Skip to content

Commit

Permalink
Merge pull request #907 from cherylking/updateVersionlessFeatureTest
Browse files Browse the repository at this point in the history
Add test methods for versionless feature on older runtime
  • Loading branch information
cherylking authored Sep 14, 2024
2 parents 1bd05b9 + aff03f8 commit c3b3c16
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<server description="default server">
<featureManager>
<feature>servlet-4.0</feature>
<platform>javaee-8.0</platform>
</featureManager>
</server>

0 comments on commit c3b3c16

Please sign in to comment.