tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject svn commit: r1555147 - in /tomee/tomee/trunk/arquillian: arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/ arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/
Date Fri, 03 Jan 2014 16:46:58 GMT
Author: jlmonteiro
Date: Fri Jan  3 16:46:57 2014
New Revision: 1555147

URL: http://svn.apache.org/r1555147
Log:
TOMEE-1102 adding deployerProperties config (arquillian.xml) for tomee remote adapter, setting
at least openejb.deployer.binaries.use=true should make it working for remote hosts

Modified:
    tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
    tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEConfiguration.java
    tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java

Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java?rev=1555147&r1=1555146&r2=1555147&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
(original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
Fri Jan  3 16:46:57 2014
@@ -18,11 +18,11 @@ package org.apache.openejb.arquillian.co
 
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.assembler.Deployer;
+import org.apache.openejb.assembler.DeployerEjb;
 import org.apache.openejb.assembler.classic.AppInfo;
 import org.apache.openejb.assembler.classic.Info;
 import org.apache.openejb.assembler.classic.ServletInfo;
 import org.apache.openejb.assembler.classic.WebAppInfo;
-import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.loader.Options;
 import org.apache.openejb.util.NetworkUtil;
 import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
@@ -40,12 +40,8 @@ import org.jboss.shrinkwrap.api.ArchiveP
 import org.jboss.shrinkwrap.api.Assignable;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.exporter.ZipExporter;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
 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 +53,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());
@@ -250,7 +249,22 @@ public abstract class TomEEContainer<Con
             final AppInfo appInfo;
             final String archiveName = archive.getName();
             try {
-                appInfo = deployer().deploy(file.getAbsolutePath());
+                final Properties deployerProperties = getDeployerProperties();
+                if (deployerProperties == null) {
+                    appInfo = deployer().deploy(file.getAbsolutePath());
+                } else {
+                    final Properties props = new Properties();
+                    props.putAll(deployerProperties);
+
+                    if ("true".equalsIgnoreCase(deployerProperties.getProperty(DeployerEjb.OPENEJB_USE_BINARIES,
"false"))) {
+                        final byte[] slurpBinaries = IO.slurp(file).getBytes();
+                        props.put(DeployerEjb.OPENEJB_VALUE_BINARIES, slurpBinaries);
+                        props.put(DeployerEjb.OPENEJB_PATH_BINARIES, archive.getName());
+                    }
+
+                    appInfo = deployer().deploy(file.getAbsolutePath(), props);
+                }
+
                 if (appInfo != null) {
                     moduleIds.put(archiveName, new DeployedApp(appInfo.path, file.getParentFile()));
                     Files.deleteOnExit(file); // "i" folder
@@ -294,6 +308,10 @@ public abstract class TomEEContainer<Con
         }
     }
 
+    protected Properties getDeployerProperties() {
+        return null;
+    }
+
     protected File dumpFile(final Archive<?> archive) {
         String tmpDir = configuration.getAppWorkingDir();
         Files.deleteOnExit(new File(tmpDir));

Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEConfiguration.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEConfiguration.java?rev=1555147&r1=1555146&r2=1555147&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEConfiguration.java
(original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEConfiguration.java
Fri Jan  3 16:46:57 2014
@@ -18,6 +18,7 @@ package org.apache.tomee.arquillian.remo
 
 import org.apache.openejb.arquillian.common.Prefixes;
 import org.apache.openejb.arquillian.common.TomEEConfiguration;
+import org.jboss.arquillian.config.descriptor.api.Multiline;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -43,6 +44,7 @@ public class RemoteTomEEConfiguration ex
     private int debugPort = 5005;
     private String catalina_opts = null; // using this format to match the script one
     private boolean simpleLog = false;
+    private String deployerProperties = "";
 
     public String getGroupId() {
         return groupId;
@@ -132,6 +134,18 @@ public class RemoteTomEEConfiguration ex
         this.lib = lib;
     }
 
+    public String getDeployerProperties() {
+        return deployerProperties;
+    }
+
+    @Multiline
+    public void setDeployerProperties(final String properties) {
+        deployerProperties = properties;
+        if (deployerProperties != null) {
+            deployerProperties = deployerProperties.replaceAll("\n *", "\n");
+        }
+    }
+
     @Override
     public int[] portsAlreadySet() {
         final List<Integer> value = new ArrayList<Integer>();

Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java?rev=1555147&r1=1555146&r2=1555147&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java
(original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java
Fri Jan  3 16:46:57 2014
@@ -30,9 +30,9 @@ import org.jboss.arquillian.container.sp
 import org.jboss.arquillian.protocol.servlet.ServletMethodExecutor;
 import org.jboss.shrinkwrap.api.Archive;
 
-import javax.naming.NamingException;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -43,6 +43,7 @@ import java.util.Properties;
 import java.util.TreeMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import javax.naming.NamingException;
 
 public class RemoteTomEEContainer extends TomEEContainer<RemoteTomEEConfiguration>
{
     private static final Logger logger = Logger.getLogger(RemoteTomEEContainer.class.getName());
@@ -53,6 +54,21 @@ public class RemoteTomEEContainer extend
     private boolean shutdown = false;
     private File tomeeHome;
     private Collection<Archive<?>> containerArchives;
+    private final Properties deployerProperties = new Properties();
+
+    @Override
+    public void setup(final RemoteTomEEConfiguration configuration) {
+        super.setup(configuration);
+
+        if (configuration.getDeployerProperties() != null) {
+            try {
+                final InputStream bytes = IO.read(configuration.getDeployerProperties().getBytes());
+                IO.readProperties(bytes, deployerProperties);
+            } catch (final IOException e) {
+                logger.log(Level.SEVERE, "Can't parse <property name=\"properties\">
value '" + configuration.getProperties() + "'", e);
+            }
+        }
+    }
 
     @Override
     public void start() throws LifecycleException {
@@ -110,6 +126,14 @@ public class RemoteTomEEContainer extend
         }
     }
 
+    @Override
+    protected Properties getDeployerProperties() {
+        if (deployerProperties.isEmpty()) {
+            return null;
+        }
+        return deployerProperties;
+    }
+
     private List<String> args() {
         String opts = configuration.getCatalina_opts();
         if (opts != null) {



Mime
View raw message