diff --git a/build.gradle b/build.gradle index 1fe233e5..ca2e8d4d 100644 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,7 @@ compileTestGroovy { targetCompatibility = JavaVersion.VERSION_1_8 } -def libertyAntVersion = "1.9.15" +def libertyAntVersion = "1.9.16-SNAPSHOT" def libertyCommonVersion = "1.8.34-SNAPSHOT" dependencies { diff --git a/src/test/groovy/io/openliberty/tools/gradle/KernelInstallVersionlessFeatureTest.groovy b/src/test/groovy/io/openliberty/tools/gradle/KernelInstallVersionlessFeatureTest.groovy index 95614fe1..9a25b860 100644 --- a/src/test/groovy/io/openliberty/tools/gradle/KernelInstallVersionlessFeatureTest.groovy +++ b/src/test/groovy/io/openliberty/tools/gradle/KernelInstallVersionlessFeatureTest.groovy @@ -98,9 +98,42 @@ class KernelInstallVersionlessFeatureTest extends AbstractIntegrationTest{ assertTrue(output.contains("CWWKF1516E: The platform could not be determined. The following versionless features cannot be installed: [ejb].")) } + @Test + /** + * Install with only server.xml features + */ + public void testInstallVersionedFeatureWithPlatformServerOldRelease() { + copyBuildFiles(new File(resourceDir, "install_features_server_old_release.gradle"), buildDir) + runTasks(buildDir, "libertyCreate") + copyServer("server_versioned_feature_with_platform.xml") + // expect failure - check for error message + BuildResult result = runTasksFailResult(buildDir, "installFeature") + String output = result.getOutput() + assertTrue(output.contains("PluginExecutionException: Detected versionless feature(s) for installation. The minimum required Liberty version for versionless feature support is 24.0.0.8")) + } + + @Test + /** + * Install with only server.xml features + */ + public void testInstallVersionlessFeaturesNoPlatformServerOldRelease() { + copyBuildFiles(new File(resourceDir, "install_features_server_old_release.gradle"), buildDir) + runTasks(buildDir, "libertyCreate") + copyServer("server_versionless_feature_no_platform.xml") + // expect failure - check for error message + BuildResult result = runTasksFailResult(buildDir, "installFeature") + String output = result.getOutput() + assertTrue(output.contains("Detected possible versionless feature(s) for installation. The minimum required Liberty version for versionless feature support is 24.0.0.8")) + + String messageWL = "PluginExecutionException: CWWKF1203E: Unable to obtain the following features: ejb. Ensure that the features are valid." + String messageOL = "PluginExecutionException: CWWKF1299E: The following features could not be obtained: ejb. Ensure that the features are valid for Open Liberty." + assertTrue(output.contains(messageOL) || output.contains(messageWL)) + } + //@Test // Commented out because current failure returns // "Cannot invoke "com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition.getSymbolicName()" because the return value of "java.util.HashMap.get(Object)" is null" + // Opened issue https://github.com/OpenLiberty/ci.common/issues/452 to follow up. /** * Install with only server.xml features */ diff --git a/src/test/resources/kernel-install-versionless-feature-test/install_features_server_old_release.gradle b/src/test/resources/kernel-install-versionless-feature-test/install_features_server_old_release.gradle new file mode 100644 index 00000000..0186f78b --- /dev/null +++ b/src/test/resources/kernel-install-versionless-feature-test/install_features_server_old_release.gradle @@ -0,0 +1,32 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + maven { + name = 'Sonatype Nexus Snapshots' + url = 'https://oss.sonatype.org/content/repositories/snapshots/' + } + } + dependencies { + classpath "io.openliberty.tools:liberty-gradle-plugin:$lgpVersion" + } +} + +apply plugin: 'liberty' + +repositories { + mavenCentral() +} + +dependencies { + // Runtime set to older version on purpose before versionless feature support was added + libertyRuntime group: runtimeGroup, name: kernelArtifactId, version: '24.0.0.6' +} + +liberty { + server{ + features { + acceptLicense = true + } + } +} diff --git a/src/test/resources/kernel-install-versionless-feature-test/server_versioned_feature_with_platform.xml b/src/test/resources/kernel-install-versionless-feature-test/server_versioned_feature_with_platform.xml new file mode 100644 index 00000000..abfec5da --- /dev/null +++ b/src/test/resources/kernel-install-versionless-feature-test/server_versioned_feature_with_platform.xml @@ -0,0 +1,6 @@ + + + servlet-4.0 + javaee-8.0 + +