You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/09/24 16:46:35 UTC

svn commit: r1525906 - in /ofbiz/branches/release12.04: ./ applications/product/widget/facility/ framework/base/src/org/ofbiz/base/container/ framework/catalina/src/org/ofbiz/catalina/container/ framework/common/servicedef/ framework/service/config/ fr...

Author: jleroux
Date: Tue Sep 24 14:46:34 2013
New Revision: 1525906

URL: http://svn.apache.org/r1525906
Log:
Set different ports for testing in a CI environment (e.g. Jenkins) https://issues.apache.org/jira/browse/OFBIZ-4794

*What's for?*
OOTB the port offset is interesting in at least 3 cases:
# To simultaneously run tests on the same Buildbot machine. This is related to http://mail-archives.apache.org/mod_mbox/www-builds/201209.mbox/%3C002101cd991b$0a16de50$1e449af0$@16degrees.com.au%3E
# To simultaneously run the demos without having to change much things, just one parameter
# To eventually run Sonar on OFBiz sources https://issues.apache.org/jira/browse/INFRA-3590

*How it's done?*
Basically, I just added a portoffset integer parameter to some ant targets (of course this JVM param can also be used in a Java call from command line):
* in trunk and R13.07: start, start-batch, start-debug, start-pos, start-both, run-tests and run-test
* in R12.04 and R11.04: run-tests, run-test. I did not set start targets because anyway it would miss the admin port offset, withouh much changes. So can't be used to demonstrate. We will continue to use the current paches for those.

The portoffset parameter is set to zero by default in ClassLoaderContainer.java. 
If a value is passed, it's then grabed by Config.java and passed to ClassLoaderContainer.java, where it's set to this value.

 The portoffset is then used to change in one shoot all the default ports values defined (in config or hardcoded), and the admin port value in R13.07 and trunk.
This is done in following classes:
CatalinaContainer
NamingServiceContainer
ServiceEngine through ServiceLocation
RmiServiceContainer
XMLRPCClientEngine
XmlRpcTests

To avoid hardcoding locations in services definitions, I also had to create some service-locations: main-local-soap and main-remote-soap 

*What are the constraints?*
* For demos: the offset should not be applied to trunk because <service-location name="main-remote-soap" location="http://demo-trunk.ofbiz.apache.org:8080/webtools/control/SOAPService"/> is used for tests by trunk *and all releases*. It's useless to apply to trunk anyway,  offsetting port in releases is enough.
* I did not take into account the Ideal payment harcoded port values in IdealPaymentServiceTest.java. Weirdly I did not cross error during tests, though it seems there are tests using an harcoded port in url.

*What is the status?*
Locally (on Win XP)  I ran many tests combinations with <<ant load-demo run-tests>>.  
Applying the portoffset on a sole running test instance has no effects. I have still some fails (no errors) but those are not related to my changes, they appear also without.
But when I run a combination of any releases/trunk but with R11.04, I get a time out error with testSOAPSimpleService, that I can't explain so far. 
If I run the trunk alone with the portoffset no errors occur. Same if I run a release with portoffset and only testSOAPSimpleService in trunk (w/ or w/o portoffset)

*To summarize:* these changes will be used to run Buildot tests instances simultaneously . And, for coming releases, to run demos without having to create patches. Simply running ant start with a portoffset value which will take care of all ports values, including admin port. For running R12.04 demo as stable we will still need to create a patch for the last time.

*What I will to do for now:* commit the patches and test if I cross the same issue on Buildbot. If it's the same (99% chances it will) I will revert and will continue to locally try to find the reason . I believe this issue is unrelated to the changes I implemened.  And it's just because it's now possible to simultaneously run tests that it appears. 

