Author: rr
Date: Mon Oct 19 13:11:43 2009
New Revision: 826662

URL: http://svn.apache.org/viewvc?rev=826662&view=rev
Log:
ODE-684: test + fix

Added:
    ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OnEventAlarmJbiTest.java   
(with props)
    ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/
    
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.bpel   
(with props)
    
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.wsdl   
(with props)
    
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelationArtifacts.wsdl
   (with props)
    ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/deploy.xml   (with 
props)
    ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/smx.xml   (with props)
    ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/test.properties   
(with props)
    ode/trunk/jbi/src/test/resources/smx-base.xml   (with props)
Modified:
    ode/trunk/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java
    
ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OdeJbiComponentLifeCycleTest.java
    ode/trunk/jbi/src/test/resources/ExtVarJbiTest/smx.xml
    ode/trunk/jbi/src/test/resources/HelloWorldJbiTest/smx.xml
    ode/trunk/jbi/src/test/resources/log4j.properties
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EH_ALARM.java

Modified: ode/trunk/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java?rev=826662&r1=826661&r2=826662&view=diff
==============================================================================
--- ode/trunk/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java (original)
+++ ode/trunk/jbi/src/test/java/org/apache/ode/jbi/JbiTestBase.java Mon Oct 19 
13:11:43 2009
@@ -19,6 +19,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
@@ -52,12 +53,16 @@
 
     protected OdeComponent odeComponent;
     protected JBIContainer jbiContainer;
-
+    
     protected Properties testProperties;
+    protected DefaultServiceMixClient smxClient;
     
     @Override
     protected AbstractXmlApplicationContext createBeanFactory() {
-        return new ClassPathXmlApplicationContext("/" + getTestName() + 
"/smx.xml");
+        return new ClassPathXmlApplicationContext(new String[] {
+            "/smx-base.xml",
+            "/" + getTestName() + "/smx.xml"
+        });
     }
     
     @Override
@@ -75,6 +80,8 @@
         
         testProperties = new Properties();
         testProperties.load(getClass().getResourceAsStream("/" + getTestName() 
+ "/test.properties"));
+        
+        smxClient = new DefaultServiceMixClient(jbiContainer);
     }
     
     protected String getTestName() {
@@ -101,52 +108,96 @@
 
 
     protected void go() throws Exception {
-        enableProcess(getTestName(), true);
-
-        String request = testProperties.getProperty("request");
-        String expectedResponse = testProperties.getProperty("response");
-        {
-               String httpUrl = testProperties.getProperty("http.url");
-               if (httpUrl != null) {
-                   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.
-                   InputStream is = connection.getInputStream();
-                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                   FileUtil.copyInputStream(is, baos);
-                   String result = baos.toString();
-                   log.debug(getTestName() + " have result: " + result);
-                   matchResponse(expectedResponse, result);
-               }
-        }
-        {
-               if (testProperties.getProperty("nmr.service") != null) {
-                   DefaultServiceMixClient client = new 
DefaultServiceMixClient(jbiContainer);
-                   InOut io = client.createInOutExchange();
-                   
io.setService(QName.valueOf(testProperties.getProperty("nmr.service")));
-                   
io.setOperation(QName.valueOf(testProperties.getProperty("nmr.operation")));
-                   io.getInMessage().setContent(new StreamSource(new 
ByteArrayInputStream(request.getBytes())));
-                   client.sendSync(io,20000);
-                   assertEquals(ExchangeStatus.ACTIVE,io.getStatus());
-                   assertNotNull(io.getOutMessage());
-                   String result = new 
SourceTransformer().contentToString(io.getOutMessage());
-                   matchResponse(expectedResponse, result);
-                   client.done(io);
-               }
-        }      
+        boolean manualDeploy = Boolean.parseBoolean("" + 
testProperties.getProperty("manualDeploy"));
+        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);
+               }
+            }
+            {
+               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);
+                   assertEquals(ExchangeStatus.ACTIVE,io.getStatus());
+                   assertNotNull(io.getOutMessage());
+                   String result = new 
SourceTransformer().contentToString(io.getOutMessage());
+                   matchResponse(expectedResponse, result);
+                   smxClient.done(io);
+               }
+            }
+            
+            i++;
+        } while (loop);
         
