Author: rmannibucau
Date: Mon May  7 12:15:46 2012
New Revision: 1334969

URL: http://svn.apache.org/viewvc?rev=1334969&view=rev
Log:
tomee arquillian adapters were not able to manage a cluster run

Modified:
    
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
    
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/pom.xml
    
openejb/trunk/openejb/examples/multiple-tomee-arquillian/src/test/resources/arquillian.xml

Modified: 
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java?rev=1334969&r1=1334968&r2=1334969&view=diff
==============================================================================
--- 
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
 (original)
+++ 
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
 Mon May  7 12:15:46 2012
@@ -28,6 +28,7 @@ import java.util.Properties;
 
 public class TomEEConfiguration implements ContainerConfiguration {
 
+    private boolean exportConfAsSystemProperty = false;
     private int httpPort = 8080;
     private int stopPort = 8005;
     private String dir = System.getProperty("java.io.tmpdir") + 
"/arquillian-apache-tomee";
@@ -67,4 +68,12 @@ public class TomEEConfiguration implemen
 
     public void validate() throws ConfigurationException {
     }
+
+    public boolean getExportConfAsSystemProperty() {
+        return exportConfAsSystemProperty;
+    }
+
+    public void setExportConfAsSystemProperty(boolean 
exportConfAsSystemProperty) {
+        this.exportConfAsSystemProperty = exportConfAsSystemProperty;
+    }
 }

Modified: 
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java?rev=1334969&r1=1334968&r2=1334969&view=diff
==============================================================================
--- 
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
 (original)
+++ 
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
 Mon May  7 12:15:46 2012
@@ -83,9 +83,13 @@ public abstract class TomEEContainer<Con
                     map.put(key, value);
                 } catch (Exception e) {
                     try {
-                        map.put(key, Integer.parseInt(value)); // we manage 
String and int so let's try an int
+                        map.put(key, Integer.parseInt(value)); // we manage 
String and int and boolean so let's try an int
                     } catch (Exception ignored) {
-                        LOGGER.log(Level.WARNING, String.format("Override 
failed '%s=%s'", property, value), e);
+                        try {
+                            map.put(key, Boolean.parseBoolean(value)); // idem 
let's try a boolean
+                        } catch (Exception ignored2) {
+                            LOGGER.log(Level.WARNING, String.format("Override 
failed '%s=%s'", property, value), e);
+                        }
                     }
                 }
             }
@@ -105,20 +109,24 @@ public abstract class TomEEContainer<Con
             } catch (NumberFormatException mustNotBeAPortConfig) {
             }
         }
-        //
-        // Export the config back out to properties
-        //
-        for (Map.Entry<String, Object> entry : map.entrySet()) {
-            for (String prefix : prefixes.value()) {
-                try {
-                    final String property = prefix + "." + entry.getKey();
-                    final String value = entry.getValue().toString();
-
-                    LOGGER.log(Level.FINER, String.format("Exporting '%s=%s'", 
property, value));
-
-                    System.setProperty(property, value);
-                } catch (Throwable e) {
-                    // value cannot be converted to a string
+
+        // with multiple containers we don't want it so let the user eb able 
to skip it
+        if (configuration.getExportConfAsSystemProperty()) {
+            //
+            // Export the config back out to properties
+            //
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
+                for (String prefix : prefixes.value()) {
+                    try {
+                        final String property = prefix + "." + entry.getKey();
+                        final String value = entry.getValue().toString();
+
+                        LOGGER.log(Level.FINER, String.format("Exporting 
'%s=%s'", property, value));
+
+                        System.setProperty(property, value);
+                    } catch (Throwable e) {
+                        // value cannot be converted to a string
+                    }
                 }
             }
         }

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/pom.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/pom.xml?rev=1334969&r1=1334968&r2=1334969&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/pom.xml 
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-remote/pom.xml Mon 
May  7 12:15:46 2012
@@ -123,6 +123,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.apache.openwebbeans</groupId>
+      <artifactId>openwebbeans-impl</artifactId>
+      <version>${org.apache.openwebbeans.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>commons-httpclient</groupId>
       <artifactId>commons-httpclient</artifactId>
       <version>3.1</version>

Modified: 
openejb/trunk/openejb/examples/multiple-tomee-arquillian/src/test/resources/arquillian.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/multiple-tomee-arquillian/src/test/resources/arquillian.xml?rev=1334969&r1=1334968&r2=1334969&view=diff
==============================================================================
--- 
openejb/trunk/openejb/examples/multiple-tomee-arquillian/src/test/resources/arquillian.xml
 (original)
+++ 
openejb/trunk/openejb/examples/multiple-tomee-arquillian/src/test/resources/arquillian.xml
 Mon May  7 12:15:46 2012
@@ -23,6 +23,7 @@
         <property name="httpPort">-1</property>
         <property name="stopPort">-1</property>
         <property name="ajpPort">-1</property>
+        <property name="exportConfAsSystemProperty">false</property>
         <property name="version">1.0.0-beta-3-SNAPSHOT</property>
         <property name="dir">target/apache-tomee-remote-1</property>
         <property 
name="appWorkingDir">target/arquillian-test-working-dir-1</property>
@@ -33,6 +34,7 @@
         <property name="httpPort">-1</property>
         <property name="stopPort">-1</property>
         <property name="ajpPort">-1</property>
+        <property name="exportConfAsSystemProperty">false</property>
         <property name="version">1.0.0-beta-3-SNAPSHOT</property>
         <property name="dir">target/apache-tomee-remote-2</property>
         <property 
name="appWorkingDir">target/arquillian-test-working-dir-2</property>


Reply via email to