You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by lw...@apache.org on 2006/10/17 08:56:17 UTC

svn commit: r464834 - in /incubator/ode/trunk/bpel-test/src: main/java/org/apache/ode/test/ test/java/org/apache/ode/test/ test/resources/bpel/2.0/NegativeInitializationTest/ test/resources/bpel/2.0/NegativeTargetNSTest1/ test/resources/bpel/2.0/TestFa...

Author: lwaterman
Date: Mon Oct 16 23:56:15 2006
New Revision: 464834

URL: http://svn.apache.org/viewvc?view=rev&rev=464834
Log:
Add new negative test

Added:
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.bpel
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.wsdl
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/deploy.xml
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/test.properties
Modified:
    incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeInitializationTest/test1.properties
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestFaultWithVariable/TestFaultWithVariable.bpel

Modified: incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java?view=diff&rev=464834&r1=464833&r2=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java (original)
+++ incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java Mon Oct 16 23:56:15 2006
@@ -91,6 +91,7 @@
 
 		Status mStat = myRoleMex.getStatus();
 		
+	
 		if ( mStat == Status.RESPONSE ) {
 			
 			currentResponse = myRoleMex.getResponse();

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java?view=diff&rev=464834&r1=464833&r2=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java Mon Oct 16 23:56:15 2006
@@ -20,6 +20,7 @@
 
 import junit.framework.TestCase;
 import org.apache.ode.bpel.engine.BpelServerImpl;
+import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.Message;
 import org.apache.ode.bpel.iapi.MessageExchange;
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
@@ -84,7 +85,14 @@
 			}
 		}
 		
