You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC
svn commit: r381694 [37/38] - in /incubator/ode/scratch: bpe/ ode/
ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/
ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/
ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InteractionTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InteractionTest.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InteractionTest.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InteractionTest.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.interaction.test;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.IInvocation;
+import org.apache.ode.interaction.InvocationFactory;
+import org.apache.ode.util.BPEDecoder;
+import org.apache.ode.util.BPEEncoder;
+
+
+public abstract class InteractionTest extends TestCase
+{
+ protected abstract void createInteraction() throws Exception;
+
+ protected InteractionTest( String iMethod )
+ {
+ super( iMethod );
+ }
+
+ protected void setUp() throws Exception
+ {
+ createInteraction();
+ }
+
+ protected String getXMLString()
+ {
+ return
+ "<Properties xmlns:blah = \"http://www.blah.com\" >" +
+ "<Property><blah:name>CustName</blah:name><value>King</value></Property>" +
+ "<Property><blah:name>Age</blah:name><value>53</value></Property>" +
+ "<Property><blah:name>Income</blah:name><value>1000000</value></Property>" +
+ "</Properties>";
+
+ }
+
+ protected String[] getXPATHQueries()
+ {
+ return new String[]
+ {
+
+ "/Properties/Property[blimey:name='CustName']/value",
+ "/Properties/Property[blimey:name='Age']/value > 100",
+ "/Properties/Property[blimey:name='Income']/value = 1000000"
+ };
+ }
+
+ protected String[] getXPATHQueryExpectedResults()
+ {
+ return new String[]
+ {
+
+ "King",
+ "false",
+ "true"
+ };
+ }
+
+ protected String runXPathQuery(
+ String iXPATHQuery,
+ IInteraction iInteraction)
+ throws Exception
+ {
+ HashMap namespacemap = new HashMap();
+ namespacemap.put("blimey", "http://www.blah.com");
+
+ IInvocation invocation =
+ InvocationFactory.newInstance().
+ createXPathQueryNodeValueInvocation(iXPATHQuery, namespacemap);
+
+ // Encode and decode the invocation to test xml serialization
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ BPEEncoder encoder = new BPEEncoder( baos );
+ encoder.writeObject( invocation );
+ encoder.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray());
+ BPEDecoder decoder = new BPEDecoder( bais );
+ invocation = ( IInvocation ) decoder.readObject();
+ decoder.close();
+
+ String returnValue = ( String ) iInteraction.invoke(invocation);
+
+ return returnValue;
+ }
+
+ public void testSerializationDeserialization() throws Exception
+ {
+ IInteraction i1 = getInteraction();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream( baos );
+ oos.writeObject( i1 );
+
+ ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray() );
+ ObjectInputStream ois = new ObjectInputStream( bais );
+ IInteraction i2 = ( IInteraction ) ( ois.readObject() );
+
+ executeXPathQueries( i2 );
+
+ }
+
+ public void testXPathQueries() throws Exception
+ {
+ executeXPathQueries( getInteraction() );
+ }
+
+ private void executeXPathQueries( IInteraction iInteraction ) throws Exception
+ {
+ String[] queries = getXPATHQueries();
+ String[] expectedResults = getXPATHQueryExpectedResults();
+ for( int i = 0; i< queries.length; i++ )
+ {
+ String query = queries[i];
+ String result = runXPathQuery(query, iInteraction );
+ String expectedResult = expectedResults[i];
+ assertTrue( expectedResult.equals( result ) );
+ }
+
+ }
+
+ protected IInteraction getInteraction()
+ {
+ return m_interaction;
+ }
+
+ protected void setInteraction( IInteraction iInteraction )
+ {
+ m_interaction = iInteraction;
+ }
+
+ public void go() throws Exception
+ {
+ setUp();
+ testXPathQueries();
+ testSerializationDeserialization();
+ }
+
+ private IInteraction m_interaction;
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InvocationSerializationTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InvocationSerializationTest.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InvocationSerializationTest.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/InvocationSerializationTest.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.interaction.test;
+
+
+import java.io.FileOutputStream;
+import java.util.HashMap;
+
+//import org.apache.ode.interaction.IInvocation;
+import org.apache.ode.interaction.InvocationFactory;
+import org.apache.ode.util.BPEEncoder;
+
+public class InvocationSerializationTest
+{
+ public static void main(String iArgs[]) throws Exception
+ {
+ HashMap namespacemap = new HashMap();
+ namespacemap.put("blimey", "http://www.blah.com");
+
+ InvocationFactory.newInstance().
+ createXPathQueryNodeValueInvocation( "/Properties/Property[blimey:name='CustName']/value",
+ namespacemap);
+
+ FileOutputStream baos = new FileOutputStream( "d:/eclipse/workspace/BPEE_old/serialized.xml");
+ BPEEncoder encoder = new BPEEncoder(baos);
+ //encoder.writeObject( (JaxenNodeValueQuery) invocation );
+ encoder.writeObject( namespacemap );
+ encoder.close();
+
+ System.out.println( "Serialization Test complete.");
+
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/PropertiesInteractionTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/PropertiesInteractionTest.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/PropertiesInteractionTest.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/PropertiesInteractionTest.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.interaction.test;
+
+import java.util.Properties;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.InteractionFactory;
+
+public class PropertiesInteractionTest extends InteractionTest
+{
+ public PropertiesInteractionTest()
+ {
+ super( "go" );
+ }
+
+ public PropertiesInteractionTest(String iMethodName)
+ {
+ super(iMethodName);
+ }
+
+ protected void createInteraction() throws Exception
+ {
+ Properties testProperties = new Properties();
+
+ testProperties.put("CustName", "King");
+ testProperties.put("Income", "1000000");
+ testProperties.put("Age", "53");
+ IInteraction newInteraction =
+ InteractionFactory.newInstance().createPropertiesInteraction(
+ testProperties);
+
+ setInteraction(newInteraction);
+ }
+
+
+
+ public static void main( String[] iArgs ) throws Exception
+ {
+ PropertiesInteractionTest test = new PropertiesInteractionTest();
+ test.go();
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/XMLBufferInteractionTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/XMLBufferInteractionTest.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/XMLBufferInteractionTest.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/interaction/test/XMLBufferInteractionTest.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.interaction.test;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.InteractionException;
+import org.apache.ode.interaction.InteractionFactory;
+
+public class XMLBufferInteractionTest extends InteractionTest
+{
+ public XMLBufferInteractionTest()
+ {
+ super("go");
+ }
+
+
+ public XMLBufferInteractionTest( String iMethod )
+ {
+ super( iMethod );
+
+ }
+
+
+ protected void createInteraction() throws InteractionException
+ {
+ String xmldoc = getXMLString();
+
+
+ IInteraction newInteraction =
+ InteractionFactory.newInstance().createXMLInteraction(
+ xmldoc.getBytes());
+
+ setInteraction(newInteraction);
+ }
+
+
+ public static void main( String[] iArgs ) throws Exception
+ {
+ XMLBufferInteractionTest test = new XMLBufferInteractionTest();
+ test.go();
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPEClientThread.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPEClientThread.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPEClientThread.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPEClientThread.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jan 23, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.performance;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.SimpleRequestMessageEvent;
+import org.apache.ode.interaction.InteractionFactory;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BPEClientThread extends Thread {
+
+ private static Logger logger =
+ Logger.getLogger(BPEClientThread.class.getName());
+
+ private static InteractionFactory interactionfactory =
+ InteractionFactory.newInstance();
+
+ private ThreadCounter tcw;
+ private EventDirector ed;
+ private int numMsgs;
+ private SimpleRequestMessageEvent[] msgs;
+ private String uniquePart;
+ private ArrayList partNames;
+ private String[] responses;
+
+ public BPEClientThread(
+ EventDirector ed,
+ int numMsgs,
+ SimpleRequestMessageEvent[] msgs,
+ ThreadCounter tcw, String uniquePart, ArrayList partNames) {
+ this.ed = ed;
+ this.numMsgs = numMsgs;
+ this.msgs = msgs;
+ this.tcw = tcw;
+ this.uniquePart = uniquePart;
+ this.partNames = partNames;
+ }
+
+ public BPEClientThread(
+ EventDirector ed,
+ int numMsgs,
+ SimpleRequestMessageEvent[] msgs,
+ ThreadCounter tcw, String uniquePart, ArrayList partNames,
+ String[] responses) {
+ this(ed,numMsgs,msgs,tcw,uniquePart,partNames);
+ this.responses = responses;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+
+ // let the thread counter know this thread is started
+ tcw.increment();
+
+ // send the specified number of message groups
+ for (int i = 0; i < numMsgs; i++) {
+
+ //send each message
+ SimpleRequestMessageEvent[] msgsToSend =
+ new SimpleRequestMessageEvent[msgs.length];
+ String uniqueNumber = tcw.getUniqueNumber();
+ for ( int j = 0; j < msgs.length; j++ ) {
+ if ( uniquePart != null ) {
+
+ msgsToSend[j]=buildUniquePart(msgs[j],uniqueNumber);
+ } else {
+ msgsToSend[j]=msgs[j];
+ }
+ }
+
+ for ( int j = 0; j < msgs.length; j++ ) {
+ //send the event syncronously
+ try {
+ IResponseMessage rsp = ed.sendEvent(msgsToSend[j], true);
+ if ( responses != null ) {
+ if ( ! Pattern.compile(responses[j],Pattern.DOTALL).matcher(rsp.toString()).matches()) {
+ System.err.println("Test " + this.getName() +" Response:");
+ System.err.println(responses.toString());
+ System.err.println("Matching RegEx for " + this.getName() +" Response:");
+ System.err.println(responses[j]);
+ tcw.setFaulted();
+ tcw.decrement();
+ return;
+ }
+ }
+ } catch (BPException e) {
+ logger.log(Level.SEVERE,"",e);
+ }
+ }
+ }
+
+ // let the thread counter know this thread is finished
+ tcw.decrement();
+
+ }
+
+ private SimpleRequestMessageEvent buildUniquePart(SimpleRequestMessageEvent msg,
+ String uniqueNumber){
+ SimpleRequestMessageEvent newMsg = new SimpleRequestMessageEvent();
+ try {
+ // set the key
+ newMsg.setStaticKey(msg.getStaticKey());
+
+ Iterator it = partNames.iterator();
+ while ( it.hasNext() ) {
+ String partName = (String)it.next();
+ if ( partName.compareTo(uniquePart) == 0 ) {
+ newMsg.setPart(partName,
+ interactionfactory.createObjectInteraction(uniqueNumber));
+ } else {
+ newMsg.setPart(partName,msg.getPart(partName));
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return newMsg;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPELPerformance.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPELPerformance.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPELPerformance.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/BPELPerformance.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jan 23, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.performance;
+
+import org.apache.ode.test.BPELTester;
+import org.apache.ode.test.CleanUpThread;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BPELPerformance extends BPELTester {
+
+
+
+ /**
+ * Constructor for BPELPerformance.
+ * @param arg0
+ */
+ public BPELPerformance(String arg0) {
+ super(arg0);
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ // get the properties
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testBPELPerformance() throws Exception {
+
+ getSystemProps();
+ mySetup();
+
+ ThreadCounter tcw = new ThreadCounter(threadNumber);
+ long startTime = System.currentTimeMillis();
+ for (int i = 0; i < threadNumber; i++) {
+ // split up the messages
+ int threadNumMessages = numMessages/threadNumber;
+ if ( i == 0) {
+ threadNumMessages += numMessages%threadNumber;
+ }
+ // create and start a thread
+ BPEClientThread bpect =
+ new BPEClientThread(eventDirectors[i],threadNumMessages,msgs,
+ tcw,uniquePart,partNames);
+ bpect.start();
+ }
+ // start cleanup if requested
+ CleanUpThread cut = null;
+ if ( cleanUp >=0 ) {
+ cut = new CleanUpThread(cleanUp);
+ cut.start();
+ }
+ tcw.waitForThreadsToFinish();
+ // stop clean up thread
+ if ( cut != null ) {
+ cut.stopCleanUp();
+ }
+ long time = System.currentTimeMillis() - startTime;
+ double timeInSecs = (double)time/(double)1000;
+ double iterationsPerSec = (double)numMessages/((double)time/(double)1000);
+
+ String longName = testName+"-"+bpelFile+"-"+numMessages+
+ "Messages-"+threadNumber+"Threads(s)";
+
+ setName(longName);
+ System.out.println(longName + " run complete.\n"+
+ "Iterations = " + numMessages +"\n"+
+ "Total time in milliseconds = " + time+"\n"+
+ "Total time in seconds = " + timeInSecs +"\n"+
+ "Iterations/second = "+iterationsPerSec+"(expected:"+expected+")");
+
+ assertTrue(iterationsPerSec > expected);
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/ThreadCounter.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/ThreadCounter.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/ThreadCounter.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/performance/ThreadCounter.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jan 23, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.performance;
+
+import java.util.logging.Logger;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ThreadCounter {
+
+ private static Logger logger =
+ Logger.getLogger(ThreadCounter.class.getName());
+
+ private int uniqueNumber;
+ private int count;
+// private int numThreads;
+ private boolean threadFaulted;
+
+ public synchronized String getUniqueNumber(){
+ uniqueNumber++;
+ return String.valueOf(uniqueNumber);
+ }
+
+ public ThreadCounter( int numThreads ) {
+// this.numThreads = numThreads;
+ }
+
+ public synchronized void increment () {
+ logger.fine("increment");
+ count++;
+ }
+
+ public synchronized void decrement () {
+ logger.fine("decrement");
+ count--;
+ if ( count <= 0 ) {
+ notifyAll();
+ }
+ }
+
+ public synchronized void setFaulted() {
+ threadFaulted = true;
+ }
+
+ public synchronized boolean isFaulted() {
+ return threadFaulted;
+ }
+
+
+ public synchronized void waitForThreadsToFinish() {
+ try {
+ logger.fine("waitforThreadsToFinish");
+ wait();
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELClientTests.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELClientTests.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELClientTests.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELClientTests.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import java.io.FileInputStream;
+//import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import org.apache.ode.action.bpel.ReceiveAction;
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.cc.service.CCServiceFactory;
+import org.apache.ode.client.exceptions.BPEUserException;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.client.util.IBPEInvoker;
+import org.apache.ode.client.util.InvokerBuilder;
+
+
+public class BPELClientTests extends BPELTests
+{
+ protected IBPEInvoker[] invokers;
+
+ public BPELClientTests(String arg0) {
+ super(arg0);
+ }
+
+ public void mySetup() throws Exception
+ {
+ // is this a remote event director
+ remote = true;
+ if (System.getProperty(JNFI).compareTo(IMJNFI) == 0) {
+ remote = false;
+ }
+ // get the event directors so we can send messages and load definitions
+ eventDirectors = new EventDirector[threadNumber];
+ for (int i = 0; i < threadNumber; i++) {
+
+ if (remote) {
+ // all the engine properties are specified in the app server
+ eventDirectors[i] =
+ EventDirectorFactory.createRemoteEventDirector(pkgName);
+ } else {
+ // all the engine properties are specified in the property files
+ eventDirectors[i] = EventDirectorFactory.createEventDirector();
+ }
+ }
+
+ // we only need to deploy once if the engine is remote
+ if (! noLoad ) {
+ int deploys = remote ? 1 : threadNumber;
+ for (int i = 0; i < deploys; i++) {
+ // get a bpel deployer which we can use to load and delete defintions
+ IDeployer deployer =
+ eventDirectors[i].getDeployer(DeployTypeEnum.BPEL);
+ deployer.loadDefinition(
+ new FileInputStream(bpelFile),
+ false);
+ }
+ }
+
+ InvokerBuilder invokerBuilder = new InvokerBuilder(pkgName);
+ invokers = invokerBuilder.buildInvokers(msgFiles);
+
+ // get a hold of a CCService
+ // we need to pass a property to make sure we get the correct
+ // engine state service for the in memory event director, we will have
+ // to modify this if we are going to CC testing with multiple threads
+ // running CC at the same time
+ Properties props = new Properties();
+ props.put(EventDirector.class.getName(),eventDirectors[0]);
+ ccs = CCServiceFactory.newInstance().createCCService(pkgName, props);
+ }
+
+ protected boolean go(long delay, Object[] oobData)throws Exception
+ {
+ mySetup();
+ // if there is a delay and the test is in memory
+ // return true becase this is a appserver only test
+ if ( ! remote && delay > 0 ) {
+ System.out.println("Skipping appserver test " + this.getName() + "....");
+ return true;
+ }
+ StringBuffer responses = new StringBuffer();
+
+ for ( int i=0; i < invokers.length; i++){
+ String resultString = null;
+ try
+ {
+ IBPEInvoker invoker = invokers[i];
+ if ( oobData != null ) {
+ if ( oobData[i] != null ) {
+ Properties props = new Properties();
+ props.put("formatName","atomic");
+ invoker.addPart(ReceiveAction.OOB_DATA,oobData[i],props);
+ }
+ }
+ IResult result = invoker.invoke();
+ resultString = getResultString( result );
+ }
+ catch( BPEUserException e)
+ {
+ resultString = e.toString();
+ }
+
+ responses.append(resultString);
+ System.out.println(resultString);
+ if ( delay > 0 ) {
+ Thread.sleep(delay);
+ }
+ }
+// if (responses.toString().matches(expectedResponse)) {
+ if (Pattern.compile(expectedResponse,Pattern.DOTALL).matcher(responses.toString()).matches()) {
+
+ return true;
+ }
+ System.err.println("Test " + this.getName() +" Response:");
+ System.err.println(responses.toString());
+ System.err.println("Matching RegEx for " + this.getName() +" Response:");
+ System.err.println(expectedResponse);
+
+ return false;
+ }
+
+ public static String getResultString(IResult result)
+ {
+ return result.toString();
+ /*
+ if (result instanceof ISuccessWithResponse)
+ {
+ ISuccessWithResponse swrresult = (ISuccessWithResponse) (result);
+ IBPEMessage rmessage = swrresult.getResponse();
+ StringBuffer buf = new StringBuffer("Fault Message:" + null + "\n");
+ Iterator it = rmessage.getParts().iterator();
+ while (it.hasNext())
+ {
+ IBPEMessagePart part = (IBPEMessagePart) (it.next());
+ String name = part.getName();
+ try
+ {
+ buf.append("Part \""
+ + name
+ + "\" value: "
+ + rmessage.getPart(name).getFormattableValue()
+ .toString() + "\n");
+ } catch (Exception e)
+ {
+ buf.append("Part \"" + name + "\" value: "
+ + e.getLocalizedMessage());
+ }
+ }
+
+ return buf.toString();
+ }
+ return "" + null;
+ */
+ }
+
+ public void testTestThrowFaultOutsideOfBP() throws Exception {
+ bpelFile = bpelTestsDir+"testThrowFaultOutsideOfBP/bpelTestThrowFaultOutsideOfBP.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testThrowFaultOutsideOfBP/datatfo_1.txt"};
+ expectedResponse = ".*urn:sybase:bpel:testFault.*FaultMessage1.*errorID.*FA-1.*errorText.*fault text one.*";
+ assertTrue(go(0, null));
+ /*
+ <FaultResult>
+ <FaultNamespace>urn:sybase:bpel:testFault</FaultNamespace>
+ <FaultName>FaultMessage1</FaultName>
+ <Message>
+ <Part name="errorID">FA-1</Part>
+ <Part name="errorText">fault text one</Part>
+ </Message>
+ </FaultResult>
+ */
+ }
+
+ public void testBadPortType() throws Exception {
+ bpelFile = bpelTestsDir+"testThrowFaultOutsideOfBP/bpelTestThrowFaultOutsideOfBP.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testBadPortType/dataBadPortType.txt"};
+ expectedResponse = ".*SystemException.*";
+ assertTrue(go(0, null));
+ /*
+ <FaultResult>
+ <FaultNamespace>urn:sybase:bpel:testFault</FaultNamespace>
+ <FaultName>FaultMessage1</FaultName>
+ <Message>
+ <Part name="errorID">FA-1</Part>
+ <Part name="errorText">fault text one</Part>
+ </Message>
+ </FaultResult>
+ */
+ }
+
+ public void testFaultCompHandlerInInvoke() throws Exception {
+ bpelFile = bpelTestsDir+"testFaultCompHandlerInInvoke/bpelTestFaultCompHandlerInInvoke.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testFaultCompHandlerInInvoke/data.txt"};
+ expectedResponse = ".*faultFromCompensationHandlerInInvoke.*";
+/*
+ <FaultNamespace>urn:sybase:bpel:faultCompHandlerInInvokeProcessing</FaultNamespace>
+ <FaultName>faultFromCompensationHandlerInInvoke</FaultName>
+ </FaultResult>
+*/
+ assertTrue(go(0, null));
+ }
+
+ public void testReplyWithFault() throws Exception {
+ bpelFile = bpelTestsDir+"testReplyWithFault/bpelTestReplyWithFault.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testReplyWithFault/dataReplyWithFault.txt"};
+ expectedResponse = ".*urn:sybase:bpel:testReplyWithFault.*testFault.*faultID.*fault text one.*faultText.*Event Start Test ReplyWithFault -> caught FaultMessage -> fault text one.*";
+ /*
+ <FaultResult>
+ <FaultNamespace>urn:sybase:bpel:testReplyWithFault</FaultNamespace>
+ <FaultName>testFault</FaultName>
+ <Message>
+ <Part name="faultID">fault text one</Part>
+ <Part name="faultText">Event Start Test ReplyWithFault -> caught FaultMessage -> fault text one</Part>
+ </Message>
+ </FaultResult>
+ */
+ assertTrue(go(0, null));
+ }
+
+
+ public void testLoopedCompensation() throws Exception {
+ bpelFile = bpelTestsDir+"testLoopedCompensation/bpelTestLoopedCompensation.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testLoopedCompensation/data1.txt"};
+ expectedResponse = ".*Scope \"ScopOne\" does not exist.*";
+ assertTrue(go(0, null));
+ }
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTester.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTester.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTester.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTester.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jan 23, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+//import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import junit.framework.TestCase;
+
+import org.apache.ode.action.bpel.ReceiveAction;
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.cc.service.CCServiceFactory;
+import org.apache.ode.cc.service.ICCService;
+import org.apache.ode.client.DescribedValue;
+import org.apache.ode.client.formats.INativeFormat;
+import org.apache.ode.client.spi.interaction.ISPIInteraction;
+import org.apache.ode.event.BPELStaticKey;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.SimpleRequestMessageEvent;
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.InteractionFactory;
+import org.apache.ode.interaction.spiadapter.SPIAdapterInteraction;
+import org.apache.ode.interaction.spiimpl.MasterInteractionFactory;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BPELTester extends TestCase {
+
+ public static final String BPEL_TESTS_DIR = "BPEL_TESTS_DIR";
+ public static final String BPEL = "BPEL";
+ public static final String PKGNAME = "PKGNAME";
+ public static final String MSGS = "MSGS";
+ public static final String OUTPUT = "OUTPUT";
+ public static final String TESTNAME = "TESTNAME";
+ public static final String THREADS = "THREADS";
+ public static final String NUMMSGS = "NUMMSGS";
+ public static final String EXPECTED = "EXPECTED";
+ public static final String JNFI = "java.naming.factory.initial";
+ public static final String IMJNFI =
+ "org.apache.ode.inmemory.jndi.IMContextFactory";
+ public static final String UNIQUE = "UNIQUE";
+ public static final String NOLOAD = "NOLOAD";
+ public static final String CLEANUP = "CLEANUP";
+
+ private static InteractionFactory interactionfactory =
+ InteractionFactory.newInstance();
+
+ protected String expectedResponse;
+
+ public String bpelFile;
+ public String[] msgFiles;
+ public String outPutFile;
+ public int threadNumber;
+ public String testName;
+ public int numMessages;
+ public int expected;
+ public EventDirector[] eventDirectors;
+ public SimpleRequestMessageEvent[] msgs;
+ public String uniquePart;
+ public ArrayList partNames;
+ public boolean noLoad;
+ public int cleanUp = -1;
+ public boolean remote;
+ public ICCService ccs;
+ // default is BPE
+ public String pkgName = "BPE";
+ public String bpelTestsDir = "";
+
+ /**
+ * Constructor for BPELPerformance.
+ * @param arg0
+ */
+ public BPELTester(String arg0) {
+ super(arg0);
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void getSystemProps() {
+
+ // get the properties
+ if ( System.getProperty(BPEL_TESTS_DIR) != null ){
+ bpelTestsDir = System.getProperty(BPEL_TESTS_DIR)+"/";
+ }
+ if ( System.getProperty(PKGNAME) != null ){
+ pkgName = System.getProperty(PKGNAME);
+ }
+ if ( System.getProperty(BPEL) != null ){
+ bpelFile = System.getProperty(BPEL);
+ }
+ if ( System.getProperty(MSGS) != null ) {
+ msgFiles = System.getProperty(MSGS).split(",");
+ }
+ if ( System.getProperty(OUTPUT) != null ) {
+ outPutFile = System.getProperty(OUTPUT);
+ }
+ if (System.getProperty(NUMMSGS) != null) {
+ numMessages = Integer.parseInt(System.getProperty(NUMMSGS));
+ }
+ if (System.getProperty(THREADS) != null) {
+ threadNumber = Integer.parseInt(System.getProperty(THREADS));
+ }
+ if (System.getProperty(EXPECTED) != null) {
+ expected = Integer.parseInt(System.getProperty(EXPECTED));
+ }
+ if ( System.getProperty(TESTNAME) != null ) {
+ testName = System.getProperty(TESTNAME);
+ }
+ if ( System.getProperty(UNIQUE) != null ) {
+ uniquePart = System.getProperty(UNIQUE);
+ }
+
+ noLoad = (System.getProperty(NOLOAD) != null) ? true : false;
+
+ if (System.getProperty(CLEANUP) != null) {
+ cleanUp = Integer.parseInt(System.getProperty(CLEANUP));
+ }
+
+ }
+
+ public void mySetup() throws Exception {
+
+
+ // is this a remote event director
+ remote = true;
+ if (System.getProperty(JNFI).compareTo(IMJNFI) == 0) {
+ remote = false;
+ }
+ // get the event directors so we can send messages and load definitions
+ eventDirectors = new EventDirector[threadNumber];
+ for (int i = 0; i < threadNumber; i++) {
+
+ if (remote) {
+ // all the engine properties are specified in the app server
+ eventDirectors[i] =
+ EventDirectorFactory.createRemoteEventDirector(pkgName);
+ } else {
+ // all the engine properties are specified in the property files
+ eventDirectors[i] = EventDirectorFactory.createEventDirector();
+ }
+ }
+
+ // we only need to deploy once if the engine is remote
+ if (! noLoad ) {
+ int deploys = remote ? 1 : threadNumber;
+ for (int i = 0; i < deploys; i++) {
+ // get a bpel deployer which we can use to load and delete defintions
+ IDeployer deployer =
+ eventDirectors[i].getDeployer(DeployTypeEnum.BPEL);
+ deployer.loadDefinition(
+ new FileInputStream(bpelFile),
+ false);
+ }
+ }
+
+ // create the messages
+ msgs = new SimpleRequestMessageEvent[msgFiles.length];
+ for (int j = 0; j < msgFiles.length; j++) {
+ // each message is passed in a properties file for this utility
+ Properties msg = new Properties();
+ msg.load(new FileInputStream(new File(msgFiles[j])));
+
+ // bpel message are routed based on webservice type information
+ // so we build a key to tack on to our message
+ BPELStaticKey bsk = new BPELStaticKey();
+ bsk.setTargetNamespace(msg.getProperty("target.name.space"));
+ bsk.setPortType(msg.getProperty("port.type"));
+ bsk.setOperation(msg.getProperty("operation"));
+
+ // now create the message
+ msgs[j] = new SimpleRequestMessageEvent();
+ // set the key
+ msgs[j].setStaticKey(bsk);
+
+ //now set the parts of the message, specified as part1, part2, ... in the file
+ int i = 1;
+ partNames = new ArrayList();
+ while (true) {
+ String partName = msg.getProperty("part" + String.valueOf(i++));
+ if (partName == null)
+ break;
+ String[] partSplit = partName.split("\\.");
+ if (partSplit.length < 2) {
+ System.out.println("part name requires a type prefix");
+ break;
+ }
+ IInteraction ior = null;
+ if (partSplit[0].equals("xml")) {
+ ior =
+ interactionfactory.createXMLInteraction(
+ msg.getProperty(partName).getBytes());
+ } else if (partSplit[0].equals("str")) {
+ ior =
+ interactionfactory.createObjectInteraction(
+ msg.getProperty(partName));
+ }
+
+ msgs[j].setPart(partSplit[1], ior);
+ partNames.add(partSplit[1]);
+ }
+ }
+
+ // get a hold of a CCService
+ // we need to pass a property to make sure we get the correct
+ // engine state service for the in memory event director, we will have
+ // to modify this if we are going to CC testing with multiple threads
+ // running CC at the same time
+ Properties props = new Properties();
+ props.put(EventDirector.class.getName(),eventDirectors[0]);
+ ccs = CCServiceFactory.newInstance().createCCService(pkgName,props);
+
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ protected boolean go(long delay, Object[] oobData)throws Exception {
+ mySetup();
+ // if there is a delay and the test is in memory
+ // return true becase this is a appserver only test
+ if ( ! remote && delay > 0 ) {
+ System.out.println("Skipping appserver test " + this.getName() + "....");
+ return true;
+ }
+ StringBuffer responses = new StringBuffer();
+ for ( int i=0; i < msgs.length; i++){
+ SimpleRequestMessageEvent msg = msgs[i];
+ if ( oobData != null ) {
+ if ( oobData[i] != null ) {
+ DescribedValue dv = new DescribedValue( oobData[i], INativeFormat.ATOMIC, new Properties() );
+ ISPIInteraction spi = MasterInteractionFactory.newInstance().createInteraction(dv);
+ SPIAdapterInteraction spiai =
+ new SPIAdapterInteraction( spi );
+ msg.setPart(ReceiveAction.OOB_DATA, spiai);
+ }
+ }
+ IResponseMessage rsp = eventDirectors[0].sendEvent(msg,true);
+ responses.append(rsp.toString());
+ System.out.println(rsp.toString());
+ if ( delay > 0 ) {
+ Thread.sleep(delay);
+ }
+ }
+// if (responses.toString().matches(expectedResponse)) {
+ if (Pattern.compile(expectedResponse,Pattern.DOTALL).matcher(responses.toString()).matches()) {
+
+ return true;
+ }
+ System.err.println("Test " + this.getName() +" Response:");
+ System.err.println(responses.toString());
+ System.err.println("Matching RegEx for " + this.getName() +" Response:");
+ System.err.println(expectedResponse);
+
+ return false;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTests.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTests.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTests.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTests.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,658 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jan 26, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.test;
+
+import java.util.Iterator;
+
+import org.apache.ode.cc.client.InstanceState;
+import org.apache.ode.cc.data.DefinitionData;
+import org.apache.ode.cc.data.InstanceData;
+
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BPELTests extends BPELTester {
+
+
+
+ /**
+ * Constructor for BPELTests.
+ * @param arg0
+ */
+ public BPELTests(String arg0) {
+ super(arg0);
+ }
+
+
+
+ public void testTest1() throws Exception {
+
+ bpelFile = bpelTestsDir+"test1/bpelTest1.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test1/data1_1.txt",bpelTestsDir+"test1/data1_2.txt",
+ bpelTestsDir+"test1/data1_3.txt",bpelTestsDir+"test1/data1_4.txt",bpelTestsDir+"test1/data1_5.txt",
+ bpelTestsDir+"test1/data1_6.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: test1Process complete\n"+
+"Part \"replyText\" value: Event Start Test1.1 -> root process splits into A and B -> process [AB] completes -> process [AB] completes -> processes A and B merge on process C -> merge into root process -> test switch statement -> case min: set loop iterations = 5 -> test loop iterations -> 2 -> 3 -> 4 -> 5 -> 6 -> test1Process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: test1Process complete\n"+
+"Part \"replyText\" value: Event Start Test1.2 -> root process splits into A and B -> process [AB] completes -> process [AB] completes -> merge into root process -> test switch statement -> case min: set loop iterations = 5 -> test loop iterations -> 2 -> 3 -> 4 -> 5 -> 6 -> test1Process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: test1Process complete\n"+
+"Part \"replyText\" value: Event Start Test1.3 -> root process splits into A and B -> process [AB] completes -> process [AB] completes -> merge into root process -> test switch statement -> case min: set loop iterations = 5 -> test loop iterations -> 2 -> 3 -> 4 -> 5 -> 6 -> test1Process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: test1Process complete\n"+
+"Part \"replyText\" value: Event Start Test1.4 -> root process splits into A and B -> process [AB] completes -> process [AB] completes -> merge into root process -> test switch statement -> case min: set loop iterations = 5 -> test loop iterations -> 2 -> 3 -> 4 -> 5 -> 6 -> test1Process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: test1Process complete\n"+
+"Part \"replyText\" value: Event Start Test1.5 -> root process splits into A and B -> process [AB] completes -> process [AB] completes -> processes A and B merge on process C -> merge into root process -> test switch statement -> case max: set loop iterations = 10 -> test loop iterations -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> 10 -> 11 -> test1Process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: test1Process complete\n"+
+"Part \"replyText\" value: Event Start Test1.6 -> root process splits into A and B -> process [AB] completes -> process [AB] completes -> processes A and B merge on process C -> merge into root process -> test switch statement -> otherwise: set loop iterations = 0 -> test loop iterations -> test1Process complete\n";
+
+ assertTrue(go(0, null));
+ }
+
+ public void testTest10() throws Exception {
+ bpelFile = bpelTestsDir+"test10/bpelTest10.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test10/data10_1.txt",bpelTestsDir+"test10/data10_3.txt",
+ bpelTestsDir+"test10/data10_4.txt",bpelTestsDir+"test10/data10_2.txt"};
+ expectedResponse=
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test10.1 -> block for next message -> received event on port test10_3PT -> received event on port test10_4PT -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+
+ public void testTest12() throws Exception {
+ bpelFile = bpelTestsDir+"test12/bpelTest12.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test12/data12_1.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: Start Test12\n"+
+"Part \"replyText\" value: pass\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest13() throws Exception {
+ bpelFile = bpelTestsDir+"test13/bpelTest13.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test13/data13_1.txt"};
+ expectedResponse ="Fault Message:null\n"+
+"Part \"replyID\" value: Test13\n"+
+"Part \"replyText\" value: pass\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest14() throws Exception {
+ bpelFile = bpelTestsDir+"test14/bpelTest14.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test14/data14_1.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: Test14\n"+
+"Part \"replyText\" value: pass\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest15() throws Exception {
+ bpelFile = bpelTestsDir+"test15/bpelTest15.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test15/data15_1.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: Start Test15\n"+
+"Part \"replyText\" value: pass\n";
+ assertTrue(go(0, null));
+ }
+
+
+ public void testTest2() throws Exception {
+ bpelFile = bpelTestsDir+"test2/bpelTest2.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test2/data2_1.txt",bpelTestsDir+"test2/data2_2.txt",
+ bpelTestsDir+"test2/data2_3.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test2.1 -> throw testFault -> caught testFault -> process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: caught fault with catchAll\n"+
+"Part \"replyText\" value: Event Start Test2.2 -> throw unknown fault -> caught fault with catchAll\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test2.3 -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest3() throws Exception {
+ bpelFile = bpelTestsDir+"test3/bpelTest3.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test3/data3_1.txt",bpelTestsDir+"test3/data3_2.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test3.1 -> begin fault test -> throw testFault -> caught testFault -> process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test3.2 -> begin fault test -> throw unknown fault -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+
+ public void testTest5() throws Exception {
+ bpelFile = bpelTestsDir+"test5/bpelTest5.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test5/data5_1_1.txt",bpelTestsDir+"test5/data5_1_2.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test5.1 -> loop on receive until message includes requestEnd = yes -> received message -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest6() throws Exception {
+ bpelFile = bpelTestsDir+"test6/bpelTest6.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test6/data6_1.txt",bpelTestsDir+"test6/data6_2.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test6.1 -> pick branch one invoked -> process complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test6.2 -> pick branch two invoked -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest7() throws Exception {
+ bpelFile = bpelTestsDir+"test7/bpelTest7.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test7/data7_1.txt",bpelTestsDir+"test7/data7_3.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test7.1 -> block for next message -> pick branch two invoked -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+
+ public void testTest8() throws Exception {
+ bpelFile = bpelTestsDir+"test8/bpelTest8.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test8/data8_1.txt",bpelTestsDir+"test8/data8_3.txt",
+ bpelTestsDir+"test8/data8_4.txt",bpelTestsDir+"test8/data8_2.txt",bpelTestsDir+"test8/data8_2.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test8.1 -> block for next message -> received event on port test8_3PT -> received event on port test8_4PT -> block for next message -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest9() throws Exception {
+ bpelFile = bpelTestsDir+"test9/bpelTest9.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test9/data9_1.txt",bpelTestsDir+"test9/data9_2_1.txt",
+ bpelTestsDir+"test9/data9_2_2.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test9.1 -> loop on pick until message includes requestEnd = yes -> pick branch one invoked -> pick branch two invoked -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTest16() throws Exception {
+ bpelFile = bpelTestsDir+"test16/bpelTest16.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test16/data16_1.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n" +
+"Part \"replyText\" value: Event Start Test16.1 -> caught uninitializedVariable -> process complete\n";
+
+
+ assertTrue(go(0, null));
+ }
+
+ public void testTest17() throws Exception {
+ bpelFile = bpelTestsDir+"test17/bpelTest17.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test17/data17_1.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: process complete\n"+
+"Part \"replyText\" value: Event Start Test17.1 -> caught FaultMessage -> fault text one -> process complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTestBPChain() throws Exception {
+ bpelFile = bpelTestsDir+"testBPChain/bpelTestBPChain.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testBPChain/data1_1.txt"};
+ expectedResponse = "Fault Message:null.*response1.*some reply text.*";
+/*"Fault Message:null\n"+
+"Part \"responses\" value: <.xml version=\"1.0\" encoding=\"UTF-8\".>\n"+
+"<response1>response1</response1>\n"+
+"Part \"replyID\" value: a reply ID\n"+
+"Part \"replyText\" value: some reply text\n";*/
+
+ assertTrue(go(0, null));
+ }
+
+/* public void testTimer1() throws Exception {
+ bpelFile = "testTimer1/bpelTestTimer1.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimer1/timer1Data.txt","testTimer1/timer1Data.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: PT3SPT7S\n";
+ assertTrue(go(30000));
+ }
+
+ public void testTimer2() throws Exception {
+ bpelFile = "testTimer2/bpelTestTimer2.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimer2/timer2Data.txt","testTimer2/timer2Data.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: TESTPT7S\n";
+ assertTrue(go(20000));
+ }
+
+ public void testTimer3() throws Exception {
+ bpelFile = "testTimer3/bpelTestTimer3.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimer3/timer3Data.txt"};
+ expectedResponse =
+"Fault Message:null\n";
+ assertTrue(go(1000));
+ }*/
+
+ public void testTerminate() throws Exception {
+ bpelFile = bpelTestsDir+"testTerminate/bpelTestTerminate.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testTerminate/terminate1Data.txt"};
+ expectedResponse =
+"Fault Message:null\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testTerminateTest5() throws Exception {
+ bpelFile = bpelTestsDir+"test5/bpelTest5.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"test5/data5_1_1.txt"}; //,"test5/data5_1_2.txt"};
+ expectedResponse =
+"Fault Message:null\n";//+
+//"Fault Message:null\n"+
+//"Part \"replyID\" value: process complete\n"+
+//"Part \"replyText\" value: Event Start Test5.1 -> loop on receive until message includes requestEnd = yes -> received message -> process complete\n";
+ //assertTrue(
+ go(0, null);//);
+
+ Iterator it = ccs.getDefinitionData().iterator();
+ while ( it.hasNext() ) {
+ DefinitionData dd = (DefinitionData)it.next();
+ if ( dd.getName().equals("test5Process")) {
+ Iterator it2 = ccs.getInstancesData(dd.getID()).iterator();
+ while ( it2.hasNext() ) {
+ InstanceData id = (InstanceData)it2.next();
+ ccs.terminateInstance(id);
+ }
+ break;
+ }
+ }
+
+ // look for the process agian
+ it = ccs.getDefinitionData().iterator();
+ while ( it.hasNext() ) {
+ DefinitionData dd = (DefinitionData)it.next();
+ if ( dd.getName().equals("test5Process")) {
+ Iterator it2 = ccs.getInstancesData(dd.getID()).iterator();
+ while ( it2.hasNext() ) {
+ InstanceData id = (InstanceData)it2.next();
+ if ( ! id.getState().toString().equals(InstanceState.FINISHED.toString()) ) {
+ assertTrue(false);
+ return;
+ }
+ }
+ }
+ }
+ assertTrue(true);
+ }
+
+
+
+ public void testScopedCorrelationSets() throws Exception {
+ bpelFile = bpelTestsDir+"testScopedCorrelationSets/bpelTestScopedCorrelationSets.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testScopedCorrelationSets/data1.txt",
+ bpelTestsDir+"testScopedCorrelationSets/data2.txt",bpelTestsDir+"testScopedCorrelationSets/data3.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Fault Message:null\n"+
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: corrl2\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testCatchForcedTermination() throws Exception {
+ bpelFile = bpelTestsDir+"testCatchForcedTerminate/bpelTestCatchForcedTerminate.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCatchForcedTerminate/data1.txt",
+ bpelTestsDir+"testCatchForcedTerminate/data3.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: forcedTermination\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testFaultInCompensationHandler() throws Exception {
+ bpelFile = bpelTestsDir+"testFaultInCompensationHandler/bpelTestFaultInCompensationHandler.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testFaultInCompensationHandler/data1.txt",
+ bpelTestsDir+"testFaultInCompensationHandler/data3.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: msg1\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testFaultInFaultHandler() throws Exception {
+ bpelFile = bpelTestsDir+"testFaultInFaultHandler/bpelTestFaultInFaultHandler.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testFaultInFaultHandler/data1.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: ScopeOneTwoFaultHandler -> RootScopeFaultHandler\n";
+ assertTrue(go(0, null));
+ }
+
+/* public void testTimerOnAlarmAtRootScope() throws Exception {
+ bpelFile = "testTimerOnAlarmAtRootScope/bpelTestTimerOnAlarmAtRootScope.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimerOnAlarmAtRootScope/timer1Data.txt","testTimerOnAlarmAtRootScope/timer1Data.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: PT3SPT7S\n";
+ assertTrue(go(30000));
+ }*/
+
+ public void testOOBData() throws Exception {
+ bpelFile = bpelTestsDir+"testOOBData/bpelTestOOBData.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testOOBData/oOBData.txt",bpelTestsDir+"testOOBData/oOBData2.txt"};
+ Object[] oobData = new Object[] {"junk",null};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: junk\n";
+ assertTrue(go(0, oobData));
+ }
+
+ public void testNSDeploy() throws Exception {
+ bpelFile = bpelTestsDir+"testNSDeploy/bpelTestNSDeploy.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testNSDeploy/nSDeploy.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: PT7S\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testLocalInvoke() throws Exception {
+ bpelFile = bpelTestsDir+"testLocalInvoke/bpelTestLocalInvoke.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testLocalInvoke/localInvoke1.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: test\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testLinkInSwitch() throws Exception {
+ bpelFile = bpelTestsDir+"testLinkInSwitch/bpelTestLinkInSwitch.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testLinkInSwitch/dataLIS_1.txt",bpelTestsDir+"testLinkInSwitch/dataLIS_2.txt",
+ bpelTestsDir+"testLinkInSwitch/dataLIS_3.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Part \"replyID\" value: testLinkInSwitch complete\n"+
+"Part \"replyText\" value: Start TestLIS.1 -> case1 -> test switch link -> switch-case1 -> known-message -> testLinkInSwitch complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: testLinkInSwitch complete\n"+
+"Part \"replyText\" value: Start TestLIS.2 -> case2 -> test switch link -> switch-case2 -> known-message -> testLinkInSwitch complete\n"+
+"Fault Message:null\n"+
+"Part \"replyID\" value: testLinkInSwitch complete\n"+
+"Part \"replyText\" value: Start TestLIS.3 -> otherwise -> test switch link -> switch-otherwise -> unknown-message -> testLinkInSwitch complete\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testQts377278() throws Exception {
+ bpelFile = bpelTestsDir+"testQts377278/bpelTestQts377278.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testQts377278/data.txt"};
+ expectedResponse =
+ "Fault Message:null\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testPartnerLinkAssign() throws Exception {
+ bpelFile = bpelTestsDir+"testPartnerLinkAssign/bpelTestPartnerLinkAssign.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testPartnerLinkAssign/data.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Part \"replyText\" value: partnerLinkDataInpartnerLinkDataOut\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testNestedSplits() throws Exception {
+ bpelFile = bpelTestsDir+"testNestedSplits/bpelTestNestedSplits.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testNestedSplits/links.props"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Part \"InParam\" value: franklin\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testReplyWithFault() throws Exception {
+ bpelFile = bpelTestsDir+"testReplyWithFault/bpelTestReplyWithFault.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testReplyWithFault/dataReplyWithFault.txt"};
+ expectedResponse =
+"Fault Message:Fault Actor:null Fault Code:null Fault String:testFault\n"+
+"FaultPart \"faultID\" value: fault text one\n"+
+"FaultPart \"faultText\" value: Event Start Test ReplyWithFault -> caught FaultMessage -> fault text one\n\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testCorrlCmplx() throws Exception {
+ bpelFile = bpelTestsDir+"testCorrlCmplx/bpelTestCorrlCmplx.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCorrlCmplx/msg1.txt",
+ bpelTestsDir+"testCorrlCmplx/msg2.txt",
+ bpelTestsDir+"testCorrlCmplx/msg3.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"newParameter2\" value: cory\n";
+ assertTrue(go(0, null));
+ }
+
+ public void testCorrlInvokeReply() throws Exception {
+ bpelFile = bpelTestsDir+"testCorrlInvokeReply/bpelTestCorrlInvokeReply.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCorrlInvokeReply/msg1.txt",
+ bpelTestsDir+"testCorrlInvokeReply/msg2.txt",
+ bpelTestsDir+"testCorrlInvokeReply/msg3.txt",
+ bpelTestsDir+"testCorrlInvokeReply/msg4.txt"};
+ expectedResponse = ".*xml.*jayme.*cory.*heading.*body.*cory.*testinvoke.*jayme.*";
+//"Fault Message:null\n"+
+//"Part \"newParameter2\" value: <?xml version=\"1.0\" encoding=\"UTF-8\"?><tns1:note xmlns:tns=\"urn:mycompany:/corrlcr/invokereplycorrls\" xmlns:tns1=\"http://www.w3schools.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><tns1:to>jayme</tns1:to><tns1:from>cory</tns1:from><tns1:heading>heading</tns1:heading><tns1:body>body</tns1:body></tns1:note>\n"+
+//"Fault Message:null\n"+
+//"Part \"newParameter2\" value: cory\n"+
+//"Fault Message:null\n"+
+//"Part \"newParameter2\" value: testinvoke\n"+
+//"Fault Message:null\n"+
+//"Part \"newParameter2\" value: jayme";
+ assertTrue(go(0, null));
+ }
+
+ public void testGraftGraftChildren() throws Exception {
+ bpelFile = bpelTestsDir+"testGraftGraftChildren/bpelTestGraftGraftChildren.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testGraftGraftChildren/msg1.txt"};
+ expectedResponse = ".*Sombrero.*Slippers.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testLoopedCompensation2() throws Exception {
+ bpelFile = bpelTestsDir+"testLoopedCompensation2/bpelTestLoopedCompensation2.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testLoopedCompensation2/msg1.txt"};
+ expectedResponse = ".*AppendVar:01234567899876543210.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testBuildDocWithNestedNS() throws Exception {
+ bpelFile = bpelTestsDir+"testBuildDocWithNestedNS/bpelTestBuildDocWithNestedNS.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testBuildDocWithNestedNS/company.txt"};
+ expectedResponse = ".*<ns0:Company xmlns:ns0=\"http://www.company.org\" xmlns:ns1=\"http://www.person.org\" xmlns:ns2=\"http://www.product.org\"><ns0:Person><ns1:Name>John Doe</ns1:Name><ns1:SSN>123-45-6789</ns1:SSN></ns0:Person><ns0:Product><ns2:Type>Widget</ns2:Type></ns0:Product></ns0:Company>.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testSingleRuleInCompHandler() throws Exception {
+ bpelFile = bpelTestsDir+"testSingleRuleInCompHandler/bpelTestSingleRuleInCompHandler.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testSingleRuleInCompHandler/msg1.txt"};
+ expectedResponse = ".*true.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testCatchAllNonBPError1() throws Exception {
+ bpelFile = bpelTestsDir+"testCatchAllNonBPError/bpelTestCatchAllNonBPError.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCatchAllNonBPError/msg1.txt"};
+ expectedResponse = ".*catchAll.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testCatchAllNonBPError2() throws Exception {
+ bpelFile = bpelTestsDir+"testCatchAllNonBPError/bpelTestCatchAllNonBPError.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCatchAllNonBPError/msg2.txt"};
+ expectedResponse = ".*catchAll.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testCatchAllNonBPError3() throws Exception {
+ bpelFile = bpelTestsDir+"testCatchAllNonBPError/bpelTestCatchAllNonBPError.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCatchAllNonBPError/msg3.txt"};
+ expectedResponse = ".*catchAll.*";
+ assertTrue(go(0, null));
+ }
+
+ public void testCatchFaultInFaultHandler() throws Exception {
+ bpelFile = bpelTestsDir+"testCatchFaultInFaultHandler/bpelTestCatchFaultInFaultHandler.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCatchFaultInFaultHandler/msg.txt"};
+ expectedResponse = ".*>works<.*";
+ assertTrue(go(0,null));
+ }
+
+ public void testCatchFaultInFaultHandler2() throws Exception {
+ bpelFile = bpelTestsDir+"testCatchFaultInFaultHandler2/bpelTestCatchFaultInFaultHandler2.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testCatchFaultInFaultHandler2/msg.txt"};
+ expectedResponse = ".*>works<.*";
+ assertTrue(go(0,null));
+ }
+
+ public void testThrowInScopeInFaultHandler() throws Exception {
+ bpelFile = bpelTestsDir+"testThrowInScopeInFaultHandler/bpelTestThrowInScopeInFaultHandler.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testThrowInScopeInFaultHandler/msg.txt" };
+ expectedResponse = ".*>doesn&apos;t work<.*";
+ assertTrue(go(0,null));
+ }
+
+ public void testThrowInScopeInFaultHandler2() throws Exception {
+ bpelFile = bpelTestsDir+"testThrowInScopeInFaultHandler2/bpelTestThrowInScopeInFaultHandler2.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testThrowInScopeInFaultHandler2/msg.txt" };
+ expectedResponse = ".*>doesn&apos;t work<.*";
+ assertTrue(go(0,null));
+ }
+
+ // this realy doesn't test the deadlock
+ // this test is also run in another appserver threaded test
+ // to test for the deadlock
+ public void testBPInvokeDeadlock() throws Exception {
+ bpelFile = bpelTestsDir+"testBPInvokeDeadlock/bpelTestBPInvokeDeadlock.jar";
+ threadNumber=1;
+ msgFiles = new String [] {bpelTestsDir+"testBPInvokeDeadlock/deadlock1.txt",
+ bpelTestsDir+"testBPInvokeDeadlock/deadlock2.txt"};
+ expectedResponse =
+ "Fault Message:null\n"+
+ "Part \"newParameter2\" value: test\n"+
+ "Fault Message:null\n"+
+ "Part \"newParameter2\" value: test\n";
+ assertTrue(go(0,null));
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ getSystemProps();
+ }
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTimerTests.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTimerTests.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTimerTests.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/BPELTimerTests.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jan 26, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.test;
+
+
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BPELTimerTests extends BPELTester {
+
+
+
+ /**
+ * Constructor for BPELTests.
+ * @param arg0
+ */
+ public BPELTimerTests(String arg0) {
+ super(arg0);
+ }
+
+
+ public void testTimer1() throws Exception {
+ bpelFile = "testTimer1/bpelTestTimer1.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimer1/timer1Data.txt","testTimer1/timer1Data.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: PT3SPT7S\n";
+ assertTrue(go(30000, null));
+ }
+
+ public void testTimer2() throws Exception {
+ bpelFile = "testTimer2/bpelTestTimer2.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimer2/timer2Data.txt","testTimer2/timer2Data.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: TESTPT7S\n";
+ assertTrue(go(20000, null));
+ }
+
+ public void testTimer3() throws Exception {
+ bpelFile = "testTimer3/bpelTestTimer3.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimer3/timer3Data.txt"};
+ expectedResponse =
+"Fault Message:null\n";
+ assertTrue(go(1000, null));
+ }
+
+
+ public void testTimerOnAlarmAtRootScope() throws Exception {
+ bpelFile = "testTimerOnAlarmAtRootScope/bpelTestTimerOnAlarmAtRootScope.jar";
+ threadNumber=1;
+ msgFiles = new String [] {"testTimerOnAlarmAtRootScope/timer1Data.txt","testTimerOnAlarmAtRootScope/timer1Data.txt"};
+ expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: PT3SPT7S\n";
+ assertTrue(go(30000, null));
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ getSystemProps();
+ }
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/CleanUpThread.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/CleanUpThread.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/CleanUpThread.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/CleanUpThread.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Mar 1, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.test;
+
+//import java.util.logging.Logger;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class CleanUpThread extends Thread {
+
+ private boolean stop;
+// private static Logger logger =
+// Logger.getLogger(CleanUpThread.class.getName());
+ private long interval;
+
+ public CleanUpThread (long interval) {
+ this.interval = interval;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ while (!stop) {
+ // no op right now
+ try {
+ Thread.sleep(interval);
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ public void stopCleanUp() {
+ stop = true;
+ this.interrupt();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/LocalInvokeDeadLockTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/LocalInvokeDeadLockTest.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/LocalInvokeDeadLockTest.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/LocalInvokeDeadLockTest.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Nov 9, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.test;
+
+import org.apache.ode.performance.BPEClientThread;
+import org.apache.ode.performance.ThreadCounter;
+
+public class LocalInvokeDeadLockTest extends BPELTester {
+
+ public LocalInvokeDeadLockTest(String arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void testLocalInvokeDeadLock() throws Exception {
+
+ getSystemProps();
+ mySetup();
+
+ ThreadCounter tcw = new ThreadCounter(threadNumber);
+ for (int i = 0; i < threadNumber; i++) {
+ // split up the messages
+ int threadNumMessages = numMessages/threadNumber;
+ if ( i == 0) {
+ threadNumMessages += numMessages%threadNumber;
+ }
+ // create and start a thread
+ BPEClientThread bpect =
+ new BPEClientThread(eventDirectors[i],threadNumMessages,msgs,
+ tcw,uniquePart,partNames, new String[]{
+ "Fault Message:null\n"+
+ "Part \"newParameter2\" value: test\n",
+ "Fault Message:null\n"+
+ "Part \"newParameter2\" value: test\n"});
+ bpect.start();
+ }
+
+ tcw.waitForThreadsToFinish();
+
+ assertFalse(tcw.isFaulted());
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibility.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibility.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibility.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibility.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import junit.framework.TestCase;
+
+
+public class SerializableCompatibility extends TestCase {
+
+ public void testCompatability( ) throws Exception {
+
+ String newJar = System.getProperty("COMPAT_NEW_JAR");
+ String oldJar = System.getProperty("COMPAT_OLD_JAR");
+
+ String[] args = new String[]{newJar,oldJar};
+ assertTrue(
+ SerializableCompatibilityTester.check(args));
+ }
+}
Added: incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibilityTester.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibilityTester.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibilityTester.java (added)
+++ incubator/ode/scratch/ode/src/test/java/org/apache/ode/test/SerializableCompatibilityTester.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Oct 4, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.test;
+
+import java.io.File;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class SerializableCompatibilityTester {
+
+ public static void main(String[] args) throws Exception {
+ if ( SerializableCompatibilityTester.check(args) ) {
+ System.out.println("Serialization compatible.");
+ } else {
+ System.err.println("Serialization not compatible.");
+ }
+ }
+
+ public static boolean check(String[] args) throws Exception {
+
+ boolean ok = true;
+ int files = 0;
+
+ File newJar = new File(args[0]);
+ JarFile jar = new JarFile(newJar);
+ ClassLoader newJarCL = new URLClassLoader(new URL[]{newJar.toURL()});
+
+ File oldJar = new File(args[1]);
+ ClassLoader oldJarCL = new URLClassLoader(new URL[]{oldJar.toURL()});
+
+ ArrayList clazzes = new ArrayList();
+ Enumeration enumeration = jar.entries();
+ while ( enumeration.hasMoreElements() ) {
+ JarEntry je = (JarEntry)enumeration.nextElement();
+
+ if ( je.getName().endsWith(".class")) {
+
+ // EAS cant handle extra member vars in
+ // primary key classes, this class can't
+ // have a servialVersionUID
+ if ( ! je.getName().endsWith("RegistrationEntityPK.class")) {
+ clazzes.add(je.getName().
+ substring(0,je.getName().indexOf('.')).
+ replace('/','.'));
+ }
+ }
+ }
+
+// ArrayList serClazzes = new ArrayList();
+
+ for (Iterator iter = clazzes.iterator(); iter.hasNext();) {
+
+ String element = (String) iter.next();
+
+ Class newClazz = newJarCL.loadClass(element);
+
+ if ( Serializable.class.isAssignableFrom(newClazz) ) {
+
+ StringBuffer sb = new StringBuffer();
+
+ Class oldClazz = null;
+ try {
+ oldClazz = oldJarCL.loadClass(element);
+ } catch (ClassNotFoundException e) {
+
+ }
+
+ try {
+ newClazz.getDeclaredField("serialVersionUID");
+ } catch ( NoSuchFieldException e ) {
+ sb.append(element + " doesn't define a serialVersionUID.");
+ sb.append("\n");
+ files++;
+ ok = false;
+ if ( oldClazz != null ) {
+ sb.append(getSVUIDline(getSVUID(oldClazz)));
+ sb.append("\n");
+ } else {
+ sb.append(getSVUIDline(1));
+ sb.append("\n");
+ }
+ print(sb);
+ continue;
+ }
+
+ if ( oldClazz != null ) {
+
+ if ( getSVUID(newClazz) != getSVUID(oldClazz) ) {
+ files++;
+ ok = false;
+
+ sb.append(element + " is not compatible with old version.");
+ sb.append("\n");
+ sb.append(getSVUIDline(getSVUID(oldClazz)));
+ sb.append("\n");
+ }
+ }
+
+ if ( ! sb.toString().equals("")) {
+ print(sb);
+ }
+
+ }
+
+ }
+
+ if ( !ok ) System.out.println("Files to change:"+files);
+
+ return ok;
+
+ }
+
+ static void print(StringBuffer sb) {
+ System.err.println(sb.toString());
+ System.err.println();
+ }
+
+ static String getSVUIDline(long id) {
+ return "Add to class:\tstatic final long serialVersionUID = "
+ + String.valueOf(id) + "L;";
+ }
+
+ static long getSVUID(Class clazz) {
+ ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
+ return osc.getSerialVersionUID();
+ }
+}