[savara-commits] savara SVN: r465 - in trunk/tools: plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component and 24 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Nov 12 14:20:58 EST 2010
Author: objectiser
Date: 2010-11-12 14:20:56 -0500 (Fri, 12 Nov 2010)
New Revision: 465
Added:
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.classpath
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.project
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/build.properties
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/pom.xml
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Broker.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Buyer.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at CreditAgency.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Supplier.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierQuoteEngine.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierTxnProcessor.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Buyer.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at CreditAgency.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Store.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Buyer.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Seller.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ESBBroker.cdm
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/PurchaseGoods.cdm
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ReqRespFault.cdm
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/change/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtilsTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteractionTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivityTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchAllTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandlerTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ConditionTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseIfTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlersTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ExitTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlersTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FlowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ForEachTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/IfTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/InvokeTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarmTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnEventTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnMessageTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLinkTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PickTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ProcessTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReceiveTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntilTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReplyTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RethrowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ScopeTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/SequenceTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandlerTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestAbstractInteraction.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELActivity.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELElement.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ThrowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/VariableTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WaitTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WhileTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/util/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/util/InteractionUtilTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/ParserTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Broker.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Buyer.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at CreditAgency.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierQuoteEngine.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierTxnProcessor.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/LoanApprovalService at Service.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Buyer.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at CreditAgency.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Store.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Buyer.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Seller.scv
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessorArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BrokerArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Buyer.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BuyerArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgencyArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Supplier.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/LoanApprovalService at Service.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Buyer.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_BuyerArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgencyArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_StoreArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Buyer.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_BuyerArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_SellerArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.bpel
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngineArtifacts.wsdl
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/AllTests.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/osgi/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/osgi/Activator.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util/XMLUtilsTest.java
Modified:
trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElement.java
trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF
trunk/tools/tests/pom.xml
Log:
Enabled BPEL generator tests in the Tycho build, but parser tests are throwing exceptions under Tycho currently (SAVARA-151).
Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF 2010-11-12 12:21:09 UTC (rev 464)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF 2010-11-12 19:20:56 UTC (rev 465)
@@ -38,3 +38,7 @@
org.jboss.savara.tools.bpel.model.change.SpawnModelChangeRule,
org.jboss.savara.tools.bpel.model.change.ConversationInteractionModelChangeRule,
org.jboss.savara.tools.bpel.editor.BPELEditorManager
+Export-Package: org.jboss.savara.tools.bpel.model;x-friends:="org.jboss.savara.tools.bpel.tests",
+ org.jboss.savara.tools.bpel.model.change;x-friends:="org.jboss.savara.tools.bpel.tests",
+ org.jboss.savara.tools.bpel.model.component;x-friends:="org.jboss.savara.tools.bpel.tests",
+ org.jboss.savara.tools.bpel.util;x-friends:="org.jboss.savara.tools.bpel.tests"
Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElement.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElement.java 2010-11-12 12:21:09 UTC (rev 464)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElement.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -157,7 +157,7 @@
* @param name The name
* @return The element, or null if not found
*/
- protected org.w3c.dom.Element findChildElement(String name) {
+ public org.w3c.dom.Element findChildElement(String name) {
org.w3c.dom.Element ret=null;
org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
@@ -181,7 +181,7 @@
*
* @return The child BPEL activity, or null if not found
*/
- protected BPELActivity findChildActivity() {
+ public BPELActivity findChildActivity() {
BPELActivity ret=null;
org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
@@ -210,7 +210,7 @@
* @return The list of child elements of the type specified
* by the supplied class
*/
- protected java.util.List<BPELElement> findChildElements(Class<? extends BPELElement> cls) {
+ public java.util.List<BPELElement> findChildElements(Class<? extends BPELElement> cls) {
return(findChildElements(getDOMElement(), cls));
}
@@ -223,7 +223,7 @@
* @return The list of child elements of the type specified
* by the supplied class
*/
- protected java.util.List<BPELElement> findChildElements(org.w3c.dom.Element root,
+ public java.util.List<BPELElement> findChildElements(org.w3c.dom.Element root,
Class<? extends BPELElement> cls) {
java.util.List<BPELElement> ret=new java.util.Vector<BPELElement>();
@@ -262,7 +262,7 @@
* @param newelem The new element
* @param insertBefore Optional location to insert new element
*/
- protected void setChildElement(org.w3c.dom.Element existing,
+ public void setChildElement(org.w3c.dom.Element existing,
BPELElement newelem, org.w3c.dom.Node insertBefore) {
setChildElement(getDOMElement(), existing, newelem, insertBefore);
@@ -286,7 +286,7 @@
* @param newelem The new element
* @param insertBefore Optional location to insert new element
*/
- protected void setChildElement(org.w3c.dom.Element root,
+ public void setChildElement(org.w3c.dom.Element root,
org.w3c.dom.Element existing,
BPELElement newelem, org.w3c.dom.Node insertBefore) {
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.classpath
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.classpath (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.classpath 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.project
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.project (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/.project 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.savara.tools.bpel.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Boss SAVARA Tools BPEL Tests Plug-in
+Bundle-SymbolicName: org.jboss.savara.tools.bpel.tests
+Bundle-Version: 1.1.0.qualifier
+Bundle-Activator: org.jboss.savara.tools.bpel.tests.osgi.Activator
+Bundle-Vendor: www.jboss.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.osgi.framework
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.scribble.conversation.model;bundle-version="[1.0.0,2.0.0)",
+ org.scribble.core;bundle-version="[1.0.0,2.0.0)",
+ org.scribble.lang.model;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.core.resources,
+ org.scribble.eclipse;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.jdt.core,
+ org.junit,
+ org.scribble.conversation.parser;bundle-version="[1.0.0,2.0.0)",
+ org.apache.commons.logging,
+ org.scribble.expression.xpath;bundle-version="[1.0.0,2.0.0)",
+ org.jboss.savara.pi4soa.cdm;resolution:=optional,
+ org.jboss.savara.tools.bpel,
+ org.jboss.savara.contract.model,
+ org.jboss.savara.tools.wsdl,
+ org.eclipse.ui.ide,
+ org.eclipse.jst.common.frameworks,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.wst.common.project.facet.core,
+ org.scribble.conversation.projector;bundle-version="[1.0.0,2.0.0)"
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/build.properties
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/build.properties (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/build.properties 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,12 @@
+source.. = src/java/
+output.. = classes/
+bin.includes = META-INF/,\
+ .,\
+ test.xml
+src.includes = test.xml,\
+ src/,\
+ build.properties,\
+ META-INF/,\
+ .settings/,\
+ .project,\
+ .classpath
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/pom.xml
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/pom.xml (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/pom.xml 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.savara.tools</groupId>
+ <artifactId>org.jboss.savara.tools.bpel.tests</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>Savara::Tools::Tests::ToolsBPEL</name>
+
+ <parent>
+ <groupId>org.jboss.savara.tools</groupId>
+ <artifactId>tests</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+</project>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,312 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.generator;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.jboss.savara.tools.bpel.model.BPELNotation;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.util.XMLUtils;
+import org.jboss.savara.pi4soa.cdm.model.CDMNotation;
+import org.scribble.extensions.RegistryFactory;
+import org.scribble.model.Definition;
+import org.scribble.model.ModelReference;
+import org.scribble.model.SubDefinitionPath;
+import org.scribble.model.change.ModelGenerator;
+
+public class GeneratorTest {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Choreography->BPEL Generator Tests");
+
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker", "Broker"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker", "Buyer"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker", "CreditAgency"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker",
+ new SubDefinitionPath(new String[]{"CompleteTransaction"}),
+ "SupplierTxnProcessor"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker",
+ new SubDefinitionPath(new String[]{"RequestForQuote"}),
+ "SupplierQuoteEngine"));
+ suite.addTest(new ChoreographyToBPELTester("PurchaseGoods", "Buyer"));
+ suite.addTest(new ChoreographyToBPELTester("PurchaseGoods", "CreditAgency"));
+ suite.addTest(new ChoreographyToBPELTester("PurchaseGoods", "Store"));
+ suite.addTest(new ChoreographyToBPELTester("ReqRespFault", "Buyer"));
+ suite.addTest(new ChoreographyToBPELTester("ReqRespFault", "Seller"));
+
+ return suite;
+ }
+
+ public static class ChoreographyToBPELTester extends TestCase {
+
+ /**
+ * This constructor is initialized with the test
+ * name.
+ *
+ * @param name The test name
+ * @param role The role
+ */
+ public ChoreographyToBPELTester(String name,
+ String role) {
+ super(name+"@"+role);
+ m_name = name;
+ m_role = role;
+ }
+
+ /**
+ * This constructor is initialized with the test
+ * name.
+ *
+ * @param name The test name
+ * @param role The role
+ */
+ public ChoreographyToBPELTester(String name,
+ SubDefinitionPath sdp, String role) {
+ super(name+sdp.toString()+"@"+role);
+ m_name = name;
+ m_subDefinitionPath = sdp;
+ m_role = role;
+ }
+
+ /**
+ * This method runs the test.
+ *
+ * @param result The test result
+ */
+ public void run(TestResult result) {
+ result.startTest(this);
+
+ String filename="testmodels/"+m_name+".cdm";
+
+ java.io.InputStream is=
+ ChoreographyToBPELTester.class.getResourceAsStream(filename);
+
+ if (is == null) {
+ result.addError(this,
+ new Throwable("Unable to locate resource: "+filename));
+ } else {
+ org.scribble.parser.Parser p=new org.scribble.parser.DefaultParser();
+ org.scribble.model.ModelReference ref=
+ new org.scribble.model.ModelReference(CDMNotation.NOTATION_CODE);
+ org.scribble.model.admin.DefaultModelListener l=
+ new org.scribble.model.admin.DefaultModelListener();
+
+ org.scribble.model.Model model=p.parse(ref, is, l, null);
+
+ if (model == null) {
+ result.addError(this, new Throwable("Model is null"));
+ } else {
+ org.scribble.projector.Projector projector=
+ new org.scribble.projector.DefaultProjector();
+
+ org.scribble.model.Role role=null;
+
+ // Obtain role from definition
+ java.util.List<Definition> defns=model.getDefinitions();
+ Definition defn=null;
+
+ if (defns.size() == 1) {
+ defn = defns.get(0);
+ }
+
+ // Check if subpath definition defined
+ if (m_subDefinitionPath != null) {
+ defn = defn.getSubDefinition(m_subDefinitionPath);
+ }
+
+ java.util.List<org.scribble.model.Role> roles=defn.getRoles();
+ //new org.scribble.model.Role(m_role);
+
+ for (int i=0; role == null && i < roles.size(); i++) {
+ if (roles.get(i).getName().equals(m_role)) {
+ role = roles.get(i);
+ }
+ }
+
+ if (role == null) {
+ result.addError(this,
+ new Throwable("Role '"+m_role+"' not found"));
+ } else {
+ org.scribble.model.Model projected=
+ projector.project(ref, model,
+ m_subDefinitionPath, role, l);
+
+ /* Currently if a 'fail' is performed in Tycho build, it
+ * hangs the build.
+ if (l.getErrors().size() > 0) {
+ fail("Projection has errors: "+l.getErrors());
+ } else if (projected == null) {
+ fail("Projected model is null, for "+filename+" role "+role);
+ }
+ */
+
+ ModelGenerator generator=(ModelGenerator)
+ RegistryFactory.getRegistry().getExtension(
+ ModelGenerator.class, null);
+
+ defns = projected.getDefinitions();
+ defn = null;
+
+ if (defns.size() == 1) {
+ defn = defns.get(0);
+ }
+
+ if (generator != null && defn != null) {
+ ModelReference targetRef=
+ new ModelReference(BPELNotation.NOTATION_CODE);
+ targetRef.setAlias(m_name);
+ targetRef.setLocatedRole(m_role);
+
+ DefaultBPELLanguageModel target=
+ new DefaultBPELLanguageModel(targetRef);
+
+ generator.generate(targetRef, role,
+ target, projected);
+
+ if (target.getBPELProcess().getDOMElement() != null) {
+ try {
+ String text=XMLUtils.toText(target.getBPELProcess().getDOMElement());
+ checkResults(result, text);
+ } catch(Exception e) {
+ result.addError(this, e);
+ }
+ } else {
+ result.addError(this,
+ new Throwable("No BPEL generated"));
+ }
+
+ } else {
+ result.addError(this,
+ new Throwable("Unable to find Model Generator"));
+ }
+ }
+ }
+ }
+
+ result.endTest(this);
+ }
+
+ /**
+ * This method checks the generated BPEL against a
+ * previously stored correct version.
+ *
+ * @param result The test result
+ * @param bpel The BPEL
+ */
+ protected void checkResults(TestResult result, String bpel) {
+ boolean f_valid=false;
+
+ String filename="results/"+m_name+"@"+m_role+".bpel";
+
+ java.io.InputStream is=
+ ChoreographyToBPELTester.class.getResourceAsStream(filename);
+
+ if (is != null) {
+
+ try {
+ byte[] b=new byte[is.available()];
+
+ is.read(b);
+
+ is.close();
+
+ String orig=new String(b);
+
+ if (orig.equals(bpel) == false) {
+ result.addError(this,
+ new Throwable("Generated Conversation does not match stored version"));
+ } else {
+ f_valid = true;
+ }
+ } catch(Exception e) {
+ result.addError(this, e);
+ }
+ } else {
+ result.addError(this,
+ new Throwable("Resulting BPEL '"+filename+
+ "' not found for comparison"));
+ }
+
+ if (f_valid == false) {
+ String bpelfile="testmodels/"+m_name+".cdm";
+
+ java.net.URL url=ChoreographyToBPELTester.class.getResource(bpelfile);
+
+ try {
+ url = org.eclipse.core.runtime.FileLocator.toFileURL(url);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ if (url != null) {
+ // URL will point to copy of test models in the classes folder, so need
+ // to obtain reference back to source version
+ java.io.File f=null;
+
+ if (url.getFile().indexOf("classes") != -1) {
+ f = new java.io.File(url.getFile().replaceFirst("classes","src/plugintest"));
+ } else if (url.getFile().indexOf("bin") != -1) {
+ f = new java.io.File(url.getFile().replaceFirst("bin","src/plugintest"));
+ } else {
+ result.addError(this, new Exception("Could not locate results folder to record expected result"));
+ }
+
+ if (f != null && f.exists()) {
+ f = f.getParentFile().getParentFile();
+
+ java.io.File resultsDir=new java.io.File(f, "results");
+
+ if (resultsDir.exists() == false) {
+ resultsDir.mkdirs();
+ }
+
+ java.io.File resultFile=new java.io.File(resultsDir,
+ m_name+"@"+m_role+".expected");
+
+ if (resultFile.exists() == false) {
+ try {
+ java.io.FileOutputStream fos=new java.io.FileOutputStream(resultFile);
+
+ fos.write(bpel.getBytes());
+
+ fos.flush();
+ fos.close();
+
+ } catch(Exception e){
+ result.addError(this, e);
+ }
+ } else {
+ System.err.println("NOTE: Expected output '"+resultFile+
+ "' already exists - not being overwritten");
+ }
+ } else {
+ result.addError(this, new Throwable("Unable to obtain URL for CDM model source '"+
+ m_name+"': "+url));
+ }
+ }
+ }
+ }
+
+ private String m_name=null;
+ private SubDefinitionPath m_subDefinitionPath=null;
+ private String m_role=null;
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Broker.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Broker.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Broker.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,66 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at Broker" name="ESBBrokerProcess_Broker" targetNamespace="http://www.pi4soa.org/ESBBroker/Broker" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_BrokerArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <partnerLinks>
+ <partnerLink myRole="BrokerBehavior" name="BuyerToBroker" partnerLinkType="brk:BuyerToBrokerServiceLT"/>
+ <partnerLink name="BrokerToSupplierQuoteEngine" partnerLinkType="brk:BrokerToSupplierQuoteEngineLT" partnerRole="SupplierQuoteEngineRequester"/>
+ <partnerLink name="BrokerToCreditAgency" partnerLinkType="brk:BrokerToCreditAgencyLT" partnerRole="CreditAgencyRequester"/>
+ <partnerLink name="BrokerToSupplierTxnProcessor" partnerLinkType="brk:BrokerToSupplierTxnProcessorLT" partnerRole="SupplierTxnProcessorRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="brk:makeEnquiryRequest" name="makeEnquiryRequestVar"/>
+ <variable messageType="spr:getQuoteRequest" name="getQuoteRequestVar"/>
+ <variable messageType="spr:getQuoteResponse" name="getQuoteResponseVar"/>
+ <variable messageType="brk:makeEnquiryResponse" name="makeEnquiryResponseVar"/>
+ <variable messageType="brk:buyRequest" name="buyRequestVar"/>
+ <variable messageType="cay:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="cay:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="spr:confirmRequest" name="confirmRequestVar"/>
+ <variable messageType="spr:confirmResponse" name="confirmResponseVar"/>
+ <variable messageType="brk:buyResponse" name="buyResponseVar"/>
+ <variable messageType="brk:rejectedFault" name="rejectedFaultVar"/>
+ <variable messageType="brk:cancelRequest" name="cancelRequestVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_enquiry" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="makeEnquiryRequestVar"/>
+ <while>
+ <sequence>
+ <scope>
+ <sequence>
+ <invoke inputVariable="getQuoteRequestVar" name="Send_requestForQuote" operation="getQuote" outputVariable="getQuoteResponseVar" partnerLink="BrokerToSupplierQuoteEngine" portType="spr:SupplierBehavior"/>
+ </sequence>
+ </scope>
+ </sequence>
+ </while>
+ <reply name="Send_quoteList" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="makeEnquiryResponseVar"/>
+ <pick>
+ <onMessage operation="buy" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="buyRequestVar">
+ <sequence>
+ <scope>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="cay:invalidCreditFault" faultName="cay:invalidCredit" faultVariable="invalidCreditFaultVar">
+ <sequence>
+ <reply faultName="brk:rejected" name="Send_orderRejected" operation="buy" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="rejectedFaultVar"/>
+ </sequence>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="checkCreditRequestVar" name="Send_CreditCheckRequest" operation="checkCredit" outputVariable="checkCreditResponseVar" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior"/>
+ <invoke inputVariable="confirmRequestVar" name="Send_orderConfirmed" operation="confirm" outputVariable="confirmResponseVar" partnerLink="BrokerToSupplierTxnProcessor" portType="spr:SupplierBehavior"/>
+ <reply name="Send_bookingReference" operation="buy" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="buyResponseVar"/>
+ </sequence>
+ </scope>
+ </sequence>
+ </scope>
+ </sequence>
+ </onMessage>
+ <onMessage operation="cancel" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="cancelRequestVar">
+ <sequence/>
+ </onMessage>
+ </pick>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Buyer.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Buyer.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Buyer.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,43 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at Buyer" name="ESBBrokerProcess_Buyer" targetNamespace="http://www.pi4soa.org/ESBBroker/Buyer" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_BuyerArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Buyer"/>
+ <partnerLinks>
+ <partnerLink myRole="BrokerBehavior" name="BuyerToBroker" partnerLinkType="byr:BuyerToBrokerLT" partnerRole="BrokerRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="brk:makeEnquiryRequest" name="makeEnquiryRequestVar"/>
+ <variable messageType="brk:makeEnquiryResponse" name="makeEnquiryResponseVar"/>
+ <variable messageType="brk:buyRequest" name="buyRequestVar"/>
+ <variable messageType="brk:buyResponse" name="buyResponseVar"/>
+ <variable messageType="brk:cancelRequest" name="cancelRequestVar"/>
+ </variables>
+ <sequence>
+ <invoke inputVariable="makeEnquiryRequestVar" name="Send_enquiry" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior"/>
+ <receive name="Receive_quoteList" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="makeEnquiryResponseVar"/>
+ <if>
+ <sequence>
+ <scope>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="brk:rejectedFault" faultName="brk:rejected" faultVariable="rejectedFaultVar">
+ <sequence/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="buyRequestVar" name="Send_buy" operation="buy" outputVariable="buyResponseVar" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior"/>
+ </sequence>
+ </scope>
+ </sequence>
+ </scope>
+ </sequence>
+ <else>
+ <sequence>
+ <invoke inputVariable="cancelRequestVar" name="Send_cancel" operation="cancel" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at CreditAgency.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at CreditAgency.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at CreditAgency.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,36 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.Common at CreditAgency" name="ESBBrokerProcess_CreditAgency" targetNamespace="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgencyArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <partnerLinks>
+ <partnerLink myRole="CreditAgencyService" name="BrokerToCreditAgency" partnerLinkType="cay:BrokerToCreditAgencyServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="cay:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="cay:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="cay:invalidCreditFault" name="invalidCreditFaultVar"/>
+ </variables>
+ <sequence>
+ <pick>
+ <onMessage operation="checkCredit" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior" variable="checkCreditRequestVar">
+ <sequence>
+ <scope>
+ <sequence>
+ <if>
+ <sequence>
+ <reply name="Send_CreditCheckOk" operation="checkCredit" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior" variable="checkCreditResponseVar"/>
+ </sequence>
+ <else>
+ <sequence>
+ <reply faultName="cay:invalidCredit" name="Send_CreditCheckInvalid" operation="checkCredit" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior" variable="invalidCreditFaultVar"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+ </scope>
+ </sequence>
+ </onMessage>
+ </pick>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Supplier.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Supplier.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at Supplier.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,3 @@
+<process name="ESBBrokerProcess_Supplier" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <sequence/>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierQuoteEngine.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierQuoteEngine.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierQuoteEngine.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,15 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at SupplierQuoteEngine" name="RequestForQuote_SupplierQuoteEngine" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="RequestForQuote_SupplierQuoteEngine.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="RequestForQuote_SupplierQuoteEngineArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <partnerLinks>
+ <partnerLink myRole="SupplierBehavior" name="BrokerToSupplierQuoteEngine" partnerLinkType="spr:BrokerToSupplierQuoteEngineServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="spr:getQuoteRequest" name="getQuoteRequestVar"/>
+ <variable messageType="spr:getQuoteResponse" name="getQuoteResponseVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_requestForQuote" operation="getQuote" partnerLink="BrokerToSupplierQuoteEngine" portType="spr:SupplierBehavior" variable="getQuoteRequestVar"/>
+ <reply name="Send_quote" operation="getQuote" partnerLink="BrokerToSupplierQuoteEngine" portType="spr:SupplierBehavior" variable="getQuoteResponseVar"/>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierTxnProcessor.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierTxnProcessor.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ESBBroker at SupplierTxnProcessor.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,20 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at SupplierTxnProcessor" name="CompleteTransaction_SupplierTxnProcessor" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="CompleteTransaction_SupplierTxnProcessor.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="CompleteTransaction_SupplierTxnProcessorArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <partnerLinks>
+ <partnerLink myRole="SupplierTxnProcessorService" name="BrokerToSupplierTxnProcessor" partnerLinkType="spr:BrokerToSupplierTxnProcessorServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="spr:confirmRequest" name="confirmRequestVar"/>
+ <variable messageType="spr:confirmResponse" name="confirmResponseVar"/>
+ </variables>
+ <sequence>
+ <pick createInstance="yes">
+ <onMessage operation="confirm" partnerLink="BrokerToSupplierTxnProcessor" portType="spr:SupplierBehavior" variable="confirmRequestVar">
+ <sequence>
+ <reply name="Send_bookingReference" operation="confirm" partnerLink="BrokerToSupplierTxnProcessor" portType="spr:SupplierBehavior" variable="confirmResponseVar"/>
+ </sequence>
+ </onMessage>
+ </pick>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Buyer.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Buyer.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Buyer.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,24 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="savara.samples.Purchasing at Buyer" name="PurchaseGoodsProcess_Buyer" targetNamespace="http://www.jboss.org/savara/examples" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_BuyerArtifacts.wsdl" namespace="http://www.jboss.org/savara/examples"/>
+ <partnerLinks>
+ <partnerLink name="BuyerToStore" partnerLinkType="tns:BuyerToStoreLT" partnerRole="StoreRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="sto:buyRequest" name="buyRequestVar"/>
+ <variable messageType="sto:buyResponse" name="buyResponseVar"/>
+ </variables>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="sto:BuyFailedFault" faultName="sto:BuyFailed" faultVariable="BuyFailedFaultVar">
+ <sequence/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="buyRequestVar" name="Send_BuyRequest" operation="buy" outputVariable="buyResponseVar" partnerLink="BuyerToStore" portType="sto:StoreInterface"/>
+ </sequence>
+ </scope>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at CreditAgency.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at CreditAgency.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at CreditAgency.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,26 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="savara.samples.Common at CreditAgency" name="PurchaseGoodsProcess_CreditAgency" targetNamespace="java:org.jboss.savara.examples.purchasing" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgencyArtifacts.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <partnerLinks>
+ <partnerLink myRole="CreditAgencyInterface" name="StoreToCreditAgency" partnerLinkType="pur:StoreToCreditAgencyServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="pur:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="pur:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="pur:CreditCheckFailedFault" name="CreditCheckFailedFaultVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_CreditCheckRequest" operation="checkCredit" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface" variable="checkCreditRequestVar"/>
+ <if>
+ <sequence>
+ <reply name="Send_CreditCheckOk" operation="checkCredit" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface" variable="checkCreditResponseVar"/>
+ </sequence>
+ <else>
+ <sequence>
+ <reply faultName="pur:CreditCheckFailed" name="Send_CreditCheckInvalid" operation="checkCredit" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface" variable="CreditCheckFailedFaultVar"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Store.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Store.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/PurchaseGoods at Store.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,32 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="savara.samples.Purchasing at Store" name="PurchaseGoodsProcess_Store" targetNamespace="http://www.jboss.org/examples/store" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_StoreArtifacts.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <partnerLinks>
+ <partnerLink myRole="StoreInterface" name="BuyerToStore" partnerLinkType="sto:BuyerToStoreServiceLT"/>
+ <partnerLink name="StoreToCreditAgency" partnerLinkType="sto:StoreToCreditAgencyLT" partnerRole="CreditAgencyRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="sto:buyRequest" name="buyRequestVar"/>
+ <variable messageType="pur:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="pur:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="sto:buyResponse" name="buyResponseVar"/>
+ <variable messageType="sto:BuyFailedFault" name="BuyFailedFaultVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_BuyRequest" operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" variable="buyRequestVar"/>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="pur:CreditCheckFailedFault" faultName="pur:CreditCheckFailed" faultVariable="CreditCheckFailedFaultVar">
+ <sequence>
+ <reply faultName="sto:BuyFailed" name="Send_BuyFailed" operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" variable="BuyFailedFaultVar"/>
+ </sequence>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="checkCreditRequestVar" name="Send_CreditCheckRequest" operation="checkCredit" outputVariable="checkCreditResponseVar" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface"/>
+ <reply name="Send_BuyConfirmed" operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" variable="buyResponseVar"/>
+ </sequence>
+ </scope>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Buyer.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Buyer.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Buyer.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,23 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:byr="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns:slr="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:tns="http://www.pi4soa.org/ReqRespFault" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at Buyer" name="ReqRespFaultProcess_Buyer" targetNamespace="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_Seller.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_BuyerArtifacts.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Buyer"/>
+ <partnerLinks>
+ <partnerLink name="BuyerToSeller" partnerLinkType="byr:BuyerToSellerLT" partnerRole="SellerRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="slr:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="slr:checkCreditResponse" name="checkCreditResponseVar"/>
+ </variables>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="slr:insufficientCreditFault" faultName="slr:insufficientCredit" faultVariable="insufficientCreditFaultVar">
+ <sequence/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="checkCreditRequestVar" name="Send_CreditCheckRequest" operation="checkCredit" outputVariable="checkCreditResponseVar" partnerLink="BuyerToSeller" portType="slr:SellerBehavior"/>
+ </sequence>
+ </scope>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Seller.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Seller.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/results/ReqRespFault at Seller.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,25 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:byr="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns:slr="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:tns="http://www.pi4soa.org/ReqRespFault" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="org.pi4soa.reqrespfault.reqrespfault.ReqRespFaultProcess at Seller" name="ReqRespFaultProcess_Seller" targetNamespace="http://www.pi4soa.org/ReqRespFault/Seller" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_Seller.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_SellerArtifacts.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <partnerLinks>
+ <partnerLink myRole="SellerBehavior" name="BuyerToSeller" partnerLinkType="slr:BuyerToSellerServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="slr:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="slr:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="slr:insufficientCreditFault" name="insufficientCreditFaultVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_CreditCheckRequest" operation="checkCredit" partnerLink="BuyerToSeller" portType="slr:SellerBehavior" variable="checkCreditRequestVar"/>
+ <if>
+ <sequence>
+ <reply name="Send_CreditCheckOk" operation="checkCredit" partnerLink="BuyerToSeller" portType="slr:SellerBehavior" variable="checkCreditResponseVar"/>
+ </sequence>
+ <else>
+ <sequence>
+ <reply faultName="slr:insufficientCredit" name="Send_CreditCheckInvalid" operation="checkCredit" partnerLink="BuyerToSeller" portType="slr:SellerBehavior" variable="insufficientCreditFaultVar"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ESBBroker.cdm
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ESBBroker.cdm (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ESBBroker.cdm 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<org.pi4soa.cdl:Package xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:org.pi4soa.cdl="http:///org/pi4soa/cdl.ecore" description="The choreography description for ESBBroker" name="ESBBroker" author="gary" version="0.2" targetNamespace="http://www.pi4soa.org/ESBBroker">
+ <typeDefinitions>
+ <nameSpaces description="Target Namespace for ESBBroker" prefix="tns" uRI="http://www.pi4soa.org/ESBBroker"/>
+ <nameSpaces description="XML Schema Namespace" prefix="xsd" uRI="http://www.w3.org/2001/XMLSchema"/>
+ <nameSpaces description="Target Namespace for ESBBroker" prefix="brk" uRI="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <nameSpaces description="Target Namespace for ESBBroker" prefix="byr" uRI="http://www.pi4soa.org/ESBBroker/Buyer"/>
+ <nameSpaces description="Target Namespace for ESBBroker" prefix="cay" uRI="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <nameSpaces description="Target Namespace for ESBBroker" prefix="spr" uRI="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <informationTypes description="This is the information type BookingReference" name="BookingReference" elementName="bookingReference"/>
+ <informationTypes description="This is the information type Buy" name="Buy" elementName="buy"/>
+ <informationTypes description="This is the information type Cancel" name="Cancel" elementName="cancel"/>
+ <informationTypes description="This is the information type CreditInformation" name="CreditInformation" elementName="CreditCheckRequest"/>
+ <informationTypes description="This is the information type CreditInvalid" name="CreditInvalid" elementName="CreditCheckInvalid"/>
+ <informationTypes description="This is the information type CreditValid" name="CreditValid" elementName="CreditCheckOk"/>
+ <informationTypes description="This is the information type Enquiry" name="Enquiry" typeName="" elementName="enquiry"/>
+ <informationTypes description="This is the information type OrderConfirmed" name="OrderConfirmed" elementName="orderConfirmed"/>
+ <informationTypes description="This is the information type OrderRejected" name="OrderRejected" elementName="orderRejected"/>
+ <informationTypes description="This is the information type Quote" name="Quote" elementName="quote"/>
+ <informationTypes description="This is the information type QuoteList" name="QuoteList" elementName="quoteList"/>
+ <informationTypes description="This is the information type RequestForQuote" name="RequestForQuote" elementName="requestForQuote"/>
+ <informationTypes description="This is the information type URIType" name="URIType"/>
+ <tokens description="This is the token URI" name="URI" informationType="//@typeDefinitions/@informationTypes.12"/>
+ <roleTypes description="This is the role type Broker" name="Broker">
+ <behaviors description="This is the behavior BrokerBehavior" name="BrokerBehavior"/>
+ </roleTypes>
+ <roleTypes description="This is the role type Buyer" name="Buyer">
+ <behaviors description="This is the behavior BuyerBehavior" name="BuyerBehavior"/>
+ </roleTypes>
+ <roleTypes description="This is the role type CreditAgency" name="CreditAgency">
+ <behaviors description="This is the behavior CreditAgencyBehavior" name="CreditAgencyBehavior"/>
+ </roleTypes>
+ <roleTypes description="This is the role type Supplier" name="Supplier">
+ <behaviors description="This is the behavior SupplierBehavior" name="SupplierBehavior"/>
+ </roleTypes>
+ <relationshipTypes description="Relationship between Broker and CreditAgency" name="BrokerToCreditAgencyRel" firstRoleType="//@typeDefinitions/@roleTypes.0" secondRoleType="//@typeDefinitions/@roleTypes.2"/>
+ <relationshipTypes description="Relationship between Broker and Supplier" name="BrokerToSupplierRel" firstRoleType="//@typeDefinitions/@roleTypes.0" secondRoleType="//@typeDefinitions/@roleTypes.3"/>
+ <relationshipTypes description="Relationship between Buyer and Broker" name="BuyerToBrokerRel" firstRoleType="//@typeDefinitions/@roleTypes.1" secondRoleType="//@typeDefinitions/@roleTypes.0"/>
+ <participantTypes description="This is the participant type brk:Broker" name="brk:Broker" roleTypes="//@typeDefinitions/@roleTypes.0">
+ <semanticAnnotations annotation="overlord.cdl.samples.LoanBroker at Broker" name="conversationType"/>
+ </participantTypes>
+ <participantTypes description="This is the participant type byr:Buyer" name="byr:Buyer" roleTypes="//@typeDefinitions/@roleTypes.1">
+ <semanticAnnotations annotation="overlord.cdl.samples.LoanBroker at Buyer" name="conversationType"/>
+ </participantTypes>
+ <participantTypes description="This is the participant type cay:CreditAgency" name="cay:CreditAgency" roleTypes="//@typeDefinitions/@roleTypes.2">
+ <semanticAnnotations annotation="overlord.cdl.samples.Common at CreditAgency" name="conversationType"/>
+ </participantTypes>
+ <participantTypes description="This is the participant type spr:Supplier" name="spr:Supplier" roleTypes="//@typeDefinitions/@roleTypes.3">
+ <semanticAnnotations annotation="" name="conversationType"/>
+ </participantTypes>
+ <channelTypes description="This is the channel type BrokerChannelType" name="BrokerChannelType" referenceToken="//@typeDefinitions/@tokens.0" roleType="//@typeDefinitions/@roleTypes.0"/>
+ <channelTypes description="This is the channel type CreditAgencyChannelType" name="CreditAgencyChannelType" referenceToken="//@typeDefinitions/@tokens.0" roleType="//@typeDefinitions/@roleTypes.2"/>
+ <channelTypes description="This is the channel type SupplierChannelType" name="SupplierChannelType" referenceToken="//@typeDefinitions/@tokens.0" roleType="//@typeDefinitions/@roleTypes.3"/>
+ </typeDefinitions>
+ <choreographies description="Choreography flow for the ESBBroker process" name="ESBBrokerProcess" root="true">
+ <enclosedChoreographies name="CompleteTransaction">
+ <participantDefinitions name="SupplierTxnProcessor" roleTypes="//@typeDefinitions/@roleTypes.3">
+ <semanticAnnotations annotation="overlord.cdl.samples.LoanBroker at SupplierTxnProcessor" name="conversationType"/>
+ </participantDefinitions>
+ <variableDefinitions description="Channel to facilitate interaction to Broker" name="BrokerChannel" type="//@typeDefinitions/@channelTypes.0" free="true" roleTypes="//@typeDefinitions/@roleTypes.0 //@typeDefinitions/@roleTypes.1"/>
+ <variableDefinitions description="Channel to facilitate interaction to CreditAgency" name="CreditAgencyChannel" type="//@typeDefinitions/@channelTypes.1"/>
+ <variableDefinitions description="Channel to facilitate interaction to Supplier" name="SupplierChannel" type="//@typeDefinitions/@channelTypes.2"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="Buy" operation="buy" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction Buy" name="BuyRequestExchange" type="//@typeDefinitions/@informationTypes.1"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CheckCredit" operation="checkCredit" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction CheckCredit" name="CheckCreditRequestExchange" type="//@typeDefinitions/@informationTypes.3"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Choice" description="Evaluate Credit Check Result">
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="Sufficient Credit">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CheckCreditResponse" operation="checkCredit" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CheckCreditResponse" name="CheckCreditResponseRespondExchange" type="//@typeDefinitions/@informationTypes.5" action="Respond"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="ConfirmBooking" operation="confirm" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.2" relationship="//@typeDefinitions/@relationshipTypes.1" toParticipant="//@choreographies.0/@enclosedChoreographies.0/@participantDefinitions.0">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction ConfirmBooking" name="ConfirmBookingRequestExchange" type="//@typeDefinitions/@informationTypes.7"/>
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction ConfirmBooking" name="ConfirmBookingRequestExchange" type="//@typeDefinitions/@informationTypes.0" action="Respond"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="Buy" operation="buy" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction Buy" name="BuyRespondExchange" type="//@typeDefinitions/@informationTypes.0" action="Respond" faultName=""/>
+ </activities>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="Insufficient Credit">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CheckCreditFailed" operation="checkCredit" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CheckCreditFailed" name="CheckCreditFailedRespondExchange" type="//@typeDefinitions/@informationTypes.4" action="Respond" faultName="invalidCredit"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="Buy" operation="buy" channelVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction Buy" name="BuyRespondExchange" type="//@typeDefinitions/@informationTypes.8" action="Respond" faultName="rejected"/>
+ </activities>
+ </activities>
+ </activities>
+ </enclosedChoreographies>
+ <enclosedChoreographies name="RequestForQuote">
+ <participantDefinitions name="SupplierQuoteEngine" roleTypes="//@typeDefinitions/@roleTypes.3">
+ <semanticAnnotations annotation="overlord.cdl.samples.LoanBroker at SupplierQuoteEngine" name="conversationType"/>
+ </participantDefinitions>
+ <variableDefinitions description="Channel to facilitate interaction to Supplier" name="SupplierChannel" type="//@typeDefinitions/@channelTypes.2"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="RFQ" operation="getQuote" channelVariable="//@choreographies.0/@enclosedChoreographies.1/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.1" toParticipant="//@choreographies.0/@enclosedChoreographies.1/@participantDefinitions.0">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction RFQ" name="RFQRequestExchange" type="//@typeDefinitions/@informationTypes.11"/>
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction RFQ" name="RFQRespondExchange" type="//@typeDefinitions/@informationTypes.9" action="Respond"/>
+ </activities>
+ </enclosedChoreographies>
+ <variableDefinitions description="Channel to facilitate interaction to Broker" name="BrokerChannel" type="//@typeDefinitions/@channelTypes.0" roleTypes="//@typeDefinitions/@roleTypes.0 //@typeDefinitions/@roleTypes.1"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="Enquiry" operation="makeEnquiry" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction Enquiry" name="EnquiryRequestExchange" type="//@typeDefinitions/@informationTypes.6"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:While" name="SendRFQToSuppliers">
+ <activities xsi:type="org.pi4soa.cdl:Perform" choreography="//@choreographies.0/@enclosedChoreographies.1"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:When" name="WhenQuotesReceivedOrTimeout">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="Enquiry" operation="makeEnquiry" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction Enquiry" name="EnquiryRespondExchange" type="//@typeDefinitions/@informationTypes.10" action="Respond"/>
+ </activities>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Choice">
+ <activities xsi:type="org.pi4soa.cdl:Sequence">
+ <activities xsi:type="org.pi4soa.cdl:Perform" choreography="//@choreographies.0/@enclosedChoreographies.0" waitForCompletion="false">
+ <bindDetails name="BindBrokerChannel" thisVariable="//@choreographies.0/@variableDefinitions.0" thisRole="//@typeDefinitions/@roleTypes.1" freeVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.0" freeRole="//@typeDefinitions/@roleTypes.1"/>
+ <bindDetails name="BindBrokerChannel" thisVariable="//@choreographies.0/@variableDefinitions.0" thisRole="//@typeDefinitions/@roleTypes.0" freeVariable="//@choreographies.0/@enclosedChoreographies.0/@variableDefinitions.0" freeRole="//@typeDefinitions/@roleTypes.0"/>
+ </activities>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Sequence">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="Cancel" operation="cancel" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction Cancel" name="CancelRequestExchange" type="//@typeDefinitions/@informationTypes.2"/>
+ </activities>
+ </activities>
+ </activities>
+ </choreographies>
+</org.pi4soa.cdl:Package>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/PurchaseGoods.cdm
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/PurchaseGoods.cdm (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/PurchaseGoods.cdm 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<org.pi4soa.cdl:Package xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:org.pi4soa.cdl="http:///org/pi4soa/cdl.ecore" description="The choreography description for PurchaseGoods" name="PurchaseGoods" author="gary" version="0.1" targetNamespace="http://www.jboss.org/savara/examples">
+ <typeDefinitions>
+ <nameSpaces description="Target Namespace for PurchaseGoods" prefix="tns" uRI="http://www.jboss.org/savara/examples"/>
+ <nameSpaces description="XML Schema Namespace" prefix="xsd" uRI="http://www.w3.org/2001/XMLSchema"/>
+ <nameSpaces prefix="pur" uRI="java:org.jboss.savara.examples.purchasing"/>
+ <nameSpaces prefix="sto" uRI="http://www.jboss.org/examples/store"/>
+ <informationTypes description="This is the information type BuyConfirmed" name="BuyConfirmed" typeName="sto:BuyConfirmed" elementName=""/>
+ <informationTypes description="This is the information type BuyFailed" name="BuyFailed" typeName="sto:BuyFailed" elementName=""/>
+ <informationTypes description="This is the information type BuyRequest" name="BuyRequest" typeName="sto:BuyRequest" elementName=""/>
+ <informationTypes description="This is the information type CreditCheckInvalid" name="CreditCheckInvalid" typeName="pur:CreditCheckInvalid" elementName=""/>
+ <informationTypes description="This is the information type CreditCheckOk" name="CreditCheckOk" typeName="pur:CreditCheckOk" elementName=""/>
+ <informationTypes description="This is the information type CreditCheckRequest" name="CreditCheckRequest" typeName="pur:CreditCheckRequest" elementName=""/>
+ <informationTypes description="This is the information type IDType" name="IDType" typeName="xsd:string"/>
+ <informationTypes description="This is the information type URITokenType" name="URITokenType" typeName="xsd:anyURI"/>
+ <tokens description="This is the token ID" name="ID" informationType="//@typeDefinitions/@informationTypes.6"/>
+ <tokens description="This is the token URIToken" name="URIToken" informationType="//@typeDefinitions/@informationTypes.7"/>
+ <tokenLocators description="This is the token locator BuyFailedIDLocator" token="//@typeDefinitions/@tokens.0" informationType="//@typeDefinitions/@informationTypes.1" query="//@id" name="BuyFailedIDLocator"/>
+ <tokenLocators description="This is the token locator BuyRequestIDLocator" token="//@typeDefinitions/@tokens.0" informationType="//@typeDefinitions/@informationTypes.2" query="//@id" name="BuyRequestIDLocator"/>
+ <tokenLocators description="This is the token locator BuyResponseIDLocator" token="//@typeDefinitions/@tokens.0" informationType="//@typeDefinitions/@informationTypes.0" query="//@id" name="BuyResponseIDLocator"/>
+ <tokenLocators description="This is the token locator CreditCheckInvalidIDLocator" token="//@typeDefinitions/@tokens.0" informationType="//@typeDefinitions/@informationTypes.3" query="//@id" name="CreditCheckInvalidIDLocator"/>
+ <tokenLocators description="This is the token locator CreditCheckRequestIDLocator" token="//@typeDefinitions/@tokens.0" informationType="//@typeDefinitions/@informationTypes.5" query="//@id" name="CreditCheckRequestIDLocator"/>
+ <tokenLocators description="This is the token locator CreditCheckResponseIDLocator" token="//@typeDefinitions/@tokens.0" informationType="//@typeDefinitions/@informationTypes.4" query="//@id" name="CreditCheckResponseIDLocator"/>
+ <roleTypes description="This is the role type Buyer" name="Buyer">
+ <behaviors description="This is the behavior BuyerBehavior" name="BuyerBehavior"/>
+ </roleTypes>
+ <roleTypes description="This is the role type CreditAgency" name="CreditAgency">
+ <behaviors description="This is the behavior CreditAgencyBehavior" name="CreditAgencyBehavior" interface="pur:CreditAgencyInterface"/>
+ </roleTypes>
+ <roleTypes description="This is the role type Store" name="Store">
+ <behaviors description="This is the behavior StoreBehavior" name="StoreBehavior" interface="sto:StoreInterface"/>
+ </roleTypes>
+ <relationshipTypes description="Relationship between Buyer and Store" name="BuyerToStoreRel" firstRoleType="//@typeDefinitions/@roleTypes.0" secondRoleType="//@typeDefinitions/@roleTypes.2"/>
+ <relationshipTypes description="Relationship between Store and CreditAgency" name="StoreToCreditAgencyRel" firstRoleType="//@typeDefinitions/@roleTypes.2" secondRoleType="//@typeDefinitions/@roleTypes.1"/>
+ <participantTypes description="This is the participant type Buyer" name="Buyer" roleTypes="//@typeDefinitions/@roleTypes.0">
+ <semanticAnnotations annotation="savara.samples.Purchasing at Buyer" name="conversationType"/>
+ </participantTypes>
+ <participantTypes description="This is the participant type pur:CreditAgency" name="pur:CreditAgency" roleTypes="//@typeDefinitions/@roleTypes.1">
+ <semanticAnnotations annotation="savara.samples.Common at CreditAgency" name="conversationType"/>
+ </participantTypes>
+ <participantTypes description="This is the participant type sto:Store" name="sto:Store" roleTypes="//@typeDefinitions/@roleTypes.2">
+ <semanticAnnotations annotation="savara.samples.Purchasing at Store" name="conversationType"/>
+ </participantTypes>
+ <channelTypes description="This is the channel type CreditAgencyChannelType" name="CreditAgencyChannelType" referenceToken="//@typeDefinitions/@tokens.1" roleType="//@typeDefinitions/@roleTypes.1">
+ <identities description="ID" tokens="//@typeDefinitions/@tokens.0"/>
+ </channelTypes>
+ <channelTypes description="This is the channel type StoreChannelType" name="StoreChannelType" referenceToken="//@typeDefinitions/@tokens.1" roleType="//@typeDefinitions/@roleTypes.2">
+ <identities description="ID" tokens="//@typeDefinitions/@tokens.0"/>
+ </channelTypes>
+ </typeDefinitions>
+ <choreographies description="Choreography flow for the PurchaseGoods process" name="PurchaseGoodsProcess" root="true">
+ <variableDefinitions description="Channel to facilitate interaction to CreditAgency" name="CreditAgencyChannel" type="//@typeDefinitions/@channelTypes.0"/>
+ <variableDefinitions description="Channel to facilitate interaction to Supplier" name="SupplierChannel" type="//@typeDefinitions/@channelTypes.1"/>
+ <variableDefinitions description="This is the variable buy" name="buy" type="//@typeDefinitions/@informationTypes.2"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyRequest" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction BuyRequest" name="BuyRequestRequestExchange" type="//@typeDefinitions/@informationTypes.2"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheck" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.1">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction CreditCheck" name="CreditCheckRequestExchange" type="//@typeDefinitions/@informationTypes.5"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Choice" description="Is credit ok?">
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="Credit Valid">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheckOk" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.1">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CreditCheckOk" name="CreditCheckOkRespondExchange" type="//@typeDefinitions/@informationTypes.4" action="Respond"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyConfirmed" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction BuyConfirmed" name="BuyConfirmedRespondExchange" type="//@typeDefinitions/@informationTypes.0" action="Respond"/>
+ </activities>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="Credit Invalid">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheckFailed" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.1">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CreditCheckFailed" name="CreditCheckFailedRespondExchange" type="//@typeDefinitions/@informationTypes.3" action="Respond" faultName="CreditCheckFailed"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyFailed" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction BuyFailed" name="BuyFailedRespondExchange" type="//@typeDefinitions/@informationTypes.1" action="Respond" faultName="BuyFailed"/>
+ </activities>
+ </activities>
+ </activities>
+ </choreographies>
+</org.pi4soa.cdl:Package>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ReqRespFault.cdm
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ReqRespFault.cdm (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/testmodels/ReqRespFault.cdm 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<org.pi4soa.cdl:Package xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:org.pi4soa.cdl="http:///org/pi4soa/cdl.ecore" description="The choreography description for ReqRespFault" name="ReqRespFault" author="gary" version="0.3" targetNamespace="http://www.pi4soa.org/ReqRespFault">
+ <typeDefinitions>
+ <nameSpaces description="Target Namespace for ReqRespFault" prefix="tns" uRI="http://www.pi4soa.org/ReqRespFault"/>
+ <nameSpaces description="XML Schema Namespace" prefix="xsd" uRI="http://www.w3.org/2001/XMLSchema"/>
+ <nameSpaces description="Target Namespace for ReqRespFault" prefix="byr" uRI="http://www.pi4soa.org/ReqRespFault/Buyer"/>
+ <nameSpaces description="Target Namespace for ReqRespFault" prefix="slr" uRI="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <informationTypes description="This is the information type CreditInformation" name="CreditInformation" elementName="CreditCheckRequest"/>
+ <informationTypes description="This is the information type CreditInvalid" name="CreditInvalid" elementName="CreditCheckInvalid"/>
+ <informationTypes description="This is the information type CreditValid" name="CreditValid" elementName="CreditCheckOk"/>
+ <informationTypes description="This is the information type URIType" name="URIType"/>
+ <tokens description="This is the token URI" name="URI" informationType="//@typeDefinitions/@informationTypes.3"/>
+ <roleTypes description="This is the role type Buyer" name="Buyer">
+ <behaviors description="This is the behavior BuyerBehavior" name="BuyerBehavior"/>
+ </roleTypes>
+ <roleTypes description="This is the role type Seller" name="Seller">
+ <behaviors description="This is the behavior SellerBehavior" name="SellerBehavior"/>
+ </roleTypes>
+ <relationshipTypes description="Relationship between Buyer and Seller" name="BuyerToSellerRel" firstRoleType="//@typeDefinitions/@roleTypes.0" secondRoleType="//@typeDefinitions/@roleTypes.1"/>
+ <participantTypes description="This is the participant type byr:Buyer" name="byr:Buyer" roleTypes="//@typeDefinitions/@roleTypes.0">
+ <semanticAnnotations annotation="overlord.cdl.samples.LoanBroker at Buyer" name="conversationType"/>
+ </participantTypes>
+ <participantTypes description="This is the participant type slr:Seller" name="slr:Seller" roleTypes="//@typeDefinitions/@roleTypes.1">
+ <semanticAnnotations annotation="overlord.cdl.samples.LoanBroker at Broker" name="conversationType"/>
+ </participantTypes>
+ <channelTypes description="This is the channel type SellerChannelType" name="SellerChannelType" referenceToken="//@typeDefinitions/@tokens.0" roleType="//@typeDefinitions/@roleTypes.1"/>
+ </typeDefinitions>
+ <choreographies description="Choreography flow for the ReqRespFault process" name="ReqRespFaultProcess" root="true">
+ <variableDefinitions description="Channel to facilitate interaction to Broker" name="BrokerChannel" type="//@typeDefinitions/@channelTypes.0" roleTypes="//@typeDefinitions/@roleTypes.1 //@typeDefinitions/@roleTypes.0"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheck" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction CreditCheck" name="CreditCheckRequestExchange" type="//@typeDefinitions/@informationTypes.0"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Choice">
+ <activities xsi:type="org.pi4soa.cdl:Sequence">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheckValid" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CreditCheckValid" name="CreditCheckValidRespondExchange" type="//@typeDefinitions/@informationTypes.2" action="Respond"/>
+ </activities>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Sequence">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheckInvalid" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CreditCheckInvalid" name="CreditCheckInvalidRespondExchange" type="//@typeDefinitions/@informationTypes.1" action="Respond" faultName="insufficientCredit"/>
+ </activities>
+ </activities>
+ </activities>
+ </choreographies>
+</org.pi4soa.cdl:Package>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtilsTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtilsTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtilsTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.change;
+
+import org.scribble.conversation.model.Conversation;
+import org.scribble.conversation.model.Run;
+import org.scribble.model.*;
+import org.scribble.model.change.DefaultModelChangeContext;
+import org.scribble.model.change.ModelChangeContext;
+import org.jboss.savara.contract.model.*;
+
+import junit.framework.TestCase;
+
+public class ModelChangeUtilsTest extends TestCase {
+
+ private static final String MY_ROLE = "MyRole";
+ private static final String MY_LOCATED_ROLE = "MyLocatedRole";
+ private static final String MY_OTHER_ROLE = "MyOtherRole";
+ private static final String MY_OTHER_LOCATED_ROLE = "MyOtherLocatedRole";
+
+ public void testInitialiseContracts() {
+ ModelChangeContext context=new DefaultModelChangeContext(null, null);
+
+ Conversation conv=new Conversation();
+ LocatedName ln=new LocatedName();
+ Role r=new Role();
+ r.setName(MY_ROLE);
+
+ Contract c=new Contract();
+ r.getAnnotations().put(Contract.class.getName(), c);
+
+ ln.setRole(r);
+ conv.setLocatedName(ln);
+
+ ModelChangeUtils.addContracts(context, conv, true);
+
+ Contract c2=ModelChangeUtils.getContract(context, MY_ROLE);
+
+ if (c2 == null) {
+ fail("Contract not found");
+ }
+
+ if (c2 != c) {
+ fail("Contract not the same as the one stored");
+ }
+ }
+
+ public void testInitialiseContractsTwice() {
+ ModelChangeContext context=new DefaultModelChangeContext(null, null);
+
+ Conversation conv=new Conversation();
+ LocatedName ln=new LocatedName();
+ Role r=new Role();
+ r.setName(MY_ROLE);
+
+ Contract c=new Contract();
+ r.getAnnotations().put(Contract.class.getName(), c);
+
+ ln.setRole(r);
+ conv.setLocatedName(ln);
+
+ ModelChangeUtils.addContracts(context, conv, true);
+
+ Conversation conv2=new Conversation();
+ LocatedName ln2=new LocatedName();
+ Role r2=new Role();
+ r2.setName(MY_OTHER_ROLE);
+
+ Contract c2=new Contract();
+ r2.getAnnotations().put(Contract.class.getName(), c2);
+
+ ln2.setRole(r2);
+ conv2.setLocatedName(ln2);
+
+ ModelChangeUtils.addContracts(context, conv2, true);
+
+ Contract c3=ModelChangeUtils.getContract(context, MY_ROLE);
+
+ if (c3 == null) {
+ fail("Contract not found");
+ }
+
+ if (c3 != c) {
+ fail("Contract not the same as the one stored");
+ }
+
+ Contract c4=ModelChangeUtils.getContract(context, MY_OTHER_ROLE);
+
+ if (c4 == null) {
+ fail("Contract not found");
+ }
+
+ if (c4 != c2) {
+ fail("Contract2 not the same as the one stored");
+ }
+ }
+
+ public void testPushRoleContractMapping() {
+ ModelChangeContext context=new DefaultModelChangeContext(null, null);
+
+ Conversation conv=new Conversation();
+ LocatedName ln=new LocatedName();
+ Role r1=new Role();
+ r1.setName(MY_LOCATED_ROLE);
+ ln.setRole(r1);
+ conv.setLocatedName(ln);
+
+ Contract c1=new Contract();
+ r1.getAnnotations().put(Contract.class.getName(), c1);
+
+ Role r2=new Role();
+ r2.setName(MY_ROLE);
+
+ Contract c2=new Contract();
+ r2.getAnnotations().put(Contract.class.getName(), c2);
+
+ RoleList rl=new RoleList();
+ rl.getRoles().add(r2);
+ conv.getBlock().getContents().add(rl);
+
+ ModelChangeUtils.addContracts(context, conv, true);
+
+ Conversation subconv=new Conversation();
+ LocatedName subln=new LocatedName();
+ Role subr1=new Role();
+ subr1.setName(MY_OTHER_LOCATED_ROLE);
+ subln.setRole(subr1);
+ subconv.setLocatedName(subln);
+
+ Run run=new Run();
+ conv.getBlock().getContents().add(run);
+ run.setInlineDefinition(subconv);
+
+ DeclarationBinding db=new DeclarationBinding();
+ db.setDeclaration(r2);
+ db.setBoundName(MY_OTHER_ROLE);
+ run.getBindings().add(db);
+
+ ModelChangeUtils.pushRoleContractMapping(context, run);
+
+ Contract c3=ModelChangeUtils.getContract(context, MY_ROLE);
+ Contract c4=ModelChangeUtils.getContract(context, MY_OTHER_ROLE);
+
+ if (c3 != null) {
+ fail("Contract for "+MY_ROLE+" should be null");
+ }
+
+ if (c4 == null) {
+ fail("Contract for "+MY_OTHER_ROLE+" should NOT be null");
+ }
+
+ Contract c5=ModelChangeUtils.getContract(context, MY_LOCATED_ROLE);
+ Contract c6=ModelChangeUtils.getContract(context, MY_OTHER_LOCATED_ROLE);
+
+ if (c5 != null) {
+ fail("Contract for "+MY_LOCATED_ROLE+" should be null");
+ }
+
+ if (c6 == null) {
+ fail("Contract for "+MY_OTHER_LOCATED_ROLE+" should NOT be null");
+ }
+
+ if (c6 != c1) {
+ fail("Located role's Contract not the same as the one stored");
+ }
+
+ if (c4 != c2) {
+ fail("Contract not the same as the one stored");
+ }
+ }
+
+ public void testPopRoleContractMapping() {
+ ModelChangeContext context=new DefaultModelChangeContext(null, null);
+
+ Conversation conv=new Conversation();
+ LocatedName ln=new LocatedName();
+ Role r1=new Role();
+ r1.setName(MY_LOCATED_ROLE);
+
+ ln.setRole(r1);
+ conv.setLocatedName(ln);
+
+ Role r2=new Role();
+ r2.setName(MY_ROLE);
+
+ RoleList rl=new RoleList();
+ rl.getRoles().add(r2);
+ conv.getBlock().getContents().add(rl);
+
+ Conversation subconv=new Conversation();
+ LocatedName subln=new LocatedName();
+ Role subr1=new Role();
+ subr1.setName(MY_OTHER_LOCATED_ROLE);
+ subln.setRole(subr1);
+ subconv.setLocatedName(subln);
+
+ Contract c1=new Contract();
+ subr1.getAnnotations().put(Contract.class.getName(), c1);
+
+ Role r3=new Role();
+ r3.setName(MY_OTHER_ROLE);
+
+ Contract c2=new Contract();
+ r3.getAnnotations().put(Contract.class.getName(), c2);
+
+ RoleList rl2=new RoleList();
+ rl2.getRoles().add(r3);
+ subconv.getBlock().getContents().add(rl2);
+
+ // Add contracts for subconv as if root, as normally
+ // this would be done by pushing the contracts, so this
+ // is just being used to setup the appropriate context
+ ModelChangeUtils.addContracts(context, subconv, true);
+
+ Run run=new Run();
+ conv.getBlock().getContents().add(run);
+ run.setInlineDefinition(subconv);
+
+ DeclarationBinding db=new DeclarationBinding();
+ db.setDeclaration(r2);
+ db.setBoundName(MY_OTHER_ROLE);
+ run.getBindings().add(db);
+
+ ModelChangeUtils.popRoleContractMapping(context, run);
+
+ Contract c3=ModelChangeUtils.getContract(context, MY_ROLE);
+ Contract c4=ModelChangeUtils.getContract(context, MY_OTHER_ROLE);
+
+ if (c3 == null) {
+ fail("Contract for "+MY_ROLE+" should NOT be null");
+ }
+
+ if (c4 != null) {
+ fail("Contract for "+MY_OTHER_ROLE+" should be null");
+ }
+
+ Contract c5=ModelChangeUtils.getContract(context, MY_LOCATED_ROLE);
+ Contract c6=ModelChangeUtils.getContract(context, MY_OTHER_LOCATED_ROLE);
+
+ if (c5 == null) {
+ fail("Contract for "+MY_LOCATED_ROLE+" should NOT be null");
+ }
+
+ if (c6 != null) {
+ fail("Contract for "+MY_OTHER_LOCATED_ROLE+" should be null");
+ }
+
+ if (c3 != c2) {
+ fail("Contract not the same as the one stored");
+ }
+
+ if (c5 != c1) {
+ fail("Contract not the same as the one stored");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteractionTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteractionTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteractionTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class AbstractInteractionTest extends TestCase {
+
+ public void testIsActivity() {
+ TestAbstractInteraction act=
+ new TestAbstractInteraction(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String op="testOp";
+ String portType="testPortType";
+ String partnerLink="testPartnerLink";
+
+ String xml="<interaction xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "operation=\""+op+"\" "+
+ "partnerLink=\""+partnerLink+"\" "+
+ "portType=\""+portType+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model, elem);
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+
+ if (component.getPartnerLink().equals(partnerLink) == false) {
+ fail("PartnerLink not correct, expecting '"+partnerLink+"': "+
+ component.getPartnerLink());
+ }
+
+ if (component.getPortType().equals(portType) == false) {
+ fail("Port type not correct, expecting '"+portType+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetOperation() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String op="testOp";
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model);
+
+ if (component.getOperation() != null) {
+ fail("Should be null");
+ }
+
+ component.setOperation(op);
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+ }
+
+ public void testGetPortType() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pt="testPortType";
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model);
+
+ if (component.getPortType() != null) {
+ fail("Should be null");
+ }
+
+ component.setPortType(pt);
+
+ if (component.getPortType().equals(pt) == false) {
+ fail("Port type not correct, expecting '"+pt+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pl="testPartnerLink";
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model);
+
+ if (component.getPartnerLink() != null) {
+ fail("Should be null");
+ }
+
+ component.setPartnerLink(pl);
+
+ if (component.getPartnerLink().equals(pl) == false) {
+ fail("Partner link not correct, expecting '"+pl+"': "+
+ component.getPartnerLink());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivityTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivityTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivityTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,191 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class BPELActivityTest extends TestCase {
+
+ public void testIsActivity() {
+ TestBPELActivity act=
+ new TestBPELActivity(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testGetNameFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String name="testName";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "name=\""+name+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELActivity component=new TestBPELActivity(model, elem);
+
+ if (component.getName().equals(name) == false) {
+ fail("Name not correct, expecting '"+name+"': "+
+ component.getName());
+ }
+ }
+
+ public void testGetName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String name="testName";
+
+ TestBPELActivity component=new TestBPELActivity(model);
+
+ if (component.getName() != null) {
+ fail("Should be null");
+ }
+
+ component.setName(name);
+
+ if (component.getName().equals(name) == false) {
+ fail("Name not correct, expecting '"+name+"': "+
+ component.getName());
+ }
+ }
+
+ public void testSuppressJoinFailureFromDOMTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="yes";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "suppressJoinFailure=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELActivity component=new TestBPELActivity(model, elem);
+
+ if (component.getSuppressJoinFailure() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+
+ public void testSuppressJoinFailureFromDOMFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="no";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "suppressJoinFailure=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELActivity component=new TestBPELActivity(model, elem);
+
+ if (component.getSuppressJoinFailure() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+
+ public void testGetSuppressJoinFailureTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ TestBPELActivity component=new TestBPELActivity(model);
+
+ component.setSuppressJoinFailure(true);
+
+ if (component.getSuppressJoinFailure() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+
+ public void testGetSuppressJoinFailureFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ TestBPELActivity component=new TestBPELActivity(model);
+
+ component.setSuppressJoinFailure(false);
+
+ if (component.getSuppressJoinFailure() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,401 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.BPELElement;
+import org.jboss.savara.tools.bpel.model.component.Condition;
+import org.jboss.savara.tools.bpel.model.component.Else;
+import org.jboss.savara.tools.bpel.model.component.If;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class BPELElementTest extends TestCase {
+
+ public void testFindChildElements() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<first/>"+
+ "<else/>"+
+ "<sequence/>"+
+ "<second/>"+
+ "<if/>"+
+ "</elem>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ java.util.List<BPELElement> elems=
+ top.findChildElements(BPELElement.class);
+
+ if (elems == null) {
+ fail("Null list");
+ }
+
+ if (elems.size() != 3) {
+ fail("Expecting three child elements: "+elems.size());
+ }
+
+ if ((elems.get(0) instanceof Else) == false) {
+ fail("Element 0 not else: "+elems.get(0));
+ }
+
+ if ((elems.get(1) instanceof Sequence) == false) {
+ fail("Element 1 not sequence: "+elems.get(1));
+ }
+
+ if ((elems.get(2) instanceof If) == false) {
+ fail("Element 2 not 'if': "+elems.get(2));
+ }
+
+ elems = top.findChildElements(Sequence.class);
+
+ if (elems == null) {
+ fail("Null sequence list");
+ }
+
+ if (elems.size() != 1) {
+ fail("Expecting one child element: "+elems.size());
+ }
+
+ if ((elems.get(0) instanceof Sequence) == false) {
+ fail("Element 0 not sequence: "+elems.get(0));
+ }
+ }
+
+ public void testFindChildActivity() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<first/>"+
+ "<else/>"+
+ "<sequence/>"+
+ "<second/>"+
+ "<if/>"+
+ "</elem>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ BPELElement act=top.findChildActivity();
+
+ if (act == null) {
+ fail("Null activity");
+ }
+
+ if ((act instanceof Sequence) == false) {
+ fail("Activity not sequence");
+ }
+ }
+
+ public void testSetChildElement() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ TestBPELElement top=new TestBPELElement(model);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getFirstChild() != null) {
+ fail("Child element not expected");
+ }
+
+ TestBPELElement telem=new TestBPELElement(model, newElem);
+
+ top.setChildElement(null, telem, null);
+
+ if (top.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("Should only be 1 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(0).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+ }
+
+ public void testSetChildElementAtBeginning() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem>"+
+ "<first/>"+
+ "<second/>"+
+ "<third/>"+
+ "</elem>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Should only be 3 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ TestBPELElement telem=new TestBPELElement(model, newElem);
+
+ top.setChildElement(null, telem, top.getDOMElement().getFirstChild());
+
+ if (top.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Should only be 4 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(0).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+ }
+
+ public void testSetChildElementAtEnd() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem>"+
+ "<first/>"+
+ "<second/>"+
+ "<third/>"+
+ "</elem>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Should only be 3 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ TestBPELElement telem=new TestBPELElement(model, newElem);
+
+ top.setChildElement(null, telem, null);
+
+ if (top.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Should only be 4 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(3).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+ }
+
+ public void testSetChildElementReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String first="first";
+ String second="second";
+
+ String xml="<elem>"+
+ "<newelem name=\""+first+"\" />"+
+ "</elem>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+ newElem.setAttribute("name", second);
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getFirstChild() == null) {
+ fail("First child element expected");
+ }
+
+ if ((top.getDOMElement().getFirstChild() instanceof
+ org.w3c.dom.Element) == false) {
+ fail("First child is not an element");
+ }
+
+ TestBPELElement telem=new TestBPELElement(model, newElem);
+
+ top.setChildElement((org.w3c.dom.Element)
+ top.getDOMElement().getFirstChild(),
+ telem, null);
+
+ if (top.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("Should only be 1 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(0).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+
+ if (((org.w3c.dom.Element)top.getDOMElement().getChildNodes().
+ item(0)).getAttribute("name").equals(second) == false) {
+ fail("Attribute is not as expected");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchAllTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchAllTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchAllTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.CatchAll;
+import org.jboss.savara.tools.bpel.model.component.Else;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class CatchAllTest extends TestCase {
+
+ public void testIsActivity() {
+ CatchAll act=new CatchAll(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildCatchAll() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<catchAll xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<sequence/></catchAll>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ CatchAll construct=new CatchAll(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CatchTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Catch;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class CatchTest extends TestCase {
+
+ public void testIsActivity() {
+ Catch act=new Catch(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildCatchAll() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String fault="testFault";
+
+ String xml="<catch xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" " +
+ "faultVariable=\""+var+"\" "+
+ "faultName=\""+fault+"\" >"+
+ "<sequence/></catch>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Catch construct=new Catch(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+
+ public void testGetFaultVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Catch component=new Catch(model);
+
+ if (component.getFaultVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setFaultVariable(var);
+
+ if (component.getFaultVariable().equals(var) == false) {
+ fail("Fault Variable not correct, expecting '"+var+"': "+
+ component.getFaultVariable());
+ }
+ }
+
+ public void testGetFaultName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String fault="testFault";
+
+ Catch component=new Catch(model);
+
+ if (component.getFaultName() != null) {
+ fail("Should be null");
+ }
+
+ component.setFaultName(fault);
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault name not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandlerTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandlerTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandlerTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.CompensationHandler;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class CompensationHandlerTest extends TestCase {
+
+ public void testIsActivity() {
+ CompensationHandler act=
+ new CompensationHandler(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildCompensationHandler() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<compensationHandler xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<sequence/></compensationHandler>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ CompensationHandler construct=new CompensationHandler(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ConditionTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ConditionTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ConditionTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Condition;
+
+import junit.framework.TestCase;
+
+public class ConditionTest extends TestCase {
+
+ public void testIsActivity() {
+ Condition act=new Condition(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testGetExpression() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+ Condition condition=new Condition(model);
+
+ String expr="Test Expression";
+
+ if (condition.getExpression() != null) {
+ fail("Should be null");
+ }
+
+ condition.setExpression(expr);
+
+ String result=condition.getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+ }
+
+ public void testGetExpressionFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr="Test Expression";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+expr+"</condition>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ String result=condition.getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+ }
+
+ public void testGetExpressionLanguage() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+ Condition condition=new Condition(model);
+
+ String lang="Test Language";
+
+ if (condition.getExpressionLanguage() != null) {
+ fail("Should be null");
+ }
+
+ condition.setExpressionLanguage(lang);
+
+ String result=condition.getExpressionLanguage();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(lang) == false) {
+ fail("Expression language is not valid: expecting '"+
+ lang+"' but got '"+result+"'");
+ }
+ }
+
+ public void testGetExpressionLanguageFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String lang="TestLanguage";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\"" +
+ " expressionLanguage=\""+lang+"\"></condition>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ String result=condition.getExpressionLanguage();
+
+ if (result == null) {
+ fail("Expression language is null");
+ }
+
+ if (result.equals(lang) == false) {
+ fail("Expression language is not valid: expecting '"+
+ lang+"' but got '"+result+"'");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseIfTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseIfTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseIfTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Elseif;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class ElseIfTest extends TestCase {
+
+ public void testIsActivity() {
+ Elseif act=new Elseif(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr="Test Expression";
+
+ String xml="<elseif xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<condition>"+expr+"</condition><sequence/></elseif>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Elseif elseif=new Elseif(model, elem);
+
+ if (elseif.getCondition() == null) {
+ fail("No condition");
+ }
+
+ if (elseif.getActivity() == null) {
+ fail("No activity");
+ }
+
+ String result=elseif.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+
+ if ((elseif.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ElseTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Else;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class ElseTest extends TestCase {
+
+ public void testIsActivity() {
+ Else act=new Else(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<else xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<sequence/></else>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Else construct=new Else(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlersTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlersTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlersTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,411 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.EventHandlers;
+import org.jboss.savara.tools.bpel.model.component.OnAlarm;
+import org.jboss.savara.tools.bpel.model.component.OnEvent;
+
+import junit.framework.TestCase;
+
+public class EventHandlersTest extends TestCase {
+
+ public void testIsActivity() {
+ EventHandlers act=new EventHandlers(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testEventHandlersFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<eventHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<onEvent/>"+
+ "<onEvent/>"+
+ "<onAlarm/>"+
+ "</eventHandlers>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ EventHandlers component=new EventHandlers(model, elem);
+
+ if (component.getOnEvents().size() != 2) {
+ fail("Expecting 2 onEvent: "+
+ component.getOnEvents().size());
+ }
+
+ if (component.getOnAlarms().size() != 1) {
+ fail("Expecting 1 onAlarm: "+
+ component.getOnAlarms().size());
+ }
+ }
+
+ public void testAddOnMessageToEventHandlersInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<eventHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<onAlarm/>"+
+ "<onAlarm/>"+
+ "</eventHandlers>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ EventHandlers component=new EventHandlers(model, elem);
+
+ if (component.getOnAlarms().size() != 2) {
+ fail("Expecting 2 onAlarms: "+
+ component.getOnAlarms().size());
+ }
+
+ if (component.getOnEvents().size() != 0) {
+ fail("Expecting 0 onEvents: "+
+ component.getOnEvents().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ OnEvent sub=new OnEvent(model);
+
+ component.addOnEvent(sub, 0);
+
+ if (component.getOnEvents().size() != 1) {
+ fail("Expecting 1 onEvent: "+
+ component.getOnEvents().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(OnEvent.ONEVENT) == false) {
+ fail("Second element was not a 'onEvent': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+
+ public void testAddOnAlarmToEventHandlersInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<eventHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<onEvent/>"+
+ "<onEvent/>"+
+ "</eventHandlers>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ EventHandlers component=new EventHandlers(model, elem);
+
+ if (component.getOnEvents().size() != 2) {
+ fail("Expecting 2 onEvents: "+
+ component.getOnEvents().size());
+ }
+
+ if (component.getOnAlarms().size() != 0) {
+ fail("Expecting 0 onAlarms: "+
+ component.getOnAlarms().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ OnAlarm sub=new OnAlarm(model);
+
+ component.addOnAlarm(sub, 0);
+
+ if (component.getOnAlarms().size() != 1) {
+ fail("Expecting 1 onAlarm: "+
+ component.getOnAlarms().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(3).
+ getLocalName().equals(OnAlarm.ONALARM) == false) {
+ fail("Second element was not a 'onAlarm': "+
+ component.getDOMElement().getChildNodes().item(3).
+ getLocalName());
+ }
+ }
+
+ public void testGetURIOnEvent() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<scope>"+
+ "<eventHandlers>"+
+ "<onEvent>"+
+ "<scope>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</scope>"+
+ "</onEvent>"+
+ "</eventHandlers>"+
+ "<sequence/>"+
+ "</scope>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Scope) == false) {
+ fail("Top level activity is not scope");
+ }
+
+ Scope scope=(Scope)topact;
+
+ if (scope.getEventHandlers() == null) {
+ fail("Event handlers not set");
+ }
+
+ if (scope.getEventHandlers().getOnEvents().size() != 1) {
+ fail("Event handlers should have 1 onEvent: "+scope.getEventHandlers().getOnEvents().size());
+ }
+
+ OnEvent one=scope.getEventHandlers().getOnEvents().get(0);
+
+ Scope innerScope=one.getScope();
+
+ if (innerScope == null) {
+ fail("Inner scope not set");
+ }
+
+ if ((innerScope.getActivity() instanceof Sequence) == false) {
+ fail("Inner scope activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)innerScope.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@eventHandlers/@onEvent.0/@scope/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+
+ public void testGetURIOnAlarm() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<scope>"+
+ "<eventHandlers>"+
+ "<onAlarm>"+
+ "<scope>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</scope>"+
+ "</onAlarm>"+
+ "</eventHandlers>"+
+ "<sequence/>"+
+ "</scope>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Scope) == false) {
+ fail("Top level activity is not scope");
+ }
+
+ Scope scope=(Scope)topact;
+
+ if (scope.getEventHandlers() == null) {
+ fail("Event handlers not set");
+ }
+
+ if (scope.getEventHandlers().getOnAlarms().size() != 1) {
+ fail("Event handlers should have 1 onAlarm: "+scope.getEventHandlers().getOnAlarms().size());
+ }
+
+ OnAlarm one=scope.getEventHandlers().getOnAlarms().get(0);
+
+ if ((one.getActivity() instanceof Scope) == false) {
+ fail("Activity is not Scope");
+ }
+
+ Scope innerScope=(Scope)one.getActivity();
+
+ if (innerScope == null) {
+ fail("Inner scope not set");
+ }
+
+ if ((innerScope.getActivity() instanceof Sequence) == false) {
+ fail("Inner scope activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)innerScope.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@eventHandlers/@onAlarm.0/@scope/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ExitTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ExitTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ExitTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Exit;
+
+import junit.framework.TestCase;
+
+public class ExitTest extends TestCase {
+
+ public void testIsActivity() {
+ Exit act=
+ new Exit(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlersTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlersTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlersTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,391 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Catch;
+import org.jboss.savara.tools.bpel.model.component.FaultHandlers;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class FaultHandlersTest extends TestCase {
+
+ public void testIsActivity() {
+ FaultHandlers act=new FaultHandlers(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testFaultHandlersCatchFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<faultHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<catch/>"+
+ "<catch/>"+
+ "</faultHandlers>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ FaultHandlers component=new FaultHandlers(model, elem);
+
+ if (component.getCatchAll() != null) {
+ fail("CatchAll path should be null");
+ }
+
+ if (component.getCatchPaths().size() != 2) {
+ fail("Should have 2 catch paths: "+component.getCatchPaths().size());
+ }
+ }
+
+ public void testFaultHandlersCatchAllFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<faultHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<catchAll/>"+
+ "</faultHandlers>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ FaultHandlers component=new FaultHandlers(model, elem);
+
+ if (component.getCatchAll() == null) {
+ fail("CatchAll path should NOT be null");
+ }
+
+ if (component.getCatchPaths().size() != 0) {
+ fail("Should have 0 catch paths: "+component.getCatchPaths().size());
+ }
+ }
+
+ public void testAddCatch() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<faultHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "</faultHandlers>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ FaultHandlers component=new FaultHandlers(model, ifelem);
+
+ if (component.getCatchPaths().size() != 0) {
+ fail("Should be no catch paths");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 0) {
+ fail("Zero child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Catch elem=new Catch(model);
+ elem.setActivity(seq);
+
+ component.addCatch(elem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("One child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(Catch.CATCH) == false) {
+ fail("First element was not a catch: "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+ }
+
+ public void testAddCatchInsertBeforeCatchAll() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<faultHandlers xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<catchAll>"+
+ "<sequence/>"+
+ "</catchAll>"+
+ "</faultHandlers>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ FaultHandlers component=new FaultHandlers(model, ifelem);
+
+ if (component.getCatchPaths().size() != 0) {
+ fail("Should be no catch paths");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("One child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Catch catchElem=new Catch(model);
+ catchElem.setActivity(seq);
+
+ component.addCatch(catchElem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(Catch.CATCH) == false) {
+ fail("First element was not a catch: "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+ }
+
+ public void testGetURICatch() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<faultHandlers>"+
+ "<catch>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</catch>"+
+ "</faultHandlers>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ FaultHandlers fhs=component.getFaultHandlers();
+
+ if (fhs == null) {
+ fail("No fault handlers");
+ }
+
+ if (fhs.getCatchPaths().size() != 1) {
+ fail("Expecting one catch: "+fhs.getCatchPaths().size());
+ }
+
+ Catch c=fhs.getCatchPaths().get(0);
+
+ BPELActivity act=c.getActivity();
+
+ if ((act instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)act;
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@faultHandlers/@catch.0/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+
+ public void testGetURICatchAll() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<faultHandlers>"+
+ "<catchAll>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</catchAll>"+
+ "</faultHandlers>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ FaultHandlers fhs=component.getFaultHandlers();
+
+ if (fhs == null) {
+ fail("No fault handlers");
+ }
+
+ if (fhs.getCatchAll() == null) {
+ fail("CatchAll not set");
+ }
+
+ CatchAll c=fhs.getCatchAll();
+
+ BPELActivity act=c.getActivity();
+
+ if ((act instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)act;
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@faultHandlers/@catchAll/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FlowTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FlowTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/FlowTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,398 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Flow;
+import org.jboss.savara.tools.bpel.model.component.Link;
+import org.jboss.savara.tools.bpel.model.component.While;
+
+import junit.framework.TestCase;
+
+public class FlowTest extends TestCase {
+
+ public void testIsActivity() {
+ Flow act=new Flow(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testFlowFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String link1="link1Name";
+ String link2="link2Name";
+
+ String xml="<flow xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<links>"+
+ "<link name=\""+link1+"\" />"+
+ "<link name=\""+link2+"\" />"+
+ "</links>"+
+ "<if/>"+
+ "<if/>"+
+ "</flow>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Flow component=new Flow(model, elem);
+
+ if (component.getLinks().size() != 2) {
+ fail("Expecting 2 child links: "+
+ component.getLinks().size());
+ }
+
+ if (component.getLinks().get(0).getName().equals(link1) == false) {
+ fail("First link name incorrect");
+ }
+
+ if (component.getLinks().get(1).getName().equals(link2) == false) {
+ fail("Second link name incorrect");
+ }
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+ }
+
+ public void testAddLinkToFlowFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String link1="link1Name";
+
+ String xml="<flow xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<if/>"+
+ "</flow>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Flow component=new Flow(model, elem);
+
+ if (component.getLinks().size() != 0) {
+ fail("Should be no links");
+ }
+
+ org.w3c.dom.Element links=
+ component.findChildElement(Flow.LINKS);
+
+ if (links != null) {
+ fail("Links element should not be found");
+ }
+
+ Link l1=new Link(model);
+ l1.setName(link1);
+
+ component.addLink(l1, -1);
+
+ links = component.findChildElement(Flow.LINKS);
+
+ if (links == null) {
+ fail("Links element not found");
+ }
+ }
+
+ public void testRemoveLinkFromFlowFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String link1="link1Name";
+
+ String xml="<flow xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<links>"+
+ "<link name=\""+link1+"\" />"+
+ "</links>"+
+ "<if/>"+
+ "</flow>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Flow component=new Flow(model, elem);
+
+ if (component.getLinks().size() != 1) {
+ fail("Should be one link: "+component.getLinks().size());
+ }
+
+ org.w3c.dom.Element links=
+ component.findChildElement(Flow.LINKS);
+
+ if (links == null) {
+ fail("Links element is null");
+ }
+
+ Link l1=component.getLinks().get(0);
+
+ component.removeLink(l1);
+
+ links = component.findChildElement(Flow.LINKS);
+
+ if (links != null) {
+ fail("Links element should now be null");
+ }
+ }
+
+ public void testAddFirstActToFlowInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<flow xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<if/>"+
+ "<if/>"+
+ "</flow>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Flow component=new Flow(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ While sub=new While(model);
+
+ component.addActivity(sub, 0);
+
+ if (component.getActivities().size() != 3) {
+ fail("Expecting 3 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(While.WHILE) == false) {
+ fail("Second element was not a 'while': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddSecondActToFlowInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<flow xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<if/>"+
+ "<if/>"+
+ "</flow>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Flow component=new Flow(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ While sub=new While(model);
+
+ component.addActivity(sub, 1);
+
+ if (component.getActivities().size() != 3) {
+ fail("Expecting 3 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(While.WHILE) == false) {
+ fail("Second element was not a 'while': "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+ public void testAddLastActToFlowInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<flow xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<if/>"+
+ "<if/>"+
+ "</flow>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Flow component=new Flow(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ While sub=new While(model);
+
+ component.addActivity(sub, -1);
+
+ if (component.getActivities().size() != 3) {
+ fail("Expecting 3 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(3).
+ getLocalName().equals(While.WHILE) == false) {
+ fail("Second element was not a 'while': "+
+ component.getDOMElement().getChildNodes().item(3).
+ getLocalName());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ForEachTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ForEachTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ForEachTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,213 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.ForEach;
+import org.jboss.savara.tools.bpel.model.component.Scope;
+
+import junit.framework.TestCase;
+
+public class ForEachTest extends TestCase {
+
+ public void testIsActivity() {
+ ForEach act=new ForEach(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testForEachFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<forEach xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<startCounterValue/>"+
+ "<finalCounterValue/>"+
+ "<completionCondition/>"+
+ "<scope/>"+
+ "</forEach>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ ForEach component=new ForEach(model, elem);
+
+ if (component.getScope() == null) {
+ fail("Scope not set");
+ }
+ }
+
+ public void testSetScopeInInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<forEach xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<startCounterValue/>"+
+ "<finalCounterValue/>"+
+ "<completionCondition/>"+
+ "</forEach>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ ForEach component=new ForEach(model, elem);
+
+ if (component.getScope() == null) {
+ fail("Scope should not be null");
+ }
+
+ Scope scope=new Scope(model);
+ component.setScope(scope);
+
+ if (component.getScope() == null) {
+ fail("Scope should still not be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(3).
+ getLocalName().equals(Scope.SCOPE) == false) {
+ fail("Second element was not a 'scope': "+
+ component.getDOMElement().getChildNodes().item(3).
+ getLocalName());
+ }
+ }
+
+ public void testGetURI() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<forEach xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<startCounterValue/>"+
+ "<finalCounterValue/>"+
+ "<completionCondition/>"+
+ "<scope>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</scope>"+
+ "</forEach>"+
+ "<sequence/>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof ForEach) == false) {
+ fail("Top level activity is not ForEach");
+ }
+
+ ForEach fe=(ForEach)topact;
+
+ Scope innerScope=fe.getScope();
+
+ if (innerScope == null) {
+ fail("Inner scope not set");
+ }
+
+ if ((innerScope.getActivity() instanceof Sequence) == false) {
+ fail("Inner scope activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)innerScope.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@scope/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/IfTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/IfTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/IfTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,1186 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Condition;
+import org.jboss.savara.tools.bpel.model.component.Else;
+import org.jboss.savara.tools.bpel.model.component.Elseif;
+import org.jboss.savara.tools.bpel.model.component.If;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class IfTest extends TestCase {
+
+ public void testIsActivity() {
+ If act=new If(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testIfFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "</if>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+
+ if (component.getElsePath() != null) {
+ fail("Else path should be null");
+ }
+
+ if (component.getElseIfPaths().size() > 0) {
+ fail("No elseif paths should be set");
+ }
+ }
+
+ public void testIfElseFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+
+ if (component.getElsePath() == null) {
+ fail("Else path is not set");
+ }
+
+ if ((component.getElsePath().getActivity() instanceof Sequence) == false) {
+ fail("Else path Activity not a sequence");
+ }
+
+ }
+
+ public void testIfElseIfsElseFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+ String expr3="Test Expression 3";
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "<elseif>"+
+ "<condition>"+expr2+"</condition>"+
+ "<sequence/>"+
+ "</elseif>"+
+ "<elseif>"+
+ "<condition>"+expr3+"</condition>"+
+ "<sequence/>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+
+ if (component.getElsePath() == null) {
+ fail("Else path is not set");
+ }
+
+ if ((component.getElsePath().getActivity() instanceof Sequence) == false) {
+ fail("Else path Activity not a sequence");
+ }
+
+ if (component.getElseIfPaths().size() != 2) {
+ fail("Two elseif paths expected: "+component.getElseIfPaths().size());
+ }
+
+ if (component.getElseIfPaths().get(0).getCondition() == null) {
+ fail("Elseif 0 no condition");
+ }
+
+ result=component.getElseIfPaths().get(0).getCondition().getExpression();
+
+ if (result == null) {
+ fail("Elseif 0 Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Elseif 0 Expression is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+
+ if (component.getElseIfPaths().get(0).getActivity() == null) {
+ fail("Elseif 0 no activity");
+ }
+
+ if ((component.getElseIfPaths().get(0).getActivity() instanceof Sequence) == false) {
+ fail("Elseif 0 Activity not a sequence");
+ }
+
+ if (component.getElseIfPaths().get(1).getCondition() == null) {
+ fail("Elseif 1 no condition");
+ }
+
+ result=component.getElseIfPaths().get(1).getCondition().getExpression();
+
+ if (result == null) {
+ fail("Elseif 1 Expression is null");
+ }
+
+ if (result.equals(expr3) == false) {
+ fail("Elseif 1 Expression is not valid: expecting '"+
+ expr3+"' but got '"+result+"'");
+ }
+
+ if (component.getElseIfPaths().get(1).getActivity() == null) {
+ fail("Elseif 1 no activity");
+ }
+
+ if ((component.getElseIfPaths().get(1).getActivity() instanceof Sequence) == false) {
+ fail("Elseif 1 Activity not a sequence");
+ }
+ }
+
+ public void testSetConditionNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ If component=new If(model);
+
+ component.setCondition(condition);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetConditionReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ String xml2="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</condition>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ If component=new If(model);
+
+ component.setCondition(condition1);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setCondition(condition2);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetActivityInsertBeforeElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Second element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testSetConditionInsertBeforeElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sources/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ String expr1="Test Expression 1";
+
+ Condition cond=new Condition(model);
+ cond.setExpression(expr1);
+
+ component.setCondition(cond);
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression not set");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression not same");
+ }
+
+ // Check position of condition
+ org.w3c.dom.NodeList nl=component.getDOMElement().getChildNodes();
+
+ if (nl.item(1).getLocalName().equals(Condition.CONDITION) == false) {
+ fail("Second child not is not condition: "+nl.item(1).getLocalName());
+ }
+ }
+
+ public void testSetActivityInsertBeforeElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Second element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElseIfPaths().size() != 0) {
+ fail("Should be no elseif paths");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Elseif elseif=new Elseif(model);
+ elseif.setActivity(seq);
+
+ component.addElseIfPath(elseif);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Elseif.ELSEIF) == false) {
+ fail("Third element was not an elseif: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+ public void testAddElseIfInsertBeforeElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElseIfPaths().size() != 0) {
+ fail("Should be no elseif paths");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Elseif elseif=new Elseif(model);
+ elseif.setActivity(seq);
+
+ component.addElseIfPath(elseif);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Elseif.ELSEIF) == false) {
+ fail("Third element was not an elseif: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+ public void testSetElseNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElsePath() != null) {
+ fail("Should be no else path");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Else elseElem=new Else(model);
+ elseElem.setActivity(seq);
+
+ component.setElsePath(elseElem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Else.ELSE) == false) {
+ fail("Third element was not an else: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+
+ public void testSetElseReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElsePath() == null) {
+ fail("Should have else path");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+ Else elseElem=new Else(model);
+ elseElem.setActivity(sub);
+
+ component.setElsePath(elseElem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Else.ELSE) == false) {
+ fail("Third element was not an else: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).getFirstChild() == null) {
+ fail("Third element has no child");
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).getFirstChild().
+ getLocalName().equals(If.IF) == false) {
+ fail("Third element child was not an if: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getFirstChild().getLocalName());
+ }
+ }
+
+ public void testGetURIIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence>"+
+ "<invoke/>"+
+ "</sequence>"+
+ "</elseif>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence>"+
+ "<reply/>"+
+ "</sequence>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence>"+
+ "<throw/>"+
+ "</sequence>"+
+ "</else>"+
+ "</if>"+
+ "</sequence>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Sequence) == false) {
+ fail("Top level activity is not Sequence");
+ }
+
+ Sequence seq=(Sequence)topact;
+
+ if (seq.getActivities().size() != 1) {
+ fail("Should have 1 activity: "+seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof If) == false) {
+ fail("Activty should be If");
+ }
+
+ If ifelem=(If)seq.getActivities().get(0);
+
+ if ((ifelem.getActivity() instanceof Sequence) == false) {
+ fail("Inner scope activity is not a sequence");
+ }
+
+ Sequence innerseq=(Sequence)ifelem.getActivity();
+
+ if (innerseq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ innerseq.getActivities().size());
+ }
+
+ if ((innerseq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)innerseq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activities.0/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+
+ public void testGetURIIfElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence>"+
+ "<invoke/>"+
+ "</sequence>"+
+ "</elseif>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence>"+
+ "<reply/>"+
+ "</sequence>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence>"+
+ "<throw/>"+
+ "</sequence>"+
+ "</else>"+
+ "</if>"+
+ "</sequence>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Sequence) == false) {
+ fail("Top level activity is not Sequence");
+ }
+
+ Sequence seq=(Sequence)topact;
+
+ if (seq.getActivities().size() != 1) {
+ fail("Should have 1 activity: "+seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof If) == false) {
+ fail("Activty should be If");
+ }
+
+ If ifelem=(If)seq.getActivities().get(0);
+
+ if (ifelem.getElseIfPaths().size() != 2) {
+ fail("Expecting 2 elseIf paths: "+ifelem.getElseIfPaths().size());
+ }
+
+ Elseif eif=ifelem.getElseIfPaths().get(1);
+
+ if ((eif.getActivity() instanceof Sequence) == false) {
+ fail("ElseIf activity not a sequence");
+ }
+
+ Sequence innerseq=(Sequence)eif.getActivity();
+
+ if (innerseq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ innerseq.getActivities().size());
+ }
+
+ if ((innerseq.getActivities().get(0) instanceof Reply) == false) {
+ fail("First activity should be Reply");
+ }
+
+ Reply reply=(Reply)innerseq.getActivities().get(0);
+
+ String uri=reply.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activities.0/@elseif.1/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+
+ public void testGetURIIfElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence>"+
+ "<invoke/>"+
+ "</sequence>"+
+ "</elseif>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence>"+
+ "<reply/>"+
+ "</sequence>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence>"+
+ "<throw/>"+
+ "</sequence>"+
+ "</else>"+
+ "</if>"+
+ "</sequence>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Sequence) == false) {
+ fail("Top level activity is not Sequence");
+ }
+
+ Sequence seq=(Sequence)topact;
+
+ if (seq.getActivities().size() != 1) {
+ fail("Should have 1 activity: "+seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof If) == false) {
+ fail("Activty should be If");
+ }
+
+ If ifelem=(If)seq.getActivities().get(0);
+
+ if (ifelem.getElsePath() == null) {
+ fail("Else not set");
+ }
+
+ Else els=ifelem.getElsePath();
+
+ if ((els.getActivity() instanceof Sequence) == false) {
+ fail("Else activity not a sequence");
+ }
+
+ Sequence innerseq=(Sequence)els.getActivity();
+
+ if (innerseq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ innerseq.getActivities().size());
+ }
+
+ if ((innerseq.getActivities().get(0) instanceof Throw) == false) {
+ fail("First activity should be Throw");
+ }
+
+ Throw thr=(Throw)innerseq.getActivities().get(0);
+
+ String uri=thr.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activities.0/@else/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/InvokeTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/InvokeTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/InvokeTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Invoke;
+
+import junit.framework.TestCase;
+
+public class InvokeTest extends TestCase {
+
+ public void testIsActivity() {
+ Invoke act=
+ new Invoke(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String iv="testIV";
+ String ov="testOV";
+
+ String xml="<invoke xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "inputVariable=\""+iv+"\" "+
+ "outputVariable=\""+ov+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Invoke component=new Invoke(model, elem);
+
+ if (component.getInputVariable().equals(iv) == false) {
+ fail("Input variable not correct, expecting '"+iv+"': "+
+ component.getInputVariable());
+ }
+
+ if (component.getOutputVariable().equals(ov) == false) {
+ fail("Output variable not correct, expecting '"+ov+"': "+
+ component.getOutputVariable());
+ }
+ }
+
+ public void testGetInputVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Invoke component=new Invoke(model);
+
+ if (component.getInputVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setInputVariable(var);
+
+ if (component.getInputVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getInputVariable());
+ }
+ }
+
+ public void testGetOutputVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Invoke component=new Invoke(model);
+
+ if (component.getOutputVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setOutputVariable(var);
+
+ if (component.getOutputVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getOutputVariable());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarmTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarmTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarmTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,913 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.For;
+import org.jboss.savara.tools.bpel.model.component.OnAlarm;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+import org.jboss.savara.tools.bpel.model.component.Until;
+
+import junit.framework.TestCase;
+
+public class OnAlarmTest extends TestCase {
+
+ public void testIsActivity() {
+ OnAlarm act=new OnAlarm(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildOnAlarmUntil() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<onAlarm xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<until>"+expr1+"</until>"+
+ "<scope/></onAlarm>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnAlarm component=new OnAlarm(model, elem);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should is set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+ }
+
+ public void testBuildOnAlarmFor() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<onAlarm xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<for>"+expr1+"</for>"+
+ "<scope/>"+
+ "</onAlarm>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnAlarm component=new OnAlarm(model, elem);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("For condition should is set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+ }
+
+ public void testSetUntilNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</until>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Until condition=new Until(model, elem);
+
+ OnAlarm component=new OnAlarm(model);
+
+ component.setUntil(condition);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetUntilReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</until>";
+
+ String xml2="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</until>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Until condition1=new Until(model, elem1);
+
+ OnAlarm component=new OnAlarm(model);
+
+ component.setUntil(condition1);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Until condition2=new Until(model, elem2);
+
+ component.setUntil(condition2);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should still not be set");
+ }
+
+ result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetForNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</for>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ For condition=new For(model, elem);
+
+ OnAlarm component=new OnAlarm(model);
+
+ component.setFor(condition);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetForReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</for>";
+
+ String xml2="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</for>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ For condition1=new For(model, elem1);
+
+ OnAlarm component=new OnAlarm(model);
+
+ component.setFor(condition1);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ For condition2=new For(model, elem2);
+
+ component.setFor(condition2);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should still not be set");
+ }
+
+ result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetForThenUntil() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</for>";
+
+ String xml2="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</until>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ For condition1=new For(model, elem1);
+
+ OnAlarm component=new OnAlarm(model);
+
+ component.setFor(condition1);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Until condition2=new Until(model, elem2);
+
+ component.setUntil(condition2);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should still not be set");
+ }
+
+ result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetUntilThenFor() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</until>";
+
+ String xml2="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</for>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Until condition1=new Until(model, elem1);
+
+ OnAlarm component=new OnAlarm(model);
+
+ component.setUntil(condition1);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ For condition2=new For(model, elem2);
+
+ component.setFor(condition2);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should still not be set");
+ }
+
+ result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testAddActivityOnAlarmUntil() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<onAlarm xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<until>"+expr1+"</until>"+
+ "</onAlarm>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnAlarm component=new OnAlarm(model, elem);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should is set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Scope sub=new Scope(model);
+ component.setActivity(sub);
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Scope.SCOPE) == false) {
+ fail("Second element was not a scope: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddActivityOnAlarmFor() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<onAlarm xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<for>"+expr1+"</for>"+
+ "</onAlarm>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnAlarm component=new OnAlarm(model, elem);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should is set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Scope sub=new Scope(model);
+ component.setActivity(sub);
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Scope.SCOPE) == false) {
+ fail("Second element was not a Scope: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddForOnAlarm() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<onAlarm xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<scope/>"+
+ "</onAlarm>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnAlarm component=new OnAlarm(model, elem);
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+
+ For cond=new For(model);
+ cond.setExpression(expr1);
+
+ component.setFor(cond);
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(For.FOR) == false) {
+ fail("First element was not a 'for': "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Scope.SCOPE) == false) {
+ fail("Second element was not a Scope: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddUntilOnAlarm() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<onAlarm xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<scope/>"+
+ "</onAlarm>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnAlarm component=new OnAlarm(model, elem);
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+
+ Until cond=new Until(model);
+ cond.setExpression(expr1);
+
+ component.setUntil(cond);
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(Until.UNTIL) == false) {
+ fail("First element was not a 'until': "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Scope.SCOPE) == false) {
+ fail("Second element was not a Scope: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnEventTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnEventTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnEventTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.OnEvent;
+
+import junit.framework.TestCase;
+
+public class OnEventTest extends TestCase {
+
+ public void testIsActivity() {
+ OnEvent act=new OnEvent(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildEHOnEvent() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String op="testOp";
+ String portType="testPortType";
+ String partnerLink="testPartnerLink";
+
+ String xml="<onEvent xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" " +
+ "operation=\""+op+"\" "+
+ "partnerLink=\""+partnerLink+"\" "+
+ "portType=\""+portType+"\" "+
+ "variable=\""+var+"\" "+
+ " >"+
+ "<scope/></onEvent>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnEvent component=new OnEvent(model, elem);
+
+ if (component.getScope() == null) {
+ fail("No scope");
+ }
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+
+ if (component.getPartnerLink().equals(partnerLink) == false) {
+ fail("PartnerLink not correct, expecting '"+partnerLink+"': "+
+ component.getPartnerLink());
+ }
+
+ if (component.getPortType().equals(portType) == false) {
+ fail("Port type not correct, expecting '"+portType+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ OnEvent component=new OnEvent(model);
+
+ if (component.getVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setVariable(var);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+ }
+
+ public void testGetOperation() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String op="testOp";
+
+ OnEvent component=new OnEvent(model);
+
+ if (component.getOperation() != null) {
+ fail("Should be null");
+ }
+
+ component.setOperation(op);
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+ }
+
+ public void testGetPortType() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pt="testPortType";
+
+ OnEvent component=new OnEvent(model);
+
+ if (component.getPortType() != null) {
+ fail("Should be null");
+ }
+
+ component.setPortType(pt);
+
+ if (component.getPortType().equals(pt) == false) {
+ fail("Port type not correct, expecting '"+pt+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pl="testPartnerLink";
+
+ OnEvent component=new OnEvent(model);
+
+ if (component.getPartnerLink() != null) {
+ fail("Should be null");
+ }
+
+ component.setPartnerLink(pl);
+
+ if (component.getPartnerLink().equals(pl) == false) {
+ fail("Partner link not correct, expecting '"+pl+"': "+
+ component.getPartnerLink());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnMessageTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnMessageTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/OnMessageTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.OnMessage;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class OnMessageTest extends TestCase {
+
+ public void testIsActivity() {
+ OnMessage act=new OnMessage(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildOnMessage() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String op="testOp";
+ String portType="testPortType";
+ String partnerLink="testPartnerLink";
+
+ String xml="<onMessage xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" " +
+ "operation=\""+op+"\" "+
+ "partnerLink=\""+partnerLink+"\" "+
+ "portType=\""+portType+"\" "+
+ "variable=\""+var+"\" "+
+ " >"+
+ "<sequence/></onMessage>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ OnMessage component=new OnMessage(model, elem);
+
+ if (component.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+
+ if (component.getPartnerLink().equals(partnerLink) == false) {
+ fail("PartnerLink not correct, expecting '"+partnerLink+"': "+
+ component.getPartnerLink());
+ }
+
+ if (component.getPortType().equals(portType) == false) {
+ fail("Port type not correct, expecting '"+portType+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ OnMessage component=new OnMessage(model);
+
+ if (component.getVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setVariable(var);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+ }
+
+ public void testGetOperation() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String op="testOp";
+
+ OnMessage component=new OnMessage(model);
+
+ if (component.getOperation() != null) {
+ fail("Should be null");
+ }
+
+ component.setOperation(op);
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+ }
+
+ public void testGetPortType() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pt="testPortType";
+
+ OnMessage component=new OnMessage(model);
+
+ if (component.getPortType() != null) {
+ fail("Should be null");
+ }
+
+ component.setPortType(pt);
+
+ if (component.getPortType().equals(pt) == false) {
+ fail("Port type not correct, expecting '"+pt+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pl="testPartnerLink";
+
+ OnMessage component=new OnMessage(model);
+
+ if (component.getPartnerLink() != null) {
+ fail("Should be null");
+ }
+
+ component.setPartnerLink(pl);
+
+ if (component.getPartnerLink().equals(pl) == false) {
+ fail("Partner link not correct, expecting '"+pl+"': "+
+ component.getPartnerLink());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLinkTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLinkTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLinkTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,170 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.PartnerLink;
+
+import junit.framework.TestCase;
+
+public class PartnerLinkTest extends TestCase {
+
+ public void testIsActivity() {
+ PartnerLink act=new PartnerLink(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String partnerRole="testPartnerRole";
+ String name="testName";
+ String myRole="testMyRole";
+ String partnerLinkType="testPartnerLinkType";
+
+ String xml="<partnerLink xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" " +
+ "name=\""+name+"\" "+
+ "partnerLinkType=\""+partnerLinkType+"\" "+
+ "myRole=\""+myRole+"\" "+
+ "partnerRole=\""+partnerRole+"\" "+
+ " />";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ PartnerLink component=new PartnerLink(model, elem);
+
+ if (component.getPartnerRole().equals(partnerRole) == false) {
+ fail("PartnerRole not correct, expecting '"+partnerRole+"': "+
+ component.getPartnerRole());
+ }
+
+ if (component.getName().equals(name) == false) {
+ fail("Name not correct, expecting '"+name+"': "+
+ component.getName());
+ }
+
+ if (component.getPartnerLinkType().equals(partnerLinkType) == false) {
+ fail("PartnerLinkType not correct, expecting '"+partnerLinkType+"': "+
+ component.getPartnerLinkType());
+ }
+
+ if (component.getMyRole().equals(myRole) == false) {
+ fail("MyRole not correct, expecting '"+myRole+"': "+
+ component.getMyRole());
+ }
+ }
+
+ public void testGetName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String name="testName";
+
+ PartnerLink component=new PartnerLink(model);
+
+ if (component.getName() != null) {
+ fail("Name should be null");
+ }
+
+ component.setName(name);
+
+ if (component.getName().equals(name) == false) {
+ fail("Name not correct, expecting '"+name+"': "+
+ component.getName());
+ }
+ }
+
+ public void testGetPartnerLinkType() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String plt="testPartnerLinkType";
+
+ PartnerLink component=new PartnerLink(model);
+
+ if (component.getPartnerLinkType() != null) {
+ fail("Partner link type should be null");
+ }
+
+ component.setPartnerLinkType(plt);
+
+ if (component.getPartnerLinkType().equals(plt) == false) {
+ fail("PartnerLinkType not correct, expecting '"+plt+"': "+
+ component.getPartnerLinkType());
+ }
+ }
+
+ public void testGetMyRole() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String mr="testMyRole";
+
+ PartnerLink component=new PartnerLink(model);
+
+ if (component.getMyRole() != null) {
+ fail("My role is not null");
+ }
+
+ component.setMyRole(mr);
+
+ if (component.getMyRole().equals(mr) == false) {
+ fail("MyRole not correct, expecting '"+mr+"': "+
+ component.getMyRole());
+ }
+ }
+
+ public void testGetPartnerRole() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pr="testPartnerRole";
+
+ PartnerLink component=new PartnerLink(model);
+
+ if (component.getPartnerRole() != null) {
+ fail("Partner role should be null");
+ }
+
+ component.setPartnerRole(pr);
+
+ if (component.getPartnerRole().equals(pr) == false) {
+ fail("PartnerRole not correct, expecting '"+pr+"': "+
+ component.getPartnerRole());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PickTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PickTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/PickTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,417 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.OnAlarm;
+import org.jboss.savara.tools.bpel.model.component.OnMessage;
+import org.jboss.savara.tools.bpel.model.component.Pick;
+
+import junit.framework.TestCase;
+
+public class PickTest extends TestCase {
+
+ public void testIsActivity() {
+ Pick act=new Pick(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testPickFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<pick xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<onMessage/>"+
+ "<onMessage/>"+
+ "<onAlarm/>"+
+ "</pick>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Pick component=new Pick(model, elem);
+
+ if (component.getOnMessages().size() != 2) {
+ fail("Expecting 2 onMessage: "+
+ component.getOnMessages().size());
+ }
+
+ if (component.getOnAlarms().size() != 1) {
+ fail("Expecting 1 onAlarm: "+
+ component.getOnAlarms().size());
+ }
+ }
+
+ public void testAddOnMessageToPickInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<pick xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<onAlarm/>"+
+ "<onAlarm/>"+
+ "</pick>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Pick component=new Pick(model, elem);
+
+ if (component.getOnAlarms().size() != 2) {
+ fail("Expecting 2 onAlarms: "+
+ component.getOnAlarms().size());
+ }
+
+ if (component.getOnMessages().size() != 0) {
+ fail("Expecting 0 onMessages: "+
+ component.getOnMessages().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ OnMessage sub=new OnMessage(model);
+
+ component.addOnMessage(sub, 0);
+
+ if (component.getOnMessages().size() != 1) {
+ fail("Expecting 1 onMessage: "+
+ component.getOnMessages().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(OnMessage.ONMESSAGE) == false) {
+ fail("Second element was not a 'onMessage': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+
+ public void testAddOnAlarmToPickInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<pick xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<onMessage/>"+
+ "<onMessage/>"+
+ "</pick>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Pick component=new Pick(model, elem);
+
+ if (component.getOnMessages().size() != 2) {
+ fail("Expecting 2 onMessages: "+
+ component.getOnMessages().size());
+ }
+
+ if (component.getOnAlarms().size() != 0) {
+ fail("Expecting 0 onAlarms: "+
+ component.getOnAlarms().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ OnAlarm sub=new OnAlarm(model);
+
+ component.addOnAlarm(sub, 0);
+
+ if (component.getOnAlarms().size() != 1) {
+ fail("Expecting 1 onAlarm: "+
+ component.getOnAlarms().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(3).
+ getLocalName().equals(OnAlarm.ONALARM) == false) {
+ fail("Second element was not a 'onAlarm': "+
+ component.getDOMElement().getChildNodes().item(3).
+ getLocalName());
+ }
+ }
+
+ public void testGetURIOnAlarm() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<pick>"+
+ "<onAlarm>"+
+ "<scope>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</scope>"+
+ "</onAlarm>"+
+ "</pick>"+
+ "</sequence>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Sequence) == false) {
+ fail("Top level activity is not Sequence");
+ }
+
+ Sequence topseq=(Sequence)topact;
+
+ if (topseq.getActivities().size() != 1) {
+ fail("Top sequence should have 1 activity");
+ }
+
+ if ((topseq.getActivities().get(0) instanceof Pick) == false) {
+ fail("Activity is not Pick");
+ }
+
+ Pick pick=(Pick)topseq.getActivities().get(0);
+
+ OnAlarm one=pick.getOnAlarms().get(0);
+
+ if ((one.getActivity() instanceof Scope) == false) {
+ fail("Activity is not scope");
+ }
+
+ Scope innerScope=(Scope)one.getActivity();
+
+ if (innerScope == null) {
+ fail("Inner scope not set");
+ }
+
+ if ((innerScope.getActivity() instanceof Sequence) == false) {
+ fail("Inner scope activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)innerScope.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activities.0/@onAlarm.0/@scope/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+
+ public void testGetURIOnMessage() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<pick>"+
+ "<onMessage>"+
+ "<scope>"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</scope>"+
+ "</onMessage>"+
+ "</pick>"+
+ "</sequence>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof Sequence) == false) {
+ fail("Top level activity is not Sequence");
+ }
+
+ Sequence topseq=(Sequence)topact;
+
+ if (topseq.getActivities().size() != 1) {
+ fail("Top sequence should have 1 activity");
+ }
+
+ if ((topseq.getActivities().get(0) instanceof Pick) == false) {
+ fail("Activity is not Pick");
+ }
+
+ Pick pick=(Pick)topseq.getActivities().get(0);
+
+ OnMessage one=pick.getOnMessages().get(0);
+
+ if ((one.getActivity() instanceof Scope) == false) {
+ fail("Activity is not scope");
+ }
+
+ Scope innerScope=(Scope)one.getActivity();
+
+ if (innerScope == null) {
+ fail("Inner scope not set");
+ }
+
+ if ((innerScope.getActivity() instanceof Sequence) == false) {
+ fail("Inner scope activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)innerScope.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Expecting 1 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activities.0/@onMessage.0/@activity/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ProcessTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ProcessTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ProcessTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,440 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.EventHandlers;
+import org.jboss.savara.tools.bpel.model.component.FaultHandlers;
+import org.jboss.savara.tools.bpel.model.component.PartnerLink;
+import org.jboss.savara.tools.bpel.model.component.Process;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+import org.jboss.savara.tools.bpel.model.component.Variable;
+
+import junit.framework.TestCase;
+
+public class ProcessTest extends TestCase {
+
+ public void testIsActivity() {
+ Process act=new Process(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testProcessFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<messageExchanges/>"+
+ "<variables><variable/></variables>"+
+ "<correlationSets/>"+
+ "<faultHandlers/>"+
+ "<eventHandlers/>"+
+ "<sequence/>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ if (component.getPartnerLinks().size() != 1) {
+ fail("Expecting 1 partner link: "+component.getPartnerLinks().size());
+ }
+
+ if (component.getVariables().size() != 1) {
+ fail("Expecting 1 variable: "+component.getVariables().size());
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not defined");
+ }
+
+ if (component.getEventHandlers() == null) {
+ fail("Event handlers not defined");
+ }
+
+ if (component.getFaultHandlers() == null) {
+ fail("Fault handlers not defined");
+ }
+ }
+
+ public void testAddVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<faultHandlers/>"+
+ "<eventHandlers/>"+
+ "<sequence/>"+
+ "</process>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, ifelem);
+
+ if (component.getVariables().size() != 0) {
+ fail("Should be no variables");
+ }
+
+ Variable var=new Variable(model);
+ component.addVariable(var, 0);
+
+ if (component.getVariables().size() != 1) {
+ fail("Should be one variable: "+component.getVariables().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(2).getLocalName().equals("variables") == false) {
+ fail("Child 2 not as expected: "+component.getDOMElement().getChildNodes().
+ item(2).getLocalName());
+ }
+ }
+
+ public void testAddPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<messageExchanges/>"+
+ "<variables><variable/></variables>"+
+ "<correlationSets/>"+
+ "<faultHandlers/>"+
+ "<eventHandlers/>"+
+ "<sequence/>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ if (component.getPartnerLinks().size() != 0) {
+ fail("Should be no partner links");
+ }
+
+ PartnerLink pl=new PartnerLink(model);
+ component.addPartnerLink(pl, 0);
+
+ if (component.getPartnerLinks().size() != 1) {
+ fail("Should be one partner link: "+component.getPartnerLinks().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(0).getLocalName().equals("partnerLinks") == false) {
+ fail("Child 0 not as expected: "+component.getDOMElement().getChildNodes().
+ item(0).getLocalName());
+ }
+ }
+
+ public void testGetPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Process component=new Process(model);
+ String name="testName";
+
+ PartnerLink pl=new PartnerLink(model);
+ pl.setName(name);
+
+ component.addPartnerLink(pl, 0);
+
+ if (component.getPartnerLink(name) == null) {
+ fail("Failed to get partner link for '"+name+"'");
+ }
+
+ if (component.getPartnerLink("unknown") != null) {
+ fail("Should not have returned a partner link");
+ }
+ }
+
+ public void testSetEventHandlers() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<messageExchanges/>"+
+ "<variables><variable/></variables>"+
+ "<correlationSets/>"+
+ "<faultHandlers/>"+
+ "<sequence/>"+
+ "</process>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, ifelem);
+
+ if (component.getEventHandlers() != null) {
+ fail("Should be null");
+ }
+
+ EventHandlers elem=new EventHandlers(model);
+ component.setEventHandlers(elem);
+
+ if (component.getEventHandlers() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(5).getLocalName().equals("eventHandlers") == false) {
+ fail("Child 5 not as expected: "+component.getDOMElement().getChildNodes().
+ item(5).getLocalName());
+ }
+ }
+
+ public void testSetFaultHandlers() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<messageExchanges/>"+
+ "<variables><variable/></variables>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<sequence/>"+
+ "</process>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, ifelem);
+
+ if (component.getFaultHandlers() != null) {
+ fail("Should be null");
+ }
+
+ FaultHandlers elem=new FaultHandlers(model);
+ component.setFaultHandlers(elem);
+
+ if (component.getFaultHandlers() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(4).getLocalName().equals("faultHandlers") == false) {
+ fail("Child 4 not as expected: "+component.getDOMElement().getChildNodes().
+ item(4).getLocalName());
+ }
+ }
+
+ public void testSetActivity() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<messageExchanges/>"+
+ "<variables><variable/></variables>"+
+ "<correlationSets/>"+
+ "<faultHandlers/>"+
+ "<eventHandlers/>"+
+ "</process>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Should be null");
+ }
+
+ Sequence elem=new Sequence(model);
+ component.setActivity(elem);
+
+ if (component.getActivity() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(6).getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Child 6 not as expected: "+component.getDOMElement().getChildNodes().
+ item(6).getLocalName());
+ }
+ }
+
+ public void testAddDistinctNamespaces() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Process component=new Process(model);
+
+ String prefix1=component.addNamespace("namespace1");
+ String prefix2=component.addNamespace("namespace2");
+
+ if (prefix1 == null) {
+ fail("First prefix is null");
+ }
+
+ if (prefix2 == null) {
+ fail("Second prefix is null");
+ }
+
+ if (prefix1.equals(prefix2)) {
+ fail("Prefixes should be different: "+prefix1+" "+prefix2);
+ }
+ }
+
+ public void testAddSameNamespaces() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Process component=new Process(model);
+
+ String prefix1=component.addNamespace("namespace1");
+ String prefix2=component.addNamespace("namespace1");
+
+ if (prefix1 == null) {
+ fail("First prefix is null");
+ }
+
+ if (prefix2 == null) {
+ fail("Second prefix is null");
+ }
+
+ if (prefix1.equals(prefix2) == false) {
+ fail("Prefixes should be same: "+prefix1+" "+prefix2);
+ }
+ }
+
+ public void testDefaultNamesapces() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Process component=new Process(model);
+
+ String ns=component.getNamespace(Process.BPEL_PREFIX);
+
+ if (ns == null) {
+ fail("Namespace not found");
+ }
+
+ if (ns.equals(Process.BPEL_NS) == false) {
+ fail("Namespace is wrong: "+ns+" was expecting "+Process.BPEL_NS);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReceiveTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReceiveTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReceiveTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,200 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Receive;
+
+import junit.framework.TestCase;
+
+public class ReceiveTest extends TestCase {
+
+ public void testIsActivity() {
+ Receive act=
+ new Receive(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String create="yes";
+
+ String xml="<receive xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "variable=\""+var+"\" "+
+ "createInstance=\""+create+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Receive component=new Receive(model, elem);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+
+ if (component.getCreateInstance() == false) {
+ fail("createInstance not correct, expecting 'true': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testGetVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Receive component=new Receive(model);
+
+ if (component.getVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setVariable(var);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+ }
+
+ public void testCreateInstanceFromDOMTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="yes";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "createInstance=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Receive component=new Receive(model, elem);
+
+ if (component.getCreateInstance() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testCreateInstanceFromDOMFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="no";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "createInstance=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Receive component=new Receive(model, elem);
+
+ if (component.getCreateInstance() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testGetCreateInstanceTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Receive component=new Receive(model);
+
+ component.setCreateInstance(true);
+
+ if (component.getCreateInstance() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testGetCreateInstanceFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Receive component=new Receive(model);
+
+ component.setCreateInstance(false);
+
+ if (component.getCreateInstance() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getCreateInstance());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntilTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntilTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntilTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,477 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Condition;
+import org.jboss.savara.tools.bpel.model.component.If;
+import org.jboss.savara.tools.bpel.model.component.RepeatUntil;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class RepeatUntilTest extends TestCase {
+
+ public void testIsActivity() {
+ RepeatUntil act=new RepeatUntil(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence/>"+
+ "<condition>"+expr1+"</condition>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+ }
+
+ public void testSetActivityInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<condition>"+expr1+"</condition>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+
+ component.setActivity(sub);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(If.IF) == false) {
+ fail("Second element was not an 'if': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testSetConditionNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ RepeatUntil component=new RepeatUntil(model);
+
+ component.setCondition(condition);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetConditionReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ String xml2="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</condition>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ RepeatUntil component=new RepeatUntil(model);
+
+ component.setCondition(condition1);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setCondition(condition2);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetActivityNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("One child element expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("First element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+ }
+
+ public void testSetActivityReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence/>"+
+ "<condition/>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, ifelem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+
+ component.setActivity(sub);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(If.IF) == false) {
+ fail("First element was not an 'if': "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+ }
+
+ public void testGetURI() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</repeatUntil>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof RepeatUntil) == false) {
+ fail("Top level activity is not RepeatUntil");
+ }
+
+ RepeatUntil top=(RepeatUntil)topact;
+
+ if (top.getActivity() == null) {
+ fail("While activity is null");
+ }
+
+ if ((top.getActivity() instanceof Sequence) == false) {
+ fail("While activity is not sequence");
+ }
+
+ Sequence seq=(Sequence)top.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Should have 1 activity: "+seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("Activty should be Receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReplyTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReplyTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ReplyTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Reply;
+
+import junit.framework.TestCase;
+
+public class ReplyTest extends TestCase {
+
+ public void testIsActivity() {
+ Reply act=
+ new Reply(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String fault="testFault";
+
+ String xml="<reply xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "variable=\""+var+"\" "+
+ "faultName=\""+fault+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Reply component=new Reply(model, elem);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+
+ public void testGetVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Reply component=new Reply(model);
+
+ if (component.getVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setVariable(var);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+ }
+
+ public void testGetFaultName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String fault="testFault";
+
+ Reply component=new Reply(model);
+
+ if (component.getFaultName() != null) {
+ fail("Should be null");
+ }
+
+ component.setFaultName(fault);
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault name not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RethrowTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RethrowTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/RethrowTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Rethrow;
+
+import junit.framework.TestCase;
+
+public class RethrowTest extends TestCase {
+
+ public void testIsActivity() {
+ Rethrow act=
+ new Rethrow(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ScopeTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ScopeTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ScopeTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,494 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.CompensationHandler;
+import org.jboss.savara.tools.bpel.model.component.EventHandlers;
+import org.jboss.savara.tools.bpel.model.component.FaultHandlers;
+import org.jboss.savara.tools.bpel.model.component.PartnerLink;
+import org.jboss.savara.tools.bpel.model.component.Scope;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+import org.jboss.savara.tools.bpel.model.component.TerminationHandler;
+import org.jboss.savara.tools.bpel.model.component.Variable;
+
+import junit.framework.TestCase;
+
+public class ScopeTest extends TestCase {
+
+ public void testIsActivity() {
+ Scope act=new Scope(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testScopeFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<faultHandlers/>"+
+ "<compensationHandler/>"+
+ "<terminationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, elem);
+
+ if (component.getPartnerLinks().size() != 1) {
+ fail("Expecting 1 partner link: "+component.getPartnerLinks().size());
+ }
+
+ if (component.getVariables().size() != 1) {
+ fail("Expecting 1 variable: "+component.getVariables().size());
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not defined");
+ }
+
+ if (component.getCompensationHandler() == null) {
+ fail("Compensation handler not defined");
+ }
+
+ if (component.getEventHandlers() == null) {
+ fail("Event handlers not defined");
+ }
+
+ if (component.getFaultHandlers() == null) {
+ fail("Fault handlers not defined");
+ }
+
+ if (component.getTerminationHandler() == null) {
+ fail("Termination handler not defined");
+ }
+ }
+
+ public void testAddVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<faultHandlers/>"+
+ "<compensationHandler/>"+
+ "<terminationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, ifelem);
+
+ if (component.getVariables().size() != 0) {
+ fail("Should be no variables");
+ }
+
+ Variable var=new Variable(model);
+ component.addVariable(var, 0);
+
+ if (component.getVariables().size() != 1) {
+ fail("Should be one variable: "+component.getVariables().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(0).getLocalName().equals("variables") == false) {
+ fail("Child 0 not as expected: "+component.getDOMElement().getChildNodes().
+ item(0).getLocalName());
+ }
+ }
+
+ public void testAddPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<faultHandlers/>"+
+ "<compensationHandler/>"+
+ "<terminationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, elem);
+
+ if (component.getPartnerLinks().size() != 0) {
+ fail("Should be no partner links");
+ }
+
+ PartnerLink pl=new PartnerLink(model);
+ component.addPartnerLink(pl, 0);
+
+ if (component.getPartnerLinks().size() != 1) {
+ fail("Should be one partner link: "+component.getPartnerLinks().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(1).getLocalName().equals("partnerLinks") == false) {
+ fail("Child 1 not as expected: "+component.getDOMElement().getChildNodes().
+ item(1).getLocalName());
+ }
+ }
+
+ public void testSetEventHandlers() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<faultHandlers/>"+
+ "<compensationHandler/>"+
+ "<terminationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, ifelem);
+
+ if (component.getEventHandlers() != null) {
+ fail("Should be null");
+ }
+
+ EventHandlers elem=new EventHandlers(model);
+ component.setEventHandlers(elem);
+
+ if (component.getEventHandlers() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(4).getLocalName().equals("eventHandlers") == false) {
+ fail("Child 4 not as expected: "+component.getDOMElement().getChildNodes().
+ item(4).getLocalName());
+ }
+ }
+
+ public void testSetFaultHandlers() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<compensationHandler/>"+
+ "<terminationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, ifelem);
+
+ if (component.getFaultHandlers() != null) {
+ fail("Should be null");
+ }
+
+ FaultHandlers elem=new FaultHandlers(model);
+ component.setFaultHandlers(elem);
+
+ if (component.getFaultHandlers() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(5).getLocalName().equals("faultHandlers") == false) {
+ fail("Child 5 not as expected: "+component.getDOMElement().getChildNodes().
+ item(5).getLocalName());
+ }
+ }
+
+ public void testSetCompensationHandler() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<faultHandlers/>"+
+ "<terminationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, ifelem);
+
+ if (component.getCompensationHandler() != null) {
+ fail("Should be null");
+ }
+
+ CompensationHandler elem=new CompensationHandler(model);
+ component.setCompensationHandler(elem);
+
+ if (component.getCompensationHandler() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(6).getLocalName().equals("compensationHandler") == false) {
+ fail("Child 6 not as expected: "+component.getDOMElement().getChildNodes().
+ item(6).getLocalName());
+ }
+ }
+
+ public void testSetTerminationHandler() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<faultHandlers/>"+
+ "<compensationHandler/>"+
+ "<sequence/>"+
+ "</scope>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, ifelem);
+
+ if (component.getTerminationHandler() != null) {
+ fail("Should be null");
+ }
+
+ TerminationHandler elem=new TerminationHandler(model);
+ component.setTerminationHandler(elem);
+
+ if (component.getTerminationHandler() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(7).getLocalName().equals("terminationHandler") == false) {
+ fail("Child 7 not as expected: "+component.getDOMElement().getChildNodes().
+ item(7).getLocalName());
+ }
+ }
+
+ public void testSetActivity() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<scope xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<partnerLinks><partnerLink/></partnerLinks>"+
+ "<variables><variable/></variables>"+
+ "<messageExchanges/>"+
+ "<correlationSets/>"+
+ "<eventHandlers/>"+
+ "<faultHandlers/>"+
+ "<compensationHandler/>"+
+ "<terminationHandler/>"+
+ "</scope>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Scope component=new Scope(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Should be null");
+ }
+
+ Sequence elem=new Sequence(model);
+ component.setActivity(elem);
+
+ if (component.getActivity() == null) {
+ fail("Should NOT be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().
+ item(8).getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Child 8 not as expected: "+component.getDOMElement().getChildNodes().
+ item(8).getLocalName());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/SequenceTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/SequenceTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/SequenceTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,333 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+import org.jboss.savara.tools.bpel.model.component.While;
+
+import junit.framework.TestCase;
+
+public class SequenceTest extends TestCase {
+
+ public void testIsActivity() {
+ Sequence act=new Sequence(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testSequenceFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<sequence xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<if/>"+
+ "<if/>"+
+ "</sequence>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Sequence component=new Sequence(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+ }
+
+ public void testAddFirstActToSequenceInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<sequence xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<if/>"+
+ "<if/>"+
+ "</sequence>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Sequence component=new Sequence(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ While sub=new While(model);
+
+ component.addActivity(sub, 0);
+
+ if (component.getActivities().size() != 3) {
+ fail("Expecting 3 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(While.WHILE) == false) {
+ fail("Second element was not a 'while': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddSecondActToSequenceInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<sequence xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<if/>"+
+ "<if/>"+
+ "</sequence>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Sequence component=new Sequence(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ While sub=new While(model);
+
+ component.addActivity(sub, 1);
+
+ if (component.getActivities().size() != 3) {
+ fail("Expecting 3 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(While.WHILE) == false) {
+ fail("Second element was not a 'while': "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+ public void testAddLastActToSequenceInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<sequence xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<if/>"+
+ "<if/>"+
+ "</sequence>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Sequence component=new Sequence(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ While sub=new While(model);
+
+ component.addActivity(sub, -1);
+
+ if (component.getActivities().size() != 3) {
+ fail("Expecting 3 child activities: "+
+ component.getActivities().size());
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(3).
+ getLocalName().equals(While.WHILE) == false) {
+ fail("Second element was not a 'while': "+
+ component.getDOMElement().getChildNodes().item(3).
+ getLocalName());
+ }
+ }
+
+ public void testGetURI() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<receive/>"+
+ "<invoke/>"+
+ "</sequence>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity act=component.getActivity();
+
+ if ((act instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+
+ Sequence seq=(Sequence)act;
+
+ if (seq.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("First activity should be receive");
+ }
+
+ if ((seq.getActivities().get(1) instanceof Invoke) == false) {
+ fail("Second activity should be invoke");
+ }
+
+ Invoke invoke=(Invoke)seq.getActivities().get(1);
+
+ String uri=invoke.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activities.1") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandlerTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandlerTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandlerTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+import org.jboss.savara.tools.bpel.model.component.TerminationHandler;
+
+import junit.framework.TestCase;
+
+public class TerminationHandlerTest extends TestCase {
+
+ public void testIsActivity() {
+ TerminationHandler act=
+ new TerminationHandler(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildTerminationHandler() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<terminationHandler xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<sequence/></terminationHandler>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TerminationHandler construct=new TerminationHandler(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestAbstractInteraction.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestAbstractInteraction.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestAbstractInteraction.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.AbstractInteraction;
+import org.jboss.savara.tools.bpel.model.component.ConversionContext;
+import org.scribble.model.Activity;
+import org.w3c.dom.Element;
+
+public class TestAbstractInteraction extends AbstractInteraction {
+
+ private static final long serialVersionUID = 8254837781661826397L;
+
+ public TestAbstractInteraction(BPELLanguageModel model, Element elem) {
+ super(model, elem);
+ }
+
+ public TestAbstractInteraction(BPELLanguageModel model) {
+ super(model, "test");
+ }
+
+ /**
+ * This method does the actual work of converting the specific
+ * BPEL activity into an equivalent behavioural description for
+ * conformance checking. The 'convert' method provides
+ * a wrapper around this method, to handle the standard elements
+ * that can be associated with any BPEL activity.
+ *
+ * @param activities The list of activities that will contain
+ * the converted action(s)
+ * @param context The conversion context
+ */
+ protected void convertActivity(java.util.List<Activity> activities,
+ ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELActivity.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELActivity.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELActivity.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.BPELActivity;
+import org.jboss.savara.tools.bpel.model.component.ConversionContext;
+import org.scribble.model.Activity;
+import org.w3c.dom.Element;
+
+public class TestBPELActivity extends BPELActivity {
+
+ private static final long serialVersionUID = 6706918585744310399L;
+
+ public TestBPELActivity(BPELLanguageModel model, Element elem) {
+ super(model, elem);
+ }
+
+ public TestBPELActivity(BPELLanguageModel model) {
+ super(model, "test");
+ }
+
+ /**
+ * This method does the actual work of converting the specific
+ * BPEL activity into an equivalent behavioural description for
+ * conformance checking. The 'convert' method provides
+ * a wrapper around this method, to handle the standard elements
+ * that can be associated with any BPEL activity.
+ *
+ * @param activities The list of activities that will contain
+ * the converted action(s)
+ * @param context The conversion context
+ */
+ protected void convertActivity(java.util.List<Activity> activities,
+ ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELElement.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELElement.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/TestBPELElement.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.BPELElement;
+import org.jboss.savara.tools.bpel.model.component.ConversionContext;
+import org.scribble.model.Activity;
+import org.w3c.dom.Element;
+
+public class TestBPELElement extends BPELElement {
+
+ private static final long serialVersionUID = 6428569513605691840L;
+
+ public TestBPELElement(BPELLanguageModel model, Element elem) {
+ super(model, elem);
+ }
+
+ public TestBPELElement(BPELLanguageModel model) {
+ super(model, "test");
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ThrowTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ThrowTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/ThrowTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Throw;
+
+import junit.framework.TestCase;
+
+public class ThrowTest extends TestCase {
+
+ public void testIsActivity() {
+ Throw act=
+ new Throw(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String fault="testFault";
+
+ String xml="<throw xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "faultVariable=\""+var+"\" "+
+ "faultName=\""+fault+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Throw component=new Throw(model, elem);
+
+ if (component.getFaultVariable().equals(var) == false) {
+ fail("Fault Variable not correct, expecting '"+var+"': "+
+ component.getFaultVariable());
+ }
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+
+ public void testGetFaultVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Throw component=new Throw(model);
+
+ if (component.getFaultVariable() != null) {
+ fail("Should be null");
+ }
+
+ component.setFaultVariable(var);
+
+ if (component.getFaultVariable().equals(var) == false) {
+ fail("Fault Variable not correct, expecting '"+var+"': "+
+ component.getFaultVariable());
+ }
+ }
+
+ public void testGetFaultName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String fault="testFault";
+
+ Throw component=new Throw(model);
+
+ if (component.getFaultName() != null) {
+ fail("Should be null");
+ }
+
+ component.setFaultName(fault);
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault name not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/VariableTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/VariableTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/VariableTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Variable;
+
+import junit.framework.TestCase;
+
+public class VariableTest extends TestCase {
+
+ public void testIsActivity() {
+ Variable act=
+ new Variable(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String type="testType";
+
+ String xml="<variable xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "name=\""+var+"\" "+
+ "type=\""+type+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Variable component=new Variable(model, elem);
+
+ if (component.getName().equals(var) == false) {
+ fail("Variable name not correct, expecting '"+var+"': "+
+ component.getName());
+ }
+
+ if (component.getType().equals(type) == false) {
+ fail("Type not correct, expecting '"+type+"': "+
+ component.getType());
+ }
+ }
+
+ public void testGetVariableName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Variable component=new Variable(model);
+
+ if (component.getName() != null) {
+ fail("Should be null");
+ }
+
+ component.setName(var);
+
+ if (component.getName().equals(var) == false) {
+ fail("Variable name not correct, expecting '"+var+"': "+
+ component.getName());
+ }
+ }
+
+ public void testGetType() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String type="testType";
+
+ Variable component=new Variable(model);
+
+ if (component.getType() != null) {
+ fail("Should be null");
+ }
+
+ component.setType(type);
+
+ if (component.getType().equals(type) == false) {
+ fail("Type not correct, expecting '"+type+"': "+
+ component.getType());
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WaitTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WaitTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WaitTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,621 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Condition;
+import org.jboss.savara.tools.bpel.model.component.Wait;
+
+import junit.framework.TestCase;
+
+public class WaitTest extends TestCase {
+
+ public void testIsActivity() {
+ Wait act=
+ new Wait(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testUntilFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<wait xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<until>"+expr1+"</until>"+
+ "</wait>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Wait component=new Wait(model, elem);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should is set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testForFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<wait xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<for>"+expr1+"</for>"+
+ "</wait>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Wait component=new Wait(model, elem);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("For condition should is set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetUntilNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</until>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ Wait component=new Wait(model);
+
+ component.setUntil(condition);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetUntilReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</until>";
+
+ String xml2="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</until>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ Wait component=new Wait(model);
+
+ component.setUntil(condition1);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setUntil(condition2);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should still not be set");
+ }
+
+ result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetForNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</for>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ Wait component=new Wait(model);
+
+ component.setFor(condition);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetForReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</for>";
+
+ String xml2="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</for>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ Wait component=new Wait(model);
+
+ component.setFor(condition1);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setFor(condition2);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should still not be set");
+ }
+
+ result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetForThenUntil() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</for>";
+
+ String xml2="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</until>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ Wait component=new Wait(model);
+
+ component.setFor(condition1);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should not be set");
+ }
+
+ String result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setUntil(condition2);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should still not be set");
+ }
+
+ result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetUntilThenFor() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<until xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</until>";
+
+ String xml2="<for xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</for>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ Wait component=new Wait(model);
+
+ component.setUntil(condition1);
+
+ if (component.getUntil() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getFor() != null) {
+ fail("For condition should not be set");
+ }
+
+ String result=component.getUntil().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setFor(condition2);
+
+ if (component.getFor() == null) {
+ fail("Condition not set");
+ }
+
+ if (component.getUntil() != null) {
+ fail("Until condition should still not be set");
+ }
+
+ result=component.getFor().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WhileTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WhileTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component/WhileTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,475 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.component;
+
+import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.tools.bpel.model.component.Condition;
+import org.jboss.savara.tools.bpel.model.component.If;
+import org.jboss.savara.tools.bpel.model.component.Sequence;
+import org.jboss.savara.tools.bpel.model.component.While;
+
+import junit.framework.TestCase;
+
+public class WhileTest extends TestCase {
+
+ public void testIsActivity() {
+ While act=new While(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "</while>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ While component=new While(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+ }
+
+ public void testSetConditionInitFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<targets/>"+
+ "<sequence/>"+
+ "</while>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ While component=new While(model, elem);
+
+ if (component.getActivity() == null) {
+ fail("Activity should be set");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Condition cond=new Condition(model);
+
+ cond.setExpression(expr1);
+
+ component.setCondition(cond);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Condition.CONDITION) == false) {
+ fail("Second element was not a 'condition': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testSetConditionNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ While component=new While(model);
+
+ component.setCondition(condition);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetConditionReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ String xml2="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</condition>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ While component=new While(model);
+
+ component.setCondition(condition1);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setCondition(condition2);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetActivityNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "</while>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ While component=new While(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("One child element expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Second element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testSetActivityReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</while>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ While component=new While(model, ifelem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+
+ component.setActivity(sub);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(If.IF) == false) {
+ fail("Second element was not an 'if': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testGetURI() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<process xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence>"+
+ "<receive/>"+
+ "</sequence>"+
+ "</while>"+
+ "</process>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Failed to convert to doc");
+ }
+
+ Process component=new Process(model, elem);
+
+ BPELActivity topact=component.getActivity();
+
+ if ((topact instanceof While) == false) {
+ fail("Top level activity is not While");
+ }
+
+ While top=(While)topact;
+
+ if (top.getActivity() == null) {
+ fail("While activity is null");
+ }
+
+ if ((top.getActivity() instanceof Sequence) == false) {
+ fail("While activity is not sequence");
+ }
+
+ Sequence seq=(Sequence)top.getActivity();
+
+ if (seq.getActivities().size() != 1) {
+ fail("Should have 1 activity: "+seq.getActivities().size());
+ }
+
+ if ((seq.getActivities().get(0) instanceof Receive) == false) {
+ fail("Activty should be Receive");
+ }
+
+ Receive recv=(Receive)seq.getActivities().get(0);
+
+ String uri=recv.getURI();
+
+ if (uri == null) {
+ fail("URI is null");
+ }
+
+ if (uri.equals("//@activity/@activity/@activities.0") == false) {
+ fail("URI is invalid: "+uri);
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/util/InteractionUtilTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/util/InteractionUtilTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/util/InteractionUtilTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.model.util;
+
+import junit.framework.TestCase;
+
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+
+public class InteractionUtilTest extends TestCase {
+
+ public void testIsFirstInteractionSingleInteraction() {
+ ConversationModel cm=new ConversationModel();
+ Conversation c=new Conversation();
+ cm.setConversation(c);
+
+ Interaction i1=new Interaction();
+
+ c.getBlock().getContents().add(i1);
+
+ if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i1) == false) {
+ fail("Interaction should be first in conversation");
+ }
+ }
+
+ public void testIsFirstInteractionSecondInteraction() {
+ ConversationModel cm=new ConversationModel();
+ Conversation c=new Conversation();
+ cm.setConversation(c);
+
+ Interaction i1=new Interaction();
+ Interaction i2=new Interaction();
+
+ c.getBlock().getContents().add(i1);
+ c.getBlock().getContents().add(i2);
+
+ if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i2)) {
+ fail("Interaction should NOT be first in conversation");
+ }
+ }
+
+ public void testIsFirstInteractionIfElse() {
+ ConversationModel cm=new ConversationModel();
+ Conversation c=new Conversation();
+ cm.setConversation(c);
+
+ If choice=new If();
+ c.getBlock().getContents().add(choice);
+
+ Block b=choice.createNewPath();
+
+ Interaction i1=new Interaction();
+
+ b.getContents().add(i1);
+
+ Block b2=choice.createNewPath();
+
+ Interaction i2=new Interaction();
+ Interaction i3=new Interaction();
+
+ b2.getContents().add(i2);
+ b2.getContents().add(i3);
+
+ if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i1) == false) {
+ fail("Interaction should be first in conversation");
+ }
+
+ if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i2) == false) {
+ fail("Interaction should be first in conversation");
+ }
+
+ if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i3)) {
+ fail("Interaction should NOT be first in conversation");
+ }
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/ParserTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/ParserTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/ParserTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,288 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.parser;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.jboss.savara.tools.bpel.model.BPELNotation;
+import org.scribble.conversation.model.ConversationModel;
+import org.scribble.lang.model.*;
+import org.scribble.conversation.model.ConversationNotation;
+import org.scribble.extensions.RegistryFactory;
+import org.scribble.model.ModelReference;
+import org.scribble.model.admin.Context;
+
+public class ParserTest extends TestCase {
+
+ public static TestSuite suite() {
+ TestSuite suite = new TestSuite("BPEL->Conversation Parser Tests");
+
+ suite.addTest(new BPELToConversationTest("ESBBrokerProcess_Broker", "ESBBroker at Broker"));
+ suite.addTest(new BPELToConversationTest("ESBBrokerProcess_Buyer", "ESBBroker at Buyer"));
+ suite.addTest(new BPELToConversationTest("ESBBrokerProcess_CreditAgency", "ESBBroker at CreditAgency"));
+ suite.addTest(new BPELToConversationTest("RequestForQuote_SupplierQuoteEngine", "ESBBroker at SupplierQuoteEngine"));
+ suite.addTest(new BPELToConversationTest("CompleteTransaction_SupplierTxnProcessor", "ESBBroker at SupplierTxnProcessor"));
+ suite.addTest(new BPELToConversationTest("PurchaseGoodsProcess_Buyer", "PurchaseGoods at Buyer"));
+ suite.addTest(new BPELToConversationTest("PurchaseGoodsProcess_CreditAgency", "PurchaseGoods at CreditAgency"));
+ suite.addTest(new BPELToConversationTest("PurchaseGoodsProcess_Store", "PurchaseGoods at Store"));
+ suite.addTest(new BPELToConversationTest("ReqRespFaultProcess_Buyer", "ReqRespFault at Buyer"));
+ suite.addTest(new BPELToConversationTest("ReqRespFaultProcess_Seller", "ReqRespFault at Seller"));
+
+ /**
+ * TODO: (SAVARA-150) Commenting out this test for now, as we now need the accompanying WSDL to be able to
+ * resolve the message type's underlying XSD element or type.
+ *
+ suite.addTest(new BPELToConversationTest("LoanApprovalService at Service", "LoanApprovalService at Service"));
+ */
+
+ return suite;
+ }
+
+ /**
+ * The test case for running the BPEL to Conversation test.
+ */
+ public static class BPELToConversationTest extends TestCase {
+
+ /**
+ * This constructor is initialized with the test
+ * name.
+ *
+ * @param name The test name
+ */
+ public BPELToConversationTest(String bpelName, String scvName) {
+ super(bpelName+"->"+scvName);
+ m_bpelName = bpelName;
+ m_scvName = scvName;
+ }
+
+ /**
+ * This method runs the test.
+ *
+ * @param result The test result
+ */
+ public void run(TestResult result) {
+ result.startTest(this);
+
+ String filename="testmodels/"+m_bpelName+".bpel";
+
+ java.io.InputStream is=
+ ParserTest.class.getResourceAsStream(filename);
+
+ if (is == null) {
+ result.addError(this,
+ new Throwable("Unable to locate resource: "+filename));
+ } else {
+ org.scribble.parser.Parser p=new org.scribble.parser.DefaultParser();
+ org.scribble.model.ModelReference ref=
+ new org.scribble.model.ModelReference(BPELNotation.NOTATION_CODE);
+ org.scribble.model.admin.DefaultModelListener l=
+ new org.scribble.model.admin.DefaultModelListener();
+
+ org.scribble.model.Model model=p.parse(ref, is, l, new ResourceLoaderContext());
+
+ if (model == null) {
+ result.addError(this, new Throwable("Model is null"));
+
+ } else if ((model instanceof LanguageModel) == false) {
+ result.addError(this, new Throwable("Model is null"));
+
+ } else if (l.getErrors().size() != 0) {
+ result.addError(this, new Throwable("Failed to parse CDM Model"));
+
+ for (int i=0; i < l.getErrors().size(); i++) {
+ System.err.println("ModelIssue: "+
+ l.getErrors().get(i).getMessage());
+ }
+ } else {
+ LanguageModel lm=(LanguageModel)model;
+ ConversationModel cm=new ConversationModel();
+
+ cm.setNamespace(lm.getNamespace());
+
+ if (lm.getConversations().size() == 1) {
+ cm.setConversation(lm.getConversations().get(0));
+ }
+
+ try {
+ org.scribble.export.Exporter exporter=
+ (org.scribble.export.Exporter)
+ RegistryFactory.getRegistry().getExtension(
+ org.scribble.export.Exporter.class, null);
+
+ org.scribble.export.text.TextFormatter formatter=
+ new org.scribble.export.text.TextFormatter();
+
+ java.io.ByteArrayOutputStream os=
+ new java.io.ByteArrayOutputStream();
+
+ formatter.setOutputStream(os);
+
+ exporter.export(new ModelReference(ConversationNotation.NOTATION_CODE),
+ cm, formatter);
+
+ String str=new String(os.toByteArray());
+
+ checkResults(result, str);
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ result.endTest(this);
+ }
+
+ /**
+ * This method checks the generated jboss-esb.xml against a
+ * previously stored correct version.
+ *
+ * @param result The test result
+ * @param conv The conversation
+ */
+ protected void checkResults(TestResult result, String conv) {
+ boolean f_valid=false;
+
+ String filename="results/"+m_scvName+".scv";
+
+ java.io.InputStream is=
+ ParserTest.class.getResourceAsStream(filename);
+
+ if (is != null) {
+
+ try {
+ byte[] b=new byte[is.available()];
+
+ is.read(b);
+
+ is.close();
+
+ String orig=new String(b);
+
+ if (orig.equals(conv) == false) {
+ result.addError(this,
+ new Throwable("Generated Conversation does not match stored version"));
+ } else {
+ f_valid = true;
+ }
+ } catch(Exception e) {
+ result.addError(this, e);
+ }
+ } else {
+ result.addError(this,
+ new Throwable("Resulting Conversation '"+filename+
+ "' not found for comparison"));
+ }
+
+ if (f_valid == false) {
+ String bpelfile="testmodels/"+m_bpelName+".bpel";
+
+ java.net.URL url=ParserTest.class.getResource(bpelfile);
+
+ try {
+ url = org.eclipse.core.runtime.FileLocator.toFileURL(url);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ if (url != null) {
+ // URL will point to copy of test models in the classes folder, so need
+ // to obtain reference back to source version
+ java.io.File f=null;
+
+ if (url.getFile().indexOf("classes") != -1) {
+ f = new java.io.File(url.getFile().replaceFirst("classes","src/plugintest"));
+ } else if (url.getFile().indexOf("bin") != -1) {
+ f = new java.io.File(url.getFile().replaceFirst("bin","src/plugintest"));
+ } else {
+ result.addError(this, new Exception("Could not locate results folder to record expected result"));
+ }
+
+ if (f != null && f.exists()) {
+ f = f.getParentFile().getParentFile();
+
+ java.io.File resultsDir=new java.io.File(f, "results");
+
+ if (resultsDir.exists() == false) {
+ resultsDir.mkdirs();
+ }
+
+ java.io.File resultFile=new java.io.File(resultsDir, m_scvName+".expected");
+
+ if (resultFile.exists() == false) {
+ try {
+ java.io.FileOutputStream fos=new java.io.FileOutputStream(resultFile);
+
+ fos.write(conv.getBytes());
+
+ fos.flush();
+ fos.close();
+
+ } catch(Exception e){
+ result.addError(this, e);
+ }
+ } else {
+ System.err.println("NOTE: Expected output '"+resultFile+
+ "' already exists - not being overwritten");
+ }
+ } else {
+ result.addError(this, new Throwable("Unable to obtain URL for BPEL model source '"+
+ m_bpelName+"': "+url));
+ }
+ }
+ }
+ }
+
+ private String m_bpelName=null;
+ private String m_scvName=null;
+ }
+
+ public static class ResourceLoaderContext implements Context {
+
+ public ResourceLoaderContext() {
+ }
+
+ public InputStream getResource(ModelReference ref, String uri) {
+ String filename="testmodels/"+uri;
+
+ java.io.InputStream is=
+ ParserTest.class.getResourceAsStream(filename);
+
+ return(is);
+ }
+
+ public java.net.URI getResourceURI(ModelReference ref, String uri) {
+ String filename="testmodels/"+uri;
+
+ java.net.URI ret=null;
+
+ try {
+ ret = ParserTest.class.getResource(filename).toURI();
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ return(ret);
+ }
+
+ }
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Broker.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Broker.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Broker.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,35 @@
+namespace null;
+
+conversation ESBBrokerProcess_Broker at Broker implements LoanBroker at Broker {
+ makeEnquiry(enquiry) from Buyer to Broker;
+ while {
+ getQuote(requestForQuote) from Broker to SupplierQuoteEngine;
+ getQuote(quote) from SupplierQuoteEngine to Broker;
+ }
+ ;
+ makeEnquiry(quoteList) from Broker to Buyer;
+ if {
+ buy(buy) from Buyer to Broker;
+ try {
+ checkCredit(CreditCheckRequest) from Broker to CreditAgency;
+ if {
+ checkCredit(CreditCheckOk) from CreditAgency to Broker;
+ } else if {
+ checkCredit(CreditCheckInvalid) from CreditAgency to Broker;
+ raise invalidCredit;
+ }
+ confirm(orderConfirmed) from Broker to SupplierTxnProcessor;
+ if {
+ confirm(bookingReference) from SupplierTxnProcessor to Broker;
+ } else if {
+ confirm(CreditCheckInvalid) from SupplierTxnProcessor to Broker;
+ raise invalidCredit;
+ }
+ buy(bookingReference) from Broker to Buyer;
+ } catch invalidCredit {
+ buy(orderRejected) from Broker to Buyer;
+ }
+ } else if {
+ cancel(cancel) from Buyer to Broker;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Buyer.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Buyer.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at Buyer.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,16 @@
+namespace null;
+
+conversation ESBBrokerProcess_Buyer at Buyer implements LoanBroker at Buyer {
+ makeEnquiry(enquiry) from Buyer to Broker;
+ makeEnquiry(quoteList) from Broker to Buyer;
+ if {
+ buy(buy) from Buyer to Broker;
+ if {
+ buy(bookingReference) from Broker to Buyer;
+ } else if {
+ buy(orderRejected) from Broker to Buyer;
+ }
+ } else if {
+ cancel(cancel) from Buyer to Broker;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at CreditAgency.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at CreditAgency.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at CreditAgency.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,12 @@
+namespace null;
+
+conversation ESBBrokerProcess_CreditAgency at CreditAgency implements Common at CreditAgency {
+ if {
+ checkCredit(CreditCheckRequest) from Broker to CreditAgency;
+ if {
+ checkCredit(CreditCheckOk) from CreditAgency to Broker;
+ } else if {
+ checkCredit(CreditCheckInvalid) from CreditAgency to Broker;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierQuoteEngine.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierQuoteEngine.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierQuoteEngine.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,6 @@
+namespace null;
+
+conversation RequestForQuote_SupplierQuoteEngine at SupplierQuoteEngine implements LoanBroker at SupplierQuoteEngine {
+ getQuote(requestForQuote) from Broker to SupplierQuoteEngine;
+ getQuote(quote) from SupplierQuoteEngine to Broker;
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierTxnProcessor.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierTxnProcessor.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ESBBroker at SupplierTxnProcessor.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,8 @@
+namespace null;
+
+conversation CompleteTransaction_SupplierTxnProcessor at SupplierTxnProcessor implements LoanBroker at SupplierTxnProcessor {
+ if {
+ confirm(orderConfirmed) from Broker to SupplierTxnProcessor;
+ confirm(bookingReference) from SupplierTxnProcessor to Broker;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/LoanApprovalService at Service.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/LoanApprovalService at Service.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/LoanApprovalService at Service.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,41 @@
+namespace null;
+
+conversation loanApprovalProcess {
+ try {
+ boolean receive-to-assess, receive-to-approval, approval-to-reply, assess-to-setMessage, setMessage-to-reply, assess-to-approval;
+ parallel {
+ request(creditInformationMessage) from customer;
+ receive-to-assess = xpath[true()];
+ receive-to-approval = xpath[true()];
+ } and {
+ when (xpath[$receive-to-assess]) {
+ check(creditInformationMessage) to assessor;
+ if {
+ check(riskAssessmentMessage) from assessor;
+ } else if {
+ check(errorMessage) from assessor;
+ raise lns:loanProcessFault;
+ }
+ assess-to-setMessage = xpath[true()];
+ assess-to-approval = xpath[true()];
+ }
+ } and {
+ when (xpath[$receive-to-approval and $assess-to-approval]) {
+ approve(creditInformationMessage) to approver;
+ if {
+ approve(approvalMessage) from approver;
+ } else if {
+ approve(errorMessage) from approver;
+ raise lns:loanProcessFault;
+ }
+ approval-to-reply = xpath[true()];
+ }
+ } and {
+ when (xpath[$setMessage-to-reply and $approval-to-reply]) {
+ request(approvalMessage) to customer;
+ }
+ }
+ } catch lns:loanProcessFault {
+ request(errorMessage) to customer;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Buyer.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Buyer.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Buyer.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,10 @@
+namespace null;
+
+conversation PurchaseGoodsProcess_Buyer at Buyer implements Purchasing at Buyer {
+ buy(BuyRequest) from Buyer to Store;
+ if {
+ buy(BuyConfirmed) from Store to Buyer;
+ } else if {
+ buy(BuyFailed) from Store to Buyer;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at CreditAgency.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at CreditAgency.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at CreditAgency.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,10 @@
+namespace null;
+
+conversation PurchaseGoodsProcess_CreditAgency at CreditAgency implements Common at CreditAgency {
+ checkCredit(CreditCheckRequest) from Store to CreditAgency;
+ if {
+ checkCredit(CreditCheckOk) from CreditAgency to Store;
+ } else if {
+ checkCredit(CreditCheckInvalid) from CreditAgency to Store;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Store.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Store.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/PurchaseGoods at Store.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,13 @@
+namespace null;
+
+conversation PurchaseGoodsProcess_Store at Store implements Purchasing at Store {
+ buy(BuyRequest) from Buyer to Store;
+ checkCredit(CreditCheckRequest) from Store to CreditAgency;
+ if {
+ checkCredit(CreditCheckOk) from CreditAgency to Store;
+ buy(BuyConfirmed) from Store to Buyer;
+ } else if {
+ checkCredit(CreditCheckInvalid) from CreditAgency to Store;
+ buy(BuyFailed) from Store to Buyer;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Buyer.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Buyer.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Buyer.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,10 @@
+namespace null;
+
+conversation ReqRespFaultProcess_Buyer at Buyer implements LoanBroker at Buyer {
+ checkCredit(CreditCheckRequest) from Buyer to Seller;
+ if {
+ checkCredit(CreditCheckOk) from Seller to Buyer;
+ } else if {
+ checkCredit(CreditCheckInvalid) from Seller to Buyer;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Seller.scv
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Seller.scv (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/results/ReqRespFault at Seller.scv 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,10 @@
+namespace null;
+
+conversation ReqRespFaultProcess_Seller at Seller implements ReqRespFaultProcess at Seller {
+ checkCredit(CreditCheckRequest) from Buyer to Seller;
+ if {
+ checkCredit(CreditCheckOk) from Seller to Buyer;
+ } else if {
+ checkCredit(CreditCheckInvalid) from Seller to Buyer;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,20 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at SupplierTxnProcessor" name="CompleteTransaction_SupplierTxnProcessor" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="CompleteTransaction_SupplierTxnProcessor.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="CompleteTransaction_SupplierTxnProcessorArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <partnerLinks>
+ <partnerLink myRole="SupplierTxnProcessorService" name="BrokerToSupplierTxnProcessor" partnerLinkType="spr:BrokerToSupplierTxnProcessorServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="spr:confirmRequest" name="confirmRequestVar"/>
+ <variable messageType="spr:confirmResponse" name="confirmResponseVar"/>
+ </variables>
+ <sequence>
+ <pick createInstance="yes">
+ <onMessage operation="confirm" partnerLink="BrokerToSupplierTxnProcessor" portType="spr:SupplierBehavior" variable="confirmRequestVar">
+ <sequence>
+ <reply name="Send_bookingReference" operation="confirm" partnerLink="BrokerToSupplierTxnProcessor" portType="spr:SupplierBehavior" variable="confirmResponseVar"/>
+ </sequence>
+ </onMessage>
+ </pick>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessor.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Supplier" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="confirmRequest">
+ <wsdl:part element="orderConfirmed" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="confirmResponse">
+ <wsdl:part element="bookingReference" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getQuoteResponse">
+ <wsdl:part element="quote" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getQuoteRequest">
+ <wsdl:part element="requestForQuote" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="SupplierBehavior">
+ <wsdl:operation name="confirm">
+ <wsdl:input message="spr:confirmRequest">
+ </wsdl:input>
+ <wsdl:output message="spr:confirmResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getQuote">
+ <wsdl:input message="spr:getQuoteRequest">
+ </wsdl:input>
+ <wsdl:output message="spr:getQuoteResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SupplierBehaviorBinding" type="spr:SupplierBehavior">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="confirm">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Supplier/confirm"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getQuote">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Supplier/getQuote"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SupplierService">
+ <wsdl:port binding="spr:SupplierBehaviorBinding" name="SupplierBehaviorPort">
+ <soap:address location="http://localhost:8080/SupplierService/SupplierBehaviorPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessorArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessorArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/CompleteTransaction_SupplierTxnProcessorArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier">
+ <wsdl:import location="CompleteTransaction_SupplierTxnProcessor.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <plnk:partnerLinkType name="BrokerToSupplierTxnProcessorServiceLT">
+ <plnk:role name="SupplierTxnProcessorService" portType="ns1:SupplierBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,66 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at Broker" name="ESBBrokerProcess_Broker" targetNamespace="http://www.pi4soa.org/ESBBroker/Broker" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_BrokerArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <partnerLinks>
+ <partnerLink myRole="BrokerBehavior" name="BuyerToBroker" partnerLinkType="brk:BuyerToBrokerServiceLT"/>
+ <partnerLink name="BrokerToSupplierQuoteEngine" partnerLinkType="brk:BrokerToSupplierQuoteEngineLT" partnerRole="SupplierQuoteEngineRequester"/>
+ <partnerLink name="BrokerToCreditAgency" partnerLinkType="brk:BrokerToCreditAgencyLT" partnerRole="CreditAgencyRequester"/>
+ <partnerLink name="BrokerToSupplierTxnProcessor" partnerLinkType="brk:BrokerToSupplierTxnProcessorLT" partnerRole="SupplierTxnProcessorRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="brk:makeEnquiryRequest" name="makeEnquiryRequestVar"/>
+ <variable messageType="spr:getQuoteRequest" name="getQuoteRequestVar"/>
+ <variable messageType="spr:getQuoteResponse" name="getQuoteResponseVar"/>
+ <variable messageType="brk:makeEnquiryResponse" name="makeEnquiryResponseVar"/>
+ <variable messageType="brk:buyRequest" name="buyRequestVar"/>
+ <variable messageType="cay:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="cay:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="spr:confirmRequest" name="confirmRequestVar"/>
+ <variable messageType="spr:confirmResponse" name="confirmResponseVar"/>
+ <variable messageType="brk:buyResponse" name="buyResponseVar"/>
+ <variable messageType="brk:rejectedFault" name="rejectedFaultVar"/>
+ <variable messageType="brk:cancelRequest" name="cancelRequestVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_enquiry" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="makeEnquiryRequestVar"/>
+ <while>
+ <sequence>
+ <scope>
+ <sequence>
+ <invoke inputVariable="getQuoteRequestVar" name="Send_requestForQuote" operation="getQuote" outputVariable="getQuoteResponseVar" partnerLink="BrokerToSupplierQuoteEngine" portType="spr:SupplierBehavior"/>
+ </sequence>
+ </scope>
+ </sequence>
+ </while>
+ <reply name="Send_quoteList" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="makeEnquiryResponseVar"/>
+ <pick>
+ <onMessage operation="buy" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="buyRequestVar">
+ <sequence>
+ <scope>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="cay:invalidCreditFault" faultName="cay:invalidCredit" faultVariable="invalidCreditFaultVar">
+ <sequence>
+ <reply faultName="brk:rejected" name="Send_orderRejected" operation="buy" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="rejectedFaultVar"/>
+ </sequence>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="checkCreditRequestVar" name="Send_CreditCheckRequest" operation="checkCredit" outputVariable="checkCreditResponseVar" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior"/>
+ <invoke inputVariable="confirmRequestVar" name="Send_orderConfirmed" operation="confirm" outputVariable="confirmResponseVar" partnerLink="BrokerToSupplierTxnProcessor" portType="spr:SupplierBehavior"/>
+ <reply name="Send_bookingReference" operation="buy" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="buyResponseVar"/>
+ </sequence>
+ </scope>
+ </sequence>
+ </scope>
+ </sequence>
+ </onMessage>
+ <onMessage operation="cancel" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="cancelRequestVar">
+ <sequence/>
+ </onMessage>
+ </pick>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Broker.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Broker" targetNamespace="http://www.pi4soa.org/ESBBroker/Broker">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="rejectedFault">
+ <wsdl:part element="orderRejected" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="makeEnquiryRequest">
+ <wsdl:part element="enquiry" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="buyResponse">
+ <wsdl:part element="bookingReference" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="makeEnquiryResponse">
+ <wsdl:part element="quoteList" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="buyRequest">
+ <wsdl:part element="buy" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="cancelRequest">
+ <wsdl:part element="cancel" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="BrokerBehavior">
+ <wsdl:operation name="buy">
+ <wsdl:input message="brk:buyRequest">
+ </wsdl:input>
+ <wsdl:output message="brk:buyResponse">
+ </wsdl:output>
+ <wsdl:fault message="brk:rejectedFault" name="rejected">
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="makeEnquiry">
+ <wsdl:input message="brk:makeEnquiryRequest">
+ </wsdl:input>
+ <wsdl:output message="brk:makeEnquiryResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="cancel">
+ <wsdl:input message="brk:cancelRequest">
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="BrokerBehaviorBinding" type="brk:BrokerBehavior">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="buy">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Broker/buy"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="rejected">
+ <soap:fault name="rejected" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="makeEnquiry">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Broker/makeEnquiry"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="cancel">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Broker/cancel"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="BrokerService">
+ <wsdl:port binding="brk:BrokerBehaviorBinding" name="BrokerBehaviorPort">
+ <soap:address location="http://localhost:8080/BrokerService/BrokerBehaviorPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BrokerArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BrokerArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BrokerArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ESBBroker/Broker" xmlns:ns2="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:ns3="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ESBBroker/Broker">
+ <wsdl:import location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <wsdl:import location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <wsdl:import location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <plnk:partnerLinkType name="BuyerToBrokerServiceLT">
+ <plnk:role name="BrokerBehavior" portType="ns1:BrokerBehavior"/>
+ </plnk:partnerLinkType>
+ <plnk:partnerLinkType name="BrokerToSupplierQuoteEngineLT">
+ <plnk:role name="SupplierQuoteEngineRequester" portType="ns2:SupplierBehavior"/>
+ </plnk:partnerLinkType>
+ <plnk:partnerLinkType name="BrokerToCreditAgencyLT">
+ <plnk:role name="CreditAgencyRequester" portType="ns3:CreditAgencyBehavior"/>
+ </plnk:partnerLinkType>
+ <plnk:partnerLinkType name="BrokerToSupplierTxnProcessorLT">
+ <plnk:role name="SupplierTxnProcessorRequester" portType="ns2:SupplierBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Buyer.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Buyer.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Buyer.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,43 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at Buyer" name="ESBBrokerProcess_Buyer" targetNamespace="http://www.pi4soa.org/ESBBroker/Buyer" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_BuyerArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Buyer"/>
+ <partnerLinks>
+ <partnerLink myRole="BrokerBehavior" name="BuyerToBroker" partnerLinkType="byr:BuyerToBrokerLT" partnerRole="BrokerRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="brk:makeEnquiryRequest" name="makeEnquiryRequestVar"/>
+ <variable messageType="brk:makeEnquiryResponse" name="makeEnquiryResponseVar"/>
+ <variable messageType="brk:buyRequest" name="buyRequestVar"/>
+ <variable messageType="brk:buyResponse" name="buyResponseVar"/>
+ <variable messageType="brk:cancelRequest" name="cancelRequestVar"/>
+ </variables>
+ <sequence>
+ <invoke inputVariable="makeEnquiryRequestVar" name="Send_enquiry" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior"/>
+ <receive name="Receive_quoteList" operation="makeEnquiry" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior" variable="makeEnquiryResponseVar"/>
+ <if>
+ <sequence>
+ <scope>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="brk:rejectedFault" faultName="brk:rejected" faultVariable="rejectedFaultVar">
+ <sequence/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="buyRequestVar" name="Send_buy" operation="buy" outputVariable="buyResponseVar" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior"/>
+ </sequence>
+ </scope>
+ </sequence>
+ </scope>
+ </sequence>
+ <else>
+ <sequence>
+ <invoke inputVariable="cancelRequestVar" name="Send_cancel" operation="cancel" partnerLink="BuyerToBroker" portType="brk:BrokerBehavior"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BuyerArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BuyerArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_BuyerArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ESBBroker/Broker" xmlns:ns2="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ESBBroker/Buyer">
+ <wsdl:import location="ESBBrokerProcess_Buyer.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Buyer"/>
+ <wsdl:import location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <wsdl:import location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <wsdl:import location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <plnk:partnerLinkType name="BuyerToBrokerLT">
+ <plnk:role name="BrokerRequester" portType="ns1:BrokerBehavior"/>
+ <plnk:role name="BrokerBehavior" portType="ns2:BuyerBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,36 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.Common at CreditAgency" name="ESBBrokerProcess_CreditAgency" targetNamespace="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ESBBrokerProcess_CreditAgencyArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <partnerLinks>
+ <partnerLink myRole="CreditAgencyService" name="BrokerToCreditAgency" partnerLinkType="cay:BrokerToCreditAgencyServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="cay:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="cay:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="cay:invalidCreditFault" name="invalidCreditFaultVar"/>
+ </variables>
+ <sequence>
+ <pick>
+ <onMessage operation="checkCredit" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior" variable="checkCreditRequestVar">
+ <sequence>
+ <scope>
+ <sequence>
+ <if>
+ <sequence>
+ <reply name="Send_CreditCheckOk" operation="checkCredit" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior" variable="checkCreditResponseVar"/>
+ </sequence>
+ <else>
+ <sequence>
+ <reply faultName="cay:invalidCredit" name="Send_CreditCheckInvalid" operation="checkCredit" partnerLink="BrokerToCreditAgency" portType="cay:CreditAgencyBehavior" variable="invalidCreditFaultVar"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+ </scope>
+ </sequence>
+ </onMessage>
+ </pick>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgency.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditAgency" targetNamespace="http://www.pi4soa.org/ESBBroker/CreditAgency">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="checkCreditResponse">
+ <wsdl:part element="CreditCheckOk" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="checkCreditRequest">
+ <wsdl:part element="CreditCheckRequest" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="invalidCreditFault">
+ <wsdl:part element="CreditCheckInvalid" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditAgencyBehavior">
+ <wsdl:operation name="checkCredit">
+ <wsdl:input message="cay:checkCreditRequest">
+ </wsdl:input>
+ <wsdl:output message="cay:checkCreditResponse">
+ </wsdl:output>
+ <wsdl:fault message="cay:invalidCreditFault" name="invalidCredit">
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditAgencyBehaviorBinding" type="cay:CreditAgencyBehavior">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="checkCredit">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/CreditAgency/checkCredit"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="invalidCredit">
+ <soap:fault name="invalidCredit" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditAgencyService">
+ <wsdl:port binding="cay:CreditAgencyBehaviorBinding" name="CreditAgencyBehaviorPort">
+ <soap:address location="http://localhost:8080/CreditAgencyService/CreditAgencyBehaviorPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgencyArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgencyArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_CreditAgencyArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ESBBroker/CreditAgency">
+ <wsdl:import location="ESBBrokerProcess_CreditAgency.wsdl" namespace="http://www.pi4soa.org/ESBBroker/CreditAgency"/>
+ <wsdl:import location="ESBBrokerProcess_Broker.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Broker"/>
+ <wsdl:import location="ESBBrokerProcess_Supplier.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <plnk:partnerLinkType name="BrokerToCreditAgencyServiceLT">
+ <plnk:role name="CreditAgencyService" portType="ns1:CreditAgencyBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Supplier.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Supplier.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ESBBrokerProcess_Supplier.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Supplier" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="confirmRequest">
+ <wsdl:part element="orderConfirmed" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="confirmResponse">
+ <wsdl:part element="bookingReference" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getQuoteResponse">
+ <wsdl:part element="quote" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getQuoteRequest">
+ <wsdl:part element="requestForQuote" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="SupplierBehavior">
+ <wsdl:operation name="confirm">
+ <wsdl:input message="spr:confirmRequest">
+ </wsdl:input>
+ <wsdl:output message="spr:confirmResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getQuote">
+ <wsdl:input message="spr:getQuoteRequest">
+ </wsdl:input>
+ <wsdl:output message="spr:getQuoteResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SupplierBehaviorBinding" type="spr:SupplierBehavior">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="confirm">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Supplier/confirm"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getQuote">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Supplier/getQuote"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SupplierService">
+ <wsdl:port binding="spr:SupplierBehaviorBinding" name="SupplierBehaviorPort">
+ <soap:address location="http://localhost:8080/SupplierService/SupplierBehaviorPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/LoanApprovalService at Service.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/LoanApprovalService at Service.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/LoanApprovalService at Service.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,123 @@
+<process name="loanApprovalProcess"
+ targetNamespace="http://example.com/loan-approval/"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:lns="http://example.com/loan-approval/wsdl/"
+ suppressJoinFailure="yes">
+ <import importType="http://schemas.xmlsoap.org/wsdl/"
+ location="loanServicePT.wsdl"
+ namespace="http://example.com/loan-approval/wsdl/" />
+ <partnerLinks>
+ <partnerLink name="customer"
+ partnerLinkType="lns:loanPartnerLT"
+ myRole="loanService" />
+ <partnerLink name="approver"
+ partnerLinkType="lns:loanApprovalLT"
+ partnerRole="approver" />
+ <partnerLink name="assessor"
+ partnerLinkType="lns:riskAssessmentLT"
+ partnerRole="assessor" />
+ </partnerLinks>
+ <variables>
+ <variable name="request"
+ messageType="lns:creditInformationMessage" />
+ <variable name="risk"
+ messageType="lns:riskAssessmentMessage" />
+ <variable name="approval"
+ messageType="lns:approvalMessage" />
+ </variables>
+ <faultHandlers>
+ <catch faultName="lns:loanProcessFault"
+ faultVariable="error"
+ faultMessageType="lns:errorMessage">
+ <reply partnerLink="customer"
+ portType="lns:loanServicePT"
+ operation="request" variable="error"
+ faultName="unableToHandleRequest" />
+ </catch>
+ </faultHandlers>
+ <flow>
+ <links>
+ <link name="receive-to-assess" />
+ <link name="receive-to-approval" />
+ <link name="approval-to-reply" />
+ <link name="assess-to-setMessage" />
+ <link name="setMessage-to-reply" />
+ <link name="assess-to-approval" />
+ </links>
+ <receive partnerLink="customer"
+ portType="lns:loanServicePT"
+ operation="request"
+ variable="request"
+ createInstance="yes">
+ <sources>
+ <source linkName="receive-to-assess">
+ <transitionCondition>
+ $request.amount < 10000
+ </transitionCondition>
+ </source>
+ <source linkName="receive-to-approval">
+ <transitionCondition>
+ $request.amount >= 10000
+ </transitionCondition>
+ </source>
+ </sources>
+ </receive>
+ <invoke partnerLink="assessor"
+ portType="lns:riskAssessmentPT"
+ operation="check"
+ inputVariable="request"
+ outputVariable="risk">
+ <targets>
+ <target linkName="receive-to-assess" />
+ </targets>
+ <sources>
+ <source linkName="assess-to-setMessage">
+ <transitionCondition>
+ $risk.level='low'
+ </transitionCondition>
+ </source>
+ <source linkName="assess-to-approval">
+ <transitionCondition>
+ $risk.level!='low'
+ </transitionCondition>
+ </source>
+ </sources>
+ </invoke>
+ <assign>
+ <targets>
+ <target linkName="assess-to-setMessage" />
+ </targets>
+ <sources>
+ <source linkName="setMessage-to-reply" />
+ </sources>
+ <copy>
+ <from>
+ <literal>yes</literal>
+ </from>
+ <to variable="approval" part="accept" />
+ </copy>
+ </assign>
+ <invoke partnerLink="approver"
+ portType="lns:loanApprovalPT"
+ operation="approve"
+ inputVariable="request"
+ outputVariable="approval">
+ <targets>
+ <target linkName="receive-to-approval" />
+ <target linkName="assess-to-approval" />
+ </targets>
+ <sources>
+ <source linkName="approval-to-reply" />
+ </sources>
+ </invoke>
+ <reply partnerLink="customer"
+ portType="lns:loanServicePT"
+ operation="request"
+ variable="approval">
+ <targets>
+ <target linkName="setMessage-to-reply" />
+ <target linkName="approval-to-reply" />
+ </targets>
+ </reply>
+ </flow>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Buyer.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Buyer.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Buyer.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,24 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="savara.samples.Purchasing at Buyer" name="PurchaseGoodsProcess_Buyer" targetNamespace="http://www.jboss.org/savara/examples" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_BuyerArtifacts.wsdl" namespace="http://www.jboss.org/savara/examples"/>
+ <partnerLinks>
+ <partnerLink name="BuyerToStore" partnerLinkType="tns:BuyerToStoreLT" partnerRole="StoreRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="sto:buyRequest" name="buyRequestVar"/>
+ <variable messageType="sto:buyResponse" name="buyResponseVar"/>
+ </variables>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="sto:BuyFailedFault" faultName="sto:BuyFailed" faultVariable="BuyFailedFaultVar">
+ <sequence/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="buyRequestVar" name="Send_BuyRequest" operation="buy" outputVariable="buyResponseVar" partnerLink="BuyerToStore" portType="sto:StoreInterface"/>
+ </sequence>
+ </scope>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_BuyerArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_BuyerArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_BuyerArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.jboss.org/examples/store" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.jboss.org/savara/examples">
+ <wsdl:import location="PurchaseGoodsProcess_Buyer.wsdl" namespace="http://www.jboss.org/savara/examples"/>
+ <wsdl:import location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <wsdl:import location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <plnk:partnerLinkType name="BuyerToStoreLT">
+ <plnk:role name="StoreRequester" portType="ns1:StoreInterface"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,26 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="savara.samples.Common at CreditAgency" name="PurchaseGoodsProcess_CreditAgency" targetNamespace="java:org.jboss.savara.examples.purchasing" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgencyArtifacts.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <partnerLinks>
+ <partnerLink myRole="CreditAgencyInterface" name="StoreToCreditAgency" partnerLinkType="pur:StoreToCreditAgencyServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="pur:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="pur:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="pur:CreditCheckFailedFault" name="CreditCheckFailedFaultVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_CreditCheckRequest" operation="checkCredit" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface" variable="checkCreditRequestVar"/>
+ <if>
+ <sequence>
+ <reply name="Send_CreditCheckOk" operation="checkCredit" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface" variable="checkCreditResponseVar"/>
+ </sequence>
+ <else>
+ <sequence>
+ <reply faultName="pur:CreditCheckFailed" name="Send_CreditCheckInvalid" operation="checkCredit" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface" variable="CreditCheckFailedFaultVar"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgency.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditAgency" targetNamespace="java:org.jboss.savara.examples.purchasing">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="checkCreditRequest">
+ <wsdl:part name="content" type="pur:CreditCheckRequest">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="CreditCheckFailedFault">
+ <wsdl:part name="content" type="pur:CreditCheckInvalid">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="checkCreditResponse">
+ <wsdl:part name="content" type="pur:CreditCheckOk">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditAgencyInterface">
+ <wsdl:operation name="checkCredit">
+ <wsdl:input message="pur:checkCreditRequest">
+ </wsdl:input>
+ <wsdl:output message="pur:checkCreditResponse">
+ </wsdl:output>
+ <wsdl:fault message="pur:CreditCheckFailedFault" name="CreditCheckFailed">
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditAgencyInterfaceBinding" type="pur:CreditAgencyInterface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="checkCredit">
+ <soap:operation soapAction="java:org.jboss.savara.examples.purchasing/checkCredit"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="CreditCheckFailed">
+ <soap:fault name="CreditCheckFailed" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditAgencyService">
+ <wsdl:port binding="pur:CreditAgencyInterfaceBinding" name="CreditAgencyInterfacePort">
+ <soap:address location="http://localhost:8080/CreditAgencyService/CreditAgencyInterfacePort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgencyArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgencyArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_CreditAgencyArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="java:org.jboss.savara.examples.purchasing" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="java:org.jboss.savara.examples.purchasing">
+ <wsdl:import location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <wsdl:import location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <plnk:partnerLinkType name="StoreToCreditAgencyServiceLT">
+ <plnk:role name="CreditAgencyInterface" portType="ns1:CreditAgencyInterface"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,32 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="savara.samples.Purchasing at Store" name="PurchaseGoodsProcess_Store" targetNamespace="http://www.jboss.org/examples/store" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="PurchaseGoodsProcess_StoreArtifacts.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <partnerLinks>
+ <partnerLink myRole="StoreInterface" name="BuyerToStore" partnerLinkType="sto:BuyerToStoreServiceLT"/>
+ <partnerLink name="StoreToCreditAgency" partnerLinkType="sto:StoreToCreditAgencyLT" partnerRole="CreditAgencyRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="sto:buyRequest" name="buyRequestVar"/>
+ <variable messageType="pur:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="pur:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="sto:buyResponse" name="buyResponseVar"/>
+ <variable messageType="sto:BuyFailedFault" name="BuyFailedFaultVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_BuyRequest" operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" variable="buyRequestVar"/>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="pur:CreditCheckFailedFault" faultName="pur:CreditCheckFailed" faultVariable="CreditCheckFailedFaultVar">
+ <sequence>
+ <reply faultName="sto:BuyFailed" name="Send_BuyFailed" operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" variable="BuyFailedFaultVar"/>
+ </sequence>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="checkCreditRequestVar" name="Send_CreditCheckRequest" operation="checkCredit" outputVariable="checkCreditResponseVar" partnerLink="StoreToCreditAgency" portType="pur:CreditAgencyInterface"/>
+ <reply name="Send_BuyConfirmed" operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" variable="buyResponseVar"/>
+ </sequence>
+ </scope>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_Store.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:pur="java:org.jboss.savara.examples.purchasing" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:sto="http://www.jboss.org/examples/store" xmlns:tns="http://www.jboss.org/savara/examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Store" targetNamespace="http://www.jboss.org/examples/store">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="BuyFailedFault">
+ <wsdl:part name="content" type="sto:BuyFailed">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="buyRequest">
+ <wsdl:part name="content" type="sto:BuyRequest">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="buyResponse">
+ <wsdl:part name="content" type="sto:BuyConfirmed">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="StoreInterface">
+ <wsdl:operation name="buy">
+ <wsdl:input message="sto:buyRequest">
+ </wsdl:input>
+ <wsdl:output message="sto:buyResponse">
+ </wsdl:output>
+ <wsdl:fault message="sto:BuyFailedFault" name="BuyFailed">
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StoreInterfaceBinding" type="sto:StoreInterface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="buy">
+ <soap:operation soapAction="http://www.jboss.org/examples/store/buy"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BuyFailed">
+ <soap:fault name="BuyFailed" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StoreService">
+ <wsdl:port binding="sto:StoreInterfaceBinding" name="StoreInterfacePort">
+ <soap:address location="http://localhost:8080/StoreService/StoreInterfacePort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_StoreArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_StoreArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/PurchaseGoodsProcess_StoreArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.jboss.org/examples/store" xmlns:ns2="java:org.jboss.savara.examples.purchasing" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.jboss.org/examples/store">
+ <wsdl:import location="PurchaseGoodsProcess_Store.wsdl" namespace="http://www.jboss.org/examples/store"/>
+ <wsdl:import location="PurchaseGoodsProcess_CreditAgency.wsdl" namespace="java:org.jboss.savara.examples.purchasing"/>
+ <plnk:partnerLinkType name="BuyerToStoreServiceLT">
+ <plnk:role name="StoreInterface" portType="ns1:StoreInterface"/>
+ </plnk:partnerLinkType>
+ <plnk:partnerLinkType name="StoreToCreditAgencyLT">
+ <plnk:role name="CreditAgencyRequester" portType="ns2:CreditAgencyInterface"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Buyer.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Buyer.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Buyer.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,23 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:byr="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns:slr="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:tns="http://www.pi4soa.org/ReqRespFault" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at Buyer" name="ReqRespFaultProcess_Buyer" targetNamespace="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_Seller.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_BuyerArtifacts.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Buyer"/>
+ <partnerLinks>
+ <partnerLink name="BuyerToSeller" partnerLinkType="byr:BuyerToSellerLT" partnerRole="SellerRequester"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="slr:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="slr:checkCreditResponse" name="checkCreditResponseVar"/>
+ </variables>
+ <sequence>
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="slr:insufficientCreditFault" faultName="slr:insufficientCredit" faultVariable="insufficientCreditFaultVar">
+ <sequence/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <invoke inputVariable="checkCreditRequestVar" name="Send_CreditCheckRequest" operation="checkCredit" outputVariable="checkCreditResponseVar" partnerLink="BuyerToSeller" portType="slr:SellerBehavior"/>
+ </sequence>
+ </scope>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_BuyerArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_BuyerArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_BuyerArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ReqRespFault/Buyer">
+ <wsdl:import location="ReqRespFaultProcess_Buyer.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Buyer"/>
+ <wsdl:import location="ReqRespFaultProcess_Seller.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <plnk:partnerLinkType name="BuyerToSellerLT">
+ <plnk:role name="SellerRequester" portType="ns1:SellerBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,25 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:byr="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns:slr="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:tns="http://www.pi4soa.org/ReqRespFault" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="org.pi4soa.reqrespfault.reqrespfault.ReqRespFaultProcess at Seller" name="ReqRespFaultProcess_Seller" targetNamespace="http://www.pi4soa.org/ReqRespFault/Seller" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_Seller.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="ReqRespFaultProcess_SellerArtifacts.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <partnerLinks>
+ <partnerLink myRole="SellerBehavior" name="BuyerToSeller" partnerLinkType="slr:BuyerToSellerServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="slr:checkCreditRequest" name="checkCreditRequestVar"/>
+ <variable messageType="slr:checkCreditResponse" name="checkCreditResponseVar"/>
+ <variable messageType="slr:insufficientCreditFault" name="insufficientCreditFaultVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_CreditCheckRequest" operation="checkCredit" partnerLink="BuyerToSeller" portType="slr:SellerBehavior" variable="checkCreditRequestVar"/>
+ <if>
+ <sequence>
+ <reply name="Send_CreditCheckOk" operation="checkCredit" partnerLink="BuyerToSeller" portType="slr:SellerBehavior" variable="checkCreditResponseVar"/>
+ </sequence>
+ <else>
+ <sequence>
+ <reply faultName="slr:insufficientCredit" name="Send_CreditCheckInvalid" operation="checkCredit" partnerLink="BuyerToSeller" portType="slr:SellerBehavior" variable="insufficientCreditFaultVar"/>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_Seller.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:byr="http://www.pi4soa.org/ReqRespFault/Buyer" xmlns:slr="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.pi4soa.org/ReqRespFault" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Seller" targetNamespace="http://www.pi4soa.org/ReqRespFault/Seller">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="checkCreditRequest">
+ <wsdl:part element="CreditCheckRequest" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="checkCreditResponse">
+ <wsdl:part element="CreditCheckOk" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="insufficientCreditFault">
+ <wsdl:part element="CreditCheckInvalid" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="SellerBehavior">
+ <wsdl:operation name="checkCredit">
+ <wsdl:input message="slr:checkCreditRequest">
+ </wsdl:input>
+ <wsdl:output message="slr:checkCreditResponse">
+ </wsdl:output>
+ <wsdl:fault message="slr:insufficientCreditFault" name="insufficientCredit">
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SellerBehaviorBinding" type="slr:SellerBehavior">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="checkCredit">
+ <soap:operation soapAction="http://www.pi4soa.org/ReqRespFault/Seller/checkCredit"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="insufficientCredit">
+ <soap:fault name="insufficientCredit" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SellerService">
+ <wsdl:port binding="slr:SellerBehaviorBinding" name="SellerBehaviorPort">
+ <soap:address location="http://localhost:8080/SellerService/SellerBehaviorPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_SellerArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_SellerArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/ReqRespFaultProcess_SellerArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ReqRespFault/Seller" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ReqRespFault/Seller">
+ <wsdl:import location="ReqRespFaultProcess_Seller.wsdl" namespace="http://www.pi4soa.org/ReqRespFault/Seller"/>
+ <plnk:partnerLinkType name="BuyerToSellerServiceLT">
+ <plnk:role name="SellerBehavior" portType="ns1:SellerBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.bpel
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.bpel (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.bpel 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,15 @@
+<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.scribble.org/conversation" ns0:conversationType="overlord.cdl.samples.LoanBroker at SupplierQuoteEngine" name="RequestForQuote_SupplierQuoteEngine" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="RequestForQuote_SupplierQuoteEngine.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="RequestForQuote_SupplierQuoteEngineArtifacts.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <partnerLinks>
+ <partnerLink myRole="SupplierBehavior" name="BrokerToSupplierQuoteEngine" partnerLinkType="spr:BrokerToSupplierQuoteEngineServiceLT"/>
+ </partnerLinks>
+ <variables>
+ <variable messageType="spr:getQuoteRequest" name="getQuoteRequestVar"/>
+ <variable messageType="spr:getQuoteResponse" name="getQuoteResponseVar"/>
+ </variables>
+ <sequence>
+ <receive createInstance="yes" name="Receive_requestForQuote" operation="getQuote" partnerLink="BrokerToSupplierQuoteEngine" portType="spr:SupplierBehavior" variable="getQuoteRequestVar"/>
+ <reply name="Send_quote" operation="getQuote" partnerLink="BrokerToSupplierQuoteEngine" portType="spr:SupplierBehavior" variable="getQuoteResponseVar"/>
+ </sequence>
+</process>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngine.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:brk="http://www.pi4soa.org/ESBBroker/Broker" xmlns:byr="http://www.pi4soa.org/ESBBroker/Buyer" xmlns:cay="http://www.pi4soa.org/ESBBroker/CreditAgency" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:spr="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:tns="http://www.pi4soa.org/ESBBroker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Supplier" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier">
+ <types xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
+ </types>
+ <wsdl:message name="confirmRequest">
+ <wsdl:part element="orderConfirmed" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="confirmResponse">
+ <wsdl:part element="bookingReference" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getQuoteResponse">
+ <wsdl:part element="quote" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getQuoteRequest">
+ <wsdl:part element="requestForQuote" name="content">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="SupplierBehavior">
+ <wsdl:operation name="confirm">
+ <wsdl:input message="spr:confirmRequest">
+ </wsdl:input>
+ <wsdl:output message="spr:confirmResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getQuote">
+ <wsdl:input message="spr:getQuoteRequest">
+ </wsdl:input>
+ <wsdl:output message="spr:getQuoteResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SupplierBehaviorBinding" type="spr:SupplierBehavior">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="confirm">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Supplier/confirm"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getQuote">
+ <soap:operation soapAction="http://www.pi4soa.org/ESBBroker/Supplier/getQuote"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SupplierService">
+ <wsdl:port binding="spr:SupplierBehaviorBinding" name="SupplierBehaviorPort">
+ <soap:address location="http://localhost:8080/SupplierService/SupplierBehaviorPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngineArtifacts.wsdl
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngineArtifacts.wsdl (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/testmodels/RequestForQuote_SupplierQuoteEngineArtifacts.wsdl 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.pi4soa.org/ESBBroker/Supplier" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier">
+ <wsdl:import location="RequestForQuote_SupplierQuoteEngine.wsdl" namespace="http://www.pi4soa.org/ESBBroker/Supplier"/>
+ <plnk:partnerLinkType name="BrokerToSupplierQuoteEngineServiceLT">
+ <plnk:role name="SupplierBehavior" portType="ns1:SupplierBehavior"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/AllTests.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/AllTests.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/AllTests.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.tests;
+
+import org.jboss.savara.tools.bpel.generator.GeneratorTest.ChoreographyToBPELTester;
+import org.jboss.savara.tools.bpel.model.change.ModelChangeUtilsTest;
+import org.jboss.savara.tools.bpel.model.component.*;
+import org.jboss.savara.tools.bpel.model.util.InteractionUtilTest;
+import org.jboss.savara.tools.bpel.parser.ParserTest.BPELToConversationTest;
+import org.jboss.savara.tools.bpel.util.XMLUtilsTest;
+import org.scribble.model.SubDefinitionPath;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(ModelChangeUtilsTest.class);
+ suite.addTestSuite(AbstractInteractionTest.class);
+ suite.addTestSuite(BPELActivityTest.class);
+ suite.addTestSuite(BPELElementTest.class);
+ suite.addTestSuite(CatchAllTest.class);
+ suite.addTestSuite(CatchTest.class);
+ suite.addTestSuite(CompensationHandlerTest.class);
+ suite.addTestSuite(ConditionTest.class);
+ suite.addTestSuite(ElseIfTest.class);
+ suite.addTestSuite(ElseTest.class);
+ suite.addTestSuite(EventHandlersTest.class);
+ suite.addTestSuite(ExitTest.class);
+ suite.addTestSuite(FaultHandlersTest.class);
+ suite.addTestSuite(FlowTest.class);
+ suite.addTestSuite(ForEachTest.class);
+ suite.addTestSuite(IfTest.class);
+ suite.addTestSuite(InvokeTest.class);
+ suite.addTestSuite(OnAlarmTest.class);
+ suite.addTestSuite(OnEventTest.class);
+ suite.addTestSuite(OnMessageTest.class);
+ suite.addTestSuite(PartnerLinkTest.class);
+ suite.addTestSuite(PickTest.class);
+ suite.addTestSuite(ProcessTest.class);
+ suite.addTestSuite(ReceiveTest.class);
+ suite.addTestSuite(RepeatUntilTest.class);
+ suite.addTestSuite(ReplyTest.class);
+ suite.addTestSuite(RethrowTest.class);
+ suite.addTestSuite(ScopeTest.class);
+ suite.addTestSuite(SequenceTest.class);
+ suite.addTestSuite(TerminationHandlerTest.class);
+ suite.addTestSuite(ThrowTest.class);
+ suite.addTestSuite(VariableTest.class);
+ suite.addTestSuite(WaitTest.class);
+ suite.addTestSuite(WhileTest.class);
+ suite.addTestSuite(InteractionUtilTest.class);
+ suite.addTestSuite(XMLUtilsTest.class);
+
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker", "Broker"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker", "Buyer"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker", "CreditAgency"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker",
+ new SubDefinitionPath(new String[]{"CompleteTransaction"}),
+ "SupplierTxnProcessor"));
+ suite.addTest(new ChoreographyToBPELTester("ESBBroker",
+ new SubDefinitionPath(new String[]{"RequestForQuote"}),
+ "SupplierQuoteEngine"));
+ suite.addTest(new ChoreographyToBPELTester("PurchaseGoods", "Buyer"));
+ suite.addTest(new ChoreographyToBPELTester("PurchaseGoods", "CreditAgency"));
+ suite.addTest(new ChoreographyToBPELTester("PurchaseGoods", "Store"));
+ suite.addTest(new ChoreographyToBPELTester("ReqRespFault", "Buyer"));
+ suite.addTest(new ChoreographyToBPELTester("ReqRespFault", "Seller"));
+
+ /* SAVARA-151 - need to uncomment tests and find a way to run from Tycho
+ *
+ suite.addTest(new BPELToConversationTest("ESBBrokerProcess_Broker", "ESBBroker at Broker"));
+ suite.addTest(new BPELToConversationTest("ESBBrokerProcess_Buyer", "ESBBroker at Buyer"));
+ suite.addTest(new BPELToConversationTest("ESBBrokerProcess_CreditAgency", "ESBBroker at CreditAgency"));
+ suite.addTest(new BPELToConversationTest("RequestForQuote_SupplierQuoteEngine", "ESBBroker at SupplierQuoteEngine"));
+ suite.addTest(new BPELToConversationTest("CompleteTransaction_SupplierTxnProcessor", "ESBBroker at SupplierTxnProcessor"));
+ suite.addTest(new BPELToConversationTest("PurchaseGoodsProcess_Buyer", "PurchaseGoods at Buyer"));
+ suite.addTest(new BPELToConversationTest("PurchaseGoodsProcess_CreditAgency", "PurchaseGoods at CreditAgency"));
+ suite.addTest(new BPELToConversationTest("PurchaseGoodsProcess_Store", "PurchaseGoods at Store"));
+ suite.addTest(new BPELToConversationTest("ReqRespFaultProcess_Buyer", "ReqRespFault at Buyer"));
+ suite.addTest(new BPELToConversationTest("ReqRespFaultProcess_Seller", "ReqRespFault at Seller"));
+ */
+
+ /**
+ * TODO: (SAVARA-150) Commenting out this test for now, as we now need the accompanying WSDL to be able to
+ * resolve the message type's underlying XSD element or type.
+ *
+ suite.addTest(new BPELToConversationTest("LoanApprovalService at Service", "LoanApprovalService at Service"));
+ */
+
+ return suite;
+ }
+}
\ No newline at end of file
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/osgi/Activator.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/osgi/Activator.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/osgi/Activator.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,22 @@
+package org.jboss.savara.tools.bpel.tests.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
Added: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util/XMLUtilsTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util/XMLUtilsTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util/XMLUtilsTest.java 2010-11-12 19:20:56 UTC (rev 465)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.bpel.util;
+
+import org.jboss.savara.tools.bpel.util.XMLUtils;
+import org.scribble.model.ModelObject;
+
+import junit.framework.TestCase;
+
+public class XMLUtilsTest extends TestCase {
+
+ public void testNamespace() {
+ String namespace="http://namespace";
+ String elemName="testElement";
+
+ String expected="<"+elemName+" xmlns=\""+namespace+"\"/>\r\n";
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.
+ newInstance();
+ factory.setNamespaceAware(true);
+
+ org.w3c.dom.Document doc=
+ factory.newDocumentBuilder().newDocument();
+
+ org.w3c.dom.Element elem=
+ doc.createElementNS(namespace, elemName);
+
+ String str=XMLUtils.toText(elem);
+
+ if (str.equals(expected) == false) {
+ fail("Expected result '"+expected+"', got: '"+str+"'");
+ }
+
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ public void testSetStartAndEndPosition() {
+ String xml="<root><myelem></myelem><myelem></myelem></root>";
+
+ try {
+ org.w3c.dom.Element node=(org.w3c.dom.Element)XMLUtils.getNode(xml);
+
+ org.w3c.dom.NodeList nl=node.getElementsByTagName("myelem");
+
+ if (nl.getLength() != 2) {
+ fail("Should be two elements: "+nl.getLength());
+ }
+
+ ModelObject obj=new ModelObject(){};
+
+ XMLUtils.setStartAndEndPosition(obj, xml, (org.w3c.dom.Element)nl.item(1));
+
+ if (obj.getSource().getStartPosition() != 23) {
+ fail("Start position should be 23: "+obj.getSource().getStartPosition());
+ }
+
+ if (obj.getSource().getEndPosition() != 39) {
+ fail("End position should be 39: "+obj.getSource().getEndPosition());
+ }
+
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ public void testSetStartAndEndPositionWithNS() {
+ String xml="<bpel:root xmlns:bpel=\"myns\" ><bpel:myelem></bpel:myelem><bpel:myelem></bpel:myelem></bpel:root>";
+
+ try {
+ org.w3c.dom.Element node=(org.w3c.dom.Element)XMLUtils.getNode(xml);
+
+ org.w3c.dom.NodeList nl=node.getElementsByTagNameNS("myns", "myelem");
+
+ if (nl.getLength() != 2) {
+ fail("Should be two elements: "+nl.getLength());
+ }
+
+ ModelObject obj=new ModelObject(){};
+
+ XMLUtils.setStartAndEndPosition(obj, xml, (org.w3c.dom.Element)nl.item(1));
+
+ if (obj.getSource().getStartPosition() != 57) {
+ fail("Start position should be 57: "+obj.getSource().getStartPosition());
+ }
+
+ if (obj.getSource().getEndPosition() != 83) {
+ fail("End position should be 83: "+obj.getSource().getEndPosition());
+ }
+
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ public void testSetStartAndEndPositionSingleNodeWithNS() {
+ String xml="<bpel:root xmlns:bpel=\"myns\" ><bpel:myelem attr=\"1\" /><bpel:myelem attr=\"2\" /></bpel:root>";
+
+ try {
+ org.w3c.dom.Element node=(org.w3c.dom.Element)XMLUtils.getNode(xml);
+
+ org.w3c.dom.NodeList nl=node.getElementsByTagNameNS("myns", "myelem");
+
+ if (nl.getLength() != 2) {
+ fail("Should be two elements: "+nl.getLength());
+ }
+
+ ModelObject obj=new ModelObject(){};
+
+ XMLUtils.setStartAndEndPosition(obj, xml, (org.w3c.dom.Element)nl.item(1));
+
+ if (obj.getSource().getStartPosition() != 54) {
+ fail("Start position should be 54: "+obj.getSource().getStartPosition());
+ }
+
+ if (obj.getSource().getEndPosition() != 77) {
+ fail("End position should be 77: "+obj.getSource().getEndPosition());
+ }
+
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ public void testSetStartAndEndPositionWithChildAndNS() {
+ String xml="<bpel:root xmlns:bpel=\"myns\" ><bpel:myelem></bpel:myelem>" +
+ "<bpel:myelem><bpel:myelem></bpel:myelem></bpel:myelem></bpel:root>";
+
+ try {
+ org.w3c.dom.Element node=(org.w3c.dom.Element)XMLUtils.getNode(xml);
+
+ org.w3c.dom.NodeList nl=node.getElementsByTagNameNS("myns", "myelem");
+
+ if (nl.getLength() != 3) {
+ fail("Should be three elements: "+nl.getLength());
+ }
+
+ ModelObject obj=new ModelObject(){};
+
+ XMLUtils.setStartAndEndPosition(obj, xml, (org.w3c.dom.Element)nl.item(1));
+
+ if (obj.getSource().getStartPosition() != 57) {
+ fail("Start position should be 57: "+obj.getSource().getStartPosition());
+ }
+
+ if (obj.getSource().getEndPosition() != 110) {
+ fail("End position should be 110: "+obj.getSource().getEndPosition());
+ }
+
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+}
Modified: trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF 2010-11-12 12:21:09 UTC (rev 464)
+++ trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF 2010-11-12 19:20:56 UTC (rev 465)
@@ -5,9 +5,9 @@
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.jboss.savara.tools.wsdl.tests.osgi.Activator
Bundle-Vendor: www.jboss.org
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: org.osgi.framework;version="1.3.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.osgi.framework
Require-Bundle: org.jboss.savara.contract.model,
- org.jboss.savara.tools.wsdl;bundle-version="1.0.0",
+ org.jboss.savara.tools.wsdl,
org.junit,
org.scribble.core
Modified: trunk/tools/tests/pom.xml
===================================================================
--- trunk/tools/tests/pom.xml 2010-11-12 12:21:09 UTC (rev 464)
+++ trunk/tools/tests/pom.xml 2010-11-12 19:20:56 UTC (rev 465)
@@ -16,6 +16,7 @@
<modules>
<module>org.jboss.savara.protocol.contract.tests</module>
+ <module>org.jboss.savara.tools.bpel.tests</module>
<module>org.jboss.savara.tools.wsdl.tests</module>
</modules>
More information about the savara-commits
mailing list