Author: objectiser
Date: 2010-12-20 12:43:34 -0500 (Mon, 20 Dec 2010)
New Revision: 508
Added:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseifGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FlowGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/IfGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/InvokeGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessageGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PickGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProcessGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProtocolGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReceiveGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReplyGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/SequenceGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/WhileGenerationRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ActivityUtil.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ImportUtil.java
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java
Removed:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/export/BPELLanguageModelStreamExportRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/GeneratorUtil.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/AbstractCondition.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/AbstractInteraction.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELActivity.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELElement.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELElementFactory.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELGroupingConstruct.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Catch.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/CatchAll.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/CompensationHandler.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Condition.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Else.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Elseif.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/EventHandlers.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Exit.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FaultHandlers.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Flow.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/For.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ForEach.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/If.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Import.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Invoke.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Link.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnAlarm.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnEvent.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessage.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PartnerLink.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Pick.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Process.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Receive.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/RepeatUntil.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Reply.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Rethrow.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Scope.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeActivity.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Sequence.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Source.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Target.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/TerminationHandler.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Throw.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Until.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Variable.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Wait.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/While.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELLanguageModel.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELNotation.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/DefaultBPELLanguageModel.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELModelParserRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELTokenizer.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/AbstractInteractionTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELActivityTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELElementTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchAllTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CompensationHandlerTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ConditionTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseIfTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/EventHandlersTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ExitTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FaultHandlersTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FlowTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ForEachTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/IfTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/InvokeTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnAlarmTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnEventTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnMessageTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PartnerLinkTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PickTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ProcessTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReceiveTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RepeatUntilTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReplyTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RethrowTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ScopeTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/SequenceTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TerminationHandlerTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestAbstractInteraction.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELActivity.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELElement.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ThrowTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/VariableTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WaitTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WhileTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/util/InteractionUtilTest.java
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/BPELDefinitions.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/change/ProtocolModelChangeRule.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/PartnerLinkUtil.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/change/ModelChangeUtilsTest.java
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/actions/GenerateAction.java
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/util/XMLUtils.java
Log:
Intermediate save - still refactoring.
Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF 2010-12-17
08:46:19 UTC (rev 507)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF 2010-12-20
17:43:34 UTC (rev 508)
@@ -26,6 +26,5 @@
org.savara.bpel.model.change.RunModelChangeRule,
org.savara.bpel.model.change.SpawnModelChangeRule,
org.savara.bpel.model.change.ConversationInteractionModelChangeRule
-Export-Package:
org.savara.bpel.change;x-friends:="org.savara.tools.bpel.tests",
- org.savara.bpel.model2;x-friends:="org.savara.tools.bpel.tests",
- org.savara.bpel.toprotocol;x-friends:="org.savara.tools.bpel.tests"
+Export-Package:
org.savara.bpel.model.change;x-friends:="org.savara.tools.bpel.tests",
+
org.savara.bpel.model.generator.protocol;x-friends:="org.savara.tools.bpel.tests"
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/BPELDefinitions.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/BPELDefinitions.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/BPELDefinitions.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -21,4 +21,6 @@
public static final String BPEL_MODEL_PROPERTY="bpel.model";
+ public static final String BPEL_TYPE="bpel";
+
}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/export/BPELLanguageModelStreamExportRule.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/export/BPELLanguageModelStreamExportRule.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/export/BPELLanguageModelStreamExportRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.export;
-
-import java.io.IOException;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.BPELNotation;
-import org.savara.util.XMLUtils;
-import org.scribble.export.ExportRule;
-import org.scribble.export.ExporterContext;
-import org.scribble.export.Formatter;
-import org.scribble.export.stream.AbstractModelStreamExportRule;
-import org.scribble.export.stream.StreamFormatter;
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.ModelObject;
-
-/**
- * This class implements the stream based export rule for the
- * BPELLanguageModel entity.
- */
-(a)RegistryInfo(extension=ExportRule.class,notation=BPELNotation.NOTATION_CODE)
-public class BPELLanguageModelStreamExportRule extends AbstractModelStreamExportRule {
-
- /**
- * This method determines whether the exporter rule is appropriate
- * for the supplied model object and format.
- *
- * @param modelObject The model object
- * @param format The format
- * @return Whether the rule is appropriate for the model object and
- * format
- */
- public boolean isSupported(ModelObject modelObject, Formatter format) {
- return(super.isSupported(modelObject, format) &&
- BPELLanguageModel.class.isAssignableFrom(modelObject.getClass()));
- }
-
- /**
- * This method exports the model object.
- *
- * @param modelObject The model object
- * @param context The context
- * @throws IOException Failed to record export information
- */
- public void export(ModelObject modelObject, ExporterContext context)
- throws java.io.IOException {
- BPELLanguageModel model=(BPELLanguageModel)modelObject;
- StreamFormatter formatter=(StreamFormatter)context.getFormatter();
-
- try {
- String text=XMLUtils.toText(model.getBPELProcess().getDOMElement());
- formatter.record(text.getBytes());
-
- } catch(Exception e) {
- throw new java.io.IOException("Failed to get BPEL process text");
- }
- }
-
-}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/change/ProtocolModelChangeRule.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/change/ProtocolModelChangeRule.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/change/ProtocolModelChangeRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -21,7 +21,7 @@
import org.savara.bpel.model.TProcess;
import org.savara.bpel.model.TScope;
import org.savara.bpel.model.TSequence;
-import org.savara.bpel.model.generator.GeneratorUtil;
+import org.savara.bpel.util.ImportUtil;
import org.savara.contract.model.Contract;
import org.savara.contract.model.Interface;
import org.savara.model.change.ModelChangeContext;
@@ -227,7 +227,7 @@
}
if (gen) {
- String fileName=GeneratorUtil.getWSDLFileName(role,
+ String fileName=ImportUtil.getWSDLFileName(role,
conv.getName(), "");
TImport imp=new TImport();
Added:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2005-8 Pi4 Technologies Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Change History:
+ * 24 Jul 2008 : Initial version created by gary
+ */
+package org.savara.bpel.model.generator;
+
+import org.savara.bpel.BPELDefinitions;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.generator.protocol.DefaultConversionContext;
+import org.savara.model.ProtocolDefinitions;
+import org.savara.model.generator.ModelGenerator;
+import org.savara.util.ResourceLocator;
+import org.scribble.common.logging.Journal;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents the BPEL to Protocol implementation of the model
+ * generator interface.
+ */
+public class BPELToProtocolModelGenerator implements ModelGenerator {
+
+ public boolean isSupported(String sourceType, String targetType) {
+ return(sourceType.equals(ProtocolDefinitions.PROTOCOL_TYPE) &&
+ targetType.equals(BPELDefinitions.BPEL_TYPE));
+ }
+
+ public Object generate(Object source, Journal journal, ResourceLocator locator) {
+ ProtocolModel ret=new ProtocolModel();
+ TProcess process=(TProcess)source;
+
+ //ret.derivedFrom(this);
+ //ret.getBlock().derivedFrom(this);
+
+ Protocol protocol=new Protocol();
+
+ // Configure model name
+ protocol.setName(process.getName());
+
+ // Define implements reference for conversation type
+ //String convType=getConversationType();
+ String role=null;
+
+ // Convert the process contents
+ DefaultConversionContext context=new DefaultConversionContext(role, process, locator);
+
+ context.convert(process, protocol.getBlock().getContents());
+
+ return(ret);
+ }
+
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/GeneratorUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/GeneratorUtil.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/GeneratorUtil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,41 +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.savara.bpel.model.generator;
-
-import org.scribble.protocol.model.Role;
-
-/**
- * This class provides general utility functions for
- * use when generating artefacts.
- */
-public class GeneratorUtil {
-
- /**
- * This method returns the WSDL file name for the supplied role and local
- * conversation model.
- *
- * @param role The role
- * @param localcm The local conversation model
- * @param fileNum The file name (zero being the main wsdl file)
- * @return The file name
- */
- public static String getWSDLFileName(Role role, String modelName, String suffix) {
- return(modelName+"_"+role.getName()+suffix+".wsdl");
- }
-
-}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -22,7 +22,9 @@
import org.savara.bpel.BPELDefinitions;
import org.savara.bpel.model.TProcess;
import org.savara.bpel.model.change.BPELModelChangeContext;
+import org.savara.model.ProtocolDefinitions;
import org.savara.model.generator.ModelGenerator;
+import org.savara.util.ResourceLocator;
import org.scribble.common.logging.Journal;
import org.scribble.protocol.model.*;
@@ -33,11 +35,11 @@
public class ProtocolToBPELModelGenerator implements ModelGenerator {
public boolean isSupported(String sourceType, String targetType) {
- // TODO Auto-generated method stub
- return false;
+ return(sourceType.equals(ProtocolDefinitions.PROTOCOL_TYPE) &&
+ targetType.equals(BPELDefinitions.BPEL_TYPE));
}
- public Object generate(Object source, Journal journal) {
+ public Object generate(Object source, Journal journal, ResourceLocator locator) {
BPELModelChangeContext context=
new BPELModelChangeContext();
ProtocolModel pm=(ProtocolModel)source;
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol)
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/AbstractCondition.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/AbstractCondition.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/AbstractCondition.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/AbstractInteraction.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/AbstractInteraction.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/AbstractInteraction.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,158 +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.savara.bpel.toprotocol;
-
-import javax.xml.namespace.QName;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.TypeReference;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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
- */
- public void validate(Journal l) {
- }
-
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELActivity.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/BPELActivity.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELActivity.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,413 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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) {
-
- /* TODO: Currently don't have a 'when' construct similar to CDL
- *
- *
- 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.protocol.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);
-
- /* TODO: How to deal with sources???
- *
- *
- // 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELElement.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/BPELElement.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELElement.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,408 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.savara.util.XMLUtils;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-import org.apache.commons.logging.*;
-
-/**
- * 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(Journal 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 void visit(Visitor visitor) {
- // TODO: Not sure if need visitor implementations
- }
-
- 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELElementFactory.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/BPELElementFactory.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELElementFactory.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,67 +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.savara.bpel.toprotocol;
-
-import org.apache.commons.logging.*;
-import org.savara.bpel.model2.BPELLanguageModel;
-
-public class BPELElementFactory {
-
- public static final String MODEL_COMPONENTS_PACKAGE =
BPELElementFactory.class.getPackage().getName();
-
- /**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELGroupingConstruct.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/BPELGroupingConstruct.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/BPELGroupingConstruct.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.apache.commons.logging.*;
-import org.savara.bpel.model2.*;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Catch.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Catch.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Catch.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/CatchAll.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/CatchAll.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/CatchAll.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/CompensationHandler.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/CompensationHandler.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/CompensationHandler.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Condition.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Condition.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Condition.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.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);
- }
-
-}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/ConversionContext.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -15,25 +15,37 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.savara.bpel.toprotocol;
+package org.savara.bpel.model.generator.protocol;
-import org.scribble.model.admin.Context;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TVariable;
+import org.savara.util.ResourceLocator;
+import org.scribble.protocol.model.Activity;
public interface ConversionContext {
/**
- * This method returns a reference to the environment context.
+ * This method applies the conversion process to the supplied component.
*
- * @return The environment context
+ * @param component The domain component
+ * @param activities The list of protocol activities to place the conversion results
*/
- public Context getEnvironmentContext();
+ public void convert(Object component, java.util.List<Activity> activities);
/**
+ * This method returns a reference to the resource locator.
+ *
+ * @return The resource locator
+ */
+ public ResourceLocator getResourceLocator();
+
+ /**
* This method returns the process.
*
* @return The process
*/
- public Process getProcess();
+ public TProcess getProcess();
/**
* This method returns the role associated with the
@@ -50,28 +62,40 @@
* @param name The name
* @return The variable, or null if not found
*/
- public Variable getVariable(String name);
+ public TVariable getVariable(String name);
/**
* This method adds a variable to the context.
*
* @param var The variable
*/
- public void addVariable(Variable var);
+ public void addVariable(TVariable var);
/**
* This method removes a variable from the context.
*
* @param var The variable
*/
- public void removeVariable(Variable var);
+ public void removeVariable(TVariable var);
/**
- * This method returns the namespace for the supplied prefix.
+ * This method pushes the supplied scope on the stack.
*
- * @param prefix The prefix
- * @return The namespace, or null if not found
+ * @param scope The scope
*/
- public String getNamespace(String prefix);
-
+ public void pushScope(TScope scope);
+
+ /**
+ * This method pops the top scope from the stack.
+ *
+ */
+ public void popScope();
+
+ /**
+ * This method returns the current scope.
+ *
+ * @return The scope, or null if not within a scope
+ */
+ public TScope getScope();
+
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/DefaultConversionContext.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -15,15 +15,45 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.savara.bpel.toprotocol;
+package org.savara.bpel.model.generator.protocol;
-import org.scribble.model.admin.Context;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TVariable;
+import org.savara.util.ResourceLocator;
+import org.scribble.protocol.model.Activity;
/**
* This class provides a default implementation of the conversation
* context.
*/
public class DefaultConversionContext implements ConversionContext {
+
+ private String m_role=null;
+ private TProcess m_process=null;
+ private ResourceLocator m_resourceLocator=null;
+ private java.util.Map<String,TVariable> m_variables=
+ new java.util.HashMap<String,TVariable>();
+ private java.util.Stack<TScope> m_scopeStack=new java.util.Stack<TScope>();
+
+ private static java.util.List<ProtocolGenerationRule> m_rules=
+ new java.util.Vector<ProtocolGenerationRule>();
+
+ static {
+ m_rules.add(new ElseGenerationRule());
+ m_rules.add(new ElseifGenerationRule());
+ m_rules.add(new FlowGenerationRule());
+ m_rules.add(new IfGenerationRule());
+ m_rules.add(new InvokeGenerationRule());
+ m_rules.add(new OnMessageGenerationRule());
+ m_rules.add(new PickGenerationRule());
+ m_rules.add(new ProcessGenerationRule());
+ m_rules.add(new ReceiveGenerationRule());
+ m_rules.add(new ReplyGenerationRule());
+ m_rules.add(new ScopeGenerationRule());
+ m_rules.add(new SequenceGenerationRule());
+ m_rules.add(new WhileGenerationRule());
+ }
/**
* This is the constructor for the conversion context, initialised
@@ -31,21 +61,41 @@
*
* @param role The role
* @param proc The process
- * @param envContext The environment context
+ * @param locator The resource locator
*/
- public DefaultConversionContext(String role, Process proc, Context envContext) {
+ public DefaultConversionContext(String role, TProcess proc, ResourceLocator locator) {
m_role = role;
m_process = proc;
- m_environmentContext = envContext;
+ m_resourceLocator = locator;
}
/**
+ * This method applies the conversion process to the supplied component.
+ *
+ * @param component The domain component
+ * @param activities The list of protocol activities to place the conversion results
+ */
+ public void convert(Object component, java.util.List<Activity> activities) {
+ ProtocolGenerationRule rule=null;
+
+ for (int i=0; rule == null && i < m_rules.size(); i++) {
+ if (m_rules.get(i).isSupported(component)) {
+ rule = m_rules.get(i);
+ }
+ }
+
+ if (rule != null) {
+ rule.convert(this, component, activities);
+ }
+ }
+
+ /**
* This method returns a reference to the environment context.
*
* @return The environment context
*/
- public Context getEnvironmentContext() {
- return(m_environmentContext);
+ public ResourceLocator getResourceLocator() {
+ return(m_resourceLocator);
}
/**
@@ -53,7 +103,7 @@
*
* @return The process
*/
- public Process getProcess() {
+ public TProcess getProcess() {
return(m_process);
}
@@ -74,7 +124,7 @@
* @param name The name
* @return The variable, or null if not found
*/
- public Variable getVariable(String name) {
+ public TVariable getVariable(String name) {
return(m_variables.get(name));
}
@@ -83,7 +133,7 @@
*
* @param var The variable
*/
- public void addVariable(Variable var) {
+ public void addVariable(TVariable var) {
m_variables.put(var.getName(), var);
}
@@ -92,23 +142,33 @@
*
* @param var The variable
*/
- public void removeVariable(Variable var) {
+ public void removeVariable(TVariable var) {
m_variables.remove(var.getName());
}
/**
- * This method returns the namespace for the supplied prefix.
+ * This method pushes the supplied scope on the stack.
*
- * @param prefix The prefix
- * @return The namespace, or null if not found
+ * @param scope The scope
*/
- public String getNamespace(String prefix) {
- return(m_process.getNamespace(prefix));
+ public void pushScope(TScope scope) {
+ m_scopeStack.push(scope);
}
- 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>();
+ /**
+ * This method pops the top scope from the stack.
+ *
+ */
+ public void popScope() {
+ m_scopeStack.pop();
+ }
+
+ /**
+ * This method returns the current scope.
+ *
+ * @return The scope, or null if not within a scope
+ */
+ public TScope getScope() {
+ return(m_scopeStack.peek());
+ }
}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Else.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Else.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Else.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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;
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Else.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TActivityContainer;
+import org.savara.bpel.util.ActivityUtil;
+import org.scribble.protocol.model.Activity;
+
+/**
+ * This class represents the 'else' construct contained
+ * within the 'if' activity.
+ */
+public class ElseGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TActivityContainer);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TActivityContainer container=(TActivityContainer)component;
+
+ TActivity act=ActivityUtil.getActivity(container);
+
+ if (act != null) {
+ context.convert(act, activities);
+ }
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Elseif.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Elseif.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Elseif.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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;
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseifGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Elseif.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseifGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseifGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TElseif;
+import org.savara.bpel.util.ActivityUtil;
+import org.scribble.protocol.model.Activity;
+
+/**
+ * This class represents the 'elseif' construct contained
+ * within the 'if' activity.
+ */
+public class ElseifGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TElseif);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TElseif container=(TElseif)component;
+
+ TActivity act=ActivityUtil.getActivity(container);
+
+ if (act != null) {
+ context.convert(act, activities);
+ }
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/EventHandlers.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/EventHandlers.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/EventHandlers.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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 += "(a)onEvent."+getOnEvents().indexOf(elem);
- } else if (elem instanceof OnAlarm) {
- ret += "(a)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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Exit.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Exit.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Exit.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FaultHandlers.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/FaultHandlers.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FaultHandlers.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.apache.commons.logging.*;
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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 += "(a)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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Flow.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Flow.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Flow.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,292 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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
-
- /* TODO: Basis for source link mechanism - but no variables
- * supported yet
- *
- if (getLinks().size() > 0) {
- org.scribble.conversation.model.VariableList vl=
- new org.scribble.conversation.model.VariableList();
-
- org.scribble.protocol.model.TypeReference tref=
- new org.scribble.protocol.model.TypeReference();
- tref.setName("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.protocol.model.Parallel parallel=
- new org.scribble.protocol.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>();
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FlowGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Flow.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FlowGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FlowGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,84 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TFlow;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a flow grouping activity.
+ *
+ */
+public class FlowGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TFlow);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TFlow elem=(TFlow)component;
+
+ //getSource().setComponentURI(getURI());
+
+ // If links have been defined, represent them as boolean
+ // variables that can be tested using a 'when' clause
+
+ /* TODO: Basis for source link mechanism - but no variables
+ * supported yet
+ *
+ if (getLinks().size() > 0) {
+ org.scribble.conversation.model.VariableList vl=
+ new org.scribble.conversation.model.VariableList();
+
+ org.scribble.protocol.model.TypeReference tref=
+ new org.scribble.protocol.model.TypeReference();
+ tref.setName("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.protocol.model.Parallel parallel=
+ new org.scribble.protocol.model.Parallel();
+
+ for (int i=0; i < elem.getActivity().size(); i++) {
+ Block b=new Block();
+
+ context.convert(elem.getActivity().get(i), b.getContents());
+
+ parallel.getBlocks().add(b);
+ }
+
+ activities.add(parallel);
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/For.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/For.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/For.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ForEach.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/ForEach.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ForEach.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/If.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/If.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/If.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,289 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-import org.apache.commons.logging.*;
-
-/**
- * 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(Journal 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.protocol.model.Choice elem=
- new org.scribble.protocol.model.Choice();
-
- When cb=new When();
-
- // TODO: Convert the conditional expression
-
- if (getActivity() != null) {
- getActivity().convert(cb.getBlock().getContents(), context);
- }
-
- elem.getWhens().add(cb);
-
- // Convert 'else if' paths
- for (int i=0; i < getElseIfPaths().size(); i++) {
- Elseif elseIfElem=getElseIfPaths().get(i);
-
- cb = new When();
-
- elseIfElem.convert(cb.getBlock().getContents(), context);
-
- elem.getWhens().add(cb);
- }
-
- // Convert 'else' path
- if (getElsePath() != null) {
- cb = new When();
-
- getElsePath().convert(cb.getBlock().getContents(), context);
-
- elem.getWhens().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 = "(a)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>();
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/IfGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/If.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/IfGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/IfGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,80 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TElseif;
+import org.savara.bpel.model.TIf;
+import org.savara.bpel.util.ActivityUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents an 'if' grouping construct.
+ *
+ */
+public class IfGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TIf);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TIf bpelElem=(TIf)component;
+
+ //getSource().setComponentURI(getURI());
+
+ org.scribble.protocol.model.Choice elem=
+ new org.scribble.protocol.model.Choice();
+
+ When cb=new When();
+
+ // TODO: Convert the conditional expression
+
+ TActivity act=ActivityUtil.getActivity(bpelElem);
+
+ if (act != null) {
+ context.convert(act, cb.getBlock().getContents());
+ }
+
+ elem.getWhens().add(cb);
+
+ // Convert 'else if' paths
+ for (int i=0; i < bpelElem.getElseif().size(); i++) {
+ TElseif elseIfElem=bpelElem.getElseif().get(i);
+
+ cb = new When();
+
+ context.convert(elseIfElem, cb.getBlock().getContents());
+
+ elem.getWhens().add(cb);
+ }
+
+ // Convert 'else' path
+ if (bpelElem.getElse() != null) {
+ cb = new When();
+
+ context.convert(bpelElem.getElse(), cb.getBlock().getContents());
+
+ elem.getWhens().add(cb);
+ }
+
+ activities.add(elem);
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Import.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Import.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Import.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Invoke.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Invoke.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Invoke.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,318 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.savara.bpel.util.TypeReferenceUtil;
-import org.savara.util.XMLUtils;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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.protocol.model.Choice te=
- new org.scribble.protocol.model.Choice();
- te.derivedFrom(this);
-
- activities.add(te);
-
- org.scribble.protocol.model.When when=
- new org.scribble.protocol.model.When();
- te.getWhens().add(when);
-
- activities = when.getBlock().getContents();
-
- for (int i=0; i < scope.getFaultHandlers().getCatchPaths().size(); i++) {
- Catch catchBlock=scope.getFaultHandlers().getCatchPaths().get(i);
-
- org.scribble.protocol.model.When fcb=
- new org.scribble.protocol.model.When();
-
- 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.getBlock().getContents(), catchBlock.getFaultVariable(),
- mesgType, context);
-
- org.scribble.protocol.model.Raise raise=
- new org.scribble.protocol.model.Raise();
-
- TypeReference tref=new TypeReference();
- tref.setName(XMLUtils.getLocalname(catchBlock.getFaultName()));
- raise.setType(tref);
-
- fcb.getBlock().add(raise);
-
- te.getWhens().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
- Interaction interaction=new Interaction();
- 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.getTypeReferences().add(tref);
-
- if (context.getRole() != null) {
- interaction.setFromRole(new Role(context.getRole()));
- }
-
- String toRole=getClientPartnerRole();
-
- if (toRole != null) {
- interaction.getToRoles().add(new Role(toRole));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-
- protected void convertResponse(java.util.List<Activity> activities,
- ConversionContext context) {
-
- // Create interaction for request
- Interaction interaction=new Interaction();
- 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.getTypeReferences().add(tref);
-
- String fromRole=getClientPartnerRole();
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.getToRoles().add(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
- Interaction interaction=new Interaction();
- 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.getTypeReferences().add(tref);
-
- String fromRole=getClientPartnerRole();
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.getToRoles().add(new Role(context.getRole()));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/InvokeGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Invoke.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/InvokeGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/InvokeGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,229 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.savara.bpel.model.TCatch;
+import org.savara.bpel.model.TInvoke;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TVariable;
+import org.savara.bpel.util.InteractionUtil;
+import org.savara.bpel.util.PartnerLinkUtil;
+import org.savara.bpel.util.TypeReferenceUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents an unsupported (or custom) action within
+ * the conversation based ESB service descriptor.
+ *
+ */
+public class InvokeGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TInvoke);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TInvoke invoke=(TInvoke)component;
+
+ //getSource().setComponentURI(getURI());
+
+ convertRequest(invoke, activities, context);
+
+ // Check if invoke is contained within a scope that defines
+ // fault handlers. If so, then generate choice to throw
+ // fault exceptions.
+ TScope scope=context.getScope();
+
+ if (scope != null && scope.getFaultHandlers() != null &&
+ (scope.getFaultHandlers().getCatch().size() > 0 ||
+ scope.getFaultHandlers().getCatchAll() != null)) {
+ org.scribble.protocol.model.Choice te=
+ new org.scribble.protocol.model.Choice();
+ //te.derivedFrom(this);
+
+ activities.add(te);
+
+ org.scribble.protocol.model.When when=
+ new org.scribble.protocol.model.When();
+ te.getWhens().add(when);
+
+ activities = when.getBlock().getContents();
+
+ for (int i=0; i < scope.getFaultHandlers().getCatch().size(); i++) {
+ TCatch catchBlock=scope.getFaultHandlers().getCatch().get(i);
+
+ org.scribble.protocol.model.When fcb=
+ new org.scribble.protocol.model.When();
+
+ QName mesgType=catchBlock.getFaultMessageType();
+
+ if (mesgType == null) {
+ mesgType = catchBlock.getFaultElement();
+ }
+
+ TVariable faultVar=null;
+
+ if (catchBlock.getFaultVariable() != null) {
+ faultVar = new TVariable();
+ faultVar.setName(catchBlock.getFaultVariable());
+ faultVar.setMessageType(catchBlock.getFaultMessageType());
+ faultVar.setElement(catchBlock.getFaultElement());
+ context.addVariable(faultVar);
+ }
+
+ convertFaultResponse(invoke, fcb.getBlock().getContents(),
catchBlock.getFaultVariable(),
+ mesgType, context);
+
+ org.scribble.protocol.model.Raise raise=
+ new org.scribble.protocol.model.Raise();
+
+ TypeReference tref=new TypeReference();
+ tref.setName(catchBlock.getFaultName().getLocalPart());
+ raise.setType(tref);
+
+ fcb.getBlock().add(raise);
+
+ te.getWhens().add(fcb);
+
+ if (faultVar != null) {
+ context.removeVariable(faultVar);
+ }
+ }
+ }
+
+ if (invoke.getOutputVariable() != null) {
+
+ convertResponse(invoke, activities, context);
+ }
+ }
+
+ protected static void convertRequest(TInvoke invoke, java.util.List<Activity>
activities,
+ ConversionContext context) {
+ // Create interaction for request
+ Interaction interaction=new Interaction();
+ //interaction.derivedFrom(this);
+
+ TVariable var=context.getVariable(invoke.getInputVariable());
+
+ String xmlType=InteractionUtil.getXMLType(context.getProcess(), var.getMessageType(),
+ context.getResourceLocator());
+
+ TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
+
+ MessageSignature ms=new MessageSignature();
+ ms.setOperation(invoke.getOperation());
+ ms.getTypeReferences().add(tref);
+
+ if (context.getRole() != null) {
+ interaction.setFromRole(new Role(context.getRole()));
+ }
+
+ String toRole=PartnerLinkUtil.getClientPartnerRole(invoke.getPartnerLink());
+
+ if (toRole != null) {
+ interaction.getToRoles().add(new Role(toRole));
+ }
+
+ interaction.setMessageSignature(ms);
+
+ activities.add(interaction);
+ }
+
+ protected static void convertResponse(TInvoke invoke, java.util.List<Activity>
activities,
+ ConversionContext context) {
+
+ // Create interaction for request
+ Interaction interaction=new Interaction();
+ //interaction.derivedFrom(this);
+
+ TVariable var=context.getVariable(invoke.getOutputVariable());
+
+ String xmlType=InteractionUtil.getXMLType(context.getProcess(), var.getMessageType(),
+ context.getResourceLocator());
+
+ TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
+
+ MessageSignature ms=new MessageSignature();
+ ms.setOperation(invoke.getOperation());
+ ms.getTypeReferences().add(tref);
+
+ String fromRole=PartnerLinkUtil.getClientPartnerRole(invoke.getPartnerLink());
+
+ if (fromRole != null) {
+ interaction.setFromRole(new Role(fromRole));
+ }
+
+ if (context.getRole() != null) {
+ interaction.getToRoles().add(new Role(context.getRole()));
+ }
+
+ interaction.setMessageSignature(ms);
+
+ activities.add(interaction);
+ }
+
+ protected static void convertFaultResponse(TInvoke invoke,
java.util.List<Activity> activities,
+ String faultVar, QName faultMesgType, ConversionContext context) {
+
+ // Create interaction for request
+ Interaction interaction=new Interaction();
+ //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.
+
+ TVariable var=context.getVariable(faultVar);
+
+ if (var != null) {
+ String xmlType=InteractionUtil.getXMLType(context.getProcess(), var.getMessageType(),
+ context.getResourceLocator());
+
+ tref = TypeReferenceUtil.createTypeReference(xmlType, context);
+ //tref.setLocalpart(var.getMessageType());
+ } else if (faultMesgType != null) {
+ tref = TypeReferenceUtil.createTypeReference(faultMesgType.getLocalPart(), context);
+ //tref.setLocalpart(faultMesgType);
+ }
+
+ MessageSignature ms=new MessageSignature();
+ ms.setOperation(invoke.getOperation());
+ ms.getTypeReferences().add(tref);
+
+ String fromRole=PartnerLinkUtil.getClientPartnerRole(invoke.getPartnerLink());
+
+ if (fromRole != null) {
+ interaction.setFromRole(new Role(fromRole));
+ }
+
+ if (context.getRole() != null) {
+ interaction.getToRoles().add(new Role(context.getRole()));
+ }
+
+ interaction.setMessageSignature(ms);
+
+ activities.add(interaction);
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Link.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Link.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Link.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnAlarm.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/OnAlarm.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnAlarm.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnEvent.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/OnEvent.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnEvent.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessage.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/OnMessage.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessage.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,233 +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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.util.TypeReferenceUtil;
-import org.scribble.protocol.model.*;
-
-/**
- * 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) {
-
- Interaction interaction=new Interaction();
-
- 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.getTypeReferences().add(tref);
-
- String fromRole=getServerPartnerRole();
-
- if (fromRole != null) {
- interaction.setFromRole(new Role(fromRole));
- }
-
- if (context.getRole() != null) {
- interaction.getToRoles().add(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;
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessageGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/OnMessage.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessageGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessageGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,77 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TOnMessage;
+import org.savara.bpel.model.TVariable;
+import org.savara.bpel.util.ActivityUtil;
+import org.savara.bpel.util.InteractionUtil;
+import org.savara.bpel.util.PartnerLinkUtil;
+import org.savara.bpel.util.TypeReferenceUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents the 'onMessage' construct contained
+ * within the 'pick' activity.
+ */
+public class OnMessageGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TOnMessage);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TOnMessage elem=(TOnMessage)component;
+
+ Interaction interaction=new Interaction();
+
+ TVariable var=context.getVariable(elem.getVariable());
+
+ String xmlType=InteractionUtil.getXMLType(context.getProcess(), var.getMessageType(),
+ context.getResourceLocator());
+
+ TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
+
+ MessageSignature ms=new MessageSignature();
+ ms.setOperation(elem.getOperation());
+ ms.getTypeReferences().add(tref);
+
+ String fromRole=PartnerLinkUtil.getServerPartnerRole(elem.getPartnerLink());
+
+ if (fromRole != null) {
+ interaction.setFromRole(new Role(fromRole));
+ }
+
+ if (context.getRole() != null) {
+ interaction.getToRoles().add(new Role(context.getRole()));
+ }
+
+ interaction.setMessageSignature(ms);
+
+ activities.add(interaction);
+
+ TActivity act=ActivityUtil.getActivity(elem);
+
+ if (act != null) {
+ context.convert(act, activities);
+ }
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PartnerLink.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/PartnerLink.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PartnerLink.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Pick.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Pick.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Pick.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,283 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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.protocol.model.Choice elem=
- new org.scribble.protocol.model.Choice();
-
- // Convert 'onMessage' paths
- for (int i=0; i < getOnMessages().size(); i++) {
- OnMessage onMessageElem=getOnMessages().get(i);
-
- When cb = new When();
-
- onMessageElem.convert(cb.getBlock().getContents(), context);
-
- elem.getWhens().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 += "(a)onMessage."+getOnMessages().indexOf(elem);
- } else if (elem instanceof OnAlarm) {
- ret += "(a)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>();
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PickGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Pick.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PickGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PickGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,62 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TOnMessage;
+import org.savara.bpel.model.TPick;
+import org.savara.bpel.model.TReply;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a pick grouping activity.
+ *
+ * @author gary
+ */
+public class PickGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TReply);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TPick pick=(TPick)component;
+
+ //getSource().setComponentURI(getURI());
+
+ org.scribble.protocol.model.Choice elem=
+ new org.scribble.protocol.model.Choice();
+
+ // Convert 'onMessage' paths
+ for (int i=0; i < pick.getOnMessage().size(); i++) {
+ TOnMessage onMessageElem=pick.getOnMessage().get(i);
+
+ When cb = new When();
+
+ context.convert(onMessageElem, cb.getBlock().getContents());
+
+ elem.getWhens().add(cb);
+ }
+
+ // TODO: If alarms defined, then model these using a
+ // try/catch with interrupt?
+
+ activities.add(elem);
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Process.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Process.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Process.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,976 +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.savara.bpel.toprotocol;
-
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import org.savara.bpel.model2.*;
-import org.savara.bpel.util.InteractionUtil;
-import org.savara.util.XMLUtils;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * 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(Journal 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.protocol.model.Choice choice=new org.scribble.protocol.model.Choice();
-
- When cb=new When();
-
- invoke.convertResponse(cb.getBlock().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.getBlock().getContents(),
context);
- }
- }
-
- choice.getWhens().add(cb);
-
- // Process fault handlers
- for (int i=0; i < m_faultHandlers.getCatchPaths().size(); i++) {
- Catch catchBlock=m_faultHandlers.getCatchPaths().get(i);
-
- When fcb=new When();
-
- 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.getBlock().getContents(),
catchBlock.getFaultVariable(),
- mesgType, context);
-
- if (catchBlock.getActivity() != null) {
- catchBlock.getActivity().convert(fcb.getBlock().getContents(), context);
- }
-
- choice.getWhens().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.protocol.model.Try te=
- new org.scribble.protocol.model.Try();
- 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.protocol.model.Catch cb=
- new org.scribble.protocol.model.Catch();
- cb.derivedFrom(catchPath);
-
- /* TODO: How to deal with catch based on type?
- *
- *
- TypeReference tref=new TypeReference();
- tref.setName(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.getBlock().getContents(), context);
- }
-
- if (faultVar != null) {
- context.removeVariable(faultVar);
- }
-
- te.getCatches().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 Protocol convert(Context envContext) {
- Protocol ret=new Protocol();
-
- ret.derivedFrom(this);
- ret.getBlock().derivedFrom(this);
-
- // Configure model name
- ret.setName(getName());
-
- // 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;
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProcessGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Process.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProcessGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProcessGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,190 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TCatch;
+import org.savara.bpel.model.TInvoke;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.TSequence;
+import org.savara.bpel.model.TVariable;
+import org.savara.bpel.util.ActivityUtil;
+import org.savara.bpel.util.InteractionUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a BPEL process.
+ *
+ * @author gary
+ */
+public class ProcessGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TProcess);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TProcess process=(TProcess)component;
+
+ // Add variables to the context
+ for (int i=0; i < process.getVariables().getVariable().size(); i++) {
+ context.addVariable(process.getVariables().getVariable().get(i));
+ }
+
+ // Count number of invoke activities
+ int invokeCount=InteractionUtil.countInvokes(process);
+
+ // Check whether scope has been defined to represent
+ // an interaction with one or more fault responses and
+ // no event handlers
+ TInvoke invoke=null;
+ TActivity act=ActivityUtil.getActivity(process);
+
+ if (invokeCount == 1 &&
+ process.getFaultHandlers() != null &&
(process.getFaultHandlers().getCatch().size() > 0 ||
+ process.getFaultHandlers().getCatchAll() != null) &&
+ (process.getEventHandlers() == null ||
(process.getEventHandlers().getOnEvent().size() == 0 &&
+ process.getEventHandlers().getOnAlarm().size() == 0)) &&
+ (invoke = InteractionUtil.getInvoke(act)) != null) {
+
+ InvokeGenerationRule.convertRequest(invoke, activities, context);
+
+ // Create choice with normal response and fault paths
+ org.scribble.protocol.model.Choice choice=new org.scribble.protocol.model.Choice();
+
+ When cb=new When();
+
+ InvokeGenerationRule.convertResponse(invoke, cb.getBlock().getContents(), context);
+
+ // Include remaining activities
+ if (act instanceof TSequence) {
+ for (int i=1; i < ((TSequence)act).getActivity().size(); i++) {
+ context.convert(((TSequence)act).getActivity().get(i),
cb.getBlock().getContents());
+ }
+ }
+
+ choice.getWhens().add(cb);
+
+ // Process fault handlers
+ for (int i=0; i < process.getFaultHandlers().getCatch().size(); i++) {
+ TCatch catchBlock=process.getFaultHandlers().getCatch().get(i);
+
+ When fcb=new When();
+
+ QName mesgType=catchBlock.getFaultMessageType();
+
+ if (mesgType == null) {
+ mesgType = catchBlock.getFaultElement();
+ }
+
+ TVariable faultVar=null;
+
+ if (catchBlock.getFaultVariable() != null) {
+ faultVar = new TVariable();
+ faultVar.setName(catchBlock.getFaultVariable());
+ faultVar.setMessageType(catchBlock.getFaultMessageType());
+ faultVar.setElement(catchBlock.getFaultElement());
+ context.addVariable(faultVar);
+ }
+
+ InvokeGenerationRule.convertFaultResponse(invoke,
+ fcb.getBlock().getContents(), catchBlock.getFaultVariable(),
+ mesgType, context);
+
+ TActivity cbact=ActivityUtil.getActivity(catchBlock);
+
+ if (cbact != null) {
+ context.convert(cbact, fcb.getBlock().getContents());
+ }
+
+ choice.getWhens().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 (process.getFaultHandlers() != null &&
+ (process.getFaultHandlers().getCatch().size() > 0 ||
+ process.getFaultHandlers().getCatchAll() != null)) {
+ org.scribble.protocol.model.Try te=
+ new org.scribble.protocol.model.Try();
+ //te.derivedFrom(this);
+ //te.getBlock().derivedFrom(this);
+
+ acts.add(te);
+
+ acts = te.getBlock().getContents();
+
+ for (int i=0; i < process.getFaultHandlers().getCatch().size(); i++) {
+ TCatch catchPath=process.getFaultHandlers().getCatch().get(i);
+
+ org.scribble.protocol.model.Catch cb=
+ new org.scribble.protocol.model.Catch();
+ //cb.derivedFrom(catchPath);
+
+ /* TODO: How to deal with catch based on type?
+ *
+ *
+ TypeReference tref=new TypeReference();
+ tref.setName(XMLUtils.getLocalname(catchPath.getFaultName()));
+ cb.setType(tref);
+ */
+
+ TVariable faultVar=null;
+
+ if (catchPath.getFaultVariable() != null) {
+ faultVar = new TVariable();
+ faultVar.setName(catchPath.getFaultVariable());
+ faultVar.setMessageType(catchPath.getFaultMessageType());
+ faultVar.setElement(catchPath.getFaultElement());
+ context.addVariable(faultVar);
+ }
+
+ TActivity cbact=ActivityUtil.getActivity(catchPath);
+
+ if (cbact != null) {
+ context.convert(cbact, cb.getBlock().getContents());
+ }
+
+ if (faultVar != null) {
+ context.removeVariable(faultVar);
+ }
+
+ te.getCatches().add(cb);
+ }
+ }
+
+ // Convert normal activities in scope
+ if (act != null) {
+ context.convert(act, acts);
+ }
+ }
+ }
+}
Added:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProtocolGenerationRule.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProtocolGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProtocolGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,49 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import org.scribble.protocol.model.Activity;
+
+/**
+ * This interface represents a generation rule from a domain specific component
+ * to a Protocol component.
+ *
+ */
+public interface ProtocolGenerationRule {
+
+ /**
+ * This method determines whether the supplied domain component is supported
+ * by this conversion rule.
+ *
+ * @param context The conversion context
+ * @param component The domain component
+ * @return Whether the component is supported for this rule
+ */
+ public boolean isSupported(Object component);
+
+ /**
+ * This method converts a domain specific component to a protocol component and
+ * add it to the supplied activity list.
+ *
+ * @param context The conversion context
+ * @param component The domain component
+ * @param activities The list of protocol activities
+ */
+ public void convert(ConversionContext context, Object component,
java.util.List<Activity> activities);
+
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Receive.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Receive.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Receive.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.savara.bpel.util.TypeReferenceUtil;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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(Journal 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());
-
- Interaction interaction=new Interaction();
- 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.getTypeReferences().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.getToRoles().add(new Role(context.getRole()));
- }
-
- interaction.setMessageSignature(ms);
-
- activities.add(interaction);
- }
-
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReceiveGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Receive.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReceiveGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReceiveGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,81 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TReceive;
+import org.savara.bpel.model.TVariable;
+import org.savara.bpel.util.InteractionUtil;
+import org.savara.bpel.util.PartnerLinkUtil;
+import org.savara.bpel.util.TypeReferenceUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents an unsupported (or custom) action within
+ * the conversation based ESB service descriptor.
+ *
+ * @author gary
+ */
+public class ReceiveGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TReceive);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TReceive elem=(TReceive)component;
+
+ //getSource().setComponentURI(getURI());
+
+ Interaction interaction=new Interaction();
+ //interaction.derivedFrom(this);
+
+ TVariable var=context.getVariable(elem.getVariable());
+
+ String xmlType=InteractionUtil.getXMLType(context.getProcess(), var.getMessageType(),
+ context.getResourceLocator());
+
+ TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
+
+ MessageSignature ms=new MessageSignature();
+ //ms.derivedFrom(this);
+
+ ms.setOperation(elem.getOperation());
+ ms.getTypeReferences().add(tref);
+
+ String fromRole=PartnerLinkUtil.getServerPartnerRole(elem.getPartnerLink());
+
+ if (fromRole != null && fromRole.equals(context.getRole())) {
+ fromRole = PartnerLinkUtil.getClientPartnerRole(elem.getPartnerLink());
+ }
+
+ if (fromRole != null) {
+ interaction.setFromRole(new Role(fromRole));
+ }
+
+ if (context.getRole() != null) {
+ interaction.getToRoles().add(new Role(context.getRole()));
+ }
+
+ interaction.setMessageSignature(ms);
+
+ activities.add(interaction);
+ }
+
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/RepeatUntil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/RepeatUntil.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/RepeatUntil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Reply.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Reply.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Reply.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.savara.bpel.util.TypeReferenceUtil;
-import org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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);
- }
-
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReplyGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Reply.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReplyGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReplyGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,76 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TReply;
+import org.savara.bpel.model.TVariable;
+import org.savara.bpel.util.InteractionUtil;
+import org.savara.bpel.util.PartnerLinkUtil;
+import org.savara.bpel.util.TypeReferenceUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a BPEL reply activity.
+ *
+ * @author gary
+ */
+public class ReplyGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TReply);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TReply reply=(TReply)component;
+
+ //getSource().setComponentURI(getURI());
+
+ Interaction interaction=new Interaction();
+ //interaction.derivedFrom(this);
+
+ TVariable var=context.getVariable(reply.getVariable());
+
+ String xmlType=InteractionUtil.getXMLType(context.getProcess(), var.getMessageType(),
+ context.getResourceLocator());
+
+ TypeReference tref=TypeReferenceUtil.createTypeReference(xmlType, context);
+
+ MessageSignature ms=new MessageSignature();
+ //ms.derivedFrom(this);
+
+ ms.setOperation(reply.getOperation());
+ ms.getTypeReferences().add(tref);
+
+ if (context.getRole() != null) {
+ interaction.setFromRole(new Role(context.getRole()));
+ }
+
+ String toRole=PartnerLinkUtil.getServerPartnerRole(reply.getPartnerLink());
+
+ if (toRole != null) {
+ interaction.getToRoles().add(new Role(toRole));
+ }
+
+ interaction.setMessageSignature(ms);
+
+ activities.add(interaction);
+ }
+
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Rethrow.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Rethrow.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Rethrow.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Scope.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Scope.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Scope.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,690 +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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.savara.bpel.util.InteractionUtil;
-import org.savara.util.XMLUtils;
-import org.scribble.conversation.model.ConditionalBlock;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeActivity.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/ScopeActivity.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeActivity.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.scribble.common.logging.Journal;
-
-/**
- * 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);
-
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Scope.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,193 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TCatch;
+import org.savara.bpel.model.TInvoke;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TSequence;
+import org.savara.bpel.model.TVariable;
+import org.savara.bpel.util.ActivityUtil;
+import org.savara.bpel.util.InteractionUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a scope grouping activity.
+ *
+ * @author gary
+ */
+public class ScopeGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TScope);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TScope scope=(TScope)component;
+
+ //getSource().setComponentURI(getURI());
+
+ // Add variables to the context
+ for (int i=0; i < scope.getVariables().getVariable().size(); i++) {
+ context.addVariable(scope.getVariables().getVariable().get(i));
+ }
+
+ // Count number of invoke activities
+ int invokeCount=InteractionUtil.countInvokes(scope);
+
+ // Check whether scope has been defined to represent
+ // an interaction with one or more fault responses and
+ // no event handlers
+ TInvoke invoke=null;
+
+ if (invokeCount == 1 &&
+ scope.getFaultHandlers() != null &&
(scope.getFaultHandlers().getCatch().size() > 0 ||
+ scope.getFaultHandlers().getCatchAll() != null) &&
+ (scope.getEventHandlers() == null || (scope.getEventHandlers().getOnEvent().size() ==
0 &&
+ scope.getEventHandlers().getOnAlarm().size() == 0)) &&
+ (invoke = InteractionUtil.getInvoke(ActivityUtil.getActivity(scope))) != null) {
+
+ InvokeGenerationRule.convertRequest(invoke, activities, context);
+
+ // Create choice with normal response and fault paths
+ org.scribble.protocol.model.Choice choice=new org.scribble.protocol.model.Choice();
+
+ When cb=new When();
+
+ InvokeGenerationRule.convertResponse(invoke, cb.getBlock().getContents(), context);
+
+ // Include remaining activities
+ if (scope.getSequence() != null) {
+ for (int i=1; i < ((TSequence)scope.getSequence()).getActivity().size(); i++) {
+ context.convert(((TSequence)scope.getSequence()).getActivity().get(i),
+ cb.getBlock().getContents());
+ }
+ }
+
+ choice.getWhens().add(cb);
+
+ // Process fault handlers
+ for (int i=0; i < scope.getFaultHandlers().getCatch().size(); i++) {
+ TCatch catchBlock=scope.getFaultHandlers().getCatch().get(i);
+
+ When fcb=new When();
+
+ QName mesgType=catchBlock.getFaultMessageType();
+
+ if (mesgType == null) {
+ mesgType = catchBlock.getFaultElement();
+ }
+
+ TVariable faultVar=null;
+
+ if (catchBlock.getFaultVariable() != null) {
+ faultVar = new TVariable();
+ faultVar.setName(catchBlock.getFaultVariable());
+ faultVar.setMessageType(catchBlock.getFaultMessageType());
+ faultVar.setElement(catchBlock.getFaultElement());
+ context.addVariable(faultVar);
+ }
+
+ InvokeGenerationRule.convertFaultResponse(invoke, fcb.getBlock().getContents(),
+ catchBlock.getFaultVariable(), mesgType, context);
+
+ TActivity act=ActivityUtil.getActivity(catchBlock);
+
+ if (act != null) {
+ context.convert(act, fcb.getBlock().getContents());
+ }
+
+ choice.getWhens().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 (scope.getFaultHandlers() != null &&
+ (scope.getFaultHandlers().getCatch().size() > 0 ||
+ scope.getFaultHandlers().getCatchAll() != null)) {
+ org.scribble.protocol.model.Try te=
+ new org.scribble.protocol.model.Try();
+ //te.derivedFrom(this);
+ //te.getBlock().derivedFrom(this);
+
+ acts.add(te);
+
+ acts = te.getBlock().getContents();
+
+ for (int i=0; i < scope.getFaultHandlers().getCatch().size(); i++) {
+ TCatch catchPath=scope.getFaultHandlers().getCatch().get(i);
+
+ org.scribble.protocol.model.Catch cb=
+ new org.scribble.protocol.model.Catch();
+ //cb.derivedFrom(catchPath);
+
+ TypeReference tref=new TypeReference();
+ tref.setName(catchPath.getFaultName().getLocalPart());
+
+ //cb.setType(tref);
+
+ // TODO: Need to do a search for first interaction in the block,
+ // and treat that as the triggering condition
+
+ TVariable faultVar=null;
+
+ if (catchPath.getFaultVariable() != null) {
+ faultVar = new TVariable();
+ faultVar.setName(catchPath.getFaultVariable());
+ faultVar.setMessageType(catchPath.getFaultMessageType());
+ faultVar.setElement(catchPath.getFaultElement());
+ context.addVariable(faultVar);
+ }
+
+ TActivity act=ActivityUtil.getActivity(catchPath);
+
+ if (act != null) {
+ context.convert(act, cb.getBlock().getContents());
+ }
+
+ if (faultVar != null) {
+ context.removeVariable(faultVar);
+ }
+
+ te.getCatches().add(cb);
+ }
+ }
+
+ // Convert normal activities in scope
+ TActivity act=ActivityUtil.getActivity(scope);
+
+ if (act != null) {
+ context.convert(act, acts);
+ }
+ }
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Sequence.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Sequence.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Sequence.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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("(a)activities."+pos);
- }
-
- private java.util.List<BPELActivity> m_activities=
- new java.util.Vector<BPELActivity>();
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/SequenceGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Sequence.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/SequenceGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/SequenceGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,45 @@
+/*
+ * 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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TSequence;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a sequence grouping activity.
+ *
+ * @author gary
+ */
+public class SequenceGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TSequence);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TSequence bpelElem=(TSequence)component;
+
+ //getSource().setComponentURI(getURI());
+
+ for (int i=0; i < bpelElem.getActivity().size(); i++) {
+ context.convert(bpelElem.getActivity().get(i), activities);
+ }
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Source.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Source.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Source.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Target.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Target.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Target.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/TerminationHandler.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/TerminationHandler.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/TerminationHandler.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Throw.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Throw.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Throw.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Until.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Until.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Until.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Variable.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Variable.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Variable.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Wait.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/Wait.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/Wait.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/While.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/While.java 2010-12-16
14:37:55 UTC (rev 504)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/While.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.toprotocol;
-
-import org.savara.bpel.model2.*;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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;
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/WhileGenerationRule.java
(from rev 504,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/toprotocol/While.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/WhileGenerationRule.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/WhileGenerationRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.generator.protocol;
+
+import java.util.List;
+
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TWhile;
+import org.savara.bpel.util.ActivityUtil;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents a while grouping activity.
+ *
+ * @author gary
+ */
+public class WhileGenerationRule implements ProtocolGenerationRule {
+
+ public boolean isSupported(Object component) {
+ return(component instanceof TWhile);
+ }
+
+ public void convert(ConversionContext context, Object component, List<Activity>
activities) {
+ TWhile bpelElem=(TWhile)component;
+
+ //getSource().setComponentURI(getURI());
+
+ org.scribble.protocol.model.Repeat elem=
+ new org.scribble.protocol.model.Repeat();
+
+ // TODO: Convert while expression
+
+ TActivity act=ActivityUtil.getActivity(bpelElem);
+
+ if (act != null) {
+ context.convert(act, elem.getBlock().getContents());
+ }
+
+ activities.add(elem);
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELLanguageModel.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELLanguageModel.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELLanguageModel.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model2;
-
-import org.savara.bpel.toprotocol.Process;
-import org.scribble.protocol.model.*;
-import org.scribble.common.logging.Journal;
-
-/**
- * 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELNotation.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELNotation.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/BPELNotation.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model2;
-
-import org.scribble.extensions.*;
-import org.scribble.model.ModelReference;
-import org.scribble.model.Notation;
-
-/**
- * The notation class for the BPEL language.
- */
-(a)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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/DefaultBPELLanguageModel.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/DefaultBPELLanguageModel.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model2/DefaultBPELLanguageModel.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model2;
-
-//import org.apache.commons.logging.*;
-import org.savara.bpel.toprotocol.Process;
-import org.scribble.conversation.model.Conversation;
-import org.scribble.protocol.model.*;
-import org.scribble.model.admin.Context;
-import org.scribble.model.admin.ModelIssue;
-import org.scribble.common.logging.Journal;
-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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELModelParserRule.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELModelParserRule.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELModelParserRule.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,111 +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.savara.bpel.parser;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.savara.bpel.model2.BPELNotation;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.Model;
-import org.scribble.common.logging.Journal;
-import org.scribble.parser.ParserContext;
-import org.scribble.parser.ParserRule;
-import org.scribble.parser.Token;
-
-/**
- * This class provides the model parser for the BPEL notation.
- *
- */
-(a)RegistryInfo(extension=ParserRule.class,notation=BPELNotation.NOTATION_CODE)
-public class BPELModelParserRule extends
org.scribble.conversation.parser.ConversationModelParserRule {
-
- /**
- * The default constructor.
- */
- public BPELModelParserRule() {
- //super(ParserRuleType.File);
- }
-
- /**
- * This method determines whether the parser rules is
- * appropriate to return a model object of the required
- * type.
- *
- * @param type The required type
- * @return Whether the parser rule returns a
- * model object of the required type
- */
- public boolean isSupported(Class<?> type) {
- return(type.isAssignableFrom(Model.class));
- }
-
- /**
- * This method parses the description to obtain
- * a model object of the appropriate type.
- *
- * @param context The context
- * @param l The listener
- * @return The model object
- */
- public Object parse(ParserContext context, ModelListener l) {
- DefaultBPELLanguageModel ret=null;
-
- Token t=context.nextToken();
-
- if (t != null && t.getObject() instanceof String) {
- try {
- String str=(String)t.getObject();
-
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- DocumentBuilder builder=fact.newDocumentBuilder();
-
- // Need to load original input stream and then
- // provide a second input stream, as some input stream
- // implementations don't support 'reset' operation,
- // and therefore this was the only way to extract the
- // content and also provide the stream to the XML
- // document builder.
- java.io.ByteArrayInputStream bais=
- new java.io.ByteArrayInputStream(str.getBytes());
-
- org.w3c.dom.Document doc=builder.parse(bais);
-
- // Identify the model associated with the
- // changed resource
- ret = new DefaultBPELLanguageModel(context.getSource(),
- doc.getDocumentElement(), str, context.getEnvironmentContext());
-
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to load model", e);
- }
- }
-
- return(ret);
- }
-
- private static Logger logger =
Logger.getLogger("org.savara.tools.bpel.parser");
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELTokenizer.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELTokenizer.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELTokenizer.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,59 +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.savara.bpel.parser;
-
-import org.savara.bpel.model2.BPELNotation;
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.ModelReference;
-import org.scribble.parser.*;
-
-/**
- * This is the BPEL based implementation of the tokenizer
- * interface.
- */
-(a)RegistryInfo(extension=Tokenizer.class,notation=BPELNotation.NOTATION_CODE)
-public class BPELTokenizer extends DefaultTokenizer {
-
- /**
- * The default constructor.
- */
- public BPELTokenizer() {
- }
-
- /**
- * This method obtains a list of tokens based on the
- * contents of the input stream.
- *
- * @param ref The model reference for the input source
- * @param is The input stream
- * @return The list of tokens
- * @throws java.io.IOException Failed to derive
- */
- public java.util.List<Token> getTokens(ModelReference ref,
- java.io.InputStream is) throws java.io.IOException {
- java.util.List<Token> ret=new java.util.Vector<Token>();
-
- byte[] b=new byte[is.available()];
- is.read(b);
-
- Token t=new Token(new String(b));
- ret.add(t);
-
- return(ret);
- }
-}
Added:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ActivityUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ActivityUtil.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ActivityUtil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,48 @@
+/*
+ * 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.savara.bpel.util;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TExtensibleElements;
+
+public class ActivityUtil {
+
+ private static Log logger = LogFactory.getLog(InteractionUtil.class);
+
+ public static TActivity getActivity(TExtensibleElements container) {
+ TActivity ret=null;
+
+ // TODO: Need to expand list of supported types
+
+ try {
+ Method method=container.getClass().getMethod("getSequence");
+
+ if (method != null) {
+ ret = (TActivity)method.invoke(container);
+ }
+ } catch(Exception e) {
+ logger.error("Failed to get contained activity", e);
+ }
+
+ return(ret);
+ }
+}
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ImportUtil.java
(from rev 506,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/GeneratorUtil.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ImportUtil.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/ImportUtil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,41 @@
+/*
+ * 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.savara.bpel.util;
+
+import org.scribble.protocol.model.Role;
+
+/**
+ * This class provides general utility functions for
+ * use when generating artefacts.
+ */
+public class ImportUtil {
+
+ /**
+ * This method returns the WSDL file name for the supplied role and local
+ * conversation model.
+ *
+ * @param role The role
+ * @param localcm The local conversation model
+ * @param fileNum The file name (zero being the main wsdl file)
+ * @return The file name
+ */
+ public static String getWSDLFileName(Role role, String modelName, String suffix) {
+ return(modelName+"_"+role.getName()+suffix+".wsdl");
+ }
+
+}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -17,10 +17,25 @@
*/
package org.savara.bpel.util;
+import java.io.IOException;
+
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.savara.bpel.model.TActivity;
+import org.savara.bpel.model.TExtensibleElements;
+import org.savara.bpel.model.TImport;
+import org.savara.bpel.model.TInvoke;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TSequence;
import org.savara.bpel.model.change.InteractionPatterns;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.Invoke;
-import org.savara.bpel.toprotocol.Sequence;
+import org.savara.util.ResourceLocator;
+import org.savara.util.XMLUtils;
import org.scribble.protocol.model.*;
/**
@@ -28,6 +43,8 @@
*/
public class InteractionUtil {
+ private static Log logger = LogFactory.getLog(InteractionUtil.class);
+
/**
* This method returns the name associated with the interaction.
*
@@ -161,20 +178,38 @@
* @param act The activity
* @return The invoke, or null if not found
*/
- public static Invoke getInvoke(BPELActivity act) {
- Invoke ret=null;
+ public static TInvoke getInvoke(TActivity act) {
+ TInvoke ret=null;
- if (act instanceof Invoke) {
- ret = (Invoke)act;
- } else if (act instanceof Sequence &&
- ((Sequence)act).getActivities().size() > 0 &&
- ((Sequence)act).getActivities().get(0) instanceof Invoke) {
- ret = (Invoke)((Sequence)act).getActivities().get(0);
+ if (act instanceof TInvoke) {
+ ret = (TInvoke)act;
+ } else if (act instanceof TSequence &&
+ ((TSequence)act).getActivity().size() > 0 &&
+ ((TSequence)act).getActivity().get(0) instanceof TInvoke) {
+ ret = (TInvoke)((TSequence)act).getActivity().get(0);
}
return(ret);
}
+ public static int countInvokes(TExtensibleElements scope) {
+ org.w3c.dom.Element elem=null;
+
+ try {
+ elem = convertScopeToDOM(scope);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ int ret=0;
+
+ if (elem != null) {
+ ret = countInvokes(elem);
+ }
+
+ return(ret);
+ }
+
/**
* This method recursively counts the number of 'invoke' activities
* contained within a DOM element.
@@ -199,4 +234,103 @@
return(ret);
}
+
+ protected static org.w3c.dom.Element convertScopeToDOM(TExtensibleElements desc) throws
IOException {
+ org.w3c.dom.Element ret=null;
+
+ try {
+ org.savara.bpel.model.ObjectFactory factory=
+ new org.savara.bpel.model.ObjectFactory();
+
+ JAXBContext context = JAXBContext.newInstance(desc.getClass());
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+
+ java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream();
+
+ if (desc instanceof TProcess) {
+ marshaller.marshal(factory.createProcess((TProcess)desc), baos);
+ } else if (desc instanceof TScope) {
+ marshaller.marshal(factory.createScope((TScope)desc), baos);
+ }
+
+ baos.close();
+
+ ret = (org.w3c.dom.Element)XMLUtils.getNode(baos.toString());
+
+ } catch(Exception e) {
+ throw new IOException("Failed to serialize scope", e);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * 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 locator The resource locator
+ * @return The underlying XML element/type, or null if not found
+ */
+ public static String getXMLType(TProcess process, QName wsdlMessageType, ResourceLocator
locator) {
+ String ret=null;
+
+ String namespace=wsdlMessageType.getNamespaceURI();
+
+ for (TImport imp : process.getImport()) {
+
+ // 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=
+ locator.getResourceURI(imp.getLocation());
+
+ if (uri != null) {
+ ret = getXMLType(wsdlMessageType, uri);
+
+ if (ret != null) {
+ break;
+ }
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ public static String getXMLType(QName 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(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);
+ }
+
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/PartnerLinkUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/PartnerLinkUtil.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/PartnerLinkUtil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -33,4 +33,38 @@
return(ret);
}
+
+ /**
+ * This method attempts to identify the client's partner role name.
+ *
+ * @param The partner link name
+ * @return The partner role
+ */
+ public static String getClientPartnerRole(String partnerLink) {
+ String ret=partnerLink;
+ 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.
+ *
+ * @param The partner link name
+ * @return The partner role
+ */
+ public static String getServerPartnerRole(String partnerLink) {
+ String ret=partnerLink;
+ int index=-1;
+
+ if (ret != null && (index=ret.indexOf("To")) != -1) {
+ ret = ret.substring(0, index);
+ }
+
+ return(ret);
+ }
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -19,7 +19,7 @@
import javax.xml.namespace.QName;
-import org.savara.bpel.toprotocol.ConversionContext;
+import org.savara.bpel.model.generator.protocol.ConversionContext;
import org.scribble.protocol.model.TypeReference;
public class TypeReferenceUtil {
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/change/ModelChangeUtilsTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/change/ModelChangeUtilsTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/change/ModelChangeUtilsTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -19,34 +19,30 @@
import org.savara.bpel.model.change.ModelChangeUtils;
import org.savara.contract.model.*;
-import org.scribble.conversation.model.Conversation;
-import org.scribble.conversation.model.Run;
+import org.savara.model.change.ModelChangeContext;
import org.scribble.protocol.model.*;
-import org.scribble.model.change.DefaultModelChangeContext;
-import org.scribble.model.change.ModelChangeContext;
import junit.framework.TestCase;
public class ModelChangeUtilsTest extends TestCase {
+ private static final String SUB_PROTOCOL = "SubProtocol";
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 BPELModelChangeContext(null, null);
+ ModelChangeContext context=new BPELModelChangeContext();
- Conversation conv=new Conversation();
- LocatedName ln=new LocatedName();
+ Protocol conv=new Protocol();
Role r=new Role();
r.setName(MY_ROLE);
Contract c=new Contract();
- r.getAnnotations().put(Contract.class.getName(), c);
+ r.getProperties().put(Contract.class.getName(), c);
- ln.setRole(r);
- conv.setLocatedName(ln);
+ conv.setRole(r);
ModelChangeUtils.addContracts(context, conv, true);
@@ -62,31 +58,27 @@
}
public void testInitialiseContractsTwice() {
- ModelChangeContext context=new BPELModelChangeContext(null, null);
+ ModelChangeContext context=new BPELModelChangeContext();
- Conversation conv=new Conversation();
- LocatedName ln=new LocatedName();
+ Protocol conv=new Protocol();
Role r=new Role();
r.setName(MY_ROLE);
Contract c=new Contract();
- r.getAnnotations().put(Contract.class.getName(), c);
+ r.getProperties().put(Contract.class.getName(), c);
- ln.setRole(r);
- conv.setLocatedName(ln);
+ conv.setRole(r);
ModelChangeUtils.addContracts(context, conv, true);
- Conversation conv2=new Conversation();
- LocatedName ln2=new LocatedName();
+ Protocol conv2=new Protocol();
Role r2=new Role();
r2.setName(MY_OTHER_ROLE);
Contract c2=new Contract();
- r2.getAnnotations().put(Contract.class.getName(), c2);
+ r2.getProperties().put(Contract.class.getName(), c2);
- ln2.setRole(r2);
- conv2.setLocatedName(ln2);
+ conv2.setRole(r2);
ModelChangeUtils.addContracts(context, conv2, true);
@@ -112,23 +104,21 @@
}
public void testPushRoleContractMapping() {
- ModelChangeContext context=new BPELModelChangeContext(null, null);
+ ModelChangeContext context=new BPELModelChangeContext();
- Conversation conv=new Conversation();
- LocatedName ln=new LocatedName();
+ Protocol conv=new Protocol();
Role r1=new Role();
r1.setName(MY_LOCATED_ROLE);
- ln.setRole(r1);
- conv.setLocatedName(ln);
+ conv.setRole(r1);
Contract c1=new Contract();
- r1.getAnnotations().put(Contract.class.getName(), c1);
+ r1.getProperties().put(Contract.class.getName(), c1);
Role r2=new Role();
r2.setName(MY_ROLE);
Contract c2=new Contract();
- r2.getAnnotations().put(Contract.class.getName(), c2);
+ r2.getProperties().put(Contract.class.getName(), c2);
RoleList rl=new RoleList();
rl.getRoles().add(r2);
@@ -136,22 +126,29 @@
ModelChangeUtils.addContracts(context, conv, true);
- Conversation subconv=new Conversation();
- LocatedName subln=new LocatedName();
+ Protocol subconv=new Protocol();
+ subconv.setName(SUB_PROTOCOL);
+
Role subr1=new Role();
subr1.setName(MY_OTHER_LOCATED_ROLE);
- subln.setRole(subr1);
- subconv.setLocatedName(subln);
+ subconv.setRole(subr1);
Run run=new Run();
+
+ ProtocolReference ref=new ProtocolReference();
+ ref.setName(SUB_PROTOCOL);
+ ref.setRole(subr1);
+ run.setProtocolReference(ref);
+
conv.getBlock().getContents().add(run);
- run.setInlineDefinition(subconv);
- DeclarationBinding db=new DeclarationBinding();
- db.setDeclaration(r2);
+ Parameter db=new Parameter();
+ db.setName(r2.getName());
db.setBoundName(MY_OTHER_ROLE);
- run.getBindings().add(db);
+ run.getParameters().add(db);
+ conv.getBlock().add(subconv);
+
ModelChangeUtils.pushRoleContractMapping(context, run);
Contract c3=ModelChangeUtils.getContract(context, MY_ROLE);
@@ -186,15 +183,13 @@
}
public void testPopRoleContractMapping() {
- ModelChangeContext context=new BPELModelChangeContext(null, null);
+ ModelChangeContext context=new BPELModelChangeContext();
- Conversation conv=new Conversation();
- LocatedName ln=new LocatedName();
+ Protocol conv=new Protocol();
Role r1=new Role();
r1.setName(MY_LOCATED_ROLE);
- ln.setRole(r1);
- conv.setLocatedName(ln);
+ conv.setRole(r1);
Role r2=new Role();
r2.setName(MY_ROLE);
@@ -203,21 +198,20 @@
rl.getRoles().add(r2);
conv.getBlock().getContents().add(rl);
- Conversation subconv=new Conversation();
- LocatedName subln=new LocatedName();
+ Protocol subconv=new Protocol();
+
Role subr1=new Role();
subr1.setName(MY_OTHER_LOCATED_ROLE);
- subln.setRole(subr1);
- subconv.setLocatedName(subln);
+ subconv.setRole(subr1);
Contract c1=new Contract();
- subr1.getAnnotations().put(Contract.class.getName(), c1);
+ subr1.getProperties().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);
+ r3.getProperties().put(Contract.class.getName(), c2);
RoleList rl2=new RoleList();
rl2.getRoles().add(r3);
@@ -229,14 +223,22 @@
ModelChangeUtils.addContracts(context, subconv, true);
Run run=new Run();
+
+ ProtocolReference ref=new ProtocolReference();
+ ref.setName(SUB_PROTOCOL);
+ ref.setRole(subr1);
+
+ run.setProtocolReference(ref);
+
conv.getBlock().getContents().add(run);
- run.setInlineDefinition(subconv);
- DeclarationBinding db=new DeclarationBinding();
- db.setDeclaration(r2);
+ Parameter db=new Parameter();
+ db.setName(r2.getName());
db.setBoundName(MY_OTHER_ROLE);
- run.getBindings().add(db);
+ run.getParameters().add(db);
+ conv.getBlock().add(subconv);
+
ModelChangeUtils.popRoleContractMapping(context, run);
Contract c3=ModelChangeUtils.getContract(context, MY_ROLE);
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/AbstractInteractionTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/AbstractInteractionTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/AbstractInteractionTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELActivityTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELActivityTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELActivityTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELElementTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELElementTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/BPELElementTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELElement;
-import org.savara.bpel.toprotocol.Condition;
-import org.savara.bpel.toprotocol.Else;
-import org.savara.bpel.toprotocol.If;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchAllTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchAllTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchAllTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.CatchAll;
-import org.savara.bpel.toprotocol.Else;
-import org.savara.bpel.toprotocol.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\&qu... +
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CatchTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.Catch;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CompensationHandlerTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CompensationHandlerTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/CompensationHandlerTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.CompensationHandler;
-import org.savara.bpel.toprotocol.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\&qu... +
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ConditionTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ConditionTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ConditionTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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\&qu...;
- org.w3c.dom.Element elem=null;
-
- try {
- javax.xml.parsers.DocumentBuilderFactory factory=
- javax.xml.parsers.DocumentBuilderFactory.newInstance();
-
- factory.setNamespaceAware(true);
-
- javax.xml.parsers.DocumentBuilder builder=
- factory.newDocumentBuilder();
-
- java.io.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\&qu... +
- "
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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseIfTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseIfTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseIfTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.Elseif;
-import org.savara.bpel.toprotocol.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\&qu... +
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ElseTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.Else;
-import org.savara.bpel.toprotocol.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\&qu... +
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/EventHandlersTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/EventHandlersTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/EventHandlersTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.EventHandlers;
-import org.savara.bpel.toprotocol.OnAlarm;
-import org.savara.bpel.toprotocol.OnEvent;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.Scope;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)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\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)activities.0")
== false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ExitTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ExitTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ExitTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FaultHandlersTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FaultHandlersTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FaultHandlersTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,396 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.Catch;
-import org.savara.bpel.toprotocol.CatchAll;
-import org.savara.bpel.toprotocol.FaultHandlers;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "</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\&qu...
- "<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\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)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\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)activities.0") ==
false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FlowTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FlowTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/FlowTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.Flow;
-import org.savara.bpel.toprotocol.Link;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ForEachTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ForEachTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ForEachTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,217 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.ForEach;
-import org.savara.bpel.toprotocol.Process;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.Scope;
-import org.savara.bpel.toprotocol.Sequence;
-
-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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<forEach
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- "<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/(a)activities.0") == false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/IfTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/IfTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/IfTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,1192 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.Condition;
-import org.savara.bpel.toprotocol.Else;
-import org.savara.bpel.toprotocol.Elseif;
-import org.savara.bpel.toprotocol.If;
-import org.savara.bpel.toprotocol.Process;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.Reply;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.Throw;
-
-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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- 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\&qu...
- expr1+
- "</condition>";
-
- String xml2="<condition
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<sequence>"+
- "<if
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)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\&qu...
- "<sequence>"+
- "<if
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- "<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/(a)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\&qu...
- "<sequence>"+
- "<if
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- "<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/(a)activities.0") ==
false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/InvokeTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/InvokeTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/InvokeTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnAlarmTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnAlarmTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnAlarmTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,914 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.For;
-import org.savara.bpel.toprotocol.OnAlarm;
-import org.savara.bpel.toprotocol.Scope;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.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\&qu... +
- "<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\&qu...
- "<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\&qu...
- 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\&qu...
- expr1+
- "</until>";
-
- String xml2="<until
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- 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\&qu...
- expr1+
- "</for>";
-
- String xml2="<for
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- expr1+
- "</for>";
-
- String xml2="<until
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- expr1+
- "</until>";
-
- String xml2="<for
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu... +
- "<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\&qu... +
- "<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\&qu... +
- "<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\&qu... +
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnEventTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnEventTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnEventTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnMessageTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnMessageTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/OnMessageTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.OnMessage;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PartnerLinkTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PartnerLinkTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PartnerLinkTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PickTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PickTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/PickTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,423 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.OnAlarm;
-import org.savara.bpel.toprotocol.OnMessage;
-import org.savara.bpel.toprotocol.Pick;
-import org.savara.bpel.toprotocol.Process;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.Scope;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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/(a)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\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)activities.0")
== false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ProcessTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ProcessTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ProcessTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.EventHandlers;
-import org.savara.bpel.toprotocol.FaultHandlers;
-import org.savara.bpel.toprotocol.PartnerLink;
-import org.savara.bpel.toprotocol.Process;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReceiveTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReceiveTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReceiveTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RepeatUntilTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RepeatUntilTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RepeatUntilTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,480 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.Condition;
-import org.savara.bpel.toprotocol.If;
-import org.savara.bpel.toprotocol.Process;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.RepeatUntil;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- 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\&qu...
- expr1+
- "</condition>";
-
- String xml2="<condition
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<repeatUntil
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- "<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/(a)activities.0") == false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReplyTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReplyTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ReplyTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RethrowTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RethrowTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/RethrowTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ScopeTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ScopeTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ScopeTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.CompensationHandler;
-import org.savara.bpel.toprotocol.EventHandlers;
-import org.savara.bpel.toprotocol.FaultHandlers;
-import org.savara.bpel.toprotocol.PartnerLink;
-import org.savara.bpel.toprotocol.Scope;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.TerminationHandler;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/SequenceTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/SequenceTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/SequenceTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,337 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.Invoke;
-import org.savara.bpel.toprotocol.Process;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<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/(a)activities.1") == false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TerminationHandlerTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TerminationHandlerTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TerminationHandlerTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.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\&qu... +
- "<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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestAbstractInteraction.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestAbstractInteraction.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestAbstractInteraction.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.toprotocol.AbstractInteraction;
-import org.savara.bpel.toprotocol.ConversionContext;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELActivity.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELActivity.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELActivity.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.ConversionContext;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELElement.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELElement.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/TestBPELElement.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import java.util.List;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELElement;
-import org.savara.bpel.toprotocol.ConversionContext;
-import org.scribble.protocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ThrowTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ThrowTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/ThrowTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/VariableTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/VariableTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/VariableTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WaitTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WaitTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WaitTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.Condition;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- 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\&qu...
- expr1+
- "</until>";
-
- String xml2="<until
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- 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\&qu...
- expr1+
- "</for>";
-
- String xml2="<for
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- expr1+
- "</for>";
-
- String xml2="<until
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- expr1+
- "</until>";
-
- String xml2="<for
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WhileTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WhileTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/component/WhileTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,478 +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.savara.bpel.model.component;
-
-import org.savara.bpel.model2.BPELLanguageModel;
-import org.savara.bpel.model2.DefaultBPELLanguageModel;
-import org.savara.bpel.toprotocol.BPELActivity;
-import org.savara.bpel.toprotocol.Condition;
-import org.savara.bpel.toprotocol.If;
-import org.savara.bpel.toprotocol.Receive;
-import org.savara.bpel.toprotocol.Sequence;
-import org.savara.bpel.toprotocol.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\&qu...
- "<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\&qu...
- "<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\&qu...
- 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\&qu...
- expr1+
- "</condition>";
-
- String xml2="<condition
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- 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\&qu...
- "<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\&qu...
- "<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\&qu...
- "<while
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...
- "<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.savara.bpel.toprotocol.Process component=
- new org.savara.bpel.toprotocol.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/(a)activities.0") == false) {
- fail("URI is invalid: "+uri);
- }
- }
-}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/util/InteractionUtilTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/util/InteractionUtilTest.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/model/util/InteractionUtilTest.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -1,92 +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.savara.bpel.model.util;
-
-import junit.framework.TestCase;
-
-import org.savara.bpel.util.InteractionUtil;
-import org.scribble.conversation.model.*;
-import org.scribble.protocol.model.*;
-
-public class InteractionUtilTest extends TestCase {
-
- public void testIsFirstInteractionSingleInteraction() {
- ConversationModel cm=new ConversationModel();
- Conversation c=new Conversation();
- cm.setConversation(c);
-
- Interaction i1=new Interaction();
-
- c.getBlock().getContents().add(i1);
-
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i1) == false) {
- fail("Interaction should be first in conversation");
- }
- }
-
- public void testIsFirstInteractionSecondInteraction() {
- ConversationModel cm=new ConversationModel();
- Conversation c=new Conversation();
- cm.setConversation(c);
-
- Interaction i1=new Interaction();
- Interaction i2=new Interaction();
-
- c.getBlock().getContents().add(i1);
- c.getBlock().getContents().add(i2);
-
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i2)) {
- fail("Interaction should NOT be first in conversation");
- }
- }
-
- public void testIsFirstInteractionIfElse() {
- ConversationModel cm=new ConversationModel();
- Conversation c=new Conversation();
- cm.setConversation(c);
-
- If choice=new If();
- c.getBlock().getContents().add(choice);
-
- Block b=choice.createNewPath();
-
- Interaction i1=new Interaction();
-
- b.getContents().add(i1);
-
- Block b2=choice.createNewPath();
-
- Interaction i2=new Interaction();
- Interaction i3=new Interaction();
-
- b2.getContents().add(i2);
- b2.getContents().add(i3);
-
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i1) == false) {
- fail("Interaction should be first in conversation");
- }
-
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i2) == false) {
- fail("Interaction should be first in conversation");
- }
-
- if (org.scribble.model.util.InteractionUtil.isInitialInteraction(i3)) {
- fail("Interaction should NOT be first in conversation");
- }
- }
-}
Added:
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,24 @@
+/*
+ * 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.savara.model;
+
+public class ProtocolDefinitions {
+
+ public static final String PROTOCOL_TYPE="spr";
+
+}
Modified:
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -19,8 +19,8 @@
*/
package org.savara.model.generator;
+import org.savara.util.ResourceLocator;
import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.*;
/**
* This interface represents a model generator.
@@ -41,11 +41,11 @@
* This method generates the contents of the target
* model using information in the source model.
*
- * @param targetRef The target model's reference
- * @param role The role associated with the model
- * @param target The model being generated
- * @param source The reference model
+ * @param source The source model
+ * @param journal The log
+ * @param locator The resource locator
+ * @return The target model
*/
- public Object generate(Object source, Journal journal);
+ public Object generate(Object source, Journal journal, ResourceLocator locator);
}
Added:
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -0,0 +1,37 @@
+/*
+ * 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.savara.util;
+
+/**
+ * This interface represents a resource locator that can be used to
+ * load artifacts relative to another resource being processed.
+ *
+ */
+public interface ResourceLocator {
+
+ /**
+ * This method can be used to retrieve the URI of a resource which
+ * is located at the specified URI, potentially relative to a resource
+ * that is being processed.
+ *
+ * @param uri The relative URI of the resource to load
+ * @return The URI, or null if not found
+ */
+ public java.net.URI getResourceURI(String uri);
+
+}
Modified:
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/actions/GenerateAction.java
===================================================================
---
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/actions/GenerateAction.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/actions/GenerateAction.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -41,13 +41,6 @@
import org.savara.tools.wsdl.util.XMLUtils;
import org.savara.wsdl.generator.WSDLGeneratorFactory;
import org.savara.wsdl.generator.soap.SOAPDocLitWSDLBinding;
-import org.scribble.conversation.model.ConversationModel;
-import org.scribble.eclipse.util.*;
-import org.scribble.extensions.RegistryFactory;
-import org.scribble.model.Model;
-import org.scribble.model.ModelReference;
-import org.scribble.model.admin.DefaultModelListener;
-import org.scribble.model.admin.ModelRepository;
/**
* This class implements the action to generate the choreography
Modified:
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/util/XMLUtils.java
===================================================================
---
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/util/XMLUtils.java 2010-12-17
08:46:19 UTC (rev 507)
+++
branches/experimental/2.0.x/tools/plugins/org.savara.tools.wsdl/src/java/org/savara/tools/wsdl/util/XMLUtils.java 2010-12-20
17:43:34 UTC (rev 508)
@@ -26,7 +26,8 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.scribble.model.ModelObject;
+import org.scribble.protocol.model.ModelObject;
+import org.scribble.protocol.model.ModelProperties;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -271,13 +272,13 @@
}
if (startpos != -1) {
- obj.getSource().setStartPosition(startpos);
+ obj.getProperties().put(ModelProperties.START_LOCATION, startpos);
// Check if single node
int p1=contents.indexOf('>', startpos);
if (p1 != -1 && contents.charAt(p1-1) == '/') {
- obj.getSource().setEndPosition(p1);
+ obj.getProperties().put(ModelProperties.END_LOCATION, p1);
} else {
org.w3c.dom.NodeList enl=elem.getElementsByTagName(elem.getNodeName());
@@ -290,7 +291,8 @@
}
if (endpos != -1) {
- obj.getSource().setEndPosition(endpos+nodetxt.length()-1);
+ obj.getProperties().put(ModelProperties.END_LOCATION,
+ endpos+nodetxt.length()-1);
}
}
}