[savara-commits] savara SVN: r476 - in trunk: bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component and 23 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Nov 18 07:43:47 EST 2010
Author: objectiser
Date: 2010-11-18 07:43:39 -0500 (Thu, 18 Nov 2010)
New Revision: 476
Added:
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/change/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/change/ModelChangeUtilsTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/AbstractInteractionTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELActivityTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELElementTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchAllTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CompensationHandlerTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ConditionTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseIfTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/EventHandlersTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ExitTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FaultHandlersTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FlowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ForEachTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/IfTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/InvokeTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnAlarmTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnEventTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnMessageTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PartnerLinkTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PickTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ProcessTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReceiveTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RepeatUntilTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReplyTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RethrowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ScopeTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/SequenceTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TerminationHandlerTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestAbstractInteraction.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELActivity.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELElement.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ThrowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/VariableTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WaitTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WhileTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/util/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/util/InteractionUtilTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/
Removed:
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/export/
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELLanguageModel.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELNotation.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/DefaultBPELLanguageModel.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/AbstractBPELModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/InteractionPatterns.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/LanguageToConversationModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtils.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/RunModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/SpawnModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhenModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhileModelChangeRule.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractCondition.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteraction.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivity.java
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/BPELElementFactory.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELGroupingConstruct.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Catch.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CatchAll.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandler.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Condition.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ConversionContext.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/DefaultConversionContext.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Else.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Elseif.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlers.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Exit.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlers.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Flow.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/For.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ForEach.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/If.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Import.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Invoke.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Link.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarm.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnEvent.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnMessage.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLink.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Pick.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Process.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Receive.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntil.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Reply.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Rethrow.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Scope.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ScopeActivity.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Sequence.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Source.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Target.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandler.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Throw.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Until.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Variable.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Wait.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/While.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/parser/
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/plugintest/
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/test/
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/AbstractInteractionTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELActivityTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELElementTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchAllTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CompensationHandlerTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ConditionTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseIfTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/EventHandlersTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ExitTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FaultHandlersTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FlowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ForEachTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/IfTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/InvokeTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnAlarmTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnEventTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnMessageTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PartnerLinkTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PickTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ProcessTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReceiveTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RepeatUntilTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReplyTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RethrowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ScopeTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/SequenceTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TerminationHandlerTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestAbstractInteraction.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELActivity.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELElement.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ThrowTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/VariableTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WaitTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WhileTest.java
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/component/
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/util/
Modified:
trunk/bundles/org.jboss.savara.bpel/
trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElementFactory.java
trunk/tools/features/org.jboss.savara.tools.feature/feature.xml
trunk/tools/plugins/org.jboss.savara.tools.bpel/.classpath
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/editor/BPELEditorManager.java
trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java
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/parser/ParserTest.java
trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/AllTests.java
Log:
More work to move the BPEL generation capability into a separate bundle.
Property changes on: trunk/bundles/org.jboss.savara.bpel
___________________________________________________________________
Name: svn:ignore
+ bin
target
Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElementFactory.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElementFactory.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElementFactory.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -22,8 +22,7 @@
public class BPELElementFactory {
- public static final String MODEL_COMPONENTS_PACKAGE =
- "org.jboss.savara.tools.bpel.model.component";
+ public static final String MODEL_COMPONENTS_PACKAGE = BPELElementFactory.class.getPackage().getName();
/**
* This method creates a BPELElement instance relevant to the
Modified: trunk/tools/features/org.jboss.savara.tools.feature/feature.xml
===================================================================
--- trunk/tools/features/org.jboss.savara.tools.feature/feature.xml 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/features/org.jboss.savara.tools.feature/feature.xml 2010-11-18 12:43:39 UTC (rev 476)
@@ -201,6 +201,13 @@
unpack="false"/>
<plugin
+ id="org.jboss.savara.bpel"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.jboss.savara.tools.validator"
download-size="0"
install-size="0"
Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/.classpath
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/.classpath 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/.classpath 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,9 +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/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/java"/>
- <classpathentry kind="src" path="src/plugintest"/>
- <classpathentry kind="src" path="src/test"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
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-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF 2010-11-18 12:43:39 UTC (rev 476)
@@ -23,23 +23,9 @@
org.eclipse.jst.common.frameworks,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.common.project.facet.core,
- org.jboss.savara.wsdl
+ org.jboss.savara.wsdl,
+ org.jboss.savara.bpel
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: www.jboss.org
-Scribble-Extensions: org.jboss.savara.tools.bpel.parser.BPELTokenizer,
- org.jboss.savara.tools.bpel.parser.BPELModelParserRule,
- org.jboss.savara.tools.bpel.model.BPELNotation,
- org.jboss.savara.tools.bpel.model.change.LanguageToConversationModelChangeRule,
- org.jboss.savara.tools.bpel.model.change.ConversationChangeRule,
- org.jboss.savara.tools.bpel.model.change.WhileModelChangeRule,
- org.jboss.savara.tools.bpel.model.change.WhenModelChangeRule,
- org.jboss.savara.tools.bpel.model.change.IfModelChangeRule,
- org.jboss.savara.tools.bpel.model.change.RunModelChangeRule,
- 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"
+Scribble-Extensions: org.jboss.savara.tools.bpel.editor.BPELEditorManager
Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/editor/BPELEditorManager.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/editor/BPELEditorManager.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/editor/BPELEditorManager.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -18,8 +18,8 @@
package org.jboss.savara.tools.bpel.editor;
//import org.eclipse.emf.ecore.EValidator;
-import org.jboss.savara.tools.bpel.model.BPELNotation;
-import org.jboss.savara.tools.bpel.model.component.BPELElement;
+import org.jboss.savara.bpel.model.BPELNotation;
+import org.jboss.savara.bpel.model.component.BPELElement;
import org.scribble.extensions.RegistryInfo;
import org.scribble.model.ModelReference;
import org.scribble.model.SourceRef;
Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -31,9 +31,9 @@
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.jboss.savara.tools.bpel.generator.BuildSystem;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.PartnerLink;
-import org.jboss.savara.tools.bpel.util.XMLUtils;
+import org.jboss.savara.bpel.model.*;
+import org.jboss.savara.bpel.model.component.PartnerLink;
+import org.jboss.savara.bpel.util.XMLUtils;
import org.jboss.savara.wsdl.generator.soap.SOAPDocLitWSDLBinding;
import org.jboss.savara.contract.model.Contract;
import org.jboss.savara.contract.model.Interface;
@@ -230,7 +230,7 @@
}
protected void generateRoleProject(String projectName, Role role,
- org.jboss.savara.tools.bpel.model.component.Process bpelProcess, ConversationModel localcm,
+ org.jboss.savara.bpel.model.component.Process bpelProcess, ConversationModel localcm,
BPELLanguageModel model, IFile cdmResource) throws Exception {
final IProject proj=createProject(projectName);
@@ -481,7 +481,7 @@
}
protected void generatePartnerLinkTypes(Role role, IProject proj, ConversationModel localcm,
- org.jboss.savara.tools.bpel.model.component.Process bpelProcess) throws Exception {
+ org.jboss.savara.bpel.model.component.Process bpelProcess) throws Exception {
org.w3c.dom.Document doc=javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();;
@@ -671,7 +671,7 @@
protected void generateBPELDeploy(Role role, IProject proj, ConversationModel localcm,
- org.jboss.savara.tools.bpel.model.component.Process bpelProcess) throws Exception {
+ org.jboss.savara.bpel.model.component.Process bpelProcess) throws Exception {
org.w3c.dom.Document doc=javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();;
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELLanguageModel.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELLanguageModel.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELLanguageModel.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,60 +0,0 @@
-/*
- * 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;
-
-import org.jboss.savara.tools.bpel.model.component.Process;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-
-/**
- * This class represents a BPEL model.
- *
- * @author gary
- */
-public interface BPELLanguageModel {
-
- /**
- * This method validates the ESB model and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l);
-
- /**
- * This method returns the source model reference.
- *
- * @return The source model reference
- */
- public ModelReference getModelReference();
-
- /**
- * This textual contents of the model.
- *
- * @return The textual contents
- */
- public String getOriginalContents();
-
- /**
- * This method returns the BPEL Process.
- *
- * @return The BPEL Process
- */
- public Process getBPELProcess();
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELNotation.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELNotation.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/BPELNotation.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,66 +0,0 @@
-/*
- * 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;
-
-import org.scribble.extensions.*;
-import org.scribble.model.ModelReference;
-import org.scribble.model.Notation;
-
-/**
- * The notation class for the BPEL language.
- */
- at RegistryInfo(extension=org.scribble.model.Notation.class)
-public class BPELNotation extends org.scribble.model.AbstractNotation {
-
- public static final String NOTATION_CODE = "bpel";
-
- /**
- * This is the default constructor for the BPEL notation.
- */
- public BPELNotation() {
- super(NOTATION_CODE, "BPEL", false);
- }
-
- /**
- * This method returns the initial description associated
- * with the supplied reference.
- *
- * @param ref The reference
- * @return The initial description, or null if no description
- */
- @Override
- public String getInitialDescription(ModelReference ref) {
- StringBuffer buf=new StringBuffer();
-
- return(buf.toString());
- }
-
- /**
- * This method returns the optional 'super' notation.
- * If defined, then this notation is a derived notation
- * from the 'super' notation.
- *
- * @return The optional 'super' notation
- */
- @Override
- public Notation getSuperNotation() {
- return(m_superNotation);
- }
-
- private Notation m_superNotation=new org.scribble.conversation.model.ConversationNotation();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/DefaultBPELLanguageModel.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/DefaultBPELLanguageModel.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/DefaultBPELLanguageModel.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,188 +0,0 @@
-/*
- * 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;
-
-//import org.apache.commons.logging.*;
-import org.jboss.savara.tools.bpel.model.component.Process;
-import org.scribble.conversation.model.Conversation;
-import org.scribble.model.*;
-import org.scribble.model.admin.Context;
-import org.scribble.model.admin.ModelIssue;
-import org.scribble.model.admin.ModelListener;
-import org.scribble.model.resolutions.*;
-
-/**
- * This class represents a BPEL model.
- *
- * @author gary
- */
-public class DefaultBPELLanguageModel extends org.scribble.lang.model.LanguageModel
- implements BPELLanguageModel {
-
- private static final long serialVersionUID = 7625564863751533521L;
-
- public static final String BPEL_NOTATION = "bpel";
-
- /**
- * This constructor is initialized with the BPEL description.
- *
- * @param source The model reference for the BPEL source
- * @param elem The BPEL document
- * @param contents The textual contents
- */
- public DefaultBPELLanguageModel(ModelReference source, org.w3c.dom.Element elem,
- String contents, Context context) {
- m_source = source;
- m_contents = contents;
- m_bpelProcess = new Process(this, elem);
-
- Namespace ns=new Namespace();
- ns.setName(source.getNamespace());
- setNamespace(ns);
-
- // Initialize the existing model
- Conversation conv=m_bpelProcess.convert(context);
-
- if (conv != null) {
- getConversations().add(conv);
- } else {
- // Log error?
- }
- }
-
- /**
- * This constructor initializes a new BPEL process.
- *
- * @param source The model reference for the BPEL description
- */
- public DefaultBPELLanguageModel(ModelReference source) {
- m_source = source;
-
- m_bpelProcess = new Process(this);
- }
-
- /**
- * This method returns the source model reference.
- *
- * @return The source model reference
- */
- public ModelReference getModelReference() {
- return(m_source);
- }
-
- /**
- * Generate a key for use in accessing the service related to
- * the supplied category and name.
- *
- * @param category The category
- * @param name The service name
- * @return The key
- */
- protected String getKey(String category, String name) {
- return(category+"/"+name);
- }
-
- /**
- * This method validates the ESB model and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l) {
-
- }
-
- /**
- * This textual contents of the model.
- *
- * @return The textual contents
- */
- public String getOriginalContents() {
- return(m_contents);
- }
-
- /**
- * This method returns the BPEL Process.
- *
- * @return The BPEL Process
- */
- public Process getBPELProcess() {
- return(m_bpelProcess);
- }
-
- //private static Log logger = LogFactory.getLog(DefaultBPELLanguageModel.class);
-
- private ModelReference m_source=null;
- private Process m_bpelProcess=null;
- private String m_contents=null;
-
- public class InnerModelListener implements ModelListener {
-
- public InnerModelListener(ModelListener l) {
- m_listener = l;
- }
-
- public void error(ModelIssue issue) {
-
- /*
- issue.getProperties().put(ModelListener.RESOLUTIONS, ModelListener.SHOW_REFERENCE_DESCRIPTION_RESOLUTION);
- issue.getProperties().put(ModelListener.REFERENCE_MODEL, m_source);
- issue.getProperties().put(ModelListener.REFERENCE_MODEL_START_POSITION,
- issue.getModelObject().getSource().getStartPosition());
- issue.getProperties().put(ModelListener.REFERENCE_MODEL_END_POSITION,
- issue.getModelObject().getSource().getEndPosition());
- if (issue.getModelObject().getSource().getComponentURI() != null) {
- issue.getProperties().put(ModelListener.REFERENCE_MODEL_COMPONENT,
- issue.getModelObject().getSource().getComponentURI());
- }
- */
- ShowReferencedDescription res=new ShowReferencedDescription();
- res.setModel(m_source);
- res.setSourceReference(issue.getModelObject().getSource());
-
- issue.getResolutions().add(res);
-
- m_listener.error(issue);
- }
-
- public void warning(ModelIssue issue) {
- /*
- issue.getProperties().put(ModelListener.RESOLUTIONS, ModelListener.SHOW_REFERENCE_DESCRIPTION_RESOLUTION);
- issue.getProperties().put(ModelListener.REFERENCE_MODEL, m_source);
- issue.getProperties().put(ModelListener.REFERENCE_MODEL_START_POSITION,
- issue.getModelObject().getSource().getStartPosition());
- issue.getProperties().put(ModelListener.REFERENCE_MODEL_END_POSITION,
- issue.getModelObject().getSource().getEndPosition());
- if (issue.getModelObject().getSource().getComponentURI() != null) {
- issue.getProperties().put(ModelListener.REFERENCE_MODEL_COMPONENT,
- issue.getModelObject().getSource().getComponentURI());
- }
- */
-
- ShowReferencedDescription res=new ShowReferencedDescription();
- res.setModel(m_source);
- res.setSourceReference(issue.getModelObject().getSource());
-
- issue.getResolutions().add(res);
-
- m_listener.warning(issue);
- }
-
- private ModelListener m_listener=null;
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/AbstractBPELModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/AbstractBPELModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/AbstractBPELModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,90 +0,0 @@
-/*
- * 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.model.*;
-import org.scribble.model.change.*;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.Sequence;
-
-/**
- * This is the abstract ESB model change rule.
- */
-public abstract class AbstractBPELModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (context.getParent() instanceof Sequence &&
- model instanceof BPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and deleted model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object to be removed
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isDeleteSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- return(ret);
- }
-
- /**
- * This method removes the supplied model object from the
- * supplied model. The model object representation must
- * contain the necessary model specific to remove the
- * object from the underlying model representation.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object to be deleted
- * @return Whether the change has been applied
- */
- @Override
- public boolean delete(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- return(ret);
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,243 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.generator.Generator;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.jboss.savara.tools.bpel.model.component.Import;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.jboss.savara.contract.model.Contract;
-import org.jboss.savara.contract.model.Interface;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Conversation.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class ConversationChangeRule extends AbstractModelChangeRule {
-
- //private static final String NAME_SUFFIX = "_main";
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Conversation &&
- model instanceof DefaultBPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- Conversation conv=(Conversation)mobj;
- String roleNamespace=null;
-
- Sequence seq=new Sequence(bpelModel);
-
- // Check if root conversation
- if (conv.getParent() instanceof Model) {
-
- // Set the name of the process
- bpelModel.getBPELProcess().setName(conv.getLocatedName().getName()+"_"+
- conv.getLocatedName().getRole().getName());
-
- // Get contract
- Contract contract=ModelChangeUtils.getContract(context, conv.getLocatedName().getRole().getName());
-
- if (contract != null) {
- roleNamespace = contract.getNamespace();
-
- // Set namespace
- bpelModel.getBPELProcess().setTargetNamespace(contract.getNamespace());
-
- // Add other namespaces
- for (org.jboss.savara.contract.model.Namespace ns : contract.getNamespaces()) {
- bpelModel.getBPELProcess().initNamespace(ns.getURI(), ns.getPrefix());
- }
- }
-
- String namespace=((Model)conv.getModel()).
- getNamespace().getName();
-
- String ctype=null;
-
- // Check if conversation has a 'conforms to' reference
- if (conv.getConformsTo().size() > 0) {
- // Set conversation type based on first 'conforms to'
- // reference
- ConformanceReference cref=conv.getConformsTo().get(0);
-
- ctype = cref.getNamespace()+"."+
- cref.getLocalpart()+"@"+
- cref.getLocatedRole();
- } else {
- // Set conversation type based on conversation
- // namespace and name
- ctype = namespace+"."+
- conv.getLocatedName().getName()+"@"+
- conv.getLocatedName().getRole().getName();
- }
-
- if (ctype != null) {
- bpelModel.getBPELProcess().setConversationType(ctype);
- }
-
- // Add import for this role
- addImport(context, bpelModel, conv, context.getRole());
-
- // Add import statements for partner roles
- java.util.List<Role> roles=conv.getRoles();
-
- for (int i=0; i < roles.size(); i++) {
- addImport(context, bpelModel, conv, roles.get(i));
- }
-
- // Add import for partner link types
- Import imp=new Import(bpelModel);
- imp.setLocation(bpelModel.getBPELProcess().getName()+"Artifacts.wsdl");
- imp.setNamespace(roleNamespace);
- imp.setImportType("http://schemas.xmlsoap.org/wsdl/");
-
- bpelModel.getBPELProcess().addImport(imp, -1);
-
- // Add sequence to model
- bpelModel.getBPELProcess().setActivity(seq);
-
- } else if (context.getParent() instanceof Sequence) {
-
- // Create a scope
- Scope scope=new Scope(bpelModel);
-
- ((Sequence)context.getParent()).addActivity(scope, -1);
-
- // NOTE: Currently needs to be added after adding scope
- // to parent sequence, as otherwise the DOM element
- // associated with the 'seq' sequence becomes
- // disconnected from the actual document - due to
- // the fact that added elements are copied (in
- // turn due to an xml parser exception).
- scope.setActivity(seq);
- }
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=conv.getBlock().getContents();
-
- Object parent=context.getParent();
-
- context.setParent(seq);
-
- for (int i=0; i < acts.size(); i++) {
- if ((acts.get(i) instanceof Definition) == false) {
- context.insert(model, acts.get(i), null);
- }
- }
-
- // Reset old parent
- context.setParent(parent);
-
- return(true);
- }
-
- /**
- * This method adds an import statement for the contract associated with the
- * supplied role.
- *
- * @param context The context
- * @param bpelModel The model
- * @param conv The conversation
- * @param role The role
- */
- protected void addImport(ModelChangeContext context, DefaultBPELLanguageModel bpelModel,
- Conversation conv, Role role) {
- if (role.getAnnotations().containsKey(Contract.class.getName())) {
- Contract contract=(Contract)role.getAnnotations().get(Contract.class.getName());
-
- boolean gen=false;
-
- java.util.Iterator<Interface> iter=contract.getInterfaces().iterator();
-
- while (gen == false && iter.hasNext()) {
- Interface intf=iter.next();
-
- if (intf.getMessageExchangePatterns().size() > 0) {
- gen = true;
- }
- }
-
- if (gen) {
- String fileName=Generator.getWSDLFileName(role,
- conv.getLocatedName().getName(), "");
-
- Import imp=new Import(bpelModel);
-
- imp.setLocation(fileName);
- imp.setNamespace(contract.getNamespace());
- imp.setImportType("http://schemas.xmlsoap.org/wsdl/");
-
- bpelModel.getBPELProcess().addImport(imp, -1);
- }
- }
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,472 +0,0 @@
-/*
- * 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 javax.xml.namespace.QName;
-
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.jboss.savara.tools.bpel.model.util.*;
-import org.jboss.savara.wsdl.generator.WSDLGeneratorUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.jboss.savara.contract.model.Contract;
-import org.jboss.savara.contract.model.Interface;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Conversation Interaction.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class ConversationInteractionModelChangeRule extends AbstractBPELModelChangeRule {
-
- private static final String INTERFACE_NAME = "interfaceName";
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj,
- ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof ConversationInteraction &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- BPELLanguageModel bpelModel=(BPELLanguageModel)model;
- ConversationInteraction interaction=(ConversationInteraction)mobj;
- boolean ret=false;
- AbstractInteraction act=null;
- PartnerLink pl=new PartnerLink(bpelModel);
- Role role=null;
- String portType=null;
- String varName=null; //InteractionPatterns.getVariableName(interaction);
- Interface intf=null;
-
- if (interaction.getEnclosingDefinition() != null) {
- role = interaction.getEnclosingDefinition().
- getLocatedName().getRole();
- }
-
- // Identify port type role
- String prefix=null;
-
- String mainPrefix=null;
-
- Contract contract=ModelChangeUtils.getContract(context, context.getRole().getName());
- if (contract != null) {
- mainPrefix = bpelModel.getBPELProcess().addNamespace(contract.getNamespace());
- }
-
- Role roleType=null;
-
- if (InteractionUtil.isRequest(interaction)) {
- roleType = interaction.getToRole();
- if (roleType == null) {
- roleType = role;
- }
- } else {
- roleType = interaction.getFromRole();
- if (roleType == null) {
- roleType = role;
- }
- }
-
- if (roleType != null) {
- contract = ModelChangeUtils.getContract(context, roleType.getName());
-
- if (contract != null) {
- if (interaction.getAnnotations().containsKey(INTERFACE_NAME)) {
- String intfName=(String)interaction.getAnnotations().get(INTERFACE_NAME);
- intf = contract.getInterface(intfName);
-
- if (intf == null) {
- // Try localpart
- javax.xml.namespace.QName qname=javax.xml.namespace.QName.valueOf(intfName);
- intf = contract.getInterface(qname.getLocalPart());
- }
- } else if (contract.getInterfaces().size() > 0) {
- intf = contract.getInterfaces().iterator().next();
- }
- }
- }
-
- if (intf != null) {
- portType = intf.getName();
-
- prefix = bpelModel.getBPELProcess().addNamespace(intf.getNamespace());
-
- if (prefix != null) {
- portType = prefix+":"+portType;
- }
- }
-
- // Create variable
- //if (varName != null) {
- QName qname=null;
- if (InteractionUtil.isRequest(interaction)) {
- qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
- interaction.getMessageSignature().getOperation());
- } else if (InteractionPatterns.isFaultResponse(interaction)) {
- qname = WSDLGeneratorUtil.getFaultMessageType(contract.getNamespace(),
- InteractionPatterns.getFaultName(interaction));
- } else {
- qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
- interaction.getMessageSignature().getOperation());
- }
-
- varName = qname.getLocalPart()+"Var";
-
- org.jboss.savara.tools.bpel.model.component.Variable var=
- bpelModel.getBPELProcess().getVariable(varName);
-
- if (var == null) {
- var = new org.jboss.savara.tools.bpel.model.component.Variable(bpelModel);
- var.setName(varName);
-
- String mesgType=qname.getLocalPart();
-
- // Find namespace prefix
- if (qname.getNamespaceURI() != null) {
- String pfix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
-
- if (pfix != null) {
- mesgType = pfix+":"+mesgType;
- }
- }
-
- var.setMessageType(mesgType);
-
- bpelModel.getBPELProcess().addVariable(var, -1);
- }
- //}
-
- // Check if send or receive
- if (InteractionUtil.isSend(interaction)) {
-
- // TODO: Record variables against relevant interaction
- // based activity - probably only mechanism for
- // establishing message type
-
- if (InteractionUtil.isRequest(interaction)) {
-
- if (InteractionPatterns.isFaultHandlerRequired(interaction)) {
-
- Scope scope=new Scope(bpelModel);
-
- if (context.getParent() instanceof Sequence) {
- ((Sequence)context.getParent()).addActivity(scope, -1);
- }
-
- FaultHandlers fhs=new FaultHandlers(bpelModel);
-
- Sequence seq=new Sequence(bpelModel);
-
- scope.setActivity(seq);
- scope.setFaultHandlers(fhs);
-
- context.setParent(scope.getActivity());
- }
-
- act = new Invoke(bpelModel);
-
- pl.setPartnerRole(interaction.getToRole().getName()+"Requester");
- pl.setName(role.getName()+"To"+interaction.getToRole().getName());
-
- String plt=role.getName()+"To"+interaction.getToRole().getName()+"LT";
-
- if (mainPrefix != null) {
- plt = mainPrefix+":"+plt;
- }
-
- pl.setPartnerLinkType(plt);
-
- //portType = interaction.getToRole().getName()+"PT";
-
- if (varName != null) {
- ((Invoke)act).setInputVariable(varName);
- }
-
- } else {
- act = new Reply(bpelModel);
-
- pl.setMyRole(role.getName()+"Service");
- pl.setName(interaction.getToRole().getName()+"To"+role.getName());
-
- String plt=interaction.getToRole().getName()+"To"+role.getName()+"Service"+"LT";
-
- if (mainPrefix != null) {
- plt = mainPrefix+":"+plt;
- }
-
- pl.setPartnerLinkType(plt);
-
- //portType = role.getName()+"PT";
-
- if (InteractionPatterns.isFaultResponse(interaction)) {
- String faultName=InteractionPatterns.getFaultName(interaction);
-
- // Find namespace prefix
- //if (intf != null) {
- // String prefix=bpelModel.getBPELProcess().addNamespace(intf.getNamespace());
-
- if (prefix != null) {
- faultName = prefix+":"+faultName;
- }
- //}
-
- ((Reply)act).setFaultName(faultName);
- }
-
- if (varName != null) {
- ((Reply)act).setVariable(varName);
- }
- }
- } else if (InteractionPatterns.isResponseInFaultHandler(interaction) == false) {
-
- if (InteractionPatterns.isSyncNormalResponse(interaction)) {
-
- //System.out.println("ADD RESP VAR TO PRECEDING");
- if (context.getParent() instanceof Sequence) {
- java.util.List<BPELActivity> acts=
- ((Sequence)context.getParent()).getActivities();
-
- if (acts.size() > 0 &&
- acts.get(acts.size()-1) instanceof Invoke) {
- Invoke invoke=(Invoke)acts.get(acts.size()-1);
-
- invoke.setOutputVariable(varName);
- }
- }
-
- } else if (InteractionPatterns.isInteractionPickPathTrigger(interaction) == false) {
- act = new Receive(bpelModel);
-
- String intfName=(String)interaction.getAnnotations().get("interfaceName");
-
- if (intfName != null && intfName.trim().length() > 0) {
- intfName = javax.xml.namespace.QName.valueOf(intfName).getLocalPart();
- } else {
- intfName = role.getName();
- }
-
- if (InteractionUtil.isRequest(interaction)) {
-
- pl.setMyRole(intfName); //role.getName()+"Service");
- //pl.setPartnerRole(interaction.getToRole().getName());
- pl.setName(interaction.getFromRole().getName()+"To"+role.getName());
-
- String plt=interaction.getFromRole().getName()+"To"+role.getName()+"Service"+"LT";
-
- if (mainPrefix != null) {
- plt = mainPrefix+":"+plt;
- }
-
- pl.setPartnerLinkType(plt);
-
- //portType = role.getName()+"PT";
- } else {
- pl.setMyRole(intfName); //role.getName()+"Requester");
- pl.setPartnerRole(interaction.getFromRole().getName()+"Service");
- pl.setName(role.getName()+"To"+interaction.getFromRole().getName());
-
- String plt=role.getName()+"To"+interaction.getFromRole().getName()+"Requester"+"LT";
-
- if (mainPrefix != null) {
- plt = mainPrefix+":"+plt;
- }
-
- pl.setPartnerLinkType(plt);
-
- //portType = role.getName()+
- // interaction.getFromRole().getName()+"CallbackPT";
- }
-
- if (varName != null) {
- ((Receive)act).setVariable(varName);
- }
-
- // Check if create instance
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(interaction)) {
- ((Receive)act).setCreateInstance(true);
- }
- }
- }
-
- // TODO: Possibly if the channel is set, then
- // might be a callback channel, so could use
- // channel name to reflect callback port
-
- // TODO: If both myRole and partnerRole are specified
- // then one is a callback porttype
-
- if (act != null) {
-
- // Set the name
- act.setName(InteractionUtil.getName(interaction));
-
- if (context.getParent() instanceof Sequence) {
- ((Sequence)context.getParent()).addActivity(act, -1);
-
- ret = true;
- }
-
- // Create partner link
- PartnerLink other=
- bpelModel.getBPELProcess().getPartnerLink(pl.getName());
- if (other == null) {
- bpelModel.getBPELProcess().addPartnerLink(pl, -1);
- } else {
- if (other.getPartnerRole() == null &&
- pl.getPartnerRole() != null) {
- other.setPartnerRole(pl.getPartnerRole());
- }
- if (other.getMyRole() == null &&
- pl.getMyRole() != null) {
- other.setMyRole(pl.getMyRole());
- }
- }
-
- // Set details on interaction
- act.setPartnerLink(pl.getName());
-
- act.setPortType(portType);
-
- if (interaction.getMessageSignature() != null) {
- act.setOperation(interaction.getMessageSignature().getOperation());
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and modified model object.
- *
- * @param context The context
- * @param model The model
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isUpdateSupported(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
-
- if (fromObj instanceof ConversationInteraction &&
- toObj instanceof ConversationInteraction &&
- model instanceof BPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method modifies an existing model object, within a
- * parent model object, with the details supplied in
- * another model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the change has been applied
- */
- @Override
- public boolean update(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
- //BPELLanguageModel bpelModel=(BPELLanguageModel)model;
- //ConversationInteraction fromInteraction=(ConversationInteraction)fromObj;
- //ConversationInteraction toInteraction=(ConversationInteraction)toObj;
-
- return(ret);
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and deleted model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object to be removed
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isDeleteSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof ConversationInteraction &&
- super.isDeleteSupported(context, model, mobj)) {
- ret = true;
- }
-
- return(ret);
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,483 +0,0 @@
-/*
- * 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 javax.xml.namespace.QName;
-
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.jboss.savara.tools.bpel.model.util.InteractionUtil;
-import org.jboss.savara.wsdl.generator.WSDLGeneratorUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.jboss.savara.contract.model.Contract;
-import org.jboss.savara.contract.model.Interface;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the If.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class IfModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof org.scribble.conversation.model.If &&
- model instanceof DefaultBPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- org.scribble.conversation.model.If elem=
- (org.scribble.conversation.model.If)mobj;
- java.util.List<Block> paths=elem.getPaths();
-
- // Check if the 'If' construct is to handle responses
- // to a preceding request being sent
- if (InteractionPatterns.isResponseAndFaultHandler(elem)) {
-
- if (context.getParent() instanceof Sequence) {
- // Find fault handler
- Sequence seq=(Sequence)context.getParent();
- Scope scope=new Scope(bpelModel,
- (org.w3c.dom.Element)seq.getDOMElement().getParentNode());
- FaultHandlers fh=scope.getFaultHandlers();
-
- for (int i=0; i < paths.size(); i++) {
- Block path=paths.get(i);
-
- if (path.getContents().size() > 0) {
- Activity act=path.getContents().get(0);
- Sequence subseq=null;
-
- if (act instanceof Interaction &&
- InteractionPatterns.isFaultResponse(
- (Interaction)act)) {
- String faultName=InteractionPatterns.getFaultName((Interaction)act);
-
- Contract contract = ModelChangeUtils.getContract(context,
- ((Interaction)act).getFromRole().getName());
-
- // Define fault message type
- QName qname= WSDLGeneratorUtil.getFaultMessageType(contract.getNamespace(),
- faultName);
-
- String faultVarName=qname.getLocalPart()+"Var";
- String mesgType=InteractionPatterns.getMessageTypeLocalPart((Interaction)act);
- //String namespace=InteractionPatterns.getMessageTypeNameSpace((Interaction)act);
-
- Catch c=new Catch(bpelModel);
- c.setFaultVariable(faultVarName);
-
- // Find namespace prefix
- if (qname != null) {
- String prefix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
-
- if (prefix != null) {
- mesgType = prefix+":"+qname.getLocalPart();
- faultName = prefix+":"+faultName;
- }
- }
-
- c.setFaultName(faultName);
- c.setFaultMessageType(mesgType);
-
- // Add catch to fault handler
- fh.addCatch(c);
-
- subseq = new Sequence(bpelModel);
- c.setActivity(subseq);
- } else {
- subseq = seq;
-
- java.util.List<BPELActivity> acts=
- ((Sequence)context.getParent()).getActivities();
-
- if (acts.size() > 0 && act instanceof Interaction &&
- acts.get(acts.size()-1) instanceof Invoke) {
- Contract contract = ModelChangeUtils.getContract(context,
- ((Interaction)act).getFromRole().getName());
-
- QName qname=null;
- if (InteractionUtil.isRequest((Interaction)act)) {
- qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
- ((Interaction)act).getMessageSignature().getOperation());
- } else if (InteractionPatterns.isFaultResponse((Interaction)act)) {
- qname = WSDLGeneratorUtil.getFaultMessageType(contract.getNamespace(),
- InteractionPatterns.getFaultName((Interaction)act));
- } else {
- qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
- ((Interaction)act).getMessageSignature().getOperation());
- }
-
- String varName=qname.getLocalPart()+"Var"; //InteractionPatterns.getVariableName((Interaction)act);
- Invoke invoke=(Invoke)acts.get(acts.size()-1);
-
- invoke.setOutputVariable(varName);
-
- // Create variable
- if (varName != null) {
- createVariable(context, varName, (Interaction)act, bpelModel);
- }
- }
- }
-
- Object parent=context.getParent();
-
- context.setParent(subseq);
-
- for (int j=1; j < path.getContents().size(); j++) {
- context.insert(model, path.getContents().get(j), null);
- }
-
- context.setParent(parent);
- }
- }
- } else {
- // TODO: Error handling
- }
- } else if (InteractionPatterns.isSwitch(elem)) {
- Pick act=new Pick(bpelModel);
-
- if (context.getParent() instanceof Sequence) {
- ((Sequence)context.getParent()).addActivity(act, -1);
- }
-
- Role role=null;
-
- if (elem.getEnclosingDefinition() != null) {
- role = elem.getEnclosingDefinition().
- getLocatedName().getRole();
- }
-
- for (int i=0; i < paths.size(); i++) {
- Block path=paths.get(i);
-
- Sequence seq=new Sequence(bpelModel);
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=path.getContents();
-
- Object parent=context.getParent();
-
- context.setParent(seq);
-
- for (int j=0; j < acts.size(); j++) {
- context.insert(model, acts.get(j), null);
- }
-
- context.setParent(parent);
-
- Interaction recv=InteractionPatterns.getPickPathInteraction(path);
-
- OnMessage onm=new OnMessage(bpelModel);
- onm.setActivity(seq);
-
- PartnerLink pl=new PartnerLink(bpelModel);
- String portType=null;
-
- String prevPLName=role.getName()+"To"+recv.getFromRole().getName();
-
- String mainPrefix=null;
-
- Contract contract=ModelChangeUtils.getContract(context, context.getRole().getName());
- if (contract != null) {
- mainPrefix = bpelModel.getBPELProcess().addNamespace(contract.getNamespace());
- }
-
- // Check if partner link already exists in
- // other direction
- PartnerLink prev=
- bpelModel.getBPELProcess().getPartnerLink(prevPLName);
-
- if (InteractionUtil.isRequest(recv) && prev == null) {
-
- pl.setMyRole(role.getName()+"Service");
- //pl.setPartnerRole(interaction.getToRole().getName());
- pl.setName(recv.getFromRole().getName()+"To"+role.getName());
-
- String plt=recv.getFromRole().getName()+"To"+role.getName()+"Service"+"LT";
-
- if (mainPrefix != null) {
- plt = mainPrefix+":"+plt;
- }
-
- pl.setPartnerLinkType(plt);
-
- contract = ModelChangeUtils.getContract(context, role.getName());
-
- if (contract != null && contract.getInterfaces().size() > 0) {
- Interface intf = contract.getInterfaces().iterator().next();
-
- portType = intf.getName();
-
- String prefix = bpelModel.getBPELProcess().addNamespace(intf.getNamespace());
-
- if (prefix != null) {
- portType = prefix+":"+portType;
- }
- }
- } else {
- pl.setMyRole(role.getName()+"Requester");
- pl.setPartnerRole(recv.getFromRole().getName()+"Service");
- pl.setName(role.getName()+"To"+recv.getFromRole().getName());
-
- String plt=role.getName()+"To"+recv.getFromRole().getName()+"Requester"+"LT";
-
- if (mainPrefix != null) {
- plt = mainPrefix+":"+plt;
- }
-
- pl.setPartnerLinkType(plt);
-
- //portType = role.getName()+
- // recv.getFromRole().getName()+"CallbackPT";
-
- contract = ModelChangeUtils.getContract(context, recv.getFromRole().getName());
- if (contract != null && contract.getInterfaces().size() > 0) {
- Interface intf = contract.getInterfaces().iterator().next();
-
- portType = intf.getName();
-
- String prefix = bpelModel.getBPELProcess().addNamespace(intf.getNamespace());
-
- if (prefix != null) {
- portType = prefix+":"+portType;
- }
- }
- }
-
- QName qname=null;
- if (InteractionUtil.isRequest(recv)) {
- qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
- recv.getMessageSignature().getOperation());
- } else if (InteractionPatterns.isFaultResponse(recv)) {
- qname = WSDLGeneratorUtil.getFaultMessageType(contract.getNamespace(),
- InteractionPatterns.getFaultName(recv));
- } else {
- qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
- recv.getMessageSignature().getOperation());
- }
-
- String varName=qname.getLocalPart()+"Var"; //InteractionPatterns.getVariableName(recv);
-
- if (varName != null) {
- onm.setVariable(varName);
- }
-
- // Create partner link
- PartnerLink other=
- bpelModel.getBPELProcess().getPartnerLink(pl.getName());
-
- if (other == null) {
- bpelModel.getBPELProcess().addPartnerLink(pl, -1);
- } else {
- if (other.getPartnerRole() == null &&
- pl.getPartnerRole() != null) {
- other.setPartnerRole(pl.getPartnerRole());
- }
- if (other.getMyRole() == null &&
- pl.getMyRole() != null) {
- other.setMyRole(pl.getMyRole());
- }
- }
-
- // Create variable
- if (varName != null) {
- createVariable(context, varName, recv, bpelModel);
- }
-
- // Check if create instance
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(recv)) {
- act.setCreateInstance(true);
- }
-
- // Set details on interaction
- onm.setPartnerLink(pl.getName());
- onm.setPortType(portType);
-
- MessageSignature ms=recv.getMessageSignature();
- if (ms.getOperation() != null) {
- onm.setOperation(ms.getOperation());
- }
-
- act.addOnMessage(onm, -1);
- }
-
- } else {
- If act=new If(bpelModel);
-
- if (context.getParent() instanceof Sequence) {
- ((Sequence)context.getParent()).addActivity(act, -1);
- }
-
- for (int i=0; i < paths.size(); i++) {
- Block path=paths.get(i);
-
- Sequence seq=new Sequence(bpelModel);
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=path.getContents();
-
- Object parent=context.getParent();
-
- context.setParent(seq);
-
- for (int j=0; j < acts.size(); j++) {
- context.insert(model, acts.get(j), null);
- }
-
- context.setParent(parent);
-
- if (i == 0) {
- act.setActivity(seq);
- } else if (i == elem.getPaths().size()-1) {
- Else construct=new Else(bpelModel);
- construct.setActivity(seq);
-
- act.setElsePath(construct);
- } else {
- Elseif construct=new Elseif(bpelModel);
-
- construct.setActivity(seq);
-
- act.addElseIfPath(construct);
- }
- }
- }
-
- return(true);
- }
-
- /**
- * This method creates a variable, if one does not already exist for the
- * supplied name, with the message type associated with the supplied
- * interaction.
- *
- * @param varName The variable name
- * @param interaction The interaction associated with the variable
- * @param bpelModel The BPEL model
- */
- protected void createVariable(ModelChangeContext context, String varName,
- Interaction interaction, BPELLanguageModel bpelModel) {
- org.jboss.savara.tools.bpel.model.component.Variable var=
- bpelModel.getBPELProcess().getVariable(varName);
-
- if (var == null) {
- Role role=null;
-
- if (interaction.getEnclosingDefinition() != null) {
- role = interaction.getEnclosingDefinition().
- getLocatedName().getRole();
- }
-
- var = new org.jboss.savara.tools.bpel.model.component.Variable(bpelModel);
- var.setName(varName);
-
- Role roleType=null;
- Contract contract=null;
-
- if (InteractionUtil.isRequest(interaction)) {
- roleType = interaction.getToRole();
- if (roleType == null) {
- roleType = role;
- }
- } else {
- roleType = interaction.getFromRole();
- if (roleType == null) {
- roleType = role;
- }
- }
-
- if (roleType != null) {
- contract = ModelChangeUtils.getContract(context, roleType.getName());
- }
-
- QName qname=null;
- if (InteractionUtil.isRequest(interaction)) {
- qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
- interaction.getMessageSignature().getOperation());
- } else {
- qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
- interaction.getMessageSignature().getOperation());
- }
-
- String mesgType=qname.getLocalPart();
-
- // Find namespace prefix
- if (qname.getNamespaceURI() != null) {
- String pfix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
-
- if (pfix != null) {
- mesgType = pfix+":"+mesgType;
- }
- }
-
- var.setMessageType(mesgType);
-
- bpelModel.getBPELProcess().addVariable(var, -1);
- }
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/InteractionPatterns.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/InteractionPatterns.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/InteractionPatterns.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,382 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * This class provides utility functions for detecting
- * patterns related to interactions.
- */
-public class InteractionPatterns {
-
- private static final String FAULT_NAME = "faultName";
- private static final String MESSAGE_TYPE_LOCALPART = "messageTypeLocalPart";
- private static final String MESSAGE_TYPE_NAMESPACE = "messageTypeNameSpace";
-
- /**
- * This method checks whether the supplied interaction
- * is a request that requires a scope with associated
- * fault handlers.
- *
- * @param interaction The interaction
- * @return Whether the interaction is a request requiring
- * an outer fault handler
- */
- public static boolean isFaultHandlerRequired(org.scribble.model.Interaction interaction) {
- boolean ret=false;
-
- // Check if interaction is an invoke, and followed
- // by a choice representing a normal and multiple
- // fault responses
- if (InteractionUtil.isRequest(interaction) &&
- interaction.getRequestLabel() != null) {
-
- if (interaction.getParent() instanceof
- org.scribble.model.Block) {
- org.scribble.model.Block block=
- (org.scribble.model.Block)interaction.getParent();
-
- int pos=block.getContents().indexOf(interaction);
-
- if (pos != -1 && pos < block.getContents().size()-1) {
- org.scribble.model.Activity act=
- block.getContents().get(pos+1);
-
- if (act instanceof org.scribble.conversation.model.If) {
-
- // Need to check if each path receives a
- // response (normal and fault)
- org.scribble.conversation.model.If choice=
- (org.scribble.conversation.model.If)act;
-
- if (choice.getPaths().size() > 0) {
- ret = true;
- }
-
- for (int i=0; ret &&
- i < choice.getPaths().size(); i++) {
-
- org.scribble.model.Block path=
- choice.getPaths().get(i);
-
- if (path.getContents().size() == 0 ||
- (path.getContents().get(0) instanceof Interaction) == false ||
- InteractionUtil.isRequest((Interaction)
- path.getContents().get(0))) {
- ret = false;
- }
- }
- }
- }
- }
- }
-
- return(ret);
- }
-
- // TODO: Method to detect if normal response, which needs
- // to enhance the invoke (and subsequent activities following
- // the invoke), or a fault response needing to
- // place itself and subsequent activities in a fault handler.
- // Methods need to return (and set) the relevant sequence
- // to use for subsequent activities.
-
- public static boolean isResponseAndFaultHandler(If choice) {
- boolean ret=false;
-
- // Obtain interaction prior to 'If'
- if (choice.getPaths().size() > 0 &&
- choice.getParent() instanceof
- org.scribble.model.Block) {
- org.scribble.model.Block block=
- (org.scribble.model.Block)choice.getParent();
-
- int pos=block.getContents().indexOf(choice);
-
- if (pos != -1 && pos > 0) {
- org.scribble.model.Activity act=
- block.getContents().get(pos-1);
-
- if (act instanceof Interaction &&
- InteractionUtil.isSend((Interaction)act) &&
- InteractionUtil.isRequest((Interaction)act) &&
- ((Interaction)act).getRequestLabel() != null) {
-
- // Check if each path has a response/fault associated
- // with the preceding request
- String requestLabel=
- ((Interaction)act).getRequestLabel();
-
- java.util.List<Block> paths=choice.getPaths();
- int matched=0;
-
- for (int i=0; i < paths.size(); i++) {
- if (paths.get(i).getContents().size() > 0) {
- Interaction in=getPickPathInteraction(paths.get(i));
-
- if (in != null &&
- InteractionUtil.isResponse(in) &&
- in.getReplyToLabel().equals(requestLabel)) {
- matched++;
- }
- }
- }
-
- if (matched == paths.size()) {
- ret = true;
- }
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method obtains the interaction that triggers a
- * specified path in a BPEL pick activity.
- *
- * @param path The path
- * @return The interaction that triggers the path in
- * the pick activity
- */
- public static Interaction getPickPathInteraction(Block path) {
- Interaction ret=null;
-
- // TODO: This method is the opposite of the
- // 'isInteractionPickPathTrigger', so needs to be
- // updated to reflect any changes to that method
-
- if (path.getContents().size() > 0) {
- org.scribble.model.Activity sub=
- path.getContents().get(0);
-
- // Check if scope
- if (sub instanceof Compose) {
- Definition defn=((Compose)sub).getDefinition();
- org.scribble.model.Behaviour b=null;
-
- for (int j=0; b == null &&
- j < defn.getBlock().getContents().size(); j++) {
- if (defn.getBlock().getContents().get(j) instanceof org.scribble.model.Behaviour) {
- b = (org.scribble.model.Behaviour)
- defn.getBlock().getContents().get(j);
- }
- }
-
- if (b != null) {
- sub = b;
- }
- }
-
- if (sub instanceof Interaction) {
- ret = (Interaction)sub;
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied interaction
- * is the trigger interaction within a BPEL pick activity.
- *
- * @param in The interaction
- * @return Whether the interaction is a pick trigger activity
- */
- public static boolean isInteractionPickPathTrigger(Interaction in) {
- boolean ret=false;
-
- // TODO: Need to determine all situations and ensure
- // is generic enough to cope with extensions to Scribble
- // model
-
- Block path=(Block)in.getParent();
-
- if (path.getParent() instanceof If &&
- InteractionPatterns.isSwitch((If)path.getParent())) {
- ret = true;
-
- // Check if receive is directly contained within a
- // sub-definition
- } else if (InteractionUtil.isSend(in) == false &&
- path.getParent() instanceof org.scribble.model.Definition &&
- path.getParent().getParent() instanceof Block &&
- path.getParent().getParent().getParent() instanceof
- org.scribble.model.Definition) {
- ret = true;
- }
-
- return(ret);
- }
-
- public static boolean isSwitch(If choice) {
- boolean ret=false;
-
- if (choice.getPaths().size() > 0) {
- java.util.List<Block> paths=choice.getPaths();
- int matched=0;
-
- for (int i=0; i < paths.size(); i++) {
- if (paths.get(i).getContents().size() > 0) {
- Interaction in=getPickPathInteraction(paths.get(i));
-
- if (in != null &&
- InteractionUtil.isSend(in) == false) {
- matched++;
- }
- }
- }
-
- if (matched == paths.size()) {
- ret = true;
- }
- }
-
- return(ret);
- }
-
- public static Interaction getRequestForResponseInFaultHandler(Interaction interaction) {
- Interaction ret=null;
-
- if (InteractionUtil.isRequest(interaction) == false &&
- interaction.getReplyToLabel() != null) {
-
- // Find if contained in 'if' path
- if (interaction.getParent() instanceof Block &&
- interaction.getParent().getParent() instanceof If) {
-
- If choice=(If)interaction.getParent().getParent();
-
- // Obtain interaction prior to 'If'
- if (choice.getParent() instanceof
- org.scribble.model.Block) {
- org.scribble.model.Block block=
- (org.scribble.model.Block)choice.getParent();
-
- int pos=block.getContents().indexOf(choice);
-
- if (pos != -1 && pos > 0) {
- org.scribble.model.Activity act=
- block.getContents().get(pos-1);
-
- if (act instanceof Interaction &&
- InteractionUtil.isRequest((Interaction)act) &&
- ((Interaction)act).getRequestLabel() != null &&
- interaction.getReplyToLabel().equals(
- ((Interaction)act).getRequestLabel())) {
- ret = (Interaction)act;
- }
- }
- }
- }
- }
-
- return(ret);
- }
-
- public static boolean isResponseInFaultHandler(Interaction interaction) {
- return(getRequestForResponseInFaultHandler(interaction) != null);
- }
-
- public static boolean isFaultResponse(Interaction interaction) {
- boolean ret=false;
-
- if (InteractionUtil.isRequest(interaction) == false &&
- interaction.getMessageSignature().getAnnotations().
- keySet().contains(FAULT_NAME)) {
- ret = true;
- }
-
- return(ret);
- }
-
- public static String getFaultName(Interaction interaction) {
- return((String)interaction.
- getMessageSignature().getAnnotations().get(FAULT_NAME));
- }
-
- public static String getMessageTypeLocalPart(Interaction interaction) {
- return((String)interaction.
- getMessageSignature().getAnnotations().get(MESSAGE_TYPE_LOCALPART));
- }
-
- public static String getMessageTypeNameSpace(Interaction interaction) {
- return((String)interaction.
- getMessageSignature().getAnnotations().get(MESSAGE_TYPE_NAMESPACE));
- }
-
- /*
- public static String getVariableName(Interaction interaction) {
- String varName=getMessageTypeLocalPart(interaction);
-
- if (varName != null) {
- int ind=varName.lastIndexOf('}');
-
- if (ind != -1) {
- varName = varName.substring(ind+1);
- }
-
- varName += "Var";
-
- if (Character.isLowerCase(varName.charAt(0)) == false) {
- varName = Character.toLowerCase(varName.charAt(0))+
- varName.substring(1);
- }
- }
-
- return(varName);
- }
- */
-
- public static boolean isSyncNormalResponse(Interaction interaction) {
- boolean ret=false;
-
- if (InteractionUtil.isResponse(interaction) &&
- interaction.getParent() instanceof Block) {
- Block block=(Block)interaction.getParent();
-
- int pos=block.getContents().indexOf(interaction);
-
- if (pos > 0 && block.getContents().get(pos-1) instanceof Interaction) {
- Interaction req=(Interaction)block.getContents().get(pos-1);
-
- ret = isResponseForRequest(interaction, req);
- }
- }
-
- return(ret);
- }
-
- public static boolean isResponseForRequest(Interaction resp,
- Interaction req) {
- boolean ret=false;
-
- if (InteractionUtil.isRequest(req) &&
- InteractionUtil.isResponse(resp) &&
- resp.getReplyToLabel().equals(
- req.getRequestLabel())) {
- ret = true;
- }
-
- return(ret);
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/LanguageToConversationModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/LanguageToConversationModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/LanguageToConversationModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,100 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.model.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Language Model to
- * Conversation Model.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class LanguageToConversationModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof ConversationModel &&
- model instanceof BPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ConversationModel cm=(ConversationModel)mobj;
-
- if (cm.getConversation() != null) {
- ModelChangeUtils.addContracts(context, cm.getConversation(), true);
-
- context.insert(model, cm.getConversation(), null);
-
- ModelChangeUtils.removeContracts(context, cm.getConversation(), true);
- }
-
- return(true);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtils.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtils.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ModelChangeUtils.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,239 +0,0 @@
-/*
- * 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.model.*;
-import org.scribble.model.change.*;
-import org.jboss.savara.contract.model.Contract;
-import org.scribble.conversation.model.*;
-
-/**
- * Model change utilities.
- */
-public class ModelChangeUtils {
-
- /**
- * This method adds any contracts associated with roles defined in the
- * supplied conversation.
- *
- * @param context The context
- * @param conv The conversation
- * @param root Whether this is the root conversation
- */
- @SuppressWarnings("unchecked")
- public static void addContracts(ModelChangeContext context, Conversation conv, boolean root) {
-
- java.util.Map<String,Contract> contracts=(java.util.Map<String,Contract>)
- context.getProperties().get(Contract.class.getName());
-
- if (contracts == null) {
- contracts = new java.util.HashMap<String, Contract>();
-
- context.getProperties().put(Contract.class.getName(), contracts);
- }
-
- if (conv.getLocatedName().getRole() != null && root) {
- addRoleContract(conv.getLocatedName().getRole(), contracts);
- }
-
- // Get list of roles
- java.util.List<Role> roles=getRoles(conv);
-
- for (Role r : roles) {
- addRoleContract(r, contracts);
- }
- }
-
- // NOTE: Return all the roles defined in the scope of this conversation
- // Would be better to incrementally add contracts for roles, as defined
- // in their own scope, but need to refactor how blocks are dealt with
- // first - which is different in some cases, so not straightforward.
- protected static java.util.List<Role> getRoles(final Conversation conv) {
- final java.util.List<Role> roles=new java.util.Vector<Role>();
-
- conv.visit(new Visitor() {
-
- public boolean visit(ModelObject obj) {
- boolean ret=true;
-
- if (obj instanceof RoleList) {
- roles.addAll(((RoleList)obj).getRoles());
- } else if (obj instanceof Conversation &&
- obj != conv) {
- ret = false;
- }
-
- return(ret);
- }
- });
-
- return(roles);
- }
-
- /**
- * This method initializes the contract associated with the supplied role.
- *
- * @param role The role
- * @param contracts The map of roles to contracts
- */
- protected static void addRoleContract(Role role, java.util.Map<String,Contract> contracts) {
- if (role != null && role.getAnnotations().containsKey(Contract.class.getName())) {
- contracts.put(role.getName(),
- (Contract)role.getAnnotations().get(Contract.class.getName()));
- }
- }
-
- /**
- * This method removes the contract associated with the supplied role.
- *
- * @param role The role
- * @param contracts The map of roles to contracts
- */
- protected static void removeRoleContract(Role role, java.util.Map<String,Contract> contracts) {
- if (role != null && role.getAnnotations().containsKey(Contract.class.getName())) {
- contracts.remove(role.getName());
- }
- }
-
- /**
- * This method removes any contracts associated with roles defined in the
- * supplied conversation.
- *
- * @param context The context
- * @param conv The conversation
- * @param root Whether this is the root conversation
- */
- @SuppressWarnings("unchecked")
- public static void removeContracts(ModelChangeContext context, Conversation conv, boolean root) {
-
- java.util.Map<String,Contract> contracts=(java.util.Map<String,Contract>)
- context.getProperties().get(Contract.class.getName());
-
- if (contracts != null) {
-
- if (conv.getLocatedName().getRole() != null && root) {
- removeRoleContract(conv.getLocatedName().getRole(), contracts);
- }
-
- // Get list of roles
- java.util.List<Role> roles=getRoles(conv);
-
- for (Role r : roles) {
- removeRoleContract(r, contracts);
- }
- }
- }
-
- /**
- * This method returns the contract associated with the supplied role.
- *
- * @param contezt The context
- * @param roleName The role name
- * @return The contract, or null if not found
- */
- @SuppressWarnings("unchecked")
- public static Contract getContract(ModelChangeContext context, String roleName) {
- Contract ret=null;
-
- if (context.getProperties().containsKey(Contract.class.getName())) {
- java.util.Map<String,Contract> contracts=
- (java.util.Map<String,Contract>)
- context.getProperties().get(Contract.class.getName());
-
- ret = contracts.get(roleName);
- }
-
- return(ret);
- }
-
- /**
- * This method updates the role mapping based on the supplied list of
- * declaration bindings.
- *
- * @param context The context
- * @param run The run construct
- */
- @SuppressWarnings("unchecked")
- public static void pushRoleContractMapping(ModelChangeContext context,
- Compose run) {
-
- if (context.getProperties().containsKey(Contract.class.getName())) {
- java.util.Map<String,Contract> contracts=
- (java.util.Map<String,Contract>)
- context.getProperties().get(Contract.class.getName());
-
- if (run.getEnclosingDefinition().getLocatedName().getRole() != null &&
- run.getDefinition().getLocatedName().getRole() != null) {
- Contract c=contracts.remove(run.getEnclosingDefinition().getLocatedName().getRole().getName());
-
- if (c != null) {
- contracts.put(run.getDefinition().getLocatedName().getRole().getName(), c);
- }
- }
-
- for (DeclarationBinding db : run.getBindings()) {
- if (db.getDeclaration() instanceof Role) {
- Contract c=contracts.remove(db.getDeclaration().getName());
-
- if (c != null) {
- contracts.put(db.getBoundName(), c);
- }
- }
- }
-
- }
- }
-
- /**
- * This method resets the role mapping based on the supplied list of
- * declaration bindings.
- *
- * @param context The context
- * @param run The run construct
- */
- @SuppressWarnings("unchecked")
- public static void popRoleContractMapping(ModelChangeContext context,
- Compose run) {
-
- if (context.getProperties().containsKey(Contract.class.getName())) {
- java.util.Map<String,Contract> contracts=
- (java.util.Map<String,Contract>)
- context.getProperties().get(Contract.class.getName());
-
- if (run.getEnclosingDefinition().getLocatedName().getRole() != null &&
- run.getDefinition().getLocatedName().getRole() != null) {
- Contract c=contracts.remove(run.getDefinition().getLocatedName().getRole().getName());
-
- if (c != null) {
- contracts.put(run.getEnclosingDefinition().getLocatedName().getRole().getName(), c);
- }
- }
-
- for (DeclarationBinding db : run.getBindings()) {
- if (db.getDeclaration() instanceof Role) {
- Contract c=contracts.remove(db.getBoundName());
-
- if (c != null) {
- contracts.put(db.getDeclaration().getName(), c);
- }
- }
- }
-
- }
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/RunModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/RunModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/RunModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,106 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Run.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class RunModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Run &&
- model instanceof DefaultBPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- Run elem=(Run)mobj;
-
- if (elem.getDefinition() != null) {
-
- ModelChangeUtils.pushRoleContractMapping(context, elem);
-
- ModelChangeUtils.addContracts(context, elem.getDefinition(), false);
-
- context.insert(bpelModel, elem.getDefinition(), ref);
-
- ModelChangeUtils.removeContracts(context, elem.getDefinition(), false);
-
- ModelChangeUtils.popRoleContractMapping(context, elem);
- }
-
- return(true);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/SpawnModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/SpawnModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/SpawnModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,105 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Run.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class SpawnModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Spawn &&
- model instanceof DefaultBPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- Spawn elem=(Spawn)mobj;
-
- if (elem.getDefinition() != null) {
- ModelChangeUtils.pushRoleContractMapping(context, elem);
-
- ModelChangeUtils.addContracts(context, elem.getDefinition(), false);
-
- context.insert(bpelModel, elem.getDefinition(), ref);
-
- ModelChangeUtils.removeContracts(context, elem.getDefinition(), false);
-
- ModelChangeUtils.popRoleContractMapping(context, elem);
- }
-
- return(true);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhenModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhenModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhenModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,108 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the When.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class WhenModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof When &&
- model instanceof DefaultBPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- When elem=(When)mobj;
-
- // TODO: Need to decide best way to deal with single
- // and multi-path when constructs.
-
- if (elem.getPaths().size() == 1) {
- // Single path - so ignore it for now
- Block path=elem.getPaths().get(0);
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=path.getContents();
-
- for (int i=0; i < acts.size(); i++) {
- context.insert(model, acts.get(i), null);
- }
- }
-
- return(true);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhileModelChangeRule.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhileModelChangeRule.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/WhileModelChangeRule.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,117 +0,0 @@
-/*
- * 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.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.component.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the While.
- */
- at RegistryInfo(extension=ModelChangeRule.class,notation=BPELNotation.NOTATION_CODE)
-public class WhileModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof org.scribble.conversation.model.While &&
- model instanceof DefaultBPELLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- org.scribble.conversation.model.While elem=
- (org.scribble.conversation.model.While)mobj;
-
- While act=new While(bpelModel);
-
- Sequence seq=new Sequence(bpelModel);
-
- if (context.getParent() instanceof Sequence) {
- ((Sequence)context.getParent()).addActivity(act, -1);
- }
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=elem.getBlock().getContents();
-
- Object parent=context.getParent();
-
- context.setParent(seq);
-
- for (int i=0; i < acts.size(); i++) {
- context.insert(model, acts.get(i), null);
- }
-
- act.setActivity(seq);
-
- // Reset old parent
- context.setParent(parent);
-
- return(true);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractCondition.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractCondition.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractCondition.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,126 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the BPEL condition element.
- */
-public abstract class AbstractCondition extends BPELElement {
-
- private static final long serialVersionUID = 178873060670041144L;
-
- private static final String EXPRESSION_LANGUAGE = "expressionLanguage";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public AbstractCondition(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elemName The condition's element name
- */
- public AbstractCondition(BPELLanguageModel model, String elemName) {
- super(model, elemName);
- }
-
- /**
- * This method returns the expression associated
- * with the condition.
- *
- * @return The expression
- */
- public String getExpression() {
- String ret=null;
-
- getDOMElement().normalize();
-
- if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
- org.w3c.dom.Text text=(org.w3c.dom.Text)
- getDOMElement().getFirstChild();
-
- ret = text.getNodeValue();
- }
-
- return(ret);
- }
-
- /**
- * This method sets the expression.
- *
- * @param expr The expression
- */
- public void setExpression(String expr) {
-
- getDOMElement().normalize();
-
- if (getDOMElement().getFirstChild() == null) {
- org.w3c.dom.Text text=
- getDOMElement().getOwnerDocument().createTextNode(expr);
-
- getDOMElement().appendChild(text);
-
- } else if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
- org.w3c.dom.Text text=(org.w3c.dom.Text)
- getDOMElement().getFirstChild();
-
- text.setNodeValue(expr);
- }
- }
-
- /**
- * This method returns the expression language associated
- * with the condition.
- *
- * @return The expression language
- */
- public String getExpressionLanguage() {
- return(getDOMElement().hasAttribute(EXPRESSION_LANGUAGE)?
- getDOMElement().getAttribute(EXPRESSION_LANGUAGE):null);
- }
-
- /**
- * This method sets the expression language.
- *
- * @param lang The expression language
- */
- public void setExpressionLanguage(String lang) {
- getDOMElement().setAttribute(EXPRESSION_LANGUAGE, lang);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteraction.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteraction.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/AbstractInteraction.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,159 +0,0 @@
-/*
- * 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 javax.xml.namespace.QName;
-
-import org.scribble.model.TypeReference;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents an abstract interaction activity.
- *
- * @author gary
- */
-public abstract class AbstractInteraction extends BPELActivity {
-
- private static final String PARTNER_LINK = "partnerLink";
- private static final String PORT_TYPE = "portType";
- private static final String OPERATION = "operation";
-
- private static final long serialVersionUID = -5048477859609625462L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public AbstractInteraction(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public AbstractInteraction(BPELLanguageModel model,
- String name) {
- super(model, name);
- }
-
- /**
- * This method sets the operation.
- *
- * @param op The operation
- */
- public void setOperation(String op) {
- getDOMElement().setAttribute(OPERATION, op);
- }
-
- /**
- * This method returns the operation.
- *
- * @return The operation
- */
- public String getOperation() {
- return(getDOMElement().hasAttribute(OPERATION)?
- getDOMElement().getAttribute(OPERATION):null);
- }
-
- /**
- * This method sets the partner link.
- *
- * @param pl The partner link
- */
- public void setPartnerLink(String pl) {
- getDOMElement().setAttribute(PARTNER_LINK, pl);
- }
-
- /**
- * This method returns the partner link.
- *
- * @return The partner link
- */
- public String getPartnerLink() {
- return(getDOMElement().hasAttribute(PARTNER_LINK)?
- getDOMElement().getAttribute(PARTNER_LINK):null);
- }
-
- /**
- * This method sets the port type.
- *
- * @param pt The port type
- */
- public void setPortType(String pt) {
- getDOMElement().setAttribute(PORT_TYPE, pt);
- }
-
- /**
- * This method returns the port type.
- *
- * @return The port type
- */
- public String getPortType() {
- return(getDOMElement().hasAttribute(PORT_TYPE)?
- getDOMElement().getAttribute(PORT_TYPE):null);
- }
-
- /**
- * This method attempts to identify the client's partner role name.
- *
- * @return The partner role
- */
- protected String getClientPartnerRole() {
- String ret=getPartnerLink();
- int index=-1;
-
- if (ret != null && (index=ret.indexOf("To")) != -1) {
- ret = ret.substring(index+2);
- }
-
- return(ret);
- }
-
- /**
- * This method attempts to identify the server's partner role name.
- *
- * @return The partner role
- */
- protected String getServerPartnerRole() {
- String ret=getPartnerLink();
- int index=-1;
-
- if (ret != null && (index=ret.indexOf("To")) != -1) {
- ret = ret.substring(0, index);
- }
-
- return(ret);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivity.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivity.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELActivity.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,405 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the base class for all BPEL
- * activities.
- */
-public abstract class BPELActivity extends BPELElement {
-
- private static final String SOURCES = "sources";
-
- private static final String TARGETS = "targets";
-
- private static final String SUPPRESS_JOIN_FAILURE = "suppressJoinFailure";
-
- private static final String NAME = "name";
-
- private static final long serialVersionUID = 2885165314780298048L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public BPELActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- org.w3c.dom.Element targets=findChildElement(TARGETS);
-
- if (targets != null) {
- org.w3c.dom.NodeList nl=targets.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getLocalName().equals(Target.TARGET)
- && nl.item(i) instanceof org.w3c.dom.Element) {
- m_targets.add(new Target(model,
- (org.w3c.dom.Element)nl.item(i)));
- }
- }
- }
-
- org.w3c.dom.Element sources=findChildElement(SOURCES);
-
- if (sources != null) {
- org.w3c.dom.NodeList nl=sources.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getLocalName().equals(Source.SOURCE)
- && nl.item(i) instanceof org.w3c.dom.Element) {
- m_sources.add(new Source(model,
- (org.w3c.dom.Element)nl.item(i)));
- }
- }
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public BPELActivity(BPELLanguageModel model,
- String name) {
- super(model, name);
- }
-
- /**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
- * This method sets the name.
- *
- * @param name The name
- */
- public void setName(String name) {
- getDOMElement().setAttribute(NAME, name);
- }
-
- /**
- * This method returns the name.
- *
- * @return The name
- */
- public String getName() {
- return(getDOMElement().hasAttribute(NAME)?
- getDOMElement().getAttribute(NAME):null);
- }
-
- /**
- * This method sets the 'suppress join failure'
- * attribute.
- *
- * @param b Whether to suppress join failure
- */
- public void setSuppressJoinFailure(boolean b) {
- String suppress=(b?"yes":"no");
-
- getDOMElement().setAttribute(SUPPRESS_JOIN_FAILURE, suppress);
- }
-
- /**
- * This method returns whether the join should
- * be suppressed.
- *
- * @return Whether the join should be suppressed
- */
- public boolean getSuppressJoinFailure() {
- boolean ret=false;
- String suppress=
- getDOMElement().getAttribute(SUPPRESS_JOIN_FAILURE);
-
- if (suppress != null &&
- suppress.equals("yes")) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a target to the activity.
- *
- * @param target The target to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addTarget(Target target, int pos) {
-
- org.w3c.dom.Element targets=null;
-
- if (m_targets.size() == 0) {
- targets = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, TARGETS);
-
- if (getDOMElement().getFirstChild() == null) {
- getDOMElement().appendChild(targets);
- } else {
- getDOMElement().insertBefore(targets,
- getDOMElement().getFirstChild());
- }
- } else {
- targets = findChildElement(TARGETS);
- }
-
- org.w3c.dom.Node newNode=target.getDOMElement().cloneNode(true);
-
- getDOMElement().getOwnerDocument().adoptNode(newNode);
-
- target.setDOMElement((org.w3c.dom.Element)newNode);
-
- if (pos == -1 && pos < m_targets.size()) {
- m_targets.add(target);
-
- targets.appendChild(newNode);
- } else {
-
- Target cur=m_targets.get(pos);
-
- m_targets.add(pos, target);
-
- if (cur != null) {
- targets.insertBefore(newNode,
- cur.getDOMElement());
- } else {
- targets.appendChild(newNode);
- }
- }
- }
-
- /**
- * This method removes a target from the activity.
- *
- * @param target The target to be removed
- * @return Whether the target was removed
- */
- public boolean removeTarget(Target target) {
- boolean ret=m_targets.remove(target);
-
- if (ret) {
- org.w3c.dom.Element targets=
- findChildElement(TARGETS);
-
- if (targets != null) {
- targets.removeChild(target.getDOMElement());
-
- if (m_targets.size() == 0) {
- getDOMElement().removeChild(targets);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of targets associated
- * with the activity.
- *
- * @return The list of targets
- */
- public java.util.List<Target> getTargets() {
- return(m_targets);
- }
-
- /**
- * This method adds a source to the activity.
- *
- * @param source The source to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addSource(Source source, int pos) {
-
- org.w3c.dom.Element sources=null;
-
- if (m_sources.size() == 0) {
- sources = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, SOURCES);
-
- if (getDOMElement().getFirstChild() == null) {
- getDOMElement().appendChild(sources);
- } else {
- getDOMElement().insertBefore(sources,
- getDOMElement().getFirstChild());
- }
- } else {
- sources = findChildElement(SOURCES);
- }
-
- org.w3c.dom.Node newNode=source.getDOMElement().cloneNode(true);
-
- getDOMElement().getOwnerDocument().adoptNode(newNode);
-
- source.setDOMElement((org.w3c.dom.Element)newNode);
-
- if (pos == -1 && pos < m_sources.size()) {
- m_sources.add(source);
-
- sources.appendChild(newNode);
- } else {
-
- Source cur=m_sources.get(pos);
-
- m_sources.add(pos, source);
-
- if (cur != null) {
- sources.insertBefore(newNode,
- cur.getDOMElement());
- } else {
- sources.appendChild(newNode);
- }
- }
- }
-
- /**
- * This method removes a source from the activity.
- *
- * @param source The source to be removed
- * @return Whether the source was removed
- */
- public boolean removesource(Source source) {
- boolean ret=m_sources.remove(source);
-
- if (ret) {
- org.w3c.dom.Element sources=
- findChildElement(SOURCES);
-
- if (sources != null) {
- sources.removeChild(source.getDOMElement());
-
- if (m_sources.size() == 0) {
- getDOMElement().removeChild(sources);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of sources associated
- * with the activity.
- *
- * @return The list of sources
- */
- public java.util.List<Source> getSources() {
- return(m_sources);
- }
-
- /**
- * This method converts the BPEL activity into an equivalent
- * behavioural description for conformance checking.
- *
- * @param activities The list of activities that will contain
- * the converted action(s)
- * @param context The conversion context
- */
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- if (getTargets().size() > 0) {
-
- // Create 'when' construct to wait for inbound links
- // to be satisfied
- org.scribble.expression.xpath.model.XPathExpression expr=
- new org.scribble.expression.xpath.model.XPathExpression();
-
- String query="";
-
- for (int i=0; i < getTargets().size(); i++) {
- if (i > 0) {
- query += " and ";
- }
- query += "$"+getTargets().get(i).getLinkName();
- }
-
- expr.setQuery(query);
-
- org.scribble.conversation.model.When elem=
- new org.scribble.conversation.model.When();
-
- org.scribble.conversation.model.ConditionalBlock block=
- new org.scribble.conversation.model.ConditionalBlock();
- block.setExpression(expr);
-
- elem.getConditionalBlocks().add(block);
-
- activities.add(elem);
-
- activities = block.getContents();
- }
-
- convertActivity(activities, context);
-
- // If sources, then set boolean variable
- for (int i=0; i < getSources().size(); i++) {
-
- org.scribble.conversation.model.Assignment assign=
- new org.scribble.conversation.model.Assignment();
-
- org.scribble.conversation.model.Variable var=
- new org.scribble.conversation.model.Variable();
-
- var.setName(getSources().get(i).getLinkName());
-
- assign.setVariable(var);
-
- org.scribble.expression.xpath.model.XPathExpression expr=
- new org.scribble.expression.xpath.model.XPathExpression();
-
- expr.setQuery("true()");
- assign.setExpression(expr);
-
- activities.add(assign);
- }
- }
-
- /**
- * 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 abstract void convertActivity(java.util.List<Activity> activities,
- ConversionContext context);
-
- private java.util.List<Target> m_targets=
- new java.util.Vector<Target>();
- private java.util.List<Source> m_sources=
- new java.util.Vector<Source>();
-}
Deleted: 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-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElement.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,404 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.apache.commons.logging.*;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.util.XMLUtils;
-
-/**
- * This is the generic BPEL element class.
- *
- * @author gary
- */
-public abstract class BPELElement extends ModelObject {
-
- public static final String BPEL_NS = "http://docs.oasis-open.org/wsbpel/2.0/process/executable";
-
- private static final long serialVersionUID = -7306844554703224704L;
-
- /**
- * The constructor for initializing the BPEL element based on
- * an existing DOM element.
- */
- protected BPELElement(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- m_model = model;
-
- m_element = elem;
-
- // Set the start/end position information
- // in the source details
- XMLUtils.setStartAndEndPosition(this, model.getOriginalContents(), elem);
-
- getSource().setObject(this);
- }
-
- /**
- * The contructor for initializing a new element.
- */
- protected BPELElement(BPELLanguageModel model,
- String elemName) {
- m_model = model;
-
- org.w3c.dom.Document doc=null;
-
- if (model.getBPELProcess() == null) {
- try {
- javax.xml.parsers.DocumentBuilderFactory factory=
- javax.xml.parsers.DocumentBuilderFactory.
- newInstance();
- factory.setNamespaceAware(true);
-
- doc = factory.newDocumentBuilder().newDocument();
- } catch(Exception e) {
- logger.error("Failed to create document", e);
- }
- } else {
- doc = model.getBPELProcess().getDOMElement().
- getOwnerDocument();
- }
-
- m_element = doc.createElementNS(BPEL_NS, elemName);
-
- getSource().setObject(this);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l) {
- }
-
- /**
- * This method returns the XML configuration representation
- * of the activity.
- *
- * @return The XML configuration for the BPEL node
- */
- public org.w3c.dom.Element getDOMElement() {
- return(m_element);
- }
-
- /**
- * This method sets the XML configuration representation
- * of the activity.
- *
- * @param elem The XML configuration
- */
- protected void setDOMElement(org.w3c.dom.Element elem) {
- m_element = elem;
- }
-
- /**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- public boolean isActivity() {
- return(false);
- }
-
- /**
- * This method returns the model.
- *
- * @return The model
- */
- protected BPELLanguageModel getModel() {
- return(m_model);
- }
-
- /**
- * This method returns the BPEL process in which the BPEL element
- * is contained.
- *
- * @return The BPEL process, or null if not found
- */
- protected Process getProcess() {
- Process ret=null;
- ModelObject cur=this;
-
- while (ret == null && cur != null) {
- if (cur instanceof Process) {
- ret = (Process)cur;
- } else {
- cur = cur.getParent();
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the element associated with
- * the supplied name.
- *
- * @param name The name
- * @return The element, or null if not found
- */
- public org.w3c.dom.Element findChildElement(String name) {
- org.w3c.dom.Element ret=null;
-
- org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- n.getLocalName() != null &&
- n.getLocalName().equals(name)) {
- ret = (org.w3c.dom.Element)nl.item(i);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the first child BPEL activity
- * found within the DOM element.
- *
- * @return The child BPEL activity, or null if not found
- */
- public BPELActivity findChildActivity() {
- BPELActivity ret=null;
-
- org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
-
- for (int i=0; ret == null &&
- i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- BPELElement elem = BPELElementFactory.createBPELElement(m_model,
- (org.w3c.dom.Element)nl.item(i));
-
- if (elem != null && elem.isActivity() &&
- elem instanceof BPELActivity) {
- ret = (BPELActivity)elem;
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the child elements that conform to
- * the supplied class.
- *
- * @param cls The class
- * @return The list of child elements of the type specified
- * by the supplied class
- */
- public java.util.List<BPELElement> findChildElements(Class<? extends BPELElement> cls) {
- return(findChildElements(getDOMElement(), cls));
- }
-
- /**
- * This method returns the child elements that conform to
- * the supplied class.
- *
- * @param root The root element
- * @param cls The class
- * @return The list of child elements of the type specified
- * by the supplied class
- */
- 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>();
-
- org.w3c.dom.NodeList nl=root.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
-
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- BPELElement elem=BPELElementFactory.createBPELElement(m_model,
- (org.w3c.dom.Element)nl.item(i));
-
- if (elem != null &&
- cls.isAssignableFrom(elem.getClass())) {
- ret.add(elem);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method sets a new element. If an existing element
- * is specified, then it is replaced with the new element.
- * Otherwise if an insertBefore node is specified, then
- * the new element is inserted before it. If no existing
- * or insertBefore parameters are specified, then the
- * new element will be appended.<b>
- * <b>
- * The new BPEL element will be updated to be associated
- * with a DOM element that is adopted by the document
- * into which it is being added.
- *
- * @param existing The optional existing element to be
- * replaced
- * @param newelem The new element
- * @param insertBefore Optional location to insert new element
- */
- public void setChildElement(org.w3c.dom.Element existing,
- BPELElement newelem, org.w3c.dom.Node insertBefore) {
-
- setChildElement(getDOMElement(), existing, newelem, insertBefore);
- }
-
- /**
- * This method sets a new element. If an existing element
- * is specified, then it is replaced with the new element.
- * Otherwise if an insertBefore node is specified, then
- * the new element is inserted before it. If no existing
- * or insertBefore parameters are specified, then the
- * new element will be appended.<b>
- * <b>
- * The new BPEL element will be updated to be associated
- * with a DOM element that is adopted by the document
- * into which it is being added.
- *
- * @param root The root element to add child to
- * @param existing The optional existing element to be
- * replaced
- * @param newelem The new element
- * @param insertBefore Optional location to insert new element
- */
- public void setChildElement(org.w3c.dom.Element root,
- org.w3c.dom.Element existing,
- BPELElement newelem, org.w3c.dom.Node insertBefore) {
-
- if (newelem != null) {
- org.w3c.dom.Node newNode=newelem.getDOMElement().cloneNode(true);
-
- root.getOwnerDocument().adoptNode(newNode);
-
- newelem.setDOMElement((org.w3c.dom.Element)newNode);
-
- if (existing != null) {
- root.replaceChild(newNode, existing);
- } else if (insertBefore != null) {
- root.insertBefore(newNode, insertBefore);
- } else {
- root.appendChild(newNode);
- }
- }
- }
-
- /**
- * This method converts the BPEL activity into an equivalent
- * behavioural description for conformance checking.
- *
- * @param activities The list of activities that will contain
- * the converted action(s)
- * @param context The conversion context
- */
- public abstract void convert(java.util.List<Activity> activities,
- ConversionContext context);
-
- /**
- * This method returns the URI fragment to the activity within the
- * BPEL model.
- *
- * @return The URI
- */
- public String getURI() {
- String ret="";
-
- BPELElement parent=null;
-
- if (getParent() != null) {
- if (getParent() instanceof BPELElement) {
- parent = (BPELElement)getParent();
- }
- } else if (getDOMElement().getParentNode() instanceof org.w3c.dom.Element) {
- parent = BPELElementFactory.createBPELElement(getModel(),
- (org.w3c.dom.Element)getDOMElement().getParentNode());
- }
-
- if (parent != null) {
- ret = parent.getParentURI(this);
- }
-
- return(ret);
- }
-
- /**
- * This method recursively builds up the URI using the local URI
- * parts for each BPEL element up to the root node.
- *
- * @param elem The child element
- * @return The URI for the parent element
- */
- protected String getParentURI(BPELElement elem) {
- String ret="";
-
- BPELElement parent=null;
-
- if (getParent() != null) {
- if (getParent() instanceof BPELElement) {
- parent = (BPELElement)getParent();
- }
- } else if (elem.getDOMElement().getParentNode() instanceof org.w3c.dom.Element) {
- parent = BPELElementFactory.createBPELElement(getModel(),
- (org.w3c.dom.Element)getDOMElement().getParentNode());
- }
-
- if (parent != null) {
- ret = parent.getParentURI(this)+"/"+getLocalURIPart(elem);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the URI part associated with the supplied child element.
- *
- * @param elem The child element
- * @return The URI part
- */
- protected String getLocalURIPart(BPELElement elem) {
- return("");
- }
-
- public int hashCode() {
- return(m_element.hashCode());
- }
-
- public boolean equals(Object obj) {
- boolean ret=false;
-
- if (obj instanceof BPELElement) {
- ret = m_element.equals(((BPELElement)obj).getDOMElement());
- }
-
- return(ret);
- }
-
- private static Log logger = LogFactory.getLog(BPELElement.class);
-
- private BPELLanguageModel m_model=null;
- private org.w3c.dom.Element m_element=null;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementFactory.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementFactory.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELElementFactory.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,68 +0,0 @@
-/*
- * 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.apache.commons.logging.*;
-import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
-
-public class BPELElementFactory {
-
- public static final String MODEL_COMPONENTS_PACKAGE =
- "org.jboss.savara.tools.bpel.model.component";
-
- /**
- * This method creates a BPELElement instance relevant to the
- * supplied JBossESB action, associated with the supplied
- * service.
- *
- * @param model The BPEL model
- * @param elem The XML configuration of the BPEL activity
- * @return The BPEL element instance
- */
- public static BPELElement createBPELElement(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- BPELElement ret=null;
- String activityType=elem.getNodeName();
-
- // Make first character capitalised
- char ch=Character.toUpperCase(activityType.charAt(0));
-
- activityType = ch+activityType.substring(1);
-
- String clsName=MODEL_COMPONENTS_PACKAGE+"."+activityType;
-
- try {
- Class<?> cls=(Class<?>)
- Class.forName(clsName);
-
- java.lang.reflect.Constructor<?> con=
- cls.getConstructor(new Class<?>[]{BPELLanguageModel.class,
- org.w3c.dom.Element.class});
-
- ret = (BPELElement)con.newInstance(new Object[]{model, elem});
-
- } catch(Exception e) {
- logger.warn("Unable to find BPEL element class '"+
- clsName+"'");
- }
-
- return(ret);
- }
-
- private static Log logger = LogFactory.getLog(BPELElementFactory.class);
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELGroupingConstruct.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELGroupingConstruct.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/BPELGroupingConstruct.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,72 +0,0 @@
-/*
- * 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.apache.commons.logging.*;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This is the generic BPEL activity class.
- *
- * @author gary
- */
-public abstract class BPELGroupingConstruct extends BPELActivity {
-
- private static final long serialVersionUID = -5550042312010190598L;
-
- /**
- * The constructor for initializing the activity based on
- * an existing DOM element.
- */
- protected BPELGroupingConstruct(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The contructor for initializing a new activity.
- */
- protected BPELGroupingConstruct(BPELLanguageModel model,
- String activityName) {
- super(model, activityName);
- }
-
- /**
- * This method sets the contained activity.
- *
- * @param act The contained activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- getDOMElement().appendChild(act.getDOMElement());
- }
-
- /**
- * This method returns the contained activity.
- *
- * @return The contained activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- private static Log logger = LogFactory.getLog(BPELGroupingConstruct.class);
-
- private BPELElement m_activity=null;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Catch.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Catch.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Catch.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,187 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'catch' construct contained
- * within the 'faultHandlers' element.
- */
-public class Catch extends BPELElement {
-
- private static final long serialVersionUID = 8191152745680660045L;
-
- public static final String CATCH="catch";
-
- private static final String FAULT_NAME = "faultName";
- private static final String FAULT_VARIABLE = "faultVariable";
- private static final String FAULT_MESSAGE_TYPE = "faultMessageType";
- private static final String FAULT_MESSAGE_ELEMENT = "faultMessageElement";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public Catch(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Catch(BPELLanguageModel model) {
- super(model, CATCH);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // Catch is not directly converted, only its contents indirectly as
- // a fault response in a scope
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELActivity act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELActivity getActivity() {
- return(m_activity);
- }
-
- /**
- * This method sets the fault name.
- *
- * @param faultName The fault name
- */
- public void setFaultName(String faultName) {
- getDOMElement().setAttribute(FAULT_NAME, faultName);
- }
-
- /**
- * This method returns the fault name.
- *
- * @return The fault name
- */
- public String getFaultName() {
- return(getDOMElement().hasAttribute(FAULT_NAME)?
- getDOMElement().getAttribute(FAULT_NAME):null);
- }
-
- /**
- * This method sets the fault variable.
- *
- * @param faultVariable The fault variable
- */
- public void setFaultVariable(String faultVariable) {
- getDOMElement().setAttribute(FAULT_VARIABLE, faultVariable);
- }
-
- /**
- * This method returns the fault variable.
- *
- * @return The fault variable
- */
- public String getFaultVariable() {
- return(getDOMElement().hasAttribute(FAULT_VARIABLE)?
- getDOMElement().getAttribute(FAULT_VARIABLE):null);
- }
-
- /**
- * This method sets the fault message type.
- *
- * @param faultName The fault message type
- */
- public void setFaultMessageType(String faultMessageType) {
- getDOMElement().setAttribute(FAULT_MESSAGE_TYPE, faultMessageType);
- }
-
- /**
- * This method returns the fault message type.
- *
- * @return The fault message type
- */
- public String getFaultMessageType() {
- return(getDOMElement().hasAttribute(FAULT_MESSAGE_TYPE)?
- getDOMElement().getAttribute(FAULT_MESSAGE_TYPE):null);
- }
-
- /**
- * This method sets the fault message element.
- *
- * @param faultName The fault message element
- */
- public void setFaultMessageElement(String faultMessageElement) {
- getDOMElement().setAttribute(FAULT_MESSAGE_ELEMENT, faultMessageElement);
- }
-
- /**
- * This method returns the fault message element.
- *
- * @return The fault message element
- */
- public String getFaultMessageElement() {
- return(getDOMElement().hasAttribute(FAULT_MESSAGE_ELEMENT)?
- getDOMElement().getAttribute(FAULT_MESSAGE_ELEMENT):null);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private BPELActivity m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CatchAll.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CatchAll.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CatchAll.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,106 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'catchAll' construct contained
- * within the 'faultHandlers' element.
- */
-public class CatchAll extends BPELElement {
-
- private static final long serialVersionUID = 975038289163694699L;
-
- public static final String CATCHALL="catchAll";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public CatchAll(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public CatchAll(BPELLanguageModel model) {
- super(model, CATCHALL);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELActivity act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELActivity getActivity() {
- return(m_activity);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private BPELActivity m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandler.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandler.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/CompensationHandler.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,96 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'compensationHandler' construct contained
- * within the 'scope' activity.
- */
-public class CompensationHandler extends BPELElement {
-
- private static final long serialVersionUID = -1994083560689296558L;
-
- public static final String COMPENSATIONHANDLER="compensationHandler";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public CompensationHandler(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public CompensationHandler(BPELLanguageModel model) {
- super(model, COMPENSATIONHANDLER);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- private BPELElement m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Condition.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Condition.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Condition.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,51 +0,0 @@
-/*
- * 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;
-
-/**
- * This class represents the BPEL condition element.
- */
-public class Condition extends AbstractCondition {
-
- private static final long serialVersionUID = 8666349106632652777L;
-
- public static final String CONDITION="condition";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public Condition(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Condition(BPELLanguageModel model) {
- super(model, CONDITION);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ConversionContext.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ConversionContext.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ConversionContext.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,77 +0,0 @@
-/*
- * 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.scribble.model.admin.Context;
-
-public interface ConversionContext {
-
- /**
- * This method returns a reference to the environment context.
- *
- * @return The environment context
- */
- public Context getEnvironmentContext();
-
- /**
- * This method returns the process.
- *
- * @return The process
- */
- public Process getProcess();
-
- /**
- * This method returns the role associated with the
- * endpoint being converted.
- *
- *@return The role
- */
- public String getRole();
-
- /**
- * This method returns the variable associated with the
- * supplied name.
- *
- * @param name The name
- * @return The variable, or null if not found
- */
- public Variable getVariable(String name);
-
- /**
- * This method adds a variable to the context.
- *
- * @param var The variable
- */
- public void addVariable(Variable var);
-
- /**
- * This method removes a variable from the context.
- *
- * @param var The variable
- */
- public void removeVariable(Variable var);
-
- /**
- * This method returns the namespace for the supplied prefix.
- *
- * @param prefix The prefix
- * @return The namespace, or null if not found
- */
- public String getNamespace(String prefix);
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/DefaultConversionContext.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/DefaultConversionContext.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/DefaultConversionContext.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,114 +0,0 @@
-/*
- * 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.scribble.model.admin.Context;
-
-/**
- * This class provides a default implementation of the conversation
- * context.
- */
-public class DefaultConversionContext implements ConversionContext {
-
- /**
- * This is the constructor for the conversion context, initialised
- * with the role being played by the converted BPEL process.
- *
- * @param role The role
- * @param proc The process
- * @param envContext The environment context
- */
- public DefaultConversionContext(String role, Process proc, Context envContext) {
- m_role = role;
- m_process = proc;
- m_environmentContext = envContext;
- }
-
- /**
- * This method returns a reference to the environment context.
- *
- * @return The environment context
- */
- public Context getEnvironmentContext() {
- return(m_environmentContext);
- }
-
- /**
- * This method returns the process.
- *
- * @return The process
- */
- public Process getProcess() {
- return(m_process);
- }
-
- /**
- * This method returns the role associated with the
- * endpoint being converted.
- *
- *@return The role
- */
- public String getRole() {
- return(m_role);
- }
-
- /**
- * This method returns the variable associated with the
- * supplied name.
- *
- * @param name The name
- * @return The variable, or null if not found
- */
- public Variable getVariable(String name) {
- return(m_variables.get(name));
- }
-
- /**
- * This method adds a variable to the context.
- *
- * @param var The variable
- */
- public void addVariable(Variable var) {
- m_variables.put(var.getName(), var);
- }
-
- /**
- * This method removes a variable from the context.
- *
- * @param var The variable
- */
- public void removeVariable(Variable var) {
- m_variables.remove(var.getName());
- }
-
- /**
- * This method returns the namespace for the supplied prefix.
- *
- * @param prefix The prefix
- * @return The namespace, or null if not found
- */
- public String getNamespace(String prefix) {
- return(m_process.getNamespace(prefix));
- }
-
- private String m_role=null;
- private Process m_process=null;
- private Context m_environmentContext=null;
- private java.util.Map<String,Variable> m_variables=
- new java.util.HashMap<String,Variable>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Else.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Else.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Else.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,108 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'else' construct contained
- * within the 'if' activity.
- */
-public class Else extends BPELElement {
-
- private static final long serialVersionUID = 1243775332210724718L;
-
- public static final String ELSE="else";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public Else(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Else(BPELLanguageModel model) {
- super(model, ELSE);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
-
- if (getActivity() != null) {
- getActivity().convert(activities, context);
- }
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private BPELElement m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Elseif.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Elseif.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Elseif.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,139 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'elseif' construct contained
- * within the 'if' activity.
- */
-public class Elseif extends BPELElement {
-
- private static final long serialVersionUID = 6371029130621912170L;
-
- public static final String ELSEIF="elseif";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public Elseif(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- org.w3c.dom.Element cond=
- findChildElement(Condition.CONDITION);
-
- if (cond == null) {
- m_condition = new Condition(model);
- } else {
- m_condition = new Condition(model, cond);
- }
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Elseif(BPELLanguageModel model) {
- super(model, ELSEIF);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
-
- if (getActivity() != null) {
- getActivity().convert(activities, context);
- }
- }
-
- /**
- * This method sets the condition.
- *
- * @param cond The condition
- */
- public void setCondition(Condition cond) {
- m_condition = cond;
-
- setChildElement(findChildElement(Condition.CONDITION),
- cond, getDOMElement().getFirstChild());
- }
-
- /**
- * This method returns the condition.
- *
- * @return The condition
- */
- public Condition getCondition() {
- return(m_condition);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private Condition m_condition;
- private BPELElement m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlers.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlers.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/EventHandlers.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,230 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents the 'eventHandlers' component within
- * a 'scope' element.
- *
- * @author gary
- */
-public class EventHandlers extends BPELElement {
-
- private static final long serialVersionUID = 118381918664522750L;
-
- public static final String EVENTHANDLERS = "eventHandlers";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public EventHandlers(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- java.util.List<BPELElement> onevts=
- findChildElements(OnEvent.class);
-
- for (int i=0; i < onevts.size(); i++) {
- if (onevts.get(i) instanceof OnEvent) {
- m_onEvents.add((OnEvent)onevts.get(i));
- }
- }
-
- java.util.List<BPELElement> onalrms=
- findChildElements(OnAlarm.class);
-
- for (int i=0; i < onalrms.size(); i++) {
- if (onalrms.get(i) instanceof OnAlarm) {
- m_onAlarms.add((OnAlarm)onalrms.get(i));
- }
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public EventHandlers(BPELLanguageModel model) {
- super(model, EVENTHANDLERS);
- }
-
- /**
- * This method adds an 'onEvent' to the grouping construct.
- *
- * @param on The 'onEvent' to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addOnEvent(OnEvent on, int pos) {
- if (pos == -1 || pos >= m_onEvents.size()) {
- m_onEvents.add(on);
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_onAlarms.size() > 0) {
- insertBefore = m_onAlarms.get(0).getDOMElement();
- }
-
- setChildElement(null, on, insertBefore);
- } else {
-
- OnEvent cur=m_onEvents.get(pos);
-
- m_onEvents.add(pos, on);
-
- if (cur != null) {
- setChildElement(null, on,
- cur.getDOMElement());
- } else {
- org.w3c.dom.Element insertBefore=null;
-
- if (m_onAlarms.size() > 0) {
- insertBefore = m_onAlarms.get(0).getDOMElement();
- }
-
- setChildElement(null, on, insertBefore);
- }
- }
- }
-
- /**
- * This method removes an 'onEvent' from the grouping
- * construct.
- *
- * @param on The 'onEvent' to be removed
- * @return Whether the 'onEvent' was removed
- */
- public boolean removeOnEvent(OnEvent on) {
- boolean ret=m_onEvents.remove(on);
-
- if (ret) {
- getDOMElement().removeChild(on.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of 'onEvent' associated
- * with the grouping construct.
- *
- * @return The list of 'onEvent' elements
- */
- public java.util.List<OnEvent> getOnEvents() {
- return(m_onEvents);
- }
-
- /**
- * This method adds an 'onAlarm' to the grouping construct.
- *
- * @param on The 'onAlarm' to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addOnAlarm(OnAlarm on, int pos) {
- if (pos == -1 || pos >= m_onAlarms.size()) {
- m_onAlarms.add(on);
-
- setChildElement(null, on, null);
- } else {
-
- OnAlarm cur=m_onAlarms.get(pos);
-
- m_onAlarms.add(pos, on);
-
- if (cur != null) {
- setChildElement(null, on,
- cur.getDOMElement());
- } else {
- setChildElement(null, on, null);
- }
- }
- }
-
- /**
- * This method removes an 'onAlarm' from the grouping
- * construct.
- *
- * @param on The 'onAlarm' to be removed
- * @return Whether the 'onAlarm' was removed
- */
- public boolean removeOnAlarm(OnAlarm on) {
- boolean ret=m_onAlarms.remove(on);
-
- if (ret) {
- getDOMElement().removeChild(on.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of 'onAlarm' associated
- * with the grouping construct.
- *
- * @return The list of 'onAlarm' elements
- */
- public java.util.List<OnAlarm> getOnAlarms() {
- return(m_onAlarms);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * This method converts the BPEL activity into an equivalent
- * behavioural description for conformance checking.
- *
- * @param activities The list of activities that will contain
- * the converted action(s)
- * @param context The conversion context
- */
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof OnEvent) {
- ret += "@onEvent."+getOnEvents().indexOf(elem);
- } else if (elem instanceof OnAlarm) {
- ret += "@onAlarm."+getOnAlarms().indexOf(elem);
- }
-
- return(ret);
- }
-
- private java.util.List<OnEvent> m_onEvents=
- new java.util.Vector<OnEvent>();
- private java.util.List<OnAlarm> m_onAlarms=
- new java.util.Vector<OnAlarm>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Exit.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Exit.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Exit.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,82 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents the exit activity.
- *
- * @author gary
- */
-public class Exit extends BPELActivity {
-
- private static final long serialVersionUID = -5261386654111234711L;
-
- public static final String EXIT = "exit";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Exit(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Exit(BPELLanguageModel model) {
- super(model, EXIT);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlers.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlers.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/FaultHandlers.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,148 +0,0 @@
-/*
- * 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.apache.commons.logging.*;
-import org.jboss.savara.tools.bpel.model.BPELLanguageModel;
-import org.scribble.model.Activity;
-
-/**
- * This class represents the 'faultHandlers' construct contained
- * within the 'scope' activity.
- */
-public class FaultHandlers extends BPELElement {
-
- private static final long serialVersionUID = 4136137332367247503L;
-
- public static final String FAULTHANDLERS="faultHandlers";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public FaultHandlers(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- java.util.List<BPELElement> paths=
- findChildElements(Catch.class);
-
- for (int i=0; i < paths.size(); i++) {
- m_catchPaths.add((Catch)paths.get(i));
- }
-
- paths = findChildElements(CatchAll.class);
-
- if (paths.size() > 0) {
- m_catchAll = (CatchAll)paths.get(0);
-
- if (paths.size() > 1) {
- logger.error("BPEL 'faultHandlers' has multiple 'catchAll' constructs");
- }
- }
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public FaultHandlers(BPELLanguageModel model) {
- super(model, FAULTHANDLERS);
- }
-
- /**
- * This method adds a 'catch' path.
- *
- * @param act The 'catch' path
- */
- public void addCatch(Catch act) {
- m_catchPaths.add(act);
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_catchAll != null) {
- insertBefore = m_catchAll.getDOMElement();
- }
-
- setChildElement(null, act,
- insertBefore);
- }
-
- /**
- * This method returns the list of 'catch' paths.
- *
- * @return The list of 'catch' paths
- */
- public java.util.List<Catch> getCatchPaths() {
- return(m_catchPaths);
- }
-
- /**
- * This method sets the 'catchAll' path.
- *
- * @param act The 'catchAll' path
- */
- public void setCatchAll(CatchAll act) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_catchAll != null) {
- existingElem = m_catchAll.getDOMElement();
- }
-
- m_catchAll = act;
-
- setChildElement(existingElem, act,
- null);
- }
-
- /**
- * This method returns the 'catchAll' path.
- *
- * @return The 'catchAll' path
- */
- public CatchAll getCatchAll() {
- return(m_catchAll);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof Catch) {
- ret += "@catch."+getCatchPaths().indexOf(elem);
- } else if (elem instanceof CatchAll) {
- ret += "@catchAll";
- }
-
- return(ret);
- }
-
- private static Log logger=LogFactory.getLog(FaultHandlers.class);
-
- private CatchAll m_catchAll=null;
- private java.util.List<Catch> m_catchPaths=
- new java.util.Vector<Catch>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Flow.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Flow.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Flow.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,287 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents a flow grouping activity.
- *
- */
-public class Flow extends BPELActivity {
-
- private static final long serialVersionUID = -5165269453306785719L;
-
- public static final String FLOW = "flow";
- public static final String LINKS = "links";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Flow(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- org.w3c.dom.Element links=findChildElement("links");
-
- if (links != null) {
- org.w3c.dom.NodeList nl=links.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getLocalName().equals(Link.LINK)
- && nl.item(i) instanceof org.w3c.dom.Element) {
- m_links.add(new Link(model,
- (org.w3c.dom.Element)nl.item(i)));
- }
- }
- }
-
- java.util.List<BPELElement> acts=
- findChildElements(BPELActivity.class);
-
- for (int i=0; i < acts.size(); i++) {
- if (acts.get(i).isActivity() &&
- acts.get(i) instanceof BPELActivity) {
- m_activities.add((BPELActivity)acts.get(i));
- }
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Flow(BPELLanguageModel model) {
- super(model, FLOW);
- }
-
- /**
- * This method adds a link to the grouping construct.
- *
- * @param link The link to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addLink(Link link, int pos) {
-
- org.w3c.dom.Element links=null;
-
- if (m_links.size() == 0) {
- links = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, LINKS);
-
- if (getDOMElement().getFirstChild() == null) {
- getDOMElement().appendChild(links);
- } else {
- getDOMElement().insertBefore(links,
- getDOMElement().getFirstChild());
- }
- } else {
- links = findChildElement(LINKS);
- }
-
- org.w3c.dom.Node newNode=link.getDOMElement().cloneNode(true);
-
- getDOMElement().getOwnerDocument().adoptNode(newNode);
-
- link.setDOMElement((org.w3c.dom.Element)newNode);
-
- if (pos == -1 && pos < m_links.size()) {
- m_links.add(link);
-
- links.appendChild(newNode);
- } else {
-
- Link cur=m_links.get(pos);
-
- m_links.add(pos, link);
-
- if (cur != null) {
- links.insertBefore(newNode,
- cur.getDOMElement());
- } else {
- links.appendChild(newNode);
- }
- }
- }
-
- /**
- * This method removes a link from the grouping
- * construct.
- *
- * @param link The link to be removed
- * @return Whether the link was removed
- */
- public boolean removeLink(Link link) {
- boolean ret=m_links.remove(link);
-
- if (ret) {
- org.w3c.dom.Element links=
- findChildElement(LINKS);
-
- if (links != null) {
- links.removeChild(link.getDOMElement());
-
- if (m_links.size() == 0) {
- getDOMElement().removeChild(links);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of links associated
- * with the grouping construct.
- *
- * @return The list of links
- */
- public java.util.List<Link> getLinks() {
- return(m_links);
- }
-
- /**
- * This method adds an activity to the grouping construct.
- *
- * @param act The activity to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addActivity(BPELActivity act, int pos) {
- if (pos == -1 && pos < m_activities.size()) {
- m_activities.add(act);
-
- setChildElement(null, act, null);
- } else {
-
- BPELActivity cur=m_activities.get(pos);
-
- m_activities.add(pos, act);
-
- if (cur != null) {
- setChildElement(null, act,
- cur.getDOMElement());
- } else {
- setChildElement(null, act, null);
- }
- }
- }
-
- /**
- * This method removes an activity from the grouping
- * construct.
- *
- * @param act The activity to be removed
- * @return Whether the activity was removed
- */
- public boolean removeActivity(BPELActivity act) {
- boolean ret=m_activities.remove(act);
-
- if (ret) {
- getDOMElement().removeChild(act.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of activities associated
- * with the grouping construct.
- *
- * @return The list of activities
- */
- public java.util.List<BPELActivity> getActivities() {
- return(m_activities);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- // If links have been defined, represent them as boolean
- // variables that can be tested using a 'when' clause
- if (getLinks().size() > 0) {
- org.scribble.conversation.model.VariableList vl=
- new org.scribble.conversation.model.VariableList();
-
- org.scribble.model.TypeReference tref=
- new org.scribble.model.TypeReference();
- tref.setLocalpart("boolean");
-
- vl.setType(tref);
-
- for (int i=0; i < getLinks().size(); i++) {
- Link l=getLinks().get(i);
-
- org.scribble.conversation.model.Variable var=
- new org.scribble.conversation.model.Variable();
-
- var.setName(l.getName());
-
- vl.getVariables().add(var);
- }
-
- activities.add(vl);
- }
-
- org.scribble.conversation.model.Parallel parallel=
- new org.scribble.conversation.model.Parallel();
-
- for (int i=0; i < getActivities().size(); i++) {
- Block b=new Block();
-
- getActivities().get(i).convert(b.getContents(), context);
-
- parallel.getBlocks().add(b);
- }
-
- activities.add(parallel);
- }
-
- private java.util.List<Link> m_links=
- new java.util.Vector<Link>();
- private java.util.List<BPELActivity> m_activities=
- new java.util.Vector<BPELActivity>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/For.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/For.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/For.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,50 +0,0 @@
-/*
- * 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;
-
-/**
- * This class represents the BPEL 'for' element.
- */
-public class For extends AbstractCondition {
-
- private static final long serialVersionUID = -3123540793706121742L;
-
- public static final String FOR="for";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public For(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public For(BPELLanguageModel model) {
- super(model, FOR);
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ForEach.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ForEach.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ForEach.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,124 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents a forEach grouping activity.
- *
- * @author gary
- */
-public class ForEach extends BPELGroupingConstruct {
-
- private static final long serialVersionUID = -4302270930464272401L;
-
- public static final String FOREACH = "forEach";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public ForEach(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- org.w3c.dom.Element scopeElem=
- findChildElement(Scope.SCOPE);
-
- if (scopeElem == null) {
- m_scope = new Scope(model);
- } else {
- m_scope = new Scope(model, scopeElem);
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public ForEach(BPELLanguageModel model) {
- super(model, FOREACH);
- }
-
- /**
- * This method sets the scope.
- *
- * @param scope The scope
- */
- public void setScope(Scope scope) {
- m_scope = scope;
-
- org.w3c.dom.Element existingElem=this.findChildElement(Scope.SCOPE);
-
- setChildElement(existingElem, scope,
- null);
- }
-
- /**
- * This method returns the scope.
- *
- * @return The scope
- */
- public Scope getScope() {
- return(m_scope);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof Scope) {
- ret += "@scope";
- }
-
- return(ret);
- }
-
- private Scope m_scope=null;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/If.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/If.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/If.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,290 +0,0 @@
-/*
- * 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.scribble.conversation.model.ConditionalBlock;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.apache.commons.logging.*;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents an 'if' grouping construct.
- *
- * @author gary
- */
-public class If extends BPELActivity {
-
- private static final long serialVersionUID = -763221632866464831L;
-
- public static final String IF = "if";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public If(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- org.w3c.dom.Element cond=
- findChildElement(Condition.CONDITION);
-
- if (cond == null) {
- m_condition = new Condition(model);
- } else {
- m_condition = new Condition(model, cond);
- }
-
- m_activity = findChildActivity();
-
- java.util.List<BPELElement> paths=
- findChildElements(Elseif.class);
-
- for (int i=0; i < paths.size(); i++) {
- m_elseIfPaths.add((Elseif)paths.get(i));
- }
-
- paths = findChildElements(Else.class);
-
- if (paths.size() > 0) {
- m_elsePath = (Else)paths.get(0);
-
- if (paths.size() > 1) {
- logger.error("BPEL 'if' has multiple 'else' constructs");
- }
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public If(BPELLanguageModel model) {
- super(model, IF);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- org.scribble.conversation.model.If elem=
- new org.scribble.conversation.model.If();
-
- ConditionalBlock cb=new ConditionalBlock();
-
- // TODO: Convert the conditional expression
-
- if (getActivity() != null) {
- getActivity().convert(cb.getContents(), context);
- }
-
- elem.getConditionalBlocks().add(cb);
-
- // Convert 'else if' paths
- for (int i=0; i < getElseIfPaths().size(); i++) {
- Elseif elseIfElem=getElseIfPaths().get(i);
-
- cb = new ConditionalBlock();
-
- elseIfElem.convert(cb.getContents(), context);
-
- elem.getConditionalBlocks().add(cb);
- }
-
- // Convert 'else' path
- if (getElsePath() != null) {
- cb = new ConditionalBlock();
-
- getElsePath().convert(cb.getContents(), context);
-
- elem.getConditionalBlocks().add(cb);
- }
-
- activities.add(elem);
- }
-
- /**
- * This method sets the condition.
- *
- * @param cond The condition
- */
- public void setCondition(Condition cond) {
- m_condition = cond;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_activity != null) {
- insertBefore = m_activity.getDOMElement();
- } else if (m_elseIfPaths.size() > 0) {
- insertBefore = m_elseIfPaths.get(0).getDOMElement();
- } else if (m_elsePath != null) {
- insertBefore = m_elsePath.getDOMElement();
- }
-
- setChildElement(findChildElement(Condition.CONDITION),
- cond, insertBefore);
- }
-
- /**
- * This method returns the condition.
- *
- * @return The condition
- */
- public Condition getCondition() {
- return(m_condition);
- }
-
- /**
- * This method sets the main 'if' activity.
- *
- * @param act The activity associated with the 'if'
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_elseIfPaths.size() > 0) {
- insertBefore = m_elseIfPaths.get(0).getDOMElement();
- } else if (m_elsePath != null) {
- insertBefore = m_elsePath.getDOMElement();
- }
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'if' path.
- *
- * @return The 'if' activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- /**
- * This method adds an 'else if' path.
- *
- * @param act The 'else if' path
- */
- public void addElseIfPath(Elseif act) {
- m_elseIfPaths.add(act);
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_elsePath != null) {
- insertBefore = m_elsePath.getDOMElement();
- }
-
- setChildElement(null, act,
- insertBefore);
- }
-
- /**
- * This method returns the list of 'else if' paths.
- *
- * @return The list of 'else if' paths
- */
- public java.util.List<Elseif> getElseIfPaths() {
- return(m_elseIfPaths);
- }
-
- /**
- * This method sets the 'else' path.
- *
- * @param act The 'else' path
- */
- public void setElsePath(Else act) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_elsePath != null) {
- existingElem = m_elsePath.getDOMElement();
- }
-
- m_elsePath = act;
-
- setChildElement(existingElem, act,
- null);
- }
-
- /**
- * This method returns the 'else' path.
- *
- * @return The 'else' path
- */
- public Else getElsePath() {
- return(m_elsePath);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof Elseif) {
- int pos=getElseIfPaths().indexOf(elem);
- ret = "@elseif."+pos;
- } else if (elem instanceof Else) {
- ret = "@else";
- } else {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private static Log logger=LogFactory.getLog(If.class);
-
- private Condition m_condition=null;
- private BPELElement m_activity=null;
- private Else m_elsePath=null;
- private java.util.List<Elseif> m_elseIfPaths=
- new java.util.Vector<Elseif>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Import.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Import.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Import.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,120 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'import' construct.
- */
-public class Import extends BPELElement {
-
- private static final long serialVersionUID = -7103589689575940289L;
-
- private static final String IMPORT_TYPE = "importType";
- private static final String NAMESPACE = "namespace";
- private static final String LOCATION = "location";
-
- public static final String IMPORT="import";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public Import(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Import(BPELLanguageModel model) {
- super(model, IMPORT);
- }
-
- /**
- * This method sets the import type.
- *
- * @param importType The import type
- */
- public void setImportType(String importType) {
- getDOMElement().setAttribute(IMPORT_TYPE, importType);
- }
-
- /**
- * This method returns the iport type.
- *
- * @return The import type
- */
- public String getImportType() {
- return(getDOMElement().hasAttribute(IMPORT_TYPE)?
- getDOMElement().getAttribute(IMPORT_TYPE):null);
- }
-
- /**
- * This method sets the namespace.
- *
- * @param ns The namespace
- */
- public void setNamespace(String ns) {
- getDOMElement().setAttribute(NAMESPACE, ns);
- }
-
- /**
- * This method returns the namespace.
- *
- * @return The namespace
- */
- public String getNamespace() {
- return(getDOMElement().hasAttribute(NAMESPACE)?
- getDOMElement().getAttribute(NAMESPACE):null);
- }
-
- /**
- * This method sets the location.
- *
- * @param location The location
- */
- public void setLocation(String location) {
- getDOMElement().setAttribute(LOCATION, location);
- }
-
- /**
- * This method returns the location.
- *
- * @return The location
- */
- public String getLocation() {
- return(getDOMElement().hasAttribute(LOCATION)?
- getDOMElement().getAttribute(LOCATION):null);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Invoke.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Invoke.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Invoke.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,319 +0,0 @@
-/*
- * 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.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.util.TypeReferenceUtil;
-import org.jboss.savara.tools.bpel.util.XMLUtils;
-
-/**
- * This class represents an unsupported (or custom) action within
- * the conversation based ESB service descriptor.
- *
- * @author gary
- */
-public class Invoke extends AbstractInteraction {
-
- private static final String INPUT_VARIABLE = "inputVariable";
- private static final String OUTPUT_VARIABLE = "outputVariable";
- public static final String INVOKE = "invoke";
-
- private static final long serialVersionUID = 928076947383263387L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Invoke(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Invoke(BPELLanguageModel model) {
- super(model, INVOKE);
- }
-
- /**
- * This method sets the input variable.
- *
- * @param var The input variable
- */
- public void setInputVariable(String var) {
- getDOMElement().setAttribute(INPUT_VARIABLE, var);
- }
-
- /**
- * This method returns the input variable.
- *
- * @return The input variable
- */
- public String getInputVariable() {
- return(getDOMElement().hasAttribute(INPUT_VARIABLE)?
- getDOMElement().getAttribute(INPUT_VARIABLE):null);
- }
-
- /**
- * This method sets the output variable.
- *
- * @param var The output variable
- */
- public void setOutputVariable(String var) {
- getDOMElement().setAttribute(OUTPUT_VARIABLE, var);
- }
-
- /**
- * This method returns the output variable.
- *
- * @return The output variable
- */
- public String getOutputVariable() {
- return(getDOMElement().hasAttribute(OUTPUT_VARIABLE)?
- getDOMElement().getAttribute(OUTPUT_VARIABLE):null);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- convertRequest(activities, context);
-
- // Check if invoke is contained within a scope that defines
- // fault handlers. If so, then generate choice to throw
- // fault exceptions.
- ScopeActivity scope=null;
- org.w3c.dom.Element cur=getDOMElement();
-
- while (cur != null && cur.getParentNode() instanceof org.w3c.dom.Element &&
- scope == null) {
- cur = (org.w3c.dom.Element)cur.getParentNode();
-
- if (cur != null) {
- BPELElement elem=BPELElementFactory.createBPELElement(getModel(),
- cur);
-
- if (elem instanceof ScopeActivity) {
- scope = (ScopeActivity)elem;
- }
- }
- }
-
- if (scope != null && scope.getFaultHandlers() != null &&
- (scope.getFaultHandlers().getCatchPaths().size() > 0 ||
- scope.getFaultHandlers().getCatchAll() != null)) {
- org.scribble.conversation.model.If te=
- new org.scribble.conversation.model.If();
- te.derivedFrom(this);
-
- activities.add(te);
-
- org.scribble.conversation.model.ConditionalBlock cb=
- new org.scribble.conversation.model.ConditionalBlock();
- te.getConditionalBlocks().add(cb);
-
- activities = cb.getContents();
-
- for (int i=0; i < scope.getFaultHandlers().getCatchPaths().size(); i++) {
- Catch catchBlock=scope.getFaultHandlers().getCatchPaths().get(i);
-
- org.scribble.conversation.model.ConditionalBlock fcb=
- new org.scribble.conversation.model.ConditionalBlock();
-
- String mesgType=catchBlock.getFaultMessageType();
-
- if (mesgType == null) {
- mesgType = catchBlock.getFaultMessageElement();
- }
-
- Variable faultVar=null;
-
- if (catchBlock.getFaultVariable() != null) {
- faultVar = new Variable(getModel());
- faultVar.setName(catchBlock.getFaultVariable());
- faultVar.setMessageType(catchBlock.getFaultMessageType());
- faultVar.setElement(catchBlock.getFaultMessageElement());
- context.addVariable(faultVar);
- }
-
- convertFaultResponse(fcb.getContents(), catchBlock.getFaultVariable(),
- mesgType, context);
-
- org.scribble.conversation.model.Raise raise=
- new org.scribble.conversation.model.Raise();
-
- TypeReference tref=new TypeReference();
- tref.setLocalpart(XMLUtils.getLocalname(catchBlock.getFaultName()));
- raise.setType(tref);
-
- fcb.getContents().add(raise);
-
- te.getConditionalBlocks().add(fcb);
-
- if (faultVar != null) {
- context.removeVariable(faultVar);
- }
- }
- }
-
- if (getOutputVariable() != null) {
-
- convertResponse(activities, context);
- }
- }
-
- protected void convertRequest(java.util.List<Activity> activities,
- ConversionContext context) {
- // Create interaction for request
- ConversationInteraction interaction=new ConversationInteraction();
- interaction.derivedFrom(this);
-
- Variable var=context.getVariable(getInputVariable());
-
- String xmlType=context.getProcess().getXMLType(var.getMessageType(),
- context.getEnvironmentContext());
-
- TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
-
- MessageSignature ms=new MessageSignature();
- ms.setOperation(getOperation());
- ms.getTypes().add(tref);
-
- if (context.getRole() != null) {
- interaction.setFromRole(new Role(context.getRole()));
- }
-
- String toRole=getClientPartnerRole();
-
- if (toRole != null) {
- interaction.setToRole(new Role(toRole));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-
- protected void convertResponse(java.util.List<Activity> activities,
- ConversionContext context) {
-
- // Create interaction for request
- ConversationInteraction interaction=new ConversationInteraction();
- interaction.derivedFrom(this);
-
- Variable var=context.getVariable(getOutputVariable());
-
- String xmlType=context.getProcess().getXMLType(var.getMessageType(),
- context.getEnvironmentContext());
-
- TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
-
- MessageSignature ms=new MessageSignature();
- ms.setOperation(getOperation());
- ms.getTypes().add(tref);
-
- String fromRole=getClientPartnerRole();
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.setToRole(new Role(context.getRole()));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-
- protected void convertFaultResponse(java.util.List<Activity> activities,
- String faultVar, String faultMesgType, ConversionContext context) {
-
- // Create interaction for request
- ConversationInteraction interaction=new ConversationInteraction();
- interaction.derivedFrom(this);
-
- TypeReference tref=null;
-
- // TODO: Not sure if fault variable is supposed to be declared
- // in catch scope, or reused from outer scope?? If declared,
- // then without the message type/element, may be difficult to
- // define the message signature.
-
- Variable var=context.getVariable(faultVar);
-
- if (var != null) {
- String xmlType=context.getProcess().getXMLType(var.getMessageType(),
- context.getEnvironmentContext());
-
- tref = TypeReferenceUtil.createTypeReference(xmlType, context);
- //tref.setLocalpart(var.getMessageType());
- } else if (faultMesgType != null) {
- tref = TypeReferenceUtil.createTypeReference(faultMesgType, context);
- //tref.setLocalpart(faultMesgType);
- }
-
- MessageSignature ms=new MessageSignature();
- ms.setOperation(getOperation());
- ms.getTypes().add(tref);
-
- String fromRole=getClientPartnerRole();
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.setToRole(new Role(context.getRole()));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Link.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Link.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Link.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,83 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the BPEL link element, contained within
- * the flow activity.
- */
-public class Link extends BPELElement {
-
- private static final long serialVersionUID = 6889776538490515074L;
-
- private static final String NAME = "name";
-
- public static final String LINK="link";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public Link(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Link(BPELLanguageModel model) {
- super(model, LINK);
- }
-
- /**
- * This method returns the name associated
- * with the link.
- *
- * @return The link name
- */
- public String getName() {
- return(getDOMElement().getAttribute(NAME));
- }
-
- /**
- * This method sets the link name.
- *
- * @param name The name
- */
- public void setName(String name) {
- getDOMElement().setAttribute(NAME, name);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarm.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarm.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnAlarm.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,182 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'onAlarm' construct contained
- * within the 'pick' activity.
- */
-public class OnAlarm extends BPELElement {
-
- private static final long serialVersionUID = 271323368015539L;
-
- public static final String ONALARM="onAlarm";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public OnAlarm(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public OnAlarm(BPELLanguageModel model) {
- super(model, ONALARM);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method sets the 'until' condition.
- *
- * @param cond The 'until' condition
- */
- public void setUntil(Until cond) {
- org.w3c.dom.Element insertBefore=null;
-
- if (m_activity != null) {
- insertBefore = m_activity.getDOMElement();
- }
-
- setChildElement(findChildElement(Until.UNTIL),
- cond, insertBefore);
-
- org.w3c.dom.Element elem=findChildElement(For.FOR);
- if (elem != null) {
- getDOMElement().removeChild(elem);
- }
- }
-
- /**
- * This method returns the 'until' condition.
- *
- * @return The 'until' condition
- */
- public Until getUntil() {
- Until ret=null;
-
- org.w3c.dom.Element elem=findChildElement(Until.UNTIL);
- if (elem != null) {
- ret = new Until(getModel(), elem);
- }
-
- return(ret);
- }
-
- /**
- * This method sets the 'for' condition.
- *
- * @param cond The 'for' condition
- */
- public void setFor(For cond) {
- org.w3c.dom.Element insertBefore=null;
-
- if (m_activity != null) {
- insertBefore = m_activity.getDOMElement();
- }
-
- setChildElement(findChildElement(For.FOR),
- cond, insertBefore);
-
- org.w3c.dom.Element elem=findChildElement(Until.UNTIL);
- if (elem != null) {
- getDOMElement().removeChild(elem);
- }
- }
-
- /**
- * This method returns the 'for' condition.
- *
- * @return The 'for' condition
- */
- public For getFor() {
- For ret=null;
-
- org.w3c.dom.Element elem=findChildElement(For.FOR);
- if (elem != null) {
- ret = new For(getModel(), elem);
- }
-
- return(ret);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof Scope) {
- ret = "@scope";
- } else {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private BPELElement m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnEvent.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnEvent.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnEvent.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,191 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'onEvent' construct contained
- * within the 'EventHandler' element.
- */
-public class OnEvent extends BPELElement {
-
- private static final long serialVersionUID = -2444989267977027500L;
-
- private static final String PARTNER_LINK = "partnerLink";
- private static final String PORT_TYPE = "portType";
- private static final String OPERATION = "operation";
- private static final String VARIABLE = "variable";
-
- public static final String ONEVENT="onEvent";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public OnEvent(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- BPELElement elem=findChildActivity();
-
- if (elem instanceof Scope) {
- m_scope = (Scope)elem;
- }
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public OnEvent(BPELLanguageModel model) {
- super(model, ONEVENT);
- }
-
- /**
- * This method sets the operation.
- *
- * @param op The operation
- */
- public void setOperation(String op) {
- getDOMElement().setAttribute(OPERATION, op);
- }
-
- /**
- * This method returns the operation.
- *
- * @return The operation
- */
- public String getOperation() {
- return(getDOMElement().hasAttribute(OPERATION)?
- getDOMElement().getAttribute(OPERATION):null);
- }
-
- /**
- * This method sets the partner link.
- *
- * @param pl The partner link
- */
- public void setPartnerLink(String pl) {
- getDOMElement().setAttribute(PARTNER_LINK, pl);
- }
-
- /**
- * This method returns the partner link.
- *
- * @return The partner link
- */
- public String getPartnerLink() {
- return(getDOMElement().hasAttribute(PARTNER_LINK)?
- getDOMElement().getAttribute(PARTNER_LINK):null);
- }
-
- /**
- * This method sets the port type.
- *
- * @param pt The port type
- */
- public void setPortType(String pt) {
- getDOMElement().setAttribute(PORT_TYPE, pt);
- }
-
- /**
- * This method returns the port type.
- *
- * @return The port type
- */
- public String getPortType() {
- return(getDOMElement().hasAttribute(PORT_TYPE)?
- getDOMElement().getAttribute(PORT_TYPE):null);
- }
-
- /**
- * This method sets the variable.
- *
- * @param var The variable
- */
- public void setVariable(String var) {
- getDOMElement().setAttribute(VARIABLE, var);
- }
-
- /**
- * This method returns the variable.
- *
- * @return The variable
- */
- public String getVariable() {
- return(getDOMElement().hasAttribute(VARIABLE)?
- getDOMElement().getAttribute(VARIABLE):null);
- }
-
- /**
- * This method sets the scope associated with
- * the 'onEvent' construct.
- *
- * @param scope The scope
- */
- public void setScope(Scope scope) {
- m_scope = scope;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, scope,
- insertBefore);
- }
-
- /**
- * This method returns the scope associated with
- * the 'onEvent' construct.
- *
- * @return The scope
- */
- public Scope getScope() {
- return(m_scope);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof Scope) {
- ret += "@scope";
- }
-
- return(ret);
- }
-
- private Scope m_scope;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnMessage.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnMessage.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/OnMessage.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,237 +0,0 @@
-/*
- * 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.util.TypeReferenceUtil;
-import org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.Activity;
-import org.scribble.model.MessageSignature;
-import org.scribble.model.Role;
-import org.scribble.model.TypeReference;
-
-/**
- * This class represents the 'onMessage' construct contained
- * within the 'pick' activity.
- */
-public class OnMessage extends BPELElement {
-
- private static final long serialVersionUID = -827946684365823245L;
-
- private static final String PARTNER_LINK = "partnerLink";
- private static final String PORT_TYPE = "portType";
- private static final String OPERATION = "operation";
- private static final String VARIABLE = "variable";
-
- public static final String ONMESSAGE="onMessage";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public OnMessage(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public OnMessage(BPELLanguageModel model) {
- super(model, ONMESSAGE);
- }
-
- /**
- * This method sets the operation.
- *
- * @param op The operation
- */
- public void setOperation(String op) {
- getDOMElement().setAttribute(OPERATION, op);
- }
-
- /**
- * This method returns the operation.
- *
- * @return The operation
- */
- public String getOperation() {
- return(getDOMElement().hasAttribute(OPERATION)?
- getDOMElement().getAttribute(OPERATION):null);
- }
-
- /**
- * This method sets the partner link.
- *
- * @param pl The partner link
- */
- public void setPartnerLink(String pl) {
- getDOMElement().setAttribute(PARTNER_LINK, pl);
- }
-
- /**
- * This method returns the partner link.
- *
- * @return The partner link
- */
- public String getPartnerLink() {
- return(getDOMElement().hasAttribute(PARTNER_LINK)?
- getDOMElement().getAttribute(PARTNER_LINK):null);
- }
-
- /**
- * This method sets the port type.
- *
- * @param pt The port type
- */
- public void setPortType(String pt) {
- getDOMElement().setAttribute(PORT_TYPE, pt);
- }
-
- /**
- * This method returns the port type.
- *
- * @return The port type
- */
- public String getPortType() {
- return(getDOMElement().hasAttribute(PORT_TYPE)?
- getDOMElement().getAttribute(PORT_TYPE):null);
- }
-
- /**
- * This method sets the variable.
- *
- * @param var The variable
- */
- public void setVariable(String var) {
- getDOMElement().setAttribute(VARIABLE, var);
- }
-
- /**
- * This method returns the variable.
- *
- * @return The variable
- */
- public String getVariable() {
- return(getDOMElement().hasAttribute(VARIABLE)?
- getDOMElement().getAttribute(VARIABLE):null);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- /**
- * This method attempts to identify the server's partner role name.
- *
- * @return The partner role
- */
- protected String getServerPartnerRole() {
- String ret=getPartnerLink();
- int index=-1;
-
- if (ret != null && (index=ret.indexOf("To")) != -1) {
- ret = ret.substring(0, index);
- }
-
- return(ret);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
-
- ConversationInteraction interaction=new ConversationInteraction();
-
- Variable var=context.getVariable(getVariable());
-
- String xmlType=context.getProcess().getXMLType(var.getMessageType(),
- context.getEnvironmentContext());
-
- TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
-
- MessageSignature ms=new MessageSignature();
- ms.setOperation(getOperation());
- ms.getTypes().add(tref);
-
- String fromRole=getServerPartnerRole();
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.setToRole(new Role(context.getRole()));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
-
- if (getActivity() != null) {
- getActivity().convert(activities, context);
- }
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private BPELElement m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLink.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLink.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/PartnerLink.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,140 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'partnerLink' construct.
- */
-public class PartnerLink extends BPELElement {
-
- private static final long serialVersionUID = 8342639172267763736L;
-
- private static final String NAME = "name";
- private static final String PARTNER_LINK_TYPE = "partnerLinkType";
- private static final String MY_ROLE = "myRole";
- private static final String PARTNER_ROLE = "partnerRole";
-
- public static final String PARTNERLINK="partnerLink";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public PartnerLink(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public PartnerLink(BPELLanguageModel model) {
- super(model, PARTNERLINK);
- }
-
- /**
- * This method sets the name.
- *
- * @param name The name
- */
- public void setName(String name) {
- getDOMElement().setAttribute(NAME, name);
- }
-
- /**
- * This method returns the name.
- *
- * @return The name
- */
- public String getName() {
- return(getDOMElement().hasAttribute(NAME)?
- getDOMElement().getAttribute(NAME):null);
- }
-
- /**
- * This method sets the partner link type.
- *
- * @param pl The partner link type
- */
- public void setPartnerLinkType(String pl) {
- getDOMElement().setAttribute(PARTNER_LINK_TYPE, pl);
- }
-
- /**
- * This method returns the partner link type.
- *
- * @return The partner link type
- */
- public String getPartnerLinkType() {
- return(getDOMElement().hasAttribute(PARTNER_LINK_TYPE)?
- getDOMElement().getAttribute(PARTNER_LINK_TYPE):null);
- }
-
- /**
- * This method sets my role.
- *
- * @param role My role
- */
- public void setMyRole(String role) {
- getDOMElement().setAttribute(MY_ROLE, role);
- }
-
- /**
- * This method returns my role.
- *
- * @return My role
- */
- public String getMyRole() {
- return(getDOMElement().hasAttribute(MY_ROLE)?
- getDOMElement().getAttribute(MY_ROLE):null);
- }
-
- /**
- * This method sets partner role.
- *
- * @param role Partner role
- */
- public void setPartnerRole(String role) {
- getDOMElement().setAttribute(PARTNER_ROLE, role);
- }
-
- /**
- * This method returns partner role.
- *
- * @return Partner role
- */
- public String getPartnerRole() {
- return(getDOMElement().hasAttribute(PARTNER_ROLE)?
- getDOMElement().getAttribute(PARTNER_ROLE):null);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Pick.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Pick.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Pick.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,284 +0,0 @@
-/*
- * 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.scribble.conversation.model.ConditionalBlock;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents a pick grouping activity.
- *
- * @author gary
- */
-public class Pick extends BPELActivity {
-
- private static final long serialVersionUID = -2235972351406517577L;
-
- public static final String PICK = "pick";
- public static final String CREATE_INSTANCE = "createInstance";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Pick(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- java.util.List<BPELElement> onmesgs=
- findChildElements(OnMessage.class);
-
- for (int i=0; i < onmesgs.size(); i++) {
- if (onmesgs.get(i) instanceof OnMessage) {
- m_onMessages.add((OnMessage)onmesgs.get(i));
- }
- }
-
- java.util.List<BPELElement> onalrms=
- findChildElements(OnAlarm.class);
-
- for (int i=0; i < onalrms.size(); i++) {
- if (onalrms.get(i) instanceof OnAlarm) {
- m_onAlarms.add((OnAlarm)onalrms.get(i));
- }
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Pick(BPELLanguageModel model) {
- super(model, PICK);
- }
-
- /**
- * This method sets the 'create instance'
- * attribute.
- *
- * @param b Whether to create instance
- */
- public void setCreateInstance(boolean b) {
- String create=(b?"yes":"no");
-
- getDOMElement().setAttribute(CREATE_INSTANCE, create);
- }
-
- /**
- * This method returns whether to create instance.
- *
- * @return Whether to create instance
- */
- public boolean getCreateInstance() {
- boolean ret=false;
- String create=
- getDOMElement().getAttribute(CREATE_INSTANCE);
-
- if (create != null &&
- create.equals("yes")) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds an 'onMessage' to the grouping construct.
- *
- * @param on The 'onMessage' to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addOnMessage(OnMessage on, int pos) {
- if (pos == -1 || pos >= m_onMessages.size()) {
- m_onMessages.add(on);
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_onAlarms.size() > 0) {
- insertBefore = m_onAlarms.get(0).getDOMElement();
- }
-
- setChildElement(null, on, insertBefore);
- } else {
-
- OnMessage cur=m_onMessages.get(pos);
-
- m_onMessages.add(pos, on);
-
- if (cur != null) {
- setChildElement(null, on,
- cur.getDOMElement());
- } else {
- org.w3c.dom.Element insertBefore=null;
-
- if (m_onAlarms.size() > 0) {
- insertBefore = m_onAlarms.get(0).getDOMElement();
- }
-
- setChildElement(null, on, insertBefore);
- }
- }
- }
-
- /**
- * This method removes an 'onMessage' from the grouping
- * construct.
- *
- * @param on The 'onMessage' to be removed
- * @return Whether the 'onMessage' was removed
- */
- public boolean removeOnMessage(OnMessage on) {
- boolean ret=m_onMessages.remove(on);
-
- if (ret) {
- getDOMElement().removeChild(on.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of 'onMessage' associated
- * with the grouping construct.
- *
- * @return The list of 'onMessage' elements
- */
- public java.util.List<OnMessage> getOnMessages() {
- return(m_onMessages);
- }
-
- /**
- * This method adds an 'onAlarm' to the grouping construct.
- *
- * @param on The 'onAlarm' to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addOnAlarm(OnAlarm on, int pos) {
- if (pos == -1 || pos >= m_onAlarms.size()) {
- m_onAlarms.add(on);
-
- setChildElement(null, on, null);
- } else {
-
- OnAlarm cur=m_onAlarms.get(pos);
-
- m_onAlarms.add(pos, on);
-
- if (cur != null) {
- setChildElement(null, on,
- cur.getDOMElement());
- } else {
- setChildElement(null, on, null);
- }
- }
- }
-
- /**
- * This method removes an 'onAlarm' from the grouping
- * construct.
- *
- * @param on The 'onAlarm' to be removed
- * @return Whether the 'onAlarm' was removed
- */
- public boolean removeOnAlarm(OnAlarm on) {
- boolean ret=m_onAlarms.remove(on);
-
- if (ret) {
- getDOMElement().removeChild(on.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of 'onAlarm' associated
- * with the grouping construct.
- *
- * @return The list of 'onAlarm' elements
- */
- public java.util.List<OnAlarm> getOnAlarms() {
- return(m_onAlarms);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- org.scribble.conversation.model.If elem=
- new org.scribble.conversation.model.If();
-
- // Convert 'onMessage' paths
- for (int i=0; i < getOnMessages().size(); i++) {
- OnMessage onMessageElem=getOnMessages().get(i);
-
- ConditionalBlock cb = new ConditionalBlock();
-
- onMessageElem.convert(cb.getContents(), context);
-
- elem.getConditionalBlocks().add(cb);
- }
-
- // TODO: If alarms defined, then model these using a
- // try/catch with interrupt?
-
- activities.add(elem);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof OnMessage) {
- ret += "@onMessage."+getOnMessages().indexOf(elem);
- } else if (elem instanceof OnAlarm) {
- ret += "@onAlarm."+getOnAlarms().indexOf(elem);
- }
-
- return(ret);
- }
-
- private java.util.List<OnMessage> m_onMessages=
- new java.util.Vector<OnMessage>();
- private java.util.List<OnAlarm> m_onAlarms=
- new java.util.Vector<OnAlarm>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Process.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Process.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Process.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,979 +0,0 @@
-/*
- * 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.logging.Level;
-
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import org.scribble.conversation.model.ConditionalBlock;
-import org.scribble.conversation.model.Conversation;
-import org.scribble.conversation.model.ConversationNotation;
-import org.scribble.model.*;
-import org.scribble.model.admin.Context;
-import org.scribble.model.admin.ModelListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.util.InteractionUtil;
-import org.jboss.savara.tools.bpel.util.XMLUtils;
-
-/**
- * This class represents a BPEL process.
- *
- * @author gary
- */
-public class Process extends BPELElement implements ScopeActivity {
-
- private static final long serialVersionUID = 3400962966628415184L;
-
- public static final String PROCESS = "process";
- public static final String NAME = "name";
- public static final String TARGET_NAMESPACE = "targetNamespace";
- public static final String CONVERSATION_TYPE = "conversationType";
- public static final String BPEL_PREFIX = "bpel";
-
- public static final String CONVERSATION_NS="http://www.scribble.org/conversation";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Process(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- java.util.List<BPELElement> imports=findChildElements(Import.class);
- for (BPELElement elem : imports) {
- m_imports.add((Import)elem);
- }
-
- m_partnerLinksElem = findChildElement("partnerLinks");
-
- if (m_partnerLinksElem != null) {
- java.util.List<BPELElement> elems=
- findChildElements(m_partnerLinksElem,
- PartnerLink.class);
-
- for (int i=0; i < elems.size(); i++) {
- m_partnerLinks.add((PartnerLink)elems.get(i));
- }
- }
-
- m_variablesElem = findChildElement("variables");
-
- if (m_variablesElem != null) {
- java.util.List<BPELElement> elems=
- findChildElements(m_variablesElem,
- Variable.class);
-
- for (int i=0; i < elems.size(); i++) {
- m_variables.add((Variable)elems.get(i));
- }
- }
-
- //m_messageExchangesElem = findChildElement("messageExchanges");
- //m_correlationSetsElem = findChildElement("correlationSets");
-
- org.w3c.dom.Element ehs=findChildElement(EventHandlers.EVENTHANDLERS);
- if (ehs != null) {
- m_eventHandlers = new EventHandlers(model, ehs);
- }
-
- org.w3c.dom.Element fhs=findChildElement(FaultHandlers.FAULTHANDLERS);
- if (fhs != null) {
- m_faultHandlers = new FaultHandlers(model, fhs);
- }
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Process(BPELLanguageModel model) {
- super(model, PROCESS);
-
- initNamespace(BPEL_NS, BPEL_PREFIX);
- }
-
- /**
- * This method adds an import to the scope.
- *
- * @param imp The import to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addImport(Import imp, int pos) {
-
- if (pos != -1 && pos < m_imports.size()) {
- m_imports.add(pos, imp);
- } else {
- m_imports.add(imp);
- }
-
- java.util.List<BPELElement> children=findChildElements(BPELElement.class);
-
- org.w3c.dom.Node newNode=imp.getDOMElement().cloneNode(true);
-
- getDOMElement().getOwnerDocument().adoptNode(newNode);
-
- if (pos != -1 && pos < children.size()) {
- getDOMElement().insertBefore(newNode, children.get(pos).getDOMElement());
- } else {
- getDOMElement().appendChild(newNode);
- }
- }
-
- /**
- * This method removes a partner link from the grouping
- * construct.
- *
- * @param pl The partner link to be removed
- * @return Whether the partner link was removed
- */
- public boolean removeImport(Import imp) {
- boolean ret=m_imports.remove(imp);
-
- if (ret) {
- getDOMElement().removeChild(imp.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of imports.
- *
- * @return The imports
- */
- public java.util.List<Import> getImports() {
- return(m_imports);
- }
-
- /**
- * This method searches the defined WSDL definitions to identify
- * the underlying XML element/type associated with the supplied
- * WSDL message type.
- *
- * @param wsdlMessageType The WSDL message type
- * @param context The context
- * @return The underlying XML element/type, or null if not found
- */
- public String getXMLType(String wsdlMessageType, Context context) {
- String ret=null;
-
- // Resolve the namespace prefix
- int index=wsdlMessageType.indexOf(':');
-
- if (index != -1 && context != null) {
- String prefix=wsdlMessageType.substring(0, index);
-
- String namespace=getNamespace(prefix);
-
- wsdlMessageType = wsdlMessageType.substring(index+1);
-
- for (Import imp : getImports()) {
-
- // Check if import relates to the correct namespace
- if (imp.getNamespace() != null &&
- imp.getNamespace().equals(namespace) &&
- imp.getLocation() != null &&
- imp.getLocation().endsWith(".wsdl")) {
-
- java.net.URI uri=
- context.getResourceURI(getModel().getModelReference(),
- imp.getLocation());
-
- if (uri != null) {
- ret = getXMLType(imp.getNamespace(), wsdlMessageType, uri);
-
- if (ret != null) {
- break;
- }
- }
- }
- }
- }
-
- return(ret);
- }
-
- protected String getXMLType(String namespace, String wsdlMessageType, java.net.URI uri) {
- String ret=null;
-
- try {
- WSDLReader reader=javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader();
-
- javax.wsdl.Definition defn=reader.readWSDL(uri.toString());
-
- if (defn != null) {
- javax.wsdl.Message mesg=defn.getMessage(new QName(namespace, wsdlMessageType));
-
- if (mesg != null && mesg.getParts().size() == 1) {
- javax.wsdl.Part part=(javax.wsdl.Part)
- mesg.getParts().values().iterator().next();
-
- if (part.getElementName() != null) {
- ret = part.getElementName().toString();
- } else if (part.getTypeName() != null) {
- ret = part.getTypeName().toString();
- }
- }
- }
-
- } catch(Exception e) {
- logger.error("Failed to read WSDL", e);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of partner links.
- *
- * @return The partner links
- */
- public java.util.List<PartnerLink> getPartnerLinks() {
- return(m_partnerLinks);
- }
-
- /**
- * This method returns the partner link associated
- * with the supplied name.
- *
- * @param name The name
- * @return The partner link, or null if not found
- */
- public PartnerLink getPartnerLink(String name) {
- PartnerLink ret=null;
-
- for (int i=0; ret == null && i < m_partnerLinks.size(); i++) {
- if (m_partnerLinks.get(i).getName().equals(name)) {
- ret = m_partnerLinks.get(i);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method adds a partner link to the scope.
- *
- * @param pl The partner link to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addPartnerLink(PartnerLink pl, int pos) {
-
- if (m_partnerLinksElem == null) {
- m_partnerLinksElem = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, "partnerLinks");
-
- // Add to parent
- org.w3c.dom.Element insertBefore=
- findChildElement("messageExchanges");
-
- if (insertBefore == null) {
- insertBefore = findChildElement("variables");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("correlationSets");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("faultHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("eventHandlers");
- }
-
- if (insertBefore == null) {
- BPELElement elem=findChildActivity();
-
- if (elem != null) {
- insertBefore = elem.getDOMElement();
- }
- }
-
- if (insertBefore != null) {
- getDOMElement().insertBefore(m_partnerLinksElem, insertBefore);
- } else {
- getDOMElement().appendChild(m_partnerLinksElem);
- }
- }
-
- if (pos == -1 || pos >= m_partnerLinks.size()) {
- m_partnerLinks.add(pl);
-
- setChildElement(m_partnerLinksElem, null, pl, null);
- } else {
-
- PartnerLink cur=m_partnerLinks.get(pos);
-
- m_partnerLinks.add(pos, pl);
-
- if (cur != null) {
- setChildElement(m_partnerLinksElem, null, pl,
- cur.getDOMElement());
- } else {
- setChildElement(m_partnerLinksElem, null, pl, null);
- }
- }
- }
-
- /**
- * This method removes a partner link from the grouping
- * construct.
- *
- * @param pl The partner link to be removed
- * @return Whether the partner link was removed
- */
- public boolean removePartnerLink(PartnerLink pl) {
- boolean ret=m_partnerLinks.remove(pl);
-
- if (ret) {
- m_partnerLinksElem.removeChild(pl.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method sets the name.
- *
- * @param name The name
- */
- public void setName(String name) {
- getDOMElement().setAttribute(NAME, name);
- }
-
- /**
- * This method returns the name.
- *
- * @return The name
- */
- public String getName() {
- return(getDOMElement().hasAttribute(NAME)?
- getDOMElement().getAttribute(NAME):null);
- }
-
- /**
- * This method sets the target namespace.
- *
- * @param tns The target namespace
- */
- public void setTargetNamespace(String tns) {
- getDOMElement().setAttribute(TARGET_NAMESPACE, tns);
- }
-
- /**
- * This method returns the target namespace.
- *
- * @return The target namespace
- */
- public String getTargetNamespace() {
- return(getDOMElement().hasAttribute(TARGET_NAMESPACE)?
- getDOMElement().getAttribute(TARGET_NAMESPACE):null);
- }
-
- /**
- * This method sets the conversation type.
- *
- * @param ctype The conversation type
- */
- public void setConversationType(String ctype) {
- getDOMElement().setAttributeNS(CONVERSATION_NS, CONVERSATION_TYPE, ctype);
- }
-
- /**
- * This method returns the conversation type.
- *
- * @return The conversation type
- */
- public String getConversationType() {
- return(getDOMElement().hasAttributeNS(CONVERSATION_NS, CONVERSATION_TYPE)?
- getDOMElement().getAttributeNS(CONVERSATION_NS, CONVERSATION_TYPE):null);
- }
-
- /**
- * This method returns the prefix associated with the
- * supplied namespace.
- *
- * @param namespace The namespace
- * @return The prefix, or null if not found
- */
- public String getPrefix(String namespace) {
- String ret=null;
-
- org.w3c.dom.NamedNodeMap map=getDOMElement().getAttributes();
-
- for (int i=0; ret == null && i < map.getLength(); i++) {
- org.w3c.dom.Node node=map.item(i);
-
- if (node instanceof org.w3c.dom.Attr) {
- org.w3c.dom.Attr attr=(org.w3c.dom.Attr)node;
-
- if (attr.getNodeValue().equals(namespace) &&
- attr.getNodeName().startsWith("xmlns:")) {
- ret = attr.getNodeName().substring(6);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the namespace for the supplied prefix.
- *
- * @param prefix The prefix
- * @return The namespace, or null if not found
- */
- public String getNamespace(String prefix) {
- String ret=null;
-
- org.w3c.dom.NamedNodeMap map=getDOMElement().getAttributes();
-
- for (int i=0; ret == null && i < map.getLength(); i++) {
- org.w3c.dom.Node node=map.item(i);
-
- if (node instanceof org.w3c.dom.Attr) {
- org.w3c.dom.Attr attr=(org.w3c.dom.Attr)node;
-
- if (attr.getNodeName().equals("xmlns:"+prefix) ||
- attr.getNodeName().equals(prefix)) {
- ret = attr.getNodeValue();
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method initialises the prefix associated with the supplied
- * namespace.
- *
- * @param namespace
- * @param prefix
- */
- public void initNamespace(String namespace, String prefix) {
- getDOMElement().setAttribute("xmlns:"+prefix, namespace);
- }
-
- /**
- * This method adds a new namespace and returns the
- * prefix allocated to it.
- *
- * @param namespace The namespace to be added
- * @return The prefix
- */
- public String addNamespace(String namespace) {
- String ret=getPrefix(namespace);
- int i=1;
-
- while (ret == null) {
- String prefix="ns"+(i++);
-
- if (getDOMElement().hasAttribute("xmlns:"+prefix) == false) {
- ret = prefix;
-
- getDOMElement().setAttribute("xmlns:"+prefix, namespace);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method adds a variable to the scope.
- *
- * @param var The variable to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addVariable(Variable var, int pos) {
-
- if (m_variablesElem == null) {
- m_variablesElem = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, "variables");
-
- // Add to parent
- org.w3c.dom.Element insertBefore=
- findChildElement("correlationSets");
-
- if (insertBefore == null) {
- insertBefore = findChildElement("faultHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("eventHandlers");
- }
-
- if (insertBefore == null) {
- BPELElement elem=findChildActivity();
-
- if (elem != null) {
- insertBefore = elem.getDOMElement();
- }
- }
-
- if (insertBefore != null) {
- getDOMElement().insertBefore(m_variablesElem, insertBefore);
- } else {
- getDOMElement().appendChild(m_variablesElem);
- }
- }
-
- if (pos == -1 || pos >= m_variables.size()) {
- m_variables.add(var);
-
- setChildElement(m_variablesElem, null, var, null);
- } else {
-
- Variable cur=m_variables.get(pos);
-
- m_variables.add(pos, var);
-
- if (cur != null) {
- setChildElement(m_variablesElem, null, var,
- cur.getDOMElement());
- } else {
- setChildElement(m_variablesElem, null, var, null);
- }
- }
- }
-
- /**
- * This method removes an activity from the grouping
- * construct.
- *
- * @param act The activity to be removed
- * @return Whether the activity was removed
- */
- public boolean removeVariable(Variable var) {
- boolean ret=m_variables.remove(var);
-
- if (ret) {
- m_variablesElem.removeChild(var.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of variables.
- *
- * @return The
- */
- public java.util.List<Variable> getVariables() {
- return(m_variables);
- }
-
- /**
- * This method returns the variable associated
- * with the supplied name.
- *
- * @param name The name
- * @return The variable, or null if not found
- */
- public Variable getVariable(String name) {
- Variable ret=null;
-
- for (int i=0; ret == null && i < m_variables.size(); i++) {
- if (m_variables.get(i).getName().equals(name)) {
- ret = m_variables.get(i);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELActivity act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELActivity getActivity() {
- return(m_activity);
- }
-
- /**
- * This method sets the 'eventHandlers' path.
- *
- * @param elem The 'eventHandlers' path
- */
- public void setEventHandlers(EventHandlers elem) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_eventHandlers != null) {
- existingElem = m_eventHandlers.getDOMElement();
- }
-
- m_eventHandlers = elem;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (insertBefore == null) {
- BPELElement act=findChildActivity();
-
- if (elem != null) {
- insertBefore = act.getDOMElement();
- }
- }
-
- setChildElement(existingElem, elem,
- insertBefore);
- }
-
- /**
- * This method returns the 'eventHandlers' path.
- *
- * @return The 'eventHandlers' path
- */
- public EventHandlers getEventHandlers() {
- return(m_eventHandlers);
- }
-
- /**
- * This method sets the 'faultHandlers' path.
- *
- * @param elem The 'faultHandlers' path
- */
- public void setFaultHandlers(FaultHandlers elem) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_faultHandlers != null) {
- existingElem = m_faultHandlers.getDOMElement();
- }
-
- m_faultHandlers = elem;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (insertBefore == null) {
- insertBefore = findChildElement("eventHandlers");
- }
-
- if (insertBefore == null) {
- BPELElement act=findChildActivity();
-
- if (elem != null) {
- insertBefore = act.getDOMElement();
- }
- }
-
- setChildElement(existingElem, elem,
- insertBefore);
- }
-
- /**
- * This method returns the 'faultHandlers' path.
- *
- * @return The 'faultHandlers' path
- */
- public FaultHandlers getFaultHandlers() {
- return(m_faultHandlers);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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
- */
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- // Add variables to the context
- for (int i=0; i < m_variables.size(); i++) {
- context.addVariable(m_variables.get(i));
- }
-
- // Count number of invoke activities
- int invokeCount=InteractionUtil.countInvokes(getActivity().getDOMElement());
-
- // Check whether scope has been defined to represent
- // an interaction with one or more fault responses and
- // no event handlers
- Invoke invoke=null;
-
- if (invokeCount == 1 &&
- m_faultHandlers != null && (m_faultHandlers.getCatchPaths().size() > 0 ||
- m_faultHandlers.getCatchAll() != null) &&
- (m_eventHandlers == null || (m_eventHandlers.getOnEvents().size() == 0 &&
- m_eventHandlers.getOnAlarms().size() == 0)) &&
- (invoke = InteractionUtil.getInvoke(m_activity)) != null) {
-
- invoke.convertRequest(activities, context);
-
- // Create choice with normal response and fault paths
- org.scribble.conversation.model.If choice=new org.scribble.conversation.model.If();
-
- ConditionalBlock cb=new ConditionalBlock();
-
- invoke.convertResponse(cb.getContents(), context);
-
- // Include remaining activities
- if (m_activity instanceof Sequence) {
- for (int i=1; i < ((Sequence)m_activity).getActivities().size(); i++) {
- ((Sequence)m_activity).getActivities().get(i).convert(cb.getContents(), context);
- }
- }
-
- choice.getConditionalBlocks().add(cb);
-
- // Process fault handlers
- for (int i=0; i < m_faultHandlers.getCatchPaths().size(); i++) {
- Catch catchBlock=m_faultHandlers.getCatchPaths().get(i);
-
- ConditionalBlock fcb=new ConditionalBlock();
-
- String mesgType=catchBlock.getFaultMessageType();
-
- if (mesgType == null) {
- mesgType = catchBlock.getFaultMessageElement();
- }
-
- Variable faultVar=null;
-
- if (catchBlock.getFaultVariable() != null) {
- faultVar = new Variable(getModel());
- faultVar.setName(catchBlock.getFaultVariable());
- faultVar.setMessageType(catchBlock.getFaultMessageType());
- faultVar.setElement(catchBlock.getFaultMessageElement());
- context.addVariable(faultVar);
- }
-
- invoke.convertFaultResponse(fcb.getContents(), catchBlock.getFaultVariable(),
- mesgType, context);
-
- if (catchBlock.getActivity() != null) {
- catchBlock.getActivity().convert(fcb.getContents(), context);
- }
-
- choice.getConditionalBlocks().add(fcb);
-
- if (faultVar != null) {
- context.removeVariable(faultVar);
- }
- }
-
- activities.add(choice);
- } else {
- // Store in local var, in case try/catch block needs to be
- // added
- java.util.List<Activity> acts=activities;
-
- // Check if try/catch block is required
- if (getFaultHandlers() != null &&
- (getFaultHandlers().getCatchPaths().size() > 0 ||
- getFaultHandlers().getCatchAll() != null)) {
- org.scribble.conversation.model.TryEscape te=
- new org.scribble.conversation.model.TryEscape();
- te.derivedFrom(this);
- te.getBlock().derivedFrom(this);
-
- acts.add(te);
-
- acts = te.getBlock().getContents();
-
- for (int i=0; i < getFaultHandlers().getCatchPaths().size(); i++) {
- Catch catchPath=getFaultHandlers().getCatchPaths().get(i);
-
- org.scribble.conversation.model.CatchBlock cb=
- new org.scribble.conversation.model.CatchBlock();
- cb.derivedFrom(catchPath);
-
- TypeReference tref=new TypeReference();
- tref.setLocalpart(XMLUtils.getLocalname(catchPath.getFaultName()));
- cb.setType(tref);
-
- Variable faultVar=null;
-
- if (catchPath.getFaultVariable() != null) {
- faultVar = new Variable(getModel());
- faultVar.setName(catchPath.getFaultVariable());
- faultVar.setMessageType(catchPath.getFaultMessageType());
- faultVar.setElement(catchPath.getFaultMessageElement());
- context.addVariable(faultVar);
- }
-
- if (catchPath.getActivity() != null) {
- catchPath.getActivity().convert(cb.getContents(), context);
- }
-
- if (faultVar != null) {
- context.removeVariable(faultVar);
- }
-
- te.getEscapeBlocks().add(cb);
- }
- }
-
- // Convert normal activities in scope
- if (getActivity() != null) {
- getActivity().convert(acts, context);
- }
- }
- }
-
- /**
- * This method returns the conversion associated with the
- * BPEL process.
- *
- * @param envContext The environment context
- * @return The conversation
- */
- public Conversation convert(Context envContext) {
- Conversation ret=new Conversation();
-
- ret.derivedFrom(this);
- ret.getBlock().derivedFrom(this);
-
- // Configure model name
- LocatedName modelName=new LocatedName();
- modelName.setName(getName());
-
- ret.setLocatedName(modelName);
-
- // Define implements reference for conversation type
- String convType=getConversationType();
- String role=null;
-
- if (convType != null) {
- int index=convType.indexOf('@');
-
- if (index != -1) {
- // TODO: Need to think whether this should be
- // 'implements' reference. If so, then need to change
- // Java Lang Model parser and also Lang Model conformance
- // rule.
- ImplementsReference iref=
- new ImplementsReference(ConversationNotation.NOTATION_CODE);
-
- role = convType.substring(index+1);
-
- iref.setLocatedRole(role);
-
- // Need to locate the model name
- modelName.setRole(new Role(iref.getLocatedRole()));
-
- String mainpart=convType.substring(0, index);
-
- index = mainpart.lastIndexOf(".");
-
- if (index == -1) {
- iref.setNamespace("");
- iref.setLocalpart(mainpart);
- } else {
- iref.setNamespace(mainpart.substring(0, index));
- iref.setLocalpart(mainpart.substring(index+1));
- }
-
- ret.getImplements().add(iref);
-
- } else {
- logger.warn("Conversation type does not " +
- "contain '@' located role separator");
- }
- }
-
- // Convert the process contents
- DefaultConversionContext context=new DefaultConversionContext(role, this, envContext);
-
- // Add variables to the context
- for (int i=0; i < m_variables.size(); i++) {
- context.addVariable(m_variables.get(i));
- }
-
- convert(ret.getBlock().getContents(), context);
-
- return(ret);
- }
-
- protected String getParentURI(BPELElement elem) {
- String ret="//";
-
- if (elem instanceof BPELActivity) {
- ret += "@activity";
- } else if (elem instanceof FaultHandlers) {
- ret += "@faultHandlers";
- } else if (elem instanceof EventHandlers) {
- ret += "@eventHandlers";
- }
-
- return(ret);
- }
-
- private static Log logger = LogFactory.getLog(Process.class);
-
- private org.w3c.dom.Element m_partnerLinksElem=null;
- //private org.w3c.dom.Element m_messageExchangesElem=null;
- private org.w3c.dom.Element m_variablesElem=null;
- //private org.w3c.dom.Element m_correlationSetsElem=null;
- private java.util.List<Import> m_imports=new java.util.Vector<Import>();
- private java.util.List<PartnerLink> m_partnerLinks=new java.util.Vector<PartnerLink>();
- private java.util.List<Variable> m_variables=new java.util.Vector<Variable>();
- private EventHandlers m_eventHandlers=null;
- private FaultHandlers m_faultHandlers=null;
- private BPELActivity m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Receive.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Receive.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Receive.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,171 +0,0 @@
-/*
- * 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.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.util.TypeReferenceUtil;
-
-/**
- * This class represents an unsupported (or custom) action within
- * the conversation based ESB service descriptor.
- *
- * @author gary
- */
-public class Receive extends AbstractInteraction {
-
- private static final String CREATE_INSTANCE = "createInstance";
- private static final String VARIABLE = "variable";
-
- public static final String RECEIVE = "receive";
-
- private static final long serialVersionUID = -3041725198724191842L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Receive(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Receive(BPELLanguageModel model) {
- super(model, RECEIVE);
- }
-
- /**
- * This method sets the variable.
- *
- * @param var The variable
- */
- public void setVariable(String var) {
- getDOMElement().setAttribute(VARIABLE, var);
- }
-
- /**
- * This method returns the variable.
- *
- * @return The variable
- */
- public String getVariable() {
- return(getDOMElement().hasAttribute(VARIABLE)?
- getDOMElement().getAttribute(VARIABLE):null);
- }
-
- /**
- * This method sets the 'create instance'
- * attribute.
- *
- * @param b Whether to create instance
- */
- public void setCreateInstance(boolean b) {
- String create=(b?"yes":"no");
-
- getDOMElement().setAttribute(CREATE_INSTANCE, create);
- }
-
- /**
- * This method returns whether to create instance.
- *
- * @return Whether to create instance
- */
- public boolean getCreateInstance() {
- boolean ret=false;
- String create=
- getDOMElement().getAttribute(CREATE_INSTANCE);
-
- if (create != null &&
- create.equals("yes")) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- ConversationInteraction interaction=new ConversationInteraction();
- interaction.derivedFrom(this);
-
- Variable var=context.getVariable(getVariable());
-
- String xmlType=context.getProcess().getXMLType(var.getMessageType(),
- context.getEnvironmentContext());
-
- TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
-
- MessageSignature ms=new MessageSignature();
- ms.derivedFrom(this);
-
- ms.setOperation(getOperation());
- ms.getTypes().add(tref);
-
- String fromRole=getServerPartnerRole();
-
- if (fromRole != null && fromRole.equals(context.getRole())) {
- fromRole = getClientPartnerRole();
- }
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.setToRole(new Role(context.getRole()));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntil.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntil.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/RepeatUntil.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,160 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents a RepeatUntil grouping activity.
- *
- * @author gary
- */
-public class RepeatUntil extends BPELGroupingConstruct {
-
- private static final long serialVersionUID = -4479515591509703188L;
-
- public static final String REPEATUNTIL = "repeatUntil";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public RepeatUntil(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
-
- org.w3c.dom.Element cond=
- findChildElement(Condition.CONDITION);
-
- if (cond == null) {
- m_condition = new Condition(model);
- } else {
- m_condition = new Condition(model, cond);
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public RepeatUntil(BPELLanguageModel model) {
- super(model, REPEATUNTIL);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
- }
-
- /**
- * This method sets the condition.
- *
- * @param cond The condition
- */
- public void setCondition(Condition cond) {
- m_condition = cond;
-
- setChildElement(findChildElement(Condition.CONDITION),
- cond, null);
- }
-
- /**
- * This method returns the condition.
- *
- * @return The condition
- */
- public Condition getCondition() {
- return(m_condition);
- }
-
- /**
- * This method sets the main 'if' activity.
- *
- * @param act The activity associated with the 'if'
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_condition != null) {
- insertBefore = m_condition.getDOMElement();
- }
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'if' path.
- *
- * @return The 'if' activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private Condition m_condition=null;
- private BPELElement m_activity=null;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Reply.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Reply.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Reply.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,155 +0,0 @@
-/*
- * 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.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.util.TypeReferenceUtil;
-
-/**
- * This class represents a BPEL reply activity.
- *
- * @author gary
- */
-public class Reply extends AbstractInteraction {
-
- private static final String VARIABLE = "variable";
- private static final String FAULT_NAME = "faultName";
-
- public static final String REPLY = "reply";
-
- private static final long serialVersionUID = 8582738107125170604L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Reply(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Reply(BPELLanguageModel model) {
- super(model, REPLY);
- }
-
- /**
- * This method sets the variable.
- *
- * @param var The variable
- */
- public void setVariable(String var) {
- getDOMElement().setAttribute(VARIABLE, var);
- }
-
- /**
- * This method returns the variable.
- *
- * @return The variable
- */
- public String getVariable() {
- return(getDOMElement().hasAttribute(VARIABLE)?
- getDOMElement().getAttribute(VARIABLE):null);
- }
-
- /**
- * This method sets the fault name.
- *
- * @param fname The fault name
- */
- public void setFaultName(String fname) {
- getDOMElement().setAttribute(FAULT_NAME, fname);
- }
-
- /**
- * This method returns the fault name.
- *
- * @return The fault name
- */
- public String getFaultName() {
- return(getDOMElement().hasAttribute(FAULT_NAME)?
- getDOMElement().getAttribute(FAULT_NAME):null);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- ConversationInteraction interaction=new ConversationInteraction();
- interaction.derivedFrom(this);
-
- Variable var=context.getVariable(getVariable());
-
- String xmlType=context.getProcess().getXMLType(var.getMessageType(),
- context.getEnvironmentContext());
-
- TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
-
- MessageSignature ms=new MessageSignature();
- ms.derivedFrom(this);
-
- ms.setOperation(getOperation());
- ms.getTypes().add(tref);
-
- if (context.getRole() != null) {
- interaction.setFromRole(new Role(context.getRole()));
- }
-
- String toRole=getServerPartnerRole();
-
- if (toRole != null) {
- interaction.setToRole(new Role(toRole));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Rethrow.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Rethrow.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Rethrow.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,82 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents the rethrow activity.
- *
- * @author gary
- */
-public class Rethrow extends BPELActivity {
-
- private static final long serialVersionUID = 9187657888490480490L;
-
- public static final String RETHROW = "rethrow";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Rethrow(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Rethrow(BPELLanguageModel model) {
- super(model, RETHROW);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Scope.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Scope.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Scope.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,693 +0,0 @@
-/*
- * 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.scribble.conversation.model.ConditionalBlock;
-import org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-import org.jboss.savara.tools.bpel.model.util.InteractionUtil;
-import org.jboss.savara.tools.bpel.util.XMLUtils;
-
-/**
- * This class represents a scope grouping activity.
- *
- * @author gary
- */
-public class Scope extends BPELActivity implements ScopeActivity {
-
- private static final long serialVersionUID = 7132062003047468101L;
-
- public static final String SCOPE = "scope";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Scope(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_partnerLinksElem = findChildElement("partnerLinks");
-
- if (m_partnerLinksElem != null) {
- java.util.List<BPELElement> elems=
- findChildElements(m_partnerLinksElem,
- PartnerLink.class);
-
- for (int i=0; i < elems.size(); i++) {
- m_partnerLinks.add((PartnerLink)elems.get(i));
- }
- }
-
- m_variablesElem = findChildElement("variables");
-
- if (m_variablesElem != null) {
- java.util.List<BPELElement> elems=
- findChildElements(m_variablesElem,
- Variable.class);
-
- for (int i=0; i < elems.size(); i++) {
- m_variables.add((Variable)elems.get(i));
- }
- }
-
- m_messageExchangesElem = findChildElement("messageExchanges");
- m_correlationSetsElem = findChildElement("correlationSets");
-
- org.w3c.dom.Element ehs=findChildElement(EventHandlers.EVENTHANDLERS);
- if (ehs != null) {
- m_eventHandlers = new EventHandlers(model, ehs);
- }
-
- org.w3c.dom.Element fhs=findChildElement(FaultHandlers.FAULTHANDLERS);
- if (fhs != null) {
- m_faultHandlers = new FaultHandlers(model, fhs);
- }
-
- org.w3c.dom.Element ch=findChildElement(CompensationHandler.COMPENSATIONHANDLER);
- if (ch != null) {
- m_compensationHandler = new CompensationHandler(model, ch);
- }
-
- org.w3c.dom.Element th=findChildElement(TerminationHandler.TERMINATIONHANDLER);
- if (th != null) {
- m_terminationHandler = new TerminationHandler(model, th);
- }
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Scope(BPELLanguageModel model) {
- super(model, SCOPE);
- }
-
- /**
- * This method adds a variable to the scope.
- *
- * @param var The variable to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addVariable(Variable var, int pos) {
-
- if (m_variablesElem == null) {
- m_variablesElem = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, "variables");
-
- // Add to parent
- org.w3c.dom.Element insertBefore=
- findChildElement("partnerLinks");
-
- if (insertBefore == null) {
- insertBefore = findChildElement("messageExchanges");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("correlationSets");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("eventHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("faultHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("compensationHandler");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("terminationHandler");
- }
-
- if (insertBefore == null) {
- BPELElement elem=findChildActivity();
-
- if (elem != null) {
- insertBefore = elem.getDOMElement();
- }
- }
-
- if (insertBefore != null) {
- getDOMElement().insertBefore(m_variablesElem, insertBefore);
- } else {
- getDOMElement().appendChild(m_variablesElem);
- }
- }
-
- if (pos == -1 || pos >= m_variables.size()) {
- m_variables.add(var);
-
- setChildElement(m_variablesElem, null, var, null);
- } else {
-
- Variable cur=m_variables.get(pos);
-
- m_variables.add(pos, var);
-
- if (cur != null) {
- setChildElement(m_variablesElem, null, var,
- cur.getDOMElement());
- } else {
- setChildElement(m_variablesElem, null, var, null);
- }
- }
- }
-
- /**
- * This method removes an activity from the grouping
- * construct.
- *
- * @param act The activity to be removed
- * @return Whether the activity was removed
- */
- public boolean removeVariable(Variable var) {
- boolean ret=m_variables.remove(var);
-
- if (ret) {
- m_variablesElem.removeChild(var.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of variables.
- *
- * @return The
- */
- public java.util.List<Variable> getVariables() {
- return(m_variables);
- }
-
- /**
- * This method adds a partner link to the scope.
- *
- * @param pl The partner link to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addPartnerLink(PartnerLink pl, int pos) {
-
- if (m_partnerLinksElem == null) {
- m_partnerLinksElem = getDOMElement().getOwnerDocument().
- createElementNS(BPEL_NS, "partnerLinks");
-
- // Add to parent
- org.w3c.dom.Element insertBefore=
- findChildElement("messageExchanges");
-
- if (insertBefore == null) {
- insertBefore = findChildElement("correlationSets");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("eventHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("faultHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("compensationHandler");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("terminationHandler");
- }
-
- if (insertBefore == null) {
- BPELElement elem=findChildActivity();
-
- if (elem != null) {
- insertBefore = elem.getDOMElement();
- }
- }
-
- if (insertBefore != null) {
- getDOMElement().insertBefore(m_partnerLinksElem, insertBefore);
- } else {
- getDOMElement().appendChild(m_partnerLinksElem);
- }
- }
-
- if (pos == -1 || pos >= m_partnerLinks.size()) {
- m_partnerLinks.add(pl);
-
- setChildElement(m_partnerLinksElem, null, pl, null);
- } else {
-
- PartnerLink cur=m_partnerLinks.get(pos);
-
- m_partnerLinks.add(pos, pl);
-
- if (cur != null) {
- setChildElement(m_partnerLinksElem, null, pl,
- cur.getDOMElement());
- } else {
- setChildElement(m_partnerLinksElem, null, pl, null);
- }
- }
- }
-
- /**
- * This method removes a partner link from the grouping
- * construct.
- *
- * @param pl The partner link to be removed
- * @return Whether the partner link was removed
- */
- public boolean removePartnerLink(PartnerLink pl) {
- boolean ret=m_partnerLinks.remove(pl);
-
- if (ret) {
- m_partnerLinksElem.removeChild(pl.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of partner links.
- *
- * @return The partner links
- */
- public java.util.List<PartnerLink> getPartnerLinks() {
- return(m_partnerLinks);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELActivity act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELActivity getActivity() {
- return(m_activity);
- }
-
- /**
- * This method sets the 'eventHandlers' path.
- *
- * @param elem The 'eventHandlers' path
- */
- public void setEventHandlers(EventHandlers elem) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_eventHandlers != null) {
- existingElem = m_eventHandlers.getDOMElement();
- }
-
- m_eventHandlers = elem;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (insertBefore == null) {
- insertBefore = findChildElement("faultHandlers");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("compensationHandler");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("terminationHandler");
- }
-
- if (insertBefore == null) {
- BPELElement act=findChildActivity();
-
- if (elem != null) {
- insertBefore = act.getDOMElement();
- }
- }
-
- setChildElement(existingElem, elem,
- insertBefore);
- }
-
- /**
- * This method returns the 'eventHandlers' path.
- *
- * @return The 'eventHandlers' path
- */
- public EventHandlers getEventHandlers() {
- return(m_eventHandlers);
- }
-
- /**
- * This method sets the 'faultHandlers' path.
- *
- * @param elem The 'faultHandlers' path
- */
- public void setFaultHandlers(FaultHandlers elem) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_faultHandlers != null) {
- existingElem = m_faultHandlers.getDOMElement();
- }
-
- m_faultHandlers = elem;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (insertBefore == null) {
- insertBefore = findChildElement("compensationHandler");
- }
-
- if (insertBefore == null) {
- insertBefore = findChildElement("terminationHandler");
- }
-
- if (insertBefore == null) {
- BPELElement act=findChildActivity();
-
- if (elem != null) {
- insertBefore = act.getDOMElement();
- }
- }
-
- setChildElement(existingElem, elem,
- insertBefore);
- }
-
- /**
- * This method returns the 'faultHandlers' path.
- *
- * @return The 'faultHandlers' path
- */
- public FaultHandlers getFaultHandlers() {
- return(m_faultHandlers);
- }
-
- /**
- * This method sets the 'compensationHandler' path.
- *
- * @param elem The 'compensationHandler' path
- */
- public void setCompensationHandler(CompensationHandler elem) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_compensationHandler != null) {
- existingElem = m_compensationHandler.getDOMElement();
- }
-
- m_compensationHandler = elem;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (insertBefore == null) {
- insertBefore = findChildElement("terminationHandler");
- }
-
- if (insertBefore == null) {
- BPELElement act=findChildActivity();
-
- if (elem != null) {
- insertBefore = act.getDOMElement();
- }
- }
-
- setChildElement(existingElem, elem,
- insertBefore);
- }
-
- /**
- * This method returns the 'compensationHandler' path.
- *
- * @return The 'compensationHandler' path
- */
- public CompensationHandler getCompensationHandler() {
- return(m_compensationHandler);
- }
-
- /**
- * This method sets the 'terminationHandler' path.
- *
- * @param elem The 'terminationHandler' path
- */
- public void setTerminationHandler(TerminationHandler elem) {
- org.w3c.dom.Element existingElem=null;
-
- if (m_terminationHandler != null) {
- existingElem = m_terminationHandler.getDOMElement();
- }
-
- m_terminationHandler = elem;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (insertBefore == null) {
- BPELElement act=findChildActivity();
-
- if (elem != null) {
- insertBefore = act.getDOMElement();
- }
- }
-
- setChildElement(existingElem, elem,
- insertBefore);
- }
-
- /**
- * This method returns the 'terminationHandler' path.
- *
- * @return The 'terminationHandler' path
- */
- public TerminationHandler getTerminationHandler() {
- return(m_terminationHandler);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- // Add variables to the context
- for (int i=0; i < m_variables.size(); i++) {
- context.addVariable(m_variables.get(i));
- }
-
- // Count number of invoke activities
- int invokeCount=InteractionUtil.countInvokes(getActivity().getDOMElement());
-
- // Check whether scope has been defined to represent
- // an interaction with one or more fault responses and
- // no event handlers
- Invoke invoke=null;
-
- if (invokeCount == 1 &&
- m_faultHandlers != null && (m_faultHandlers.getCatchPaths().size() > 0 ||
- m_faultHandlers.getCatchAll() != null) &&
- (m_eventHandlers == null || (m_eventHandlers.getOnEvents().size() == 0 &&
- m_eventHandlers.getOnAlarms().size() == 0)) &&
- (invoke = InteractionUtil.getInvoke(m_activity)) != null) {
-
- invoke.convertRequest(activities, context);
-
- // Create choice with normal response and fault paths
- org.scribble.conversation.model.If choice=new org.scribble.conversation.model.If();
-
- ConditionalBlock cb=new ConditionalBlock();
-
- invoke.convertResponse(cb.getContents(), context);
-
- // Include remaining activities
- if (m_activity instanceof Sequence) {
- for (int i=1; i < ((Sequence)m_activity).getActivities().size(); i++) {
- ((Sequence)m_activity).getActivities().get(i).convert(cb.getContents(), context);
- }
- }
-
- choice.getConditionalBlocks().add(cb);
-
- // Process fault handlers
- for (int i=0; i < m_faultHandlers.getCatchPaths().size(); i++) {
- Catch catchBlock=m_faultHandlers.getCatchPaths().get(i);
-
- ConditionalBlock fcb=new ConditionalBlock();
-
- String mesgType=catchBlock.getFaultMessageType();
-
- if (mesgType == null) {
- mesgType = catchBlock.getFaultMessageElement();
- }
-
- Variable faultVar=null;
-
- if (catchBlock.getFaultVariable() != null) {
- faultVar = new Variable(getModel());
- faultVar.setName(catchBlock.getFaultVariable());
- faultVar.setMessageType(catchBlock.getFaultMessageType());
- faultVar.setElement(catchBlock.getFaultMessageElement());
- context.addVariable(faultVar);
- }
-
- invoke.convertFaultResponse(fcb.getContents(), catchBlock.getFaultVariable(),
- mesgType, context);
-
- if (catchBlock.getActivity() != null) {
- catchBlock.getActivity().convert(fcb.getContents(), context);
- }
-
- choice.getConditionalBlocks().add(fcb);
-
- if (faultVar != null) {
- context.removeVariable(faultVar);
- }
- }
-
- activities.add(choice);
- } else {
- // Store in local var, in case try/catch block needs to be
- // added
- java.util.List<Activity> acts=activities;
-
- // Check if try/catch block is required
- if (getFaultHandlers() != null &&
- (getFaultHandlers().getCatchPaths().size() > 0 ||
- getFaultHandlers().getCatchAll() != null)) {
- org.scribble.conversation.model.TryEscape te=
- new org.scribble.conversation.model.TryEscape();
- te.derivedFrom(this);
- te.getBlock().derivedFrom(this);
-
- acts.add(te);
-
- acts = te.getBlock().getContents();
-
- for (int i=0; i < getFaultHandlers().getCatchPaths().size(); i++) {
- Catch catchPath=getFaultHandlers().getCatchPaths().get(i);
-
- org.scribble.conversation.model.CatchBlock cb=
- new org.scribble.conversation.model.CatchBlock();
- cb.derivedFrom(catchPath);
-
- TypeReference tref=new TypeReference();
- tref.setLocalpart(XMLUtils.getLocalname(catchPath.getFaultName()));
- cb.setType(tref);
-
- Variable faultVar=null;
-
- if (catchPath.getFaultVariable() != null) {
- faultVar = new Variable(getModel());
- faultVar.setName(catchPath.getFaultVariable());
- faultVar.setMessageType(catchPath.getFaultMessageType());
- faultVar.setElement(catchPath.getFaultMessageElement());
- context.addVariable(faultVar);
- }
-
- if (catchPath.getActivity() != null) {
- catchPath.getActivity().convert(cb.getContents(), context);
- }
-
- if (faultVar != null) {
- context.removeVariable(faultVar);
- }
-
- te.getEscapeBlocks().add(cb);
- }
- }
-
- // Convert normal activities in scope
- if (getActivity() != null) {
- getActivity().convert(acts, context);
- }
- }
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret += "@activity";
- } else if (elem instanceof FaultHandlers) {
- ret += "@faultHandlers";
- } else if (elem instanceof EventHandlers) {
- ret += "@eventHandlers";
- }
-
- return(ret);
- }
-
- private org.w3c.dom.Element m_partnerLinksElem=null;
- private org.w3c.dom.Element m_variablesElem=null;
- private org.w3c.dom.Element m_messageExchangesElem=null;
- private org.w3c.dom.Element m_correlationSetsElem=null;
- private java.util.List<PartnerLink> m_partnerLinks=new java.util.Vector<PartnerLink>();
- private java.util.List<Variable> m_variables=new java.util.Vector<Variable>();
- private EventHandlers m_eventHandlers=null;
- private FaultHandlers m_faultHandlers=null;
- private CompensationHandler m_compensationHandler=null;
- private TerminationHandler m_terminationHandler=null;
- private BPELActivity m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ScopeActivity.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ScopeActivity.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/ScopeActivity.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,129 +0,0 @@
-/*
- * 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.scribble.model.admin.ModelListener;
-
-/**
- * This interface represents a scope activity.
- *
- * @author gary
- */
-public interface ScopeActivity {
-
- /**
- * This method adds a variable to the scope.
- *
- * @param var The variable to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addVariable(Variable var, int pos);
-
- /**
- * This method removes an activity from the grouping
- * construct.
- *
- * @param act The activity to be removed
- * @return Whether the activity was removed
- */
- public boolean removeVariable(Variable var);
-
- /**
- * This method returns the list of variables.
- *
- * @return The
- */
- public java.util.List<Variable> getVariables();
-
- /**
- * This method adds a partner link to the scope.
- *
- * @param pl The partner link to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addPartnerLink(PartnerLink pl, int pos);
-
- /**
- * This method removes a partner link from the grouping
- * construct.
- *
- * @param pl The partner link to be removed
- * @return Whether the partner link was removed
- */
- public boolean removePartnerLink(PartnerLink pl);
-
- /**
- * This method returns the list of partner links.
- *
- * @return The partner links
- */
- public java.util.List<PartnerLink> getPartnerLinks() ;
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELActivity act) ;
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELActivity getActivity() ;
-
- /**
- * This method sets the 'eventHandlers' path.
- *
- * @param elem The 'eventHandlers' path
- */
- public void setEventHandlers(EventHandlers elem);
-
- /**
- * This method returns the 'eventHandlers' path.
- *
- * @return The 'eventHandlers' path
- */
- public EventHandlers getEventHandlers();
-
- /**
- * This method sets the 'faultHandlers' path.
- *
- * @param elem The 'faultHandlers' path
- */
- public void setFaultHandlers(FaultHandlers elem);
-
- /**
- * This method returns the 'faultHandlers' path.
- *
- * @return The 'faultHandlers' path
- */
- public FaultHandlers getFaultHandlers();
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l);
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Sequence.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Sequence.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Sequence.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,155 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents a sequence grouping activity.
- *
- * @author gary
- */
-public class Sequence extends BPELActivity {
-
- public static final String SEQUENCE = "sequence";
-
- private static final long serialVersionUID = 6656299352423612770L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Sequence(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- java.util.List<BPELElement> acts=
- findChildElements(BPELActivity.class);
-
- for (int i=0; i < acts.size(); i++) {
- if (acts.get(i).isActivity() &&
- acts.get(i) instanceof BPELActivity) {
- m_activities.add((BPELActivity)acts.get(i));
- }
- }
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Sequence(BPELLanguageModel model) {
- super(model, SEQUENCE);
- }
-
- /**
- * This method adds an activity to the grouping construct.
- *
- * @param act The activity to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addActivity(BPELActivity act, int pos) {
- if (pos == -1 || pos >= m_activities.size()) {
- m_activities.add(act);
-
- setChildElement(null, act, null);
- } else {
-
- BPELActivity cur=m_activities.get(pos);
-
- m_activities.add(pos, act);
-
- if (cur != null) {
- setChildElement(null, act,
- cur.getDOMElement());
- } else {
- setChildElement(null, act, null);
- }
- }
- }
-
- /**
- * This method removes an activity from the grouping
- * construct.
- *
- * @param act The activity to be removed
- * @return Whether the activity was removed
- */
- public boolean removeActivity(BPELActivity act) {
- boolean ret=m_activities.remove(act);
-
- if (ret) {
- getDOMElement().removeChild(act.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of activities associated
- * with the grouping construct.
- *
- * @return The list of activities
- */
- public java.util.List<BPELActivity> getActivities() {
- return(m_activities);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- for (int i=0; i < m_activities.size(); i++) {
- m_activities.get(i).convert(activities, context);
- }
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- int pos=getActivities().indexOf(elem);
- return("@activities."+pos);
- }
-
- private java.util.List<BPELActivity> m_activities=
- new java.util.Vector<BPELActivity>();
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Source.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Source.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Source.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,83 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the BPEL source element, contained within
- * any BPEL activity.
- */
-public class Source extends BPELElement {
-
- private static final long serialVersionUID = 4878669992635772776L;
-
- private static final String LINK_NAME = "linkName";
-
- public static final String SOURCE="source";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public Source(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Source(BPELLanguageModel model) {
- super(model, SOURCE);
- }
-
- /**
- * This method returns the name associated
- * with the link.
- *
- * @return The link name
- */
- public String getLinkName() {
- return(getDOMElement().getAttribute(LINK_NAME));
- }
-
- /**
- * This method sets the link name.
- *
- * @param name The name
- */
- public void setLinkName(String name) {
- getDOMElement().setAttribute(LINK_NAME, name);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Target.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Target.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Target.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,83 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the BPEL target element, contained within
- * any BPEL activity.
- */
-public class Target extends BPELElement {
-
- private static final long serialVersionUID = -8813636777020840433L;
-
- private static final String LINK_NAME = "linkName";
-
- public static final String TARGET="target";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public Target(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Target(BPELLanguageModel model) {
- super(model, TARGET);
- }
-
- /**
- * This method returns the name associated
- * with the link.
- *
- * @return The link name
- */
- public String getLinkName() {
- return(getDOMElement().getAttribute(LINK_NAME));
- }
-
- /**
- * This method sets the link name.
- *
- * @param name The name
- */
- public void setLinkName(String name) {
- getDOMElement().setAttribute(LINK_NAME, name);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandler.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandler.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/TerminationHandler.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,96 +0,0 @@
-/*
- * 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.scribble.model.Activity;
-
-/**
- * This class represents the 'terminationHandler' construct contained
- * within the 'scope' activity.
- */
-public class TerminationHandler extends BPELElement {
-
- private static final long serialVersionUID = 7316551859410369824L;
-
- public static final String TERMINATIONHANDLER="terminationHandler";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public TerminationHandler(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public TerminationHandler(BPELLanguageModel model) {
- super(model, TERMINATIONHANDLER);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- private BPELElement m_activity;
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Throw.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Throw.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Throw.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,123 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents the throw activity.
- *
- * @author gary
- */
-public class Throw extends BPELActivity {
-
- private static final long serialVersionUID = 9187657888490480490L;
-
- public static final String THROW = "throw";
-
- private static final String FAULT_NAME = "faultName";
- private static final String FAULT_VARIABLE = "faultVariable";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Throw(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Throw(BPELLanguageModel model) {
- super(model, THROW);
- }
-
- /**
- * This method sets the fault name.
- *
- * @param faultName The fault name
- */
- public void setFaultName(String faultName) {
- getDOMElement().setAttribute(FAULT_NAME, faultName);
- }
-
- /**
- * This method returns the fault name.
- *
- * @return The fault name
- */
- public String getFaultName() {
- return(getDOMElement().hasAttribute(FAULT_NAME)?
- getDOMElement().getAttribute(FAULT_NAME):null);
- }
-
- /**
- * This method sets the fault variable.
- *
- * @param faultVariable The fault variable
- */
- public void setFaultVariable(String faultVariable) {
- getDOMElement().setAttribute(FAULT_VARIABLE, faultVariable);
- }
-
- /**
- * This method returns the fault variable.
- *
- * @return The fault variable
- */
- public String getFaultVariable() {
- return(getDOMElement().hasAttribute(FAULT_VARIABLE)?
- getDOMElement().getAttribute(FAULT_VARIABLE):null);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Until.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Until.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Until.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,50 +0,0 @@
-/*
- * 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;
-
-/**
- * This class represents the BPEL 'until' element.
- */
-public class Until extends AbstractCondition {
-
- private static final long serialVersionUID = 5398291987513467996L;
-
- public static final String UNTIL="until";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public Until(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Until(BPELLanguageModel model) {
- super(model, UNTIL);
- }
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Variable.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Variable.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Variable.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,159 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents the variable.
- *
- * @author gary
- */
-public class Variable extends BPELElement {
-
- private static final long serialVersionUID = -3824104482191549444L;
-
- public static final String VARIABLE = "variable";
-
- private static final String NAME = "name";
- private static final String TYPE = "type";
- private static final String ELEMENT = "element";
- private static final String MESSAGE_TYPE = "messageType";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param element The XML configuration details for the element
- */
- public Variable(BPELLanguageModel model,
- org.w3c.dom.Element element) {
- super(model, element);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Variable(BPELLanguageModel model) {
- super(model, VARIABLE);
- }
-
- /**
- * This method sets the name.
- *
- * @param name The name
- */
- public void setName(String name) {
- getDOMElement().setAttribute(NAME, name);
- }
-
- /**
- * This method returns the name.
- *
- * @return The name
- */
- public String getName() {
- return(getDOMElement().hasAttribute(NAME)?
- getDOMElement().getAttribute(NAME):null);
- }
-
- /**
- * This method sets the variable type.
- *
- * @param type The type
- */
- public void setType(String type) {
- getDOMElement().setAttribute(TYPE, type);
- }
-
- /**
- * This method returns the variable type.
- *
- * @return The type
- */
- public String getType() {
- return(getDOMElement().hasAttribute(TYPE)?
- getDOMElement().getAttribute(TYPE):null);
- }
-
- /**
- * This method sets the variable element.
- *
- * @param element The element
- */
- public void setElement(String element) {
- getDOMElement().setAttribute(ELEMENT, element);
- }
-
- /**
- * This method returns the variable element.
- *
- * @return The element
- */
- public String getElement() {
- return(getDOMElement().hasAttribute(ELEMENT)?
- getDOMElement().getAttribute(ELEMENT):null);
- }
-
- /**
- * This method sets the variable message type.
- *
- * @param type The message type
- */
- public void setMessageType(String type) {
- getDOMElement().setAttribute(MESSAGE_TYPE, type);
- }
-
- /**
- * This method returns the variable message type.
- *
- * @return The message type
- */
- public String getMessageType() {
- return(getDOMElement().hasAttribute(MESSAGE_TYPE)?
- getDOMElement().getAttribute(MESSAGE_TYPE):null);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * This method converts the BPEL activity into an equivalent
- * behavioural description for conformance checking.
- *
- * @param activities The list of activities that will contain
- * the converted action(s)
- * @param context The conversion context
- */
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Wait.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Wait.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/Wait.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,148 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents the wait activity.
- *
- * @author gary
- */
-public class Wait extends BPELActivity {
-
- private static final String FOR = "for";
-
- private static final String UNTIL = "until";
-
- private static final long serialVersionUID = -3934422332929710337L;
-
- public static final String WAIT = "wait";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public Wait(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public Wait(BPELLanguageModel model) {
- super(model, WAIT);
- }
-
- /**
- * This method sets the 'until' condition.
- *
- * @param cond The 'until' condition
- */
- public void setUntil(Condition cond) {
- setChildElement(findChildElement(UNTIL),
- cond, null);
-
- org.w3c.dom.Element elem=findChildElement(FOR);
- if (elem != null) {
- getDOMElement().removeChild(elem);
- }
- }
-
- /**
- * This method returns the 'until' condition.
- *
- * @return The 'until' condition
- */
- public Condition getUntil() {
- Condition ret=null;
-
- org.w3c.dom.Element elem=findChildElement(UNTIL);
- if (elem != null) {
- ret = new Condition(getModel(), elem);
- }
-
- return(ret);
- }
-
- /**
- * This method sets the 'for' condition.
- *
- * @param cond The 'for' condition
- */
- public void setFor(Condition cond) {
- setChildElement(findChildElement(FOR),
- cond, null);
-
- org.w3c.dom.Element elem=findChildElement(UNTIL);
- if (elem != null) {
- getDOMElement().removeChild(elem);
- }
- }
-
- /**
- * This method returns the 'for' condition.
- *
- * @return The 'for' condition
- */
- public Condition getFor() {
- Condition ret=null;
-
- org.w3c.dom.Element elem=findChildElement(FOR);
- if (elem != null) {
- ret = new Condition(getModel(), elem);
- }
-
- return(ret);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
- }
-
-}
Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/While.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/While.java 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/component/While.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,173 +0,0 @@
-/*
- * 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.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.savara.tools.bpel.model.*;
-
-/**
- * This class represents a while grouping activity.
- *
- * @author gary
- */
-public class While extends BPELGroupingConstruct {
-
- private static final long serialVersionUID = -4173984531470466407L;
-
- public static final String WHILE = "while";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public While(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
-
- org.w3c.dom.Element cond=
- findChildElement(Condition.CONDITION);
-
- if (cond == null) {
- m_condition = new Condition(model);
- } else {
- m_condition = new Condition(model, cond);
- }
-
- m_activity = findChildActivity();
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public While(BPELLanguageModel model) {
- super(model, WHILE);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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) {
- getSource().setComponentURI(getURI());
-
- org.scribble.conversation.model.While elem=
- new org.scribble.conversation.model.While();
-
- // TODO: Convert while expression
-
- if (getActivity() != null) {
- getActivity().convert(elem.getBlock().getContents(), context);
- }
-
- activities.add(elem);
- }
-
- /**
- * This method sets the condition.
- *
- * @param cond The condition
- */
- public void setCondition(Condition cond) {
- m_condition = cond;
-
- org.w3c.dom.Element insertBefore=null;
-
- if (m_activity != null) {
- insertBefore = m_activity.getDOMElement();
- }
-
- setChildElement(findChildElement(Condition.CONDITION),
- cond, insertBefore);
- }
-
- /**
- * This method returns the condition.
- *
- * @return The condition
- */
- public Condition getCondition() {
- return(m_condition);
- }
-
- /**
- * This method sets the main 'if' activity.
- *
- * @param act The activity associated with the 'if'
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- BPELElement existing=findChildActivity();
- org.w3c.dom.Element existingElem=null;
-
- if (existing != null) {
- existingElem = existing.getDOMElement();
- }
-
- org.w3c.dom.Element insertBefore=null;
-
- setChildElement(existingElem, act,
- insertBefore);
- }
-
- /**
- * This method returns the activity associated with
- * the 'if' path.
- *
- * @return The 'if' activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- protected String getLocalURIPart(BPELElement elem) {
- String ret="";
-
- if (elem instanceof BPELActivity) {
- ret = "@activity";
- }
-
- return(ret);
- }
-
- private Condition m_condition=null;
- private BPELElement m_activity=null;
-}
Modified: 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 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF 2010-11-18 12:43:39 UTC (rev 476)
@@ -27,4 +27,5 @@
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)"
+ org.scribble.conversation.projector;bundle-version="[1.0.0,2.0.0)",
+ org.jboss.savara.bpel
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/change/ModelChangeUtilsTest.java (from rev 473, 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/bpel/model/change/ModelChangeUtilsTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/change/ModelChangeUtilsTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.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");
+ }
+ }
+}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component (from rev 473, trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/model/component)
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/AbstractInteractionTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,144 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/AbstractInteractionTest.java (from rev 474, 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/bpel/model/component/AbstractInteractionTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/AbstractInteractionTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELActivityTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,191 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELActivityTest.java (from rev 474, 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/bpel/model/component/BPELActivityTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELActivityTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELElementTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,401 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELElementTest.java (from rev 474, 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/bpel/model/component/BPELElementTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/BPELElementTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELElement;
+import org.jboss.savara.bpel.model.component.Condition;
+import org.jboss.savara.bpel.model.component.Else;
+import org.jboss.savara.bpel.model.component.If;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchAllTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,75 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchAllTest.java (from rev 474, 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/bpel/model/component/CatchAllTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchAllTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.CatchAll;
+import org.jboss.savara.bpel.model.component.Else;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,117 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchTest.java (from rev 474, 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/bpel/model/component/CatchTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CatchTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Catch;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CompensationHandlerTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,75 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CompensationHandlerTest.java (from rev 474, 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/bpel/model/component/CompensationHandlerTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/CompensationHandlerTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.CompensationHandler;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ConditionTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,167 +0,0 @@
-/*
- * 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+"'");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ConditionTest.java (from rev 474, 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/bpel/model/component/ConditionTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ConditionTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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+"'");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseIfTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,91 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseIfTest.java (from rev 474, 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/bpel/model/component/ElseIfTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseIfTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Elseif;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,74 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseTest.java (from rev 474, 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/bpel/model/component/ElseTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ElseTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Else;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/EventHandlersTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,411 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/EventHandlersTest.java (from rev 474, 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/bpel/model/component/EventHandlersTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/EventHandlersTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -0,0 +1,416 @@
+/*
+ * 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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELActivity;
+import org.jboss.savara.bpel.model.component.EventHandlers;
+import org.jboss.savara.bpel.model.component.OnAlarm;
+import org.jboss.savara.bpel.model.component.OnEvent;
+import org.jboss.savara.bpel.model.component.Scope;
+import org.jboss.savara.bpel.model.component.Sequence;
+
+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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ExitTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,35 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ExitTest.java (from rev 474, 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/bpel/model/component/ExitTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ExitTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FaultHandlersTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,391 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FaultHandlersTest.java (from rev 474, 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/bpel/model/component/FaultHandlersTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FaultHandlersTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -0,0 +1,394 @@
+/*
+ * 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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELActivity;
+import org.jboss.savara.bpel.model.component.Catch;
+import org.jboss.savara.bpel.model.component.FaultHandlers;
+import org.jboss.savara.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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FlowTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,398 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FlowTest.java (from rev 474, 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/bpel/model/component/FlowTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/FlowTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Flow;
+import org.jboss.savara.bpel.model.component.Link;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ForEachTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,213 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ForEachTest.java (from rev 474, 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/bpel/model/component/ForEachTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ForEachTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.ForEach;
+import org.jboss.savara.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/IfTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,1186 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/IfTest.java (from rev 474, 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/bpel/model/component/IfTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/IfTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -0,0 +1,1188 @@
+/*
+ * 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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELActivity;
+import org.jboss.savara.bpel.model.component.Condition;
+import org.jboss.savara.bpel.model.component.Else;
+import org.jboss.savara.bpel.model.component.Elseif;
+import org.jboss.savara.bpel.model.component.If;
+import org.jboss.savara.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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/InvokeTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,119 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/InvokeTest.java (from rev 474, 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/bpel/model/component/InvokeTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/InvokeTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnAlarmTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,913 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnAlarmTest.java (from rev 474, 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/bpel/model/component/OnAlarmTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnAlarmTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.For;
+import org.jboss.savara.bpel.model.component.OnAlarm;
+import org.jboss.savara.bpel.model.component.Sequence;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnEventTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,175 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnEventTest.java (from rev 474, 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/bpel/model/component/OnEventTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnEventTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnMessageTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,180 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnMessageTest.java (from rev 474, 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/bpel/model/component/OnMessageTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/OnMessageTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.OnMessage;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PartnerLinkTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,170 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PartnerLinkTest.java (from rev 474, 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/bpel/model/component/PartnerLinkTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PartnerLinkTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PickTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,417 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PickTest.java (from rev 474, 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/bpel/model/component/PickTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/PickTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -0,0 +1,420 @@
+/*
+ * 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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELActivity;
+import org.jboss.savara.bpel.model.component.OnAlarm;
+import org.jboss.savara.bpel.model.component.OnMessage;
+import org.jboss.savara.bpel.model.component.Pick;
+import org.jboss.savara.bpel.model.component.Sequence;
+
+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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ProcessTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,440 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ProcessTest.java (from rev 474, 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/bpel/model/component/ProcessTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ProcessTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.EventHandlers;
+import org.jboss.savara.bpel.model.component.FaultHandlers;
+import org.jboss.savara.bpel.model.component.PartnerLink;
+import org.jboss.savara.bpel.model.component.Process;
+import org.jboss.savara.bpel.model.component.Sequence;
+import org.jboss.savara.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReceiveTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,200 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReceiveTest.java (from rev 474, 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/bpel/model/component/ReceiveTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReceiveTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RepeatUntilTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,477 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RepeatUntilTest.java (from rev 474, 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/bpel/model/component/RepeatUntilTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RepeatUntilTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Condition;
+import org.jboss.savara.bpel.model.component.If;
+import org.jboss.savara.bpel.model.component.RepeatUntil;
+import org.jboss.savara.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReplyTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,119 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReplyTest.java (from rev 474, 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/bpel/model/component/ReplyTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ReplyTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RethrowTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,35 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RethrowTest.java (from rev 474, 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/bpel/model/component/RethrowTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/RethrowTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ScopeTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,494 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ScopeTest.java (from rev 474, 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/bpel/model/component/ScopeTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ScopeTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.CompensationHandler;
+import org.jboss.savara.bpel.model.component.EventHandlers;
+import org.jboss.savara.bpel.model.component.FaultHandlers;
+import org.jboss.savara.bpel.model.component.PartnerLink;
+import org.jboss.savara.bpel.model.component.Scope;
+import org.jboss.savara.bpel.model.component.Sequence;
+import org.jboss.savara.bpel.model.component.TerminationHandler;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/SequenceTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,333 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/SequenceTest.java (from rev 474, 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/bpel/model/component/SequenceTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/SequenceTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Sequence;
+import org.jboss.savara.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);
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TerminationHandlerTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,75 +0,0 @@
-/*
- * 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");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TerminationHandlerTest.java (from rev 474, 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/bpel/model/component/TerminationHandlerTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TerminationHandlerTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Sequence;
+import org.jboss.savara.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");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestAbstractInteraction.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,56 +0,0 @@
-/*
- * 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
-
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestAbstractInteraction.java (from rev 474, 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/bpel/model/component/TestAbstractInteraction.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestAbstractInteraction.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.component.AbstractInteraction;
+import org.jboss.savara.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
+
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELActivity.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,56 +0,0 @@
-/*
- * 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
-
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELActivity.java (from rev 474, 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/bpel/model/component/TestBPELActivity.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELActivity.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELActivity;
+import org.jboss.savara.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
+
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELElement.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,46 +0,0 @@
-/*
- * 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
-
- }
-
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELElement.java (from rev 474, 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/bpel/model/component/TestBPELElement.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/TestBPELElement.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELElement;
+import org.jboss.savara.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
+
+ }
+
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ThrowTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,119 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ThrowTest.java (from rev 474, 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/bpel/model/component/ThrowTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/ThrowTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/VariableTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,119 +0,0 @@
-/*
- * 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());
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/VariableTest.java (from rev 474, 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/bpel/model/component/VariableTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/VariableTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.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());
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WaitTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,621 +0,0 @@
-/*
- * 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+"'");
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WaitTest.java (from rev 474, 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/bpel/model/component/WaitTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WaitTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.Condition;
+import org.jboss.savara.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+"'");
+ }
+ }
+}
Deleted: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/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 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WhileTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -1,475 +0,0 @@
-/*
- * 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);
- }
- }
-}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WhileTest.java (from rev 474, 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/bpel/model/component/WhileTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/component/WhileTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -0,0 +1,478 @@
+/*
+ * 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.bpel.model.component;
+
+import org.jboss.savara.bpel.model.BPELLanguageModel;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.model.component.BPELActivity;
+import org.jboss.savara.bpel.model.component.Condition;
+import org.jboss.savara.bpel.model.component.If;
+import org.jboss.savara.bpel.model.component.Receive;
+import org.jboss.savara.bpel.model.component.Sequence;
+import org.jboss.savara.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");
+ }
+
+ org.jboss.savara.bpel.model.component.Process component=
+ new org.jboss.savara.bpel.model.component.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);
+ }
+ }
+}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/util/InteractionUtilTest.java (from rev 473, 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/bpel/model/util/InteractionUtilTest.java (rev 0)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/model/util/InteractionUtilTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -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.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");
+ }
+ }
+}
Copied: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util (from rev 473, trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util)
Modified: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/util/XMLUtilsTest.java 2010-11-17 22:14:27 UTC (rev 473)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -15,9 +15,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.savara.tools.bpel.util;
+package org.jboss.savara.bpel.util;
-import org.jboss.savara.tools.bpel.util.XMLUtils;
+import org.jboss.savara.bpel.util.XMLUtils;
import org.scribble.model.ModelObject;
import junit.framework.TestCase;
Modified: 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 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -22,9 +22,9 @@
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.bpel.model.BPELNotation;
+import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.savara.bpel.util.XMLUtils;
import org.jboss.savara.pi4soa.cdm.model.CDMNotation;
import org.scribble.extensions.RegistryFactory;
import org.scribble.model.Definition;
Modified: 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 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/parser/ParserTest.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -23,7 +23,7 @@
import junit.framework.TestResult;
import junit.framework.TestSuite;
-import org.jboss.savara.tools.bpel.model.BPELNotation;
+import org.jboss.savara.bpel.model.BPELNotation;
import org.scribble.conversation.model.ConversationModel;
import org.scribble.lang.model.*;
import org.scribble.conversation.model.ConversationNotation;
Modified: 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 2010-11-18 11:04:51 UTC (rev 475)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/tests/AllTests.java 2010-11-18 12:43:39 UTC (rev 476)
@@ -18,11 +18,11 @@
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.bpel.model.change.ModelChangeUtilsTest;
+import org.jboss.savara.bpel.model.component.*;
+import org.jboss.savara.bpel.model.util.InteractionUtilTest;
+import org.jboss.savara.bpel.util.XMLUtilsTest;
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;
More information about the savara-commits
mailing list