From dc3248336f1e9ddb2bd09213c2aa6030889be2e0 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Tue, 7 Jan 2025 16:44:40 +0100 Subject: [PATCH] feat: support only WeasyPrint Service v63.1.0 Refs: #300 --- .../service/PdfExporterPolarionService.java | 16 +++++++--------- src/main/resources/versions.properties | 2 +- .../service/PdfExporterPolarionServiceTest.java | 14 ++++++-------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/main/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionService.java b/src/main/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionService.java index 9ce868be..8f2c8a72 100644 --- a/src/main/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionService.java +++ b/src/main/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionService.java @@ -190,15 +190,13 @@ private boolean sameDocument(@Nullable String projectId, @NotNull String spaceId .toList(); for (IModule module : modules) { - String[] locationParts = module.getModuleLocation().getLocationPath().split("/"); - if (locationParts.length == 2) { - result.add(new DocumentCollectionEntry( - module.getProjectId(), - locationParts[0], - locationParts[1], - module.getRevision() - )); - } + DocumentCollectionEntry documentCollectionEntry = new DocumentCollectionEntry( + module.getProjectId(), + module.getModuleFolder(), + module.getModuleName(), + module.getRevision() + ); + result.add(documentCollectionEntry); } return result; diff --git a/src/main/resources/versions.properties b/src/main/resources/versions.properties index b29fee41..f775d5f4 100644 --- a/src/main/resources/versions.properties +++ b/src/main/resources/versions.properties @@ -1 +1 @@ -weasyprint-service.version=62.4.6 \ No newline at end of file +weasyprint-service.version=63.1.0 diff --git a/src/test/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionServiceTest.java b/src/test/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionServiceTest.java index 213e6145..5071b320 100644 --- a/src/test/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionServiceTest.java +++ b/src/test/java/ch/sbb/polarion/extension/pdf_exporter/service/PdfExporterPolarionServiceTest.java @@ -248,18 +248,16 @@ void testGetDocumentsFromCollection() { IModule mockModule1 = mock(IModule.class); IModule mockModule2 = mock(IModule.class); - ILocation mockLocation1 = mock(ILocation.class); - ILocation mockLocation2 = mock(ILocation.class); - - when(mockModule1.getModuleLocation()).thenReturn(mockLocation1); + when(mockModule1.getProjectId()).thenReturn(projectId); + when(mockModule1.getModuleFolder()).thenReturn("space 1"); + when(mockModule1.getModuleName()).thenReturn("test Module1"); when(mockModule1.getRevision()).thenReturn("1"); - when(mockModule2.getModuleLocation()).thenReturn(mockLocation2); + when(mockModule2.getProjectId()).thenReturn(projectId); + when(mockModule2.getModuleFolder()).thenReturn("_default"); + when(mockModule2.getModuleName()).thenReturn("test Module2"); when(mockModule2.getRevision()).thenReturn("2"); - when(mockLocation1.getLocationPath()).thenReturn("space 1/test Module1"); - when(mockLocation2.getLocationPath()).thenReturn("_default/test Module2"); - IBaselineCollectionElement mockElement1 = mock(IBaselineCollectionElement.class); IBaselineCollectionElement mockElement2 = mock(IBaselineCollectionElement.class);