diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8f826f3..7681b94 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,10 @@ jobs: with: java-version: '11' distribution: 'adopt' + - name: Test package + run: mvn --batch-mode test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish package run: mvn --batch-mode deploy -DskipTests env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 93bbe82..d64392b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,24 @@ -# eForms Notice Viewer 0.9.0 - Release Notes +# eForms Notice Viewer 0.10.0 - Release Notes _The eForms Notice Viewer is a sample command line application that demonstrates how you can use the [eForms SDK](https://github.com/OP-TED/eForms-SDK) in a metadata driven application that visualises eForms notices._ --- -## In this release: -This is the first version of the Notice Viewer, that uses the new, pre-release version 2.0.0-alpha.1 of the EFX Toolkit. As a result, the application: +## In this release -- Now supports EFX-2 templates, and therefore can visualise notices created with SDK-2. -- Can no longer visualise notices created with pre-release versions of SDK-1 (SDK 0.x.x). +This version of the Notice Viewer, uses the pre-release version 2.0.0-alpha.2 of the EFX Toolkit. + +This release: + +- Fixes a bug in label_from_key.ftl that caused erroneous rendering of some labels. +- Updates variable_expression.ftl to render a comma separated list from sequences of values. +- Improves unit testing. --- Documentation for this sample application is available at: https://docs.ted.europa.eu/eforms/latest/notice-viewer This version depends on: - - [EFX toolkit for Java](https://github.com/OP-TED/efx-toolkit-java) version 2.0.0-alpha.1. - - [eForms Core for Java](https://github.com/OP-TED/eforms-core-java) library version 1.0.5. + +- [EFX toolkit for Java](https://github.com/OP-TED/efx-toolkit-java) version 2.0.0-alpha.2. +- [eForms Core for Java](https://github.com/OP-TED/eforms-core-java) library version 1.3.0. diff --git a/pom.xml b/pom.xml index 69b6780..497890f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ eu.europa.ted.eforms eforms-notice-viewer - 0.9.0 + 0.10.0 eForms Notice Viewer eForms Notice Viewer sample application. @@ -44,7 +44,7 @@ - 2023-01-31T18:22:58Z + 2023-07-31T09:34:21Z UTF-8 @@ -54,8 +54,8 @@ ${java.version} - 2.0.0-alpha.1 - 1.0.5 + 2.0.0-alpha.2 + 1.3.0 4.9.3 @@ -315,6 +315,9 @@ maven-surefire-plugin ${version.surefire.plugin} + + -Duser.country=BE + maven-install-plugin diff --git a/src/main/java/eu/europa/ted/eforms/viewer/DependencyFactory.java b/src/main/java/eu/europa/ted/eforms/viewer/DependencyFactory.java index cbda144..910477a 100644 --- a/src/main/java/eu/europa/ted/eforms/viewer/DependencyFactory.java +++ b/src/main/java/eu/europa/ted/eforms/viewer/DependencyFactory.java @@ -13,19 +13,36 @@ import eu.europa.ted.efx.interfaces.TranslatorOptions; public class DependencyFactory implements TranslatorDependencyFactory { - private Path sdkRoot; - - @SuppressWarnings("unused") - private DependencyFactory() {} + final private Path sdkRoot; + final private boolean sdkSnapshotsAllowed; + /** + * Public constructor used by the EfxTranslator does not allow the use of + * SNAPSHOT versions of the SDK. + * + * @param sdkRoot The root directory where the SDK will be downloaded. + */ public DependencyFactory(Path sdkRoot) { + this(sdkRoot, false); + } + + /** + * Subclasses can use this constructor to allow the use of SNAPSHOT versions of + * the SDK. + * + * @param sdkRoot The root directory where the SDK will be downloaded. + * @param resolveSnapshots If true, SNAPSHOT versions of the SDK will be + * downloaded if needed. + */ + protected DependencyFactory(Path sdkRoot, boolean resolveSnapshots) { this.sdkRoot = sdkRoot; + this.sdkSnapshotsAllowed = resolveSnapshots; } @Override public SymbolResolver createSymbolResolver(String sdkVersion) { try { - SdkDownloader.downloadSdk(sdkVersion, sdkRoot); + SdkDownloader.downloadSdk(sdkVersion, sdkRoot, this.sdkSnapshotsAllowed); return ComponentFactory.getSymbolResolver(sdkVersion, sdkRoot); } catch (InstantiationException | IOException e) { diff --git a/src/main/resources/templates/xsl_markup/label_from_key.ftl b/src/main/resources/templates/xsl_markup/label_from_key.ftl index 4fe4f5e..70bfb2d 100644 --- a/src/main/resources/templates/xsl_markup/label_from_key.ftl +++ b/src/main/resources/templates/xsl_markup/label_from_key.ftl @@ -3,9 +3,10 @@ - key: The key to use for rendering - quantity: If pluralisation is required, then this contains the suffix that identifies the plural form of the label. --> + <#if quantity?has_content> - - + + <#else> - + \ No newline at end of file diff --git a/src/main/resources/templates/xsl_markup/variable_expression.ftl b/src/main/resources/templates/xsl_markup/variable_expression.ftl index 95b691a..41b7243 100644 --- a/src/main/resources/templates/xsl_markup/variable_expression.ftl +++ b/src/main/resources/templates/xsl_markup/variable_expression.ftl @@ -2,4 +2,4 @@ Available variables: - expression: The variable expression to render --> - \ No newline at end of file + \ No newline at end of file diff --git a/src/test/java/eu/europa/ted/eforms/viewer/DependencyFactoryForUnitTesting.java b/src/test/java/eu/europa/ted/eforms/viewer/DependencyFactoryForUnitTesting.java new file mode 100644 index 0000000..39d5815 --- /dev/null +++ b/src/test/java/eu/europa/ted/eforms/viewer/DependencyFactoryForUnitTesting.java @@ -0,0 +1,14 @@ +package eu.europa.ted.eforms.viewer; + +import java.nio.file.Path; + +/** + * Extends {@link DependencyFactory} to allow the use of SNAPSHOT versions when + * unit testing. + */ +public class DependencyFactoryForUnitTesting extends DependencyFactory { + + public DependencyFactoryForUnitTesting(Path sdkRoot) { + super(sdkRoot, true); + } +} \ No newline at end of file diff --git a/src/test/java/eu/europa/ted/eforms/viewer/NoticeViewerTest.java b/src/test/java/eu/europa/ted/eforms/viewer/NoticeViewerTest.java index b4841ba..00543bc 100644 --- a/src/test/java/eu/europa/ted/eforms/viewer/NoticeViewerTest.java +++ b/src/test/java/eu/europa/ted/eforms/viewer/NoticeViewerTest.java @@ -99,7 +99,7 @@ void testEfxToXsl(String sdkVersion) throws IOException, InstantiationException final String viewId = "X02"; final Path xsl = XslGenerator.Builder - .create(new DependencyFactory(SDK_ROOT_DIR)) + .create(new DependencyFactoryForUnitTesting(SDK_ROOT_DIR)) .build() .generateFile(sdkVersion, NoticeViewer.getEfxPath(sdkVersion, viewId, SDK_ROOT_DIR), NoticeViewerConstants.DEFAULT_TRANSLATOR_OPTIONS, true); @@ -145,7 +145,7 @@ private void testGenerateHtmlFromString(final String language, final String noti Files.readString(noticeXmlPath, NoticeViewerConstants.DEFAULT_CHARSET); final Path xslPath = XslGenerator.Builder - .create(new DependencyFactory(SDK_ROOT_DIR)) + .create(new DependencyFactoryForUnitTesting(SDK_ROOT_DIR)) .build() .generateFile(sdkVersion, NoticeViewer.getEfxPath(sdkVersion, viewId, SDK_ROOT_DIR), NoticeViewerConstants.DEFAULT_TRANSLATOR_OPTIONS, true);