You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by rr...@apache.org on 2010/04/21 17:46:50 UTC

svn commit: r936363 - in /ode/branches/APACHE_ODE_1.X/jbi/src/test: java/org/apache/ode/jbi/JbiTestBase.java resources/SpringPropertiesJbiTest/deploy.xml resources/SpringPropertiesJbiTest/test.properties

Author: rr
Date: Wed Apr 21 15:46:49 2010
New Revision: 936363

URL: http://svn.apache.org/viewvc?rev=936363&view=rev
Log:
ODE-814: Fixed failing test

Modified:
    ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java
    ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/deploy.xml
    ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/test.properties

Modified: ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java?rev=936363&r1=936362&r2=936363&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java (original)
+++ ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java Wed Apr 21 15:46:49 2010
@@ -107,13 +107,15 @@ public class JbiTestBase extends SpringT
     protected void enableProcess(String resource, boolean enable) throws Exception {
         resource = "target/test/resources/" + resource;
         String process = resource.substring(resource.lastIndexOf('/') + 1);
+        String dir = new File(resource).getAbsolutePath();
+        log.debug("enableProcess " + resource + " " + enable + " path: " + dir);
         if (enable) {
-            odeComponent.getServiceUnitManager().deploy(process, resource);
-            odeComponent.getServiceUnitManager().init(process, resource);
+            odeComponent.getServiceUnitManager().deploy(process, dir);
+            odeComponent.getServiceUnitManager().init(process, dir);
             odeComponent.getServiceUnitManager().start(process);
         } else {
             odeComponent.getServiceUnitManager().stop(process);
-            odeComponent.getServiceUnitManager().undeploy(process, resource);
+            odeComponent.getServiceUnitManager().undeploy(process, dir);
         }
     }
 
@@ -128,86 +130,89 @@ public class JbiTestBase extends SpringT
         if (!manualDeploy) 
             enableProcess(getTestName(), true);
 