BTW I just noticed that when you run R11.04 with R12.04, R12.04 takes almost all the CPU (XP is not very, while when running any combinations w/o R11.04 the CPU load is shared. 
Also there are far less tests in R11.04, which coul be the reason when I run it with another test run instance there are no issues.  Because R11.04 tests finish before the other instance gets to run testSOAPSimpleService.

Modified:
    ofbiz/branches/release12.04/applications/product/widget/facility/ReportScreens.xml
    ofbiz/branches/release12.04/build.xml
    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java
    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java
    ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
    ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml
    ofbiz/branches/release12.04/framework/service/config/serviceengine.xml
    ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java
    ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java
    ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
    ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java
    ofbiz/branches/release12.04/framework/start/src/org/ofbiz/base/start/Config.java

Modified: ofbiz/branches/release12.04/applications/product/widget/facility/ReportScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/product/widget/facility/ReportScreens.xml?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/applications/product/widget/facility/ReportScreens.xml (original)
+++ ofbiz/branches/release12.04/applications/product/widget/facility/ReportScreens.xml Tue Sep 24 14:46:34 2013
@@ -25,6 +25,8 @@ under the License.
     <screen name="InventoryReports">
         <section>
             <actions>
+                <property-map resource="BirtUiLabels" map-name="uiLabelMap" global="true"/>
+                
                 <set field="titleProperty" value="CommonReports"/>
                 <set field="headerItem" value="reports"/>
                 <set field="tabButtonItem" value="EditFacilityInventoryItems"/>

Modified: ofbiz/branches/release12.04/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/build.xml?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/build.xml (original)
+++ ofbiz/branches/release12.04/build.xml Tue Sep 24 14:46:34 2013
@@ -868,12 +868,13 @@ under the License.
     </target>
 
     <target name="run-tests" depends="build"
-          description="Run OFBiz default tests; you have to manually execute 'ant load-demo' before and see results in runtime/logs/test-results/html/all-tests.html.">
+          description="Run OFBiz default tests; you have to manually execute 'ant load-demo' before and see results in runtime/logs/test-results/html/all-tests.html. Use -Dportoffset=portNumber to shift all ports with the portNumber value.">
         <java jar="ofbiz.jar" fork="true" resultproperty="test.result">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
             <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="test"/>
+            <arg value="-portoffset=${portoffset}"/>
             <env key="LC_ALL" value="C"/>
         </java>
         <mkdir dir="runtime/logs/test-results/html"/>
@@ -910,7 +911,7 @@ under the License.
         </java>
     </target>
     <target name="run-test" depends="build"
-          description="Run a single test, syntax eg: ant run-test -Dtest.component=service -Dtest.case=service-soap-tests">
+          description="Run a single test, syntax eg: ant run-test -Dtest.component=service -Dtest.case=service-soap-tests. Use -Dportoffset=portNumber to shift all ports with the portNumber value (on Windows - XP at least - you then need top wrap the parameters in double-quotes).">
         <fail unless="test.component">test.component is a required parameter: -Dtest.component=componentname</fail>
         <fail unless="test.case">test.case is a required parameter: -Dtest.case=testcasename</fail>
         <java jar="ofbiz.jar" fork="true" resultproperty="test.result">
@@ -920,6 +921,7 @@ under the License.
             <arg value="test"/>
             <arg value="-component=${test.component}"/>
             <arg value="-case=${test.case}"/>
+            <arg value="-portoffset=${portoffset}"/>
             <env key="LC_ALL" value="C"/>
         </java>
         <delete dir="runtime/logs/test-results/${test.component}-${test.case}"/>

Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java (original)
+++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java Tue Sep 24 14:46:34 2013
@@ -18,11 +18,11 @@
  *******************************************************************************/
 package org.ofbiz.base.container;
 
+import java.net.URL;
+
+import org.ofbiz.base.start.Classpath;
 import org.ofbiz.base.util.CachedClassLoader;
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.start.Classpath;
-
-import java.net.URL;
 
 /**
  * ClassLoader Container; Created a CachedClassLoader for use by all following containers
@@ -32,6 +32,7 @@ public class ClassLoaderContainer implem
 
     public static final String module = ClassLoaderContainer.class.getName();
     protected static CachedClassLoader cl = null;
+    public static Integer portOffset = 0;
 
     /**
      * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
@@ -46,6 +47,34 @@ public class ClassLoaderContainer implem
         }
 
         cl = new CachedClassLoader(new URL[0], parent);
+        
+        if (args != null) {
+            for (String argument : args) {
+                // arguments can prefix w/ a '-'. Just strip them off
+                if (argument.startsWith("-")) {
+                    int subIdx = 1;
+                    if (argument.startsWith("--")) {
+                        subIdx = 2;
+                    }
+                    argument = argument.substring(subIdx);
+                }
+
+                // parse the arguments
+                if (argument.indexOf("=") != -1) {
+                    String argumentName = argument.substring(0, argument.indexOf("="));
+                    String argumentVal = argument.substring(argument.indexOf("=") + 1);
+
+                    if ("portoffset".equalsIgnoreCase(argumentName)) {
+                        try {
+                            ClassLoaderContainer.portOffset = Integer.valueOf(argumentVal);
+                        } catch (NumberFormatException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+            }
+        }
+        
         Thread.currentThread().setContextClassLoader(cl);
         Debug.logInfo("CachedClassLoader created", module);
     }

Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java (original)
+++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java Tue Sep 24 14:46:34 2013
@@ -19,10 +19,10 @@
 package org.ofbiz.base.container;
 
 import java.net.UnknownHostException;
-import java.rmi.registry.Registry;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.RemoteException;
 import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
 import java.rmi.server.UnicastRemoteObject;
 
 import org.ofbiz.base.util.RMIExtendedSocketFactory;
@@ -53,9 +53,9 @@ public class NamingServiceContainer impl
         ContainerConfig.Container.Property port = cfg.getProperty("port");
         if (port.value != null) {
             try {
-                this.namingPort = Integer.parseInt(port.value);
+                this.namingPort = Integer.parseInt(port.value) + ClassLoaderContainer.portOffset;
             } catch (Exception e) {
-                throw new ContainerException("Invalid port defined in container [naming-container] configuration; not a valid int");
+                throw new ContainerException("Invalid port defined in container [naming-container] configuration or as portOffset; not a valid int");
             }
         }
 

Modified: ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
+++ ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Tue Sep 24 14:46:34 2013
@@ -245,6 +245,8 @@ public class CatalinaContainer implement
 
         for (Connector con: tomcat.getService().findConnectors()) {
             ProtocolHandler ph = con.getProtocolHandler();
+            int port = con.getPort();
+            con.setAttribute("port", port);
             if (ph instanceof Http11Protocol) {
                 Http11Protocol hph = (Http11Protocol) ph;
                 Debug.logInfo("Connector " + hph.getName() + " @ " + hph.getPort() + " - " +
@@ -482,7 +484,7 @@ public class CatalinaContainer implement
         // need some standard properties
         String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
         String address = ContainerConfig.getPropertyValue(connectorProp, "address", "0.0.0.0");
-        int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0);
+        int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + ClassLoaderContainer.portOffset;
         boolean secure = ContainerConfig.getPropertyValue(connectorProp, "secure", false);
         if (protocol.toLowerCase().startsWith("ajp")) {
             protocol = "ajp";
@@ -542,8 +544,12 @@ public class CatalinaContainer implement
 
             try {
                 for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
-                    connector.setProperty(prop.name, prop.value);
-                    //connector.setAttribute(prop.name, prop.value);
+                    if ("port".equals(prop.name)) { 
+                        connector.setProperty(prop.name, "" + port);
+                    } else {
+                        connector.setProperty(prop.name, prop.value);
+                        //connector.setAttribute(prop.name, prop.value);
+                    }
                 }
 
                 if (connectorProp.properties.containsKey("URIEncoding")) {

Modified: ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml (original)
+++ ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml Tue Sep 24 14:46:34 2013
@@ -82,28 +82,23 @@ under the License.
 
     <service name="groupTest" engine="group" location="testGroup" invoke=""/>
 
-    <service name="testHttp" engine="http"
-            location="http://localhost:8080/webtools/control/httpService" invoke="testScv">
+    <service name="testHttp" engine="http" location="main-http" invoke="testScv">
         <description>HTTP service wrapper around the test service</description>
         <attribute name="message" type="String" mode="IN" optional="true"/>
         <attribute name="resp" type="String" mode="OUT"/>
     </service>
 
-    <service name="testSoap" engine="soap" export="true"
-            location="http://localhost:8080/webtools/control/SOAPService" invoke="testSOAPScv">
+    <service name="testSoap" engine="soap" export="true" location="main-local-soap" invoke="testSOAPScv">
         <description>SOAP service; calls the OFBiz test SOAP service</description>
         <implements service="testSOAPScv"/>
     </service>
     
-    <service name="testSoapSimple" engine="soap" export="true"
-            location="http://localhost:8080/webtools/control/SOAPService" invoke="testScv">
+    <service name="testSoapSimple" engine="soap" export="true" location="main-local-soap" invoke="testScv">
         <description>simple SOAP service; calls the OFBiz test service</description>
         <implements service="testScv"/>
     </service>
 
-    <service name="testRemoteSoap" engine="soap" export="true" 
-        location="http://demo-trunk.ofbiz.apache.org:8080/webtools/control/SOAPService"
-        invoke="testSoapSimple">
+    <service name="testRemoteSoap" engine="soap" export="true" location="main-remote-soap" invoke="testSoapSimple">
         <attribute name="defaultValue" type="Double" mode="IN" default-value="999.9999"/>
         <attribute name="message" type="String" mode="IN" optional="true"/>
         <attribute name="resp" type="String" mode="OUT"/>

Modified: ofbiz/branches/release12.04/framework/service/config/serviceengine.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/config/serviceengine.xml?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/service/config/serviceengine.xml (original)
+++ ofbiz/branches/release12.04/framework/service/config/serviceengine.xml Tue Sep 24 14:46:34 2013
@@ -62,9 +62,8 @@ under the License.
         <engine name="soap" class="org.ofbiz.service.engine.SOAPClientEngine"/>
         <engine name="ofbiz-workflow" class="org.ofbiz.workflow.WorkflowEngine"/>
         <engine name="workflow" class="org.ofbiz.shark.service.SharkServiceEngine"/>
-        <!-- The engine xml-rpc-local is only used by a test service and for
-             this reason it is configured to run on port 8080 (see rmi-dispatcher in service/ofbiz-component.xml);
-             in order to use this in OFBiz change the port accordingly (for demo the default value is 8080)
+        <!-- The engine xml-rpc-local is only used by a test service and for this reason it is configured to run on port 8080.
+             In order to use this in OFBiz change the port accordingly (for demo the default value is 8080)
         -->
         <engine name="xml-rpc-local" class="org.ofbiz.service.engine.XMLRPCClientEngine">
             <parameter name="url" value="http://localhost:8080/webtools/control/xmlrpc"/>
@@ -74,7 +73,9 @@ under the License.
 
         <service-location name="main-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
         <service-location name="main-http" location="http://localhost:8080/webtools/control/httpService"/>
-
+        <service-location name="main-local-soap" location="http://localhost:8080/webtools/control/SOAPService"/>
+        <service-location name="main-remote-soap" location="http://demo-trunk.ofbiz.apache.org:8080/webtools/control/SOAPService"/>
+        
         <service-location name="entity-sync-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
         <service-location name="entity-sync-http" location="http://localhost:8080/webtools/control/httpService"/>
 

Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java (original)
+++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java Tue Sep 24 14:46:34 2013
@@ -18,21 +18,21 @@
  *******************************************************************************/
 package org.ofbiz.service.engine;
 
-import java.util.Map;
-import java.util.List;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javolution.util.FastMap;
 
-import org.ofbiz.service.ServiceDispatcher;
-import org.ofbiz.service.ModelService;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.GenericServiceCallback;
-import org.ofbiz.service.config.ServiceConfigUtil;
 import org.ofbiz.base.config.GenericConfigException;
+import org.ofbiz.base.container.ClassLoaderContainer;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilXml;
-
+import org.ofbiz.service.GenericServiceCallback;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.ModelService;
+import org.ofbiz.service.ServiceDispatcher;
+import org.ofbiz.service.config.ServiceConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -66,7 +66,15 @@ public abstract class AbstractEngine imp
                 List<? extends Element> locationElements = UtilXml.childElementList(root, "service-location");
                 if (locationElements != null) {
                     for (Element e: locationElements) {
-                        locationMap.put(e.getAttribute("name"), e.getAttribute("location"));
+                        String location = e.getAttribute("location");
+                        if (location.contains("localhost") && ClassLoaderContainer.portOffset != 0) {
+                            Integer port = 1099 + ClassLoaderContainer.portOffset; 
+                            location = location.replace("1099", port.toString());
+                            port = 8080 + ClassLoaderContainer.portOffset; 
+                            location = location.replace("8080", port.toString());
+                        }
+                        
+                        locationMap.put(e.getAttribute("name"), location);
                     }
                 }
             }

Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java (original)
+++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java Tue Sep 24 14:46:34 2013
@@ -28,6 +28,7 @@ import javolution.util.FastMap;
 import org.apache.xmlrpc.XmlRpcException;
 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
 import org.ofbiz.base.config.GenericConfigException;
