diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fa5e2113..d36fba90 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -39,7 +39,8 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: OpenLiberty/ci.common + repository: cherylking/ci.common + ref: checkRuntimeForVersionlessFeature path: ci.common - name: Checkout ci.ant uses: actions/checkout@v3 @@ -124,7 +125,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.gradle repos to C drive run: | cp -r D:/a/ci.gradle/ci.gradle C:/ci.gradle - git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common + git clone https://github.com/cherylking/ci.common.git --branch checkRuntimeForVersionlessFeature --single-branch C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant # Cache mvn/gradle packages - name: Cache Maven packages 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..3fba6d04 100644 --- a/src/test/groovy/io/openliberty/tools/gradle/KernelInstallVersionlessFeatureTest.groovy +++ b/src/test/groovy/io/openliberty/tools/gradle/KernelInstallVersionlessFeatureTest.groovy @@ -98,9 +98,39 @@ 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")) + assertTrue(output.contains("PluginExecutionException: CWWKF1299E: The following features could not be obtained: ejb. Ensure that the features are valid for Open Liberty.")) + } + //@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 + +