-        enableProcess(getTestName(), false);
+        if (!manualDeploy)
+            enableProcess(getTestName(), false);
     }
     
     protected void matchResponse(String expectedResponse, String result) {
         assertTrue("Response doesn't match expected regex.\nExpected: " + 
expectedResponse + "\nReceived: " + result, Pattern.compile(expectedResponse, 
Pattern.DOTALL).matcher(result).matches());
     }
+    
+    private String inputStreamToString(InputStream is) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        FileUtil.copyInputStream(is, baos);
+        return baos.toString();
+    }
 }

Modified: 
ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OdeJbiComponentLifeCycleTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OdeJbiComponentLifeCycleTest.java?rev=826662&r1=826661&r2=826662&view=diff
==============================================================================
--- 
ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OdeJbiComponentLifeCycleTest.java
 (original)
+++ 
ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OdeJbiComponentLifeCycleTest.java
 Mon Oct 19 13:11:43 2009
@@ -34,6 +34,7 @@
 import javax.xml.transform.stream.StreamSource;
 import java.io.File;
 
+...@ignore
 public class OdeJbiComponentLifeCycleTest extends TestCase {
 
     JBIContainer container;

Added: ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OnEventAlarmJbiTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OnEventAlarmJbiTest.java?rev=826662&view=auto
==============================================================================
--- ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OnEventAlarmJbiTest.java 
(added)
+++ ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OnEventAlarmJbiTest.java Mon 
Oct 19 13:11:43 2009
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.jbi;
+
+public class OnEventAlarmJbiTest extends JbiTestBase {
+    public void testOnEventAlarm() throws Exception {
+        go();
+    }
+}

Propchange: 
ode/trunk/jbi/src/test/java/org/apache/ode/jbi/OnEventAlarmJbiTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ode/trunk/jbi/src/test/resources/ExtVarJbiTest/smx.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/ExtVarJbiTest/smx.xml?rev=826662&r1=826661&r2=826662&view=diff
==============================================================================
--- ode/trunk/jbi/src/test/resources/ExtVarJbiTest/smx.xml (original)
+++ ode/trunk/jbi/src/test/resources/ExtVarJbiTest/smx.xml Mon Oct 19 13:11:43 
2009
@@ -23,58 +23,34 @@
        xmlns:util="http://www.springframework.org/schema/util";
        xmlns:jencks="http://jencks.org/2.0";
           >
-
-       <bean id="transactionManager" 
class="org.apache.geronimo.transaction.manager.GeronimoTransactionManager"/>
-
-  <jencks:connectionTracker id="connectionTracker" 
geronimoTransactionManager="#transactionManager" />
-    
-  <jencks:workManager
-            id="workManager"
-            threadPoolSize="200"
-            transactionManager="#transactionManager" />
-  
-  <jencks:bootstrapContext
-            id="bootstrapContext"
-            workManager="#workManager"
-            transactionManager="#transactionManager" />
-  
   <jencks:poolingSupport 
-            id="poolingSupport" 
+            id="poolingSupport2" 
             connectionMaxIdleMinutes="5"
             poolMaxSize="20"
             />
   
   <jencks:connectionManager
-            id="connectionManager"
+            id="connectionManager2"
             containerManagedSecurity="false"
-            transaction="xa"
+            transaction="local"
             transactionManager="#transactionManager"
-            poolingSupport="#poolingSupport"
+            poolingSupport="#poolingSupport2"
             connectionTracker="#connectionTracker" 
             />
-
-    <bean id="localDerbyMCF" class="org.tranql.connector.derby.EmbeddedXAMCF">
+    <bean id="localDerbyMCF" 
class="org.tranql.connector.derby.EmbeddedLocalMCF">
            <property name="databaseName" value="target/test/testdb"/>
            <property name="createDatabase" value="true"/>
                <property name="userName" value = "sa"/>
         <property name="password" value = ""/>
        </bean>
-       <bean id="localDerbyDataSource" 
class="org.springframework.jca.support.LocalConnectionFactoryBean">
+       <bean id="localDerbyDataSource" 
class="org.jencks.factory.ConnectionFactoryFactoryBean">
            <property name="managedConnectionFactory" ref="localDerbyMCF"/>
-           <property name="connectionManager" ref="connectionManager"/>
+           <property name="connectionManager" ref="connectionManager2"/>
        </bean>
        
-       <bean id="jndi"
-             class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" 
-             factory-method="makeInitialContext"
-             singleton="true"
-             depends-on="bootstrapContext"
-             >
-         <property name="entries" ref="jndiEntries" />
-       </bean>
-
     <util:map id="jndiEntries">
-           <entry key="testds" value-ref="localDerbyDataSource"/>
+        <entry key="java:comp/env/jdbc/ode" value-ref="odeDS"/>
+        <entry key="testds" value-ref="localDerbyDataSource"/>
        </util:map>
        
        <sm:container 

Modified: ode/trunk/jbi/src/test/resources/HelloWorldJbiTest/smx.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/HelloWorldJbiTest/smx.xml?rev=826662&r1=826661&r2=826662&view=diff
==============================================================================
--- ode/trunk/jbi/src/test/resources/HelloWorldJbiTest/smx.xml (original)
+++ ode/trunk/jbi/src/test/resources/HelloWorldJbiTest/smx.xml Mon Oct 19 
13:11:43 2009
@@ -24,17 +24,8 @@
        xmlns:util="http://www.springframework.org/schema/util";
        >
 
-    <bean id="transactionManager" 
class="org.apache.geronimo.transaction.manager.GeronimoTransactionManager"/>
-
-    <bean id="jndi"
-          class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" 
-          factory-method="makeInitialContext"
-          singleton="true"
-          >
-      <property name="entries" ref="jndiEntries" />
-    </bean>
-
     <util:map id="jndiEntries">
+        <entry key="java:comp/env/jdbc/ode" value-ref="odeDS"/>
     </util:map>
     
     <sm:container 

Added: 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.bpel
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.bpel?rev=826662&view=auto
==============================================================================
--- 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.bpel 
(added)
+++ 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.bpel 
Mon Oct 19 13:11:43 2009
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<bpws:process 
xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:ns="http://sample.bpel.org/bpel/sampleArtifacts"; 
xmlns:tns="http://sample.bpel.org/bpel/sample"; exitOnStandardFault="yes" 
name="OnEventCorrelation" suppressJoinFailure="yes" 
targetNamespace="http://sample.bpel.org/bpel/sample"; 
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+  <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"; 
location="OnEventCorrelation.wsdl" 
namespace="http://sample.bpel.org/bpel/sample"/>
+  <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"; 
location="OnEventCorrelationArtifacts.wsdl" 
namespace="http://sample.bpel.org/bpel/sampleArtifacts"/>
+  <bpws:partnerLinks>
+    <bpws:partnerLink myRole="OnEventCorrelationProvider" name="client" 
partnerLinkType="tns:OnEventCorrelation"/>
+  </bpws:partnerLinks>
+  <bpws:variables>
+    <bpws:variable messageType="tns:OnEventCorrelationMessage" name="input"/>
+    <bpws:variable messageType="tns:OnEventCorrelationMessage" name="output"/>
+  </bpws:variables>
+  <bpws:correlationSets>
+    <bpws:correlationSet name="CorrelationSet" properties="ns:input"/>
+  </bpws:correlationSets>
+  <bpws:sequence name="main">
+    <bpws:scope>
+      <bpws:sequence>
+        <bpws:receive createInstance="yes" operation="initiate" 
partnerLink="client" portType="tns:OnEventCorrelation" variable="input">
+          <bpws:correlations>
+            <bpws:correlation initiate="yes" set="CorrelationSet"/>
+          </bpws:correlations>
+        </bpws:receive>
+        <bpws:assign>
+          <bpws:copy>
+            <bpws:from>'test1'</bpws:from>
+            <bpws:to>$output.payload</bpws:to>
+          </bpws:copy>
+        </bpws:assign>
+        <bpws:reply operation="initiate" partnerLink="client" 
variable="output"/>
+      </bpws:sequence>
+    </bpws:scope>
+    <bpws:scope>
+      <bpws:eventHandlers>
+        <bpws:onEvent operation="complete" partnerLink="client" 
portType="tns:OnEventCorrelation" variable="input" 
messageType="tns:OnEventCorrelationMessage">
+          <bpws:correlations>
+            <bpws:correlation initiate="no" set="CorrelationSet"/>
+          </bpws:correlations>
+          <bpws:scope>
+            <bpws:sequence>
+              <bpws:assign>
+                <bpws:copy>
+                  <bpws:from>concat('ok2',$output.payload)</bpws:from>
+                  <bpws:to>$output.payload</bpws:to>
+                </bpws:copy>
+              </bpws:assign>
+              <bpws:reply operation="complete" partnerLink="client" 
variable="output"/>
+            </bpws:sequence>
+          </bpws:scope>
+        </bpws:onEvent>
+        <bpws:onAlarm>
+          <bpws:for>'PT1S'</bpws:for>
+          <bpws:scope>
+            <bpws:sequence>
+              <bpws:assign>
+                <bpws:copy>
+                  <bpws:from>'ok3'</bpws:from>
+                  <bpws:to>$output.payload</bpws:to>
+                </bpws:copy>
+              </bpws:assign>
+            </bpws:sequence>
+          </bpws:scope>
+        </bpws:onAlarm>
+      </bpws:eventHandlers>
+      <bpws:sequence>
+        <bpws:wait>
+          <bpws:for>'PT10000S'</bpws:for>
+        </bpws:wait>
+      </bpws:sequence>
+    </bpws:scope>
+  </bpws:sequence>
+</bpws:process>

Propchange: 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.bpel
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.wsdl
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.wsdl?rev=826662&view=auto
==============================================================================
--- 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.wsdl 
(added)
+++ 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.wsdl 
Mon Oct 19 13:11:43 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"; 
xmlns:tns="http://sample.bpel.org/bpel/sample"; 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
name="OnEventCorrelation" targetNamespace="http://sample.bpel.org/bpel/sample";
+xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+>
+  <message name="OnEventCorrelationMessage">
+    <part type="xsd:string" name="payload"/>
+    <part type="xsd:string" name="payload2"/>
+  </message>
+  <portType name="OnEventCorrelation">
+    <operation name="initiate">
+      <input message="tns:OnEventCorrelationMessage"/>
+      <output message="tns:OnEventCorrelationMessage"/>
+    </operation>
+    <operation name="complete">
+      <input message="tns:OnEventCorrelationMessage"/>
+      <output message="tns:OnEventCorrelationMessage"/>
+    </operation>
+  </portType>
+  <binding name="OnEventCorrelationBinding" type="tns:OnEventCorrelation">
+    <wsdlsoap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+    <operation name="initiate">
+      <wsdlsoap:operation soapAction="initiate"/>
+      <input>
+        <wsdlsoap:body use="literal"/>
+      </input>
+      <output>
+        <wsdlsoap:body use="literal"/>
+      </output>
+    </operation>
+    <operation name="complete">
+      <wsdlsoap:operation soapAction="complete"/>
+      <input>
+        <wsdlsoap:body use="literal"/>
+      </input>
+      <output>
+        <wsdlsoap:body use="literal"/>
+      </output>
+    </operation>
+  </binding>
+  <service name="OnEventCorrelation">
+    <port binding="tns:OnEventCorrelationBinding" name="OnEventCorrelation">
+      <wsdlsoap:address 
location="http://localhost:8080/ode/processes/OnEventCorrelation/"/>
+    </port>
+  </service>
+    <plnk:partnerLinkType name="OnEventCorrelation">
+        <plnk:role name="OnEventCorrelationProvider" 
portType="tns:OnEventCorrelation"/>
+    </plnk:partnerLinkType>
+</definitions>

Propchange: 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelation.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelationArtifacts.wsdl
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelationArtifacts.wsdl?rev=826662&view=auto
==============================================================================
--- 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelationArtifacts.wsdl
 (added)
+++ 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelationArtifacts.wsdl
 Mon Oct 19 13:11:43 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<definitions 
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"; 
+    xmlns:tns="http://sample.bpel.org/bpel/sampleArtifacts"; 
+    xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop"; 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
+    xmlns:bpel="http://sample.bpel.org/bpel/sample"; 
+    name="OnEventCorrelationArtifacts" 
+    targetNamespace="http://sample.bpel.org/bpel/sampleArtifacts"; 
+    xmlns="http://schemas.xmlsoap.org/wsdl/";
+    >
+<vprop:property name="input" type="xs:string"/>
+<vprop:propertyAlias messageType="bpel:OnEventCorrelationMessage" 
part="payload" propertyName="tns:input">
+<!--vprop:query><![CDATA[bpel:input]]></vprop:query-->
+</vprop:propertyAlias>
+<import location="OnEventCorrelation.wsdl" 
namespace="http://sample.bpel.org/bpel/sample"/>
+</definitions>

Propchange: 
ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/OnEventCorrelationArtifacts.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/deploy.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/deploy.xml?rev=826662&view=auto
==============================================================================
--- ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/deploy.xml (added)
+++ ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/deploy.xml Mon Oct 19 
13:11:43 2009
@@ -0,0 +1,31 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<dd:deploy xmlns:dd="http://www.apache.org/ode/schemas/dd/2007/03";
+    xmlns:bpel="http://sample.bpel.org/bpel/sample";
+    >
+
+    <dd:process
+        name="bpel:OnEventCorrelation" fileName="OnEventCorrelation.bpel">
+        <!--dd:process-events generate="none"/-->
+        <dd:provide partnerLink="client">
+            <dd:service name="bpel:OnEventCorrelation" 
port="OnEventCorrelation" />
+        </dd:provide>
+    </dd:process>
+</dd:deploy>

Propchange: ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/deploy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/smx.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/smx.xml?rev=826662&view=auto
==============================================================================
--- ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/smx.xml (added)
+++ ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/smx.xml Mon Oct 19 
13:11:43 2009
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
+       xmlns:http="http://servicemix.apache.org/http/1.0";
+       xmlns:eip="http://servicemix.apache.org/eip/1.0";
+       xmlns:util="http://www.springframework.org/schema/util";
+       xmlns:jencks="http://jencks.org/2.0";
+       xmlns:mws="http://ode/bpel/unit-test.wsdl";
+       xmlns:bpel="http://sample.bpel.org/bpel/sample";
+       >
+
+    <util:map id="jndiEntries">
+        <entry key="java:comp/env/jdbc/ode" value-ref="odeDS"/>
+    </util:map>
+
+    <sm:container 
+        id="jbi" 
+        embedded="true" 
+        rootDir="target/test/smx"
+        transactionManager="#transactionManager"
+        depends-on="jndi"
+        >
+    </sm:container>
+</beans>

Propchange: ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/smx.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/test.properties
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/test.properties?rev=826662&view=auto
==============================================================================
--- ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/test.properties (added)
+++ ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/test.properties Mon 
Oct 19 13:11:43 2009
@@ -0,0 +1,26 @@
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+
+1nmr.service={http://sample.bpel.org/bpel/sample}OnEventCorrelation
+1nmr.operation=initiate
+1request=<message><payload>1000</payload><payload2>t</payload2></message>
+1response=.*test1.*
+2delay=2000
+3nmr.service={http://sample.bpel.org/bpel/sample}OnEventCorrelation
+3nmr.operation=complete
+3request=<message><payload>1000</payload><payload2>t2</payload2></message>
+3response=.*ok2ok3.*

Propchange: ode/trunk/jbi/src/test/resources/OnEventAlarmJbiTest/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ode/trunk/jbi/src/test/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/log4j.properties?rev=826662&r1=826661&r2=826662&view=diff
==============================================================================
--- ode/trunk/jbi/src/test/resources/log4j.properties (original)
+++ ode/trunk/jbi/src/test/resources/log4j.properties Mon Oct 19 13:11:43 2009
@@ -21,8 +21,8 @@
 #
 # The logging properties used during tests..
 #
-log4j.rootLogger=DEBUG, file
-#log4j.rootLogger=INFO, file
+#log4j.rootLogger=DEBUG, file
+log4j.rootLogger=INFO, file
 
 log4j.appender.file=org.apache.log4j.FileAppender
 log4j.appender.file.File=target/test/test.log
@@ -33,3 +33,14 @@
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.conversionpattern=%d{mm...@hh:mm:ss} %-5p 
(%13F:%L) %3x - %m%n 
 
+log4j.category.org.apache.servicemix.jbi.nmr.flow.seda=DEBUG
+log4j.category.org.apache.ode.jbi.EndpointReferenceContextImpl=DEBUG
+#log4j.category.org.apache.ode.bpel=DEBUG
+log4j.category.httpclient=DEBUG
+log4j.category.httpclient.Wire=DEBUG
+log4j.category.org.apache.ode.jbi.JbiTestBase=DEBUG
+log4j.category.org.apache.ode.bpel.runtime.SCOPE=DEBUG
+log4j.category.org.apache.ode.bpel.runtime.EH_EVENT=DEBUG
+log4j.category.org.apache.ode.bpel.runtime.EH_ALARM=DEBUG
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=DEBUG
+

Added: ode/trunk/jbi/src/test/resources/smx-base.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/jbi/src/test/resources/smx-base.xml?rev=826662&view=auto
==============================================================================
--- ode/trunk/jbi/src/test/resources/smx-base.xml (added)
+++ ode/trunk/jbi/src/test/resources/smx-base.xml Mon Oct 19 13:11:43 2009
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
+     xmlns:http="http://servicemix.apache.org/http/1.0";
+     xmlns:eip="http://servicemix.apache.org/eip/1.0";
+       xmlns:util="http://www.springframework.org/schema/util";
+       xmlns:jencks="http://jencks.org/2.0";
+     >
+
+  <bean id="transactionManager" 
class="org.apache.geronimo.transaction.manager.GeronimoTransactionManager"/>
+
+  <jencks:connectionTracker id="connectionTracker" 
geronimoTransactionManager="#transactionManager" />
+    
+  <jencks:workManager
+            id="workManager"
+            threadPoolSize="200"
+            transactionManager="#transactionManager" />
+  
+  <jencks:bootstrapContext
+            id="bootstrapContext"
+            workManager="#workManager"
+            transactionManager="#transactionManager" />
+  
+  <jencks:poolingSupport 
+            id="poolingSupport" 
+            connectionMaxIdleMinutes="5"
+            poolMaxSize="20"
+            />
+  
+  <jencks:connectionManager
+            id="connectionManager"
+            containerManagedSecurity="false"
+            transaction="local"
+            transactionManager="#transactionManager"
+            poolingSupport="#poolingSupport"
+            connectionTracker="#connectionTracker" 
+            />
+
+    <bean id="odeMCF" class="org.tranql.connector.derby.EmbeddedLocalMCF">
+      <property name="databaseName" value="target/test/smx/ode/hibdb"/>
+      <property name="createDatabase" value="false"/>
+    <property name="userName" value = "sa"/>
+        <property name="password" value = ""/>
+  </bean>
+    <!-- 
+   <bean id="odeMCF" class="org.tranql.connector.oracle.LocalMCF">
+    <property name="databaseName" value="XE"/>
+    <property name="userName" value="ode12"/>
+    <property name="password" value="ode12"/>
+    <property name="portNumber" value="1521"/>
+    <property name="serverName" value="localhost"/>
+    <property name="driverType" value="thin"/>
+  </bean>
+   -->
+   
+  <bean id="odeDS" class="org.jencks.factory.ConnectionFactoryFactoryBean">
+      <property name="managedConnectionFactory" ref="odeMCF"/>
+      <property name="connectionManager" ref="connectionManager"/>
+  </bean>
+  
+  <bean id="jndi"
+        class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" 
+        factory-method="makeInitialContext"
+        singleton="true"
+        depends-on="bootstrapContext"
+        >
+    <property name="entries" ref="jndiEntries" />
+  </bean>
+</beans>

Propchange: ode/trunk/jbi/src/test/resources/smx-base.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EH_ALARM.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EH_ALARM.java?rev=826662&r1=826661&r2=826662&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EH_ALARM.java 
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EH_ALARM.java 
Mon Oct 19 13:11:43 2009
@@ -20,6 +20,7 @@
 
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.rtrep.v2.channels.*;
+import org.apache.ode.jacob.ChannelListener;
 import org.apache.ode.jacob.SynchChannel;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -105,7 +106,7 @@
 
         /**
          * Concretion constructor.
-         * @param alarm date at which time to fire
+         * @param alarm date at which time to fire. If null, then we wait 
forever (for control channels handling)
          */
         WAIT(Calendar alarm, ScopeFrame scopeFrame) {
             _alarm = alarm;
@@ -115,7 +116,24 @@
         public void run() {
             Calendar now = Calendar.getInstance();
 
-            if (now.before(_alarm)) {
+            Set<ChannelListener> listeners = new 
EventHandlerControlChannelListener(_cc) {
+                private static final long serialVersionUID = 
-7750428941445331236L;
+
+                public void stop() {
+                    _psc.completed(null, _comps);
+                }
+
+            }.or(new TerminationChannelListener(_tc) {
+                private static final long serialVersionUID = 
6100105997983514609L;
+
+                public void terminate() {
+                    _psc.completed(null, _comps);
+                }
+            });
+
+            if (_alarm == null) {
+                object(false, listeners);
+            } else if (now.before(_alarm)) {
                 TimerResponseChannel trc = 
newChannel(TimerResponseChannel.class);
                 getBpelRuntime().registerTimer(trc,_alarm.getTime());
                 object(false,new TimerResponseChannelListener(trc){
@@ -129,20 +147,8 @@
                     public void onCancel() {
                         _psc.completed(null, _comps);
                     }
-                }.or(new EventHandlerControlChannelListener(_cc) {
-                    private static final long serialVersionUID = 
-7750428941445331236L;
-
-                    public void stop() {
-                        _psc.completed(null, _comps);
-                    }
-
-                }.or(new TerminationChannelListener(_tc) {
-                    private static final long serialVersionUID = 
6100105997983514609L;
-
-                    public void terminate() {
-                        _psc.completed(null, _comps);
-                    }
-                })));
+                });
+                object(false, listeners);
             } else /* now is later then alarm time */ {
                 // If the alarm has passed we fire the nested activity
                 instance(new FIRE(_scopeFrame));
@@ -209,7 +215,12 @@
                         }
                         instance(new WAIT(next, _scopeFrame));
                     } else {
-                        _psc.completed(faultData, _comps);
+                        if (faultData != null) {
+                            //propagate completion into bounding scope only if 
we got fault during processing onAlarm
+                            _psc.completed(faultData, _comps);
+                        } else {
+                            instance(new WAIT(null, _scopeFrame));
+                        }
                     }
                 }
 


Reply via email to