Author: assaf Date: Mon Apr 23 22:57:44 2007 New Revision: 531776 URL: http://svn.apache.org/viewvc?view=rev&rev=531776 Log: Modified to use test processes form classpath instead of file system path gymnastics
Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/FaultHandling20Test.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/StructuredActivities20Test.java incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java Mon Apr 23 22:57:44 2007 @@ -40,6 +40,7 @@ import javax.persistence.Persistence; import javax.xml.namespace.QName; import java.io.File; +import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.Properties; @@ -143,29 +144,28 @@ * with 1. * */ - int propsFileCnt = 0; - File testPropsFile = new File(deployDir + "/test.properties"); + URL testPropsFile = getClass().getResource(deployDir + "/test.properties"); - if (!testPropsFile.exists()) { + if (testPropsFile == null) { propsFileCnt++; - testPropsFile = new File(deployDir + "/test" + propsFileCnt + testPropsFile = getClass().getResource(deployDir + "/test" + propsFileCnt + ".properties"); - if (!testPropsFile.exists()) { - System.err.println("can't find " + testPropsFile.toString()); + if (testPropsFile == null) { + System.err.println("can't find " + testPropsFile); } } scheduler.begin(); try { - Collection<QName> procs = store.deploy(new File(deployDir)); + Collection<QName> procs = store.deploy(new File(testPropsFile.getPath()).getParentFile()); for (QName procName : procs) { server.register(store.getProcessConfiguration(procName)); } } catch (ContextException bpelE) { Properties testProps = new Properties(); - testProps.load(testPropsFile.toURL().openStream()); + testProps.load(testPropsFile.openStream()); String responsePattern = testProps.getProperty("response1"); bpelE.printStackTrace(); testResponsePattern("init", bpelE.getMessage(), responsePattern); @@ -178,10 +178,10 @@ ArrayList<Thread> testThreads = new ArrayList<Thread>(); - while (testPropsFile.exists()) { + while (testPropsFile != null) { final Properties testProps = new Properties(); - testProps.load(testPropsFile.toURL().openStream()); + testProps.load(testPropsFile.openStream()); final QName serviceId = new QName(testProps.getProperty("namespace"), testProps.getProperty("service")); final String operation = testProps.getProperty("operation"); @@ -239,7 +239,7 @@ } propsFileCnt++; - testPropsFile = new File(deployDir + "/test" + propsFileCnt + testPropsFile = getClass().getResource(deployDir + "/test" + propsFileCnt + ".properties"); } Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java Mon Apr 23 22:57:44 2007 @@ -16,28 +16,28 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ode.test; - -public class BasicActivities20Test extends BPELTestAbstract { - public void testHelloWorld2() throws Throwable { - go("target/test-classes/bpel/2.0/HelloWorld2"); - } - - public void testNegativeTargetNS1() throws Throwable { - /** - * Test for an invalid targetNamespace has been entered into the WSDL. - * See JIRA ODE-67 - * Test for a specific exception message. - */ - go("target/test-classes/bpel/2.0/NegativeTargetNSTest1"); - } - - public void testTimer() throws Throwable { - go("target/test-classes/bpel/2.0/TestTimer"); - } - - public void testIf() throws Throwable { - go("target/test-classes/bpel/2.0/TestIf"); - } - -} +package org.apache.ode.test; + +public class BasicActivities20Test extends BPELTestAbstract { + public void testHelloWorld2() throws Throwable { + go("/bpel/2.0/HelloWorld2"); + } + + public void testNegativeTargetNS1() throws Throwable { + /** + * Test for an invalid targetNamespace has been entered into the WSDL. + * See JIRA ODE-67 + * Test for a specific exception message. + */ + go("/bpel/2.0/NegativeTargetNSTest1"); + } + + public void testTimer() throws Throwable { + go("/bpel/2.0/TestTimer"); + } + + public void testIf() throws Throwable { + go("/bpel/2.0/TestIf"); + } + +} Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java Mon Apr 23 22:57:44 2007 @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ode.test; - -public class CompensationHandling20Test extends BPELTestAbstract { - - public void testCompensationHandlers() throws Throwable { - go("target/test-classes/bpel/2.0/TestCompensationHandlers"); - } - - public void testImplicitFaultHandler() throws Throwable { - go("target/test-classes/bpel/2.0/TestImplicitFaultHandler"); - } - -} +package org.apache.ode.test; + +public class CompensationHandling20Test extends BPELTestAbstract { + + public void testCompensationHandlers() throws Throwable { + go("/bpel/2.0/TestCompensationHandlers"); + } + + public void testImplicitFaultHandler() throws Throwable { + go("/bpel/2.0/TestImplicitFaultHandler"); + } + +} Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java Mon Apr 23 22:57:44 2007 @@ -21,31 +21,31 @@ public class DataHandling20Test extends BPELTestAbstract { public void testXPathNamespace1() throws Throwable { - go("target/test-classes/bpel/2.0/TestXPathNamespace1"); + go("/bpel/2.0/TestXPathNamespace1"); } public void testXPathNamespace2() throws Throwable { - go("target/test-classes/bpel/2.0/TestXPathNamespace2"); + go("/bpel/2.0/TestXPathNamespace2"); + } + public void testSubTreeAssign() throws Throwable { + go("/bpel/2.0/TestSubTreeAssign"); } - public void testSubTreeAssign() throws Throwable { - go("target/test-classes/bpel/2.0/TestSubTreeAssign"); - } public void testAssignActivity1() throws Throwable { - go("src/test/resources/bpel/2.0/TestAssignActivity1"); + go("/bpel/2.0/TestAssignActivity1"); } public void testAssignActivity2() throws Throwable { - go("src/test/resources/bpel/2.0/TestAssignActivity2"); + go("/bpel/2.0/TestAssignActivity2"); } public void testAssignComplex() throws Throwable { - go("src/test/resources/bpel/2.0/TestAssignComplex"); + go("/bpel/2.0/TestAssignComplex"); } public void testSimpleTypeParts() throws Throwable { - go("target/test-classes/bpel/2.0/TestSimpleTypeParts"); + go("/bpel/2.0/TestSimpleTypeParts"); } public void testSimpleVariableType() throws Throwable { - go("target/test-classes/bpel/2.0/TestSimpleVariableType"); + go("/bpel/2.0/TestSimpleVariableType"); } public void testXslTransform() throws Throwable { - go("target/test-classes/bpel/2.0/TestXslTransform"); + go("/bpel/2.0/TestXslTransform"); } } Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/FaultHandling20Test.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/FaultHandling20Test.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/FaultHandling20Test.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/FaultHandling20Test.java Mon Apr 23 22:57:44 2007 @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ode.test; - -public class FaultHandling20Test extends BPELTestAbstract { - public void testFaultHandlers() throws Throwable { - go("target/test-classes/bpel/2.0/TestFaultHandlers"); - } - public void testFaultWithVariable() throws Throwable { - go("target/test-classes/bpel/2.0/TestFaultWithVariable"); - } - public void testCatchFaultInFaultHandler() throws Throwable { - go("target/test-classes/bpel/2.0/TestCatchFaultInFaultHandler"); - } -} +package org.apache.ode.test; + +public class FaultHandling20Test extends BPELTestAbstract { + public void testFaultHandlers() throws Throwable { + go("/bpel/2.0/TestFaultHandlers"); + } + public void testFaultWithVariable() throws Throwable { + go("/bpel/2.0/TestFaultWithVariable"); + } + public void testCatchFaultInFaultHandler() throws Throwable { + go("/bpel/2.0/TestCatchFaultInFaultHandler"); + } +} Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/MessageRouting20Test.java Mon Apr 23 22:57:44 2007 @@ -20,27 +20,27 @@ public class MessageRouting20Test extends BPELTestAbstract { - public void testCorrelation() throws Throwable { - go("target/test-classes/bpel/2.0/TestCorrelation"); - } - public void testCorrelation1() throws Throwable { - go("target/test-classes/bpel/2.0/TestCorrelation1"); - } + public void testCorrelation() throws Throwable { + go("/bpel/2.0/TestCorrelation"); + } + public void testCorrelation1() throws Throwable { + go("/bpel/2.0/TestCorrelation1"); + } // TODO Fix me, we need to capture the session id to send it in the second test message // public void testCorrelationOpaque() throws Throwable { -// go("target/test-classes/bpel/2.0/TestCorrelationOpaque"); +// go("/bpel/2.0/TestCorrelationOpaque"); // } public void testDynamicPick() throws Throwable { - go("target/test-classes/bpel/2.0/TestDynamicPick"); + go("/bpel/2.0/TestDynamicPick"); } public void testInstPick() throws Throwable { - go("target/test-classes/bpel/2.0/TestInstantiatingPick"); + go("/bpel/2.0/TestInstantiatingPick"); } public void testStaticOnMessage() throws Throwable { - go("target/test-classes/bpel/2.0/TestStaticOnMessage"); + go("/bpel/2.0/TestStaticOnMessage"); } public void testStaticPick() throws Throwable { - go("target/test-classes/bpel/2.0/TestStaticPick"); + go("/bpel/2.0/TestStaticPick"); } Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/StructuredActivities20Test.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/StructuredActivities20Test.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/StructuredActivities20Test.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/StructuredActivities20Test.java Mon Apr 23 22:57:44 2007 @@ -16,15 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ode.test; - -public class StructuredActivities20Test extends BPELTestAbstract { - public void testFlowActivity1() throws Throwable { - // Test Flow with XPath20 - go("target/test-classes/bpel/2.0/TestFlowActivity1"); - } - public void testFlowActivity2() throws Throwable { - // Test Flow with XPath10 - go("target/test-classes/bpel/2.0/TestFlowActivity2"); - } -} +package org.apache.ode.test; + +public class StructuredActivities20Test extends BPELTestAbstract { + public void testFlowActivity1() throws Throwable { + // Test Flow with XPath20 + go("/bpel/2.0/TestFlowActivity1"); + } + public void testFlowActivity2() throws Throwable { + // Test Flow with XPath10 + go("/bpel/2.0/TestFlowActivity2"); + } +} Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java?view=diff&rev=531776&r1=531775&r2=531776 ============================================================================== --- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java (original) +++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/VersionedRedeployTest.java Mon Apr 23 22:57:44 2007 @@ -35,18 +35,18 @@ QName qName3 = new QName("http://ode/bpel/unit-test", "HelloWorld2-3"); public void testRetireOld() throws Throwable { - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); ProcessConf conf = store.getProcessConfiguration(qName1); assertEquals(ProcessState.ACTIVE, conf.getState()); - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-2"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-2"); // Now 1 should be retired and 2 active conf = store.getProcessConfiguration(qName1); assertEquals(ProcessState.RETIRED, conf.getState()); conf = store.getProcessConfiguration(qName2); assertEquals(ProcessState.ACTIVE, conf.getState()); - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-3"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-3"); // 1 and 2 should be retired and 3 active conf = store.getProcessConfiguration(qName1); assertEquals(ProcessState.RETIRED, conf.getState()); @@ -59,21 +59,21 @@ public void testInstancePersistence() throws Throwable { // Checking for each step that all instances still exist and that each process got one execution // so no instance has been created after a process has been retired. - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances()); - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-2"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-2"); assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances()); assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances()); - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-3"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-3"); assertEquals(1, _cf.getConnection().getProcess(qName1).getNumInstances()); assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances()); assertEquals(1, _cf.getConnection().getProcess(qName3).getNumInstances()); } public void testVersionedUndeployDeploy() throws Throwable { - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); - store.undeploy(new File("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1")); - go("target/test-classes/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); + store.undeploy(new File(getClass().getResource("/bpel/2.0/TestVersionedRedeploy/HelloWorld-1").getPath())); + go("/bpel/2.0/TestVersionedRedeploy/HelloWorld-1"); // We should have a brand new version 1 with no version 2 assertEquals(1, _cf.getConnection().getProcess(qName2).getNumInstances()); assertNull(store.getProcessConfiguration(qName1));