-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add negative tests for versionless feature support
- Loading branch information
1 parent
85242ee
commit 045e535
Showing
9 changed files
with
282 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...-plugin/src/it/kernel-install-versionless-feature-fail-bad-platform-it/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.buildResult = failure |
110 changes: 110 additions & 0 deletions
110
liberty-maven-plugin/src/it/kernel-install-versionless-feature-fail-bad-platform-it/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.openliberty.tools.it</groupId> | ||
<artifactId>tests</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>kernel-install-versionless-feature-fail-bad-platform-it</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.8.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.openliberty.tools</groupId> | ||
<artifactId>liberty-maven-plugin</artifactId> | ||
<version>@pom.version@</version> | ||
<configuration> | ||
<assemblyArtifact> | ||
<groupId>${runtimeGroupId}</groupId> | ||
<artifactId>${runtimeKernelId}</artifactId> | ||
<version>${runtimeVersion}</version> | ||
<type>zip</type> | ||
</assemblyArtifact> | ||
<serverName>test</serverName> | ||
<serverXmlFile>src/test/resources/server.xml</serverXmlFile> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>install-liberty-server</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>install-server</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>create-server</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>create</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>install-feature</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>install-feature</goal> | ||
</goals> | ||
<configuration> | ||
<features> | ||
<acceptLicense>true</acceptLicense> | ||
</features> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>3.1.2</version> | ||
<configuration> | ||
<workingDirectory>${project.build.directory}</workingDirectory> | ||
<argLine>-enableassertions</argLine> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>integration-test</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>verify</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.1.2</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
7 changes: 7 additions & 0 deletions
7
.../it/kernel-install-versionless-feature-fail-bad-platform-it/src/test/resources/server.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<server description="default server"> | ||
<featureManager> | ||
<feature>appSecurityClient-1.0</feature> | ||
<feature>jaxws</feature> | ||
<platform>badname</platform> | ||
</featureManager> | ||
</server> |
1 change: 1 addition & 0 deletions
1
...n-plugin/src/it/kernel-install-versionless-feature-fail-no-platform-it/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.buildResult = failure |
110 changes: 110 additions & 0 deletions
110
liberty-maven-plugin/src/it/kernel-install-versionless-feature-fail-no-platform-it/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.openliberty.tools.it</groupId> | ||
<artifactId>tests</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>kernel-install-versionless-feature-fail-no-platform-it</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.8.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.openliberty.tools</groupId> | ||
<artifactId>liberty-maven-plugin</artifactId> | ||
<version>@pom.version@</version> | ||
<configuration> | ||
<assemblyArtifact> | ||
<groupId>${runtimeGroupId}</groupId> | ||
<artifactId>${runtimeKernelId}</artifactId> | ||
<version>${runtimeVersion}</version> | ||
<type>zip</type> | ||
</assemblyArtifact> | ||
<serverName>test</serverName> | ||
<serverXmlFile>src/test/resources/server.xml</serverXmlFile> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>install-liberty-server</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>install-server</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>create-server</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>create</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>install-feature</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>install-feature</goal> | ||
</goals> | ||
<configuration> | ||
<features> | ||
<acceptLicense>true</acceptLicense> | ||
</features> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>3.1.2</version> | ||
<configuration> | ||
<workingDirectory>${project.build.directory}</workingDirectory> | ||
<argLine>-enableassertions</argLine> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>integration-test</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>verify</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.1.2</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
6 changes: 6 additions & 0 deletions
6
...c/it/kernel-install-versionless-feature-fail-no-platform-it/src/test/resources/server.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<server description="default server"> | ||
<featureManager> | ||
<feature>appSecurityClient-1.0</feature> | ||
<feature>servlet</feature> | ||
</featureManager> | ||
</server> |
38 changes: 38 additions & 0 deletions
38
liberty-maven-plugin/src/test/resources/checkErrorVersionlessFeature.bsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//Check build.log content for certain tests | ||
boolean flag = false; | ||
String testname = basedir.getName(); | ||
String expectedMessage = null; | ||
switch (testname) { | ||
case "kernel-install-versionless-feature-fail-bad-platform-it": | ||
expectedMessage = "CWWKF1515E: The badname platform could not be found."; | ||
break; | ||
case "kernel-install-versionless-feature-fail-no-platform-it": | ||
expectedMessage = "CWWKF1516E: The platform could not be determined. The following versionless features cannot be installed: [servlet]"; | ||
break; | ||
default: | ||
return false; | ||
} | ||
File buildlog = new File(basedir,"build.log"); | ||
if (buildlog.exists()) { | ||
try { | ||
InputStream buildOutput = new FileInputStream(buildlog); | ||
InputStreamReader in = new InputStreamReader(buildOutput); | ||
java.util.Scanner s = new java.util.Scanner(in); | ||
while (s.hasNextLine() && !flag) { | ||
String line = s.nextLine(); | ||
if (line.contains(expectedMessage)) { | ||
flag = true; | ||
System.out.println("Correct error message found for test "+testname); | ||
} | ||
} | ||
s.close(); | ||
in.close(); | ||
buildOutput.close(); | ||
} catch (Exception e) { | ||
System.out.println("Error checking build.log " + e.getMessage()); | ||
} | ||
} | ||
if (!flag) { | ||
System.out.println("FAILED: Expected error message ("+expectedMessage+") not found in "+buildlog.getAbsolutePath()); | ||
} | ||
return flag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
//If need to check build.log for error message, call script | ||
boolean flag = true; | ||
if (basedir.getName().contains("versionless-feature-fail-")) { | ||
String errorScript = new File(basedir, "checkErrorVersionlessFeature.bsh").getAbsolutePath(); | ||
System.out.println("Running post-build script: "+ errorScript); | ||
flag = source(errorScript); | ||
} | ||
//Runs clean in the test project directory | ||
Runtime.getRuntime().exec("../../../../mvnw clean", null, basedir); | ||
System.out.println("Cleaned target dir(s) for " + basedir); | ||
return true; | ||
return flag; |