Skip to content

Commit

Permalink
feat: Polarion 2410 support
Browse files Browse the repository at this point in the history
Refs: #276
  • Loading branch information
grigoriev committed Oct 25, 2024
1 parent 172ea07 commit 23a45a6
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 27 deletions.
70 changes: 47 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,52 @@
<skipJavaScriptTests>${skipTests}</skipJavaScriptTests>
</properties>

<profiles>
<!-- deprecated profile: polarion2310 -->
<profile>
<id>polarion2310</id>
<properties>
<velocity-engine-core.artifactId>velocity-engine-core-2.3</velocity-engine-core.artifactId>
</properties>
</profile>

<!-- deprecated profile: polarion2404 -->
<profile>
<id>polarion2404</id>
<properties>
<velocity-engine-core.artifactId>velocity-engine-core-2.3</velocity-engine-core.artifactId>
</properties>
</profile>

<profile>
<id>polarion2410</id>
<properties>
<velocity-engine-core.artifactId>org.apache.velocity.engine-core_2.3.0</velocity-engine-core.artifactId>
</properties>
</profile>

<profile>
<id>tests-with-weasyprint-docker</id>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!-- hide unwanted exceptions logging -->
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemPropertyVariables>
<wpExporterImpl>docker</wpExporterImpl>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>ch.sbb.polarion.extensions</groupId>
Expand All @@ -84,7 +130,7 @@

<dependency>
<groupId>com.polarion.thirdparty</groupId>
<artifactId>velocity-engine-core-2.3</artifactId>
<artifactId>${velocity-engine-core.artifactId}</artifactId>
<version>${polarion.version}</version>
<scope>provided</scope>
</dependency>
Expand Down Expand Up @@ -270,26 +316,4 @@
</plugins>
</build>

<profiles>
<profile>
<id>tests-with-weasyprint-docker</id>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!-- hide unwanted exceptions logging -->
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemPropertyVariables>
<wpExporterImpl>docker</wpExporterImpl>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.polarion.core.util.logging.Logger;
import com.polarion.platform.service.repository.IRepositoryReadOnlyConnection;
import com.polarion.subterra.base.location.ILocation;
import com.polarion.subterra.base.location.Location;
import org.jetbrains.annotations.NotNull;

import javax.ws.rs.InternalServerErrorException;
Expand All @@ -24,6 +23,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
Expand Down Expand Up @@ -151,15 +151,14 @@ public String persistTemplateImage(String template, String scope, String imageFi
}
}

@SuppressWarnings("unchecked")
public void deleteCoverPageImages(String coverPageName, String scope) {
String uuid = getIdByName(scope, true, coverPageName);
ILocation coverPageFolderLocation = ScopeUtils.getContextLocation(scope).append(getSettingsFolder());
final IRepositoryReadOnlyConnection readOnlyConnection = pdfExporterPolarionService.getReadOnlyConnection(coverPageFolderLocation);
List<Location> subLocations = readOnlyConnection.getSubLocations(coverPageFolderLocation, false);
List<ILocation> subLocations = readOnlyConnection.getSubLocations(coverPageFolderLocation, false);
subLocations.forEach(location -> {
String locationFileName = location.getLastComponent();
if (locationFileName.startsWith(uuid) && imageExtensions.contains(locationFileName.substring(locationFileName.lastIndexOf(".")))) {
if (locationFileName.startsWith(Objects.requireNonNull(uuid)) && imageExtensions.contains(locationFileName.substring(locationFileName.lastIndexOf(".")))) {
getSettingsService().delete(location);
}
});
Expand Down

0 comments on commit 23a45a6

Please sign in to comment.