You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2019/10/29 20:26:28 UTC
[maven-ear-plugin] branch maven-it-extension created (now 44995bd)
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a change to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git.
at 44995bd Added comments.
This branch includes the following new commits:
new aee86f2 Maven IT Extension Test
new 85e5124 First prototype testing working.
new 66b0a96 Improved configuration. Leave only needed dependencies.
new c1da53d cleaned up.
new 48641bb Added another integration test case.
new 88b0fb1 Added some comments within the pom file to explain some of the changes.
new acbe400 Get usual unit tests back to work. Give system property about Maven version to integration tests.
new e9167d5 Added maven.home system property
new 48eceef Cleaned up. Using value makes usage of annotation DisabledForMaven easier to use.
new 44995bd Added comments.
The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-ear-plugin] 01/10: Maven IT Extension Test
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit aee86f2754068d1d47d1cb0b0d49fffc3ced64bc
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 19:56:38 2019 +0100
Maven IT Extension Test
---
pom.xml | 33 +-
src/it/packaging-excludes/verify.bsh | 2 +-
.../EARIT/basic/pom.xml | 45 +
.../application/META-INF/appserver-application.xml | 22 +
.../EARIT/packaging-excludes/pom.xml | 53 +
.../EARIT}/packaging-excludes/verify.bsh | 2 +-
.../EARIT/packaging-includes/pom.xml | 58 +
.../EARIT/resource-custom-directory/pom.xml | 49 +
.../application/APP-INF/classes/foo.properties | 18 +
.../org/apache/maven/plugins/ear/it/EARIT.java | 48 +
...MojoIT.java => EarMojoIntegrationTestings.java} | 1993 ++++++++++----------
11 files changed, 1304 insertions(+), 1019 deletions(-)
diff --git a/pom.xml b/pom.xml
index 794ea56..9def699 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,7 @@
<mavenArchiverVersion>3.2.0</mavenArchiverVersion>
<mavenFilteringVersion>3.1.1</mavenFilteringVersion>
<mavenVersion>3.0</mavenVersion>
- <javaVersion>7</javaVersion>
+ <javaVersion>8</javaVersion>
<surefire.version>2.22.1</surefire.version>
</properties>
@@ -163,6 +163,12 @@
<version>1.9.5</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.jupiter.extension</groupId>
+ <artifactId>maven-it-extension</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -217,10 +223,6 @@
<profile>
<id>run-its</id>
- <properties>
- <localRepositoryPath>${project.build.testOutputDirectory}/m2repo</localRepositoryPath>
- <localSnapshotRepositoryPath>${project.build.testOutputDirectory}/m2snapshots</localSnapshotRepositoryPath>
- </properties>
<build>
<resources>
<resource>
@@ -264,13 +266,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
- <streamLogs>true</streamLogs>
- <!-- NOTE: Must be synced with the repo path used by AbstractEarPluginIT -->
- <localRepositoryPath>${localRepositoryPath}</localRepositoryPath>
- <goals>
- <goal>clean</goal>
- <goal>package</goal>
- </goals>
+ <localRepositoryPath>${project.build.directory}/invoker-repo</localRepositoryPath>
<extraArtifacts>
<extraArtifact>org.apache.maven.plugins:maven-war-plugin:2.1.1:jar</extraArtifact>
<extraArtifact>org.apache.maven.plugins:maven-compiler-plugin:2.5.1:jar</extraArtifact>
@@ -281,21 +277,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
+ </configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
- <configuration>
- <systemPropertyVariables combine.children="append">
- <maven.home>${maven.home}</maven.home>
- <userlocalRepository>${settings.localRepository}</userlocalRepository>
- <localRepositoryPath>${localRepositoryPath}</localRepositoryPath>
- <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
- <basedirectory>${basedir}</basedirectory>
- </systemPropertyVariables>
- </configuration>
</execution>
</executions>
</plugin>
diff --git a/src/it/packaging-excludes/verify.bsh b/src/it/packaging-excludes/verify.bsh
index 3efbc16..4cc3c9c 100644
--- a/src/it/packaging-excludes/verify.bsh
+++ b/src/it/packaging-excludes/verify.bsh
@@ -45,7 +45,7 @@ for ( String included : includedEntries )
}
String[] excludedEntries = {
- "commons-lang-2.5.jar"
+ "commons-lang-commons-lang-2.5.jar"
};
for ( String excluded : excludedEntries )
{
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/pom.xml b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/pom.xml
new file mode 100644
index 0000000..cb4f225
--- /dev/null
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.ear.basic</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>ear</packaging>
+
+ <name>Maven Integration Test :: it0033</name>
+ <description>Test an EAR generation</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <generateApplicationXml>true</generateApplicationXml>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/src/main/application/META-INF/appserver-application.xml b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/src/main/application/META-INF/appserver-application.xml
new file mode 100644
index 0000000..76c25e0
--- /dev/null
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/src/main/application/META-INF/appserver-application.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<appserver-app>
+ <whatever/>
+</appserver-app>
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/pom.xml b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/pom.xml
new file mode 100644
index 0000000..8f7419e
--- /dev/null
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.ear.packagingexcludes</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>ear</packaging>
+
+ <name>Maven EAR Plugin Integration Test :: packaging excludes</name>
+ <description>Test EAR generation using packaging excludes</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <packagingExcludes>commons-lang-*.jar</packagingExcludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/packaging-excludes/verify.bsh b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/verify.bsh
similarity index 97%
copy from src/it/packaging-excludes/verify.bsh
copy to src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/verify.bsh
index 3efbc16..4cc3c9c 100644
--- a/src/it/packaging-excludes/verify.bsh
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/verify.bsh
@@ -45,7 +45,7 @@ for ( String included : includedEntries )
}
String[] excludedEntries = {
- "commons-lang-2.5.jar"
+ "commons-lang-commons-lang-2.5.jar"
};
for ( String excluded : excludedEntries )
{
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-includes/pom.xml b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-includes/pom.xml
new file mode 100644
index 0000000..c37ae70
--- /dev/null
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-includes/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.ear.packagingincludes</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>ear</packaging>
+
+ <name>Maven EAR Plugin Integration Test :: packaging includes</name>
+ <description>Test EAR generation using packaging includes</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <packagingIncludes>commons-lang-*.jar,META-INF/**</packagingIncludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/pom.xml b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/pom.xml
new file mode 100644
index 0000000..4a1b69b
--- /dev/null
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.ear.resourcecustomdirectory</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>ear</packaging>
+
+ <name>Maven EAR Plugin Integration Test :: resource custom directory</name>
+ <description>Test filtering of a custom directory</description>
+
+ <properties>
+ <filtered.value>Hello World!</filtered.value>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <filtering>true</filtering>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
new file mode 100644
index 0000000..08481f0
--- /dev/null
+++ b/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+test.property=${filtered.value}
\ No newline at end of file
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
new file mode 100644
index 0000000..eb729b7
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -0,0 +1,48 @@
+package org.apache.maven.plugins.ear.it;
+
+import static org.apache.maven.jupiter.assertj.MavenITAssertions.assertThat;
+
+import org.apache.maven.jupiter.extension.MavenIT;
+import org.apache.maven.jupiter.extension.MavenTest;
+import org.apache.maven.jupiter.extension.maven.MavenExecutionResult;
+import org.apache.maven.jupiter.extension.maven.MavenLog;
+import org.apache.maven.jupiter.extension.maven.MavenProjectResult;
+
+@MavenIT
+class EARIT {
+ @MavenTest
+ void basic(MavenExecutionResult result, MavenProjectResult project) {
+ assertThat(result).isSuccessful();
+ assertThat(project).hasTarget()
+ .withEarFile()
+ .containsOnlyOnce("META-INF/application.xml", "META-INF/appserver-application.xml");
+ }
+
+ @MavenTest
+ void packaging_includes(MavenExecutionResult result, MavenProjectResult project) {
+ assertThat(result).isSuccessful();
+ assertThat(project).hasTarget()
+ .withEarFile()
+ .doesNotContain("commons-io-1.4.jar")
+ .containsOnlyOnce("commons-lang-commons-lang-2.5.jar", "META-INF/application.xml", "META-INF/MANIFEST.MF");
+ }
+
+ @MavenTest
+ void packaging_excludes(MavenExecutionResult result, MavenProjectResult project) {
+ assertThat(result).isSuccessful();
+ assertThat(project).hasTarget()
+ .withEarFile()
+ .doesNotContain("commons-lang-commons-lang-2.5.jar")
+ .containsOnlyOnce("META-INF/application.xml", "META-INF/MANIFEST.MF");
+ }
+
+ @MavenTest
+ void resource_custom_directory(MavenExecutionResult result, MavenProjectResult project, MavenLog log) {
+ assertThat(result).isSuccessful();
+ assertThat(log).isSuccessful();
+ assertThat(project).hasTarget()
+ .withEarFile()
+ .containsOnlyOnce("META-INF/application.xml", "APP-INF/classes/foo.properties");
+ }
+
+}
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java
similarity index 97%
rename from src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
rename to src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java
index a9dcb44..0a2f558 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java
@@ -1,996 +1,997 @@
-package org.apache.maven.plugins.ear.it;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import org.apache.maven.shared.utils.io.IOUtil;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.ReaderFactory;
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class EarMojoIT
- extends AbstractEarPluginIT
-{
-
- /**
- * Builds an EAR with a single EJB and no configuration.
- * @throws Exception in case of an error.
- */
- public void testProject001()
- throws Exception
- {
- doTestProject( "project-001", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a customized artifact location and a customized artifact name.
- * @throws Exception in case of an error.
- */
- public void testProject002()
- throws Exception
- {
- doTestProject( "project-002",
- new String[] { "APP-INF/lib/eartest-ejb-sample-one-1.0.jar", "ejb-sample-two.jar" } );
- }
-
- /**
- * Builds an EAR with a default bundle directory for <tt>java</tt> modules.
- * @throws Exception in case of an error.
- */
- public void testProject003()
- throws Exception
- {
- doTestProject( "project-003", new String[] { "eartest-ejb-sample-one-1.0.jar",
- "APP-INF/lib/eartest-jar-sample-one-1.0.jar", "APP-INF/lib/eartest-jar-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a default bundle directory for _java_ modules and a custom location overriding the default.
- * @throws Exception in case of an error.
- */
- public void testProject004()
- throws Exception
- {
- doTestProject( "project-004", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar",
- "APP-INF/lib/eartest-jar-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a custom URI.
- * @throws Exception in case of an error.
- */
- public void testProject005()
- throws Exception
- {
- doTestProject( "project-005", new String[] { "eartest-ejb-sample-one-1.0.jar", "libs/another-name.jar" } );
- }
-
- /**
- * Builds an EAR with an excluded module.
- * @throws Exception in case of an error.
- */
- public void testProject006()
- throws Exception
- {
- doTestProject( "project-006",
- new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a classified artifact and no extra configuration.
- * @throws Exception in case of an error.
- */
- public void testProject007()
- throws Exception
- {
- doTestProject( "project-007", new String[] { "eartest-ejb-sample-one-1.0-classified.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for J2EE 1.3.
- * @throws Exception in case of an error.
- */
- public void testProject008()
- throws Exception
- {
- doTestProject( "project-008", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for J2EE 1.4.
- * @throws Exception in case of an error.
- */
- public void testProject009()
- throws Exception
- {
- doTestProject( "project-009", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for Java EE 5.
- * @throws Exception in case of an error.
- */
- public void testProject010()
- throws Exception
- {
- doTestProject( "project-010", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that deployment descriptor default settings are applied.
- * @throws Exception in case of an error.
- */
- public void testProject011()
- throws Exception
- {
- doTestProject( "project-011", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that EAR resources are bundled within the EAR.
- * @throws Exception in case of an error.
- */
- public void testProject012()
- throws Exception
- {
- doTestProject( "project-012", new String[] { "README.txt", "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that EAR resources in a customized resources directory are bundled within the EAR.
- * @throws Exception in case of an error.
- */
- public void testProject013()
- throws Exception
- {
- doTestProject( "project-013", new String[] { "README.txt", "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that EAR resources are bundled within the EAR using includes and excludes.
- * @throws Exception in case of an error.
- */
- public void testProject014()
- throws Exception
- {
- doTestProject( "project-014", new String[] { "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that default manifest is taken into account.
- * @throws Exception in case of an error.
- */
- public void testProject015()
- throws Exception
- {
- final File baseDir = doTestProject( "project-015", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- final File expectedManifest = new File( baseDir, "src/main/application/META-INF/MANIFEST.MF" );
- final File actualManifest = new File( getEarDirectory( baseDir, "project-015" ), "META-INF/MANIFEST.MF" );
- assertTrue( "Manifest was not copied", actualManifest.exists() );
- assertTrue( FileUtils.contentEquals( expectedManifest, actualManifest ) );
- }
-
- /**
- * Builds an EAR and make sure that custom manifest is taken into account.
- * @throws Exception in case of an error.
- */
- public void testProject016()
- throws Exception
- {
- final File baseDir = doTestProject( "project-016", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
-
- final File targetFolder = new File( baseDir, "target" );
- final File createdEarFile = new File( targetFolder, "maven-ear-plugin-test-project-016-99.0.ear" );
-
- final File sourceManifestFile = new File( baseDir, "src/main/ear/MANIFEST.MF" );
-
- JarFile jarFile = new JarFile( createdEarFile );
- Manifest manifestFromCreatedEARFile = jarFile.getManifest();
- jarFile.close();
-
- Manifest sourceManifest = new Manifest( new FileInputStream( sourceManifestFile ) );
-
- assertTrue( "There are differences in the manifest.", sourceManifest.equals( manifestFromCreatedEARFile ) );
- }
-
- /**
- * Builds an EAR and make sure that custom application.xml is taken into account.
- * @throws Exception in case of an error.
- */
- public void testProject017()
- throws Exception
- {
- doTestProject( "project-017", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a custom final name.
- * @throws Exception in case of an error.
- */
- public void testProject018()
- throws Exception
- {
- final File baseDir = executeMojo( "project-018", new Properties() );
- final File expectedFile = new File( baseDir, "target/my-custom-file.ear" );
- assertTrue( "EAR archive not found", expectedFile.exists() );
- }
-
- /**
- * Builds an EAR with unpacked archives using the unpackTypes.
- * @throws Exception in case of an error.
- */
- public void testProject019()
- throws Exception
- {
- doTestProject( "project-019", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-sar-sample-one-1.0.sar",
- "eartest-jar-sample-one-1.0.jar" }, new boolean[] { false, true, true } );
- }
-
- /**
- * Builds an EAR with unpacked archives using the unpack module attribute.
- * @throws Exception in case of an error.
- */
- public void testProject020()
- throws Exception
- {
- doTestProject( "project-020", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-sar-sample-one-1.0.sar",
- "eartest-jar-sample-one-1.0.jar" }, new boolean[] { true, false, false } );
- }
-
- /**
- * Builds an EAR with unpacked archives using both unpackTypes and the unpack module attribute.
- * @throws Exception in case of an error.
- */
- public void testProject021()
- throws Exception
- {
- doTestProject( "project-021",
- new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
- "eartest-sar-sample-one-1.0.sar", "eartest-jar-sample-one-1.0.jar",
- "eartest-jar-sample-two-1.0.jar" },
- new boolean[] { false, true, false, false, true } );
- }
-
- /**
- * Builds an EAR with a classifier.
- * @throws Exception in case of an error.
- */
- public void testProject022()
- throws Exception
- {
- final File baseDir = executeMojo( "project-022", new Properties() );
- final File expectedFile = new File( baseDir, "target/maven-ear-plugin-test-project-022-99.0-myclassifier.ear" );
- assertTrue( "EAR archive not found", expectedFile.exists() );
- }
-
- /**
- * Builds an EAR and make sure that a single classified dependency is detected without specifying the classifier.
- * @throws Exception in case of an error.
- */
- public void testProject023()
- throws Exception
- {
- doTestProject( "project-023",
- new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-two-1.0.jar" },
- new boolean[] { true, false } );
- }
-
- /**
- * Builds an EAR and make sure that a single classified dependency is detected when specifying the classifier.
- * @throws Exception in case of an error.
- */
- public void testProject024()
- throws Exception
- {
- doTestProject( "project-024",
- new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-two-1.0.jar" },
- new boolean[] { true, false } );
- }
-
- /**
- * Builds an EAR and make sure that a classified dependency with mutiple candidates is detected when specifying the
- * classifier.
- * @throws Exception in case of an error.
- */
- public void testProject025()
- throws Exception
- {
- doTestProject( "project-025",
- new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-one-1.0.jar" },
- new boolean[] { true, false } );
- }
-
- /**
- * Builds an EAR and make sure that the build fails if a unclassifed module configuration with mutiple candidates is
- * specified.
- * @throws Exception in case of an error.
- */
- public void testProject026()
- throws Exception
- {
- final File baseDir = executeMojo( "project-026", new Properties(), false );
- // Stupido, checks that the ear archive is not there
- assertFalse( "Execution should have failed", getEarArchive( baseDir, "project-026" ).exists() );
- }
-
- /**
- * Builds an EAR and make sure that provided dependencies are not included in the EAR.
- * @throws Exception in case of an error.
- */
- public void testProject027()
- throws Exception
- {
- doTestProject( "project-027", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that test dependencies are not included in the EAR.
- * @throws Exception in case of an error.
- */
- public void testProject028()
- throws Exception
- {
- doTestProject( "project-028", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that system dependencies are not included in the EAR.
- * @throws Exception in case of an error.
- */
- public void testProject029()
- throws Exception
- {
- doTestProject( "project-029", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that ejb-client dependencies are detected and not added by default in the generated
- * application.xml.
- * @throws Exception in case of an error.
- */
- public void testProject030()
- throws Exception
- {
- doTestProject( "project-030",
- new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 4 configuration specifying the security domain and the unauthenticated-principal to
- * use.
- * @throws Exception in case of an error.
- */
- public void testProject031()
- throws Exception
- {
- doTestProject( "project-031",
- new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 3.2 configuration specifying the jmx-name to use.
- * @throws Exception in case of an error.
- */
- public void testProject032()
- throws Exception
- {
- doTestProject( "project-032",
- new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 4 configuration and Jboss specific modules.
- * @throws Exception in case of an error.
- */
- public void testProject033()
- throws Exception
- {
- doTestProject( "project-033", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
- "eartest-sar-sample-one-1.0.sar", "eartest-har-sample-one-1.0.har" } );
- }
-
- /**
- * Builds an EAR with custom security settings.
- * @throws Exception in case of an error.
- */
- public void testProject034()
- throws Exception
- {
- doTestProject( "project-034",
- new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a full filename mapping and make sure that custom locations are not overridden.
- * @throws Exception in case of an error.
- */
- public void testProject035()
- throws Exception
- {
- doTestProject( "project-035",
- new String[] { "foo/eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
- "libs/eartest-jar-sample-one-1.0.jar", "libs/eartest-jar-sample-two-1.0.jar",
- "sar-sample-one.sar" } );
- }
-
- /**
- * Builds an EAR with a full filename mapping and make sure that groupIds with dots are replaced by dashes in
- * filenames.
- * @throws Exception in case of an error.
- */
- public void testProject036()
- throws Exception
- {
- doTestProject( "project-036",
- new String[] { "foo/eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
- "com.foo.bar-ejb-sample-one-1.0.jar", "com.foo.bar-ejb-sample-two-1.0.jar",
- "libs/eartest-jar-sample-one-1.0.jar", "libs/eartest-jar-sample-two-1.0.jar",
- "sar-sample-one.sar" } );
- }
-
- /**
- * Builds an EAR and make sure that ejb-client dependencies are detected and added in the generated application.xml
- * if includeInApplicationXml is set.
- * @throws Exception in case of an error.
- */
- public void testProject037()
- throws Exception
- {
- doTestProject( "project-037", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR and make sure that a non-classified dependency with mutiple candidates is detected when specifying
- * the mainArtifactId as classifier.
- * @throws Exception in case of an error.
- */
- public void testProject038()
- throws Exception
- {
- doTestProject( "project-038", new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-one-1.0.jar" },
- new boolean[] { false, true } );
- }
-
- /**
- * Builds an EAR with a Jboss 4 configuration specifying specifying the loader repository to use.
- * @throws Exception in case of an error.
- */
- public void testProject039()
- throws Exception
- {
- doTestProject( "project-039", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for Java EE 5 and an alternative deployment descriptor.
- * @throws Exception in case of an error.
- */
- public void testProject040()
- throws Exception
- {
- doTestProject( "project-040", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 4.2 configuration specifying the module order to use.
- * @throws Exception in case of an error.
- */
- public void testProject041()
- throws Exception
- {
- doTestProject( "project-041", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 4.2 configuration specifying a datasource to add.
- * @throws Exception in case of an error.
- */
- public void testProject042()
- throws Exception
- {
- doTestProject( "project-042", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting).
- * @throws Exception in case of an error.
- */
- public void testProject043()
- throws Exception
- {
- final File baseDir = doTestProject( "project-043", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- final File expectedApplicationXml = new File( baseDir, "target/custom-descriptor-dir/application.xml" );
- assertTrue( "Application.xml file not found", expectedApplicationXml.exists() );
- assertFalse( "Application.xml file should not be empty", expectedApplicationXml.length() == 0 );
- }
-
- /**
- * Builds an EAR with a custom library-directory.
- * @throws Exception in case of an error.
- */
- public void testProject044()
- throws Exception
- {
- doTestProject( "project-044", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR and filter the content of the sources directory.
- * @throws Exception in case of an error.
- */
- public void testProject045()
- throws Exception
- {
- final File baseDir = doTestProject( "project-045", new String[] { "README.txt", "eartest-ejb-sample-one-1.0.jar" } );
- final File actualReadme = new File( getEarDirectory( baseDir, "project-045" ), "README.txt" );
- final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
- assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );
- assertTrue( "Escaping did not work properly", content.contains( "will not be filtered ${application.name}." ) );
- }
-
- /**
- * Builds an EAR and filter the content of the sources directory using a custom filter file.
- * @throws Exception in case of an error.
- */
- public void testProject046()
- throws Exception
- {
- final File baseDir = doTestProject( "project-046", new String[] { "README.txt", "eartest-ejb-sample-one-1.0.jar" } );
- final File actualReadme = new File( getEarDirectory( baseDir, "project-046" ), "README.txt" );
- final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
- assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );
- assertTrue( "application build was not filtered properly", content.contains( "(Build 2)" ) );
- assertTrue( "Unknown property should not have been filtered",
- content.contains( "will not be filtered ${application.unknown}." ) );
- }
-
- /**
- * Builds an EAR and filter the content with a list of extensions.
- * @throws Exception in case of an error.
- */
- public void testProject047()
- throws Exception
- {
- final File baseDir = doTestProject( "project-047", new String[] { "README.txt", "eartest-ejb-sample-one-1.0.jar" } );
- final File actualReadme = new File( getEarDirectory( baseDir, "project-047" ), "README.txt" );
- final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
- assertTrue( "application name and version should not have been filtered", !content.contains( "my-app 99.0" ) );
- assertTrue( "original properties not found", content.contains( "${application.name} ${project.version}" ) );
- }
-
- /**
- * Builds an EAR with a Jboss 5 configuration containing library directory.
- * @throws Exception in case of an error.
- */
- public void testProject048()
- throws Exception
- {
- doTestProject( "project-048", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 4.2 configuration containing a library directory.
- * @throws Exception in case of an error.
- */
- public void testProject049()
- throws Exception
- {
- doTestProject( "project-049", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 5 configuration containing a loader repository configuration definition.
- * @throws Exception in case of an error.
- */
- public void testProject050()
- throws Exception
- {
- doTestProject( "project-050", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 5 configuration containing a loader repository class definition.
- * @throws Exception in case of an error.
- */
- public void testProject051()
- throws Exception
- {
- doTestProject( "project-051", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 5 configuration containing a configuration parser class definition.
- * @throws Exception in case of an error.
- */
- public void testProject052()
- throws Exception
- {
- doTestProject( "project-052", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a Jboss 5 configuration containing only the loader repo configuration
- * @throws Exception in case of an error.
- */
- public void testProject053()
- throws Exception
- {
- doTestProject( "project-053", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for Java EE 5 and no application.xml
- * @throws Exception in case of an error.
- */
- public void testProject054()
- throws Exception
- {
- doTestProject( "project-054", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with jar dependencies added in application.xml.
- * @throws Exception in case of an error.
- */
- public void testProject055()
- throws Exception
- {
- doTestProject( "project-055", new String[] { "eartest-jar-sample-one-1.0.jar", "eartest-jar-sample-two-1.0.jar",
- "eartest-jar-sample-three-with-deps-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for J2EE 1.4 and an alternative deployment descriptor.
- * @throws Exception in case of an error.
- */
- public void testProject056()
- throws Exception
- {
- doTestProject( "project-056", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a complete JBoss 4.2 configuration and validate it matches the DTD (MEAR-104).
- * @throws Exception in case of an error.
- */
- public void testProject057()
- throws Exception
- {
- doTestProject( "project-057", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for Java EE 6.
- * @throws Exception in case of an error.
- */
- public void testProject058()
- throws Exception
- {
- doTestProject( "project-058", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with no display name entry at all.
- * @throws Exception in case of an error.
- */
- public void testProject059()
- throws Exception
- {
- doTestProject( "project-059", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with ejb-client packaged for J2EE 1.3 (MEAR-85)
- *
- * @throws Exception in case of an error.
- */
- public void testProject060()
- throws Exception
- {
- doTestProject( "project-060", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR with ejb-client packaged for J2EE 1.4 (MEAR-85)
- *
- * @throws Exception in case of an error.
- */
- public void testProject061()
- throws Exception
- {
- doTestProject( "project-061", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR with ejb-client packaged for JavaEE 5 (MEAR-85)
- *
- * @throws Exception in case of an error.
- */
- public void testProject062()
- throws Exception
- {
- doTestProject( "project-062", new String[] { "eartest-ejb-sample-one-1.0.jar", "lib/eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR with ejb-client packaged for JavaEE 6 (MEAR-85)
- *
- * @throws Exception in case of an error.
- */
- public void testProject063()
- throws Exception
- {
- doTestProject( "project-063", new String[] { "lib/eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR with ejb-client packaged for JavaEE 5 and still put it in the root (MEAR-85)
- *
- * @throws Exception in case of an error.
- */
- public void testProject064()
- throws Exception
- {
- doTestProject( "project-064", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
- }
-
- /**
- * Builds an EAR with a custom moduleId.
- * @throws Exception in case of an error.
- */
- public void testProject065()
- throws Exception
- {
- doTestProject( "project-065", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with generateModuleId enabled.
- * @throws Exception in case of an error.
- */
- public void testProject066()
- throws Exception
- {
- doTestProject( "project-066", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with generateModuleId enabled and a custom module.
- * @throws Exception in case of an error.
- */
- public void testProject067()
- throws Exception
- {
- doTestProject( "project-067", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with the no-version file name mapping.
- * @throws Exception in case of an error.
- */
- public void testProject068()
- throws Exception
- {
- doTestProject( "project-068", new String[] { "eartest-ejb-sample-one.jar", "eartest-ejb-sample-two.jar" } );
- }
-
- /**
- * Builds an EAR with a custom library-directory and JavaEE 6.
- * @throws Exception in case of an error.
- */
- public void testProject069()
- throws Exception
- {
- doTestProject( "project-069", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with application-name and initialize-in-order tags.
- * @throws Exception in case of an error.
- */
- public void testProject070()
- throws Exception
- {
- doTestProject( "project-070", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with application-name and initialize-in-order tags for unsupported version.
- * @throws Exception in case of an error.
- */
- public void testProject071()
- throws Exception
- {
- doTestProject( "project-071", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with an application client module (app-client).
- * @throws Exception in case of an error.
- */
- public void testProject072()
- throws Exception
- {
- doTestProject( "project-072", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-app-client-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with an application client module (app-client) and a default bundle directory for _java_ modules.
- * @throws Exception in case of an error.
- */
- public void testProject073()
- throws Exception
- {
- doTestProject( "project-073", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-app-client-sample-one-1.0.jar",
- "APP-INF/lib/eartest-jar-sample-one-1.0.jar", "APP-INF/lib/eartest-jar-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with custom env entries settings and J2EE 1.3. Not supported by the specification so this should be
- * ignored.
- * @throws Exception in case of an error.
- */
- public void testProject074()
- throws Exception
- {
- doTestProject( "project-074", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with custom env entries settings and J2EE 1.4. Not supported by the specification so this should be
- * ignored.
- * @throws Exception in case of an error.
- */
- public void testProject075()
- throws Exception
- {
- doTestProject( "project-075", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with custom env entries settings and JavaEE 5. Not supported by the specification so this should be
- * ignored.
- * @throws Exception in case of an error.
- */
- public void testProject076()
- throws Exception
- {
- doTestProject( "project-076", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with custom env entries settings and JavaEE 6.
- * @throws Exception in case of an error.
- */
- public void testProject077()
- throws Exception
- {
- doTestProject( "project-077", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with the no version for ejb file name mapping.
- * @throws Exception in case of an error.
- */
- public void testProject078()
- throws Exception
- {
- doTestProject( "project-078",
- new String[] { "ejb-sample-one.jar", "war-sample-one.war", "jar-sample-two.jar" } );
- }
-
- /**
- * Builds an EAR with the 'default' library directory mode. Uses the value of the defaultLibBundleDir.
- * @throws Exception in case of an error.
- */
- public void testProject079()
- throws Exception
- {
- doTestProject( "project-079", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with the 'empty' library directory mode. Generate an empty library-directory element.
- * @throws Exception in case of an error.
- */
- public void testProject080()
- throws Exception
- {
- doTestProject( "project-080", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with the 'none' library directory mode. Does not generate an library-directory element.
- * @throws Exception in case of an error.
- */
- public void testProject081()
- throws Exception
- {
- doTestProject( "project-081", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with deployment descriptor configuration for JavaEE 7.
- * @throws Exception in case of an error.
- */
- public void testProject082()
- throws Exception
- {
- doTestProject( "project-082", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with a library directory and custom env entries. The library-directory element must come first
- * (MEAR-158).
- * @throws Exception in case of an error.
- */
- public void testProject083()
- throws Exception
- {
- doTestProject( "project-083", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Support of an application id (MEAR-174).
- * @throws Exception in case of an error.
- */
- public void testProject084()
- throws Exception
- {
- doTestProject( "project-084", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with custom ejbRef entries settings and JavaEE 6.
- * @throws Exception in case of an error.
- */
- public void testProject085()
- throws Exception
- {
- doTestProject( "project-085", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with custom ejbRef entries plus lookup-name entry.
- * @throws Exception in case of an error.
- */
- public void testProject086()
- throws Exception
- {
- doTestProject( "project-086", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-
- /**
- * Builds an EAR with resource-ref entries.
- * @throws Exception in case of an error.
- */
- public void testProject087()
- throws Exception
- {
- doTestProject( "project-087", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
- }
-}
+package org.apache.maven.plugins.ear.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import org.apache.maven.shared.utils.io.IOUtil;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.ReaderFactory;
+
+/**
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ */
+//FIXME: Currently disabled based on the name
+public class EarMojoIntegrationTestings
+ extends AbstractEarPluginIT
+{
+
+ /**
+ * Builds an EAR with a single EJB and no configuration.
+ * @throws Exception in case of an error.
+ */
+ public void testProject001()
+ throws Exception
+ {
+ doTestProject( "project-001", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a customized artifact location and a customized artifact name.
+ * @throws Exception in case of an error.
+ */
+ public void testProject002()
+ throws Exception
+ {
+ doTestProject( "project-002",
+ new String[] { "APP-INF/lib/eartest-ejb-sample-one-1.0.jar", "ejb-sample-two.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a default bundle directory for <tt>java</tt> modules.
+ * @throws Exception in case of an error.
+ */
+ public void testProject003()
+ throws Exception
+ {
+ doTestProject( "project-003", new String[] { "eartest-ejb-sample-one-1.0.jar",
+ "APP-INF/lib/eartest-jar-sample-one-1.0.jar", "APP-INF/lib/eartest-jar-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a default bundle directory for _java_ modules and a custom location overriding the default.
+ * @throws Exception in case of an error.
+ */
+ public void testProject004()
+ throws Exception
+ {
+ doTestProject( "project-004", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar",
+ "APP-INF/lib/eartest-jar-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a custom URI.
+ * @throws Exception in case of an error.
+ */
+ public void testProject005()
+ throws Exception
+ {
+ doTestProject( "project-005", new String[] { "eartest-ejb-sample-one-1.0.jar", "libs/another-name.jar" } );
+ }
+
+ /**
+ * Builds an EAR with an excluded module.
+ * @throws Exception in case of an error.
+ */
+ public void testProject006()
+ throws Exception
+ {
+ doTestProject( "project-006",
+ new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a classified artifact and no extra configuration.
+ * @throws Exception in case of an error.
+ */
+ public void testProject007()
+ throws Exception
+ {
+ doTestProject( "project-007", new String[] { "eartest-ejb-sample-one-1.0-classified.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for J2EE 1.3.
+ * @throws Exception in case of an error.
+ */
+ public void testProject008()
+ throws Exception
+ {
+ doTestProject( "project-008", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for J2EE 1.4.
+ * @throws Exception in case of an error.
+ */
+ public void testProject009()
+ throws Exception
+ {
+ doTestProject( "project-009", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for Java EE 5.
+ * @throws Exception in case of an error.
+ */
+ public void testProject010()
+ throws Exception
+ {
+ doTestProject( "project-010", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that deployment descriptor default settings are applied.
+ * @throws Exception in case of an error.
+ */
+ public void testProject011()
+ throws Exception
+ {
+ doTestProject( "project-011", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that EAR resources are bundled within the EAR.
+ * @throws Exception in case of an error.
+ */
+ public void testProject012()
+ throws Exception
+ {
+ doTestProject( "project-012", new String[] { "README.txt", "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that EAR resources in a customized resources directory are bundled within the EAR.
+ * @throws Exception in case of an error.
+ */
+ public void testProject013()
+ throws Exception
+ {
+ doTestProject( "project-013", new String[] { "README.txt", "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that EAR resources are bundled within the EAR using includes and excludes.
+ * @throws Exception in case of an error.
+ */
+ public void testProject014()
+ throws Exception
+ {
+ doTestProject( "project-014", new String[] { "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that default manifest is taken into account.
+ * @throws Exception in case of an error.
+ */
+ public void testProject015()
+ throws Exception
+ {
+ final File baseDir = doTestProject( "project-015", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ final File expectedManifest = new File( baseDir, "src/main/application/META-INF/MANIFEST.MF" );
+ final File actualManifest = new File( getEarDirectory( baseDir, "project-015" ), "META-INF/MANIFEST.MF" );
+ assertTrue( "Manifest was not copied", actualManifest.exists() );
+ assertTrue( FileUtils.contentEquals( expectedManifest, actualManifest ) );
+ }
+
+ /**
+ * Builds an EAR and make sure that custom manifest is taken into account.
+ * @throws Exception in case of an error.
+ */
+ public void testProject016()
+ throws Exception
+ {
+ final File baseDir = doTestProject( "project-016", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+
+ final File targetFolder = new File( baseDir, "target" );
+ final File createdEarFile = new File( targetFolder, "maven-ear-plugin-test-project-016-99.0.ear" );
+
+ final File sourceManifestFile = new File( baseDir, "src/main/ear/MANIFEST.MF" );
+
+ JarFile jarFile = new JarFile( createdEarFile );
+ Manifest manifestFromCreatedEARFile = jarFile.getManifest();
+ jarFile.close();
+
+ Manifest sourceManifest = new Manifest( new FileInputStream( sourceManifestFile ) );
+
+ assertTrue( "There are differences in the manifest.", sourceManifest.equals( manifestFromCreatedEARFile ) );
+ }
+
+ /**
+ * Builds an EAR and make sure that custom application.xml is taken into account.
+ * @throws Exception in case of an error.
+ */
+ public void testProject017()
+ throws Exception
+ {
+ doTestProject( "project-017", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a custom final name.
+ * @throws Exception in case of an error.
+ */
+ public void testProject018()
+ throws Exception
+ {
+ final File baseDir = executeMojo( "project-018", new Properties() );
+ final File expectedFile = new File( baseDir, "target/my-custom-file.ear" );
+ assertTrue( "EAR archive not found", expectedFile.exists() );
+ }
+
+ /**
+ * Builds an EAR with unpacked archives using the unpackTypes.
+ * @throws Exception in case of an error.
+ */
+ public void testProject019()
+ throws Exception
+ {
+ doTestProject( "project-019", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-sar-sample-one-1.0.sar",
+ "eartest-jar-sample-one-1.0.jar" }, new boolean[] { false, true, true } );
+ }
+
+ /**
+ * Builds an EAR with unpacked archives using the unpack module attribute.
+ * @throws Exception in case of an error.
+ */
+ public void testProject020()
+ throws Exception
+ {
+ doTestProject( "project-020", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-sar-sample-one-1.0.sar",
+ "eartest-jar-sample-one-1.0.jar" }, new boolean[] { true, false, false } );
+ }
+
+ /**
+ * Builds an EAR with unpacked archives using both unpackTypes and the unpack module attribute.
+ * @throws Exception in case of an error.
+ */
+ public void testProject021()
+ throws Exception
+ {
+ doTestProject( "project-021",
+ new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
+ "eartest-sar-sample-one-1.0.sar", "eartest-jar-sample-one-1.0.jar",
+ "eartest-jar-sample-two-1.0.jar" },
+ new boolean[] { false, true, false, false, true } );
+ }
+
+ /**
+ * Builds an EAR with a classifier.
+ * @throws Exception in case of an error.
+ */
+ public void testProject022()
+ throws Exception
+ {
+ final File baseDir = executeMojo( "project-022", new Properties() );
+ final File expectedFile = new File( baseDir, "target/maven-ear-plugin-test-project-022-99.0-myclassifier.ear" );
+ assertTrue( "EAR archive not found", expectedFile.exists() );
+ }
+
+ /**
+ * Builds an EAR and make sure that a single classified dependency is detected without specifying the classifier.
+ * @throws Exception in case of an error.
+ */
+ public void testProject023()
+ throws Exception
+ {
+ doTestProject( "project-023",
+ new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-two-1.0.jar" },
+ new boolean[] { true, false } );
+ }
+
+ /**
+ * Builds an EAR and make sure that a single classified dependency is detected when specifying the classifier.
+ * @throws Exception in case of an error.
+ */
+ public void testProject024()
+ throws Exception
+ {
+ doTestProject( "project-024",
+ new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-two-1.0.jar" },
+ new boolean[] { true, false } );
+ }
+
+ /**
+ * Builds an EAR and make sure that a classified dependency with mutiple candidates is detected when specifying the
+ * classifier.
+ * @throws Exception in case of an error.
+ */
+ public void testProject025()
+ throws Exception
+ {
+ doTestProject( "project-025",
+ new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-one-1.0.jar" },
+ new boolean[] { true, false } );
+ }
+
+ /**
+ * Builds an EAR and make sure that the build fails if a unclassifed module configuration with mutiple candidates is
+ * specified.
+ * @throws Exception in case of an error.
+ */
+ public void testProject026()
+ throws Exception
+ {
+ final File baseDir = executeMojo( "project-026", new Properties(), false );
+ // Stupido, checks that the ear archive is not there
+ assertFalse( "Execution should have failed", getEarArchive( baseDir, "project-026" ).exists() );
+ }
+
+ /**
+ * Builds an EAR and make sure that provided dependencies are not included in the EAR.
+ * @throws Exception in case of an error.
+ */
+ public void testProject027()
+ throws Exception
+ {
+ doTestProject( "project-027", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that test dependencies are not included in the EAR.
+ * @throws Exception in case of an error.
+ */
+ public void testProject028()
+ throws Exception
+ {
+ doTestProject( "project-028", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that system dependencies are not included in the EAR.
+ * @throws Exception in case of an error.
+ */
+ public void testProject029()
+ throws Exception
+ {
+ doTestProject( "project-029", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that ejb-client dependencies are detected and not added by default in the generated
+ * application.xml.
+ * @throws Exception in case of an error.
+ */
+ public void testProject030()
+ throws Exception
+ {
+ doTestProject( "project-030",
+ new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4 configuration specifying the security domain and the unauthenticated-principal to
+ * use.
+ * @throws Exception in case of an error.
+ */
+ public void testProject031()
+ throws Exception
+ {
+ doTestProject( "project-031",
+ new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 3.2 configuration specifying the jmx-name to use.
+ * @throws Exception in case of an error.
+ */
+ public void testProject032()
+ throws Exception
+ {
+ doTestProject( "project-032",
+ new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4 configuration and Jboss specific modules.
+ * @throws Exception in case of an error.
+ */
+ public void testProject033()
+ throws Exception
+ {
+ doTestProject( "project-033", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
+ "eartest-sar-sample-one-1.0.sar", "eartest-har-sample-one-1.0.har" } );
+ }
+
+ /**
+ * Builds an EAR with custom security settings.
+ * @throws Exception in case of an error.
+ */
+ public void testProject034()
+ throws Exception
+ {
+ doTestProject( "project-034",
+ new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a full filename mapping and make sure that custom locations are not overridden.
+ * @throws Exception in case of an error.
+ */
+ public void testProject035()
+ throws Exception
+ {
+ doTestProject( "project-035",
+ new String[] { "foo/eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
+ "libs/eartest-jar-sample-one-1.0.jar", "libs/eartest-jar-sample-two-1.0.jar",
+ "sar-sample-one.sar" } );
+ }
+
+ /**
+ * Builds an EAR with a full filename mapping and make sure that groupIds with dots are replaced by dashes in
+ * filenames.
+ * @throws Exception in case of an error.
+ */
+ public void testProject036()
+ throws Exception
+ {
+ doTestProject( "project-036",
+ new String[] { "foo/eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
+ "com.foo.bar-ejb-sample-one-1.0.jar", "com.foo.bar-ejb-sample-two-1.0.jar",
+ "libs/eartest-jar-sample-one-1.0.jar", "libs/eartest-jar-sample-two-1.0.jar",
+ "sar-sample-one.sar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that ejb-client dependencies are detected and added in the generated application.xml
+ * if includeInApplicationXml is set.
+ * @throws Exception in case of an error.
+ */
+ public void testProject037()
+ throws Exception
+ {
+ doTestProject( "project-037", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR and make sure that a non-classified dependency with mutiple candidates is detected when specifying
+ * the mainArtifactId as classifier.
+ * @throws Exception in case of an error.
+ */
+ public void testProject038()
+ throws Exception
+ {
+ doTestProject( "project-038", new String[] { "eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-one-1.0.jar" },
+ new boolean[] { false, true } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4 configuration specifying specifying the loader repository to use.
+ * @throws Exception in case of an error.
+ */
+ public void testProject039()
+ throws Exception
+ {
+ doTestProject( "project-039", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for Java EE 5 and an alternative deployment descriptor.
+ * @throws Exception in case of an error.
+ */
+ public void testProject040()
+ throws Exception
+ {
+ doTestProject( "project-040", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4.2 configuration specifying the module order to use.
+ * @throws Exception in case of an error.
+ */
+ public void testProject041()
+ throws Exception
+ {
+ doTestProject( "project-041", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4.2 configuration specifying a datasource to add.
+ * @throws Exception in case of an error.
+ */
+ public void testProject042()
+ throws Exception
+ {
+ doTestProject( "project-042", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting).
+ * @throws Exception in case of an error.
+ */
+ public void testProject043()
+ throws Exception
+ {
+ final File baseDir = doTestProject( "project-043", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ final File expectedApplicationXml = new File( baseDir, "target/custom-descriptor-dir/application.xml" );
+ assertTrue( "Application.xml file not found", expectedApplicationXml.exists() );
+ assertFalse( "Application.xml file should not be empty", expectedApplicationXml.length() == 0 );
+ }
+
+ /**
+ * Builds an EAR with a custom library-directory.
+ * @throws Exception in case of an error.
+ */
+ public void testProject044()
+ throws Exception
+ {
+ doTestProject( "project-044", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR and filter the content of the sources directory.
+ * @throws Exception in case of an error.
+ */
+ public void testProject045()
+ throws Exception
+ {
+ final File baseDir = doTestProject( "project-045", new String[] { "README.txt", "eartest-ejb-sample-one-1.0.jar" } );
+ final File actualReadme = new File( getEarDirectory( baseDir, "project-045" ), "README.txt" );
+ final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
+ assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );
+ assertTrue( "Escaping did not work properly", content.contains( "will not be filtered ${application.name}." ) );
+ }
+
+ /**
+ * Builds an EAR and filter the content of the sources directory using a custom filter file.
+ * @throws Exception in case of an error.
+ */
+ public void testProject046()
+ throws Exception
+ {
+ final File baseDir = doTestProject( "project-046", new String[] { "README.txt", "eartest-ejb-sample-one-1.0.jar" } );
+ final File actualReadme = new File( getEarDirectory( baseDir, "project-046" ), "README.txt" );
+ final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
+ assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );
+ assertTrue( "application build was not filtered properly", content.contains( "(Build 2)" ) );
+ assertTrue( "Unknown property should not have been filtered",
+ content.contains( "will not be filtered ${application.unknown}." ) );
+ }
+
+ /**
+ * Builds an EAR and filter the content with a list of extensions.
+ * @throws Exception in case of an error.
+ */
+ public void testProject047()
+ throws Exception
+ {
+ final File baseDir = doTestProject( "project-047", new String[] { "README.txt", "eartest-ejb-sample-one-1.0.jar" } );
+ final File actualReadme = new File( getEarDirectory( baseDir, "project-047" ), "README.txt" );
+ final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
+ assertTrue( "application name and version should not have been filtered", !content.contains( "my-app 99.0" ) );
+ assertTrue( "original properties not found", content.contains( "${application.name} ${project.version}" ) );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing library directory.
+ * @throws Exception in case of an error.
+ */
+ public void testProject048()
+ throws Exception
+ {
+ doTestProject( "project-048", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4.2 configuration containing a library directory.
+ * @throws Exception in case of an error.
+ */
+ public void testProject049()
+ throws Exception
+ {
+ doTestProject( "project-049", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing a loader repository configuration definition.
+ * @throws Exception in case of an error.
+ */
+ public void testProject050()
+ throws Exception
+ {
+ doTestProject( "project-050", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing a loader repository class definition.
+ * @throws Exception in case of an error.
+ */
+ public void testProject051()
+ throws Exception
+ {
+ doTestProject( "project-051", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing a configuration parser class definition.
+ * @throws Exception in case of an error.
+ */
+ public void testProject052()
+ throws Exception
+ {
+ doTestProject( "project-052", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing only the loader repo configuration
+ * @throws Exception in case of an error.
+ */
+ public void testProject053()
+ throws Exception
+ {
+ doTestProject( "project-053", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for Java EE 5 and no application.xml
+ * @throws Exception in case of an error.
+ */
+ public void testProject054()
+ throws Exception
+ {
+ doTestProject( "project-054", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with jar dependencies added in application.xml.
+ * @throws Exception in case of an error.
+ */
+ public void testProject055()
+ throws Exception
+ {
+ doTestProject( "project-055", new String[] { "eartest-jar-sample-one-1.0.jar", "eartest-jar-sample-two-1.0.jar",
+ "eartest-jar-sample-three-with-deps-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for J2EE 1.4 and an alternative deployment descriptor.
+ * @throws Exception in case of an error.
+ */
+ public void testProject056()
+ throws Exception
+ {
+ doTestProject( "project-056", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a complete JBoss 4.2 configuration and validate it matches the DTD (MEAR-104).
+ * @throws Exception in case of an error.
+ */
+ public void testProject057()
+ throws Exception
+ {
+ doTestProject( "project-057", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for Java EE 6.
+ * @throws Exception in case of an error.
+ */
+ public void testProject058()
+ throws Exception
+ {
+ doTestProject( "project-058", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with no display name entry at all.
+ * @throws Exception in case of an error.
+ */
+ public void testProject059()
+ throws Exception
+ {
+ doTestProject( "project-059", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with ejb-client packaged for J2EE 1.3 (MEAR-85)
+ *
+ * @throws Exception in case of an error.
+ */
+ public void testProject060()
+ throws Exception
+ {
+ doTestProject( "project-060", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR with ejb-client packaged for J2EE 1.4 (MEAR-85)
+ *
+ * @throws Exception in case of an error.
+ */
+ public void testProject061()
+ throws Exception
+ {
+ doTestProject( "project-061", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR with ejb-client packaged for JavaEE 5 (MEAR-85)
+ *
+ * @throws Exception in case of an error.
+ */
+ public void testProject062()
+ throws Exception
+ {
+ doTestProject( "project-062", new String[] { "eartest-ejb-sample-one-1.0.jar", "lib/eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR with ejb-client packaged for JavaEE 6 (MEAR-85)
+ *
+ * @throws Exception in case of an error.
+ */
+ public void testProject063()
+ throws Exception
+ {
+ doTestProject( "project-063", new String[] { "lib/eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR with ejb-client packaged for JavaEE 5 and still put it in the root (MEAR-85)
+ *
+ * @throws Exception in case of an error.
+ */
+ public void testProject064()
+ throws Exception
+ {
+ doTestProject( "project-064", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a custom moduleId.
+ * @throws Exception in case of an error.
+ */
+ public void testProject065()
+ throws Exception
+ {
+ doTestProject( "project-065", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with generateModuleId enabled.
+ * @throws Exception in case of an error.
+ */
+ public void testProject066()
+ throws Exception
+ {
+ doTestProject( "project-066", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with generateModuleId enabled and a custom module.
+ * @throws Exception in case of an error.
+ */
+ public void testProject067()
+ throws Exception
+ {
+ doTestProject( "project-067", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with the no-version file name mapping.
+ * @throws Exception in case of an error.
+ */
+ public void testProject068()
+ throws Exception
+ {
+ doTestProject( "project-068", new String[] { "eartest-ejb-sample-one.jar", "eartest-ejb-sample-two.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a custom library-directory and JavaEE 6.
+ * @throws Exception in case of an error.
+ */
+ public void testProject069()
+ throws Exception
+ {
+ doTestProject( "project-069", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with application-name and initialize-in-order tags.
+ * @throws Exception in case of an error.
+ */
+ public void testProject070()
+ throws Exception
+ {
+ doTestProject( "project-070", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with application-name and initialize-in-order tags for unsupported version.
+ * @throws Exception in case of an error.
+ */
+ public void testProject071()
+ throws Exception
+ {
+ doTestProject( "project-071", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with an application client module (app-client).
+ * @throws Exception in case of an error.
+ */
+ public void testProject072()
+ throws Exception
+ {
+ doTestProject( "project-072", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-app-client-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with an application client module (app-client) and a default bundle directory for _java_ modules.
+ * @throws Exception in case of an error.
+ */
+ public void testProject073()
+ throws Exception
+ {
+ doTestProject( "project-073", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-app-client-sample-one-1.0.jar",
+ "APP-INF/lib/eartest-jar-sample-one-1.0.jar", "APP-INF/lib/eartest-jar-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with custom env entries settings and J2EE 1.3. Not supported by the specification so this should be
+ * ignored.
+ * @throws Exception in case of an error.
+ */
+ public void testProject074()
+ throws Exception
+ {
+ doTestProject( "project-074", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with custom env entries settings and J2EE 1.4. Not supported by the specification so this should be
+ * ignored.
+ * @throws Exception in case of an error.
+ */
+ public void testProject075()
+ throws Exception
+ {
+ doTestProject( "project-075", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with custom env entries settings and JavaEE 5. Not supported by the specification so this should be
+ * ignored.
+ * @throws Exception in case of an error.
+ */
+ public void testProject076()
+ throws Exception
+ {
+ doTestProject( "project-076", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with custom env entries settings and JavaEE 6.
+ * @throws Exception in case of an error.
+ */
+ public void testProject077()
+ throws Exception
+ {
+ doTestProject( "project-077", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with the no version for ejb file name mapping.
+ * @throws Exception in case of an error.
+ */
+ public void testProject078()
+ throws Exception
+ {
+ doTestProject( "project-078",
+ new String[] { "ejb-sample-one.jar", "war-sample-one.war", "jar-sample-two.jar" } );
+ }
+
+ /**
+ * Builds an EAR with the 'default' library directory mode. Uses the value of the defaultLibBundleDir.
+ * @throws Exception in case of an error.
+ */
+ public void testProject079()
+ throws Exception
+ {
+ doTestProject( "project-079", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with the 'empty' library directory mode. Generate an empty library-directory element.
+ * @throws Exception in case of an error.
+ */
+ public void testProject080()
+ throws Exception
+ {
+ doTestProject( "project-080", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with the 'none' library directory mode. Does not generate an library-directory element.
+ * @throws Exception in case of an error.
+ */
+ public void testProject081()
+ throws Exception
+ {
+ doTestProject( "project-081", new String[] { "eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with deployment descriptor configuration for JavaEE 7.
+ * @throws Exception in case of an error.
+ */
+ public void testProject082()
+ throws Exception
+ {
+ doTestProject( "project-082", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with a library directory and custom env entries. The library-directory element must come first
+ * (MEAR-158).
+ * @throws Exception in case of an error.
+ */
+ public void testProject083()
+ throws Exception
+ {
+ doTestProject( "project-083", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Support of an application id (MEAR-174).
+ * @throws Exception in case of an error.
+ */
+ public void testProject084()
+ throws Exception
+ {
+ doTestProject( "project-084", new String[] { "eartest-ejb-sample-one-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with custom ejbRef entries settings and JavaEE 6.
+ * @throws Exception in case of an error.
+ */
+ public void testProject085()
+ throws Exception
+ {
+ doTestProject( "project-085", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with custom ejbRef entries plus lookup-name entry.
+ * @throws Exception in case of an error.
+ */
+ public void testProject086()
+ throws Exception
+ {
+ doTestProject( "project-086", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+
+ /**
+ * Builds an EAR with resource-ref entries.
+ * @throws Exception in case of an error.
+ */
+ public void testProject087()
+ throws Exception
+ {
+ doTestProject( "project-087", new String[] { "eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar" } );
+ }
+}
[maven-ear-plugin] 07/10: Get usual unit tests back to work. Give
system property about Maven version to integration tests.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit acbe40032ef72b6851a356d99daf4789b07817a3
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Oct 28 21:14:51 2019 +0100
Get usual unit tests back to work.
Give system property about Maven version to integration tests.
---
pom.xml | 10 ++++++++--
src/test/java/org/apache/maven/plugins/ear/it/EARIT.java | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4562e67..0756980 100644
--- a/pom.xml
+++ b/pom.xml
@@ -188,8 +188,11 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
-
-
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -343,6 +346,9 @@
<includes>
<include>**/*IT.java</include>
</includes>
+ <systemProperties>
+ <maven.version>${maven.version}</maven.version>
+ </systemProperties>
</configuration>
<executions>
<execution>
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index 711532e..e66ef86 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -45,6 +45,7 @@ class EARIT {
@MavenTest
@DisplayName("Basic configuration. Should simply create an ear file.")
void basic(MavenExecutionResult result, MavenProjectResult project) {
+ System.out.println("System.getProperty(\"maven.version\") = " + System.getProperty("maven.version"));
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
.withEarFile()
[maven-ear-plugin] 08/10: Added maven.home system property
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit e9167d5f0902bbf4c97de457a4dbdad9445f88ac
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Oct 28 22:25:15 2019 +0100
Added maven.home system property
---
pom.xml | 4 ++++
src/test/java/org/apache/maven/plugins/ear/it/EARIT.java | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/pom.xml b/pom.xml
index 0756980..5b5042b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -346,8 +346,12 @@
<includes>
<include>**/*IT.java</include>
</includes>
+ <!--
+ ! currently needed for running integration tests.
+ -->
<systemProperties>
<maven.version>${maven.version}</maven.version>
+ <maven.home>${maven.home}</maven.home>
</systemProperties>
</configuration>
<executions>
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index e66ef86..e2c599a 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -20,12 +20,15 @@ package org.apache.maven.plugins.ear.it;
*/
import static org.apache.maven.jupiter.assertj.MavenITAssertions.assertThat;
+import static org.apache.maven.jupiter.extension.maven.MavenVersion.M3_6_2;
+import org.apache.maven.jupiter.extension.DisabledForMaven;
import org.apache.maven.jupiter.extension.MavenIT;
import org.apache.maven.jupiter.extension.MavenTest;
import org.apache.maven.jupiter.extension.maven.MavenExecutionResult;
import org.apache.maven.jupiter.extension.maven.MavenLog;
import org.apache.maven.jupiter.extension.maven.MavenProjectResult;
+import org.apache.maven.jupiter.extension.maven.MavenVersion;
import org.junit.jupiter.api.DisplayName;
/**
@@ -43,6 +46,7 @@ import org.junit.jupiter.api.DisplayName;
class EARIT {
@MavenTest
+ @DisabledForMaven(versions = M3_6_2)
@DisplayName("Basic configuration. Should simply create an ear file.")
void basic(MavenExecutionResult result, MavenProjectResult project) {
System.out.println("System.getProperty(\"maven.version\") = " + System.getProperty("maven.version"));
[maven-ear-plugin] 09/10: Cleaned up. Using value makes usage of
annotation DisabledForMaven easier to use.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 48eceef76b59a84f79da0bf6771cf8555a4fabbc
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Oct 28 22:27:45 2019 +0100
Cleaned up. Using value makes usage of annotation DisabledForMaven easier to use.
---
src/test/java/org/apache/maven/plugins/ear/it/EARIT.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index e2c599a..6ab1ef7 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -46,10 +46,9 @@ import org.junit.jupiter.api.DisplayName;
class EARIT {
@MavenTest
- @DisabledForMaven(versions = M3_6_2)
+ @DisabledForMaven(M3_6_2)
@DisplayName("Basic configuration. Should simply create an ear file.")
void basic(MavenExecutionResult result, MavenProjectResult project) {
- System.out.println("System.getProperty(\"maven.version\") = " + System.getProperty("maven.version"));
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
.withEarFile()
[maven-ear-plugin] 10/10: Added comments.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 44995bdecef535f69709b9b75803749469437c18
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Tue Oct 29 21:21:42 2019 +0100
Added comments.
---
src/test/java/org/apache/maven/plugins/ear/it/EARIT.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index 6ab1ef7..cb2dbc1 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -40,6 +40,8 @@ import org.junit.jupiter.api.DisplayName;
* </ul>
*
* @author Karl Heinz Marbaise
+ * These are the maven-invoker-plugin integration tests (src/it/**).
+ * migrated to the new maven-it-extension
*/
@MavenIT
@DisplayName("EAR Plugin Integration tests")
[maven-ear-plugin] 02/10: First prototype testing working.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 85e51245e9138c1d81fe0c64ec28078d3923e747
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 20:16:12 2019 +0100
First prototype testing working.
---
pom.xml | 74 +-
.../maven/plugins/ear/it}/EARIT/basic/pom.xml | 0
.../application/META-INF/appserver-application.xml | 0
.../ear/it/EARIT/packaging_excludes}/pom.xml | 0
.../ear/it/EARIT/packaging_excludes}/verify.bsh | 0
.../ear/it/EARIT/packaging_includes}/pom.xml | 0
.../it/EARIT/resource_custom_directory}/pom.xml | 0
.../application/APP-INF/classes/foo.properties | 0
...va => AbstractEarPluginIntegrationTesting.java} | 830 ++++++++++-----------
.../org/apache/maven/plugins/ear/it/EARIT.java | 19 +
.../plugins/ear/it/EarMojoIntegrationTestings.java | 2 +-
11 files changed, 505 insertions(+), 420 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9def699..df896d8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,6 +87,17 @@
<surefire.version>2.22.1</surefire.version>
</properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.junit</groupId>
+ <artifactId>junit-bom</artifactId>
+ <version>5.5.2</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -158,17 +169,42 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.maven.jupiter.extension</groupId>
+ <artifactId>maven-it-extension</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.13.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.9.5</version>
+ <version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.maven.jupiter.extension</groupId>
- <artifactId>maven-it-extension</artifactId>
- <version>0.1.0-SNAPSHOT</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-inline</artifactId>
+ <version>3.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <version>3.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
+
+
</dependencies>
<build>
@@ -215,8 +251,16 @@
</excludes>
</configuration>
</plugin>
+
</plugins>
</pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin></plugins>
</build>
<profiles>
@@ -273,6 +317,25 @@
<extraArtifact>org.apache.maven.plugins:maven-ejb-plugin:2.3:jar</extraArtifact>
</extraArtifacts>
</configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>EMPTY</phase>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <phase>EMPTY</phase>
+ </execution>
+ <execution>
+ <id>install-artifacts</id>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ <configuration>
+ <localRepositoryPath>${project.build.directory}/invoker-repo</localRepositoryPath>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -280,6 +343,9 @@
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
+ <includes>
+ <include>**/*IT.java</include>
+ </includes>
</configuration>
<executions>
<execution>
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/pom.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/basic/pom.xml
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/pom.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/basic/pom.xml
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/src/main/application/META-INF/appserver-application.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/basic/src/main/application/META-INF/appserver-application.xml
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/basic/src/main/application/META-INF/appserver-application.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/basic/src/main/application/META-INF/appserver-application.xml
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/pom.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/packaging_excludes/pom.xml
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/pom.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/packaging_excludes/pom.xml
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/verify.bsh b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/packaging_excludes/verify.bsh
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-excludes/verify.bsh
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/packaging_excludes/verify.bsh
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-includes/pom.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/packaging_includes/pom.xml
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/packaging-includes/pom.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/packaging_includes/pom.xml
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/pom.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/resource_custom_directory/pom.xml
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/pom.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/resource_custom_directory/pom.xml
diff --git a/src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/resource_custom_directory/src/main/application/APP-INF/classes/foo.properties
similarity index 100%
rename from src/main/filtered-resources/maven-its/org.apache.maven.plugins.ear.it/EARIT/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/resource_custom_directory/src/main/application/APP-INF/classes/foo.properties
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIT.java b/src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIntegrationTesting.java
similarity index 97%
rename from src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIT.java
rename to src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIntegrationTesting.java
index 2d62559..78001d0 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIntegrationTesting.java
@@ -1,415 +1,415 @@
-package org.apache.maven.plugins.ear.it;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.maven.it.VerificationException;
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.util.ResourceExtractor;
-import org.apache.maven.plugins.ear.util.ResourceEntityResolver;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLAssert;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Base class for ear test cases.
- *
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public abstract class AbstractEarPluginIT
- extends TestCase
-{
-
- protected final String FINAL_NAME_PREFIX = "maven-ear-plugin-test-";
-
- protected final String FINAL_NAME_SUFFIX = "-99.0";
-
- /**
- * The base directory.
- */
- private File basedir;
-
- /**
- * Test repository directory.
- */
- protected File localRepositoryDir = new File( getBasedir().getAbsolutePath(), "target/test-classes/m2repo" );
-
- protected File settingsFile = new File( getBasedir().getAbsolutePath(), "target/test-classes/settings.xml" );
-
- /**
- * Execute the EAR plugin for the specified project.
- *
- * @param projectName the name of the project
- * @param properties extra properties to be used by the embedder
- * @param expectNoError true/flase.
- * @return the base directory of the project
- * @throws Exception if an error occurred
- */
- protected File executeMojo( final String projectName, final Properties properties, boolean expectNoError )
- throws Exception
- {
- System.out.println( " Building: " + projectName );
-
- File testDir = getTestDir( projectName );
- Verifier verifier = new Verifier( testDir.getAbsolutePath() );
- // Let's add alternate settings.xml setting so that the latest dependencies are used
- String localRepo = System.getProperty( "localRepositoryPath" );
- verifier.setLocalRepo( localRepo );
-
- String httpsProtocols = System.getProperty( "https.protocols" );
- verifier.setSystemProperty( "https.protocols", httpsProtocols );
- verifier.getCliOptions().add( "-s \"" + settingsFile.getAbsolutePath() + "\"" );//
- verifier.getCliOptions().add( "-X" );
- verifier.setLocalRepo( localRepo );
-
- // On linux and macOSX, an exception is thrown if a build failure occurs underneath
- try
- {
- verifier.executeGoal( "package" );
- }
- catch ( VerificationException e )
- {
- // @TODO needs to be handled nicely in the verifier
- if ( expectNoError || !e.getMessage().contains( "Exit code was non-zero" ) )
- {
- throw e;
- }
- }
-
- // If no error is expected make sure that error logs are free
- if ( expectNoError )
- {
- verifier.verifyErrorFreeLog();
- }
- verifier.resetStreams();
- return testDir;
- }
-
- /**
- * Execute the EAR plugin for the specified project.
- *
- * @param projectName the name of the project
- * @param properties extra properties to be used by the embedder
- * @return the base directory of the project
- * @throws Exception if an error occurred
- */
- protected File executeMojo( final String projectName, final Properties properties )
- throws Exception
- {
- return executeMojo( projectName, properties, true );
- }
-
- /**
- * Executes the specified projects and asserts the given artifacts.
- *
- * @param projectName the project to test
- * @param expectedArtifacts the list of artifacts to be found in the EAR archive
- * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not
- * @param testDeploymentDescriptors whether we should test deployment descriptors
- * @return the base directory of the project
- * @throws Exception Mojo exception in case of an error.
- */
- protected File doTestProject( final String projectName, final String[] expectedArtifacts,
- final boolean[] artifactsDirectory, boolean testDeploymentDescriptors )
- throws Exception
- {
- final File baseDir = executeMojo( projectName, new Properties() );
- assertEarArchive( baseDir, projectName );
- assertEarDirectory( baseDir, projectName );
-
- assertArchiveContent( baseDir, projectName, expectedArtifacts, artifactsDirectory );
-
- if ( testDeploymentDescriptors )
- {
- assertDeploymentDescriptors( baseDir, projectName );
- }
-
- return baseDir;
-
- }
-
- /**
- * Executes the specified projects and asserts the given artifacts. Assert the deployment descriptors are valid
- *
- * @param projectName the project to test
- * @param expectedArtifacts the list of artifacts to be found in the EAR archive
- * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not
- * @return the base directory of the project
- * @throws Exception Mojo exception in case of an error.
- */
- protected File doTestProject( final String projectName, final String[] expectedArtifacts,
- final boolean[] artifactsDirectory )
- throws Exception
- {
- return doTestProject( projectName, expectedArtifacts, artifactsDirectory, true );
-
- }
-
- /**
- * Executes the specified projects and asserts the given artifacts as artifacts (non directory)
- *
- * @param projectName the project to test
- * @param expectedArtifacts the list of artifacts to be found in the EAR archive
- * @param testDeploymentDescriptors whether we should test deployment descriptors
- * @return the base directory of the project
- * @throws Exception Mojo exception in case of an error.
- */
- protected File doTestProject( final String projectName, final String[] expectedArtifacts,
- boolean testDeploymentDescriptors )
- throws Exception
- {
- return doTestProject( projectName, expectedArtifacts, new boolean[expectedArtifacts.length] );
- }
-
- /**
- * Executes the specified projects and asserts the given artifacts as artifacts (non directory). Assert the
- * deployment descriptors are valid
- *
- * @param projectName the project to test
- * @param expectedArtifacts the list of artifacts to be found in the EAR archive
- * @return the base directory of the project
- * @throws Exception Mojo exception in case of an error.
- */
- protected File doTestProject( final String projectName, final String[] expectedArtifacts )
- throws Exception
- {
- return doTestProject( projectName, expectedArtifacts, true );
- }
-
- protected void assertEarArchive( final File baseDir, final String projectName )
- {
- assertTrue( "EAR archive does not exist", getEarArchive( baseDir, projectName ).exists() );
- }
-
- protected void assertEarDirectory( final File baseDir, final String projectName )
- {
- assertTrue( "EAR archive directory does not exist", getEarDirectory( baseDir, projectName ).exists() );
- }
-
- protected File getTargetDirectory( final File basedir )
- {
- return new File( basedir, "target" );
- }
-
- protected File getEarArchive( final File baseDir, final String projectName )
- {
- return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) + ".ear" );
- }
-
- protected File getEarDirectory( final File baseDir, final String projectName )
- {
- return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) );
- }
-
- protected String buildFinalName( final String projectName )
- {
- return FINAL_NAME_PREFIX + projectName + FINAL_NAME_SUFFIX;
- }
-
- protected void assertArchiveContent( final File baseDir, final String projectName, final String[] artifactNames,
- final boolean[] artifactsDirectory )
- {
- // sanity check
- assertEquals( "Wrong parameter, artifacts mismatch directory flags", artifactNames.length,
- artifactsDirectory.length );
-
- File dir = getEarDirectory( baseDir, projectName );
-
- // Let's build the expected directories sort list
- final List<File> expectedDirectories = new ArrayList<File>();
- for ( int i = 0; i < artifactsDirectory.length; i++ )
- {
- if ( artifactsDirectory[i] )
- {
- expectedDirectories.add( new File( dir, artifactNames[i] ) );
- }
- }
-
- final List<File> actualFiles = buildArchiveContentFiles( dir, expectedDirectories );
- assertEquals( "Artifacts mismatch " + actualFiles, artifactNames.length, actualFiles.size() );
- for ( int i = 0; i < artifactNames.length; i++ )
- {
- String artifactName = artifactNames[i];
- final boolean isDirectory = artifactsDirectory[i];
- File expectedFile = new File( dir, artifactName );
-
- assertEquals( "Artifact[" + artifactName + "] not in the right form (exploded/archive", isDirectory,
- expectedFile.isDirectory() );
- assertTrue( "Artifact[" + artifactName + "] not found in ear archive", actualFiles.contains( expectedFile ) );
-
- }
- }
-
- protected List<File> buildArchiveContentFiles( final File baseDir, final List<File> expectedDirectories )
- {
- final List<File> result = new ArrayList<File>();
- addFiles( baseDir, result, expectedDirectories );
-
- return result;
- }
-
- private void addFiles( final File directory, final List<File> files, final List<File> expectedDirectories )
- {
- File[] result = directory.listFiles( new FilenameFilter()
- {
- public boolean accept( File dir, String name )
- {
- return !name.equals( "META-INF" );
- }
-
- } );
-
- /*
- * Kinda complex. If we found a file, we always add it to the list of files. If a directory is within the
- * expectedDirectories short list we add it but we don't add it's content. Otherwise, we don't add the directory
- * *BUT* we browse it's content
- */
- for ( File file : result )
- {
- if ( file.isFile() )
- {
- files.add( file );
- }
- else if ( expectedDirectories.contains( file ) )
- {
- files.add( file );
- }
- else
- {
- addFiles( file, files, expectedDirectories );
- }
- }
- }
-
- protected File getBasedir()
- {
- if ( basedir != null )
- {
- return basedir;
- }
-
- final String basedirString = System.getProperty( "basedir" );
- if ( basedirString == null )
- {
- basedir = new File( "" );
- }
- else
- {
- basedir = new File( basedirString );
- }
- return basedir;
- }
-
- protected File getTestDir( String projectName )
- throws IOException
- {
- return ResourceExtractor.simpleExtractResources( getClass(), "/projects/" + projectName );
- }
-
- // Generated application.xml stuff
-
- /**
- * Asserts that the deployment descriptors have been generated successfully.
- *
- * This test assumes that deployment descriptors are located in the <tt>expected-META-INF</tt> directory of the
- * project. Note that the <tt>MANIFEST.mf</tt> file is ignored and is not tested.
- *
- * @param baseDir the directory of the tested project
- * @param projectName the name of the project
- * @throws IOException exception in case of an error.
- */
- protected void assertDeploymentDescriptors( final File baseDir, final String projectName )
- throws IOException
- {
- final File earDirectory = getEarDirectory( baseDir, projectName );
- final File[] actualDeploymentDescriptors = getDeploymentDescriptors( new File( earDirectory, "META-INF" ) );
- final File[] expectedDeploymentDescriptors =
- getDeploymentDescriptors( new File( baseDir, "expected-META-INF" ) );
-
- if ( expectedDeploymentDescriptors == null )
- {
- assertNull( "No deployment descriptor was expected", actualDeploymentDescriptors );
- }
- else
- {
- assertNotNull( "Missing deployment descriptor", actualDeploymentDescriptors );
-
- // Make sure we have the same number of files
- assertEquals( "Number of Deployment descriptor(s) mismatch", expectedDeploymentDescriptors.length,
- actualDeploymentDescriptors.length );
-
- // Sort the files so that we have the same behavior here
- Arrays.sort( expectedDeploymentDescriptors );
- Arrays.sort( actualDeploymentDescriptors );
-
- for ( int i = 0; i < expectedDeploymentDescriptors.length; i++ )
- {
- File expectedDeploymentDescriptor = expectedDeploymentDescriptors[i];
- File actualDeploymentDescriptor = actualDeploymentDescriptors[i];
-
- assertEquals( "File name mismatch", expectedDeploymentDescriptor.getName(),
- actualDeploymentDescriptor.getName() );
-
- try
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setValidating( true );
- DocumentBuilder docBuilder = dbf.newDocumentBuilder();
- docBuilder.setEntityResolver( new ResourceEntityResolver() );
- docBuilder.setErrorHandler( new DefaultHandler() );
-
- final Diff myDiff =
- new Diff( docBuilder.parse( expectedDeploymentDescriptor ),
- docBuilder.parse( actualDeploymentDescriptor ) );
- XMLAssert.assertXMLEqual( "Wrong deployment descriptor generated for["
- + expectedDeploymentDescriptor.getName() + "]", myDiff, true );
- }
- catch ( Exception e )
- {
- e.printStackTrace();
- fail( "Could not assert deployment descriptor " + e.getMessage() );
- }
- }
- }
- }
-
- private File[] getDeploymentDescriptors( final File ddDirectory )
- {
- return ddDirectory.listFiles( new FilenameFilter()
- {
- public boolean accept( File dir, String name )
- {
- return !name.equalsIgnoreCase( "manifest.mf" );
- }
- } );
- }
-}
+package org.apache.maven.plugins.ear.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.plugins.ear.util.ResourceEntityResolver;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Base class for ear test cases.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ */
+public abstract class AbstractEarPluginIntegrationTesting
+ extends TestCase
+{
+
+ protected final String FINAL_NAME_PREFIX = "maven-ear-plugin-test-";
+
+ protected final String FINAL_NAME_SUFFIX = "-99.0";
+
+ /**
+ * The base directory.
+ */
+ private File basedir;
+
+ /**
+ * Test repository directory.
+ */
+ protected File localRepositoryDir = new File( getBasedir().getAbsolutePath(), "target/test-classes/m2repo" );
+
+ protected File settingsFile = new File( getBasedir().getAbsolutePath(), "target/test-classes/settings.xml" );
+
+ /**
+ * Execute the EAR plugin for the specified project.
+ *
+ * @param projectName the name of the project
+ * @param properties extra properties to be used by the embedder
+ * @param expectNoError true/flase.
+ * @return the base directory of the project
+ * @throws Exception if an error occurred
+ */
+ protected File executeMojo( final String projectName, final Properties properties, boolean expectNoError )
+ throws Exception
+ {
+ System.out.println( " Building: " + projectName );
+
+ File testDir = getTestDir( projectName );
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ // Let's add alternate settings.xml setting so that the latest dependencies are used
+ String localRepo = System.getProperty( "localRepositoryPath" );
+ verifier.setLocalRepo( localRepo );
+
+ String httpsProtocols = System.getProperty( "https.protocols" );
+ verifier.setSystemProperty( "https.protocols", httpsProtocols );
+ verifier.getCliOptions().add( "-s \"" + settingsFile.getAbsolutePath() + "\"" );//
+ verifier.getCliOptions().add( "-X" );
+ verifier.setLocalRepo( localRepo );
+
+ // On linux and macOSX, an exception is thrown if a build failure occurs underneath
+ try
+ {
+ verifier.executeGoal( "package" );
+ }
+ catch ( VerificationException e )
+ {
+ // @TODO needs to be handled nicely in the verifier
+ if ( expectNoError || !e.getMessage().contains( "Exit code was non-zero" ) )
+ {
+ throw e;
+ }
+ }
+
+ // If no error is expected make sure that error logs are free
+ if ( expectNoError )
+ {
+ verifier.verifyErrorFreeLog();
+ }
+ verifier.resetStreams();
+ return testDir;
+ }
+
+ /**
+ * Execute the EAR plugin for the specified project.
+ *
+ * @param projectName the name of the project
+ * @param properties extra properties to be used by the embedder
+ * @return the base directory of the project
+ * @throws Exception if an error occurred
+ */
+ protected File executeMojo( final String projectName, final Properties properties )
+ throws Exception
+ {
+ return executeMojo( projectName, properties, true );
+ }
+
+ /**
+ * Executes the specified projects and asserts the given artifacts.
+ *
+ * @param projectName the project to test
+ * @param expectedArtifacts the list of artifacts to be found in the EAR archive
+ * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not
+ * @param testDeploymentDescriptors whether we should test deployment descriptors
+ * @return the base directory of the project
+ * @throws Exception Mojo exception in case of an error.
+ */
+ protected File doTestProject( final String projectName, final String[] expectedArtifacts,
+ final boolean[] artifactsDirectory, boolean testDeploymentDescriptors )
+ throws Exception
+ {
+ final File baseDir = executeMojo( projectName, new Properties() );
+ assertEarArchive( baseDir, projectName );
+ assertEarDirectory( baseDir, projectName );
+
+ assertArchiveContent( baseDir, projectName, expectedArtifacts, artifactsDirectory );
+
+ if ( testDeploymentDescriptors )
+ {
+ assertDeploymentDescriptors( baseDir, projectName );
+ }
+
+ return baseDir;
+
+ }
+
+ /**
+ * Executes the specified projects and asserts the given artifacts. Assert the deployment descriptors are valid
+ *
+ * @param projectName the project to test
+ * @param expectedArtifacts the list of artifacts to be found in the EAR archive
+ * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not
+ * @return the base directory of the project
+ * @throws Exception Mojo exception in case of an error.
+ */
+ protected File doTestProject( final String projectName, final String[] expectedArtifacts,
+ final boolean[] artifactsDirectory )
+ throws Exception
+ {
+ return doTestProject( projectName, expectedArtifacts, artifactsDirectory, true );
+
+ }
+
+ /**
+ * Executes the specified projects and asserts the given artifacts as artifacts (non directory)
+ *
+ * @param projectName the project to test
+ * @param expectedArtifacts the list of artifacts to be found in the EAR archive
+ * @param testDeploymentDescriptors whether we should test deployment descriptors
+ * @return the base directory of the project
+ * @throws Exception Mojo exception in case of an error.
+ */
+ protected File doTestProject( final String projectName, final String[] expectedArtifacts,
+ boolean testDeploymentDescriptors )
+ throws Exception
+ {
+ return doTestProject( projectName, expectedArtifacts, new boolean[expectedArtifacts.length] );
+ }
+
+ /**
+ * Executes the specified projects and asserts the given artifacts as artifacts (non directory). Assert the
+ * deployment descriptors are valid
+ *
+ * @param projectName the project to test
+ * @param expectedArtifacts the list of artifacts to be found in the EAR archive
+ * @return the base directory of the project
+ * @throws Exception Mojo exception in case of an error.
+ */
+ protected File doTestProject( final String projectName, final String[] expectedArtifacts )
+ throws Exception
+ {
+ return doTestProject( projectName, expectedArtifacts, true );
+ }
+
+ protected void assertEarArchive( final File baseDir, final String projectName )
+ {
+ assertTrue( "EAR archive does not exist", getEarArchive( baseDir, projectName ).exists() );
+ }
+
+ protected void assertEarDirectory( final File baseDir, final String projectName )
+ {
+ assertTrue( "EAR archive directory does not exist", getEarDirectory( baseDir, projectName ).exists() );
+ }
+
+ protected File getTargetDirectory( final File basedir )
+ {
+ return new File( basedir, "target" );
+ }
+
+ protected File getEarArchive( final File baseDir, final String projectName )
+ {
+ return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) + ".ear" );
+ }
+
+ protected File getEarDirectory( final File baseDir, final String projectName )
+ {
+ return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) );
+ }
+
+ protected String buildFinalName( final String projectName )
+ {
+ return FINAL_NAME_PREFIX + projectName + FINAL_NAME_SUFFIX;
+ }
+
+ protected void assertArchiveContent( final File baseDir, final String projectName, final String[] artifactNames,
+ final boolean[] artifactsDirectory )
+ {
+ // sanity check
+ assertEquals( "Wrong parameter, artifacts mismatch directory flags", artifactNames.length,
+ artifactsDirectory.length );
+
+ File dir = getEarDirectory( baseDir, projectName );
+
+ // Let's build the expected directories sort list
+ final List<File> expectedDirectories = new ArrayList<File>();
+ for ( int i = 0; i < artifactsDirectory.length; i++ )
+ {
+ if ( artifactsDirectory[i] )
+ {
+ expectedDirectories.add( new File( dir, artifactNames[i] ) );
+ }
+ }
+
+ final List<File> actualFiles = buildArchiveContentFiles( dir, expectedDirectories );
+ assertEquals( "Artifacts mismatch " + actualFiles, artifactNames.length, actualFiles.size() );
+ for ( int i = 0; i < artifactNames.length; i++ )
+ {
+ String artifactName = artifactNames[i];
+ final boolean isDirectory = artifactsDirectory[i];
+ File expectedFile = new File( dir, artifactName );
+
+ assertEquals( "Artifact[" + artifactName + "] not in the right form (exploded/archive", isDirectory,
+ expectedFile.isDirectory() );
+ assertTrue( "Artifact[" + artifactName + "] not found in ear archive", actualFiles.contains( expectedFile ) );
+
+ }
+ }
+
+ protected List<File> buildArchiveContentFiles( final File baseDir, final List<File> expectedDirectories )
+ {
+ final List<File> result = new ArrayList<File>();
+ addFiles( baseDir, result, expectedDirectories );
+
+ return result;
+ }
+
+ private void addFiles( final File directory, final List<File> files, final List<File> expectedDirectories )
+ {
+ File[] result = directory.listFiles( new FilenameFilter()
+ {
+ public boolean accept( File dir, String name )
+ {
+ return !name.equals( "META-INF" );
+ }
+
+ } );
+
+ /*
+ * Kinda complex. If we found a file, we always add it to the list of files. If a directory is within the
+ * expectedDirectories short list we add it but we don't add it's content. Otherwise, we don't add the directory
+ * *BUT* we browse it's content
+ */
+ for ( File file : result )
+ {
+ if ( file.isFile() )
+ {
+ files.add( file );
+ }
+ else if ( expectedDirectories.contains( file ) )
+ {
+ files.add( file );
+ }
+ else
+ {
+ addFiles( file, files, expectedDirectories );
+ }
+ }
+ }
+
+ protected File getBasedir()
+ {
+ if ( basedir != null )
+ {
+ return basedir;
+ }
+
+ final String basedirString = System.getProperty( "basedir" );
+ if ( basedirString == null )
+ {
+ basedir = new File( "" );
+ }
+ else
+ {
+ basedir = new File( basedirString );
+ }
+ return basedir;
+ }
+
+ protected File getTestDir( String projectName )
+ throws IOException
+ {
+ return ResourceExtractor.simpleExtractResources( getClass(), "/projects/" + projectName );
+ }
+
+ // Generated application.xml stuff
+
+ /**
+ * Asserts that the deployment descriptors have been generated successfully.
+ *
+ * This test assumes that deployment descriptors are located in the <tt>expected-META-INF</tt> directory of the
+ * project. Note that the <tt>MANIFEST.mf</tt> file is ignored and is not tested.
+ *
+ * @param baseDir the directory of the tested project
+ * @param projectName the name of the project
+ * @throws IOException exception in case of an error.
+ */
+ protected void assertDeploymentDescriptors( final File baseDir, final String projectName )
+ throws IOException
+ {
+ final File earDirectory = getEarDirectory( baseDir, projectName );
+ final File[] actualDeploymentDescriptors = getDeploymentDescriptors( new File( earDirectory, "META-INF" ) );
+ final File[] expectedDeploymentDescriptors =
+ getDeploymentDescriptors( new File( baseDir, "expected-META-INF" ) );
+
+ if ( expectedDeploymentDescriptors == null )
+ {
+ assertNull( "No deployment descriptor was expected", actualDeploymentDescriptors );
+ }
+ else
+ {
+ assertNotNull( "Missing deployment descriptor", actualDeploymentDescriptors );
+
+ // Make sure we have the same number of files
+ assertEquals( "Number of Deployment descriptor(s) mismatch", expectedDeploymentDescriptors.length,
+ actualDeploymentDescriptors.length );
+
+ // Sort the files so that we have the same behavior here
+ Arrays.sort( expectedDeploymentDescriptors );
+ Arrays.sort( actualDeploymentDescriptors );
+
+ for ( int i = 0; i < expectedDeploymentDescriptors.length; i++ )
+ {
+ File expectedDeploymentDescriptor = expectedDeploymentDescriptors[i];
+ File actualDeploymentDescriptor = actualDeploymentDescriptors[i];
+
+ assertEquals( "File name mismatch", expectedDeploymentDescriptor.getName(),
+ actualDeploymentDescriptor.getName() );
+
+ try
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating( true );
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ docBuilder.setEntityResolver( new ResourceEntityResolver() );
+ docBuilder.setErrorHandler( new DefaultHandler() );
+
+ final Diff myDiff =
+ new Diff( docBuilder.parse( expectedDeploymentDescriptor ),
+ docBuilder.parse( actualDeploymentDescriptor ) );
+ XMLAssert.assertXMLEqual( "Wrong deployment descriptor generated for["
+ + expectedDeploymentDescriptor.getName() + "]", myDiff, true );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ fail( "Could not assert deployment descriptor " + e.getMessage() );
+ }
+ }
+ }
+ }
+
+ private File[] getDeploymentDescriptors( final File ddDirectory )
+ {
+ return ddDirectory.listFiles( new FilenameFilter()
+ {
+ public boolean accept( File dir, String name )
+ {
+ return !name.equalsIgnoreCase( "manifest.mf" );
+ }
+ } );
+ }
+}
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index eb729b7..147ae4c 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -1,5 +1,24 @@
package org.apache.maven.plugins.ear.it;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
import static org.apache.maven.jupiter.assertj.MavenITAssertions.assertThat;
import org.apache.maven.jupiter.extension.MavenIT;
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java
index 0a2f558..c5842f6 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIntegrationTestings.java
@@ -34,7 +34,7 @@ import org.codehaus.plexus.util.ReaderFactory;
*/
//FIXME: Currently disabled based on the name
public class EarMojoIntegrationTestings
- extends AbstractEarPluginIT
+ extends AbstractEarPluginIntegrationTesting
{
/**
[maven-ear-plugin] 03/10: Improved configuration. Leave only needed
dependencies.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 66b0a961931c7424c867097fa6b2aa9659d9fdf0
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 20:25:47 2019 +0100
Improved configuration. Leave only needed dependencies.
---
pom.xml | 18 -------
src/it/basic/pom.xml | 45 ----------------
.../application/META-INF/appserver-application.xml | 22 --------
src/it/basic/verify.bsh | 49 -----------------
src/it/packaging-excludes/pom.xml | 53 ------------------
src/it/packaging-excludes/verify.bsh | 61 ---------------------
src/it/packaging-includes/pom.xml | 58 --------------------
src/it/packaging-includes/verify.bsh | 62 ----------------------
src/it/resource-custom-directory/pom.xml | 49 -----------------
.../application/APP-INF/classes/foo.properties | 18 -------
src/it/resource-custom-directory/verify.bsh | 49 -----------------
.../org/apache/maven/plugins/ear/it/EARIT.java | 20 +++++++
12 files changed, 20 insertions(+), 484 deletions(-)
diff --git a/pom.xml b/pom.xml
index df896d8..66df0e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,24 +181,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-inline</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-junit-jupiter</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
diff --git a/src/it/basic/pom.xml b/src/it/basic/pom.xml
deleted file mode 100644
index cb4f225..0000000
--- a/src/it/basic/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.basic</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven Integration Test :: it0033</name>
- <description>Test an EAR generation</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <generateApplicationXml>true</generateApplicationXml>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/basic/src/main/application/META-INF/appserver-application.xml b/src/it/basic/src/main/application/META-INF/appserver-application.xml
deleted file mode 100644
index 76c25e0..0000000
--- a/src/it/basic/src/main/application/META-INF/appserver-application.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<appserver-app>
- <whatever/>
-</appserver-app>
diff --git a/src/it/basic/verify.bsh b/src/it/basic/verify.bsh
deleted file mode 100644
index 0e96a92..0000000
--- a/src/it/basic/verify.bsh
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "META-INF/application.xml",
- "META-INF/appserver-application.xml",
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for existence of " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/it/packaging-excludes/pom.xml b/src/it/packaging-excludes/pom.xml
deleted file mode 100644
index 8f7419e..0000000
--- a/src/it/packaging-excludes/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.packagingexcludes</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven EAR Plugin Integration Test :: packaging excludes</name>
- <description>Test EAR generation using packaging excludes</description>
-
- <dependencies>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <packagingExcludes>commons-lang-*.jar</packagingExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/packaging-excludes/verify.bsh b/src/it/packaging-excludes/verify.bsh
deleted file mode 100644
index 4cc3c9c..0000000
--- a/src/it/packaging-excludes/verify.bsh
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "META-INF/application.xml",
- "META-INF/MANIFEST.MF"
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for included archive entry " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-String[] excludedEntries = {
- "commons-lang-commons-lang-2.5.jar"
-};
-for ( String excluded : excludedEntries )
-{
- System.out.println( "Checking for excluded artifact " + excluded );
- if ( jar.getEntry( excluded ) != null )
- {
- throw new IllegalStateException( "Archive entry should be excluded: " + excluded );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/it/packaging-includes/pom.xml b/src/it/packaging-includes/pom.xml
deleted file mode 100644
index c37ae70..0000000
--- a/src/it/packaging-includes/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.packagingincludes</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven EAR Plugin Integration Test :: packaging includes</name>
- <description>Test EAR generation using packaging includes</description>
-
- <dependencies>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <packagingIncludes>commons-lang-*.jar,META-INF/**</packagingIncludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/packaging-includes/verify.bsh b/src/it/packaging-includes/verify.bsh
deleted file mode 100644
index f8e2415..0000000
--- a/src/it/packaging-includes/verify.bsh
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "commons-lang-commons-lang-2.5.jar",
- "META-INF/application.xml",
- "META-INF/MANIFEST.MF"
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for included archive entry " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-String[] excludedEntries = {
- "commons-io-1.4.jar"
-};
-for ( String excluded : excludedEntries )
-{
- System.out.println( "Checking for excluded artifact " + excluded );
- if ( jar.getEntry( excluded ) != null )
- {
- throw new IllegalStateException( "Archive entry should be excluded: " + excluded );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/it/resource-custom-directory/pom.xml b/src/it/resource-custom-directory/pom.xml
deleted file mode 100644
index 4a1b69b..0000000
--- a/src/it/resource-custom-directory/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.its.ear.resourcecustomdirectory</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>ear</packaging>
-
- <name>Maven EAR Plugin Integration Test :: resource custom directory</name>
- <description>Test filtering of a custom directory</description>
-
- <properties>
- <filtered.value>Hello World!</filtered.value>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <filtering>true</filtering>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties b/src/it/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
deleted file mode 100644
index 08481f0..0000000
--- a/src/it/resource-custom-directory/src/main/application/APP-INF/classes/foo.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-test.property=${filtered.value}
\ No newline at end of file
diff --git a/src/it/resource-custom-directory/verify.bsh b/src/it/resource-custom-directory/verify.bsh
deleted file mode 100644
index 41b23b7..0000000
--- a/src/it/resource-custom-directory/verify.bsh
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-
-File jarFile = new File( basedir, "target/test-1.0.ear" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
-
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "META-INF/application.xml",
- "APP-INF/classes/foo.properties",
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for existence of " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included );
- }
-}
-
-jar.close();
-
-return true;
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index 147ae4c..3863992 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -26,10 +26,27 @@ import org.apache.maven.jupiter.extension.MavenTest;
import org.apache.maven.jupiter.extension.maven.MavenExecutionResult;
import org.apache.maven.jupiter.extension.maven.MavenLog;
import org.apache.maven.jupiter.extension.maven.MavenProjectResult;
+import org.junit.jupiter.api.DisplayName;
+/**
+ * Examples taken from Maven EAR Plugin
+ *
+ * Invoker Integration Test:
+ * <ul>
+ * <li>basic</li>
+ * <li>packaging_includes</li>
+ * <li>packaging_excludes</li>
+ * <li>resource_custom_directory</li>
+ * </ul>
+ *
+ * @author Karl Heinz Marbaise
+ */
@MavenIT
+@DisplayName("EAR Plugin Integration tests")
class EARIT {
+
@MavenTest
+ @DisplayName("Basic configuration. Should simply create an ear file.")
void basic(MavenExecutionResult result, MavenProjectResult project) {
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
@@ -38,6 +55,7 @@ class EARIT {
}
@MavenTest
+ @DisplayName("Packging includes defined.")
void packaging_includes(MavenExecutionResult result, MavenProjectResult project) {
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
@@ -47,6 +65,7 @@ class EARIT {
}
@MavenTest
+ @DisplayName("Packging excludes defined to prevent adding commons-lang-2.5 into the ear file.")
void packaging_excludes(MavenExecutionResult result, MavenProjectResult project) {
assertThat(result).isSuccessful();
assertThat(project).hasTarget()
@@ -56,6 +75,7 @@ class EARIT {
}
@MavenTest
+ @DisplayName("Filtering of a custom directory (likely wrong!)")
void resource_custom_directory(MavenExecutionResult result, MavenProjectResult project, MavenLog log) {
assertThat(result).isSuccessful();
assertThat(log).isSuccessful();
[maven-ear-plugin] 06/10: Added some comments within the pom file
to explain some of the changes.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 88b0fb122980327404d2bd56e787a9da9554c8c6
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 20:49:27 2019 +0100
Added some comments within the pom file to explain some of the changes.
---
pom.xml | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/pom.xml b/pom.xml
index 66df0e7..4562e67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -168,6 +168,9 @@
<version>4.12 </version>
<scope>test</scope>
</dependency>
+ <!--
+ ! New maven-it-extension including dependencies needed to write IT tests.
+ -->
<dependency>
<groupId>org.apache.maven.jupiter.extension</groupId>
<artifactId>maven-it-extension</artifactId>
@@ -237,6 +240,9 @@
</plugins>
</pluginManagement>
<plugins>
+ <!--
+ ! Currently based on animal-sniffer of new packages;
+ -->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<configuration>
@@ -300,6 +306,11 @@
</extraArtifacts>
</configuration>
<executions>
+ <!--
+ ! !!Hack!!
+ ! Currently needed to turn off running integration-test part
+ ! and keep only install goal of maven-invoker-plugin.
+ -->
<execution>
<id>integration-test</id>
<phase>EMPTY</phase>
@@ -314,6 +325,10 @@
<goal>install</goal>
</goals>
<configuration>
+ <!--
+ ! !!Hack!!
+ ! This location is currently hard coded within the maven-it-extension
+ -->
<localRepositoryPath>${project.build.directory}/invoker-repo</localRepositoryPath>
</configuration>
</execution>
[maven-ear-plugin] 05/10: Added another integration test case.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit 48641bbd8af5615e09e386157b3c286df9ddfe6e
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 20:40:10 2019 +0100
Added another integration test case.
---
.../org/apache/maven/plugins/ear/it/EARIT}/jboss/pom.xml | 0
.../src/main/application/META-INF/appserver-application.xml | 0
.../org/apache/maven/plugins/ear/it/EARIT}/jboss/verify.bsh | 0
src/test/java/org/apache/maven/plugins/ear/it/EARIT.java | 12 ++++++++++++
4 files changed, 12 insertions(+)
diff --git a/src/it/jboss/pom.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/jboss/pom.xml
similarity index 100%
rename from src/it/jboss/pom.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/jboss/pom.xml
diff --git a/src/it/jboss/src/main/application/META-INF/appserver-application.xml b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/jboss/src/main/application/META-INF/appserver-application.xml
similarity index 100%
rename from src/it/jboss/src/main/application/META-INF/appserver-application.xml
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/jboss/src/main/application/META-INF/appserver-application.xml
diff --git a/src/it/jboss/verify.bsh b/src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/jboss/verify.bsh
similarity index 100%
rename from src/it/jboss/verify.bsh
rename to src/test/filtered-resources/maven-its/org/apache/maven/plugins/ear/it/EARIT/jboss/verify.bsh
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index 64dc01a..711532e 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -81,4 +81,16 @@ class EARIT {
.containsOnlyOnce("META-INF/application.xml", "APP-INF/classes/foo.properties");
}
+ @MavenTest
+ @DisplayName("JBoss app generation in EAR file.")
+ void jboss(MavenExecutionResult result, MavenProjectResult project, MavenLog log) {
+ assertThat(result).isSuccessful();
+ assertThat(log).isSuccessful();
+ assertThat(project).hasTarget()
+ .withEarFile()
+ .containsOnlyOnce("META-INF/application.xml",
+ "META-INF/appserver-application.xml",
+ "META-INF/jboss-app.xml");
+ }
+
}
[maven-ear-plugin] 04/10: cleaned up.
Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch maven-it-extension
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
commit c1da53d4c9bc00e080947810c80a50e9ee0059ab
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Oct 27 20:29:48 2019 +0100
cleaned up.
---
src/test/java/org/apache/maven/plugins/ear/it/EARIT.java | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
index 3863992..64dc01a 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EARIT.java
@@ -29,9 +29,6 @@ import org.apache.maven.jupiter.extension.maven.MavenProjectResult;
import org.junit.jupiter.api.DisplayName;
/**
- * Examples taken from Maven EAR Plugin
- *
- * Invoker Integration Test:
* <ul>
* <li>basic</li>
* <li>packaging_includes</li>