-		server.getDeploymentService().deploy(new File(deployDir));
+		try {
+			server.getDeploymentService().deploy(new File(deployDir));
+		} catch (BpelEngineException bpelE) {
+			Properties testProps = new Properties();
+			testProps.load(testPropsFile.toURL().openStream());
+			String responsePattern = testProps.getProperty("response1");
+			testResponsePattern(bpelE.getMessage(),responsePattern);
+		}
 		
 		while ( testPropsFile.exists() ) {
 		
@@ -157,6 +165,21 @@
                     System.out.println("=> " + mex.getFaultExplanation());
                     assertTrue(false);
 					break;
+				case COMPLETED_FAILURE:
+					// TODO: handle Failure
+					System.out.println("=> " + mex.getFaultExplanation());
+					assertTrue(false);
+					break;
+				case COMPLETED_FAULT:
+					// TODO: handle Failure
+					System.out.println("=> " + mex.getFaultExplanation());
+					assertTrue(false);
+					break;
+				case FAILURE:
+					// TODO: handle Faulure
+					System.out.println("=> " + mex.getFaultExplanation());
+					assertTrue(false);
+					break;
 				default:
 					assertTrue(false);
 					break;
@@ -170,13 +193,17 @@
 	
 	private void testResponsePattern(Message response, String responsePattern){
 		String resp = ( response == null ) ? "null" : DOMUtils.domToString(response.getMessage());
+		testResponsePattern(resp,responsePattern);
+	}
+	
+	private void testResponsePattern(String resp, String responsePattern){
 		boolean testValue = Pattern.compile(responsePattern,Pattern.DOTALL).matcher(resp).matches();
 		
 		if ( !testValue ) {
 			System.out.println("=> Expected Response Pattern >> " + responsePattern);
 		    System.out.println("=> Acutal Response >> " + resp);
 		}
-		assertTrue(testValue);
+		assertTrue(testValue);		
 	}
 
 	public void testHelloWorld2() throws Exception {
@@ -230,13 +257,24 @@
     	go("target/test-classes/bpel/2.0/TestFaultWithVariable");
     }
     
+    public void testNegativeTargetNS1() throws Exception {
+    	/**
+    	 * Test for an invalid targetNamespace has been entered into
+    	 * the WSDL.
+    	 * 
+    	 * See JIRA ODE-67
+    	 */
+    	go("target/test-classes/bpel/2.0/NegativeTargetNSTest1");
+    }
     
 	  public void testNegativeCorrelation() throws Exception {
 		/**
 		 * This test contains invalid BPEL. There is an instantiating
 		 * <receive> and a subsequent <pick> that does not define a correlation
 		 * key. The BPEL compiler should throw an exception indicating
-		 * the BPEL code error ( verify with spec.
+		 * the BPEL code error ( verify with spec ).
+		 * 
+		 * See JIRA ODE-64
 		 * 
 		 */
 	    go("target/test-classes/bpel/2.0/NegativeCorrelationTest");
@@ -244,11 +282,15 @@
 	  public void testNegativeInitialization() throws Exception {
 			/**
 			 * This test contains invalid BPEL. There is an instantiating
-			 * <receive> within a <scope> that contains eventhandlers
-			 * that use the correlation set found on the receive. The BPEL
-			 * compiler should through an exception indicating
-			 * the BPEL code error ( verify with spec ) or at runtime
+			 * <receive> within a <scope>. The <scope> contains eventhandlers
+			 * that reference the correlation set found on the receive. The BPEL
+			 * compiler should throw an exception indicating
+			 * the BPEL error ( verify with spec ) or at runtime
 			 * a clear initialization exception should be thrown.
+			 * 
+			 * See JIRA ODE-61.
+			 * 
+			 * The message exchange should return with a Fault/Failure.
 			 * 
 			 */
 		    go("target/test-classes/bpel/2.0/NegativeInitializationTest");

Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeInitializationTest/test1.properties
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeInitializationTest/test1.properties?view=diff&rev=464834&r1=464833&r2=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeInitializationTest/test1.properties (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeInitializationTest/test1.properties Mon Oct 16 23:56:15 2006
@@ -2,4 +2,4 @@
 service=NegativeInitializationTestService
 operation=request
 request1=<message><requestMessageData><testMessage><requestID>NegativeInitializationTest</requestID><requestText>NegativeInitializationTest</requestText></testMessage></requestMessageData></message>
-response1=ASYNC
+response1=FAILURE

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.bpel?view=auto&rev=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.bpel (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.bpel Mon Oct 16 23:56:15 2006
@@ -0,0 +1,62 @@
+
+<!--
+	~ Licensed to the Apache Software Foundation (ASF) under one
+	~ or more contributor license agreements.  See the NOTICE file
+	~ distributed with this work for additional information
+	~ regarding copyright ownership.  The ASF licenses this file
+	~ to you under the Apache License, Version 2.0 (the
+	~ "License"); you may not use this file except in compliance
+	~ with the License.  You may obtain a copy of the License at
+	~
+	~    http://www.apache.org/licenses/LICENSE-2.0
+	~
+	~ Unless required by applicable law or agreed to in writing,
+	~ software distributed under the License is distributed on an
+	~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	~ KIND, either express or implied.  See the License for the
+	~ specific language governing permissions and limitations
+	~ under the License.
+-->
+
+<process xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2004/03/business-process/ ../../../../../../../bpel-schemas/src/main/resources/wsbpel_main-draft-Apr-29-2006.xsd"
+	xmlns:tns="http://ode/bpel/unit-test/NegativeTargetNSTest1"
+	targetNamespace="http://ode/bpel/unit-test/NegativeTargetNSTest1"
+	xmlns:wns="http://ode/bpel/unit-test/NegativeTargetNSTest1.wsdl"
+	xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+	name="NegativeTargetNSTest1"
+	queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+	expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+	suppressJoinFailure="yes">
+	
+
+	<import location="NegativeTargetNSTest1.wsdl"
+		namespace="http://ode/bpel/unit-test/NegativeTargetNSTest1.wsdl"
+		importType="http://schemas.xmlsoap.org/wsdl/" />
+
+
+	<partnerLinks>
+		<partnerLink name="request" partnerLinkType="wns:NegativeTargetNSTest1Request" myRole="NegativeTargetNSTest1Service"/>
+	</partnerLinks>
+	<variables>
+		<variable name="request" messageType="wns:requestMessage"/>
+		<variable name="reply" messageType="wns:replyMessage"/>
+	</variables>
+
+	<sequence>
+		<receive name="receive1" partnerLink="request" portType="wns:NegativeTargetNSTest1PT" operation="request" variable="request" createInstance="yes"/>
+		<!-- Copy input variables to internal accumulators -->
+		<assign name="assign1">
+			<copy>
+				<from variable="request" part="requestID"/>
+				<to variable="reply" part="replyID"/>
+			</copy>
+			<copy>
+				<from variable="request" part="requestText"/>
+				<to variable="reply" part="replyText"/>
+			</copy>
+		</assign>
+
+		<reply name="reply" partnerLink="request" portType="wns:NegativeTargetNSTest1PT" operation="request" variable="reply"/>
+	</sequence>
+</process>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.wsdl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.wsdl?view=auto&rev=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.wsdl (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/NegativeTargetNSTest1.wsdl Mon Oct 16 23:56:15 2006
@@ -0,0 +1,55 @@
+<!--
+	~ Licensed to the Apache Software Foundation (ASF) under one
+	~ or more contributor license agreements.  See the NOTICE file
+	~ distributed with this work for additional information
+	~ regarding copyright ownership.  The ASF licenses this file
+	~ to you under the Apache License, Version 2.0 (the
+	~ "License"); you may not use this file except in compliance
+	~ with the License.  You may obtain a copy of the License at
+	~
+	~    http://www.apache.org/licenses/LICENSE-2.0
+	~
+	~ Unless required by applicable law or agreed to in writing,
+	~ software distributed under the License is distributed on an
+	~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	~ KIND, either express or implied.  See the License for the
+	~ specific language governing permissions and limitations
+	~ under the License.
+-->
+
+<wsdl:definitions targetNamespace="http://ode/bpel/unit-test/NegativeTargetNSTest.wsdl"
+	xmlns:tns="http://ode/bpel/unit-test/NegativeTargetNSTest1.wsdl"
+	xmlns="http://ode/bpel/unit-test/NegativeTargetNSTest1.wsdl"
+	xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"      
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+	
+	<wsdl:message name="requestMessage">
+		<wsdl:part name="requestID" type="xsd:string"/>
+		<wsdl:part name="requestText" type="xsd:string"/>
+	</wsdl:message>
+	<wsdl:message name="replyMessage">
+		<wsdl:part name="replyID" type="xsd:string"/>
+		<wsdl:part name="replyText" type="xsd:string"/>
+	</wsdl:message>
+
+	<wsdl:portType name="NegativeTargetNSTest1PT">
+		<wsdl:operation name="request">
+			<wsdl:input message="requestMessage"/>
+			<wsdl:output message="replyMessage"/>
+		</wsdl:operation>
+	</wsdl:portType>
+	<wsdl:binding name="NegativeTargetNSTest1Binding" type="tns:NegativeTargetNSTest1PT">
+		<wsdl:operation name="request">
+		</wsdl:operation>
+	</wsdl:binding>
+	<wsdl:service name="NegativeTargetNSTest1Service">
+		<wsdl:port name="NegativeTargetNSTest1Port" binding="tns:NegativeTargetNSTest1Binding">
+		</wsdl:port>
+	</wsdl:service>	
+	
+	<plnk:partnerLinkType name="NegativeTargetNSTest1Request">
+		<plnk:role name="NegativeTargetNSTest1Service" portType="NegativeTargetNSTest1PT"/>
+	</plnk:partnerLinkType>
+
+</wsdl:definitions>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/deploy.xml?view=auto&rev=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/deploy.xml (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/deploy.xml Mon Oct 16 23:56:15 2006
@@ -0,0 +1,31 @@
+<!--
+	~ Licensed to the Apache Software Foundation (ASF) under one
+	~ or more contributor license agreements.  See the NOTICE file
+	~ distributed with this work for additional information
+	~ regarding copyright ownership.  The ASF licenses this file
+	~ to you under the Apache License, Version 2.0 (the
+	~ "License"); you may not use this file except in compliance
+	~ with the License.  You may obtain a copy of the License at
+	~
+	~    http://www.apache.org/licenses/LICENSE-2.0
+	~
+	~ Unless required by applicable law or agreed to in writing,
+	~ software distributed under the License is distributed on an
+	~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	~ KIND, either express or implied.  See the License for the
+	~ specific language governing permissions and limitations
+	~ under the License.
+-->
+
+<deploy xmlns="http://ode.fivesight.com/schemas/2006/06/27/dd" 
+	xmlns:pns="http://ode/bpel/unit-test/NegativeTargetNSTest1" 
+	xmlns:wns="http://ode/bpel/unit-test/NegativeTargetNSTest1.wsdl">
+
+
+	<process name="pns:NegativeTargetNSTest1">
+		<active>true</active>
+		<provide partnerLink="request">
+			<service name="wns:NegativeTargetNSTest1Service" port="wns:NegativeTargetNSTest1Port"/>
+		</provide>
+	</process>
+</deploy>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/test.properties
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/test.properties?view=auto&rev=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/test.properties (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/NegativeTargetNSTest1/test.properties Mon Oct 16 23:56:15 2006
@@ -0,0 +1,5 @@
+namespace=http://ode/bpel/unit-test/NegativeTargetNSTest1.wsdl
+service=NegativeTargetNSTest1Service
+operation=request
+request1=<message><requestID>Start NegativeTargetNSTest1</requestID><requestText>Event NegativeTargetNSTest1</requestText></message>
+response1=.*Namespace Exception.*

Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestFaultWithVariable/TestFaultWithVariable.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestFaultWithVariable/TestFaultWithVariable.bpel?view=diff&rev=464834&r1=464833&r2=464834
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestFaultWithVariable/TestFaultWithVariable.bpel (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestFaultWithVariable/TestFaultWithVariable.bpel Mon Oct 16 23:56:15 2006
@@ -1,3 +1,23 @@
+
+<!--
+	~ Licensed to the Apache Software Foundation (ASF) under one
+	~ or more contributor license agreements.  See the NOTICE file
+	~ distributed with this work for additional information
+	~ regarding copyright ownership.  The ASF licenses this file
+	~ to you under the Apache License, Version 2.0 (the
+	~ "License"); you may not use this file except in compliance
+	~ with the License.  You may obtain a copy of the License at
+	~
+	~    http://www.apache.org/licenses/LICENSE-2.0
+	~
+	~ Unless required by applicable law or agreed to in writing,
+	~ software distributed under the License is distributed on an
+	~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	~ KIND, either express or implied.  See the License for the
+	~ specific language governing permissions and limitations
+	~ under the License.
+-->
+
 <process xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2004/03/business-process/ ../../../../../../../bpel-schemas/src/main/resources/wsbpel_main-draft-Apr-29-2006.xsd"
  xmlns:tns="http://ode/bpel/unit-test/TestFaultWithVariable"