tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: extracting arquillian servlet runner logic in its own method to easily reuse it in children
Date Sat, 30 May 2015 03:08:54 GMT
Repository: tomee
Updated Branches:
  refs/heads/master d2fdd7632 -> 8c0d055b1


extracting arquillian servlet runner logic in its own method to easily reuse it in children


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/8c0d055b
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/8c0d055b
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/8c0d055b

Branch: refs/heads/master
Commit: 8c0d055b1ff9741ca2d184107ea2bc95c91ad28f
Parents: d2fdd76
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Sat May 30 05:08:42 2015 +0200
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Sat May 30 05:08:42 2015 +0200

----------------------------------------------------------------------
 .../arquillian/common/TomEEContainer.java       | 41 +++++++++++---------
 1 file changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/8c0d055b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
index 7bd6975..6460d96 100644
--- a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
+++ b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
@@ -43,9 +43,6 @@ import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 import org.jboss.shrinkwrap.descriptor.api.Descriptor;
 
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -57,6 +54,9 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
 public abstract class TomEEContainer<Configuration extends TomEEConfiguration> implements
DeployableContainer<Configuration> {
     protected static final Logger LOGGER = Logger.getLogger(TomEEContainer.class.getName());
@@ -122,6 +122,25 @@ public abstract class TomEEContainer<Configuration extends TomEEConfiguration>
i
         ArquillianUtil.preLoadClassesAsynchronously(configuration.getPreloadClasses());
     }
 
+    protected void addArquillianServlet(final Archive<?> archive, final AppInfo appInfo,
+                                      final String archiveName, final HTTPContext httpContext)
{
+        // Avoids "inconvertible types" error in windows build
+        if (archiveName.endsWith(".war")) {
+            httpContext.add(new Servlet("ArquillianServletRunner", "/" + getArchiveNameWithoutExtension(archive)));
+        } else if (archiveName.endsWith(".ear") && appInfo.webApps.size() > 0)
{
+            final String contextRoot = System.getProperty("tomee.arquillian.ear.context",
configuration.getWebContextToUseWithEars());
+            if (contextRoot != null) {
+                httpContext.add(new Servlet("ArquillianServletRunner", ("/" + contextRoot).replace("//",
"/")));
+            } else {
+                for (final WebAppInfo web : appInfo.webApps) { // normally a single webapp
is supported cause of arquillian resolution
+                    httpContext.add(new Servlet("ArquillianServletRunner", ("/" + web.contextRoot).replace("//",
"/")));
+                }
+            }
+        } else {
+            httpContext.add(new Servlet("ArquillianServletRunner", "/arquillian-protocol"));
// needs another jar to add the fake webapp
+        }
+    }
+
     protected void setPorts() {
         //
         // Set ports if they are unspecified
@@ -311,21 +330,7 @@ public abstract class TomEEContainer<Configuration extends TomEEConfiguration>
i
 
             final HTTPContext httpContext = new HTTPContext(configuration.getHost(), configuration.getHttpPort());
 
-            // Avoids "inconvertible types" error in windows build
-            if (archiveName.endsWith(".war")) {
-                httpContext.add(new Servlet("ArquillianServletRunner", "/" + getArchiveNameWithoutExtension(archive)));
-            } else if (archiveName.endsWith(".ear") && appInfo.webApps.size() >
0) {
-                final String contextRoot = System.getProperty("tomee.arquillian.ear.context",
configuration.getWebContextToUseWithEars());
-                if (contextRoot != null) {
-                    httpContext.add(new Servlet("ArquillianServletRunner", ("/" + contextRoot).replace("//",
"/")));
-                } else {
-                    for (final WebAppInfo web : appInfo.webApps) { // normally a single webapp
is supported cause of arquillian resolution
-                        httpContext.add(new Servlet("ArquillianServletRunner", ("/" + web.contextRoot).replace("//",
"/")));
-                    }
-                }
-            } else {
-                httpContext.add(new Servlet("ArquillianServletRunner", "/arquillian-protocol"));
// needs another jar to add the fake webapp
-            }
+            addArquillianServlet(archive, appInfo, archiveName, httpContext);
             addServlets(httpContext, appInfo);
 
             return new ProtocolMetaData().addContext(httpContext);


Mime
View raw message