-        int i = 0;
-        boolean loop;
-        do {
-            String prefix = i == 0 ? "" : "" + i;
-            loop = i == 0;
-
-            {
-                String deploy = testProperties.getProperty(prefix + "deploy");
-                if (deploy != null) {
-                    loop = true;
-                    enableProcess(getTestName() + "/" + deploy, true);
-                }
-            }
-            {
-                String undeploy = testProperties.getProperty(prefix + "undeploy");
-                if (undeploy != null) {
-                    loop = true;
-                    enableProcess(getTestName() + "/" + undeploy, false);
-                }
-            }
-            
-            String request = testProperties.getProperty(prefix + "request");
-            if (request != null && request.startsWith("@")) {
-                request = inputStreamToString(getClass().getResourceAsStream("/" + getTestName() + "/" + request.substring(1)));
-            }
-            String expectedResponse = testProperties.getProperty(prefix + "response");
-            {
-                String delay = testProperties.getProperty(prefix + "delay");
-                if (delay != null) {
-                    loop = true;
-                    long d = Long.parseLong(delay);
-                    log.debug("Sleeping " + d + " ms");
-                    Thread.sleep(d);
-                }
-            }
-            {
-    	        String httpUrl = testProperties.getProperty(prefix + "http.url");
-    	        if (httpUrl != null && request != null) {
-                    loop = true;
-    	            log.debug(getTestName() + " sending http request to " + httpUrl + " request: " + request);
-    	            URLConnection connection = new URL(httpUrl).openConnection();
-    	            connection.setDoOutput(true);
-    	            connection.setDoInput(true);
-    	            //Send request
-    	            OutputStream os = connection.getOutputStream();
-    	            PrintWriter wt = new PrintWriter(os);
-    	            wt.print(request);
-    	            wt.flush();
-    	            wt.close();
-    	            // Read the response.
-    	            String result = inputStreamToString(connection.getInputStream());
-    	            
-    	            log.debug(getTestName() + " have result: " + result);
-    	            matchResponse(expectedResponse, result, true);
-    	        }
-            }
-            {
-    	        if (testProperties.getProperty(prefix + "nmr.service") != null && request != null) {
-                    loop = true;
-    	            InOut io = smxClient.createInOutExchange();
-    	            io.setService(QName.valueOf(testProperties.getProperty(prefix + "nmr.service")));
-    	            io.setOperation(QName.valueOf(testProperties.getProperty(prefix + "nmr.operation")));
-    	            io.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(request.getBytes())));
-    	            smxClient.sendSync(io,20000);
-                    if (io.getStatus() == ExchangeStatus.ACTIVE) {
-                        assertNotNull(io.getOutMessage());
-                        String result = new SourceTransformer().contentToString(io.getOutMessage());
-                        matchResponse(expectedResponse, result, true);
-                        smxClient.done(io);
-                    } else {
-                        matchResponse(expectedResponse, "", false);
+        try {
+            int i = 0;
+            boolean loop;
+            do {
+                String prefix = i == 0 ? "" : "" + i;
+                loop = i == 0;
+    
+                {
+                    String deploy = testProperties.getProperty(prefix + "deploy");
+                    if (deploy != null) {
+                        loop = true;
+                        enableProcess(getTestName() + "/" + deploy, true);
+                    }
+                }
+                {
+                    String undeploy = testProperties.getProperty(prefix + "undeploy");
+                    if (undeploy != null) {
+                        loop = true;
+                        enableProcess(getTestName() + "/" + undeploy, false);
+                    }
+                }
+                
+                String request = testProperties.getProperty(prefix + "request");
+                if (request != null && request.startsWith("@")) {
+                    request = inputStreamToString(getClass().getResourceAsStream("/" + getTestName() + "/" + request.substring(1)));
+                }
+                String expectedResponse = testProperties.getProperty(prefix + "response");
+                {
+                    String delay = testProperties.getProperty(prefix + "delay");
+                    if (delay != null) {
+                        loop = true;
+                        long d = Long.parseLong(delay);
+                        log.debug("Sleeping " + d + " ms");
+                        Thread.sleep(d);
                     }
-    	        }
-            }
-            
-            i++;
-        } while (loop);
-        
-        if (!manualDeploy)
-            enableProcess(getTestName(), false);
+                }
+                {
+        	        String httpUrl = testProperties.getProperty(prefix + "http.url");
+        	        if (httpUrl != null && request != null) {
+                        loop = true;
+        	            log.debug(getTestName() + " sending http request to " + httpUrl + " request: " + request);
+        	            URLConnection connection = new URL(httpUrl).openConnection();
+        	            connection.setDoOutput(true);
+        	            connection.setDoInput(true);
+        	            //Send request
+        	            OutputStream os = connection.getOutputStream();
+        	            PrintWriter wt = new PrintWriter(os);
+        	            wt.print(request);
+        	            wt.flush();
+        	            wt.close();
+        	            // Read the response.
+        	            String result = inputStreamToString(connection.getInputStream());
+        	            
+        	            log.debug(getTestName() + " have result: " + result);
+        	            matchResponse(expectedResponse, result, true);
+        	        }
+                }
+                {
+        	        if (testProperties.getProperty(prefix + "nmr.service") != null && request != null) {
+                        loop = true;
+        	            InOut io = smxClient.createInOutExchange();
+        	            io.setService(QName.valueOf(testProperties.getProperty(prefix + "nmr.service")));
+        	            io.setOperation(QName.valueOf(testProperties.getProperty(prefix + "nmr.operation")));
+        	            io.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(request.getBytes())));
+        	            smxClient.sendSync(io,20000);
+                        if (io.getStatus() == ExchangeStatus.ACTIVE) {
+                            assertNotNull(io.getOutMessage());
+                            String result = new SourceTransformer().contentToString(io.getOutMessage());
+                            matchResponse(expectedResponse, result, true);
+                            smxClient.done(io);
+                        } else {
+                            matchResponse(expectedResponse, "", false);
+                        }
+        	    }
+                }
+                
+                i++;
+            } while (loop);
+
+        } finally {
+            if (!manualDeploy)
+                enableProcess(getTestName(), false);
+        }
     }
     
     protected void matchResponse(String expectedResponse, String result, boolean succeeded) {

Modified: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/deploy.xml?rev=936363&r1=936362&r2=936363&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/deploy.xml (original)
+++ ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/deploy.xml Wed Apr 21 15:46:49 2010
@@ -7,7 +7,7 @@
         name="bpel:OnEventCorrelation" fileName="OnEventCorrelation.bpel">
         <!--dd:process-events generate="none"/-->
         <dd:provide partnerLink="client">
-            <dd:service name="bpel:OnEventCorrelation" port="OnEventCorrelation" />
+            <dd:service name="bpel:OnEventCorrelation3" port="OnEventCorrelation" />
         </dd:provide>
     </dd:process>
 </dd:deploy>

Modified: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/test.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/test.properties?rev=936363&r1=936362&r2=936363&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/test.properties (original)
+++ ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/SpringPropertiesJbiTest/test.properties Wed Apr 21 15:46:49 2010
@@ -15,7 +15,7 @@
 #    limitations under the License.
 #
 
-1nmr.service={http://sample.bpel.org/bpel/sample}OnEventCorrelation
+1nmr.service={http://sample.bpel.org/bpel/sample}OnEventCorrelation3
 1nmr.operation=initiate
-1request=<message><payload>1000</payload><payload2>t</payload2></message>
+1request=<message><payload>9000</payload><payload2>t2</payload2></message>
 1response=.*myWeirdPropValue2.*