Skip to content

Commit 7dfa0c4

Browse files
authored
Merge pull request #1829 from cbridgha/AddVersionlessTests
Adding tests for versionless install
2 parents 6b80ca8 + 133f23a commit 7dfa0c4

File tree

8 files changed

+272
-8
lines changed

8 files changed

+272
-8
lines changed

liberty-maven-plugin/src/it/kernel-install-feature-test/base-install-feature-test/src/test/java/net/wasdev/wlp/test/feature/it/BaseInstallFeature.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515
*******************************************************************************/
1616
package net.wasdev.wlp.test.feature.it;
1717

18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertTrue;
20+
1821
import java.io.File;
19-
import java.io.FilenameFilter;
20-
import io.openliberty.tools.common.plugins.util.InstallFeatureUtil;
2122
import java.io.FileInputStream;
23+
import java.io.FilenameFilter;
2224
import java.io.InputStream;
2325
import java.io.InputStreamReader;
2426
import java.util.Scanner;
2527
import java.util.Set;
2628

27-
import static org.junit.Assert.assertEquals;
28-
import static org.junit.Assert.assertTrue;
2929
import org.junit.Before;
3030

31-
public class BaseInstallFeature {
31+
import io.openliberty.tools.common.plugins.util.InstallFeatureUtil;
3232

33-
protected File[] features;
33+
public class BaseInstallFeature {
34+
35+
protected File[] features;
3436

3537
@Before
3638
public void setUp() throws Exception {
@@ -77,8 +79,13 @@ protected String getFeatureInfo() throws Exception {
7779
return InstallFeatureUtil.productInfo(installDirectory, "featureInfo");
7880
}
7981

82+
8083
public boolean buildLogCheckForInstalledFeatures(String testname, String msg, Set<String> installedFeatures) throws Exception {
81-
File buildLog = new File("../../build.log");
84+
85+
File buildLog = new File("../build.log");
86+
if (!buildLog.exists()) {
87+
buildLog = new File("../../build.log");
88+
}
8289
assertTrue(buildLog.exists());
8390
boolean foundTestName = false;
8491

@@ -105,5 +112,5 @@ public boolean buildLogCheckForInstalledFeatures(String testname, String msg, Se
105112

106113
return false;
107114
}
108-
115+
109116
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>io.openliberty.tools.it</groupId>
8+
<artifactId>kernel-install-feature-tests</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>install-features-versionless-server-it</artifactId>
13+
<packaging>jar</packaging>
14+
15+
<build>
16+
<plugins>
17+
<plugin>
18+
<groupId>io.openliberty.tools</groupId>
19+
<artifactId>liberty-maven-plugin</artifactId>
20+
<version>@pom.version@</version>
21+
<configuration>
22+
<assemblyArtifact>
23+
<groupId>${runtimeGroupId}</groupId>
24+
<artifactId>${runtimeKernelId}</artifactId>
25+
<version>${runtimeVersion}</version>
26+
<type>zip</type>
27+
</assemblyArtifact>
28+
<serverName>test</serverName>
29+
<serverXmlFile>src/test/resources/server.xml</serverXmlFile>
30+
</configuration>
31+
<executions>
32+
<execution>
33+
<id>install-liberty-server</id>
34+
<phase>compile</phase>
35+
<goals>
36+
<goal>install-server</goal>
37+
</goals>
38+
</execution>
39+
<execution>
40+
<id>create-server</id>
41+
<phase>pre-integration-test</phase>
42+
<goals>
43+
<goal>create</goal>
44+
</goals>
45+
</execution>
46+
<execution>
47+
<id>install-server-features</id>
48+
<phase>pre-integration-test</phase>
49+
<goals>
50+
<goal>install-feature</goal>
51+
</goals>
52+
<configuration>
53+
<features>
54+
<acceptLicense>true</acceptLicense>
55+
</features>
56+
</configuration>
57+
</execution>
58+
<execution>
59+
<id>install-server-features-again</id>
60+
<phase>pre-integration-test</phase>
61+
<goals>
62+
<goal>install-feature</goal>
63+
</goals>
64+
<configuration>
65+
<features>
66+
<acceptLicense>true</acceptLicense>
67+
</features>
68+
</configuration>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
</plugins>
73+
</build>
74+
75+
</project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*******************************************************************************
2+
* (c) Copyright IBM Corporation 2018.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
package net.wasdev.wlp.test.feature.it;
17+
18+
import static org.junit.Assert.*;
19+
import org.junit.Test;
20+
import java.io.File;
21+
22+
public class InstallFeaturesVersionlessServerTest extends BaseInstallFeature {
23+
24+
@Test
25+
public void testInstalledFeatures() throws Exception {
26+
27+
28+
assertInstalled("appSecurityClient-1.0");
29+
assertInstalled("servlet");
30+
assertInstalled("servlet-4.0");
31+
assertNotInstalled("beanValidation-2.0");
32+
assertNotInstalled("couchdb-1.0");
33+
assertNotInstalled("distributedMap-1.0");
34+
}
35+
36+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<server description="default server">
2+
<featureManager>
3+
<feature>appSecurityClient-1.0</feature>
4+
<feature>servlet</feature>
5+
<platform>javaee-8.0</platform>
6+
</featureManager>
7+
</server>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>io.openliberty.tools.it</groupId>
8+
<artifactId>kernel-install-feature-tests</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>install-features-versionless-with-versioned-server-it</artifactId>
13+
<packaging>jar</packaging>
14+
15+
<build>
16+
<plugins>
17+
<plugin>
18+
<groupId>io.openliberty.tools</groupId>
19+
<artifactId>liberty-maven-plugin</artifactId>
20+
<version>@pom.version@</version>
21+
<configuration>
22+
<assemblyArtifact>
23+
<groupId>${runtimeGroupId}</groupId>
24+
<artifactId>${runtimeKernelId}</artifactId>
25+
<version>${runtimeVersion}</version>
26+
<type>zip</type>
27+
</assemblyArtifact>
28+
<serverName>test</serverName>
29+
<serverXmlFile>src/test/resources/server.xml</serverXmlFile>
30+
</configuration>
31+
<executions>
32+
<execution>
33+
<id>install-liberty-server</id>
34+
<phase>compile</phase>
35+
<goals>
36+
<goal>install-server</goal>
37+
</goals>
38+
</execution>
39+
<execution>
40+
<id>create-server</id>
41+
<phase>pre-integration-test</phase>
42+
<goals>
43+
<goal>create</goal>
44+
</goals>
45+
</execution>
46+
<execution>
47+
<id>install-server-features</id>
48+
<phase>pre-integration-test</phase>
49+
<goals>
50+
<goal>install-feature</goal>
51+
</goals>
52+
<configuration>
53+
<features>
54+
<acceptLicense>true</acceptLicense>
55+
</features>
56+
</configuration>
57+
</execution>
58+
</executions>
59+
</plugin>
60+
</plugins>
61+
</build>
62+
63+
</project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*******************************************************************************
2+
* (c) Copyright IBM Corporation 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
package net.wasdev.wlp.test.feature.it;
17+
18+
import static org.junit.Assert.*;
19+
import org.junit.Test;
20+
import java.io.File;
21+
import java.util.Set;
22+
import java.util.HashSet;
23+
24+
public class InstallFeaturesVersionlessWithVersionedServerTest extends BaseInstallFeature {
25+
26+
@Test
27+
public void testInstalledFeatures() throws Exception {
28+
29+
30+
assertInstalled("beanValidation");
31+
assertInstalled("jsp");
32+
assertInstalled("enterpriseBeans-4.0");
33+
assertInstalled("ejb");
34+
assertInstalled("jdbc");
35+
assertInstalled("servlet-5.0");
36+
37+
Set<String> expectedFeatures = new HashSet<String>();
38+
expectedFeatures.add("jdbc");
39+
expectedFeatures.add("enterpriseBeansRemote-4.0");
40+
expectedFeatures.add("jsp");
41+
expectedFeatures.add("connectors-2.0");
42+
expectedFeatures.add("enterpriseBeansPersistentTimer-4.0");
43+
expectedFeatures.add("enterpriseBeansLite-4.0");
44+
expectedFeatures.add("xmlBinding-3.0");
45+
expectedFeatures.add("mdb-4.0");
46+
expectedFeatures.add("jdbc-4.2");
47+
expectedFeatures.add("enterpriseBeans-4.0");
48+
expectedFeatures.add("expressionLanguage-4.0");
49+
expectedFeatures.add("pages-3.0");
50+
expectedFeatures.add("beanValidation-3.0");
51+
expectedFeatures.add("beanValidation");
52+
expectedFeatures.add("servlet-5.0");
53+
expectedFeatures.add("jndi-1.0");
54+
expectedFeatures.add("ejb");
55+
expectedFeatures.add("enterpriseBeansHome-4.0");
56+
57+
assertTrue(buildLogCheckForInstalledFeatures("io.openliberty.tools.it:install-features-versionless-with-versioned-server-it", "The following features have been installed:", expectedFeatures));
58+
59+
60+
61+
62+
63+
}
64+
65+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<server description="default server">
2+
<featureManager>
3+
<feature>beanValidation</feature>
4+
<feature>servlet-5.0</feature>
5+
<feature>jsp</feature>
6+
<feature>ejb</feature>
7+
<feature>jdbc</feature>
8+
</featureManager>
9+
</server>

liberty-maven-plugin/src/it/kernel-install-feature-test/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
<module>install-features-pluginlist-it</module>
3838
<module>install-features-server-already-installed-lowercase-it</module>
3939
<module>install-features-server-it</module>
40+
<module>install-features-versionless-server-it</module>
41+
<module>install-features-versionless-with-versioned-server-it</module>
4042
<module>install-ol-features-no-accept-license-it</module>
4143
<module>prepare-feature-it</module>
4244
<module>prepare-multiple-features-it</module>

0 commit comments

Comments
 (0)