+import org.ofbiz.base.container.ClassLoaderContainer;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
@@ -90,6 +91,10 @@ public class XMLRPCClientEngine extends 
         String keyAlias  = null;
         try {
             url = ServiceConfigUtil.getEngineParameter(engine, "url");
+            if (ClassLoaderContainer.portOffset != 0) {
+                Integer port = 8080 + ClassLoaderContainer.portOffset; 
+                url = url.replace("8080", port.toString());
+            }
             login = ServiceConfigUtil.getEngineParameter(engine, "login");
             password = ServiceConfigUtil.getEngineParameter(engine, "password");
             keyStoreComponent = ServiceConfigUtil.getEngineParameter(engine, "keyStoreComponent");

Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java (original)
+++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Tue Sep 24 14:46:34 2013
@@ -26,6 +26,7 @@ import java.rmi.server.RMIServerSocketFa
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
+import org.ofbiz.base.container.ClassLoaderContainer;
 import org.ofbiz.base.container.Container;
 import org.ofbiz.base.container.ContainerConfig;
 import org.ofbiz.base.container.ContainerException;
@@ -81,6 +82,11 @@ public class RmiServiceContainer impleme
         String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value;
         String host = lookupHostProp == null || lookupHostProp.value == null ? "localhost" : lookupHostProp.value;
         String port = lookupPortProp == null || lookupPortProp.value == null ? "1099" : lookupPortProp.value;
+        if (ClassLoaderContainer.portOffset != 0) {
+            Integer portValue = Integer.valueOf(port);
+            portValue += ClassLoaderContainer.portOffset;
+            port = portValue.toString();
+        }                
         String keystore = ContainerConfig.getPropertyValue(cfg, "ssl-keystore", null);
         String ksType = ContainerConfig.getPropertyValue(cfg, "ssl-keystore-type", "JKS");
         String ksPass = ContainerConfig.getPropertyValue(cfg, "ssl-keystore-pass", null);

Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java (original)
+++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java Tue Sep 24 14:46:34 2013
@@ -23,6 +23,7 @@ import java.util.Locale;
 import java.util.Map;
 
 import org.apache.xmlrpc.client.XmlRpcClient;
+import org.ofbiz.base.container.ClassLoaderContainer;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
@@ -37,10 +38,14 @@ public class XmlRpcTests extends Abstrac
 
     public static final String module = XmlRpcTests.class.getName();
     public static final String resource = "ServiceErrorUiLabels";
-    public static final String url = "http://localhost:8080/webtools/control/xmlrpc";
+    public static String url = "http://localhost:8080/webtools/control/xmlrpc";
 
     public XmlRpcTests(String name) {
         super(name);
+        if (ClassLoaderContainer.portOffset != 0) {
+            Integer port = 8080 + ClassLoaderContainer.portOffset; 
+            url = url.replace("8080", port.toString());
+        }                            
     }
 
     /**

Modified: ofbiz/branches/release12.04/framework/start/src/org/ofbiz/base/start/Config.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/start/src/org/ofbiz/base/start/Config.java?rev=1525906&r1=1525905&r2=1525906&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/start/src/org/ofbiz/base/start/Config.java (original)
+++ ofbiz/branches/release12.04/framework/start/src/org/ofbiz/base/start/Config.java Tue Sep 24 14:46:34 2013
@@ -55,7 +55,7 @@ public class Config {
         String firstArg = args.length > 0 ? args[0] : "";
         String configFileName = getConfigFileName(firstArg);
         Config result = new Config();
-        result.readConfig(configFileName);
+        result.readConfig(configFileName, args);
         return result;
     }
 
@@ -283,7 +283,7 @@ public class Config {
         }
     }
 
-    public void readConfig(String config) throws IOException {
+    public void readConfig(String config, String[] args) throws IOException {
         // check the java_version
         String javaVersion = System.getProperty("java.version");
         String javaVendor = System.getProperty("java.vendor");
@@ -352,6 +352,13 @@ public class Config {
         // parse the port number
         try {
             adminPort = Integer.parseInt(adminPortStr);
+            if (args.length > 0) {
+                for (String arg : args) {
+                    if (arg.toLowerCase().contains("portoffset=")) {
+                        adminPort += Integer.parseInt(arg.split("=")[1]);
+                    }
+                }
+            }
         } catch (Exception e) {
             adminPort = 0;
         }
@@ -396,16 +403,16 @@ public class Config {
         // set the default locale
         String localeString = props.getProperty("ofbiz.locale.default");
         if (localeString != null && localeString.length() > 0) {
-            String args[] = localeString.split("_");
-            switch (args.length) {
+            String locales[] = localeString.split("_");
+            switch (locales.length) {
                 case 1:
-                    Locale.setDefault(new Locale(args[0]));
+                    Locale.setDefault(new Locale(locales[0]));
                     break;
                 case 2:
-                    Locale.setDefault(new Locale(args[0], args[1]));
+                    Locale.setDefault(new Locale(locales[0], locales[1]));
                     break;
                 case 3:
-                    Locale.setDefault(new Locale(args[0], args[1], args[2]));
+                    Locale.setDefault(new Locale(locales[0], locales[1], args[2]));
             }
             System.setProperty("user.language", localeString);
         }