From 3f98c0cea7437fc55721f6e18025a0047b27d47f Mon Sep 17 00:00:00 2001 From: gjoranv Date: Tue, 22 Oct 2019 16:46:47 +0200 Subject: Use project.version also for the dependency test bundle. - The automated build process updates the project version for all modules. - Unfortunately, this reduces the value of one of the test cases, because the versions of the dependent and dependency bundles are now the same. --- .../yahoo/container/plugin/ExportPackageVersionTest.java | 10 +++++++--- .../artifact-version-for-exports-dep/pom.xml | 16 +++++++--------- .../test-bundles/artifact-version-for-exports/pom.xml | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java index 46f8dd61576..66f36e32f39 100644 --- a/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java +++ b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java @@ -22,12 +22,15 @@ import static org.junit.Assert.assertThat; public class ExportPackageVersionTest { private static Attributes mainAttributes; + private static String bundleVersion; @BeforeClass public static void setup() { try { File componentJar = findBundleJar("artifact-version-for-exports"); mainAttributes = new JarFile(componentJar).getManifest().getMainAttributes(); + bundleVersion = mainAttributes.getValue("Bundle-Version"); + } catch (IOException e) { throw new RuntimeException(e); } @@ -36,7 +39,6 @@ public class ExportPackageVersionTest { @Test public void artifact_version_without_qualifier_is_used_as_export_version() { // Bundle-Version is artifact version without qualifier - String bundleVersion = mainAttributes.getValue("Bundle-Version"); String expectedExport = "ai.vespa.noversion;version=" + bundleVersion; String exportPackage = mainAttributes.getValue("Export-Package"); @@ -55,8 +57,10 @@ public class ExportPackageVersionTest { @Test public void artifact_version_of_dependency_is_used_as_export_version_for_package_in_compile_scoped_dependency() { String exportPackage = mainAttributes.getValue("Export-Package"); - // Verify against the artifact version from the test bundle's pom. - assertThat(exportPackage, containsString("ai.vespa.noversion_dep;version=3.2.1")); + + // TODO: This test should have checked for a fixed version of the dependency bundle, different than the main bundle version. + // See comment in the dependency bundle's pom.xml for why this is not the case. + assertThat(exportPackage, containsString("ai.vespa.noversion_dep;version=" + bundleVersion)); } @Test diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml index e958618472b..34b250ae927 100644 --- a/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml +++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml @@ -12,26 +12,24 @@ ../pom.xml artifact-version-for-exports-dep - 3.2.1 + + 7-SNAPSHOT container-plugin - - com.yahoo.vespa - container-dev - ${project.parent.version} - provided - com.yahoo.vespa bundle-plugin - ${project.parent.version} + ${project.version} true true - ${project.parent.version} + ${project.version} diff --git a/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml b/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml index ac7263c8846..619189cd874 100644 --- a/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml +++ b/bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml @@ -18,7 +18,7 @@ com.yahoo.vespa.bundle-plugin artifact-version-for-exports-dep - 3.2.1 + ${project.version} -- cgit v1.2.3