Skip to content

Commit

Permalink
Merge pull request #1233 from jjiwooLim/prepare-feature-test
Browse files Browse the repository at this point in the history
Prepare feature test
  • Loading branch information
cherylking authored Nov 1, 2021
2 parents 26abcc3 + b0e14c1 commit 13e8985
Show file tree
Hide file tree
Showing 14 changed files with 760 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?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>kernel-install-feature-tests</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>install-usr-feature-ext-it</artifactId>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${user.home}/.m2/repository/test/user/test/features/features-bom/19.0.0.8</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>features-bom-19.0.0.8.pom</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resource-two</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${user.home}/.m2/repository/test/user/test/features/testesa1/19.0.0.8</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>testesa1-19.0.0.8.esa</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resource-three</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${project.build.directory}/liberty/wlp/etc/extensions</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>testExt.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>@pom.version@</version>
<configuration>
<assemblyArtifact>
<groupId>${runtimeGroupId}</groupId>
<artifactId>${runtimeKernelId}</artifactId>
<!-- this goal is only available with ol 21.0.0.11 or later -->
<version>21.0.0.11</version>
<type>zip</type>
</assemblyArtifact>
</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>prepare-feature</id>
<phase>prepare-package</phase>
<goals>
<goal>prepare-feature</goal>
</goals>
<configuration>
<features>
<acceptLicense>true</acceptLicense>
<feature>testesa1</feature>
</features>
</configuration>
</execution>
<execution>
<id>install-feature</id>
<phase>prepare-package</phase>
<goals>
<goal>install-feature</goal>
</goals>
<configuration>
<features>
<acceptLicense>true</acceptLicense>
<to>testExt</to>
<feature>testesa1</feature>
</features>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>test.user.test.features</groupId>
<artifactId>features-bom</artifactId>
<version>19.0.0.8</version>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*******************************************************************************
* (c) Copyright IBM Corporation 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package net.wasdev.wlp.test.feature.it;

import static junit.framework.Assert.*;
import org.junit.Test;
import org.junit.AfterClass;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import java.io.FilenameFilter;

public class InstallUsrFeatureToExtTest {

static File mavenLocalRepo = new File(System.getProperty("user.home")+ "/.m2/repository");
static File userTestRepo = new File(mavenLocalRepo, "test/user/test/features");

public static boolean deleteFolder(final File directory) {
if (directory.isDirectory()) {
File[] files = directory.listFiles();
if (null != files) {
for (File file : files) {
if (file.isDirectory()) {
deleteFolder(file);
} else {
if (!file.delete()) {
file.deleteOnExit();
}
}
}
}
}
if(!directory.delete()){
directory.deleteOnExit();
return false;
}
return true;
}


@Test
public void testUsrFeatureExtInstall() throws Exception {
try {
File featureFile = new File("liberty/wlp/usr/cik/extensions/testExt/lib/features/testesa1.mf");

assert featureFile.exists() : "testesa1.mf cannot be generated";

} catch (Exception e) {
throw new AssertionError ("Fail to install user feature. "+e);
}
}


@AfterClass
public static void cleanUp() {
deleteFolder(userTestRepo);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>test.user.test.features</groupId>
<artifactId>features-bom</artifactId>
<version>19.0.0.8</version>
<packaging>pom</packaging>
<name>user features bill of materials</name>
<description>user features bill of materials</description>
<url>https://openliberty.io/</url>
<licenses>
<license>
<name>Eclipse Public License</name>
<url>https://www.eclipse.org/legal/epl-v10.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>ericglau</id>
<name>Eric Lau</name>
<email>ericglau@ca.ibm.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:OpenLiberty/open-liberty.git</connection>
<developerConnection>scm:git:git@github.com:OpenLiberty/open-liberty.git</developerConnection>
<url>git@github.com:OpenLiberty/open-liberty.git</url>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>test.user.test.features</groupId>
<artifactId>testesa1</artifactId>
<version>19.0.0.8</version>
<type>esa</type>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com.ibm.websphere.productId=testExt
com.ibm.websphere.productInstall=wlp/usr/cik/extensions/testExt
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
<module>install-features-pluginlist-it</module>
<module>install-features-server-already-installed-lowercase-it</module>
<module>install-features-server-it</module>
<module>install-ol-features-no-accept-license-it</module>
<module>install-ol-features-no-accept-license-it</module>
<module>prepare-feature-it</module>
<module>install-usr-feature-ext-it</module>
</modules>

<!-- Profiles for WLP vs OL -->
Expand Down
Loading

0 comments on commit 13e8985

Please sign in to comment.