summaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2019-10-22 16:46:47 +0200
committergjoranv <gv@verizonmedia.com>2019-10-23 17:06:02 +0200
commiteb182bfea2182d35994cbf5ca3d0ea0ec600379c (patch)
treec31ae462915bcb12a241e4578140f4612ae41e6c /bundle-plugin-test
parent23cb74eef6fef77964d5e5e2b0ee9dd2387f8f8e (diff)
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.
Diffstat (limited to 'bundle-plugin-test')
-rw-r--r--bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/ExportPackageVersionTest.java10
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports-dep/pom.xml16
-rw-r--r--bundle-plugin-test/test-bundles/artifact-version-for-exports/pom.xml2
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 @@
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>artifact-version-for-exports-dep</artifactId>
- <version>3.2.1</version>
+ <!-- TODO: Should use a fixed version different than the dependent bundle.
+ But version is set to the release version by build scripts before building.
+ Then, the dependent bundle will not find the artifact. Skipping this step for a sub-module seems
+ impossible with the maven-versions-plugin, and cumbersome with factorylib. -->
+ <version>7-SNAPSHOT</version>
<packaging>container-plugin</packaging>
<dependencies>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>container-dev</artifactId>
- <version>${project.parent.version}</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.yahoo.vespa</groupId>
<artifactId>bundle-plugin</artifactId>
- <version>${project.parent.version}</version>
+ <version>${project.version}</version>
<extensions>true</extensions>
<configuration>
<useArtifactVersionForExportPackages>true</useArtifactVersionForExportPackages>
- <configGenVersion>${project.parent.version}</configGenVersion>
+ <configGenVersion>${project.version}</configGenVersion>
</configuration>
</plugin>
</plugins>
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 @@
<dependency>
<groupId>com.yahoo.vespa.bundle-plugin</groupId>
<artifactId>artifact-version-for-exports-dep</artifactId>
- <version>3.2.1</version>
+ <version>${project.version}</version>
</dependency>
</dependencies>
<build>