Overlord SVN: r409 - in cdl/trunk/distribution/eclipse: features and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 10:30:49 -0400 (Tue, 21 Oct 2008)
New Revision: 409
Added:
cdl/trunk/distribution/eclipse/features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211526.jar
cdl/trunk/distribution/eclipse/features/org.scribble.conversation.feature_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/features/org.scribble.experimental.feature_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/features/org.scribble.feature_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/features/org.scribble.protocol.feature_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb_1.0.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb_1.0.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conformance_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.comparator_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.export.text_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.model_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.parser_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.projector_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.validation_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.core_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.designer_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.comparator_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.java.parser_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.model_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.osgi_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.comparator_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.export.text_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.model_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.parser_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.projector_0.1.0.200810211526.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.validation_0.1.0.200810211526.jar
Removed:
cdl/trunk/distribution/eclipse/features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211153.jar
cdl/trunk/distribution/eclipse/features/org.scribble.conversation.feature_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/features/org.scribble.experimental.feature_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/features/org.scribble.feature_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/features/org.scribble.protocol.feature_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.jbossesb_1.0.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conformance_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.comparator_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.export.text_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.model_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.parser_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.projector_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.validation_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.core_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.designer_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.comparator_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.java.parser_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.model_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.osgi_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.comparator_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.export.text_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.model_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.parser_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.projector_0.1.0.200810211153.jar
cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.validation_0.1.0.200810211153.jar
Modified:
cdl/trunk/distribution/eclipse/site.xml
Log:
Updated plugins to include refactored JBoss overlord cdl plugins to distinguish runtime and validator tools.
Deleted: cdl/trunk/distribution/eclipse/features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/features/org.scribble.conversation.feature_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/features/org.scribble.conversation.feature_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/features/org.scribble.conversation.feature_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/features/org.scribble.experimental.feature_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/features/org.scribble.experimental.feature_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/features/org.scribble.experimental.feature_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/features/org.scribble.feature_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/features/org.scribble.feature_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/features/org.scribble.feature_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/features/org.scribble.protocol.feature_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/features/org.scribble.protocol.feature_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/features/org.scribble.protocol.feature_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.jbossesb_1.0.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb_1.0.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb_1.0.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb_1.0.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb_1.0.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conformance_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conformance_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conformance_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.comparator_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.comparator_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.comparator_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.export.text_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.export.text_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.export.text_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.model_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.model_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.model_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.parser_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.parser_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.parser_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.projector_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.projector_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.projector_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.validation_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.validation_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.conversation.validation_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.core_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.core_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.core_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.designer_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.designer_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.designer_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.comparator_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.comparator_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.comparator_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.java.parser_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.java.parser_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.java.parser_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.model_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.model_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.lang.model_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.osgi_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.osgi_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.osgi_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.comparator_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.comparator_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.comparator_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.export.text_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.export.text_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.export.text_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.model_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.model_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.model_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.parser_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.parser_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.parser_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.projector_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.projector_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.projector_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.validation_0.1.0.200810211153.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.validation_0.1.0.200810211526.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/eclipse/plugins/org.scribble.protocol.validation_0.1.0.200810211526.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: cdl/trunk/distribution/eclipse/site.xml
===================================================================
--- cdl/trunk/distribution/eclipse/site.xml 2008-10-21 14:25:36 UTC (rev 408)
+++ cdl/trunk/distribution/eclipse/site.xml 2008-10-21 14:30:49 UTC (rev 409)
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
- <feature url="features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211153.jar" id="org.jboss.tools.overlord.cdl.jbossesb.feature" version="1.0.0.200810211153">
+ <feature url="features/org.jboss.tools.overlord.cdl.jbossesb.feature_1.0.0.200810211526.jar" id="org.jboss.tools.overlord.cdl.jbossesb.feature" version="1.0.0.200810211526">
<category name="JBossESB"/>
</feature>
- <feature url="features/org.scribble.conversation.feature_0.1.0.200810211153.jar" id="org.scribble.conversation.feature" version="0.1.0.200810211153">
+ <feature url="features/org.scribble.conversation.feature_0.1.0.200810211526.jar" id="org.scribble.conversation.feature" version="0.1.0.200810211526">
<category name="Common"/>
</feature>
- <feature url="features/org.scribble.experimental.feature_0.1.0.200810211153.jar" id="org.scribble.experimental.feature" version="0.1.0.200810211153">
+ <feature url="features/org.scribble.experimental.feature_0.1.0.200810211526.jar" id="org.scribble.experimental.feature" version="0.1.0.200810211526">
<category name="Common"/>
</feature>
- <feature url="features/org.scribble.feature_0.1.0.200810211153.jar" id="org.scribble.feature" version="0.1.0.200810211153">
+ <feature url="features/org.scribble.feature_0.1.0.200810211526.jar" id="org.scribble.feature" version="0.1.0.200810211526">
<category name="Common"/>
</feature>
- <feature url="features/org.scribble.protocol.feature_0.1.0.200810211153.jar" id="org.scribble.protocol.feature" version="0.1.0.200810211153">
+ <feature url="features/org.scribble.protocol.feature_0.1.0.200810211526.jar" id="org.scribble.protocol.feature" version="0.1.0.200810211526">
<category name="Common"/>
</feature>
<category-def name="JBossESB" label="JBossESB">
15 years, 6 months
Overlord SVN: r408 - cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 10:25:36 -0400 (Tue, 21 Oct 2008)
New Revision: 408
Modified:
cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml
Log:
Added validator tools plugin.
Modified: cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml
===================================================================
--- cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml 2008-10-21 14:24:26 UTC (rev 407)
+++ cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml 2008-10-21 14:25:36 UTC (rev 408)
@@ -192,4 +192,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.jboss.tools.overlord.cdl.validator.jbossesb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
15 years, 6 months
Overlord SVN: r407 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb: .settings and 13 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 10:24:26 -0400 (Tue, 21 Oct 2008)
New Revision: 407
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.classpath
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.project
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.settings/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.settings/org.eclipse.jdt.core.prefs
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/Copyright.txt
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/META-INF/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/META-INF/MANIFEST.MF
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/annotations.xml
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.presentation
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.template
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/build.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/Activator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java
Log:
Initial version of validator tools plugin.
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.classpath
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.classpath (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.classpath 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.project
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.project (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.project 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.overlord.cdl.validator.jbossesb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/.settings/org.eclipse.jdt.core.prefs 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,7 @@
+#Tue Oct 21 14:38:09 BST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/Copyright.txt
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/Copyright.txt (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/Copyright.txt 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,17 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/META-INF/MANIFEST.MF (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/META-INF/MANIFEST.MF 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Overlord CDL Validator JBossESB Plug-in
+Bundle-SymbolicName: org.jboss.tools.overlord.cdl.validator.jbossesb;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.overlord.cdl.validator.jbossesb.eclipse.Activator
+Bundle-Vendor: www.jboss.org
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.pi4soa.common;bundle-version="2.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/annotations.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/annotations.xml (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/annotations.xml 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,8 @@
+<annotations>
+ <annotation type="jbossesb" component="org.pi4soa.cdl.ExchangeDetails" >
+ <template url="cdl/jbossesb.template"
+ processor="org.pi4soa.common.annotations.impl.DefaultTemplateProcessor" />
+ <presentation url="cdl/jbossesb.presentation"
+ processor="org.pi4soa.common.annotations.impl.XSLTPresentationProcessor" />
+ </annotation>
+</annotations>
\ No newline at end of file
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.presentation
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.presentation (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.presentation 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,5 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/">
+The JBossESB Service destination is <xsl:if test="jbossesb/destination/@name != ''" >'<xsl:value-of select="jbossesb/destination/@name" />' </xsl:if><xsl:if test="jbossesb/destination/@name = ''" >'undefined' </xsl:if> [temporary=<xsl:value-of select="jbossesb/destination/@temporary"/>]
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.template
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.template (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/annotations/cdl/jbossesb.template 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,4 @@
+<jbossesb>
+ <destination name="{{Destination;The URI for the ESB destination;string;;}}"
+ temporary="{{Temporary;Whether the destination is temporary;boolean;;false}}" />
+</jbossesb>
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/build.properties
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/build.properties (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/build.properties 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,16 @@
+source.. = src/java/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ Copyright.txt,\
+ annotations/
+src.includes = .classpath,\
+ .project,\
+ .settings/,\
+ Copyright.txt,\
+ META-INF/,\
+ annotations/,\
+ build.properties,\
+ plugin.xml,\
+ src/
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.pi4soa.common.annotationsManager">
+ <annotationsManager
+ class="org.jboss.tools.overlord.cdl.validator.jbossesb.eclipse.JBossESBValidatorAnnotations">
+ </annotationsManager>
+ </extension>
+
+</plugin>
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/Activator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/Activator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/Activator.java 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,50 @@
+package org.jboss.tools.overlord.cdl.validator.jbossesb.eclipse;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.overlord.cdl.validator.jbossesb";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java 2008-10-21 14:24:26 UTC (rev 407)
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ * 21 Oct 2008 : Initial version created by gary
+ */
+package org.jboss.tools.overlord.cdl.validator.jbossesb.eclipse;
+
+import org.pi4soa.common.annotations.eclipse.EclipseAnnotationsManager;
+
+/**
+ * This class implements the AnnotationsManager extension point.
+ */
+public class JBossESBValidatorAnnotations extends EclipseAnnotationsManager {
+
+ public JBossESBValidatorAnnotations() {
+ super(Activator.PLUGIN_ID);
+ }
+}
15 years, 6 months
Overlord SVN: r406 - cdl/trunk/tools/plugins.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 10:23:45 -0400 (Tue, 21 Oct 2008)
New Revision: 406
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/
Log:
Initial import.
15 years, 6 months
Overlord SVN: r405 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 09:36:26 -0400 (Tue, 21 Oct 2008)
New Revision: 405
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF
Log:
Updated referenced implementation classes.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF 2008-10-21 13:30:12 UTC (rev 404)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF 2008-10-21 13:36:26 UTC (rev 405)
@@ -18,20 +18,20 @@
org.eclipse.ui.workbench.texteditor;bundle-version="3.4.0",
org.eclipse.ui.ide;bundle-version="3.4.0",
org.eclipse.ui.editors;bundle-version="3.4.0"
-Scribble-Extensions: org.jboss.tools.overlord.cdl.jbossesb.parser.JBossESBParser,
- org.jboss.tools.overlord.cdl.jbossesb.parser.JBossESBNotation,
- org.jboss.tools.overlord.cdl.jbossesb.editor.JBossESBConfigEditorManager,
- org.jboss.tools.overlord.cdl.jbossesb.validation.ESBLanguageModelValidationRule,
- org.jboss.tools.overlord.cdl.jbossesb.export.ESBLanguageModelStreamExportRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.LanguageToConversationModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.ConversationModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.ConversationInteractionModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.MessageSignatureModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.TypeReferenceModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.IfModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.ParallelModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.RunModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.SpawnModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.WhenModelChangeRule,
- org.jboss.tools.overlord.cdl.jbossesb.model.change.WhileModelChangeRule
+Scribble-Extensions: org.jboss.tools.overlord.cdl.runtime.jbossesb.parser.JBossESBParser,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.parser.JBossESBNotation,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.editor.JBossESBConfigEditorManager,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.validation.ESBLanguageModelValidationRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.export.ESBLanguageModelStreamExportRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.LanguageToConversationModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.ConversationModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.ConversationInteractionModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.MessageSignatureModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.TypeReferenceModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.IfModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.ParallelModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.RunModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.SpawnModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.WhenModelChangeRule,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.WhileModelChangeRule
Bundle-ActivationPolicy: lazy
15 years, 6 months
Overlord SVN: r404 - cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 09:30:12 -0400 (Tue, 21 Oct 2008)
New Revision: 404
Modified:
cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml
Log:
Updated to reference changed project name.
Modified: cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml
===================================================================
--- cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml 2008-10-21 13:27:29 UTC (rev 403)
+++ cdl/trunk/tools/features/org.jboss.tools.overlord.cdl.jbossesb.feature/feature.xml 2008-10-21 13:30:12 UTC (rev 404)
@@ -186,7 +186,7 @@
</requires>
<plugin
- id="org.jboss.tools.overlord.cdl.jbossesb"
+ id="org.jboss.tools.overlord.cdl.runtime.jbossesb"
download-size="0"
install-size="0"
version="0.0.0"
15 years, 6 months
Overlord SVN: r403 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 09:27:29 -0400 (Tue, 21 Oct 2008)
New Revision: 403
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/.project
Log:
Updated project name.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/.project
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/.project 2008-10-21 13:24:53 UTC (rev 402)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/.project 2008-10-21 13:27:29 UTC (rev 403)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.jboss.tools.overlord.cdl.jbossesb</name>
+ <name>org.jboss.tools.overlord.cdl.runtime.jbossesb</name>
<comment></comment>
<projects>
</projects>
15 years, 6 months
Overlord SVN: r402 - cdl/trunk/tools/plugins.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 09:24:53 -0400 (Tue, 21 Oct 2008)
New Revision: 402
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/
Log:
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb (from rev 401, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb)
15 years, 6 months
Overlord SVN: r400 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb: META-INF and 39 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-10-21 09:21:03 -0400 (Tue, 21 Oct 2008)
New Revision: 400
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/eclipse/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AbstractBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AntBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildConfigurationGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BusinessObjectTypeGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ConversationBasedGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/DeploymentFileGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorException.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/JBMQConfigurationGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/MavenBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ModelBasedGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapper.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/template/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ConversionContext.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContext.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBActionFactory.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLink.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractInteractionMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/AbstractESBModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/MessageSignatureModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/TypeReferenceModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/validation/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContextTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModelTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBServiceTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestModelListener.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/actions/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/eclipse/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor/JBossESBConfigEditorManager.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export/ESBLanguageModelStreamExportRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AbstractBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AntBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildConfigurationGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BusinessObjectTypeGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ConversationBasedGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/DeploymentFileGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Generator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorException.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/JBMQConfigurationGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/MavenBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ModelBasedGenerator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/TypeMapper.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/template/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ConversionContext.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContext.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBActionFactory.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLink.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/UnsupportedAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/AbstractESBModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/MessageSignatureModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/TypeReferenceModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ClasspathUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ConversationUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ESBModelUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/IdentityUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/InteractionUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ProblemDefinitions.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/PropertyUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBNotation.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBParser.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/validation/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/generator/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContextTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModelTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBServiceTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestModelListener.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ESBActionTestUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/TestActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/util/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/META-INF/MANIFEST.MF
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/plugin.xml
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/eclipse/Activator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/UnsupportedAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ConversationUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ESBModelUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/IdentityUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/InteractionUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ProblemDefinitions.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBNotation.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/validation/ESBLanguageModelValidationRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapperTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ESBActionTestUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetMessageActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/TestActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ESBModelUtilTest.java
Log:
Refactored plugin to be CDL runtime specific.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/META-INF/MANIFEST.MF 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/META-INF/MANIFEST.MF 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: JBoss Overlord CDL JBossESB Plug-in
-Bundle-SymbolicName: org.jboss.tools.overlord.cdl.jbossesb;singleton:=true
+Bundle-Name: JBoss Overlord CDL Runtime JBossESB Plug-in
+Bundle-SymbolicName: org.jboss.tools.overlord.cdl.runtime.jbossesb;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
-Bundle-Activator: org.jboss.tools.overlord.cdl.jbossesb.eclipse.Activator
+Bundle-Activator: org.jboss.tools.overlord.cdl.runtime.jbossesb.eclipse.Activator
Bundle-Vendor: www.jboss.org
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/plugin.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/plugin.xml 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/plugin.xml 2008-10-21 13:21:03 UTC (rev 400)
@@ -2,14 +2,14 @@
<?eclipse version="3.2"?>
<plugin>
<extension
- id="org.jboss.tools.overlord.cdl.jbossesb.extension"
- name="Overlord CDL JBossESB model extension"
+ id="org.jboss.tools.overlord.cdl.runtime.jbossesb.extension"
+ name="Overlord CDL Runtime JBossESB model extension"
point="org.scribble.extension">
</extension>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
- id="org.jboss.tools.overlord.cdl.jbossesb.object.contribution"
+ id="org.jboss.tools.overlord.cdl.runtime.jbossesb.object.contribution"
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.cdm">
<menu
@@ -26,10 +26,10 @@
</menu>
<action
label="Generate"
- class="org.jboss.tools.overlord.cdl.jbossesb.actions.GenerateAction"
+ class="org.jboss.tools.overlord.cdl.runtime.jbossesb.actions.GenerateAction"
menubarPath="org.jboss.tools.overlord.menu/jbossesb.menu/group2"
enablesFor="1"
- id="org.jboss.tools.overlord.cdl.jbossesb.actions.GenerateAction">
+ id="org.jboss.tools.overlord.cdl.runtime.jbossesb.actions.GenerateAction">
</action>
</objectContribution>
</extension>
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs/GenerateDialog.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs/GenerateDialog.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,378 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.dialogs;
-
-import java.util.logging.Logger;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.jboss.tools.overlord.cdl.jbossesb.generator.*;
-import org.scribble.conversation.model.ConversationModel;
-import org.scribble.extensions.RegistryFactory;
-import org.scribble.model.*;
-
-/**
- * This class provides the dialog for generating JBossESB
- * service artefacts.
- */
-public class GenerateDialog extends org.eclipse.jface.dialogs.Dialog {
-
- /**
- * This is the constructor for the generate dialog.
- *
- * @param shell The shell
- */
- public GenerateDialog(Shell shell, IFile file) {
- super(shell);
-
- m_file = file;
-
- m_buildSystems.add(new AntBuildSystem());
- m_buildSystems.add(new MavenBuildSystem());
-
- initialize(m_file);
- }
-
- /**
- * This method initializes the conversation model associated
- * with the supplied file resource.
- *
- * @param res The file
- */
- protected void initialize(IFile res) {
- ModelReference ref=
- org.scribble.osgi.model.OSGIModelRepository.createReference(res);
-
- if (ref != null) {
- ModelRepository mrep=(ModelRepository)
- RegistryFactory.getRegistry().getExtension(
- ModelRepository.class, null);
-
- if (mrep != null) {
- java.util.List<ModelInfo> models=mrep.getModels(ref,
- new DefaultModelListener());
-
- for (int i=0; m_conversationModel == null &&
- i < models.size(); i++) {
- if (models.get(i).getModel() instanceof ConversationModel) {
- m_conversationModel = (ConversationModel)
- models.get(i).getModel();
-
- m_roles = m_conversationModel.getRoles();
- }
- }
- }
- }
-
- if (m_conversationModel == null) {
- error("Unable to load model used to generate " +
- "the ESB artefacts", null);
- }
- }
-
- /**
- * This method creates the dialog details.
- *
- * @param parent The parent control
- * @return The control containing the dialog components
- */
- protected Control createDialogArea(Composite parent) {
-
- Composite composite=(Composite)super.createDialogArea(parent);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
-
- GridData gd=null;
-
- Group group=new Group(composite, SWT.H_SCROLL|SWT.V_SCROLL);
-
- gd=new GridData();
- gd.horizontalAlignment = SWT.FILL;
- gd.horizontalSpan = 1;
- gd.widthHint = 500;
- gd.grabExcessHorizontalSpace = true;
- group.setLayoutData(gd);
-
- layout = new GridLayout();
- layout.numColumns = 4;
- group.setLayout(layout);
-
- // Labels
- Label label=new Label(group, SWT.NONE);
- label.setText("Service Role");
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 150;
- label.setLayoutData(gd);
-
- label = new Label(group, SWT.NONE);
- label.setText("Project Name");
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 150;
- label.setLayoutData(gd);
-
- if (m_conversationModel != null) {
-
- for (int i=0; i < m_roles.size(); i++) {
-
- Button button=new Button(group, SWT.CHECK);
- button.setText(m_roles.get(i).getName());
- button.setSelection(true);
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 150;
- button.setLayoutData(gd);
-
- m_roleButtons.add(button);
-
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- checkStatus();
- }
- });
-
- Text projectName=new Text(group, SWT.NONE);
-
- String prjName=m_roles.get(i).getName();
-
- if (m_conversationModel.getModelName() != null) {
- prjName = m_conversationModel.getModelName().getName()+"-"+prjName;
- }
-
- projectName.setText(prjName);
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 300;
- projectName.setLayoutData(gd);
-
- m_projectNames.add(projectName);
-
- projectName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- checkStatus();
- }
- });
-
- }
- }
-
- Button button=new Button(group, SWT.NONE);
- button.setText("Check All");
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- button.setLayoutData(gd);
-
- button.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- for (int i=0; i < m_roleButtons.size(); i++) {
- m_roleButtons.get(i).setSelection(true);
- }
- checkStatus();
- }
- });
-
- button=new Button(group, SWT.NONE);
- button.setText("Clear All");
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- button.setLayoutData(gd);
-
- button.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- for (int i=0; i < m_roleButtons.size(); i++) {
- m_roleButtons.get(i).setSelection(false);
- }
- checkStatus();
- }
- });
-
- label = new Label(group, SWT.RIGHT);
- label.setText("Build: ");
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- label.setLayoutData(gd);
-
- m_build=new Combo(group, SWT.DROP_DOWN);
-
- for (int i=0; i < m_buildSystems.size(); i++) {
- m_build.add(m_buildSystems.get(i).getName());
- }
-
- m_build.select(0);
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- m_build.setLayoutData(gd);
-
- return(composite);
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Control ret=super.createButtonBar(parent);
-
- checkStatus();
-
- return(ret);
- }
-
- protected void checkStatus() {
- int selected=0;
- boolean f_error=false;
-
- for (int i=0; i < m_roleButtons.size(); i++) {
- if (m_roleButtons.get(i).getSelection()) {
- selected++;
-
- m_projectNames.get(i).setEnabled(true);
-
- // Check project name
- String projectName=m_projectNames.get(i).getText();
-
- if (isProjectNameValid(projectName) == false) {
- f_error = true;
-
- m_projectNames.get(i).setBackground(
- Display.getCurrent().getSystemColor(SWT.COLOR_RED));
- } else {
- m_projectNames.get(i).setBackground(
- Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- }
- } else {
- m_projectNames.get(i).setEnabled(false);
- m_projectNames.get(i).setBackground(
- Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- }
- }
-
- if (f_error || selected == 0) {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- } else {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- }
-
- protected boolean isProjectNameValid(String name) {
- boolean ret=true;
-
- if (name == null || name.trim().length() == 0) {
- ret = false;
- } else if (m_file.getWorkspace().getRoot().getProject(name).exists()) {
- ret = false;
- } else {
- for (int i=0; ret && i < name.length(); i++) {
- if (i == 0) {
- ret = Character.isJavaIdentifierStart(name.charAt(i));
- } else if ("-.".indexOf(name.charAt(i)) != -1) {
- ret = true;
- } else {
- ret = Character.isJavaIdentifierPart(name.charAt(i));
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * The ok button has been pressed.
- */
- public void okPressed() {
-
- try {
- Generator generator=new Generator(m_file,
- getSelectedBuildSystem());
-
- for (int i=0; i < m_roles.size(); i++) {
-
- if (m_roleButtons.get(i).getSelection()) {
- generator.generateRole(m_roles.get(i),
- m_projectNames.get(i).getText());
- }
- }
-
- super.okPressed();
- } catch(Exception e) {
- error("Failed to generate ESB artefacts", e);
- }
- }
-
- protected BuildSystem getSelectedBuildSystem() {
- return(m_buildSystems.get(m_build.getSelectionIndex()));
- }
-
- /**
- * This method is used to report an error.
- *
- * @param mesg The error message
- * @param ex The exception
- */
- public void error(String mesg, Exception ex) {
-
- org.jboss.tools.overlord.cdl.jbossesb.eclipse.Activator.logError(mesg, ex);
-
- MessageBox mbox=new MessageBox(getShell(),
- SWT.ICON_ERROR|SWT.OK);
- mbox.setMessage(mesg);
- mbox.open();
-
- logger.log(java.util.logging.Level.SEVERE, mesg, ex);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.dialogs");
-
- private IFile m_file=null;
- private ConversationModel m_conversationModel=null;
- private java.util.List<Role> m_roles=null;
- private java.util.List<Button> m_roleButtons=new java.util.Vector<Button>();
- private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
- private Combo m_build=null;
- private java.util.List<BuildSystem> m_buildSystems=new java.util.Vector<BuildSystem>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor/JBossESBConfigEditorManager.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor/JBossESBConfigEditorManager.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor/JBossESBConfigEditorManager.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,95 +0,0 @@
-/*
- * 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:
- * 19 Jun 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.editor;
-
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.ModelReference;
-import org.scribble.model.SourceRef;
-import org.scribble.editor.AbstractEditorManager;
-import org.scribble.editor.EditorManager;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-
-/**
- * This is the JBossESB config implementation of the EditorManager
- * interface.
- */
-(a)RegistryInfo(extension=EditorManager.class,preference=10,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class JBossESBConfigEditorManager extends AbstractEditorManager {
-
- /**
- * This method focuses the editor on the specified source,
- * identified by the model reference and source reference.
- *
- * @param mref The model reference
- * @param sref The component source reference
- * @param prop Additional properties
- */
- public void focus(ModelReference mref, SourceRef sref,
- java.util.Map<String,Object> props) {
- String uri=null;
- org.eclipse.core.resources.IFile file=
- org.scribble.osgi.model.OSGIModelRepository.getFile(mref);
-
- if (file == null || file.exists() == false) {
- file = org.scribble.osgi.model.OSGIModelRepository.getGlobalFile(mref);
- }
-
- if (file != null && file.exists()) {
- uri = file.getFullPath().toPortableString();
- }
-
- if (uri != null) {
- org.eclipse.ui.IWorkbenchPage page=
- org.eclipse.ui.PlatformUI.getWorkbench().
- getActiveWorkbenchWindow().getActivePage();
-
- org.eclipse.core.resources.IResource res=
- org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(uri);
-
- if (res instanceof org.eclipse.core.resources.IFile) {
- org.eclipse.ui.part.FileEditorInput input=
- new org.eclipse.ui.part.FileEditorInput(
- (org.eclipse.core.resources.IFile)res);
-
- // TODO: May want to initially try opening
- // "org.jboss.tools.common.model.ui.editor.EditorPartWrapper"
- // editor, if available, and creating a dummy
- // IMarker to trigger the 'gotoMarker' method
-
- try {
- org.eclipse.ui.IEditorPart part=page.openEditor(input,
- org.eclipse.ui.editors.text.EditorsUI.DEFAULT_TEXT_EDITOR_ID);
-
- if (part instanceof org.eclipse.ui.texteditor.ITextEditor) {
- org.eclipse.ui.texteditor.ITextEditor editor=
- (org.eclipse.ui.texteditor.ITextEditor)part;
-
- editor.selectAndReveal(sref.getStartPosition(),
- sref.getEndPosition()-sref.getStartPosition());
- }
-
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export/ESBLanguageModelStreamExportRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export/ESBLanguageModelStreamExportRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export/ESBLanguageModelStreamExportRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,207 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.export;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-import org.scribble.export.*;
-import org.scribble.export.stream.*;
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.*;
-import org.w3c.dom.Node;
-
-/**
- * This class implements the stream based export rule for the
- * ESBLanguageModel entity.
- */
-(a)RegistryInfo(extension=ExportRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ESBLanguageModelStreamExportRule extends DefaultModelStreamExportRule {
-
- /**
- * 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) &&
- ESBLanguageModel.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 {
- ESBLanguageModel model=(ESBLanguageModel)modelObject;
-
- try {
- String text=getText(model.getESBConfiguration());
-
- context.getFormatter().record(text.getBytes());
-
- } catch(Exception e) {
- throw new java.io.IOException("Failed to get ESB configuration text");
- }
- }
-
- /**
- * This class converts a DOM representation node to
- * text.
- *
- * @param node The DOM node
- * @return The text
- * @throws Exception Failed to convert
- */
- protected String getText(Node node) throws Exception {
- String ret=null;
-
- try {
- // Transform the DOM represent to text
- java.io.ByteArrayOutputStream xmlstr=
- new java.io.ByteArrayOutputStream();
-
- DOMSource source=new DOMSource();
- source.setNode(node);
-
- StreamResult result=new StreamResult(xmlstr);
-
- Transformer trans=
- TransformerFactory.newInstance().newTransformer();
- trans.transform(source, result);
-
- xmlstr.close();
-
- ret = new String(xmlstr.toByteArray());
-
- if ((node instanceof org.w3c.dom.Document) == false) {
-
- // Strip off any <?xml> header
- int index=ret.indexOf("<?xml");
- if (index != -1) {
- index = ret.indexOf("<", 1);
-
- if (index != -1) {
- ret = ret.substring(index);
- } else {
- index = ret.indexOf("?>");
-
- if (index != -1) {
- index += 2;
-
- // Remove any trailing whitespaces
- // after XML header
- while (index < ret.length() &&
- Character.isWhitespace(ret.charAt(index))) {
- index++;
- }
-
- ret = ret.substring(index);
- }
- }
- }
- }
-
- } catch(Exception e) {
- throw new Exception("Failed to transform " +
- "DOM representation into text", e);
- }
-
- int pos=0;
- int prevpos=0;
- StringBuffer buf=new StringBuffer();
- int level=0;
-
- while ((pos=ret.indexOf('<', prevpos)) != -1) {
-
- if (prevpos < pos &&
- ret.substring(prevpos, pos).trim().length() > 0 &&
- ret.charAt(prevpos-1) != '?') {
-
- if (ret.charAt(prevpos) == '\r' &&
- ret.charAt(prevpos+1) == '\n') {
- prevpos += 2;
- }
- for (int i=0; i < level; i++) {
- buf.append(" ");
- }
-
- buf.append(ret.substring(prevpos, pos).trim());
- buf.append("\r\n");
- }
-
- int endpos=ret.indexOf('>', pos);
-
- if (endpos > 0) {
- boolean noreturn=false;
-
- if (pos > 0 && ret.charAt(pos+1) == '/') {
- level--;
- }
-
- for (int i=0; i < level; i++) {
- buf.append(" ");
- }
- buf.append(ret.substring(pos, endpos+1));
-
- if (ret.charAt(endpos-1)== '?') {
- //noreturn = true;
-
- } else if (ret.charAt(endpos-1) == '/') {
- // Ignore
- } else if (pos > 0 && ret.charAt(pos+1) == '/') {
- // Ignore
-
- } else if (pos > 0 && ret.charAt(pos+1) == '!') {
- // Ignore
-
- } else {
- level++;
- }
-
- if (noreturn == false) {
- buf.append("\r\n");
- }
-
- pos = endpos+1;
- }
-
- prevpos = pos;
- }
-
- if (prevpos != -1 &&
- ret.substring(prevpos).trim().length() > 0) {
- buf.append(ret.substring(prevpos));
- }
-
- ret = buf.toString();
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AbstractBuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AbstractBuildSystem.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AbstractBuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-/**
- * This class represents an abstract build system.
- */
-public abstract class AbstractBuildSystem implements BuildSystem {
-
- private static final String TEMPLATE_SUFFIX = ".template";
- private static final String TEMPLATE_PREFIX = "template/";
-
- /**
- * This method returns the contents for the build
- * configuration file.
- *
- * @param projectName The project name
- * @return The build file contents
- */
- public String getBuildFileContents(String projectName) {
- String ret=null;
-
- java.io.InputStream is=
- AbstractBuildSystem.class.getResourceAsStream(
- TEMPLATE_PREFIX+getName()+TEMPLATE_SUFFIX);
-
- if (is != null) {
-
- try {
- byte[] b=new byte[is.available()];
- is.read(b);
-
- ret = new String(b);
-
- ret = ret.replaceAll("%PROJECT%", projectName);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AntBuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AntBuildSystem.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AntBuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-/**
- * This class represents the Ant build system.
- */
-public class AntBuildSystem extends AbstractBuildSystem {
-
- private static final String BUILD_FILE = "build.xml";
- private static final String ANT = "Ant";
- private static final String ESB_CONFIG_PATH = "src/conf/jboss-esb.xml";
- private static final String DEPLOYMENT_PATH = "src/conf/deployment.xml";
- private static final String JBMQ_CONFIG_PATH = "src/conf/jbmq-queue-service.xml";
- private static final String JAVA_SOURCE_PATH = "src/java";
- private static final String LIBRARY_PATH = "src/lib";
-
- /**
- * This method represents the name of the build
- * system.
- *
- * @return The name
- */
- public String getName() {
- return(ANT);
- }
-
- /**
- * This method returns the build configuration file
- * path.
- *
- * @return The build configuration file path
- */
- public String getBuildFilePath() {
- return(BUILD_FILE);
- }
-
- /**
- * This method returns the ESB configuration file
- * path.
- *
- * @return The ESB configuration file path
- */
- public String getESBConfigFilePath() {
- return(ESB_CONFIG_PATH);
- }
-
- /**
- * This method returns the deployment file
- * path.
- *
- * @return The deployment file path
- */
- public String getDeploymentFilePath() {
- return(DEPLOYMENT_PATH);
- }
-
- /**
- * This method returns the JBMQ configuration file
- * path.
- *
- * @return The JBMQ configuration file path
- */
- public String getJBMQConfigFilePath() {
- return(JBMQ_CONFIG_PATH);
- }
-
- /**
- * This method returns the Java source path.
- *
- * @return The Java source path
- */
- public String getJavaSourcePath() {
- return(JAVA_SOURCE_PATH);
- }
-
- /**
- * This method returns the library path.
- *
- * @return The library path
- */
- public String getLibraryPath() {
- return(LIBRARY_PATH);
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildConfigurationGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildConfigurationGenerator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildConfigurationGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -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.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-
-/**
- * This class implements the model based generator to generate
- * the build configuration.
- */
-public class BuildConfigurationGenerator implements ModelBasedGenerator {
-
- /**
- * This method generates the relevant artefacts based on
- * the supplied model, within the specified Java project.
- *
- * @param jproj The Java project
- * @param model The model
- * @param buildSystem The build system to use
- * @throws GeneratorException Failed to generate
- */
- public void generate(IJavaProject jproj,
- ESBLanguageModel model, BuildSystem buildSystem)
- throws GeneratorException {
-
- IPath buildConfigPath=jproj.getPath().append(
- new Path(buildSystem.getBuildFilePath()));
-
- IFile buildConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(buildConfigPath);
-
- GeneratorUtil.createParentFolder(buildConfigFile);
-
- try {
- buildConfigFile.create(null, true,
- new org.eclipse.core.runtime.NullProgressMonitor());
-
- String config=buildSystem.getBuildFileContents(jproj.getProject().getName());
-
- if (config != null) {
- buildConfigFile.setContents(new java.io.ByteArrayInputStream(
- config.getBytes()), true, false,
- new org.eclipse.core.runtime.NullProgressMonitor());
- }
- } catch(Exception e) {
- throw new GeneratorException("Failed to create build config", e);
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildSystem.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-/**
- * This interface represents a build system used when
- * generating the ESB projects.
- */
-public interface BuildSystem {
-
- /**
- * This method represents the name of the build
- * system.
- *
- * @return The name
- */
- public String getName();
-
- /**
- * This method returns the build configuration file
- * path.
- *
- * @return The build configuration file path
- */
- public String getBuildFilePath();
-
- /**
- * This method returns the contents for the build
- * configuration file.
- *
- * @param projectName The project name
- * @return The build file contents
- */
- public String getBuildFileContents(String projectName);
-
- /**
- * This method returns the ESB configuration file
- * path.
- *
- * @return The ESB configuration file path
- */
- public String getESBConfigFilePath();
-
- /**
- * This method returns the deployment file
- * path.
- *
- * @return The deployment file path
- */
- public String getDeploymentFilePath();
-
- /**
- * This method returns the JBMQ configuration file
- * path.
- *
- * @return The JBMQ configuration file path
- */
- public String getJBMQConfigFilePath();
-
- /**
- * This method returns the Java source path.
- *
- * @return The Java source path
- */
- public String getJavaSourcePath();
-
- /**
- * This method returns the library path.
- *
- * @return The library path, or null if not required
- */
- public String getLibraryPath();
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BusinessObjectTypeGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BusinessObjectTypeGenerator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BusinessObjectTypeGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,429 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.Assignment;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.Javadoc;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.PackageDeclaration;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.ReturnStatement;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.TagElement;
-import org.eclipse.jdt.core.dom.TextElement;
-import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.conversation.model.Conversation;
-import org.scribble.conversation.model.Variable;
-import org.scribble.conversation.model.VariableList;
-import org.scribble.model.Interaction;
-import org.scribble.model.ModelObject;
-import org.scribble.model.Role;
-import org.scribble.model.Visitor;
-
-/**
- * This class implements the conversation based generator
- * for generating the business object type associated with
- * a conversation.
- */
-public class BusinessObjectTypeGenerator implements ConversationBasedGenerator {
-
- private static final String GENERATOR_MESSAGES = "org.jboss.tools.overlord.cdl.jbossesb.generator.Messages";
-
- /**
- * This method generates the relevant artefacts based on
- * the supplied conversation, within the specified Java project.
- *
- * @param jproj The Java project
- * @param conversation The conversation
- * @param buildSystem The build system to use
- * @throws GeneratorException Failed to generate
- */
- public void generate(IJavaProject jproj,
- Conversation conversation, BuildSystem buildSystem)
- throws GeneratorException {
- IPath sourceLocation=jproj.getPath().append(
- new Path(buildSystem.getJavaSourcePath()));
-
- String javaClass=ConversationUtil.getBusinessObjectType(conversation);
-
- String javaPath=javaClass.replace('.', '/')+".java";
-
- IPath javaFile=sourceLocation.append(new Path(javaPath));
-
- IFile file=jproj.getProject().getWorkspace().getRoot().getFile(javaFile);
-
- GeneratorUtil.createParentFolder(file);
-
- try {
- file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
- } catch(Exception e) {
- throw new GeneratorException("Failed to create the file", e);
- }
-
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setResolveBindings(true);
- parser.setSource(new char[0]);
-
- CompilationUnit root=(CompilationUnit)parser.createAST(null);
-
- AST ast=root.getAST();
-
- org.eclipse.jface.text.IDocument doc=
- new org.eclipse.jface.text.Document();
-
- root.recordModifications();
-
- PackageDeclaration pd=ast.newPackageDeclaration();
- pd.setName(ast.newName(ConversationUtil.getBusinessObjectTypePackageName(conversation)));
- root.setPackage(pd);
-
- TypeDeclaration type=ast.newTypeDeclaration();
-
- type.setName(ast.newSimpleName(ConversationUtil.getBusinessObjectTypeClassName(conversation)));
-
- Modifier pubmod=ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD);
- type.modifiers().add(pubmod);
-
- root.types().add(type);
-
- // Process conversation to obtain necessary methods and
- // properties
- generateBusinessObjectTypeMethods(type, conversation);
-
- org.eclipse.text.edits.TextEdit edits=root.rewrite(doc, null);
-
- try {
- edits.apply(doc);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- java.io.ByteArrayInputStream is=
- new java.io.ByteArrayInputStream(doc.get().getBytes());
-
- try {
- file.setContents(is, false, true, null);
-
- is.close();
- } catch(Exception e) {
- throw new GeneratorException("Failed to set file contents and close", e);
- }
- }
-
- protected void generateBusinessObjectTypeMethods(TypeDeclaration type,
- final Conversation conversation) throws GeneratorException {
- final java.util.List<Role> roles=new java.util.Vector<Role>();
- final java.util.List<Variable> variables=new java.util.Vector<Variable>();
-
- conversation.visit(new Visitor() {
- public boolean visit(ModelObject obj) {
- boolean ret=true;
-
- if (obj instanceof Conversation &&
- obj != conversation) {
- ret = false;
- } else if (obj instanceof Interaction) {
- Interaction interaction=(Interaction)obj;
-
- // If send and a response, then create
- // 'to' role service category/name
- // methods
- if (InteractionUtil.isSend(interaction) &&
- interaction.getReplyToLabel() == null &&
- interaction.getToRole() != null &&
- roles.contains(interaction.getToRole()) == false) {
- roles.add(interaction.getToRole());
- }
- } else if (obj instanceof VariableList) {
- VariableList vars=(VariableList)obj;
-
- variables.addAll(vars.getVariables());
- }
-
- return(ret);
- }
- });
-
- generateServiceCategoryAndNameMethods(type, roles);
-
- generateAccessorAndModifierMethods(type, variables);
- generateMemberVariables(type, variables);
- }
-
- /**
- * This method generates the methods for returning the
- * service category and name associated with a service
- * being invoked.
- *
- * @param type The type declaration
- * @param roles The list of roles representing the invoked
- * services
- */
- protected void generateServiceCategoryAndNameMethods(TypeDeclaration type,
- java.util.List<Role> roles) {
- AST ast=type.getAST();
-
- for (int i=0; i < roles.size(); i++) {
- String methodName=
- InteractionUtil.getRoleServiceCategoryAccessorMethod(roles.get(i).getName());
-
- MethodDeclaration method=ast.newMethodDeclaration();
- method.setName(ast.newSimpleName(methodName));
- method.setReturnType2(ast.newSimpleType(
- ast.newName("String")));
-
- method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
-
- org.eclipse.jdt.core.dom.Block block=ast.newBlock();
-
- ReturnStatement retStatement=ast.newReturnStatement();
-
- retStatement.setExpression(ast.newNullLiteral());
-
- block.statements().add(retStatement);
-
- method.setBody(block);
-
- type.bodyDeclarations().add(method);
-
- methodName=
- InteractionUtil.getRoleServiceNameAccessorMethod(roles.get(i).getName());
-
- method=ast.newMethodDeclaration();
- method.setName(ast.newSimpleName(methodName));
- method.setReturnType2(ast.newSimpleType(
- ast.newName("String")));
-
- method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
-
- block=ast.newBlock();
-
- retStatement=ast.newReturnStatement();
-
- retStatement.setExpression(ast.newNullLiteral());
-
- block.statements().add(retStatement);
-
- method.setBody(block);
-
- type.bodyDeclarations().add(method);
- }
- }
-
- /**
- * This method generates the accessor and modifier methods
- * associated with the business state variables used by
- * the conversation based actions.
- *
- * @param type The type declaration
- * @param variables The list of variables
- */
- protected void generateAccessorAndModifierMethods(TypeDeclaration type,
- java.util.List<Variable> variables) {
- AST ast=type.getAST();
-
- for (int i=0; i < variables.size(); i++) {
- String methodName=
- ConversationUtil.getVariableAccessorMethod(variables.get(i).getName());
- String memberVariableName=
- ConversationUtil.getMemberVariableName(variables.get(i).getName());
-
- MethodDeclaration method=ast.newMethodDeclaration();
- method.setName(ast.newSimpleName(methodName));
-
- String typeName=TypeMapper.getJavaType(
- variables.get(i).getType().getNamespace(),
- variables.get(i).getType().getLocalpart());
-
- Type returnType=null;
-
- // Check if qualified or base type
- if (typeName.indexOf('.') == -1) {
- returnType = ast.newPrimitiveType(PrimitiveType.toCode(typeName));
- } else {
- returnType = getType(ast, typeName);
- }
-
- method.setReturnType2(returnType);
-
- method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
-
- org.eclipse.jdt.core.dom.Block block=ast.newBlock();
-
- ReturnStatement retStatement=ast.newReturnStatement();
-
- retStatement.setExpression(ast.newSimpleName(memberVariableName));
-
- block.statements().add(retStatement);
-
- method.setBody(block);
-
- Javadoc jdoc=ast.newJavadoc();
- TagElement tag=ast.newTagElement();
-
- TextElement text=ast.newTextElement();
-
- text.setText(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- GENERATOR_MESSAGES),
- "_ACCESSOR_DESCRIPTION",
- new String[]{variables.get(i).getName()}));
-
- tag.fragments().add(text);
-
- jdoc.tags().add(tag);
-
- method.setJavadoc(jdoc);
-
- type.bodyDeclarations().add(method);
-
- // Generate setter method
- methodName=
- ConversationUtil.getVariableModifierMethod(variables.get(i).getName());
-
- method=ast.newMethodDeclaration();
- method.setName(ast.newSimpleName(methodName));
- method.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));
-
- SingleVariableDeclaration svd=ast.newSingleVariableDeclaration();
- svd.setName(ast.newSimpleName("value"));
-
- Type paramType=null;
-
- // Check if qualified or base type
- if (typeName.indexOf('.') == -1) {
- paramType = ast.newPrimitiveType(PrimitiveType.toCode(typeName));
- } else {
- paramType = getType(ast, typeName);
- }
-
- svd.setType(paramType);
-
- method.parameters().add(svd);
-
- method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
-
- block=ast.newBlock();
-
- method.setBody(block);
-
- // Assign value to member variable
- Assignment assign=ast.newAssignment();
- assign.setLeftHandSide(ast.newSimpleName(memberVariableName));
- assign.setRightHandSide(ast.newSimpleName("value"));
-
- ExpressionStatement statement=ast.newExpressionStatement(assign);
-
- block.statements().add(statement);
-
- jdoc = ast.newJavadoc();
- tag = ast.newTagElement();
-
- text = ast.newTextElement();
-
- text.setText(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- GENERATOR_MESSAGES),
- "_MODIFIER_DESCRIPTION",
- new String[]{variables.get(i).getName()}));
-
- tag.fragments().add(text);
-
- jdoc.tags().add(tag);
-
- method.setJavadoc(jdoc);
-
- type.bodyDeclarations().add(method);
- }
- }
-
- /**
- * This method generates the member variables
- * associated with the business state variables used by
- * the conversation based actions.
- *
- * @param type The type declaration
- * @param variables The list of variables
- */
- protected void generateMemberVariables(TypeDeclaration type,
- java.util.List<Variable> variables) {
- AST ast=type.getAST();
-
- for (int i=0; i < variables.size(); i++) {
- String memberVariableName=
- ConversationUtil.getMemberVariableName(variables.get(i).getName());
-
- VariableDeclarationFragment fragment=
- ast.newVariableDeclarationFragment();
- fragment.setName(ast.newSimpleName(memberVariableName));
-
- FieldDeclaration memberVariable=ast.newFieldDeclaration(fragment);
-
- Type paramType=null;
- String typeName=TypeMapper.getJavaType(
- variables.get(i).getType().getNamespace(),
- variables.get(i).getType().getLocalpart());
-
- // Check if qualified or base type
- if (typeName.indexOf('.') == -1) {
- paramType = ast.newPrimitiveType(PrimitiveType.toCode(typeName));
- } else {
- paramType = getType(ast, typeName);
- }
-
- memberVariable.setType(paramType);
-
- memberVariable.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
-
- type.bodyDeclarations().add(memberVariable);
- }
- }
-
- protected Type getType(AST ast, String typeName) {
- Type ret=null;
-
- java.util.StringTokenizer st=new java.util.StringTokenizer(typeName, ".");
- while (st.hasMoreTokens()) {
- String token=st.nextToken();
-
- if (ret == null) {
- ret = ast.newSimpleType(ast.newSimpleName(token));
- } else {
- ret = ast.newQualifiedType(ret, ast.newSimpleName(token));
- }
- }
-
- return(ret);
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ConversationBasedGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ConversationBasedGenerator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ConversationBasedGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.scribble.conversation.model.Conversation;
-
-/**
- * This interface represents a module that generates artefacts
- * based on a specific conversation.
- */
-public interface ConversationBasedGenerator {
-
- /**
- * This method generates the relevant artefacts based on
- * the supplied conversation, within the specified Java project.
- *
- * @param jproj The Java project
- * @param conversation The conversation
- * @param buildSystem The build system to use
- * @throws GeneratorException Failed to generate
- */
- public void generate(IJavaProject jproj,
- Conversation conversation, BuildSystem buildSystem)
- throws GeneratorException;
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/DeploymentFileGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/DeploymentFileGenerator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/DeploymentFileGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import java.util.logging.Logger;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBService;
-
-/**
- * This class implements the model based generator to generate
- * the deployment file.
- */
-public class DeploymentFileGenerator implements ModelBasedGenerator {
-
- /**
- * This method generates the relevant artefacts based on
- * the supplied model, within the specified Java project.
- *
- * @param jproj The Java project
- * @param model The model
- * @param buildSystem The build system to use
- * @throws GeneratorException Failed to generate
- */
- public void generate(IJavaProject jproj,
- ESBLanguageModel model, BuildSystem buildSystem)
- throws GeneratorException {
-
- try {
- IPath deploymentPath=jproj.getPath().append(
- new Path(buildSystem.getDeploymentFilePath()));
-
- IFile deploymentFile=jproj.getProject().getWorkspace().getRoot().getFile(deploymentPath);
- GeneratorUtil.createParentFolder(deploymentFile);
- deploymentFile.create(null, true,
- new org.eclipse.core.runtime.NullProgressMonitor());
-
- StringBuffer buf=new StringBuffer();
- buf.append("<jbossesb-deployment>\r\n");
-
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (iter.hasNext()) {
- ESBService service=iter.next();
-
- String dest=model.getJMSDefinition(service.getJMSBusIdRef());
-
- if (dest != null) {
- buf.append("\t<depends>"+service.getCategory()+
- ".destination:service=Queue,name="+dest+
- "</depends>\r\n");
- } else {
- logger.severe("Failed to find destination for JMS bus id '"+
- service.getJMSBusIdRef()+"'");
- }
- }
-
- buf.append("</jbossesb-deployment>\r\n");
-
- deploymentFile.setContents(new java.io.ByteArrayInputStream(
- buf.toString().getBytes()), true, false,
- new org.eclipse.core.runtime.NullProgressMonitor());
- } catch(Exception e) {
- throw new GeneratorException("Failed to save deployment file", e);
- }
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.generator");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Generator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Generator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Generator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,459 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.resources.IFile;
-import org.jboss.tools.overlord.cdl.jbossesb.generator.BuildSystem;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.conversation.model.ConversationModel;
-import org.scribble.extensions.RegistryFactory;
-import org.scribble.model.*;
-import org.scribble.model.change.ModelGenerator;
-import org.scribble.conversation.model.*;
-import org.w3c.dom.Node;
-import org.eclipse.jdt.core.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-/**
- * This class provides the mechanism for generating JBossESB
- * service artefacts.
- */
-public class Generator {
-
- private static final String CLASSPATH_FILENAME = ".classpath";
- private static final String OUTPUT_LOCATION = "classes";
-
- /**
- * This is the constructor for the generator.
- *
- */
- public Generator(IFile file, BuildSystem buildSystem) {
- m_file = file;
- m_buildSystem = buildSystem;
-
- initialize(m_file);
- }
-
- /**
- * This method initializes the conversation model associated
- * with the supplied file resource.
- *
- * @param res The file
- */
- protected void initialize(IFile res) {
-
- // Initialize the artefact generators
- m_conversationBasedGen.add(new BusinessObjectTypeGenerator());
-
- m_modelBasedGen.add(new BuildConfigurationGenerator());
- m_modelBasedGen.add(new JBMQConfigurationGenerator());
- m_modelBasedGen.add(new DeploymentFileGenerator());
-
- // Initialize the model
- ModelReference ref=
- org.scribble.osgi.model.OSGIModelRepository.createReference(res);
-
- if (ref != null) {
- ModelRepository mrep=(ModelRepository)
- RegistryFactory.getRegistry().getExtension(
- ModelRepository.class, null);
-
- if (mrep != null) {
- java.util.List<ModelInfo> models=mrep.getModels(ref,
- new DefaultModelListener());
-
- for (int i=0; m_conversationModel == null &&
- i < models.size(); i++) {
- if (models.get(i).getModel() instanceof ConversationModel) {
- m_conversationModel = (ConversationModel)
- models.get(i).getModel();
-
- m_roles = m_conversationModel.getRoles();
- }
- }
- }
- }
-
- if (m_conversationModel == null) {
- logger.severe("Unable to load model used to generate " +
- "the ESB artefacts");
- }
- }
-
- /**
- * This method returns the roles that can be generated.
- *
- * @return The roles
- */
- public java.util.List<Role> getRoles() {
- return(m_roles);
- }
-
- /**
- * This method generates the project associated with the
- * supplied role.
- *
- * @param role The role
- * @param projectName The project name
- * @throws Exception Failed to generate role
- */
- public void generateRole(Role role, String projectName)
- throws Exception {
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Generate role '"+role+"' for: "+
- m_conversationModel);
- }
-
- // Project to role
- org.scribble.projector.Projector projector=
- (org.scribble.projector.Projector)
- RegistryFactory.getRegistry().getExtension(
- org.scribble.projector.Projector.class, null);
-
- if (projector != null) {
- Model localModel=projector.project(m_conversationModel,
- role, new DefaultModelListener());
-
- if (localModel instanceof ConversationModel &&
- ((ConversationModel)localModel).getConversation() != null) {
- ConversationModel lcm=(ConversationModel)localModel;
-
- ModelReference targetRef=
- new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
-
- DefaultESBLanguageModel target=
- new DefaultESBLanguageModel(targetRef);
-
- ModelGenerator generator=(ModelGenerator)
- RegistryFactory.getRegistry().getExtension(
- ModelGenerator.class, null);
-
- if (generator != null) {
- generator.generate(targetRef, role, target,
- lcm);
-
- generateRoleProject(projectName,
- target.getESBConfiguration(),
- lcm, target);
- } else {
- logger.severe("Unable to find model generator");
- }
- }
- }
- }
-
- protected void generateRoleProject(String projectName,
- org.w3c.dom.Element esbConfig, ConversationModel localcm,
- ESBLanguageModel model) throws Exception {
-
- final IJavaProject jproj=createJavaProject(projectName);
-
- if (jproj != null && esbConfig != null) {
- // Generate business object types for
- // local conversation model
- localcm.visit(new Visitor() {
-
- public boolean visit(ModelObject obj) {
-
- if (obj instanceof Conversation) {
- for (int i=0; i < m_conversationBasedGen.size(); i++) {
- try {
- m_conversationBasedGen.get(i).generate(jproj,
- (Conversation)obj, getBuildSystem());
- } catch(GeneratorException e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to generate conversation based artefact",
- e);
- }
- }
- }
-
- return true;
- }
- });
-
- // Store ESB configuration
- IPath esbConfigPath=jproj.getPath().append(
- new Path(getBuildSystem().getESBConfigFilePath()));
-
- IFile esbConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(esbConfigPath);
- GeneratorUtil.createParentFolder(esbConfigFile);
- esbConfigFile.create(null, true,
- new org.eclipse.core.runtime.NullProgressMonitor());
-
- String config=getText(esbConfig);
-
- if (config != null) {
- esbConfigFile.setContents(new java.io.ByteArrayInputStream(
- config.getBytes()), true, false,
- new org.eclipse.core.runtime.NullProgressMonitor());
- }
-
- for (int i=0; i < m_modelBasedGen.size(); i++) {
- try {
- m_modelBasedGen.get(i).generate(jproj, model,
- getBuildSystem());
- } catch(GeneratorException e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to generate model based artefact",
- e);
- }
- }
- }
- }
-
- protected IJavaProject createJavaProject(String projectName)
- throws Exception {
-
- // Create project
- IProject project=m_file.getWorkspace().getRoot().getProject(projectName);
- project.create(new org.eclipse.core.runtime.NullProgressMonitor());
-
- IJavaProject jproj=JavaCore.create(project);
-
- project.open(new org.eclipse.core.runtime.NullProgressMonitor());
-
- IProjectDescription description = jproj.getProject().getDescription();
-
- // Update the project natures to include Java Nature
- String[] prevNatures= description.getNatureIds();
- String[] newNatures= new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length]= JavaCore.NATURE_ID;
- description.setNatureIds(newNatures);
-
- // Setup project reference to CDM project
- IProject[] prevProjects=description.getReferencedProjects();
- IProject[] newProjects=new IProject[prevProjects.length+1];
- System.arraycopy(prevProjects, 0, newProjects, 0, prevProjects.length);
- newProjects[prevProjects.length] = m_file.getProject();
- description.setReferencedProjects(newProjects);
-
- // Set the description
- jproj.getProject().setDescription(description,
- new org.eclipse.core.runtime.NullProgressMonitor());
-
- IPath outputLocation=jproj.getPath().append(new Path(OUTPUT_LOCATION));
- IPath classpathLocation=jproj.getPath().append(new Path(CLASSPATH_FILENAME));
- IPath sourceLocation=jproj.getPath().append(
- new Path(getBuildSystem().getJavaSourcePath()));
- IPath libLocation=null;
-
- if (getBuildSystem().getLibraryPath() != null) {
- libLocation=jproj.getPath().append(new Path(getBuildSystem().getLibraryPath()));
- }
-
- // create and set the output and source paths first
- IFolder outputFolder= jproj.getProject().getWorkspace().getRoot().getFolder(outputLocation);
- GeneratorUtil.createParentFolder(outputFolder);
- outputFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
- outputFolder.setDerived(true);
-
- IFolder sourceFolder= jproj.getProject().getWorkspace().getRoot().getFolder(sourceLocation);
- GeneratorUtil.createParentFolder(sourceFolder);
- sourceFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
- sourceFolder.setDerived(true);
-
- if (libLocation != null) {
- IFolder libFolder= jproj.getProject().getWorkspace().getRoot().getFolder(libLocation);
- GeneratorUtil.createParentFolder(libFolder);
- libFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
- libFolder.setDerived(true);
- }
-
- IFile file=jproj.getProject().getWorkspace().getRoot().getFile(classpathLocation);
- file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
- file.setDerived(true);
-
- // Write empty contents, to overcome 'Resource '..' is not local' exception
- String classpath="<classpath/>";
- file.setContents(new java.io.ByteArrayInputStream(classpath.getBytes()), true,
- false, new org.eclipse.core.runtime.NullProgressMonitor());
-
- IClasspathEntry[] classpaths=new IClasspathEntry[2];
-
- classpaths[0] = JavaCore.newContainerEntry(
- new Path("org.eclipse.jdt.launching.JRE_CONTAINER"));
-
- classpaths[1] = JavaCore.newSourceEntry(sourceLocation);
-
- jproj.setRawClasspath(classpaths, outputLocation,
- new org.eclipse.core.runtime.NullProgressMonitor());
-
- return(jproj);
- }
-
- /**
- * This class converts a DOM representation node to
- * text.
- *
- * @param node The DOM node
- * @return The text
- * @throws Exception Failed to convert
- */
- protected String getText(Node node) throws Exception {
- String ret=null;
-
- try {
- // Transform the DOM represent to text
- java.io.ByteArrayOutputStream xmlstr=
- new java.io.ByteArrayOutputStream();
-
- DOMSource source=new DOMSource();
- source.setNode(node);
-
- StreamResult result=new StreamResult(xmlstr);
-
- Transformer trans=
- TransformerFactory.newInstance().newTransformer();
- trans.transform(source, result);
-
- xmlstr.close();
-
- ret = new String(xmlstr.toByteArray());
-
- if ((node instanceof org.w3c.dom.Document) == false) {
-
- // Strip off any <?xml> header
- int index=ret.indexOf("<?xml");
- if (index != -1) {
- index = ret.indexOf("<", 1);
-
- if (index != -1) {
- ret = ret.substring(index);
- } else {
- index = ret.indexOf("?>");
-
- if (index != -1) {
- index += 2;
-
- // Remove any trailing whitespaces
- // after XML header
- while (index < ret.length() &&
- Character.isWhitespace(ret.charAt(index))) {
- index++;
- }
-
- ret = ret.substring(index);
- }
- }
- }
- }
-
- } catch(Exception e) {
- throw new Exception("Failed to transform " +
- "DOM representation into text", e);
- }
-
- int pos=0;
- int prevpos=0;
- StringBuffer buf=new StringBuffer();
- int level=0;
-
- while ((pos=ret.indexOf('<', prevpos)) != -1) {
-
- if (prevpos < pos &&
- ret.substring(prevpos, pos).trim().length() > 0 &&
- ret.charAt(prevpos-1) != '?') {
-
- if (ret.charAt(prevpos) == '\r' &&
- ret.charAt(prevpos+1) == '\n') {
- prevpos += 2;
- }
- for (int i=0; i < level; i++) {
- buf.append(" ");
- }
-
- buf.append(ret.substring(prevpos, pos).trim());
- buf.append("\r\n");
- }
-
- int endpos=ret.indexOf('>', pos);
-
- if (endpos > 0) {
- boolean noreturn=false;
-
- if (pos > 0 && ret.charAt(pos+1) == '/') {
- level--;
- }
-
- for (int i=0; i < level; i++) {
- buf.append(" ");
- }
- buf.append(ret.substring(pos, endpos+1));
-
- if (ret.charAt(endpos-1)== '?') {
- //noreturn = true;
-
- } else if (ret.charAt(endpos-1) == '/') {
- // Ignore
- } else if (pos > 0 && ret.charAt(pos+1) == '/') {
- // Ignore
-
- } else if (pos > 0 && ret.charAt(pos+1) == '!') {
- // Ignore
-
- } else {
- level++;
- }
-
- if (noreturn == false) {
- buf.append("\r\n");
- }
-
- pos = endpos+1;
- }
-
- prevpos = pos;
- }
-
- if (prevpos != -1 &&
- ret.substring(prevpos).trim().length() > 0) {
- buf.append(ret.substring(prevpos));
- }
-
- ret = buf.toString();
-
- return(ret);
- }
-
- public BuildSystem getBuildSystem() {
- return(m_buildSystem);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.generator");
-
- private IFile m_file=null;
- private java.util.List<Role> m_roles=null;
- private ConversationModel m_conversationModel=null;
- private BuildSystem m_buildSystem=null;
- private java.util.List<ConversationBasedGenerator> m_conversationBasedGen=
- new java.util.Vector<ConversationBasedGenerator>();
- private java.util.List<ModelBasedGenerator> m_modelBasedGen=
- new java.util.Vector<ModelBasedGenerator>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorException.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorException.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorException.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-public class GeneratorException extends Exception {
-
- private static final long serialVersionUID = -2263049447116467663L;
-
- /**
- * This constructor initializes the generator exception
- * with a message and the underlying exception that
- * caused the problem.
- *
- * @param mesg The message
- * @param t The cause
- */
- public GeneratorException(String mesg, Throwable t) {
- super(mesg, t);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-
-/**
- * This class provides general utility functions for
- * use when generating artefacts.
- */
-public class GeneratorUtil {
-
- /**
- * This method checks whether the parent folder exists,
- * and if not attempts to create it.
- *
- * @param res The current resource
- */
- public static void createParentFolder(IResource res) {
-
- if (res.getParent() instanceof IFolder) {
- IFolder parent=(IFolder)res.getParent();
-
- if (parent.exists() == false) {
- createParentFolder(parent);
-
- try {
- parent.create(true, true,
- new org.eclipse.core.runtime.NullProgressMonitor());
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/JBMQConfigurationGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/JBMQConfigurationGenerator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/JBMQConfigurationGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import java.util.logging.Logger;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBService;
-
-/**
- * This class implements the model based generator to generate
- * the JBMQ configuration.
- */
-public class JBMQConfigurationGenerator implements ModelBasedGenerator {
-
- /**
- * This method generates the relevant artefacts based on
- * the supplied model, within the specified Java project.
- *
- * @param jproj The Java project
- * @param model The model
- * @param buildSystem The build system to use
- * @throws GeneratorException Failed to generate
- */
- public void generate(IJavaProject jproj,
- ESBLanguageModel model, BuildSystem buildSystem)
- throws GeneratorException {
- IPath buildConfigPath=jproj.getPath().append(
- new Path(buildSystem.getJBMQConfigFilePath()));
-
- IFile jbmqConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(buildConfigPath);
- GeneratorUtil.createParentFolder(jbmqConfigFile);
-
- try {
- jbmqConfigFile.create(null, true,
- new org.eclipse.core.runtime.NullProgressMonitor());
-
- StringBuffer buf=new StringBuffer();
- buf.append("<server>\r\n");
-
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (iter.hasNext()) {
- ESBService service=iter.next();
-
- String dest=model.getJMSDefinition(service.getJMSBusIdRef());
-
- if (dest != null) {
- buf.append("\t<mbean code=\"org.jboss.mq.server.jmx.Queue\"\r\n");
- buf.append("\t\t\tname=\""+service.getCategory()+".destination:service=Queue,name="+dest+"\">\r\n");
- buf.append("\t\t<depends optional-attribute-name=\"DestinationManager\">\r\n");
- buf.append("\t\t\tjboss.mq:service=DestinationManager\r\n");
- buf.append("\t\t</depends>\r\n");
- buf.append("\t</mbean>\r\n");
- } else {
- logger.severe("Failed to find destination for JMS bus id '"+
- service.getJMSBusIdRef()+"'");
- }
- }
-
- buf.append("</server>\r\n");
-
- jbmqConfigFile.setContents(new java.io.ByteArrayInputStream(
- buf.toString().getBytes()), true, false,
- new org.eclipse.core.runtime.NullProgressMonitor());
- } catch(Exception e) {
- throw new GeneratorException("Failed to save JBMQ configuration", e);
- }
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.generator");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/MavenBuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/MavenBuildSystem.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/MavenBuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-/**
- * This class represents the Ant build system.
- */
-public class MavenBuildSystem extends AbstractBuildSystem {
-
- private static final String BUILD_FILE = "pom.xml";
- private static final String MAVEN = "Maven";
- private static final String ESB_CONFIG_PATH = "src/main/resources/META-INF/jboss-esb.xml";
- private static final String DEPLOYMENT_PATH = "src/main/resources/META-INF/deployment.xml";
- private static final String JBMQ_CONFIG_PATH = "src/main/resources/jbmq-queue-service.xml";
- private static final String JAVA_SOURCE_PATH = "src/main/java";
- private static final String LIBRARY_PATH = null;
-
- /**
- * This method represents the name of the build
- * system.
- *
- * @return The name
- */
- public String getName() {
- return(MAVEN);
- }
-
- /**
- * This method returns the build configuration file
- * path.
- *
- * @return The build configuration file path
- */
- public String getBuildFilePath() {
- return(BUILD_FILE);
- }
-
- /**
- * This method returns the ESB configuration file
- * path.
- *
- * @return The ESB configuration file path
- */
- public String getESBConfigFilePath() {
- return(ESB_CONFIG_PATH);
- }
-
- /**
- * This method returns the deployment file
- * path.
- *
- * @return The deployment file path
- */
- public String getDeploymentFilePath() {
- return(DEPLOYMENT_PATH);
- }
-
- /**
- * This method returns the JBMQ configuration file
- * path.
- *
- * @return The JBMQ configuration file path
- */
- public String getJBMQConfigFilePath() {
- return(JBMQ_CONFIG_PATH);
- }
-
- /**
- * This method returns the Java source path.
- *
- * @return The Java source path
- */
- public String getJavaSourcePath() {
- return(JAVA_SOURCE_PATH);
- }
-
- /**
- * This method returns the library path.
- *
- * @return The library path
- */
- public String getLibraryPath() {
- return(LIBRARY_PATH);
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Messages.properties
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Messages.properties 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Messages.properties 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,20 +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.
-# */
-
-_ACCESSOR_DESCRIPTION=The accessor method for variable '{0}'.
-_MODIFIER_DESCRIPTION=The modifier method for variable '{0}'.
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ModelBasedGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ModelBasedGenerator.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ModelBasedGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-
-/**
- * This interface represents a module that generates artefacts
- * based on the complete model.
- */
-public interface ModelBasedGenerator {
-
- /**
- * This method generates the relevant artefacts based on
- * the supplied model, within the specified Java project.
- *
- * @param jproj The Java project
- * @param model The model
- * @param buildSystem The build system to use
- * @throws GeneratorException Failed to generate
- */
- public void generate(IJavaProject jproj,
- ESBLanguageModel model, BuildSystem buildSystem)
- throws GeneratorException;
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/TypeMapper.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/TypeMapper.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/TypeMapper.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
-
-public class TypeMapper {
-
- private static final String BOOLEAN_TYPE = "boolean";
- private static final String STRING_TYPE = "string";
- private static final String DECIMAL_TYPE = "decimal";
- private static final String INTEGER_TYPE = "integer";
- private static final String INT_TYPE = "int";
- public static final String JAVA_PREFIX = "java:";
- public static final String XSD_NAMESPACE = "http://www.w3.org/2001/XMLSchema";
-
- /**
- * This method determines the appropriate Java type associated
- * with the supplied type namespace and localpart.
- *
- * @param namespace The namespace
- * @param localpart The local part
- * @return The Java type
- */
- public static String getJavaType(String namespace, String localpart) {
- String ret=org.w3c.dom.Element.class.getName();
-
- if (namespace != null && localpart != null) {
-
- if (namespace.startsWith(JAVA_PREFIX)) {
- ret = namespace.substring(JAVA_PREFIX.length())
- +"."+localpart;
- } else if (namespace.equals(XSD_NAMESPACE)) {
-
- if (localpart.equals(STRING_TYPE)) {
- ret = String.class.getName();
- } else if (localpart.equals(DECIMAL_TYPE) ||
- localpart.equals(INTEGER_TYPE)) {
- ret = INT_TYPE;
- } else if (localpart.equals(BOOLEAN_TYPE)) {
- ret = BOOLEAN_TYPE;
- }
- }
- }
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ConversionContext.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ConversionContext.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ConversionContext.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,88 +0,0 @@
-/*
- * 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:
- * 25 Jun 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-public interface ConversionContext {
-
- /**
- * This method returns the role associated with the
- * endpoint being converted.
- *
- *@return The role
- */
- public String getRole();
-
- /**
- * This method is invoked when an ESB service is being processed.
- *
- * @param service The service
- */
- public void processing(ESBService service);
-
- /**
- * This method is invoked when an ESB service has been processed.
- *
- * @param service The service
- */
- public void processed(ESBService service);
-
- /**
- * Push service on the stack of services in which the current
- * context is contained.
- *
- * @param service The service
- */
- public void push(ESBService service);
-
- /**
- * Pop service from the stack of services in which the current
- * context is contained.
- *
- * @param service The service
- */
- public void pop(ESBService service);
-
- /**
- * This method determines whether the supplied service is on
- * the stack of services in which the current context is
- * contained.
- *
- * @param service The service
- * @return Whether the service is on the stack
- */
- public boolean isOnStack(ESBService service);
-
- /**
- * This method marks an ESB service as being a join state.
- *
- * @param service The service
- */
- public void markJoin(ESBService service);
-
- /**
- * This method determines whether the ESB service is a join
- * state.
- *
- * @param service The serviice
- * @return Whether the service is a join state
- */
- public boolean isJoin(ESBService service);
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContext.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContext.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContext.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,129 +0,0 @@
-/*
- * 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:
- * 25 Jun 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.logging.Logger;
-
-public class DefaultConversionContext implements ConversionContext {
-
- /**
- * This constructor initializes the role associated with
- * the conversion.
- *
- * @param role The role
- */
- public DefaultConversionContext(String role) {
- m_role = role;
- }
-
- /**
- * This method returns the role associated with the
- * endpoint being converted.
- *
- *@return The role
- */
- public String getRole() {
- return(m_role);
- }
-
- /**
- * This method is invoked when an ESB service is being processed.
- *
- * @param service The service
- */
- public void processing(ESBService service) {
- m_joins.remove(service);
- }
-
- /**
- * This method is invoked when an ESB service has been processed.
- *
- * @param service The service
- */
- public void processed(ESBService service) {
-
- }
-
- /**
- * Push service on the stack of services in which the current
- * context is contained.
- *
- * @param service The service
- */
- public void push(ESBService service) {
- m_serviceStack.add(service);
- }
-
- /**
- * Pop service from the stack of services in which the current
- * context is contained.
- *
- * @param service The service
- */
- public void pop(ESBService service) {
-
- // Check if the service is the last element on the stack
- if (m_serviceStack.size() == 0 ||
- m_serviceStack.get(m_serviceStack.size()-1) != service) {
- logger.severe("Request to pop service '"+service+
- "' that is not the most recent entry on the stack");
- }
-
- m_serviceStack.remove(service);
- }
-
- /**
- * This method determines whether the supplied service is on
- * the stack of services in which the current context is
- * contained.
- *
- * @param service The service
- * @return Whether the service is on the stack
- */
- public boolean isOnStack(ESBService service) {
- return(m_serviceStack.contains(service));
- }
-
- /**
- * This method marks an ESB service as being a join state.
- *
- * @param service The service
- */
- public void markJoin(ESBService service) {
- m_joins.add(service);
- }
-
- /**
- * This method determines whether the ESB service is a join
- * state.
- *
- * @param service The service
- * @return Whether the service is a join state
- */
- public boolean isJoin(ESBService service) {
- return(m_joins.contains(service));
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model");
-
- private java.util.List<ESBService> m_serviceStack=new java.util.Vector<ESBService>();
- private java.util.List<ESBService> m_joins=new java.util.Vector<ESBService>();
- private String m_role=null;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModel.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModel.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModel.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,689 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.logging.Logger;
-
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryFactory;
-import org.scribble.model.*;
-import org.scribble.model.resolutions.*;
-
-/**
- * This class represents an ESB model.
- *
- * @author gary
- */
-public class DefaultESBLanguageModel extends org.scribble.lang.model.LanguageModel
- implements ESBLanguageModel {
-
- private static final String SERVICE_NAME_SEPARATOR = "__";
- public static final String DEST_NAME_PREFIX = "queue/";
- public static final String DEST_NAME_ATTR = "dest-name";
- public static final String DEST_TYPE_VALUE = "QUEUE";
- public static final String DEST_TYPE_ATTR = "dest-type";
- public static final String JMS_MESSAGE_FILTER_ELEMENT = "jms-message-filter";
- public static final String JMS_BUS_ELEMENT = "jms-bus";
- public static final String BUSID_ATTR = "busid";
- public static final String JBOSSESB_XML_NAMESPACE = "http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml...";
- public static final String XMLNS = "xmlns";
- public static final String TOP_LEVEL_ELEMENT = "jbossesb";
- public static final String PARAMETER_RELOAD_SECS_ATTR = "parameterReloadSecs";
- public static final String PROVIDERS_ELEMENT = "providers";
- public static final String JMS_PROVIDER_ELEMENT = "jms-provider";
- public static final String JAVA_NOTATION = "java";
- public static final String SERVICE_ELEMENT = "service";
- public static final String SERVICES_ELEMENT = "services";
-
- public static final String JBOSSESB_NOTATION = "jboss-esb.xml";
-
- /**
- * This constructor is initialized with the ESB configuration.
- *
- * @param source The model reference for the JBossESB configuration source
- * @param elem The ESB configuration
- * @param contents The textual contents
- */
- public DefaultESBLanguageModel(ModelReference source, org.w3c.dom.Element elem,
- String contents) {
- m_source = source;
- m_esbConfig = elem;
- m_contents = contents;
-
- // Extract service action pipelines
- initializeExistingConfig();
- }
-
- /**
- * This constructor initializes a new ESB configuration.
- *
- * @param source The model reference for the JBossESB configuration
- */
- public DefaultESBLanguageModel(ModelReference source) {
- m_source = source;
-
- initializeNewConfig();
- }
-
- /**
- * This method creates a new ESB configuration.
- */
- protected void initializeNewConfig() {
-
- org.w3c.dom.Document doc=null;
-
- // Create an empty document
- try {
- doc = javax.xml.parsers.DocumentBuilderFactory.
- newInstance().newDocumentBuilder().newDocument();
-
- m_esbConfig = doc.createElement(TOP_LEVEL_ELEMENT);
-
- m_esbConfig.setAttribute(XMLNS,
- JBOSSESB_XML_NAMESPACE);
- m_esbConfig.setAttribute(PARAMETER_RELOAD_SECS_ATTR,"5000");
-
- doc.appendChild(m_esbConfig);
-
- // Create provider information
- org.w3c.dom.Element providers=doc.createElement(PROVIDERS_ELEMENT);
- m_esbConfig.appendChild(providers);
-
- m_jmsProviderElem = doc.createElement(JMS_PROVIDER_ELEMENT);
- providers.appendChild(m_jmsProviderElem);
-
- // Configure the jms provider
- m_jmsProviderElem.setAttribute("name", "JBossMQ");
- m_jmsProviderElem.setAttribute("connection-factory", "ConnectionFactory");
- m_jmsProviderElem.setAttribute("jndi-context-factory", "org.jnp.interfaces.NamingContextFactory");
- m_jmsProviderElem.setAttribute("jndi-URL", "localhost");
-
- // Create services element
- m_servicesElem = doc.createElement(SERVICES_ELEMENT);
- m_esbConfig.appendChild(m_servicesElem);
-
- } catch(Exception e) {
- logger.severe("Failed to create initial jbossesb document: "+e);
- }
-
- }
-
- /**
- * This method initializes the ESB Model.
- */
- protected void initializeExistingConfig() {
- org.w3c.dom.NodeList services=
- m_esbConfig.getElementsByTagName(SERVICES_ELEMENT);
-
- org.scribble.model.DependencyManager dm=
- (org.scribble.model.DependencyManager)
- org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
- org.scribble.model.DependencyManager.class, null);
-
- ModelName mname=new ModelName();
- mname.setName(m_source.getLocalpart());
-
- setModelName(mname);
-
- Namespace ns=new Namespace();
- ns.setName(m_source.getNamespace());
- setNamespace(ns);
-
- if (services != null && services.getLength() == 1 &&
- services.item(0) instanceof org.w3c.dom.Element) {
- org.w3c.dom.NodeList nl=((org.w3c.dom.Element)
- services.item(0)).getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
-
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(SERVICE_ELEMENT)) {
-
- ESBService service=new DefaultESBService(this,
- (org.w3c.dom.Element)nl.item(i));
- String key=getKey(service.getCategory(),
- service.getName());
-
- m_services.put(key, service);
- }
- }
-
- java.util.Iterator<ESBService> iter=m_services.values().iterator();
-
- while (iter.hasNext()) {
- iter.next().initializeLinks();
- }
-
- // Initialize the conversations
- java.util.List<String> sessionClasses=new java.util.Vector<String>();
- java.util.Iterator<ESBService> serviter=getServices().iterator();
-
- while (serviter.hasNext()) {
- ESBService service=serviter.next();
-
- if (service.isRoot()) {
-
- /*
- String convType=service.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(ConversationModel.CONVERSATION);
- //ConformanceReference iref=
- // new ConformanceReference(ConversationModel.CONVERSATION);
-
- role = convType.substring(index+1);
-
- iref.setLocatedRole(role);
-
- // Need to locate the model name
- modelName.setLocatedRole(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));
- }
-
- conv.getImplements().add(iref);
- //conv.getConformsTo().add(iref);
-
- dm.recordDependency(m_source, iref,
- DependencyType.Implements);
-
- } else {
- logger.warning("Conversation type does not " +
- "contain '@' located role separator");
- }
- } else {
- logger.warning("No conversation type specified");
- }
-
- conv.setBlock(new Block());
-
- service.convert(conv.getBlock().getContents(),
- new DefaultConversionContext(role));
-
- */
-
- Conversation conv=service.convert(null);
-
- if (conv != null) {
- getConversations().add(conv);
- }
- }
-
- //Add session class to list
- String sessionClass=service.getSessionName();
-
- if (sessionClass != null &&
- sessionClasses.contains(sessionClass) == false) {
- sessionClasses.add(sessionClass);
- }
- }
-
- // Add dependency on session classes
- for (int i=0; i < sessionClasses.size(); i++) {
- String sessionClass=sessionClasses.get(i);
- int index=sessionClass.lastIndexOf('.');
- String nspace="";
- String local=sessionClass;
-
- if (index != -1) {
- nspace = sessionClass.substring(0, index);
- local = sessionClass.substring(index+1);
-
- dm.recordDependency(getModelReference(),
- new ModelReference(nspace, local,
- null, JAVA_NOTATION),
- DependencyType.Uses);
- }
- }
- }
-
- if (logger.isLoggable(java.util.logging.Level.FINEST)) {
-
- org.scribble.export.Exporter exporter=
- (org.scribble.export.Exporter)
- RegistryFactory.getRegistry().getExtension(
- org.scribble.export.Exporter.class, null);
-
- try {
- for (int i=0; i < getConversations().size(); i++) {
- ConversationModel model=new ConversationModel();
- Conversation conv=getConversations().get(i);
- ModelObject parent=conv.getParent();
-
- // This command will overwrite the parent of
- // the conversation, so need to set this back
- // at the end
- model.setConversation(conv);
-
- org.scribble.export.text.TextFormatter formatter=
- new org.scribble.export.text.TextFormatter();
-
- java.io.ByteArrayOutputStream os=
- new java.io.ByteArrayOutputStream();
-
- formatter.setOutputStream(os);
-
- exporter.export(model, formatter);
-
- String str=new String(os.toByteArray());
-
- System.out.println("EXPORTED JBOSS-ESB TEXT:");
- System.out.println(str);
-
- // Re-establish the true parent
- conv.setParent(parent);
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- @Override
- public String getNotation() {
- return(JBOSSESB_NOTATION);
- }
-
- /**
- * 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) {
-
- java.util.Iterator<ESBService> iter=m_services.values().iterator();
-
- while (iter.hasNext()) {
- ESBService service=iter.next();
-
- service.validate(l);
- }
- }
-
- /**
- * This method returns the ESB service for the supplied
- * category and name.
- *
- * @param category The service category
- * @param name The service name
- * @return The ESB service, or null if not found
- */
- public ESBService getService(String category, String name) {
- return(m_services.get(getKey(category, name)));
- }
-
- /**
- * This method returns the collection of ESB services associated
- * with the model.
- *
- * @return The collection of ESB services
- */
- public java.util.Collection<ESBService> getServices() {
- return(m_services.values());
- }
-
- /**
- * This method creates a new ESB service.
- *
- * @param category The category
- * @param name The name
- * @return The new ESB service
- */
- public ESBService createService(String category, String name) {
- return(new DefaultESBService(this, category, name));
- }
-
- /**
- * This method adds a new service to the model.
- *
- * @param service The service
- */
- public void addService(ESBService service) {
- m_services.put(getKey(service.getCategory(), service.getName()),
- service);
-
- // Add service
- if (service.getService() != null) {
- m_servicesElem.appendChild(service.getService());
- }
-
- // Add provider information
- String busId=service.getJMSBusIdRef();
-
- // Check if busId is unique
- if (busId == null || findJMSBus(busId) != null) {
- busId = getUniqueBusId();
- service.setJMSBusIdRef(busId);
- }
-
- if (busId != null) {
- addJMSBus(busId, getJMSDestination(service.getCategory(),
- service.getName()));
- } else {
- logger.severe("Service '"+service+
- "' does not have a bus Id");
- }
- }
-
- protected String getUniqueBusId() {
- int index=1;
- String ret="busId"+index;
-
- while (findJMSBus(ret) != null) {
- index++;
- ret = "busId"+index;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the JMS destination associated with
- * the supplied JMS Bus Id.
- *
- * @param jmsBusId The JMS bus id
- * @return The JMS definition, or null if not found
- */
- public String getJMSDefinition(String jmsBusId) {
- String ret=null;
-
- org.w3c.dom.Element elem=findJMSBus(jmsBusId);
-
- if (elem != null) {
- org.w3c.dom.NodeList nl=
- elem.getElementsByTagName(JMS_MESSAGE_FILTER_ELEMENT);
-
- if (nl.getLength() != 0 &&
- nl.item(0) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Element filter=(org.w3c.dom.Element)
- nl.item(0);
-
- if (filter.hasAttribute(DEST_NAME_ATTR)) {
- ret = filter.getAttribute(DEST_NAME_ATTR);
-
- // If prefixed, then strip prefix away
- if (ret.startsWith(DEST_NAME_PREFIX)) {
- ret = ret.substring(DEST_NAME_PREFIX.length());
- }
- }
- }
- }
-
- return(ret);
- }
-
- protected void addJMSBus(String jmsBusId, String dest) {
-
- org.w3c.dom.Element jmsBus=
- m_esbConfig.getOwnerDocument().createElement(JMS_BUS_ELEMENT);
- m_jmsProviderElem.appendChild(jmsBus);
-
- jmsBus.setAttribute(BUSID_ATTR, jmsBusId);
-
- org.w3c.dom.Element mesgFilter=
- m_esbConfig.getOwnerDocument().createElement(JMS_MESSAGE_FILTER_ELEMENT);
- jmsBus.appendChild(mesgFilter);
-
- mesgFilter.setAttribute(DEST_TYPE_ATTR, DEST_TYPE_VALUE);
- mesgFilter.setAttribute(DEST_NAME_ATTR, DEST_NAME_PREFIX+dest);
- }
-
- protected org.w3c.dom.Element findJMSBus(String jmsBusId) {
- org.w3c.dom.Element ret=null;
-
- org.w3c.dom.NodeList nl=m_jmsProviderElem.getChildNodes();
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(JMS_BUS_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).
- getAttribute(BUSID_ATTR).equals(jmsBusId)) {
- ret = (org.w3c.dom.Element)nl.item(i);
- }
- }
-
- return(ret);
- }
-
- protected void removeJMSBus(String jmsBusId) {
- org.w3c.dom.Element bus=findJMSBus(jmsBusId);
-
- if (bus != null) {
- m_jmsProviderElem.removeChild(bus);
- } else {
- logger.severe("Remove JMS bus '"+jmsBusId+
- "' failed, unable to find bus");
- }
- }
-
- protected String getJMSDestination(String category, String name) {
- String ret=category.replace('.', '_');
-
- ret += "_"+name;
-
- return(ret);
- }
-
- /**
- * This method removes a service from the model.
- *
- * @param service The service
- */
- public void removeService(ESBService service) {
- m_services.remove(getKey(service.getCategory(),
- service.getName()));
-
- // Remove provider information
- String busId=service.getJMSBusIdRef();
-
- if (busId != null) {
- removeJMSBus(busId);
- } else {
- logger.severe("Service '"+service+
- "' does not have a bus Id");
- }
- }
-
- /**
- * This textual contents of the model.
- *
- * @return The textual contents
- */
- public String getOriginalContents() {
- return(m_contents);
- }
-
- /**
- * This method returns a unique service name within
- * the supplied category.
- *
- * @param category The category
- * @param currentServiceName The name of the service creating
- * the new service
- * @return The unique service name
- */
- public String getUniqueServiceName(String category, String currentServiceName) {
- String ret=null;
-
- int index=currentServiceName.indexOf(SERVICE_NAME_SEPARATOR);
- if (index != -1) {
- currentServiceName = currentServiceName.substring(0, index);
- }
-
- index = 0;
- do {
- index++;
- ret = currentServiceName+SERVICE_NAME_SEPARATOR+index;
- } while(getService(category, ret) != null);
-
- return(ret);
- }
-
- /**
- * This method returns the gateway service.
- *
- * @return The gateway service, or null if not found
- */
- public ESBService getGatewayService() {
- ESBService ret=null;
-
- java.util.Iterator<ESBService> iter=getServices().iterator();
- while (ret == null && iter.hasNext()) {
- ret = iter.next();
-
- if (ret.isGateway() == false) {
- ret = null;
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the reference to the DOM
- * representation of the ESB configuration.
- *
- * @return The ESB configuration
- */
- public org.w3c.dom.Element getESBConfiguration() {
- return(m_esbConfig);
- }
-
- /**
- * This method returns a custom classloader that uses the project's
- * classpath to locate classes referenced by the ESB config file.
- *
- * @see http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg17769.html
- *
- * @return The classloader
- * @throws Exception Failed to obtain the classloader
- */
- public synchronized ClassLoader getModelClassLoader() throws Exception {
-
- if (m_classLoader == null) {
- m_classLoader = org.jboss.tools.overlord.cdl.jbossesb.model.util.ClasspathUtil.createClassLoader(getModelReference());
- }
-
- return(m_classLoader);
- }
-
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model");
-
- private ModelReference m_source=null;
- private org.w3c.dom.Element m_esbConfig=null;
- private org.w3c.dom.Element m_jmsProviderElem=null;
- private org.w3c.dom.Element m_servicesElem=null;
- private String m_contents=null;
- private java.util.Map<String,ESBService> m_services=new java.util.Hashtable<String,ESBService>();
- private ClassLoader m_classLoader=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: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBService.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBService.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,848 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ESBModelUtil;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * This class represents an ESB service.
- *
- * @author gary
- */
-public class DefaultESBService extends ModelObject implements ESBService {
-
- public static final String LISTENERS_ELEMENT = "listeners";
- public static final String BUSIDREF_ATTR = "busidref";
- public static final String JMS_LISTENER_ELEMENT = "jms-listener";
- public static final String MAX_THREADS_ATTR = "maxThreads";
- public static final String NAME_ATTR = "name";
- public static final String CATEGORY_ATTR = "category";
- public static final String ROOT_PROPERTY = "root";
- public static final String BUSINESS_OBJECT_TYPE_PROPERTY = "session";
- public static final String CONVERSATION_TYPE_PROPERTY = "conversationType";
- public static final String SERVICE_DESCRIPTION_NAME_PROPERTY = "serviceDescriptionName";
- public static final String SERVICE_ANNOTATION = "org.jboss.soa.overlord.jbossesb.actions.Service";
- public static final String SERVICE_ELEMENT = "service";
- public static final String RETRIEVE_SESSION_ACTION_CLASS = "org.jboss.soa.overlord.jbossesb.actions.RetrieveSessionAction";
- public static final String ACTION_ELEMENT = "action";
- public static final String ACTIONS_ELEMENT = "actions";
-
- /**
- * This is the constructor for the ESB service. This construct
- * creates a new DOM element, contained within the supplied
- * model, to represent the service associated with the
- * supplied category and name.
- *
- * @param model The ESB model in which the service has been defined
- * @param service The XML configuration of the service
- */
- public DefaultESBService(ESBLanguageModel model,
- String category, String name) {
- m_model = model;
-
- // Create new element for the service
- initializeNewServiceElement(category, name);
- }
-
- /**
- * This is the constructor for the ESB service. This construct
- * creates a wrapper around the supplied DOM representation of
- * the existing service element within an ESB configuration.
- *
- * @param model The ESB model in which the service has been defined
- * @param service The XML configuration of the service
- */
- public DefaultESBService(ESBLanguageModel model, org.w3c.dom.Element service) {
- m_model = model;
- m_service = service;
-
- if (m_model != null && m_service != null) {
- initializeExistingServiceElement();
- }
- }
-
- protected void initializeNewServiceElement(String category, String name) {
-
- m_service = m_model.getESBConfiguration().
- getOwnerDocument().createElement(SERVICE_ELEMENT);
-
- m_service.setAttribute(CATEGORY_ATTR, category);
- m_service.setAttribute(NAME_ATTR, name);
-
- m_actionsElem = m_model.getESBConfiguration().
- getOwnerDocument().createElement(ACTIONS_ELEMENT);
- m_service.appendChild(m_actionsElem);
- }
-
- /**
- * This method initializes the service.
- */
- protected void initializeExistingServiceElement() {
- // Check if relevant action
- org.w3c.dom.NodeList actions=m_service.getElementsByTagName(ACTIONS_ELEMENT);
-
- if (actions != null && actions.getLength() == 1 &&
- actions.item(0) instanceof org.w3c.dom.Element) {
-
- m_actionsElem = (org.w3c.dom.Element)actions.item(0);
-
- org.w3c.dom.NodeList nl=((org.w3c.dom.Element)
- actions.item(0)).getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(ACTION_ELEMENT)) {
- m_actions.add(ESBActionFactory.createAction(this,
- ((org.w3c.dom.Element)nl.item(i))));
- }
- }
- }
-
- // Find positional information
- int servCount=getServicePosition();
-
- String str=getModel().getOriginalContents();
-
- if (str != null) {
- int startPosition=str.indexOf("<service ");
- int endPosition=-1;
- int loggedEndPosition=-1;
-
- while (startPosition != -1 && servCount > 0) {
- servCount--;
-
- loggedEndPosition = str.indexOf('>', startPosition);
-
- endPosition = str.indexOf("</service>", startPosition);
-
- if (servCount > 0) {
- startPosition=str.indexOf("<service ", endPosition);
- }
- }
-
- if (startPosition != -1) {
- endPosition = str.indexOf("</service>", startPosition);
-
- getSource().setStartPosition(startPosition);
- getSource().setEndPosition(loggedEndPosition);
-
- getSource().getProperties().put("path",
- ESBModelUtil.getPath(m_service));
- }
- }
-
- // Get jms listener
- org.w3c.dom.NodeList nl=m_service.getElementsByTagName(DefaultESBService.JMS_LISTENER_ELEMENT);
-
- if (nl.getLength() > 0 && nl.item(0) instanceof org.w3c.dom.Element) {
- m_jmsListenerElem = (org.w3c.dom.Element)nl.item(0);
- }
- }
-
- /**
- * This method initializes the links.
- */
- public void initializeLinks() {
-
- // Work through actions requesting them to
- // establish their links
- for (int i=0; i < m_actions.size(); i++) {
- m_actions.get(i).initializeLinks();
- }
- }
-
- /**
- * This method validates the ESB service and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l) {
-
- // Check that the service specifies a session
- if (isSessionBased() && getSessionClass() == null) {
-
- // Find first conversation based action to use as
- // focus - if not found then use the service itself
- ESBAction focus=getFirstSessionBasedAction();
- ModelObject src=this;
-
- if (focus instanceof ModelObject) {
- src = (ModelObject)focus;
- }
-
- l.error(new ModelIssue(src, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_SPECIFIED_SESSION_CLASS",
- new String[]{})));
- }
-
- for (int i=0; i < m_actions.size(); i++) {
- m_actions.get(i).validate(l);
- }
- }
-
- /**
- * This method returns the ESB model.
- *
- * @return The ESB model
- */
- public ESBLanguageModel getModel() {
- return(m_model);
- }
-
- /**
- * This method returns the category associated with the service
- * descriptor.
- *
- * @return The service category
- */
- public String getCategory() {
- return(m_service.getAttribute(CATEGORY_ATTR));
- }
-
- /**
- * This method returns the name associated with the service
- * descriptor.
- *
- * @return The service name
- */
- public String getName() {
- return(m_service.getAttribute(NAME_ATTR));
- }
-
- /**
- * This method returns the XML configuration representation of the service.
- *
- * @return The XML configuration for the service
- */
- public org.w3c.dom.Element getService() {
- return(m_service);
- }
-
- /**
- * This method returns the list of ESB actions.
- *
- * @return The ESB actions
- */
- public java.util.List<ESBAction> getActions() {
- return(m_actions);
- }
-
- /**
- * This method adds an action to the service.
- *
- * @param action The action to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addAction(ESBAction action, int pos) {
- // If position specified, then find element at
- // the position and insert after the previous
- // element
-
- if (action.getAction() != null) {
-
- if (pos == -1 || pos >= m_actions.size()) {
- m_actionsElem.appendChild(action.getAction());
- m_actions.add(action);
- } else {
- org.w3c.dom.NodeList nl=m_actionsElem.getChildNodes();
- org.w3c.dom.Element elem=null;
- int cur=-1;
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(ACTION_ELEMENT)) {
- cur++;
-
- if (cur == pos) {
- elem = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (elem != null) {
- m_actionsElem.insertBefore(action.getAction(), elem);
- } else {
- m_actionsElem.appendChild(action.getAction());
- }
-
- m_actions.add(pos, action);
- }
- }
- }
-
- /**
- * This method removes an action from the service.
- *
- * @param action The action to be removed
- * @return Whether the action was removed
- */
- public boolean removeAction(ESBAction action) {
- return(false);
- }
-
- protected java.lang.annotation.Annotation getServiceAnnotation(String session) {
- java.lang.annotation.Annotation ret=null;
-
- try {
- ClassLoader cl=
- org.jboss.tools.overlord.cdl.jbossesb.model.util.ClasspathUtil.getClassLoader(getModel());
-
- Class<?> cls=Class.forName(session, true, cl);
-
- // TODO: This should be replaced by direct lookup
- // of Service annotation - but library not available
- // at the moment
- java.lang.annotation.Annotation[] annotations=
- cls.getAnnotations();
- for (int i=0; ret == null &&
- i < annotations.length; i++) {
- try {
- if (annotations[i].annotationType().getName().equals(
- SERVICE_ANNOTATION)) {
- ret = annotations[i];
- }
- } catch(Throwable ex) {
- logger.log(java.util.logging.Level.SEVERE,
- "ANNOTATION: "+
- annotations[i].annotationType(), ex);
- }
- }
-
- } catch(Throwable e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get session class '"+session+"'", e);
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the ESB service represents a
- * loop construct.
- *
- * @return Whether the service represents a loop
- */
- public boolean isLoop() {
- boolean ret=false;
- ESBAction action=getFirstSessionBasedAction();
-
- if (action != null) {
- ret = action.isLoop();
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the ESB service descriptor represents
- * a 'root' conversation.
- *
- * @return Whether the ESB service is associated with a root conversation
- */
- public boolean isRoot() {
- boolean ret=false;
- ESBAction action=getFirstSessionBasedAction();
-
- if (action != null) {
- if (action.isCreateSession()) {
- String bool=action.getPropertyValue(ROOT_PROPERTY);
- if (bool != null) {
- ret = bool.equalsIgnoreCase("true");
- } else {
- String session=action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
-
- java.lang.annotation.Annotation annotation=
- getServiceAnnotation(session);
-
- if (annotation != null) {
- try {
- java.lang.reflect.Method method=
- annotation.getClass().getMethod(ROOT_PROPERTY,
- (Class<?>[])null);
-
- Object val=method.invoke(annotation, (Object[])null);
-
- if (val instanceof Boolean) {
- ret = ((Boolean)val).booleanValue();
- }
- } catch(Throwable t) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get 'root' annotation value", t);
- }
- }
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the ESB service descriptor
- * starts with a CreateSessionAction.
- *
- * @return Whether the service has a CreateSessionAction
- */
- public boolean isCreateSession() {
- boolean ret=false;
- ESBAction action=getFirstSessionBasedAction();
-
- if (action != null) {
- ret = action.isCreateSession();
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the service is a gateway
- * for inbound requests.
- *
- * @return Whether the service is a gateway
- */
- public boolean isGateway() {
- boolean ret=false;
-
- for (int i=0; ret == false && i < m_actions.size(); i++) {
- ret = m_actions.get(i).isGateway();
- }
-
- return(ret);
- }
-
- /**
- * This method returns the gateway action if this is a
- * gateway service.
- *
- * @return The gateway action
- */
- public ESBAction getGatewayAction() {
- ESBAction ret=null;
-
- for (int i=0; ret == null && i < m_actions.size(); i++) {
- if (m_actions.get(i).isGateway()) {
- ret = m_actions.get(i);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the first session based action in the
- * service descriptor.
- *
- * @return The first session based action, or null if none exist
- */
- public ESBAction getFirstSessionBasedAction() {
- ESBAction ret=null;
-
- for (int i=0; ret == null && i < m_actions.size(); i++) {
- ret=m_actions.get(i);
-
- if (ret.isSessionBased() == false) {
- ret = null;
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the service description name associated with the
- * ESB service.
- *
- * @return The service description name
- */
- public String getServiceDescriptionName() {
- String ret=null;
- ESBAction action=getFirstSessionBasedAction();
-
- if (action != null) {
- if (action.isCreateSession() || (action.getActionClass() != null &&
- action.getActionClass().equals(RETRIEVE_SESSION_ACTION_CLASS))) {
- ret = action.getPropertyValue(SERVICE_DESCRIPTION_NAME_PROPERTY);
-
- if (ret == null) {
- String session=action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
-
- java.lang.annotation.Annotation annotation=
- getServiceAnnotation(session);
-
- if (annotation != null) {
- try {
- java.lang.reflect.Method method=
- annotation.getClass().getMethod(NAME_ATTR, (Class<?>[])null);
-
- Object val=method.invoke(annotation, (Object[])null);
-
- if (val instanceof String) {
- ret = (String)val;
- }
- } catch(Throwable t) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get 'name' annotation value", t);
- }
- }
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the conversation type associated with the
- * ESB service.
- *
- * @return The conversation type
- */
- public String getConversationType() {
- String ret=null;
- ESBAction action=getFirstSessionBasedAction();
-
- if (action != null) {
- if (action.isCreateSession()) {
- ret = action.getPropertyValue(CONVERSATION_TYPE_PROPERTY);
-
- if (ret == null) {
- String session=action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
-
- java.lang.annotation.Annotation annotation=
- getServiceAnnotation(session);
-
- if (annotation != null) {
- try {
- java.lang.reflect.Method method=
- annotation.getClass().getMethod(CONVERSATION_TYPE_PROPERTY,
- (Class<?>[])null);
-
- Object val=method.invoke(annotation, (Object[])null);
-
- if (val instanceof String) {
- ret = (String)val;
- }
- } catch(Throwable t) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get 'name' annotation value", t);
- }
- }
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the session name associated with the service
- * descriptor.
- *
- * @return The session name
- */
- public String getSessionName() {
- String ret=null;
- ESBAction action=getFirstSessionBasedAction();
-
- if (action != null) {
- ret = action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the session class associated with the service
- * descriptor.
- *
- * @return The session class
- */
- public Class<?> getSessionClass() {
- Class<?> ret=null;
- String session=getSessionName();
-
- if (session != null) {
- try {
- ClassLoader cl=
- org.jboss.tools.overlord.cdl.jbossesb.model.util.ClasspathUtil.getClassLoader(getModel());
-
- ret = Class.forName(session, true, cl);
-
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get session class '"+session+"'", e);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the service is related to a behavioural
- * session.
- *
- * @return Whether the service is session based
- */
- public boolean isSessionBased() {
- boolean ret=false;
-
- for (int i=0; ret == false && i < m_actions.size(); i++) {
- ret = m_actions.get(i).isSessionBased();
- }
-
- return(ret);
- }
-
- /**
- * This method converts the ESB service into a Conversation, if
- * the service represents a conversation.
- *
- * @param context The conversion context, or null if this is the
- * root conversation
- * @return The conversation
- */
- public Conversation convert(ConversionContext context) {
- Conversation ret=null;
-
- if (isCreateSession()) {
- ret = new Conversation();
-
- ret.derivedFrom(this);
-
- ModelName modelName=new ModelName();
- modelName.setName(getServiceDescriptionName());
-
- ret.setModelName(modelName);
-
- 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(ConversationModel.CONVERSATION);
-
- role = convType.substring(index+1);
-
- iref.setLocatedRole(role);
-
- // Need to locate the model name
- modelName.setLocatedRole(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);
- //ret.getConformsTo().add(iref);
-
- org.scribble.model.DependencyManager dm=
- (org.scribble.model.DependencyManager)
- org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
- org.scribble.model.DependencyManager.class, null);
-
- if (dm != null) {
- dm.recordDependency(getModel().getModelReference(),
- iref, DependencyType.Implements);
- }
-
- } else {
- logger.warning("Conversation type does not " +
- "contain '@' located role separator");
- }
- } else {
- logger.warning("No conversation type specified");
- }
-
- ret.setBlock(new Block());
-
- context = new DefaultConversionContext(role);
-
- context.processing(this);
-
- for (int i=0; i < m_actions.size(); i++) {
- ((ESBAction)m_actions.get(i)).convert(
- ret.getBlock().getContents(), context);
- }
-
- context.processed(this);
- }
-
- return(ret);
- }
-
- /**
- * This method converts the actions associated with the ESB service into
- * activities that can be checked for conformance against a conversation
- * type.
- *
- * @param activities The target list of activities associated with the
- * ESB actions being converted
- * @param context The conversion context
- */
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- context.processing(this);
-
- for (int i=0; i < m_actions.size(); i++) {
- ((ESBAction)m_actions.get(i)).convert(
- activities, context);
- }
-
- context.processed(this);
- }
-
- /**
- * This method returns the position of the service node within the
- * ESB configuration.
- *
- * @return The service node position
- */
- public int getServicePosition() {
- org.w3c.dom.Node services=m_service.getParentNode();
- int servCount=0;
- boolean f_end=false;
-
- for (int i=0; f_end == false &&
- i < services.getChildNodes().getLength(); i++) {
- org.w3c.dom.Node serv=services.getChildNodes().item(i);
-
- if (serv.getNodeName().equals(SERVICE_ELEMENT)) {
- servCount++;
- if (serv == m_service) {
- f_end = true;
- }
- }
- }
-
- return(servCount);
- }
-
- /**
- * This method returns the JMS Bus Id Ref associated with the
- * service's JMS listener.
- *
- * @return The JMS Bus Id Ref
- */
- public String getJMSBusIdRef() {
- String ret=null;
-
- if (m_jmsListenerElem != null) {
- ret = m_jmsListenerElem.getAttribute(BUSIDREF_ATTR);
- }
-
- return(ret);
- }
-
- /**
- * This method sets the JMS Bus Id Ref associated with the
- * service's JMS listener.
- *
- * @param busId The JMS Bus Id Ref
- */
- public void setJMSBusIdRef(String busId) {
- if (m_jmsListenerElem == null) {
- m_jmsListenerElem = m_service.getOwnerDocument().createElement(JMS_LISTENER_ELEMENT);
-
- org.w3c.dom.NodeList nl=m_service.getElementsByTagName(LISTENERS_ELEMENT);
- org.w3c.dom.Element listeners=null;
-
- if (nl.getLength() > 0) {
- listeners = (org.w3c.dom.Element)nl.item(0);
- } else {
- listeners = m_service.getOwnerDocument().createElement(LISTENERS_ELEMENT);
-
- if (m_service.getFirstChild() != null) {
- m_service.insertBefore(listeners,
- m_service.getFirstChild());
- } else {
- m_service.appendChild(listeners);
- }
- }
-
- if (listeners != null) {
- listeners.appendChild(m_jmsListenerElem);
- }
- }
-
- if (m_jmsListenerElem != null) {
- m_jmsListenerElem.setAttribute(BUSIDREF_ATTR,
- busId);
-
- if (m_jmsListenerElem.hasAttribute(NAME_ATTR) == false) {
- m_jmsListenerElem.setAttribute(NAME_ATTR,
- getCategory()+"-"+getName());
- }
-
- if (m_jmsListenerElem.hasAttribute(MAX_THREADS_ATTR) == false) {
- m_jmsListenerElem.setAttribute(MAX_THREADS_ATTR, "1");
- }
- }
- }
-
- public int hashCode() {
- return(m_service.hashCode());
- }
-
- public boolean equals(Object obj) {
- boolean ret=false;
-
- if (obj instanceof DefaultESBService) {
- DefaultESBService other=(DefaultESBService)obj;
-
- if (m_service == other.m_service) {
- ret = true;
- }
- }
-
- return(ret);
- }
-
- public String toString() {
- return("ESBService: "+getCategory()+"/"+getName()+"["+getSource()+"]");
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model");
-
- private ESBLanguageModel m_model=null;
- private org.w3c.dom.Element m_service=null;
- private org.w3c.dom.Element m_jmsListenerElem=null;
- private org.w3c.dom.Element m_actionsElem=null;
- private java.util.List<ESBAction> m_actions=new java.util.Vector<ESBAction>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,134 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import org.scribble.model.*;
-
-/**
- * This interface represents the generic ESB action class.
- *
- * @author gary
- */
-public interface ESBAction {
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- public void initializeLinks();
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l);
-
- /**
- * This method determines if the action represents a loop construct.
- *
- * @return Whether the action represents a loop construct
- */
- public boolean isLoop();
-
- /**
- * This method determines whether the action is related to a behavioural
- * session.
- *
- * @return Whether the action is session based
- */
- public boolean isSessionBased();
-
- /**
- * This method determines whether the ESB action represents
- * a CreateSessionAction.
- *
- * @return Whether the action is a CreateSessionAction
- */
- public boolean isCreateSession();
-
- /**
- * This method determines whether the action is a gateway
- * for inbound requests.
- *
- * @return Whether the action is a gateway
- */
- public boolean isGateway();
-
- /**
- * This method indicates whether this action performs another
- * sub-conversation.
- *
- * @return Whether the action is a 'perform'
- */
- public boolean isPerform();
-
- /**
- * This method indicates whether the action is an initiator.
- * Initiator actions must precede any other session based
- * action, within an ESB service.
- *
- * @return Whether the action is an initiator
- */
- public boolean isInitiator();
-
- /**
- * This method returns the action's class name.
- *
- * @return The action's class name
- */
- public String getActionClass();
-
- /**
- * This method returns the property value associated
- * with the supplied name.
- *
- * @param property The property name
- * @return The property value, or null if not found
- */
- public String getPropertyValue(String property);
-
- /**
- * This method determines the property value, associated
- * with the supplied name, is defined.
- *
- * @param property The property name
- * @return Whether the property has been defined
- */
- public boolean hasProperty(String property);
-
- /**
- * This method returns the XML configuration representation of the action.
- *
- * @return The XML configuration for the action
- */
- public org.w3c.dom.Element getAction();
-
- /**
- * This method converts the ESB action 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: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBActionFactory.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBActionFactory.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBActionFactory.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.UnsupportedAction;
-
-/**
- * This class provides a factory for ESBAction instances.
- *
- * @author gary
- */
-public class ESBActionFactory {
-
- public static final String MODEL_ACTION_PACKAGE =
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions";
- public static final String CLASS_ATTR = "class";
- public static final String CONVERSATION_ACTION_PACKAGE =
- "org.jboss.soa.overlord.jbossesb.actions";
-
- /**
- * This method creates an ESBAction instance relevant to the
- * supplied JBossESB action, associated with the supplied
- * service.
- *
- * @param service The service
- * @param action The XML configuration of the action
- * @return The ESBAction instance
- */
- public static ESBAction createAction(ESBService service,
- org.w3c.dom.Element action) {
- ESBAction ret=null;
- String actionType=action.getAttribute(CLASS_ATTR);
-
- // Check that it is a conversation based ESB action
- if (actionType.startsWith(CONVERSATION_ACTION_PACKAGE)) {
- int index=actionType.lastIndexOf('.');
- if (index != -1) {
- String actionName=actionType.substring(index+1);
-
- try {
- Class<?> cls=(Class<?>)
- Class.forName(MODEL_ACTION_PACKAGE+"."+actionName);
-
- java.lang.reflect.Constructor<?> con=
- cls.getConstructor(new Class<?>[]{ESBService.class,
- org.w3c.dom.Element.class});
-
- ret = (ESBAction)con.newInstance(new Object[]{service, action});
-
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Unable to find action class '"+
- MODEL_ACTION_PACKAGE+"."+actionName+"'", e);
- }
- }
- }
-
- if (ret == null) {
- // Unrecognised or unsupported action
- ret = new UnsupportedAction(service, action);
- }
-
- return(ret);
- }
-
- /**
- * This method determines the runtime action class based on
- * the ESB model action class.
- *
- * @param cls The ESB model action class
- * @return The conversation action class
- */
- public static String getConversationAction(Class<?> cls) {
- String actionType=cls.getName();
- String ret=null;
-
- // Check that it is a conversation based ESB action
- if (actionType.startsWith(MODEL_ACTION_PACKAGE)) {
- int index=actionType.lastIndexOf('.');
- if (index != -1) {
- String actionName=actionType.substring(index+1);
-
- ret = CONVERSATION_ACTION_PACKAGE+"."+actionName;
- }
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLanguageModel.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLanguageModel.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLanguageModel.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import org.scribble.model.*;
-
-/**
- * This class represents an ESB model.
- *
- * @author gary
- */
-public interface ESBLanguageModel {
-
- public static final String JBOSSESB_NOTATION = "jboss-esb.xml";
-
- /**
- * 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 method returns the ESB service for the supplied
- * category and name.
- *
- * @param category The service category
- * @param name The service name
- * @return The ESB service, or null if not found
- */
- public ESBService getService(String category, String name);
-
- /**
- * This method returns the collection of ESB services associated
- * with the model.
- *
- * @return The collection of ESB services
- */
- public java.util.Collection<ESBService> getServices();
-
- /**
- * This textual contents of the model.
- *
- * @return The textual contents
- */
- public String getOriginalContents();
-
- /**
- * This method returns the gateway service.
- *
- * @return The gateway service, or null if not found
- */
- public ESBService getGatewayService();
-
- /**
- * This method creates a new ESB service.
- *
- * @param category The category
- * @param name The name
- * @return The new ESB service
- */
- public ESBService createService(String category, String name);
-
- /**
- * This method adds a new service to the model.
- *
- * @param service The service
- */
- public void addService(ESBService service);
-
- /**
- * This method removes a service from the model.
- *
- * @param service The service
- */
- public void removeService(ESBService service);
-
- /**
- * This method returns a unique service name within
- * the supplied category.
- *
- * @param category The category
- * @param currentServiceName The name of the service creating
- * the new service
- * @return The unique service name
- */
- public String getUniqueServiceName(String category,
- String currentServiceName);
-
- /**
- * This method returns the reference to the DOM
- * representation of the ESB configuration.
- *
- * @return The ESB configuration
- */
- public org.w3c.dom.Element getESBConfiguration();
-
- /**
- * This method returns the JMS destination associated with
- * the supplied JMS Bus Id.
- *
- * @param jmsBusId The JMS bus id
- * @return The JMS definition, or null if not found
- */
- public String getJMSDefinition(String jmsBusId);
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLink.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLink.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLink.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-/**
- * This class represents the link from a ESB action to a service
- * descriptor.
- *
- * @author gary
- */
-public class ESBLink {
-
- /**
- * This is the constructor for the link.
- *
- * @param category The service category of the target service descriptor
- * @param name The service name of the target descriptor
- * @param service A reference to the service model containing the action
- * that links to the service descriptor
- * @param control Whether the link is a control link, if not then it
- * represents a message link (i.e. to another service)
- */
- public ESBLink(String category, String name,
- ESBService service, boolean control) {
- this(category, name, service, control, false);
- }
-
- /**
- * This is the constructor for the link.
- *
- * @param category The service category of the target service descriptor
- * @param name The service name of the target descriptor
- * @param service A reference to the service model containing the action
- * that links to the service descriptor
- * @param control Whether the link is a control link, if not then it
- * represents a message link (i.e. to another service)
- * @param remote Whether the link is to a remote service
- */
- public ESBLink(String category, String name,
- ESBService service, boolean control, boolean remote) {
- m_category = category;
- m_name = name;
- m_service = service;
- m_control = control;
- m_remote = remote;
- }
-
- /**
- * This method indicates whether this is a control
- * link, as opposed to a message link.
- *
- * @return Whether the link is a control link
- */
- public boolean isControl() {
- return(m_control);
- }
-
- /**
- * This method indicates whether this is a
- * link to a remote service.
- *
- * @return Whether the link is to a remote service
- */
- public boolean isRemote() {
- return(m_remote);
- }
-
- /**
- * This method returns the service category.
- *
- * @return The service category
- */
- public String getCategory() {
- return(m_category);
- }
-
- /**
- * This method returns the service name.
- *
- * @return The service name
- */
- public String getName() {
- return(m_name);
- }
-
- /**
- * This method returns the reference to ESB Service
- * model containing the action that links to the
- * target service descriptor.
- *
- * @return The ESB service
- */
- public ESBService getService() {
- return(m_service);
- }
-
- private String m_category=null;
- private String m_name=null;
- private ESBService m_service=null;
- private boolean m_control=false;
- private boolean m_remote=false;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBService.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBService.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,230 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import org.scribble.conversation.model.Conversation;
-import org.scribble.model.*;
-
-/**
- * This interface represents an ESB service.
- *
- * @author gary
- */
-public interface ESBService {
-
- /**
- * This method initializes the links.
- */
- public void initializeLinks();
-
- /**
- * This method validates the ESB service and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l);
-
- /**
- * This method returns the category associated with the service
- * descriptor.
- *
- * @return The service category
- */
- public String getCategory();
-
- /**
- * This method returns the name associated with the service
- * descriptor.
- *
- * @return The service name
- */
- public String getName();
-
- /**
- * This method returns the ESB model.
- *
- * @return The ESB model
- */
- public ESBLanguageModel getModel();
-
- /**
- * This method returns the XML configuration representation of the service.
- *
- * @return The XML configuration for the service
- */
- public org.w3c.dom.Element getService();
-
- /**
- * This method returns the list of ESB actions.
- *
- * @return The ESB actions
- */
- public java.util.List<ESBAction> getActions();
-
- /**
- * This method adds an action to the service.
- *
- * @param action The action to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addAction(ESBAction action, int pos);
-
- /**
- * This method removes an action from the service.
- *
- * @param action The action to be removed
- * @return Whether the action was removed
- */
- public boolean removeAction(ESBAction action);
-
- /**
- * This method determines whether the ESB service represents a
- * loop construct.
- *
- * @return Whether the service represents a loop
- */
- public boolean isLoop();
-
- /**
- * This method determines whether the ESB service descriptor represents
- * a 'root' conversation.
- *
- * @return Whether the ESB service is associated with a root conversation
- */
- public boolean isRoot();
-
- /**
- * This method determines whether the ESB service descriptor
- * starts with a CreateSessionAction.
- *
- * @return Whether the service has a CreateSessionAction
- */
- public boolean isCreateSession();
-
- /**
- * This method determines whether the service is a gateway
- * for inbound requests.
- *
- * @return Whether the service is a gateway
- */
- public boolean isGateway();
-
- /**
- * This method returns the gateway action if this is a
- * gateway service.
- *
- * @return The gateway action
- */
- public ESBAction getGatewayAction();
-
- /**
- * This method returns the service description name associated with the
- * ESB service.
- *
- * @return The service description name
- */
- public String getServiceDescriptionName();
-
- /**
- * This method returns the conversation type associated with the
- * ESB service.
- *
- * @return The conversation type
- */
- public String getConversationType();
-
- /**
- * This method returns the session name associated with the service
- * descriptor.
- *
- * @return The session name
- */
- public String getSessionName();
-
- /**
- * This method returns the session class associated with the service
- * descriptor.
- *
- * @return The session class
- */
- public Class<?> getSessionClass();
-
- /**
- * This method determines whether the service is related to a behavioural
- * session.
- *
- * @return Whether the service is session based
- */
- public boolean isSessionBased();
-
- /**
- * This method returns the first session based action in the
- * service descriptor.
- *
- * @return The first session based action, or null if none exist
- */
- public ESBAction getFirstSessionBasedAction();
-
- /**
- * This method converts the actions associated with the ESB service into
- * activities that can be checked for conformance against a conversation
- * type.
- *
- * @param activities The target list of activities associated with the
- * ESB actions being converted
- * @param context The conversion context
- */
- public void convert(java.util.List<Activity> activities,
- ConversionContext context);
-
- /**
- * This method converts the ESB service into a Conversation, if
- * the service represents a conversation.
- *
- * @param context The conversion context, or null if this is the
- * root conversation
- * @return The conversation
- */
- public Conversation convert(ConversionContext context);
-
- /**
- * This method returns the position of the service node within the
- * ESB configuration.
- *
- * @return The service node position
- */
- public int getServicePosition();
-
- /**
- * This method returns the JMS Bus Id Ref associated with the
- * service's JMS listener.
- *
- * @return The JMS Bus Id Ref
- */
- public String getJMSBusIdRef();
-
- /**
- * This method sets the JMS Bus Id Ref associated with the
- * service's JMS listener.
- *
- * @param busId The JMS Bus Id Ref
- */
- public void setJMSBusIdRef(String busId);
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/Messages.properties
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/Messages.properties 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/Messages.properties 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,21 +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.
-# */
-
-_NOT_FOUND_BUSINESS_OBJECT_TYPE=Business object type '{0}' could not be found
-_NOT_FOUND_SERVICE_DESCRIPTOR=Service descriptor for category '{0}' and name '{1}' not found
-_NOT_SPECIFIED_SESSION_CLASS=First conversation action must specify a valid session class
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,624 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import java.util.logging.Logger;
-
-import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ESBModelUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ProblemDefinitions;
-
-/**
- * This is the generic ESB action class.
- *
- * @author gary
- */
-public abstract class AbstractESBAction extends ModelObject
- implements ESBAction {
-
- public static final String IDENTITIES = "identities";
- public static final String ACTION_ELEMENT = "action";
- public static final String VALUE_ATTR = "value";
- public static final String NAME_ATTR = "name";
- public static final String PROPERTY_ELEMENT = "property";
- public static final String CLASS_PROPERTY = "class";
-
- /**
- * The constructor for initializing the action based on
- * an existing DOM element.
- */
- protected AbstractESBAction(ESBService service,
- org.w3c.dom.Element action) {
- initExistingAction(service, action);
- }
-
- /**
- * The contructor for initializing a new action.
- */
- protected AbstractESBAction(ESBService service,
- String actionClass) {
- initNewAction(service, actionClass);
- }
-
- /**
- * This method initializes the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param actionClass The action class
- */
- protected void initNewAction(ESBService service,
- String actionClass) {
- m_service = service;
-
- m_action = service.getService().
- getOwnerDocument().createElement(ACTION_ELEMENT);
-
- m_action.setAttribute(CLASS_PROPERTY, actionClass);
-
- getSource().setObject(this);
- }
-
- /**
- * This method initializes the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- protected void initExistingAction(ESBService service,
- org.w3c.dom.Element action) {
- m_service = service;
- m_action = action;
-
- int servicesStartPos=-1;
-
- if (m_service.getModel() != null &&
- m_service.getModel().getOriginalContents() != null &&
- (servicesStartPos=m_service.getModel().
- getOriginalContents().indexOf("<services>")) != -1) {
-
- // Find positional information
- int servCount=m_service.getServicePosition();
- int actionCount=getActionPosition();
-
- String str=m_service.getModel().getOriginalContents();
-
- int startPosition=str.indexOf("<service", servicesStartPos+2);
- int endPosition=-1;
- int loggedEndPosition=-1;
-
- while (startPosition != -1 && servCount > 0) {
- servCount--;
-
- endPosition = str.indexOf("</service>", startPosition);
-
- if (servCount > 0) {
- startPosition=str.indexOf("<service", endPosition);
- }
- }
-
- int actionsStartPos=-1;
-
- if (actionCount > 0 &&
- startPosition != -1 && endPosition != -1 &&
- (actionsStartPos=str.indexOf("<actions",
- startPosition)) != -1 &&
- actionsStartPos < endPosition) {
- startPosition=str.indexOf("<action", actionsStartPos+2);
- endPosition=-1;
-
- while (startPosition != -1 && actionCount > 0) {
- actionCount--;
-
- loggedEndPosition = str.indexOf('>', startPosition);
-
- endPosition = str.indexOf("</action>", startPosition);
-
- if (actionCount > 0) {
- startPosition=str.indexOf("<action", endPosition);
- }
- }
-
- // Check whether single line element
- int inlineEndPos=str.indexOf("/>", startPosition);
- int nextStartPos=str.indexOf("<", startPosition+1);
-
- if (inlineEndPos != -1 && inlineEndPos < nextStartPos) {
- endPosition = inlineEndPos;
- }
- }
-
- getSource().setStartPosition(startPosition);
- getSource().setEndPosition(loggedEndPosition);
-
- getSource().getProperties().put("path",
- ESBModelUtil.getPath(m_action));
-
- getSource().setObject(this);
- }
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- public void initializeLinks() {
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l) {
-
- java.util.List<String> mandatory=getMandatoryProperties();
-
- for (int i=0; i < mandatory.size(); i++) {
- if (getPropertyValue(mandatory.get(i)) == null) {
- java.util.Map<String,Object> props=new java.util.HashMap<String,Object>();
- props.put(ProblemDefinitions.PROBLEM_PROPERTY,
- mandatory.get(i));
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{mandatory.get(i)}), props));
- }
- }
-
- java.util.List<String> propNames=getPropertyNames();
-
- for (int i=0; i < propNames.size(); i++) {
- String propName=propNames.get(i);
-
- if (getOptionalProperties().contains(propName) == false &&
- getMandatoryProperties().contains(propName) == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_UNKNOWN_PROPERTY",
- new String[]{propName})));
- }
- }
-
- String session=getPropertyValue(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
-
- if (session != null) {
- // Validate that the business object type exists
- try {
- ClassLoader cl=
- org.jboss.tools.overlord.cdl.jbossesb.model.util.ClasspathUtil.getClassLoader(getService().getModel());
-
- try {
- Class.forName(session, true, cl);
- } catch(ClassNotFoundException cfne) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_BUSINESS_OBJECT_TYPE",
- new String[]{session})));
- }
-
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to load business class '"+session+"'", e);
- }
- }
-
- // Validate links
- for (int i=0; i < m_links.size(); i++) {
- ESBLink link=(ESBLink)m_links.get(i);
-
- if (link.getService() == null) {
- // If target service not found, then report error
- // unless it is a remote service, so defined in a
- // different file
- if (link.isRemote() == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{link.getCategory(),link.getName()})));
- }
- } else if (getService().getSessionName() != null &&
- isPerform() == false && link.isRemote() == false &&
- link.getService().getSessionName() != null &&
- getService().getSessionName().equals(
- link.getService().getSessionName()) == false) {
-
- java.util.Map<String,Object> props=new java.util.HashMap<String,Object>();
- props.put(ProblemDefinitions.PROBLEM_PROPERTY,
- DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
-
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MISMATCH_SESSION_CLASS",
- new String[]{link.getCategory(),link.getName()}), props));
- }
- }
- }
-
- /**
- * This method determines if the action represents a loop construct.
- *
- * @return Whether the action represents a loop construct
- */
- public boolean isLoop() {
- return(false);
- }
-
- /**
- * This method determines whether the action is related to a behavioural
- * session.
- *
- * @return Whether the action is session based
- */
- public boolean isSessionBased() {
- return(true);
- }
-
- /**
- * This method determines whether the ESB action represents
- * a CreateSessionAction.
- *
- * @return Whether the action is a CreateSessionAction
- */
- public boolean isCreateSession() {
- return(false);
- }
-
- /**
- * This method determines whether the action is a gateway
- * for inbound requests.
- *
- * @return Whether the action is a gateway
- */
- public boolean isGateway() {
- return(false);
- }
-
- /**
- * This method indicates whether this action performs another
- * sub-conversation.
- *
- * @return Whether the action is a 'perform'
- */
- public boolean isPerform() {
- return(false);
- }
-
- /**
- * This method indicates whether the action is an initiator.
- * Initiator actions must precede any other session based
- * action, within an ESB service.
- *
- * @return Whether the action is an initiator
- */
- public boolean isInitiator() {
- return(false);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=new java.util.Vector<String>();
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=new java.util.Vector<String>();
- ret.add(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
- ret.add(IDENTITIES);
- ret.add(DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY);
- return(ret);
- }
-
- /**
- * This method returns the action's class name.
- *
- * @return The action's class name
- */
- public String getActionClass() {
- String ret=null;
-
- if (m_action != null) {
- ret = m_action.getAttribute(CLASS_PROPERTY);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the property value associated
- * with the supplied name.
- *
- * @param property The property name
- * @return The property value, or null if not found
- */
- public String getPropertyValue(String property) {
- String ret=null;
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
- equals(property)) {
- ret = ((org.w3c.dom.Element)nl.item(i)).getAttribute(VALUE_ATTR);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines the property value, associated
- * with the supplied name, is defined.
- *
- * @param property The property name
- * @return Whether the property has been defined
- */
- public boolean hasProperty(String property) {
- boolean ret=false;
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; ret == false && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
- equals(property)) {
- ret = true;
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the element associated with the
- * requested property. If the property does not exist, then
- * it will be created.
- *
- * @param property The property
- * @return The element
- */
- public org.w3c.dom.Element getPropertyElement(String property) {
- org.w3c.dom.Element ret=null;
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(property)) {
- ret = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (ret == null) {
- ret = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- ret.setAttribute(NAME_ATTR, property);
-
- m_action.appendChild(ret);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method removes the named property from the action.
- *
- * @param property The property name
- */
- public void removePropertyElement(String property) {
-
- if (m_action != null) {
- org.w3c.dom.Node prop=null;
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- for (int i=0; prop == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(property)) {
- prop = nl.item(i);
- }
- }
- }
-
- if (prop != null) {
- m_action.removeChild(prop);
- }
- }
- }
-
- /**
- * This method returns the list of property names defined for
- * this action.
- *
- * @return The list of property names
- */
- public java.util.List<String> getPropertyNames() {
- java.util.List<String> ret=new java.util.Vector<String>();
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT)) {
- ret.add(((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR));
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the 'property' child nodes, associated with the
- * supplied property name, within the action configuration.
- *
- * @param property The property name
- * @return The list of child nodes
- */
- public org.w3c.dom.NodeList getPropertyChildNodes(String property) {
- org.w3c.dom.NodeList ret=null;
-
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
- equals(property)) {
- ret = ((org.w3c.dom.Element)nl.item(i)).getChildNodes();
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the reference to the service that contains the
- * action.
- *
- * @return The service
- */
- public ESBService getService() {
- return(m_service);
- }
-
- /**
- * This method sets the service description name property.
- *
- * @param name The service description name
- */
- public void setServiceDescriptionName(String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(
- DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- /**
- * This method sets the business object type property.
- *
- * @param name The business object type
- */
- public void setBusinessObjectType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(
- DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-
- /**
- * This method returns the XML configuration representation of the action.
- *
- * @return The XML configuration for the action
- */
- public org.w3c.dom.Element getAction() {
- return(m_action);
- }
-
- /**
- * This method returns the list of links established by this action.
- *
- * @return The list of links
- */
- protected java.util.List<ESBLink> getLinks() {
- return(m_links);
- }
-
- /**
- * This method converts the ESB action 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 node position of the action configuration
- * within the service descriptor.
- *
- * @return The action position
- */
- protected int getActionPosition() {
- org.w3c.dom.Element service=(org.w3c.dom.Element)
- getAction().getParentNode().getParentNode();
-
- int actionCount=0;
- boolean f_end=false;
-
- org.w3c.dom.NodeList acts=service.getElementsByTagName(ACTION_ELEMENT);
-
- for (int i=0; f_end == false &&
- i < acts.getLength(); i++) {
- org.w3c.dom.Node act=acts.item(i);
-
- actionCount++;
- if (act == getAction()) {
- f_end = true;
- }
- }
-
- return(actionCount);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model");
-
- private ESBService m_service=null;
- private org.w3c.dom.Element m_action=null;
- private java.util.List<ESBLink> m_links=new java.util.Vector<ESBLink>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-
-/**
- * The abstract model component for the 'ReceiveMessageAction'
- * and 'SendMessageAction'.
- *
- * @author gary
- */
-public abstract class AbstractInteractionMessageAction extends AbstractESBAction {
-
- public static final String IDENTITIES = "identities";
- public static final String MESSAGE_TYPE = "messageType";
- public static final String OPERATION = "operation";
- public static final String CLIENT_EPR = "clientEPR";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public AbstractInteractionMessageAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * The contructor for initializing a new action.
- */
- protected AbstractInteractionMessageAction(ESBService service,
- String actionClass) {
- super(service, actionClass);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(MESSAGE_TYPE);
- ret.add(IDENTITIES);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(OPERATION);
- ret.add(CLIENT_EPR);
- return(ret);
- }
-
- /**
- * This method sets the operation property.
- *
- * @param operation The operation
- */
- public void setOperation(String operation) {
-
- if (operation != null) {
- org.w3c.dom.Element prop=getPropertyElement(OPERATION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, operation);
- }
- } else {
- removePropertyElement(OPERATION);
- }
- }
-
- /**
- * This method sets the message type.
- *
- * @param type The message type
- */
- public void setMessageType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(MESSAGE_TYPE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-
- /**
- * This method returns the message type.
- *
- * @return The message type
- */
- public String getMessageType() {
- String ret=null;
-
- org.w3c.dom.Element prop=getPropertyElement(MESSAGE_TYPE);
-
- if (prop != null && prop.hasAttribute(VALUE_ATTR)) {
- ret = prop.getAttribute(VALUE_ATTR);
- }
-
- return(ret);
- }
-
- /**
- * This method sets the client's EPR label property.
- *
- * @param epr The client EPR label
- */
- public void setClientEPR(String epr) {
-
- org.w3c.dom.Element prop=getPropertyElement(CLIENT_EPR);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, epr);
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,170 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.ConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBActionFactory;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBService;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'CreateSessionAction'.
- *
- * @author gary
- */
-public class CreateSessionAction extends AbstractESBAction {
-
- public static final String ROOT = "root";
- public static final String CONVERSATION_TYPE = "conversationType";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public CreateSessionAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public CreateSessionAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- CreateSessionAction.class));
- }
-
- /**
- * This method determines whether the ESB action represents
- * a CreateSessionAction.
- *
- * @return Whether the action is a CreateSessionAction
- */
- public boolean isCreateSession() {
- return(true);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(CONVERSATION_TYPE);
- ret.add(ROOT);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Action must be first conversation based action in
- // the service
- if (getService() != null && getService().getActions().size() > 0) {
- ESBAction act=getService().getActions().get(0);
-
- if (act != this) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"CreateSession"})));
- }
- }
-
- // If service is root, then need to defined conversation type
- if (getService().isRoot()) {
- if (getService().getConversationType() == null) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_CONVERSATION_TYPE",
- new String[]{})));
- } else {
- int index=getService().getConversationType().indexOf('@');
- String convType=getService().getConversationType().trim();
-
- if (index == -1 || index == convType.length()-1) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_CONVERSATION_TYPE_ROLE",
- new String[]{convType})));
- }
- }
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- /**
- * This method sets the root property.
- *
- * @param root The root
- */
- public void setRoot(boolean root) {
-
- org.w3c.dom.Element prop=getPropertyElement(ROOT);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, ""+root);
- }
- }
-
- /**
- * This method sets the conversation type property.
- *
- * @param name The conversation type
- */
- public void setConversationType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(CONVERSATION_TYPE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,322 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'IfAction'.
- *
- * @author gary
- */
-public class IfAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String IMMEDIATE = "immediate";
- public static final String EXPRESSION = "expression";
- public static final String ELSE = "else";
- public static final String ELSEIF = "elseif";
- public static final String IF = "if";
- public static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public IfAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public IfAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- IfAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- (n.getNodeName().equals(IF) ||
- n.getNodeName().equals(ELSEIF) ||
- n.getNodeName().equals(ELSE))) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_if=false;
- boolean f_else=false;
- boolean f_orderWrong=false;
- boolean f_serviceDetailsMissing=false;
- boolean f_immediateInvalid=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(IF)) {
- if (f_if) {
- f_orderWrong = true;
- }
-
- f_if = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(ELSEIF)) {
-
- if (f_if == false || f_else) {
- f_orderWrong = true;
- }
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(ELSE)) {
-
- if (f_if == false || f_else) {
- f_orderWrong = true;
- }
-
- f_else = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && (f_if == false || f_orderWrong)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_IF_ORDER_WRONG",
- new String[]{})));
- }
-
- if (f_serviceDetailsMissing) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{})));
- }
-
- if (f_immediateInvalid) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- If choice=new If();
- activities.add(choice);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(IF) ||
- n.getNodeName().equals(ELSEIF)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // TODO: Convert the conditional expression if defined
-
- ConditionalBlock cond=new ConditionalBlock();
- choice.getConditionalBlocks().add(cond);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(cond.getContents(), context);
- }
- } else if (n.getNodeName().equals(ELSE)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- Block block=new Block();
- choice.setElseBlock(block);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(block.getContents(), context);
- }
- }
- }
- }
- }
-
- /**
- * This method adds a path to the if action.
- *
- * @param type The type of path (IF, ELSEIF or ELSE)
- * @param category The service category
- * @param name The service name
- * @param immediate Whether invocation should be immediate
- * @param expr The expression, if type is IF or ELSEIF
- * @param position The position, if type is ELSEIF
- */
- public void addPath(String type, String category, String name,
- boolean immediate, String expr, int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=getAction().getOwnerDocument().createElement(type);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
- path.setAttribute(IMMEDIATE, ""+immediate);
-
- if (expr != null && (type == IF || type == ELSEIF)) {
- path.setAttribute(EXPRESSION, expr);
- }
-
- paths.appendChild(path);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,384 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.IdentityUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'MessageRouterAction'. Although
- * not an integral part of the behaviour of a service, it provides
- * a behavioural gateway to ensure that messages sent to a
- * specific endpoint reference are routed to the appropriate
- * ESB service descriptor. Therefore the routing configuration
- * needs to be synchronized with the definition of the service
- * descriptors representing the various behavioural states associated
- * with a service.
- *
- * @author gary
- */
-public class MessageRouterAction extends AbstractESBAction {
-
- public static final String IDENTITIES_ELEMENT = "identities";
- public static final String INITIATE = "initiate";
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String ROUTE = "route";
- public static final String PATHS = "paths";
- public static final String MESSAGE_ELEMENT="message";
- public static final String TYPE_ATTR="type";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public MessageRouterAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public MessageRouterAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- MessageRouterAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(ROUTE)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
- String initiate=((org.w3c.dom.Element)n).getAttribute(INITIATE);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service, true));
-
- if (service != null) {
- if (initiate != null && initiate.equalsIgnoreCase("true")) {
- m_initiateServices.add(service);
- } else {
- m_services.add(service);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * This method determines whether the action is related to a behavioural
- * session.
- *
- * @return Whether the action is session based
- */
- public boolean isSessionBased() {
- return(false);
- }
-
- /**
- * This method determines whether the action is a gateway
- * for inbound requests.
- *
- * @return Whether the action is a gateway
- */
- public boolean isGateway() {
- return(true);
- }
-
- /**
- * This method adds a route to the message router action.
- *
- * @param category The service category
- * @param name The service name
- * @param initiate Whether the route initiates the service
- * @param messageTypes The list of message types
- */
- public void addRoute(String category, String name, boolean initiate,
- java.util.List<MessageSignature> messageTypes) {
-
- org.w3c.dom.Element paths=getPropertyElement(PATHS);
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(ROUTE);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- if (initiate) {
- path.setAttribute(INITIATE, Boolean.toString(initiate));
- }
-
- for (int i=0; i < messageTypes.size(); i++) {
- org.w3c.dom.Element mt=
- getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
-
- if (messageTypes.get(i).getTypes().size() == 1) {
- TypeReference ref=messageTypes.get(i).getTypes().get(0);
-
- mt.setAttribute(TYPE_ATTR, InteractionUtil.getTypeString(ref));
-
- path.appendChild(mt);
-
- if (messageTypes.get(i).getParent() instanceof ConversationInteraction &&
- ((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition() instanceof Conversation &&
- ((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition().getModel()
- instanceof ConversationModel) {
-
- org.w3c.dom.Element identities=
- mt.getOwnerDocument().createElement(IDENTITIES_ELEMENT);
-
- java.util.List<Identity> ids=((Conversation)
- ((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition()).getIdentities();
-
- java.util.List<IdentityLocator> locators=
- ((ConversationModel)((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition().
- getModel()).getIdentityLocators();
-
- IdentityUtil.defineIdentities(identities, messageTypes.get(i),
- ids, locators);
-
- mt.appendChild(identities);
- }
-
- } else {
- logger.warning("Can only handle single type message signatures");
- }
- }
-
- paths.appendChild(path);
- }
-
- /**
- * This method returns the number of routes associated with
- * the message router.
- *
- * @return The number of routes
- */
- public int getNumberOfRoutes() {
- int ret=0;
-
- org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
-
- ret = nl.getLength();
-
- return(ret);
- }
-
- /**
- * This method returns the DOM element associated with the
- * specified route.
- *
- * @param index The index of the required route
- * @return The route element, or null if not found
- */
- public org.w3c.dom.Element getRouteElement(int index) {
- org.w3c.dom.Element ret=null;
-
- org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
-
- if (index >= 0 && index < nl.getLength() &&
- nl.item(index) instanceof org.w3c.dom.Element) {
- ret = (org.w3c.dom.Element)nl.item(index);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the DOM element associated with the
- * specified service category and name.
- *
- * @param category The service category
- * @param name The service name
- * @return The route element, or null if not found
- */
- public org.w3c.dom.Element getRouteElement(String category,
- String name) {
- org.w3c.dom.Element ret=null;
-
- org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- ret = (org.w3c.dom.Element)nl.item(i);
-
- if (ret.getAttribute(SERVICE_CATEGORY).equals(category) == false ||
- ret.getAttribute(SERVICE_NAME).equals(name) == false) {
- ret = null;
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Check that message router has no other session based
- // ESB actions in the same service descriptor
- if (getService().isSessionBased()) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER",
- new String[]{})));
- }
-
- // Check that 'initate' services have a 'CreateSessionAction' and
- // represent the root behaviour
- for (int i=0; i < m_initiateServices.size(); i++) {
- ESBService service=m_initiateServices.get(i);
-
- if (service.isRoot() == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_CANNOT_INITIATE_NON_ROOT",
- new String[]{service.getCategory(),
- service.getName()})));
- }
- }
-
- // Check that non-'initate' services don't have a 'CreateSessionAction' and
- // represent the root behaviour
- for (int i=0; i < m_services.size(); i++) {
- ESBService service=m_services.get(i);
-
- if (service.isRoot()) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_INITIATE_ROOT",
- new String[]{service.getCategory(),
- service.getName()})));
- }
- }
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_serviceDetailsMissing=false;
- int routeCount=0;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(ROUTE)) {
- routeCount++;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && routeCount < 1) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_ROUTER_ONE_OR_MORE_PATHS",
- new String[]{})));
- }
-
- if (f_serviceDetailsMissing) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.actions");
-
- private java.util.List<ESBService> m_initiateServices=new java.util.Vector<ESBService>();
- private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/Messages.properties
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/Messages.properties 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/Messages.properties 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,47 +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.
-# */
-
-_BOOLEAN=Boolean property '{0}' can only have a 'true' or 'false' value
-_CANNOT_INITIATE_NON_ROOT=Cannot 'initiate' non-root service descriptor for category '{0}' and name '{1}'
-_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER=Cannot define MessageRouterAction with session based actions in service descriptor
-_IF_ORDER_WRONG=IfAction must have an 'if' path, followed by zero or more 'elseif' paths and ending with an optional 'else' path
-_INVALID_PROPERTY_TYPE=Property '{0}' on class '{1}' must be of type '{2}'
-_MISMATCH_SESSION_CLASS=Session class mismatch with service descriptor for category '{0}' and name '{1}'
-_MULTIPLE_JOINS=Action has multiple joins
-_MUST_DEFINE_SINGLE_WHILE_PATH=While action must have a single 'while' path
-_MUST_DEFINE_SINGLE_WHILE_EXIT=While action must have a single 'exit' path
-_MUST_INITIATE_ROOT=Must 'initiate' root service descriptor for category '{0}' and name '{1}'
-_NOT_FOUND_VARIABLE=Variable '{0}' could not be found on class '{1}'
-_NOT_FOUND_VARIABLE_PROPERTY=Variable '{0}' contains property '{1}' that could not be found on class '{2}'
-_NOT_FOUND_PERFORM_CREATE_SESSION=Perform action can only invoke a service descriptor that starts with a CreateSessionAction
-_NOT_READABLE_PROPERTY=Property '{0}' on class '{1}' is not readable
-_NOT_SPECIFIED_CONVERSATION_TYPE=Conversation type must be specified on root service descriptor
-_NOT_SPECIFIED_CONVERSATION_TYPE_ROLE=Conversation type '{0}' must specify a role name following the '@' symbol
-_NOT_SPECIFIED_PROPERTY=Property '{0}' must be specified
-_NOT_SPECIFIED_REQ_RESP_EPR=Send does not contain request service category/name or response client EPR
-_NOT_WRITABLE_PROPERTY=Property '{0}' on class '{1}' is not writable
-_MUST_BE_FIRST_ACTION='{0}' action must be first in the service descriptor
-_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION=Must specify either a State OR Message based expression
-_PARALLEL_MORE_THAN_TWO_PATHS=Parallel action must specify two or more paths
-_PARALLEL_PATH_AFTER_JOIN=Parallel path must not be defined after a join
-_PATH_SERVICE_DETAILS_MISSING=One or more paths are missing the service cateogry and/or name
-_ROUTER_ONE_OR_MORE_PATHS=MessageRouter action must specify one or more routes
-_SWITCH_ONE_OR_MORE_PATHS=Switch action must specify atleast one case
-_UNKNOWN_PROPERTY=Property '{0}' is unknown for this action
-_WHEN_ONE_OR_MORE_PATHS=When action must specify atleast one entry
-_WHILE_PATH_AFTER_EXIT=While path must not be defined after an exit
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,325 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'ParallelAction'.
- *
- * @author gary
- */
-public class ParallelAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String IMMEDIATE = "immediate";
- private static final String JOIN = "join";
- private static final String PATH = "path";
- private static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public ParallelAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public ParallelAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- ParallelAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(PATH)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
-
- if (service != null) {
- m_services.add(service);
- }
- }
- } else if (n.getNodeName().equals(JOIN)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- m_joinCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- m_joinName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
- }
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_joined=false;
- int pathCount=0;
- boolean f_pathAfterJoin=false;
- boolean f_multipleJoins=false;
- boolean f_serviceDetailsMissing=false;
- boolean f_immediateInvalid=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(PATH)) {
- pathCount++;
-
- if (f_joined) {
- f_pathAfterJoin = true;
- }
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(JOIN)) {
-
- if (f_joined) {
- f_multipleJoins = true;
- }
-
- f_joined = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && pathCount < 2) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PARALLEL_MORE_THAN_TWO_PATHS",
- new String[]{})));
- }
-
- if (f_pathAfterJoin) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PARALLEL_PATH_AFTER_JOIN",
- new String[]{})));
- }
-
- if (f_multipleJoins) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MULTIPLE_JOINS",
- new String[]{})));
- }
-
- if (f_serviceDetailsMissing) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{})));
- }
-
- if (f_immediateInvalid) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- Parallel parallel=new Parallel();
- activities.add(parallel);
-
- parallel.derivedFrom(this);
-
- if (m_joinService != null) {
- context.markJoin(m_joinService);
- }
-
- for (int i=0; i < m_services.size(); i++) {
- Block block=new Block();
-
- ESBService service=m_services.get(i);
-
- if (service != null) {
- service.convert(block.getContents(), context);
- }
-
- // TODO: Only temporary check while conformance
- // check does not handle
- //if (block.getContents().size() > 0) {
- parallel.getBlocks().add(block);
- //}
- }
-
- // TODO: Only temporary check while conformance
- // check does not handle
- //if (parallel.getBlocks().size() == 0) {
- // activities.remove(parallel);
- //}
-
- if (m_joinService != null) {
- m_joinService.convert(activities, context);
- }
- }
-
- /**
- * This method adds a path to the parallel action.
- *
- * @param category The service category
- * @param name The service name
- * @param immediate Whether invocation should be immediate
- * @param join Whether the path is for the parallel, or join
- * @param position The position
- */
- public void addPath(String category, String name,
- boolean immediate, boolean join, int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(join ? JOIN : PATH);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- if (immediate) {
- path.setAttribute(IMMEDIATE, Boolean.TRUE.toString());
- }
-
- paths.appendChild(path);
- }
-
- private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
- private String m_joinCategory=null;
- private String m_joinName=null;
- private ESBService m_joinService=null;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,323 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.PropertyUtil;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'WhenAction'.
- *
- * @author gary
- */
-public class PerformAction extends AbstractESBAction {
-
- private static final String BIND_ELEMENT = "bind";
- private static final String TO_VARIABLE_ATTR = "to-variable";
- public static final String SERVICE_NAME = "serviceName";
- public static final String SERVICE_CATEGORY = "serviceCategory";
- public static final String RETURN_SERVICE_NAME = "returnServiceName";
- public static final String RETURN_SERVICE_CATEGORY = "returnServiceCategory";
- public static final String BIND_DETAILS = "bindDetails";
- public static final String PARENT_REFERENCE = "parentReference";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public PerformAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public PerformAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- PerformAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- m_category=getPropertyValue(SERVICE_CATEGORY);
- m_name=getPropertyValue(SERVICE_NAME);
-
- if (m_category != null && m_name != null) {
- m_service=getService().getModel().getService(m_category, m_name);
-
- getLinks().add(new ESBLink(m_category, m_name, m_service, true));
- }
-
- m_joinCategory=getPropertyValue(RETURN_SERVICE_CATEGORY);
- m_joinName=getPropertyValue(RETURN_SERVICE_NAME);
-
- if (m_joinCategory != null && m_joinName != null) {
- m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
-
- getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
- }
- }
-
- /**
- * This method indicates whether this action performs another
- * sub-conversation.
- *
- * @return Whether the action is a 'perform'
- */
- @Override
- public boolean isPerform() {
- return(true);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(SERVICE_CATEGORY);
- ret.add(SERVICE_NAME);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(RETURN_SERVICE_NAME);
- ret.add(RETURN_SERVICE_CATEGORY);
- ret.add(BIND_DETAILS);
- ret.add(PARENT_REFERENCE);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Check if performed state starts with a create session action
- if (m_service != null &&
- m_service.isCreateSession() == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_PERFORM_CREATE_SESSION",
- new String[]{})));
- }
-
- // Check if performed service has relevant bind
- // and parent properties
- if (m_service != null &&
- m_service.getSessionClass() != null) {
-
- if (hasProperty(PARENT_REFERENCE)) {
- String parentRefProperty=getPropertyValue(PARENT_REFERENCE);
-
- if (PropertyUtil.isProperty(m_service.getSessionClass(),
- parentRefProperty) == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{parentRefProperty,
- m_service.getSessionClass().getName()})));
- } else if (PropertyUtil.hasWritableProperty(m_service.getSessionClass(),
- parentRefProperty) == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{parentRefProperty,
- m_service.getSessionClass().getName()})));
- }
-
- Class<?> parentCls=PropertyUtil.getPropertyType(
- m_service.getSessionClass(), parentRefProperty);
-
- if (parentCls != null && getService() != null &&
- getService().getSessionClass() != null &&
- parentCls.isAssignableFrom(
- getService().getSessionClass()) == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_INVALID_PROPERTY_TYPE",
- new String[]{parentRefProperty,
- m_service.getSessionClass().getName(),
- getService().getSessionClass().getName()})));
- }
- }
-
- if (hasProperty(BIND_DETAILS)) {
- org.w3c.dom.Element elem=getPropertyElement(BIND_DETAILS);
-
- org.w3c.dom.NodeList nl=elem.getElementsByTagName(BIND_ELEMENT);
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Element bind=(org.w3c.dom.Element)nl.item(i);
-
- if (bind.hasAttribute(TO_VARIABLE_ATTR)) {
- String variable=bind.getAttribute(TO_VARIABLE_ATTR);
-
- if (PropertyUtil.isProperty(m_service.getSessionClass(),
- variable) == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{variable,
- m_service.getSessionClass().getName()})));
-
- } else if (PropertyUtil.hasWritableProperty(m_service.getSessionClass(),
- variable) == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{variable,
- m_service.getSessionClass().getName()})));
- }
- } else {
- // Possibly report if 'to-variable' not
- // defined?
- }
- }
- }
- }
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- Compose elem=null;
-
- // Check if perform is asynchronous
- if (hasProperty(RETURN_SERVICE_NAME)) {
- elem = new Run();
- } else {
- elem = new Spawn();
- }
-
- activities.add(elem);
-
- elem.derivedFrom(this);
-
- Conversation definition=new Conversation();
-
- elem.setInlineDefinition(definition);
-
- if (m_service != null) {
- // TODO: May need to be separate definition, in case the
- // same state is called from a number of different
- // places
- m_service.convert(definition.getBlock().getContents(), context);
- }
-
- if (m_joinService != null) {
- m_joinService.convert(activities, context);
- }
- }
-
- /**
- * This method sets the destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- /**
- * This method sets the return destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setReturnDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(RETURN_SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(RETURN_SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- private String m_category=null;
- private String m_name=null;
- private ESBService m_service=null;
- private String m_joinCategory=null;
- private String m_joinName=null;
- private ESBService m_joinService=null;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'ReceiveMessageAction'.
- *
- * @author gary
- */
-public class ReceiveMessageAction extends AbstractInteractionMessageAction {
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public ReceiveMessageAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public ReceiveMessageAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- ReceiveMessageAction.class));
- }
-
- /**
- * This method indicates whether the action is an initiator.
- * Initiator actions must precede any other session based
- * action, within an ESB service.
- *
- * @return Whether the action is an initiator
- */
- @Override
- public boolean isInitiator() {
- return(true);
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- ConversationInteraction recv=new ConversationInteraction();
- activities.add(recv);
-
- recv.derivedFrom(this);
-
- MessageSignature ms=new MessageSignature();
- ms.derivedFrom(this);
-
- recv.setMessageSignature(ms);
-
- ms.setOperation(getPropertyValue(OPERATION));
-
- String type=getPropertyValue(MESSAGE_TYPE);
- if (type != null && type.length() > 0) {
- String ns=null;
- String local=type;
-
- if (type.charAt(0) == '{') {
- int endindex=type.indexOf('}');
-
- if (endindex != -1) {
- ns = type.substring(1, endindex);
- local = type.substring(endindex+1);
- }
- }
-
- TypeReference ref=new TypeReference();
- ref.setLocalpart(local);
- ref.setNamespace(ns);
-
- ref.derivedFrom(this);
-
- ms.getTypes().add(ref);
- }
-
- // Initialize the 'to' role to be this participant
- if (context.getRole() != null) {
- recv.setToRole(new Role(context.getRole()));
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'RetrieveSessionAction'.
- *
- * @author gary
- */
-public class RetrieveSessionAction extends AbstractESBAction {
-
- public static final String IDENTITIES = "identities";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public RetrieveSessionAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(IDENTITIES);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Action must be first conversation based action in
- // the service
- if (getService() != null && getService().getActions().size() > 0) {
- ESBAction act=getService().getActions().get(0);
-
- if (act != this) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"RetrieveSession"})));
- }
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
\ No newline at end of file
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,182 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'ScheduleStateAction'.
- *
- * @author gary
- */
-public class ScheduleStateAction extends AbstractESBAction {
-
- public static final String IMMEDIATE = "immediate";
- public static final String SERVICE_NAME = "serviceName";
- public static final String SERVICE_CATEGORY = "serviceCategory";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public ScheduleStateAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public ScheduleStateAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- ScheduleStateAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
- String serviceName=getPropertyValue(SERVICE_NAME);
- String immediate=getPropertyValue(IMMEDIATE);
-
- m_service=getService().getModel().getService(serviceCategory, serviceName);
-
- getLinks().add(new ESBLink(serviceCategory, serviceName, m_service,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(SERVICE_CATEGORY);
- ret.add(SERVICE_NAME);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(IMMEDIATE);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- String immediate=getPropertyValue(IMMEDIATE);
-
- if (immediate != null && immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- // If the service has been located, then convert its activities
- // if it is either not a loop construct (i.e. a while action), or
- // if it is a loop, then we need to ensure that it is not in the
- // current stack of ESB services that logically 'contain' this
- // action. If this action is within the scope of the loop, then
- // the default behaviour should be to return to the loop
- // condition (i.e. just let the loop return implicitly).
- if (m_service != null &&
- (m_service.isLoop() == false ||
- context.isOnStack(m_service) == false) &&
- context.isJoin(m_service) == false) {
- m_service.convert(activities, context);
- }
- }
-
- /**
- * This method sets the destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- * @param immediate Whether the invoke immediately
- */
- public void setDestination(String category, String name,
- boolean immediate) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
-
- if (immediate) {
- prop = getPropertyElement(IMMEDIATE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, Boolean.toString(immediate));
- }
- }
- }
-
- private ESBService m_service=null;
-}
\ No newline at end of file
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,286 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'SendMessageAction'.
- *
- * @author gary
- */
-public class SendMessageAction extends AbstractInteractionMessageAction {
-
- public static final String RESPONSE_SERVICE_NAME = "responseServiceName";
- public static final String RESPONSE_SERVICE_CATEGORY = "responseServiceCategory";
- public static final String SERVICE_NAME = "serviceName";
- public static final String SERVICE_CATEGORY = "serviceCategory";
- public static final String SERVICE_NAME_EXPRESSION = "serviceNameExpression";
- public static final String SERVICE_CATEGORY_EXPRESSION = "serviceCategoryExpression";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SendMessageAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public SendMessageAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- SendMessageAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
- String serviceName=getPropertyValue(SERVICE_NAME);
- String responseServiceCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
- String responseServiceName=getPropertyValue(RESPONSE_SERVICE_NAME);
-
- if (serviceCategory != null && serviceName != null) {
- ESBService service=getService().getModel().getService(
- serviceCategory, serviceName);
-
- getLinks().add(new ESBLink(serviceCategory, serviceName,
- service, true, true));
- }
-
- if (responseServiceCategory != null && responseServiceName != null) {
- ESBService service=getService().getModel().getService(
- responseServiceCategory, responseServiceName);
-
- getLinks().add(new ESBLink(responseServiceCategory,
- responseServiceName, service, false));
- }
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(RESPONSE_SERVICE_NAME);
- ret.add(RESPONSE_SERVICE_CATEGORY);
- ret.add(SERVICE_NAME);
- ret.add(SERVICE_CATEGORY);
- ret.add(SERVICE_NAME_EXPRESSION);
- ret.add(SERVICE_CATEGORY_EXPRESSION);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // If sending request, then category/name must be specified,
- // else a response requires the 'client epr'. Validate that
- // either case is true.
- if (getPropertyValue(SERVICE_CATEGORY) != null &&
- getPropertyValue(SERVICE_NAME) != null) {
- // Sending a request
-
- } else if (getPropertyValue(SERVICE_CATEGORY_EXPRESSION) != null &&
- getPropertyValue(SERVICE_NAME_EXPRESSION) != null) {
- // Sending a request to service derived from expression
- // on the pojo state
-
- } else if (getPropertyValue(CLIENT_EPR) != null) {
- // Sending a response
-
- // TODO: Validate that the client EPR has been sent on
- // a preceding received request
- } else {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_REQ_RESP_EPR",
- new String[]{})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- ConversationInteraction send=new ConversationInteraction();
- activities.add(send);
-
- send.derivedFrom(this);
-
- MessageSignature ms=new MessageSignature();
- ms.derivedFrom(this);
-
- send.setMessageSignature(ms);
-
- ms.setOperation(getPropertyValue(OPERATION));
-
- String type=getPropertyValue(MESSAGE_TYPE);
- if (type != null && type.length() > 0) {
- String ns=null;
- String local=type;
-
- if (type.charAt(0) == '{') {
- int endindex=type.indexOf('}');
-
- if (endindex != -1) {
- ns = type.substring(1, endindex);
- local = type.substring(endindex+1);
- }
- }
-
- TypeReference ref=new TypeReference();
- ref.setLocalpart(local);
- ref.setNamespace(ns);
-
- ref.derivedFrom(this);
-
- ms.getTypes().add(ref);
- }
-
- // Initialize the 'from' role to be this participant
- // (for now until 'to' role can be set)
- if (context.getRole() != null) {
- send.setFromRole(new Role(context.getRole()));
- }
-
- // TODO: Initialize the 'to' role (possibly to a
- // namespace=service category and localpart=service
- // name. This would need to be mapped when doing
- // conformance checking - might be an issue, may
- // need to declare the name.
-
- // Check if a response control link has been
- // specified
- String responseServiceCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
- String responseServiceName=getPropertyValue(RESPONSE_SERVICE_NAME);
-
- if (responseServiceCategory != null && responseServiceName != null) {
- ESBService service=getService().getModel().getService(
- responseServiceCategory, responseServiceName);
-
- // Add activities from the 'response' service descriptor into
- // the set of activities. If service not found, then ignore
- // here as will be reported as part of the validation of links.
- if (service != null) {
- service.convert(activities, context);
- }
- }
- }
-
- /**
- * This method sets the destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- /**
- * This method sets the destination expressions for the
- * service descriptor properties.
- *
- * @param categoryExpr The category expression
- * @param nameExpr The name expression
- */
- public void setDestinationExpression(String categoryExpr,
- String nameExpr) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY_EXPRESSION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, categoryExpr);
- }
-
- prop = getPropertyElement(SERVICE_NAME_EXPRESSION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, nameExpr);
- }
- }
-
- /**
- * This method sets the response service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setResponseDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(RESPONSE_SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(RESPONSE_SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'SetMessageAction'.
- *
- * @author gary
- */
-public class SetMessageAction extends AbstractESBAction {
-
- public static final String STATE_EXPRESSION = "stateExpression";
- public static final String HEADER_PROPERTY = "headerProperty";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SetMessageAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(STATE_EXPRESSION);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(HEADER_PROPERTY);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.PropertyUtil;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'SetStateAction'.
- *
- * @author gary
- */
-public class SetStateAction extends AbstractESBAction {
-
- public static final String STATE_EXPRESSION = "stateExpression";
- public static final String MESSAGE_EXPRESSION = "messageExpression";
- public static final String VARIABLE = "variable";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SetStateAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(VARIABLE);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(STATE_EXPRESSION);
- ret.add(MESSAGE_EXPRESSION);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- String variable=getPropertyValue(VARIABLE);
-
- if (variable != null) {
-
- // Check that variable defined on session class
- Class<?> cls=getService().getSessionClass();
-
- java.util.StringTokenizer st=new java.util.StringTokenizer(variable, ".");
-
- while (cls != null && st.hasMoreTokens()) {
- String token=st.nextToken();
-
- if (cls != null) {
- if (PropertyUtil.isProperty(cls, token) == false) {
-
- if (variable.equals(token)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{variable, cls.getName()})));
- } else {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE_PROPERTY",
- new String[]{variable, token, cls.getName()})));
- }
- } else if (st.hasMoreTokens()) {
- // Check property can be read
- if (!PropertyUtil.hasReadableProperty(cls, token)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_READABLE_PROPERTY",
- new String[]{token, cls.getName()})));
- }
- } else {
- // Check property can be written
- if (!PropertyUtil.hasWritableProperty(cls, token)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{token, cls.getName()})));
- }
- }
-
- cls = PropertyUtil.getPropertyType(cls, token);
- }
- }
- }
-
- // Check that state or message expression defined
- String stateExpression=getPropertyValue(STATE_EXPRESSION);
- String messageExpression=getPropertyValue(MESSAGE_EXPRESSION);
-
- if ((stateExpression == null && messageExpression == null) ||
- (stateExpression != null && messageExpression != null)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
- new String[]{})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.actions");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,250 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'SwitchAction'.
- *
- * @author gary
- */
-public class SwitchAction extends AbstractESBAction {
-
- public static final String TYPE_ATTR = "type";
- public static final String MESSAGE_ELEMENT = "message";
- private static final String SERVICE_NAME = "service-name";
- private static final String SERVICE_CATEGORY = "service-category";
- private static final String CASE = "case";
- private static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SwitchAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public SwitchAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- SwitchAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- n.getNodeName().equals(CASE)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service, true));
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method indicates whether the action is an initiator.
- * Initiator actions must precede any other session based
- * action, within an ESB service.
- *
- * @return Whether the action is an initiator
- */
- @Override
- public boolean isInitiator() {
- return(true);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- int pathCount=0;
- boolean f_serviceDetailsMissing=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(CASE)) {
- pathCount++;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && pathCount < 1) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_SWITCH_ONE_OR_MORE_PATHS",
- new String[]{})));
- }
-
- if (f_serviceDetailsMissing) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- If choice=new If();
- activities.add(choice);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- n.getNodeName().equals(CASE)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Conditional block with no expression - i.e. the
- // expression is non-observable, as the path will be
- // selected based on the next message that arrives
- ConditionalBlock block=new ConditionalBlock();
- choice.getConditionalBlocks().add(block);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(block.getContents(), context);
- }
- }
- }
- }
-
- /**
- * This method adds a path to the switch action.
- *
- * @param category The service category
- * @param name The service name
- * @param messageTypes The set of interactions
- * @param position The position
- */
- public void addCase(String category, String name,
- java.util.Set<Interaction> messageTypes, int position) {
-
- org.w3c.dom.Element paths=getPropertyElement(PATHS);
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(CASE);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- if (messageTypes != null) {
- java.util.Iterator<Interaction> iter=messageTypes.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getMessageSignature().getTypes().size()==1) {
- org.w3c.dom.Element mt=
- getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
-
- mt.setAttribute(TYPE_ATTR,
- InteractionUtil.getTypeString(
- interaction.getMessageSignature().
- getTypes().get(0)));
-
- path.appendChild(mt);
- }
- }
- }
-
- paths.appendChild(path);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/UnsupportedAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/UnsupportedAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/UnsupportedAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-
-/**
- * This class represents an unsupported (or custom) action within
- * the conversation based ESB service descriptor.
- *
- * @author gary
- */
-public class UnsupportedAction extends AbstractESBAction {
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public UnsupportedAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This method determines whether the action is related to a behavioural
- * session.
- *
- * @return Whether the action is session based
- */
- public boolean isSessionBased() {
- return(false);
- }
-
- /**
- * This method validates the ESB action 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 ESB action 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: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,239 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'WhenAction'.
- *
- * @author gary
- */
-public class WhenAction extends AbstractESBAction {
-
- private static final String SERVICE_NAME = "service-name";
- private static final String SERVICE_CATEGORY = "service-category";
- private static final String WHEN = "when";
- private static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public WhenAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public WhenAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- WhenAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHEN)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service, true));
-
- if (service != null) {
- m_services.add(service);
- }
- }
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // TODO: Valid if decision-method
- // specified, that method exists, if expression, then
- // validate the expression etc.
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- int pathCount=0;
- boolean f_serviceDetailsMissing=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHEN)) {
- pathCount++;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && pathCount < 1) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_WHEN_ONE_OR_MORE_PATHS",
- new String[]{})));
- }
-
- if (f_serviceDetailsMissing) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- When elem=new When();
- activities.add(elem);
-
- elem.derivedFrom(this);
-
- if (m_joinService != null) {
- context.markJoin(m_joinService);
- }
-
- for (int i=0; i < m_services.size(); i++) {
- ConditionalBlock block=new ConditionalBlock();
-
- m_services.get(i).convert(block.getContents(), context);
-
- elem.getConditionalBlocks().add(block);
- }
-
- if (m_joinService != null) {
- m_joinService.convert(activities, context);
- }
- }
-
- /**
- * This method adds a path to the when action.
- *
- * @param category The service category
- * @param name The service name
- * @param position The position
- */
- public void addPath(String category, String name,
- int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(WHEN);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- paths.appendChild(path);
- }
-
- private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
- private String m_joinCategory=null;
- private String m_joinName=null;
- private ESBService m_joinService=null;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,384 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'WhileAction'.
- *
- * @author gary
- */
-public class WhileAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String IMMEDIATE = "immediate";
- private static final String WHILE = "while";
- private static final String EXIT = "exit";
- private static final String PATHS = "paths";
- public static final String MESSAGE_ELEMENT="message";
- public static final String TYPE_ATTR="type";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public WhileAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public WhileAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- WhileAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHILE)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- m_loopCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- m_loopName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- m_loopService=getService().getModel().getService(m_loopCategory, m_loopName);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(m_loopCategory, m_loopName, m_loopService,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
- } else if (n.getNodeName().equals(EXIT)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- m_exitCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- m_exitName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- m_exitService=getService().getModel().getService(m_exitCategory, m_exitName);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(m_exitCategory, m_exitName, m_exitService,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
- }
- }
- }
- }
-
- /**
- * This method determines if the action represents a loop construct.
- *
- * @return Whether the action represents a loop construct
- */
- @Override
- public boolean isLoop() {
- return(true);
- }
-
- /**
- * This method indicates whether the action is an initiator.
- * Initiator actions must precede any other session based
- * action, within an ESB service.
- *
- * @return Whether the action is an initiator
- */
- @Override
- public boolean isInitiator() {
- return(true);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // While action must be first conversation based action in
- // the service
- if (getService() != null && getService().getActions().size() > 0) {
- ESBAction act=getService().getActions().get(0);
-
- if (act != this) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"While"})));
- }
- }
-
- // TODO: Validate while/exit order, if decision-method
- // specified, that method exists, if expression, then
- // validate the expression etc.
-
- // TODO: Validate that the loop service returns back to the
- // while action for all paths
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_while=false;
- boolean f_exit=false;
- boolean f_multipleWhiles=false;
- boolean f_multipleExits=false;
- boolean f_serviceDetailsMissing=false;
- boolean f_pathAfterExit=false;
- boolean f_immediateInvalid=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHILE)) {
-
- if (f_while) {
- f_multipleWhiles = true;
- }
-
- if (f_exit) {
- f_pathAfterExit = true;
- }
-
- f_while = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(EXIT)) {
-
- if (f_exit) {
- f_multipleExits = true;
- }
-
- f_exit = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && (f_while == false || f_multipleWhiles)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_DEFINE_SINGLE_WHILE_PATH",
- new String[]{})));
- }
-
- if (nl != null && (f_exit == false || f_multipleExits)) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_DEFINE_SINGLE_WHILE_EXIT",
- new String[]{})));
- }
-
- if (f_pathAfterExit) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_WHILE_PATH_AFTER_EXIT",
- new String[]{})));
- }
-
- if (f_serviceDetailsMissing) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{})));
- }
-
- if (f_immediateInvalid) {
- l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE})));
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- While elem=new While();
- activities.add(elem);
-
- elem.derivedFrom(this);
-
- ConditionalBlock block=new ConditionalBlock();
- elem.setBlock(block);
-
- if (m_loopService != null) {
- context.push(getService());
-
- m_loopService.convert(elem.getBlock().getContents(), context);
-
- context.pop(getService());
- }
-
- if (m_exitService != null) {
- m_exitService.convert(activities, context);
- }
- }
-
- /**
- * This method adds a path to the when action.
- *
- * @param category The service category
- * @param name The service name
- * @param position The position
- */
- public void addPath(String category, String name, boolean exit,
- java.util.List<MessageSignature> messageTypes,
- int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(exit?EXIT:WHILE);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- paths.appendChild(path);
-
- for (int i=0; i < messageTypes.size(); i++) {
- org.w3c.dom.Element mt=
- getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
-
- if (messageTypes.get(i).getTypes().size() == 1) {
- TypeReference ref=messageTypes.get(i).getTypes().get(0);
- String type="";
-
- if (ref.getNamespace() != null) {
- type += "{"+ref.getNamespace()+"}";
- }
- type += ref.getLocalpart();
-
- mt.setAttribute(TYPE_ATTR, type);
-
- path.appendChild(mt);
- }
- }
- }
-
- private String m_loopCategory=null;
- private String m_loopName=null;
- private ESBService m_loopService=null;
- private String m_exitCategory=null;
- private String m_exitName=null;
- private ESBService m_exitService=null;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/AbstractESBModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/AbstractESBModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/AbstractESBModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,173 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-
-/**
- * This is the abstract ESB model change rule.
- */
-public abstract class AbstractESBModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if ((context.getParent() instanceof ESBService ||
- (ref != null && ref.getSource().getObject()
- instanceof AbstractESBAction &&
- ((AbstractESBAction)ref.getSource().getObject()).getService() != null)) &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the ESB service associated with the
- * optional model object reference or the context.
- *
- * @param context The context
- * @param ref The optional model object
- * @return The ESB service, or null if not found
- */
- protected ESBService getESBService(ModelChangeContext context,
- ModelObject ref) {
- ESBService ret=(ESBService)context.getParent();
-
- if (ref != null && ref.getSource().getObject() instanceof AbstractESBAction) {
- ret = ((AbstractESBAction)ref.getSource().getObject()).getService();
- }
-
- return(ret);
- }
-
- /**
- * This method determines the position of the supplied
- * model object within the supplied service.
- *
- * @param service The service
- * @param ref The optional model object
- * @return The position, or -1 if not found
- */
- protected int getPosition(ESBService service, ModelObject ref) {
- int ret=-1;
-
- // Check if reference model object provided, and if so,
- // if it has a position within the service
- if (ref != null && ref.getSource().getObject() instanceof ESBAction) {
- ret = service.getActions().indexOf((ESBAction)
- ref.getSource().getObject());
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether an 'initiator' action,
- * inserted at the defined position in the specified
- * service, should actually be placed in a new scheduled
- * service.
- *
- * @param service The current service
- * @param pos The insertion position in that service
- * @return Whether a new service needs to be scheduled to
- * accommodate the initiator action
- */
- protected boolean shouldScheduleNewService(ESBService service,
- int pos) {
- boolean ret=false;
-
- for (int i=0; ret == false && i < pos; i++) {
- ESBAction action=service.getActions().get(i);
-
- if (action.isSessionBased() && !action.isCreateSession()) {
- ret = true;
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and deleted model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object to be removed
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isDeleteSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj.getSource().getObject() instanceof AbstractESBAction &&
- (context.getParent() instanceof ESBService ||
- ((AbstractESBAction)mobj.getSource().getObject()).getService() != null) &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method removes the supplied model object from the
- * supplied model. The model object representation must
- * contain the necessary model specific to remove the
- * object from the underlying model representation.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object to be deleted
- * @return Whether the change has been applied
- */
- @Override
- public boolean delete(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
- ESBService service=getESBService(context, mobj);
- ESBAction action=(ESBAction)mobj.getSource().getObject();
-
- if (action != null && service != null) {
- ret = service.getActions().remove(action);
- }
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,553 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.IdentityUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Conversation Interaction.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ConversationInteractionModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj,
- ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof ConversationInteraction &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ConversationInteraction interaction=(ConversationInteraction)mobj;
-
- // Check if send or receive
- if (InteractionUtil.isSend(interaction)) {
-
- // Send
- insertSend(context, esbModel, interaction, ref);
-
- } else {
- // Receive
- insertReceive(context, esbModel, interaction, ref);
- }
-
- return(true);
- }
-
- protected void insertSend(ModelChangeContext context,
- ESBLanguageModel esbModel, ConversationInteraction interaction,
- ModelObject ref) {
- ESBService service=getESBService(context, ref);
-
- SendMessageAction action=
- new SendMessageAction(service);
-
- if (interaction.getMessageSignature().getOperation() != null) {
- action.setOperation(interaction.getMessageSignature().getOperation());
- }
-
- setMessageType(action, interaction);
-
- boolean f_subsequentInitiator=false;
- boolean f_moveActions=false;
-
- // Check if reference model object provided, and if so,
- // if it has a position within the service
- int pos=getPosition(service, ref);
-
- // Check if subsequent action(s) are initiators
- if (pos != -1) {
- for (int i=pos; f_subsequentInitiator == false &&
- i < service.getActions().size(); i++) {
- f_subsequentInitiator =
- service.getActions().get(i).isInitiator();
- }
- }
-
- // Move actions if a subsequent initiator has been found
- f_moveActions = f_subsequentInitiator;
-
- service.addAction(action, pos);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action &&
- interaction.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)interaction.getEnclosingDefinition())));
- }
-
- if (interaction.getRequestLabel() != null) {
-
- // Create new ESB service
- ESBService respService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(respService);
-
- action.setResponseDestination(respService.getCategory(),
- respService.getName());
-
- context.setParent(respService);
-
- // Clear the sub-sequent initiator flag, as
- // subsequent actions will be moved to new service
- // anyway
- f_subsequentInitiator = false;
-
- } else if (interaction.getReplyToLabel() != null) {
-
- if (interaction.getToRole() != null) {
- action.setClientEPR(interaction.getToRole().getName());
- } else {
- action.setClientEPR("client");
- }
- }
-
- // Check if subsequent initiator found, requiring
- // a new service
- if (f_subsequentInitiator) {
-
- ESBService extraService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(extraService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- schedule.setDestination(extraService.getCategory(),
- extraService.getName(), false);
-
- service.addAction(schedule, pos+1);
-
- // Move pointer on, as now additional 'schedule' action
- pos++;
-
- context.setParent(extraService);
- }
-
- // Check if existing actions need to be moved
- if (f_moveActions) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBService extraService=(ESBService)context.getParent();
-
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- extraService.addAction(act, -1);
- }
- }
-
- // If not reply, then include the target service
- // details
- if (interaction.getReplyToLabel() == null &&
- interaction.getToRole() != null &&
- interaction.getToRole().getName() != null &&
- interaction.getToRole().getName().length() > 0) {
- String roleName=Character.toLowerCase(
- interaction.getToRole().getName().charAt(0))+
- interaction.getToRole().getName().substring(1);
-
- action.setDestinationExpression(
- InteractionUtil.getRoleServiceCategoryProperty(roleName),
- InteractionUtil.getRoleServiceNameProperty(roleName));
- }
-
- if (interaction.getEnclosingDefinition() instanceof Conversation &&
- interaction.getEnclosingDefinition().getModel()
- instanceof ConversationModel) {
-
- java.util.List<Identity> ids=((Conversation)
- interaction.getEnclosingDefinition()).getIdentities();
-
- java.util.List<IdentityLocator> locators=
- ((ConversationModel)interaction.getEnclosingDefinition().
- getModel()).getIdentityLocators();
-
- IdentityUtil.defineIdentities(action.getPropertyElement(
- SendMessageAction.IDENTITIES),
- interaction.getMessageSignature(), ids, locators);
- }
- }
-
- protected void insertReceive(ModelChangeContext context,
- ESBLanguageModel esbModel, ConversationInteraction interaction,
- ModelObject ref) {
- ESBService service=getESBService(context, ref);
- ESBService endService=service;
-
- int endPos=-1;
- boolean f_subsequentInitiator=false;
-
- // Check if reference model object provided, and if so,
- // if it has a position within the service
- int pos=getPosition(service, ref);
-
- // Check if subsequent action(s) are initiators
- if (pos != -1) {
- for (int i=pos; f_subsequentInitiator == false &&
- i < service.getActions().size(); i++) {
- f_subsequentInitiator =
- service.getActions().get(i).isInitiator();
- }
- }
-
- endPos = pos;
-
- // Check if receive needs to be placed in new service
- // descriptor - i.e. if insert at end, but current service
- // already has service based actions, or reference object
- // provided, but is not first position
- if (shouldScheduleNewService(service, (pos == -1 ?
- service.getActions().size() : pos))) {
-
- // Already has activities, so need to separate
- // into another service descriptor
- ESBService recvService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(recvService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- schedule.setDestination(recvService.getCategory(),
- recvService.getName(), false);
-
- service.addAction(schedule, pos);
-
- context.setParent(recvService);
-
- endService = recvService;
- endPos = 0;
- }
-
- ReceiveMessageAction action=
- new ReceiveMessageAction(endService);
-
- if (interaction.getMessageSignature().getOperation() != null) {
- action.setOperation(interaction.getMessageSignature().getOperation());
- }
-
- setMessageType(action, interaction);
-
- endService.addAction(action, endPos);
-
- if (endService.getFirstSessionBasedAction() == action &&
- interaction.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)interaction.getEnclosingDefinition())));
- }
-
- // Check if subsequent initiator found, requiring
- // a new service
- if (f_subsequentInitiator) {
-
- ESBService extraService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(endService.getCategory(),
- endService.getName()));
-
- esbModel.addService(extraService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(endService);
-
- schedule.setDestination(extraService.getCategory(),
- extraService.getName(), false);
-
- endService.addAction(schedule, endPos+1);
-
- // Move pointer on, as now additional 'schedule' action
- pos++;
-
- context.setParent(extraService);
-
- endService = extraService;
- endPos = -1;
- }
-
- // Check if existing actions need to be moved
- if (pos != -1 && service != endService) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- endService.addAction(act, -1);
- }
- }
-
- // If not a response, then add to the gateway
- if (interaction.getReplyToLabel() == null) {
- ESBService gwService=esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- java.util.List<MessageSignature> mtypes=
- new java.util.Vector<MessageSignature>();
- mtypes.add(interaction.getMessageSignature());
-
- mra.addRoute(endService.getCategory(),
- endService.getName(),
- service.isRoot(), mtypes);
- }
- }
-
- // Set client EPR
- if (interaction.getFromRole() != null) {
- action.setClientEPR(interaction.getFromRole().getName());
- } else {
- action.setClientEPR("client");
- }
- }
-
- if (interaction.getEnclosingDefinition() instanceof Conversation &&
- interaction.getEnclosingDefinition().getModel()
- instanceof ConversationModel) {
-
- java.util.List<Identity> ids=((Conversation)
- interaction.getEnclosingDefinition()).getIdentities();
-
- java.util.List<IdentityLocator> locators=
- ((ConversationModel)interaction.getEnclosingDefinition().
- getModel()).getIdentityLocators();
-
- IdentityUtil.defineIdentities(action.getPropertyElement(
- SendMessageAction.IDENTITIES),
- interaction.getMessageSignature(), ids, locators);
- }
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and modified model object.
- *
- * @param context The context
- * @param model The model
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isUpdateSupported(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
-
- if (fromObj instanceof ConversationInteraction &&
- toObj instanceof ConversationInteraction &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method modifies an existing model object, within a
- * parent model object, with the details supplied in
- * another model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the change has been applied
- */
- @Override
- public boolean update(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ConversationInteraction fromInteraction=(ConversationInteraction)fromObj;
- ConversationInteraction toInteraction=(ConversationInteraction)toObj;
- ESBService service=(ESBService)context.getParent();
-
- // Get action from 'toInteraction'
- if (toInteraction.getSource().getObject() instanceof
- AbstractInteractionMessageAction) {
- AbstractInteractionMessageAction ma=
- (AbstractInteractionMessageAction)
- toInteraction.getSource().getObject();
-
- String origMesgType=ma.getMessageType();
-
- // Set message type
- setMessageType(ma, fromInteraction);
-
- // Update message type in router if appropriate
- if (InteractionUtil.isSend(fromInteraction) == false &&
- fromInteraction.getReplyToLabel() == null) {
- updateRouterMessageType(esbModel, service,
- origMesgType, ma);
- }
-
- ret = true;
- }
-
- return(ret);
- }
-
- protected void updateRouterMessageType(ESBLanguageModel esbModel,
- ESBService service, String origMesgType,
- AbstractInteractionMessageAction ma) {
- ESBService gwService=esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- org.w3c.dom.Element route=
- mra.getRouteElement(service.getCategory(),
- service.getName());
-
- if (route != null) {
- org.w3c.dom.NodeList nl=
- route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Element mesg=
- (org.w3c.dom.Element)nl.item(i);
-
- if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).
- equals(origMesgType)) {
- mesg.setAttribute(MessageRouterAction.TYPE_ATTR,
- ma.getMessageType());
- }
- }
- }
- }
- }
- }
- }
-
- protected void setMessageType(AbstractInteractionMessageAction action,
- ConversationInteraction interaction) {
-
- if (interaction.getMessageSignature().getTypes().size() == 1) {
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- // TODO: Search for an implementation associated with
- // the type reference, so that the type can be
- // abstract - possibly have the required message type
- // notation as part of the context, so that if multiple
- // implementations found, then can select e.g. XML or
- // Java as message type representation.
- String mtype=InteractionUtil.getTypeString(ref);
-
- action.setMessageType(mtype);
- }
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and deleted model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object to be removed
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isDeleteSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof ConversationInteraction &&
- super.isDeleteSupported(context, model, mobj)) {
- ret = true;
- }
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,181 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Conversation.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ConversationModelChangeRule extends AbstractModelChangeRule {
-
- private static final String NAME_SUFFIX = "_main";
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Conversation &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- Conversation conv=(Conversation)mobj;
-
- String namespace=((Model)conv.getModel()).
- getNamespace().getName();
-
- String category=ConversationUtil.getServiceCategory(conv);
-
- String name=ConversationUtil.getServiceName(conv);
-
- String sdname="";
-
- // Check if root conversation
- if (conv.getParent() instanceof Model) {
-
- // Register gateway service
- DefaultESBService gateway=new DefaultESBService(esbModel,
- category, name);
-
- MessageRouterAction mra=new MessageRouterAction(gateway);
-
- // Construct service description name
- if (namespace != null) {
- sdname = "{"+namespace+"}";
- }
-
- sdname += conv.getModelName().getName()+"-"+
- conv.getModelName().getLocatedRole().getName();
-
- mra.setServiceDescriptionName(sdname);
-
- gateway.addAction(mra, -1);
-
- esbModel.addService(gateway);
-
- name += NAME_SUFFIX;
- }
-
- // Create new ESB service
- ESBService service=esbModel.createService(category, name);
-
- esbModel.addService(service);
-
- // Create 'CreateSession' activity
- CreateSessionAction csa=new CreateSessionAction(service);
-
- // Check if root conversation
- if (conv.getParent() instanceof Model) {
- csa.setRoot(true);
-
- String ctype=null;
-
- // Check if conversation has a 'conforms to' reference
- if (conv.getConformsTo().size() > 0) {
- // Set conversation type based on first 'conforms to'
- // reference
- ConformanceReference cref=conv.getConformsTo().get(0);
-
- ctype = cref.getNamespace()+"."+
- cref.getLocalpart()+"@"+
- cref.getLocatedRole();
- } else {
- // Set conversation type based on conversation
- // namespace and name
- ctype = namespace+"."+
- conv.getModelName().getName()+"@"+
- conv.getModelName().getLocatedRole().getName();
- }
-
- if (ctype != null) {
- csa.setConversationType(ctype);
- }
- }
-
- csa.setServiceDescriptionName(sdname);
- csa.setBusinessObjectType(ConversationUtil.getBusinessObjectType(conv));
-
- service.addAction(csa, -1);
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=conv.getBlock().getContents();
-
- context.setParent(service);
-
- for (int i=0; i < acts.size(); i++) {
- context.insert(model, acts.get(i), null);
- }
-
- return(true);
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,416 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the If grouping construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class IfModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof If &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=getESBService(context, ref);
- If ifElem=(If)mobj;
-
- int pos=getPosition(service, ref);
-
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
-
- // Check if should be an 'if' or a 'switch' action
- if (ifElem.getRoles().contains(context.getRole())) {
-
- insertIf(context, model, service, ifElem, joinService, pos);
- } else {
- insertSwitch(context, model, service, ifElem, joinService, pos);
- }
-
-
- context.setParent(joinService);
-
- // If reference provided, then move subsequent activities
- // to the 'join service'
- if (pos != -1) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- joinService.addAction(act, -1);
- }
- }
-
- return(true);
- }
-
- protected void insertIf(ModelChangeContext context,
- Model model, ESBService service,
- If ifElem, ESBService joinService, int pos) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
-
- // If action, because the role is a decision maker
- IfAction ifAction=new IfAction(service);
-
- service.addAction(ifAction, pos);
-
- for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
- ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), null);
- }
-
- boolean immediate=false;
-
- ifAction.addPath((i==0 ? IfAction.IF : IfAction.ELSEIF),
- subService.getCategory(), subService.getName(),
- immediate, null, i);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- if (ifElem.getElseBlock() != null) {
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
- context.insert(model,
- ifElem.getElseBlock().getContents().get(j), null);
- }
-
- boolean immediate=false;
-
- ifAction.addPath(IfAction.ELSE,
- subService.getCategory(), subService.getName(),
- immediate, null, -1);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- if (service.getFirstSessionBasedAction() == ifAction &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- ifAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- protected void insertSwitch(ModelChangeContext context,
- Model model, ESBService service,
- If ifElem, ESBService joinService, int pos) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
-
- // Check if 'when' needs to be placed in new service
- // descriptor - i.e. if insert at end, but current service
- // already has service based actions, or reference object
- // provided, but is not first position
- if (shouldScheduleNewService(service, (pos == -1 ?
- service.getActions().size() : pos))) {
-
- // Already has activities, so need to separate
- // into another service descriptor
- ESBService switchService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(switchService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- schedule.setDestination(switchService.getCategory(),
- switchService.getName(), false);
-
- service.addAction(schedule, pos);
-
- context.setParent(switchService);
-
- service = switchService;
- pos = -1;
- }
-
- // Switch action, as role is a decision observer
- SwitchAction switchAction=new SwitchAction(service);
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to find lookahead analyser");
- }
-
- service.addAction(switchAction, pos);
-
- java.util.List<MessageSignature> messageTypes=
- new java.util.Vector<MessageSignature>();
-
- for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
- ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), null);
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(cb);
- }
-
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, i);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- }
-
- if (ifElem.getElseBlock() != null) {
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
- context.insert(model,
- ifElem.getElseBlock().getContents().get(j), null);
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(ifElem.getElseBlock());
- }
-
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, -1);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- }
-
- // Only record message router 'routes' if the switch
- // receives request interactions, and it is the first
- // session based action in the service
- if (messageTypes.size() > 0 &&
- service.getFirstSessionBasedAction() == switchAction) {
- ESBService gwService=
- esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- mra.addRoute(service.getCategory(),
- service.getName(),
- false, messageTypes);
- }
- }
- }
-
- if (service.getFirstSessionBasedAction() == switchAction &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Language Model to
- * Conversation Model.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class LanguageToConversationModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof ConversationModel &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ConversationModel cm=(ConversationModel)mobj;
-
- if (cm.getConversation() != null) {
- context.insert(model, cm.getConversation(), null);
- }
-
- return(true);
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/MessageSignatureModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/MessageSignatureModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/MessageSignatureModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,180 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the MessageSignature.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class MessageSignatureModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and modified model object.
- *
- * @param context The context
- * @param model The model
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isUpdateSupported(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
-
- if (fromObj instanceof MessageSignature &&
- toObj instanceof MessageSignature &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method modifies an existing model object, within a
- * parent model object, with the details supplied in
- * another model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the change has been applied
- */
- @Override
- public boolean update(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- MessageSignature fromMS=(MessageSignature)fromObj;
- MessageSignature toMS=(MessageSignature)toObj;
- ConversationInteraction toInteraction=null;
- ConversationInteraction fromInteraction=null;
-
- if (toMS != null &&
- toMS.getParent() instanceof ConversationInteraction) {
- toInteraction = (ConversationInteraction)toMS.getParent();
- }
-
- if (fromMS != null &&
- fromMS.getParent() instanceof ConversationInteraction) {
- fromInteraction = (ConversationInteraction)fromMS.getParent();
- }
-
- // Get action from 'toInteraction'
- if (toInteraction != null &&
- toInteraction.getSource().getObject() instanceof
- AbstractInteractionMessageAction) {
- AbstractInteractionMessageAction ma=
- (AbstractInteractionMessageAction)
- toInteraction.getSource().getObject();
-
- // Update operation
- setOperation(ma, fromInteraction);
-
- ESBService service = ma.getService();
-
- String origMesgType=ma.getMessageType();
-
- // Set message type
- setMessageType(ma, fromInteraction);
-
- // Update message type in router if appropriate
- if (InteractionUtil.isSend(fromInteraction) == false &&
- fromInteraction.getReplyToLabel() == null) {
- updateRouterMessageType(esbModel, service,
- origMesgType, ma);
- }
-
- ret = true;
- }
-
- return(ret);
- }
-
- protected void updateRouterMessageType(ESBLanguageModel esbModel,
- ESBService service, String origMesgType,
- AbstractInteractionMessageAction ma) {
- ESBService gwService=esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- org.w3c.dom.Element route=
- mra.getRouteElement(service.getCategory(),
- service.getName());
-
- if (route != null) {
- org.w3c.dom.NodeList nl=
- route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Element mesg=
- (org.w3c.dom.Element)nl.item(i);
-
- if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).
- equals(origMesgType)) {
- mesg.setAttribute(MessageRouterAction.TYPE_ATTR,
- ma.getMessageType());
- }
- }
- }
- }
- }
- }
- }
-
- protected void setMessageType(AbstractInteractionMessageAction action,
- ConversationInteraction interaction) {
-
- if (interaction.getMessageSignature().getTypes().size() == 1) {
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- // TODO: Search for an implementation associated with
- // the type reference, so that the type can be
- // abstract - possibly have the required message type
- // notation as part of the context, so that if multiple
- // implementations found, then can select e.g. XML or
- // Java as message type representation.
- String mtype=InteractionUtil.getTypeString(ref);
-
- action.setMessageType(mtype);
- }
- }
-
- protected void setOperation(AbstractInteractionMessageAction action,
- ConversationInteraction interaction) {
- action.setOperation(interaction.getMessageSignature().getOperation());
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,192 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the Parallel grouping construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ParallelModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Parallel &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=getESBService(context, ref);
- Parallel parallel=(Parallel)mobj;
-
- int pos=getPosition(service, ref);
-
- // Create the join service
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
-
- // Create and configure the parallel action
- ParallelAction parAction=new ParallelAction(service);
-
- service.addAction(parAction, pos);
-
- for (int i=0; i < parallel.getBlocks().size(); i++) {
- Block b=parallel.getBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < b.getContents().size(); j++) {
- context.insert(model, b.getContents().get(j), null);
- }
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- parallel.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)parallel.getEnclosingDefinition())));
- }
-
- boolean immediate=true;
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to get lookahead analyser");
- } else {
- java.util.Iterator<Interaction> iter=
- la.getInteractions(b, true).iterator();
-
- while (immediate && iter.hasNext()) {
- Interaction interaction=iter.next();
-
- // If interaction is a receive, then immediate
- // invocation will be false
- immediate = InteractionUtil.isSend(interaction);
- }
- }
-
- parAction.addPath(subService.getCategory(),
- subService.getName(), immediate, false, i);
- }
-
- context.setParent(joinService);
-
- parAction.addPath(joinService.getCategory(),
- joinService.getName(), false, true, -1);
-
- // Check if business object type needs to be specified
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == parAction &&
- parallel.getEnclosingDefinition() instanceof Conversation) {
- parAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)parallel.getEnclosingDefinition())));
- }
-
- // If reference provided, then move subsequent activities
- // to the 'join service'
- if (pos != -1) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- joinService.addAction(act, -1);
- }
- }
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,201 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the Run composition construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class RunModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Run &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=getESBService(context, ref);
- Run run=(Run)mobj;
-
- int pos=getPosition(service, ref);
-
- PerformAction action=new PerformAction(service);
-
- service.addAction(action, pos);
-
- String category=ConversationUtil.getServiceCategory(run.getDefinition());
- String name=ConversationUtil.getServiceName(run.getDefinition());
-
- action.setDestination(category, name);
-
- // Check if business object type needs to be specified
- if (service.getFirstSessionBasedAction() == action &&
- run.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)run.getEnclosingDefinition())));
- }
-
- // Create return service
- ESBService returnService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(returnService);
-
- context.setParent(returnService);
-
- action.setReturnDestination(returnService.getCategory(),
- returnService.getName());
-
- // If reference provided, then move subsequent activities
- // to the 'return service'
- if (pos != -1) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- returnService.addAction(act, -1);
- }
- }
-
- return(true);
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and deleted model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object to be removed
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isDeleteSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof Run &&
- super.isDeleteSupported(context, model, mobj)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method removes the supplied model object from the
- * supplied model. The model object representation must
- * contain the necessary model specific to remove the
- * object from the underlying model representation.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object to be deleted
- * @return Whether the change has been applied
- */
- @Override
- public boolean delete(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
- ESBService service=getESBService(context, mobj);
- ESBAction action=(ESBAction)mobj.getSource().getObject();
-
- int pos=getPosition(service, mobj);
-
- if (action instanceof PerformAction && pos != -1) {
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- PerformAction perform=(PerformAction)action;
-
- schedule.setDestination(perform.getPropertyValue(PerformAction.RETURN_SERVICE_CATEGORY),
- perform.getPropertyValue(PerformAction.RETURN_SERVICE_NAME), true);
-
- service.addAction(schedule, pos);
-
- ret = super.delete(context, model, mobj);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-//import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the Spawn composition construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class SpawnModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof Spawn &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBService service=getESBService(context, ref);
- Spawn spawn=(Spawn)mobj;
-
- int pos=getPosition(service, ref);
-
- PerformAction action=new PerformAction(service);
-
- service.addAction(action, pos);
-
- String category=ConversationUtil.getServiceCategory(spawn.getDefinition());
- String name=ConversationUtil.getServiceName(spawn.getDefinition());
-
- action.setDestination(category, name);
-
- // Check if business object type needs to be specified
- if (service.getFirstSessionBasedAction() == action &&
- spawn.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)spawn.getEnclosingDefinition())));
- }
-
- return(true);
- }
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and deleted model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object to be removed
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isDeleteSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof Spawn &&
- super.isDeleteSupported(context, model, mobj)) {
- ret = true;
- }
-
- return(ret);
- }
-
- //private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/TypeReferenceModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/TypeReferenceModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/TypeReferenceModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,172 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Type Reference.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class TypeReferenceModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context)
- * and modified model object.
- *
- * @param context The context
- * @param model The model
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isUpdateSupported(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
-
- if (fromObj instanceof TypeReference &&
- toObj instanceof TypeReference &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method modifies an existing model object, within a
- * parent model object, with the details supplied in
- * another model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param fromObj The source model object
- * @param toObj The model object to be updated
- * @return Whether the change has been applied
- */
- @Override
- public boolean update(ModelChangeContext context,
- Model model, ModelObject fromObj, ModelObject toObj) {
- boolean ret=false;
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- TypeReference fromTypeRef=(TypeReference)fromObj;
- TypeReference toTypeRef=(TypeReference)toObj;
- ConversationInteraction toInteraction=null;
- ConversationInteraction fromInteraction=null;
-
- if (toTypeRef != null && toTypeRef.getParent() instanceof MessageSignature &&
- toTypeRef.getParent().getParent() instanceof ConversationInteraction) {
- toInteraction = (ConversationInteraction)toTypeRef.getParent().getParent();
- }
-
- if (fromTypeRef != null && fromTypeRef.getParent() instanceof MessageSignature &&
- fromTypeRef.getParent().getParent() instanceof ConversationInteraction) {
- fromInteraction = (ConversationInteraction)fromTypeRef.getParent().getParent();
- }
-
- // Get action from 'toInteraction'
- if (toInteraction != null &&
- toInteraction.getSource().getObject() instanceof
- AbstractInteractionMessageAction) {
- AbstractInteractionMessageAction ma=
- (AbstractInteractionMessageAction)
- toInteraction.getSource().getObject();
-
- ESBService service = ma.getService();
-
- String origMesgType=ma.getMessageType();
-
- // Set message type
- setMessageType(ma, fromInteraction);
-
- // Update message type in router if appropriate
- if (InteractionUtil.isSend(fromInteraction) == false &&
- fromInteraction.getReplyToLabel() == null) {
- updateRouterMessageType(esbModel, service,
- origMesgType, ma);
- }
-
- ret = true;
- }
-
- return(ret);
- }
-
- protected void updateRouterMessageType(ESBLanguageModel esbModel,
- ESBService service, String origMesgType,
- AbstractInteractionMessageAction ma) {
- ESBService gwService=esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- org.w3c.dom.Element route=
- mra.getRouteElement(service.getCategory(),
- service.getName());
-
- if (route != null) {
- org.w3c.dom.NodeList nl=
- route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Element mesg=
- (org.w3c.dom.Element)nl.item(i);
-
- if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).
- equals(origMesgType)) {
- mesg.setAttribute(MessageRouterAction.TYPE_ATTR,
- ma.getMessageType());
- }
- }
- }
- }
- }
- }
- }
-
- protected void setMessageType(AbstractInteractionMessageAction action,
- ConversationInteraction interaction) {
-
- if (interaction.getMessageSignature().getTypes().size() == 1) {
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- // TODO: Search for an implementation associated with
- // the type reference, so that the type can be
- // abstract - possibly have the required message type
- // notation as part of the context, so that if multiple
- // implementations found, then can select e.g. XML or
- // Java as message type representation.
- String mtype=InteractionUtil.getTypeString(ref);
-
- action.setMessageType(mtype);
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,322 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the When grouping construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class WhenModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof When &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=getESBService(context, ref);
- When when=(When)mobj;
-
- int pos=getPosition(service, ref);
-
- // Create join service
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
-
- // Check if context role is decision maker
- if (when.getRoles().contains(context.getRole())) {
-
- insertWhen(context, model, service,
- when, joinService, pos);
- } else {
- insertSwitch(context, model, service,
- when, joinService, pos);
- }
-
- context.setParent(joinService);
-
- // If reference provided, then move subsequent activities
- // to the 'join service'
- if (pos != -1) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- joinService.addAction(act, -1);
- }
- }
-
- return(true);
- }
-
- protected void insertWhen(ModelChangeContext context,
- Model model, ESBService service,
- When when, ESBService joinService, int pos) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
-
- WhenAction action=new WhenAction(service);
-
- service.addAction(action, pos);
-
- for (int i=0; i < when.getConditionalBlocks().size(); i++) {
- ConditionalBlock b=when.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < b.getContents().size(); j++) {
- context.insert(model, b.getContents().get(j), null);
- }
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
-
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- when.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
-
- action.addPath(subService.getCategory(),
- subService.getName(), i);
- }
-
- if (service.getFirstSessionBasedAction() == action &&
- when.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
- }
-
- protected void insertSwitch(ModelChangeContext context,
- Model model, ESBService service,
- When when, ESBService joinService, int pos) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
-
- // Check if 'when' needs to be placed in new service
- // descriptor - i.e. if insert at end, but current service
- // already has service based actions, or reference object
- // provided, but is not first position
- if (shouldScheduleNewService(service, (pos == -1 ?
- service.getActions().size() : pos))) {
-
- // Already has activities, so need to separate
- // into another service descriptor
- ESBService switchService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(switchService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- schedule.setDestination(switchService.getCategory(),
- switchService.getName(), false);
-
- service.addAction(schedule, pos);
-
- context.setParent(switchService);
-
- service = switchService;
- pos = -1;
- }
-
- // Switch action, as role is a decision observer
- SwitchAction switchAction=new SwitchAction(service);
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to find lookahead analyser");
- }
-
- service.addAction(switchAction, pos);
-
- java.util.List<MessageSignature> messageTypes=
- new java.util.Vector<MessageSignature>();
-
- for (int i=0; i < when.getConditionalBlocks().size(); i++) {
- ConditionalBlock cb=when.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), null);
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(cb);
- }
-
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, i);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
-
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- when.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- }
-
- // Only record message router 'routes' if the switch
- // receives request interactions, and it is the first
- // session based action in the service
- if (messageTypes.size() > 0 &&
- service.getFirstSessionBasedAction() == switchAction) {
- ESBService gwService=
- esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- mra.addRoute(service.getCategory(),
- service.getName(),
- false, messageTypes);
- }
- }
- }
-
- if (service.getFirstSessionBasedAction() == switchAction &&
- when.getEnclosingDefinition() instanceof Conversation) {
- switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,246 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the While repetition construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class WhileModelChangeRule extends AbstractESBModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and inserted
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object being inserted
- * @param ref The optional reference model object
- * @return Whether the rule supports the supplied information
- */
- @Override
- public boolean isInsertSupported(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- boolean ret=false;
-
- if (mobj instanceof While &&
- super.isInsertSupported(context, model, mobj, ref)) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.<p>
- * <p>
- * If a reference model object is supplied, then the
- * insertion will occur relative to it. If the reference
- * object is a block, then it means that the insertion
- * should occur at the end of the block. Otherwise the
- * new model object should be inserted before the
- * reference object, within the containing block.<p>
- * <p>
- * If the reference object is not supplied, then the
- * new model object should be inserted at the end of
- * the behaviour associated with the parent in the model
- * change context.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param ref The optional reference model object
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, ModelObject ref) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=getESBService(context, ref);
- ESBService original=service;
- While whileElem=(While)mobj;
-
- int pos=getPosition(service, ref);
-
- // Check if action needs to be placed in new service
- // descriptor - i.e. if insert at end, but current service
- // already has service based actions, or reference object
- // provided, but is not first position
- if (shouldScheduleNewService(service, (pos == -1 ?
- service.getActions().size() : pos))) {
-
- ESBService whileService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(whileService);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- // 'immediate' flag set depending on whether the role
- // is an initiator of the while. If not, then the
- // immediate flag is false, which means the loop will be
- // evaluated based on the next received message
- schedule.setDestination(whileService.getCategory(),
- whileService.getName(),
- whileElem.getRoles().contains(context.getRole()));
- service.addAction(schedule, pos);
-
- context.setParent(whileService);
-
- service = whileService;
- }
-
- WhileAction action=new WhileAction(service);
-
- service.addAction(action, -1);
-
- // Check if business object type needs to be specified
- if (service.getFirstSessionBasedAction() == action &&
- whileElem.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)whileElem.getEnclosingDefinition())));
- }
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- // Configure the while loop service
- context.setParent(subService);
-
- for (int j=0; j < whileElem.getBlock().getContents().size(); j++) {
- context.insert(model, whileElem.getBlock().getContents().get(j), null);
- }
-
- // Need to insert a 'ScheduleStateAction' to return back
- // to the 'WhileAction', to re-evaluate the expression
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- // 'immediate' flag set depending on whether the role
- // is an initiator of the while. If not, then the
- // immediate flag is false, which means the loop will be
- // evaluated based on the next received message
- schedule.setDestination(service.getCategory(),
- service.getName(),
- whileElem.getRoles().contains(context.getRole()));
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- // Check if business object type needs to be specified
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- whileElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)whileElem.getEnclosingDefinition())));
- }
-
- // Check whether message types need to be defined in
- // place of an expression
- java.util.List<MessageSignature> messageTypes=
- new java.util.Vector<MessageSignature>();
-
- // Check if context role is NOT the decision maker
- if (whileElem.getRoles().contains(context.getRole()) == false) {
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to find lookahead analyser");
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(whileElem.getBlock());
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
-
- }
-
- action.addPath(subService.getCategory(),
- subService.getName(), false, messageTypes, -1);
-
- // Create exit service
- ESBService exitService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(exitService);
-
- context.setParent(exitService);
-
- action.addPath(exitService.getCategory(),
- exitService.getName(), true,
- new java.util.Vector<MessageSignature>(), -1);
-
- // If reference provided, then move subsequent activities
- // to the 'exit service'
- if (pos != -1) {
- for (int i=pos+1; i < original.getActions().size();) {
- ESBAction act=original.getActions().get(i);
- original.getActions().remove(i);
-
- exitService.addAction(act, -1);
- }
- }
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ClasspathUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ClasspathUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ClasspathUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-import org.scribble.model.*;
-import org.scribble.osgi.model.OSGIModelRepository;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-
-public class ClasspathUtil {
-
- public static ClassLoader getClassLoader(ESBLanguageModel model)
- throws Exception {
- ClassLoader ret=null;
-
- if (model instanceof DefaultESBLanguageModel) {
- ret = ((DefaultESBLanguageModel)model).getModelClassLoader();
- } else {
- ret = createClassLoader(model.getModelReference());
- }
-
- return(ret);
- }
-
- public synchronized static ClassLoader createClassLoader(ModelReference ref)
- throws Exception {
- ClassLoader ret=null;
-
- IFile file=OSGIModelRepository.getFile(ref);
-
- if (file != null) {
- IJavaProject javaProject=JavaCore.create(file.getProject());
- java.util.List<java.net.URL> urls=new java.util.Vector<java.net.URL>();
-
- scanProjectForClasspath(javaProject, urls);
-
- java.net.URL[] urlarray=new java.net.URL[urls.size()];
- urls.toArray(urlarray);
-
- ret = new java.net.URLClassLoader(urlarray,
- String.class.getClassLoader());
- }
-
- return(ret);
- }
-
- protected static void scanProjectForClasspath(IJavaProject javaProject,
- java.util.List<java.net.URL> urls) throws Exception {
- IClasspathEntry[] entries = javaProject.getResolvedClasspath(true);
-
- IResource outres=ResourcesPlugin.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());
- if (outres != null) {
- urls.add(new java.io.File(outres.getLocation().toPortableString()).toURL());
- }
-
- for (IClasspathEntry entry : entries) {
- if(entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
- IResource project =
- ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
-
- if (project instanceof IProject) {
- IJavaProject jproj=JavaCore.create((IProject)project);
-
- if (jproj != null) {
- scanProjectForClasspath(jproj, urls);
- }
- }
-
- } else {
-
- IResource res=ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
-
- java.net.URL url=null;
-
- if (res != null) {
- url = new java.io.File(res.getLocation().
- toPortableString()).toURL();
- } else {
- url = entry.getPath().toFile().toURL();
- }
-
- if (url != null && urls.contains(url) == false) {
- urls.add(url);
- }
- }
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ConversationUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ConversationUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ConversationUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,149 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-import org.scribble.conversation.model.*;
-import org.scribble.model.Model;
-
-/**
- * This class contains utility functions related to the
- * Conversation.
- */
-public class ConversationUtil {
-
- /**
- * This method returns the full class name associated with the
- * business object type for the supplied conversation.
- *
- * @param conversation The conversation
- * @return The business object type full class name
- */
- public static String getBusinessObjectType(Conversation conversation) {
- String ret=getBusinessObjectTypePackageName(conversation);
-
- ret += "."+getBusinessObjectTypeClassName(conversation);
-
- return(ret);
- }
-
- /**
- * This method returns the package name associated with the
- * business object type for the supplied conversation.
- *
- * @param conversation The conversation
- * @return The business object type package name
- */
- public static String getBusinessObjectTypePackageName(Conversation conversation) {
- String ret=null;
-
- if (conversation.getModel() != null &&
- conversation.getModel().getNamespace() != null) {
- ret = conversation.getModel().getNamespace().getName()+".";
- } else {
- ret = "";
- }
-
- if (conversation.getModelName().getLocatedRole() != null) {
- ret += conversation.getModelName().getLocatedRole();
- }
-
- ret = ret.toLowerCase();
-
- return(ret);
- }
-
- /**
- * This method returns the class name associated with the
- * business object type for the supplied conversation.
- *
- * @param conversation The conversation
- * @return The business object type class name
- */
- public static String getBusinessObjectTypeClassName(Conversation conversation) {
- String ret=conversation.getModelName().getName();
-
- return(ret);
- }
-
- /**
- * This method returns the business object type accessor method
- * for the variable's name.
- *
- * @param name The variable name
- * @return The accessor method
- */
- public static String getVariableAccessorMethod(String name) {
- String ret="get"+Character.toUpperCase(name.charAt(0))+name.substring(1);
-
- return(ret);
- }
-
- /**
- * This method returns the business object type modifier method
- * for the variable's name.
- *
- * @param name The variable name
- * @return The modifier method
- */
- public static String getVariableModifierMethod(String name) {
- String ret="set"+Character.toUpperCase(name.charAt(0))+name.substring(1);
-
- return(ret);
- }
-
- /**
- * This method returns the business object type method variable
- * name for the supplied variable's name.
- *
- * @param name The variable name
- * @return The member variable name
- */
- public static String getMemberVariableName(String name) {
- String ret="m_"+Character.toLowerCase(name.charAt(0))+name.substring(1);
-
- return(ret);
- }
-
- /**
- * This method returns the service category associated with
- * the supplied conversation.
- *
- * @param conv The conversation
- * @return The service category
- */
- public static String getServiceCategory(Conversation conv) {
- String ret=((Model)conv.getModel()).
- getNamespace().getName();
-
- return(ret);
- }
-
- /**
- * This method returns the service name associated with
- * the supplied conversation.
- *
- * @param conv The conversation
- * @return The service name
- */
- public static String getServiceName(Conversation conv) {
- String ret=conv.getModelName().getName()+"_"+
- conv.getModelName().getLocatedRole().getName();
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ESBModelUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ESBModelUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ESBModelUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,46 +0,0 @@
-/*
- * 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:
- * 21 Aug 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-public class ESBModelUtil {
-
- public static String getPath(org.w3c.dom.Element elem) {
- String ret="";
-
- if (elem != null) {
- if (elem.hasAttribute("name")) {
- ret = elem.getAttribute("name");
- } else {
- ret = elem.getNodeName();
- }
-
- if (elem.getParentNode() instanceof org.w3c.dom.Element) {
- String parentPath=getPath((org.w3c.dom.Element)
- elem.getParentNode());
-
- if (parentPath != null && parentPath.trim().length() > 0) {
- ret = parentPath+"/"+ret;
- }
- }
- }
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/IdentityUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/IdentityUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/IdentityUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-public class IdentityUtil {
-
- private static final String LOCATOR_ATTR = "locator";
- private static final String NAME_ATTR = "name";
- private static final String TOKEN_ELEMENT = "token";
- private static final String TYPE_ATTR = "type";
- private static final String IDENTITY_ELEMENT = "identity";
-
- public static void defineIdentities(org.w3c.dom.Element identities,
- MessageSignature message, java.util.List<Identity> ids,
- java.util.List<IdentityLocator> locators) {
-
- // Clear root child nodes
- while (identities.getFirstChild() != null) {
- identities.removeChild(identities.getFirstChild());
- }
-
- for (int i=0; i < ids.size(); i++) {
- org.w3c.dom.Element identity=
- identities.getOwnerDocument().createElement(IDENTITY_ELEMENT);
- identity.setAttribute(TYPE_ATTR,
- ids.get(i).getIdentityType().name().toLowerCase());
-
- boolean f_valid=true;
-
- for (int j=0; f_valid && j < ids.get(i).getNames().size(); j++) {
- String token=ids.get(i).getNames().get(j);
- String locator=null;
-
- for (int k=0; locator == null &&
- k < message.getTypes().size(); k++) {
-
- // Find locator for type
- for (int l=0; locator == null &&
- l < locators.size(); l++) {
- IdentityLocator il=locators.get(l);
-
- if (il.getType().equals(message.getTypes().get(k))) {
- locator = il.getLocator(token);
- }
- }
- }
-
- if (locator == null) {
- f_valid = false;
- } else {
- org.w3c.dom.Element tokenElem=
- identities.getOwnerDocument().createElement(TOKEN_ELEMENT);
-
- identity.appendChild(tokenElem);
-
- tokenElem.setAttribute(NAME_ATTR, token);
- tokenElem.setAttribute(LOCATOR_ATTR, locator);
- }
- }
-
- if (f_valid) {
- identities.appendChild(identity);
- }
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/InteractionUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/InteractionUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/InteractionUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-import org.scribble.model.*;
-
-/**
- * This class contains utility functions for dealing with Interactions.
- */
-public class InteractionUtil {
-
- private static final String SERVICE_NAME_ACCESSOR_SUFFIX = "ServiceName";
- private static final String SERVICE_CATEGORY_ACCESSOR_SUFFIX = "ServiceCategory";
-
- /**
- * This method returns the text representation of the
- * supplied type reference.
- *
- * @param ref The type reference
- * @return The text for the type
- */
- public static String getTypeString(TypeReference ref) {
- String ret="";
-
- if (ref.getNamespace() != null) {
- ret = "{"+ref.getNamespace()+"}";
- }
-
- ret += ref.getLocalpart();
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied interaction
- * is a send.
- *
- * @param interaction The interaction
- * @return Whether the interaction is a send
- */
- public static boolean isSend(Interaction interaction) {
- boolean ret=false;
- Role role=null;
-
- if (interaction.getEnclosingDefinition() != null) {
- role = interaction.getEnclosingDefinition().
- getModelName().getLocatedRole();
- }
-
- if (role != null && ((interaction.getFromRole() != null &&
- interaction.getFromRole().equals(
- role)) ||
- (interaction.getToRole() != null &&
- interaction.getToRole().equals(
- role) == false))) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the business object type property
- * for the role's service category.
- *
- * @param roleName The role
- * @return The service category property
- */
- public static String getRoleServiceCategoryProperty(String roleName) {
- String ret=roleName+SERVICE_CATEGORY_ACCESSOR_SUFFIX;
-
- ret = Character.toLowerCase(ret.charAt(0))+ret.substring(1);
-
- return(ret);
- }
-
- /**
- * This method returns the business object type property
- * for the role's service name.
- *
- * @param roleName The role
- * @return The service name property
- */
- public static String getRoleServiceNameProperty(String roleName) {
- String ret=roleName+SERVICE_NAME_ACCESSOR_SUFFIX;
-
- ret = Character.toLowerCase(ret.charAt(0))+ret.substring(1);
-
- return(ret);
- }
-
- /**
- * This method returns the business object type accessor method
- * for the role's service category.
- *
- * @param roleName The role
- * @return The service category accessor method
- */
- public static String getRoleServiceCategoryAccessorMethod(String roleName) {
- String ret=roleName+SERVICE_CATEGORY_ACCESSOR_SUFFIX;
-
- ret = "get"+Character.toUpperCase(ret.charAt(0))+ret.substring(1);
-
- return(ret);
- }
-
- /**
- * This method returns the business object type accessor method
- * for the role's service name.
- *
- * @param roleName The role
- * @return The service name accessor method
- */
- public static String getRoleServiceNameAccessorMethod(String roleName) {
- String ret=roleName+SERVICE_NAME_ACCESSOR_SUFFIX;
-
- ret = "get"+Character.toUpperCase(ret.charAt(0))+ret.substring(1);
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ProblemDefinitions.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ProblemDefinitions.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ProblemDefinitions.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-public class ProblemDefinitions {
-
- // Defined when the error/warning relates to a property on
- // an ESB action
- public static final String PROBLEM_PROPERTY="ProblemProperty";
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/PropertyUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/PropertyUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/PropertyUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,135 +0,0 @@
-/*
- * 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:
- * 27 Aug 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class PropertyUtil {
-
- /**
- * This method determines whether the supplied class has
- * a writable property associated with the specified name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return Whether the class has a writable property
- */
- public static boolean isProperty(Class<?> type, String prop) {
- boolean ret=false;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied class has
- * a writable property associated with the specified name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return Whether the class has a writable property
- */
- public static boolean hasWritableProperty(Class<?> type, String prop) {
- boolean ret=false;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null && pd.getWriteMethod() != null) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied class has
- * a readable property associated with the specified name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return Whether the class has a readable property
- */
- public static boolean hasReadableProperty(Class<?> type, String prop) {
- boolean ret=false;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null && pd.getReadMethod() != null) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the type of the property associated
- * with the supplied class and property name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return The type of the property, or null if not found
- */
- public static Class<?> getPropertyType(Class<?> type, String prop) {
- Class<?> ret=null;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null) {
- ret = pd.getPropertyType();
- }
-
- return(ret);
- }
-
- /**
- * This method returns the property descriptor with the
- * supplied name on the supplied class.
- *
- * @param type The class
- * @param prop The property name
- * @return The property descriptor, or null if not found
- */
- protected static java.beans.PropertyDescriptor getPropertyDescriptor(Class<?> type, String prop) {
- java.beans.PropertyDescriptor ret=null;
-
- try {
- java.beans.BeanInfo bi=java.beans.Introspector.getBeanInfo(type);
-
- java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
-
- for (int i=0; ret == null && pds != null &&
- i < pds.length; i++) {
- if (pds[i].getName().equals(prop)) {
- ret = pds[i];
- }
- }
-
- } catch(Throwable e) {
- logger.log(Level.SEVERE, "Failed to find property '"+prop+
- "' on class '"+type+"'", e);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.util");
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBNotation.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBNotation.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBNotation.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.parser;
-
-import org.scribble.extensions.*;
-import org.scribble.model.ModelReference;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-
-/**
- *
- *
- * @author gary
- */
-(a)RegistryInfo(extension=org.scribble.parser.Notation.class)
-public class JBossESBNotation implements org.scribble.parser.Notation {
-
- /**
- * This method returns the code for the notation.
- *
- * @return The notation code
- */
- public String getCode() {
- return(ESBLanguageModel.JBOSSESB_NOTATION);
- }
-
- /**
- * This method returns the name of the notation.
- *
- * @return The name
- */
- public String getName() {
- return("JBossESB");
- }
-
- /**
- * This method returns the initial description associated
- * with the supplied reference.
- *
- * @param ref The reference
- * @return The initial description, or null if no description
- */
- public String getInitialDescription(ModelReference ref) {
- StringBuffer buf=new StringBuffer();
-
- return(buf.toString());
- }
-
- /**
- * This method determines whether the Scribble editor should
- * be used for editing the notation.
- *
- * @return Whether the Scribble editor should be used
- */
- public boolean useScribbleEditor() {
- return(false);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBParser.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBParser.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBParser.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.parser;
-
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.extensions.*;
-import org.scribble.parser.Parser;
-
-/**
- * This JBossESB implementation of the Parser interface.
- *
- * @author gary
- */
-(a)RegistryInfo(extension=Parser.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class JBossESBParser implements Parser {
-
- /**
- * This method parses the source located using the supplied
- * scribble reference, to return a model. If any
- * errors are detected, they will be reported to the parser
- * listener.
- *
- * @param ref The scribble source reference
- * @param is The input stream
- * @param l The model listener
- * @return The model, or null if not found
- */
- public Model parse(ModelReference ref, InputStream is,
- ModelListener l) {
- DefaultESBLanguageModel ret=null;
-
- org.scribble.model.DependencyManager dm=
- (org.scribble.model.DependencyManager)
- org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
- org.scribble.model.DependencyManager.class, null);
-
- try {
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- DocumentBuilder builder=fact.newDocumentBuilder();
-
- byte[] b=new byte[is.available()];
- is.read(b);
-
- // 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(b);
-
- org.w3c.dom.Document doc=builder.parse(bais);
-
- // Identify the model associated with the
- // changed resource
- ret = new DefaultESBLanguageModel(ref, doc.getDocumentElement(),
- new String(b));
-
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to load model", e);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.parser");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/actions)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/actions/GenerateAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.actions;
import java.util.logging.Logger;
@@ -31,7 +31,7 @@
import org.scribble.osgi.util.*;
-import org.jboss.tools.overlord.cdl.jbossesb.dialogs.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.dialogs.*;
/**
* This class implements the action to generate the choreography
@@ -109,7 +109,7 @@
mbox.open();
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.actions");
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.actions");
private ISelection m_selection=null;
private IWorkbenchPart m_targetPart=null;
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs)
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs/GenerateDialog.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,374 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.dialogs;
-
-import java.util.logging.Logger;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.jboss.tools.overlord.cdl.jbossesb.generator.*;
-import org.scribble.conversation.model.ConversationModel;
-import org.scribble.extensions.RegistryFactory;
-import org.scribble.model.*;
-
-/**
- * This class provides the dialog for generating JBossESB
- * service artefacts.
- */
-public class GenerateDialog extends org.eclipse.jface.dialogs.Dialog {
-
- /**
- * This is the constructor for the generate dialog.
- *
- * @param shell The shell
- */
- public GenerateDialog(Shell shell, IFile file) {
- super(shell);
-
- m_file = file;
-
- m_buildSystems.add(new AntBuildSystem());
- m_buildSystems.add(new MavenBuildSystem());
-
- initialize(m_file);
- }
-
- /**
- * This method initializes the conversation model associated
- * with the supplied file resource.
- *
- * @param res The file
- */
- protected void initialize(IFile res) {
- ModelReference ref=
- org.scribble.osgi.model.OSGIModelRepository.createReference(res);
-
- if (ref != null) {
- ModelRepository mrep=(ModelRepository)
- RegistryFactory.getRegistry().getExtension(
- ModelRepository.class, null);
-
- if (mrep != null) {
- Model model=mrep.getModel(ref,
- new DefaultModelListener());
-
- if (model instanceof ConversationModel) {
- m_conversationModel = (ConversationModel)model;
-
- m_roles = m_conversationModel.getRoles();
- }
- }
- }
-
- if (m_conversationModel == null) {
- error("Unable to load model used to generate " +
- "the ESB artefacts", null);
- }
- }
-
- /**
- * This method creates the dialog details.
- *
- * @param parent The parent control
- * @return The control containing the dialog components
- */
- protected Control createDialogArea(Composite parent) {
-
- Composite composite=(Composite)super.createDialogArea(parent);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
-
- GridData gd=null;
-
- Group group=new Group(composite, SWT.H_SCROLL|SWT.V_SCROLL);
-
- gd=new GridData();
- gd.horizontalAlignment = SWT.FILL;
- gd.horizontalSpan = 1;
- gd.widthHint = 500;
- gd.grabExcessHorizontalSpace = true;
- group.setLayoutData(gd);
-
- layout = new GridLayout();
- layout.numColumns = 4;
- group.setLayout(layout);
-
- // Labels
- Label label=new Label(group, SWT.NONE);
- label.setText("Service Role");
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 150;
- label.setLayoutData(gd);
-
- label = new Label(group, SWT.NONE);
- label.setText("Project Name");
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 150;
- label.setLayoutData(gd);
-
- if (m_conversationModel != null) {
-
- for (int i=0; i < m_roles.size(); i++) {
-
- Button button=new Button(group, SWT.CHECK);
- button.setText(m_roles.get(i).getName());
- button.setSelection(true);
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 150;
- button.setLayoutData(gd);
-
- m_roleButtons.add(button);
-
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- checkStatus();
- }
- });
-
- Text projectName=new Text(group, SWT.NONE);
-
- String prjName=m_roles.get(i).getName();
-
- if (m_conversationModel.getModelName() != null) {
- prjName = m_conversationModel.getModelName().getName()+"-"+prjName;
- }
-
- projectName.setText(prjName);
-
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.widthHint = 300;
- projectName.setLayoutData(gd);
-
- m_projectNames.add(projectName);
-
- projectName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- checkStatus();
- }
- });
-
- }
- }
-
- Button button=new Button(group, SWT.NONE);
- button.setText("Check All");
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- button.setLayoutData(gd);
-
- button.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- for (int i=0; i < m_roleButtons.size(); i++) {
- m_roleButtons.get(i).setSelection(true);
- }
- checkStatus();
- }
- });
-
- button=new Button(group, SWT.NONE);
- button.setText("Clear All");
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- button.setLayoutData(gd);
-
- button.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- for (int i=0; i < m_roleButtons.size(); i++) {
- m_roleButtons.get(i).setSelection(false);
- }
- checkStatus();
- }
- });
-
- label = new Label(group, SWT.RIGHT);
- label.setText("Build: ");
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- label.setLayoutData(gd);
-
- m_build=new Combo(group, SWT.DROP_DOWN);
-
- for (int i=0; i < m_buildSystems.size(); i++) {
- m_build.add(m_buildSystems.get(i).getName());
- }
-
- m_build.select(0);
-
- gd = new GridData();
- gd.horizontalSpan = 1;
- gd.widthHint = 100;
- m_build.setLayoutData(gd);
-
- return(composite);
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Control ret=super.createButtonBar(parent);
-
- checkStatus();
-
- return(ret);
- }
-
- protected void checkStatus() {
- int selected=0;
- boolean f_error=false;
-
- for (int i=0; i < m_roleButtons.size(); i++) {
- if (m_roleButtons.get(i).getSelection()) {
- selected++;
-
- m_projectNames.get(i).setEnabled(true);
-
- // Check project name
- String projectName=m_projectNames.get(i).getText();
-
- if (isProjectNameValid(projectName) == false) {
- f_error = true;
-
- m_projectNames.get(i).setBackground(
- Display.getCurrent().getSystemColor(SWT.COLOR_RED));
- } else {
- m_projectNames.get(i).setBackground(
- Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- }
- } else {
- m_projectNames.get(i).setEnabled(false);
- m_projectNames.get(i).setBackground(
- Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- }
- }
-
- if (f_error || selected == 0) {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- } else {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- }
-
- protected boolean isProjectNameValid(String name) {
- boolean ret=true;
-
- if (name == null || name.trim().length() == 0) {
- ret = false;
- } else if (m_file.getWorkspace().getRoot().getProject(name).exists()) {
- ret = false;
- } else {
- for (int i=0; ret && i < name.length(); i++) {
- if (i == 0) {
- ret = Character.isJavaIdentifierStart(name.charAt(i));
- } else if ("-.".indexOf(name.charAt(i)) != -1) {
- ret = true;
- } else {
- ret = Character.isJavaIdentifierPart(name.charAt(i));
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * The ok button has been pressed.
- */
- public void okPressed() {
-
- try {
- Generator generator=new Generator(m_file,
- getSelectedBuildSystem());
-
- for (int i=0; i < m_roles.size(); i++) {
-
- if (m_roleButtons.get(i).getSelection()) {
- generator.generateRole(m_roles.get(i),
- m_projectNames.get(i).getText());
- }
- }
-
- super.okPressed();
- } catch(Exception e) {
- error("Failed to generate ESB artefacts", e);
- }
- }
-
- protected BuildSystem getSelectedBuildSystem() {
- return(m_buildSystems.get(m_build.getSelectionIndex()));
- }
-
- /**
- * This method is used to report an error.
- *
- * @param mesg The error message
- * @param ex The exception
- */
- public void error(String mesg, Exception ex) {
-
- org.jboss.tools.overlord.cdl.jbossesb.eclipse.Activator.logError(mesg, ex);
-
- MessageBox mbox=new MessageBox(getShell(),
- SWT.ICON_ERROR|SWT.OK);
- mbox.setMessage(mesg);
- mbox.open();
-
- logger.log(java.util.logging.Level.SEVERE, mesg, ex);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.dialogs");
-
- private IFile m_file=null;
- private ConversationModel m_conversationModel=null;
- private java.util.List<Role> m_roles=null;
- private java.util.List<Button> m_roleButtons=new java.util.Vector<Button>();
- private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
- private Combo m_build=null;
- private java.util.List<BuildSystem> m_buildSystems=new java.util.Vector<BuildSystem>();
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java (from rev 385, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/dialogs/GenerateDialog.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,378 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.dialogs;
+
+import java.util.logging.Logger;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.generator.*;
+import org.scribble.conversation.model.ConversationModel;
+import org.scribble.extensions.RegistryFactory;
+import org.scribble.model.*;
+
+/**
+ * This class provides the dialog for generating JBossESB
+ * service artefacts.
+ */
+public class GenerateDialog extends org.eclipse.jface.dialogs.Dialog {
+
+ /**
+ * This is the constructor for the generate dialog.
+ *
+ * @param shell The shell
+ */
+ public GenerateDialog(Shell shell, IFile file) {
+ super(shell);
+
+ m_file = file;
+
+ m_buildSystems.add(new AntBuildSystem());
+ m_buildSystems.add(new MavenBuildSystem());
+
+ initialize(m_file);
+ }
+
+ /**
+ * This method initializes the conversation model associated
+ * with the supplied file resource.
+ *
+ * @param res The file
+ */
+ protected void initialize(IFile res) {
+ ModelReference ref=
+ org.scribble.osgi.model.OSGIModelRepository.createReference(res);
+
+ if (ref != null) {
+ ModelRepository mrep=(ModelRepository)
+ RegistryFactory.getRegistry().getExtension(
+ ModelRepository.class, null);
+
+ if (mrep != null) {
+ java.util.List<ModelInfo> models=mrep.getModels(ref,
+ new DefaultModelListener());
+
+ for (int i=0; m_conversationModel == null &&
+ i < models.size(); i++) {
+ if (models.get(i).getModel() instanceof ConversationModel) {
+ m_conversationModel = (ConversationModel)
+ models.get(i).getModel();
+
+ m_roles = m_conversationModel.getRoles();
+ }
+ }
+ }
+ }
+
+ if (m_conversationModel == null) {
+ error("Unable to load model used to generate " +
+ "the ESB artefacts", null);
+ }
+ }
+
+ /**
+ * This method creates the dialog details.
+ *
+ * @param parent The parent control
+ * @return The control containing the dialog components
+ */
+ protected Control createDialogArea(Composite parent) {
+
+ Composite composite=(Composite)super.createDialogArea(parent);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+
+ GridData gd=null;
+
+ Group group=new Group(composite, SWT.H_SCROLL|SWT.V_SCROLL);
+
+ gd=new GridData();
+ gd.horizontalAlignment = SWT.FILL;
+ gd.horizontalSpan = 1;
+ gd.widthHint = 500;
+ gd.grabExcessHorizontalSpace = true;
+ group.setLayoutData(gd);
+
+ layout = new GridLayout();
+ layout.numColumns = 4;
+ group.setLayout(layout);
+
+ // Labels
+ Label label=new Label(group, SWT.NONE);
+ label.setText("Service Role");
+
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ gd.widthHint = 150;
+ label.setLayoutData(gd);
+
+ label = new Label(group, SWT.NONE);
+ label.setText("Project Name");
+
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ gd.widthHint = 150;
+ label.setLayoutData(gd);
+
+ if (m_conversationModel != null) {
+
+ for (int i=0; i < m_roles.size(); i++) {
+
+ Button button=new Button(group, SWT.CHECK);
+ button.setText(m_roles.get(i).getName());
+ button.setSelection(true);
+
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ gd.widthHint = 150;
+ button.setLayoutData(gd);
+
+ m_roleButtons.add(button);
+
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ checkStatus();
+ }
+ });
+
+ Text projectName=new Text(group, SWT.NONE);
+
+ String prjName=m_roles.get(i).getName();
+
+ if (m_conversationModel.getModelName() != null) {
+ prjName = m_conversationModel.getModelName().getName()+"-"+prjName;
+ }
+
+ projectName.setText(prjName);
+
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ gd.widthHint = 300;
+ projectName.setLayoutData(gd);
+
+ m_projectNames.add(projectName);
+
+ projectName.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkStatus();
+ }
+ });
+
+ }
+ }
+
+ Button button=new Button(group, SWT.NONE);
+ button.setText("Check All");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 100;
+ button.setLayoutData(gd);
+
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ for (int i=0; i < m_roleButtons.size(); i++) {
+ m_roleButtons.get(i).setSelection(true);
+ }
+ checkStatus();
+ }
+ });
+
+ button=new Button(group, SWT.NONE);
+ button.setText("Clear All");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 100;
+ button.setLayoutData(gd);
+
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ for (int i=0; i < m_roleButtons.size(); i++) {
+ m_roleButtons.get(i).setSelection(false);
+ }
+ checkStatus();
+ }
+ });
+
+ label = new Label(group, SWT.RIGHT);
+ label.setText("Build: ");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 100;
+ label.setLayoutData(gd);
+
+ m_build=new Combo(group, SWT.DROP_DOWN);
+
+ for (int i=0; i < m_buildSystems.size(); i++) {
+ m_build.add(m_buildSystems.get(i).getName());
+ }
+
+ m_build.select(0);
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 100;
+ m_build.setLayoutData(gd);
+
+ return(composite);
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control ret=super.createButtonBar(parent);
+
+ checkStatus();
+
+ return(ret);
+ }
+
+ protected void checkStatus() {
+ int selected=0;
+ boolean f_error=false;
+
+ for (int i=0; i < m_roleButtons.size(); i++) {
+ if (m_roleButtons.get(i).getSelection()) {
+ selected++;
+
+ m_projectNames.get(i).setEnabled(true);
+
+ // Check project name
+ String projectName=m_projectNames.get(i).getText();
+
+ if (isProjectNameValid(projectName) == false) {
+ f_error = true;
+
+ m_projectNames.get(i).setBackground(
+ Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ } else {
+ m_projectNames.get(i).setBackground(
+ Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ }
+ } else {
+ m_projectNames.get(i).setEnabled(false);
+ m_projectNames.get(i).setBackground(
+ Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ }
+ }
+
+ if (f_error || selected == 0) {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ } else {
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ }
+ }
+
+ protected boolean isProjectNameValid(String name) {
+ boolean ret=true;
+
+ if (name == null || name.trim().length() == 0) {
+ ret = false;
+ } else if (m_file.getWorkspace().getRoot().getProject(name).exists()) {
+ ret = false;
+ } else {
+ for (int i=0; ret && i < name.length(); i++) {
+ if (i == 0) {
+ ret = Character.isJavaIdentifierStart(name.charAt(i));
+ } else if ("-.".indexOf(name.charAt(i)) != -1) {
+ ret = true;
+ } else {
+ ret = Character.isJavaIdentifierPart(name.charAt(i));
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * The ok button has been pressed.
+ */
+ public void okPressed() {
+
+ try {
+ Generator generator=new Generator(m_file,
+ getSelectedBuildSystem());
+
+ for (int i=0; i < m_roles.size(); i++) {
+
+ if (m_roleButtons.get(i).getSelection()) {
+ generator.generateRole(m_roles.get(i),
+ m_projectNames.get(i).getText());
+ }
+ }
+
+ super.okPressed();
+ } catch(Exception e) {
+ error("Failed to generate ESB artefacts", e);
+ }
+ }
+
+ protected BuildSystem getSelectedBuildSystem() {
+ return(m_buildSystems.get(m_build.getSelectionIndex()));
+ }
+
+ /**
+ * This method is used to report an error.
+ *
+ * @param mesg The error message
+ * @param ex The exception
+ */
+ public void error(String mesg, Exception ex) {
+
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.eclipse.Activator.logError(mesg, ex);
+
+ MessageBox mbox=new MessageBox(getShell(),
+ SWT.ICON_ERROR|SWT.OK);
+ mbox.setMessage(mesg);
+ mbox.open();
+
+ logger.log(java.util.logging.Level.SEVERE, mesg, ex);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.dialogs");
+
+ private IFile m_file=null;
+ private ConversationModel m_conversationModel=null;
+ private java.util.List<Role> m_roles=null;
+ private java.util.List<Button> m_roleButtons=new java.util.Vector<Button>();
+ private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
+ private Combo m_build=null;
+ private java.util.List<BuildSystem> m_buildSystems=new java.util.Vector<BuildSystem>();
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/eclipse (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/eclipse)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/eclipse/Activator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/eclipse/Activator.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/eclipse/Activator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.eclipse;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.eclipse;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor)
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor/JBossESBConfigEditorManager.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,79 +0,0 @@
-/*
- * 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:
- * 19 Jun 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.editor;
-
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.SourceRef;
-import org.scribble.editor.AbstractEditorManager;
-import org.scribble.editor.EditorManager;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-
-/**
- * This is the JBossESB config implementation of the EditorManager
- * interface.
- */
-(a)RegistryInfo(extension=EditorManager.class,preference=10,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class JBossESBConfigEditorManager extends AbstractEditorManager {
-
- /**
- * This method focuses the editor on the specified source
- * file, associated with the supplied URI, and the component
- * within that file, identified by the source reference.
- *
- * @param uri The source file URI
- * @param ref The component source reference
- * @param prop Additional properties
- */
- public void focus(String uri, SourceRef ref,
- java.util.Map<String,Object> props) {
-
- if (uri != null) {
- org.eclipse.ui.IWorkbenchPage page=
- org.eclipse.ui.PlatformUI.getWorkbench().
- getActiveWorkbenchWindow().getActivePage();
-
- org.eclipse.core.resources.IResource res=
- org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(uri);
-
- if (res instanceof org.eclipse.core.resources.IFile) {
- org.eclipse.ui.part.FileEditorInput input=
- new org.eclipse.ui.part.FileEditorInput(
- (org.eclipse.core.resources.IFile)res);
-
- try {
- org.eclipse.ui.IEditorPart part=page.openEditor(input,
- "org.scribble.designer.editor.ScribbleEditor");
-
- if (part instanceof org.eclipse.ui.texteditor.ITextEditor) {
- org.eclipse.ui.texteditor.ITextEditor editor=
- (org.eclipse.ui.texteditor.ITextEditor)part;
-
- editor.selectAndReveal(ref.getStartPosition(),
- ref.getEndPosition()-ref.getStartPosition());
- }
-
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
-
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java (from rev 393, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/editor/JBossESBConfigEditorManager.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ * 19 Jun 2008 : Initial version created by gary
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.editor;
+
+import org.scribble.extensions.RegistryInfo;
+import org.scribble.model.ModelReference;
+import org.scribble.model.SourceRef;
+import org.scribble.editor.AbstractEditorManager;
+import org.scribble.editor.EditorManager;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+
+/**
+ * This is the JBossESB config implementation of the EditorManager
+ * interface.
+ */
+(a)RegistryInfo(extension=EditorManager.class,preference=10,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class JBossESBConfigEditorManager extends AbstractEditorManager {
+
+ /**
+ * This method focuses the editor on the specified source,
+ * identified by the model reference and source reference.
+ *
+ * @param mref The model reference
+ * @param sref The component source reference
+ * @param prop Additional properties
+ */
+ public void focus(ModelReference mref, SourceRef sref,
+ java.util.Map<String,Object> props) {
+ String uri=null;
+ org.eclipse.core.resources.IFile file=
+ org.scribble.osgi.model.OSGIModelRepository.getFile(mref);
+
+ if (file == null || file.exists() == false) {
+ file = org.scribble.osgi.model.OSGIModelRepository.getGlobalFile(mref);
+ }
+
+ if (file != null && file.exists()) {
+ uri = file.getFullPath().toPortableString();
+ }
+
+ if (uri != null) {
+ org.eclipse.ui.IWorkbenchPage page=
+ org.eclipse.ui.PlatformUI.getWorkbench().
+ getActiveWorkbenchWindow().getActivePage();
+
+ org.eclipse.core.resources.IResource res=
+ org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(uri);
+
+ if (res instanceof org.eclipse.core.resources.IFile) {
+ org.eclipse.ui.part.FileEditorInput input=
+ new org.eclipse.ui.part.FileEditorInput(
+ (org.eclipse.core.resources.IFile)res);
+
+ // TODO: May want to initially try opening
+ // "org.jboss.tools.common.model.ui.editor.EditorPartWrapper"
+ // editor, if available, and creating a dummy
+ // IMarker to trigger the 'gotoMarker' method
+
+ try {
+ org.eclipse.ui.IEditorPart part=page.openEditor(input,
+ org.eclipse.ui.editors.text.EditorsUI.DEFAULT_TEXT_EDITOR_ID);
+
+ if (part instanceof org.eclipse.ui.texteditor.ITextEditor) {
+ org.eclipse.ui.texteditor.ITextEditor editor=
+ (org.eclipse.ui.texteditor.ITextEditor)part;
+
+ editor.selectAndReveal(sref.getStartPosition(),
+ sref.getEndPosition()-sref.getStartPosition());
+ }
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export (from rev 328, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export)
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export/ESBLanguageModelStreamExportRule.java 2008-09-14 20:21:17 UTC (rev 328)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,205 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.export;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-import org.scribble.export.*;
-import org.scribble.export.stream.*;
-import org.scribble.extensions.RegistryInfo;
-import org.scribble.model.*;
-import org.w3c.dom.Node;
-
-/**
- * This class implements the stream based export rule for the
- * ESBLanguageModel entity.
- */
-(a)RegistryInfo(extension=ExportRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ESBLanguageModelStreamExportRule extends DefaultModelStreamExportRule {
-
- /**
- * This method exports the model object.
- *
- * @param modelObject The model object
- * @param context The context
- */
- public boolean isSupported(ModelObject modelObject, String format) {
- return(super.isSupported(modelObject, format) &&
- ESBLanguageModel.class.isAssignableFrom(modelObject.getClass()));
- }
-
- /**
- * 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
- * @throws IOException Failed to record export information
- */
- public void export(ModelObject modelObject, ExporterContext context)
- throws java.io.IOException {
- ESBLanguageModel model=(ESBLanguageModel)modelObject;
-
- try {
- String text=getText(model.getESBConfiguration());
-
- context.record(text.getBytes());
-
- } catch(Exception e) {
- throw new java.io.IOException("Failed to get ESB configuration text");
- }
- }
-
- /**
- * This class converts a DOM representation node to
- * text.
- *
- * @param node The DOM node
- * @return The text
- * @throws Exception Failed to convert
- */
- protected String getText(Node node) throws Exception {
- String ret=null;
-
- try {
- // Transform the DOM represent to text
- java.io.ByteArrayOutputStream xmlstr=
- new java.io.ByteArrayOutputStream();
-
- DOMSource source=new DOMSource();
- source.setNode(node);
-
- StreamResult result=new StreamResult(xmlstr);
-
- Transformer trans=
- TransformerFactory.newInstance().newTransformer();
- trans.transform(source, result);
-
- xmlstr.close();
-
- ret = new String(xmlstr.toByteArray());
-
- if ((node instanceof org.w3c.dom.Document) == false) {
-
- // Strip off any <?xml> header
- int index=ret.indexOf("<?xml");
- if (index != -1) {
- index = ret.indexOf("<", 1);
-
- if (index != -1) {
- ret = ret.substring(index);
- } else {
- index = ret.indexOf("?>");
-
- if (index != -1) {
- index += 2;
-
- // Remove any trailing whitespaces
- // after XML header
- while (index < ret.length() &&
- Character.isWhitespace(ret.charAt(index))) {
- index++;
- }
-
- ret = ret.substring(index);
- }
- }
- }
- }
-
- } catch(Exception e) {
- throw new Exception("Failed to transform " +
- "DOM representation into text", e);
- }
-
- int pos=0;
- int prevpos=0;
- StringBuffer buf=new StringBuffer();
- int level=0;
-
- while ((pos=ret.indexOf('<', prevpos)) != -1) {
-
- if (prevpos < pos &&
- ret.substring(prevpos, pos).trim().length() > 0 &&
- ret.charAt(prevpos-1) != '?') {
-
- if (ret.charAt(prevpos) == '\r' &&
- ret.charAt(prevpos+1) == '\n') {
- prevpos += 2;
- }
- for (int i=0; i < level; i++) {
- buf.append(" ");
- }
-
- buf.append(ret.substring(prevpos, pos).trim());
- buf.append("\r\n");
- }
-
- int endpos=ret.indexOf('>', pos);
-
- if (endpos > 0) {
- boolean noreturn=false;
-
- if (pos > 0 && ret.charAt(pos+1) == '/') {
- level--;
- }
-
- for (int i=0; i < level; i++) {
- buf.append(" ");
- }
- buf.append(ret.substring(pos, endpos+1));
-
- if (ret.charAt(endpos-1)== '?') {
- //noreturn = true;
-
- } else if (ret.charAt(endpos-1) == '/') {
- // Ignore
- } else if (pos > 0 && ret.charAt(pos+1) == '/') {
- // Ignore
-
- } else if (pos > 0 && ret.charAt(pos+1) == '!') {
- // Ignore
-
- } else {
- level++;
- }
-
- if (noreturn == false) {
- buf.append("\r\n");
- }
-
- pos = endpos+1;
- }
-
- prevpos = pos;
- }
-
- if (prevpos != -1 &&
- ret.substring(prevpos).trim().length() > 0) {
- buf.append(ret.substring(prevpos));
- }
-
- ret = buf.toString();
-
- return(ret);
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java (from rev 390, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/export/ESBLanguageModelStreamExportRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,207 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.export;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+import org.scribble.export.*;
+import org.scribble.export.stream.*;
+import org.scribble.extensions.RegistryInfo;
+import org.scribble.model.*;
+import org.w3c.dom.Node;
+
+/**
+ * This class implements the stream based export rule for the
+ * ESBLanguageModel entity.
+ */
+(a)RegistryInfo(extension=ExportRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class ESBLanguageModelStreamExportRule extends DefaultModelStreamExportRule {
+
+ /**
+ * 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) &&
+ ESBLanguageModel.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 {
+ ESBLanguageModel model=(ESBLanguageModel)modelObject;
+
+ try {
+ String text=getText(model.getESBConfiguration());
+
+ context.getFormatter().record(text.getBytes());
+
+ } catch(Exception e) {
+ throw new java.io.IOException("Failed to get ESB configuration text");
+ }
+ }
+
+ /**
+ * This class converts a DOM representation node to
+ * text.
+ *
+ * @param node The DOM node
+ * @return The text
+ * @throws Exception Failed to convert
+ */
+ protected String getText(Node node) throws Exception {
+ String ret=null;
+
+ try {
+ // Transform the DOM represent to text
+ java.io.ByteArrayOutputStream xmlstr=
+ new java.io.ByteArrayOutputStream();
+
+ DOMSource source=new DOMSource();
+ source.setNode(node);
+
+ StreamResult result=new StreamResult(xmlstr);
+
+ Transformer trans=
+ TransformerFactory.newInstance().newTransformer();
+ trans.transform(source, result);
+
+ xmlstr.close();
+
+ ret = new String(xmlstr.toByteArray());
+
+ if ((node instanceof org.w3c.dom.Document) == false) {
+
+ // Strip off any <?xml> header
+ int index=ret.indexOf("<?xml");
+ if (index != -1) {
+ index = ret.indexOf("<", 1);
+
+ if (index != -1) {
+ ret = ret.substring(index);
+ } else {
+ index = ret.indexOf("?>");
+
+ if (index != -1) {
+ index += 2;
+
+ // Remove any trailing whitespaces
+ // after XML header
+ while (index < ret.length() &&
+ Character.isWhitespace(ret.charAt(index))) {
+ index++;
+ }
+
+ ret = ret.substring(index);
+ }
+ }
+ }
+ }
+
+ } catch(Exception e) {
+ throw new Exception("Failed to transform " +
+ "DOM representation into text", e);
+ }
+
+ int pos=0;
+ int prevpos=0;
+ StringBuffer buf=new StringBuffer();
+ int level=0;
+
+ while ((pos=ret.indexOf('<', prevpos)) != -1) {
+
+ if (prevpos < pos &&
+ ret.substring(prevpos, pos).trim().length() > 0 &&
+ ret.charAt(prevpos-1) != '?') {
+
+ if (ret.charAt(prevpos) == '\r' &&
+ ret.charAt(prevpos+1) == '\n') {
+ prevpos += 2;
+ }
+ for (int i=0; i < level; i++) {
+ buf.append(" ");
+ }
+
+ buf.append(ret.substring(prevpos, pos).trim());
+ buf.append("\r\n");
+ }
+
+ int endpos=ret.indexOf('>', pos);
+
+ if (endpos > 0) {
+ boolean noreturn=false;
+
+ if (pos > 0 && ret.charAt(pos+1) == '/') {
+ level--;
+ }
+
+ for (int i=0; i < level; i++) {
+ buf.append(" ");
+ }
+ buf.append(ret.substring(pos, endpos+1));
+
+ if (ret.charAt(endpos-1)== '?') {
+ //noreturn = true;
+
+ } else if (ret.charAt(endpos-1) == '/') {
+ // Ignore
+ } else if (pos > 0 && ret.charAt(pos+1) == '/') {
+ // Ignore
+
+ } else if (pos > 0 && ret.charAt(pos+1) == '!') {
+ // Ignore
+
+ } else {
+ level++;
+ }
+
+ if (noreturn == false) {
+ buf.append("\r\n");
+ }
+
+ pos = endpos+1;
+ }
+
+ prevpos = pos;
+ }
+
+ if (prevpos != -1 &&
+ ret.substring(prevpos).trim().length() > 0) {
+ buf.append(ret.substring(prevpos));
+ }
+
+ ret = buf.toString();
+
+ return(ret);
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AbstractBuildSystem.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AbstractBuildSystem.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AbstractBuildSystem.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AbstractBuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+/**
+ * This class represents an abstract build system.
+ */
+public abstract class AbstractBuildSystem implements BuildSystem {
+
+ private static final String TEMPLATE_SUFFIX = ".template";
+ private static final String TEMPLATE_PREFIX = "template/";
+
+ /**
+ * This method returns the contents for the build
+ * configuration file.
+ *
+ * @param projectName The project name
+ * @return The build file contents
+ */
+ public String getBuildFileContents(String projectName) {
+ String ret=null;
+
+ java.io.InputStream is=
+ AbstractBuildSystem.class.getResourceAsStream(
+ TEMPLATE_PREFIX+getName()+TEMPLATE_SUFFIX);
+
+ if (is != null) {
+
+ try {
+ byte[] b=new byte[is.available()];
+ is.read(b);
+
+ ret = new String(b);
+
+ ret = ret.replaceAll("%PROJECT%", projectName);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ return(ret);
+ }
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AbstractBuildSystem.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AntBuildSystem.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/AntBuildSystem.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AntBuildSystem.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/AntBuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+/**
+ * This class represents the Ant build system.
+ */
+public class AntBuildSystem extends AbstractBuildSystem {
+
+ private static final String BUILD_FILE = "build.xml";
+ private static final String ANT = "Ant";
+ private static final String ESB_CONFIG_PATH = "src/conf/jboss-esb.xml";
+ private static final String DEPLOYMENT_PATH = "src/conf/deployment.xml";
+ private static final String JBMQ_CONFIG_PATH = "src/conf/jbmq-queue-service.xml";
+ private static final String JAVA_SOURCE_PATH = "src/java";
+ private static final String LIBRARY_PATH = "src/lib";
+
+ /**
+ * This method represents the name of the build
+ * system.
+ *
+ * @return The name
+ */
+ public String getName() {
+ return(ANT);
+ }
+
+ /**
+ * This method returns the build configuration file
+ * path.
+ *
+ * @return The build configuration file path
+ */
+ public String getBuildFilePath() {
+ return(BUILD_FILE);
+ }
+
+ /**
+ * This method returns the ESB configuration file
+ * path.
+ *
+ * @return The ESB configuration file path
+ */
+ public String getESBConfigFilePath() {
+ return(ESB_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the deployment file
+ * path.
+ *
+ * @return The deployment file path
+ */
+ public String getDeploymentFilePath() {
+ return(DEPLOYMENT_PATH);
+ }
+
+ /**
+ * This method returns the JBMQ configuration file
+ * path.
+ *
+ * @return The JBMQ configuration file path
+ */
+ public String getJBMQConfigFilePath() {
+ return(JBMQ_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the Java source path.
+ *
+ * @return The Java source path
+ */
+ public String getJavaSourcePath() {
+ return(JAVA_SOURCE_PATH);
+ }
+
+ /**
+ * This method returns the library path.
+ *
+ * @return The library path
+ */
+ public String getLibraryPath() {
+ return(LIBRARY_PATH);
+ }
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildConfigurationGenerator.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildConfigurationGenerator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildConfigurationGenerator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildConfigurationGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+
+/**
+ * This class implements the model based generator to generate
+ * the build configuration.
+ */
+public class BuildConfigurationGenerator implements ModelBasedGenerator {
+
+ /**
+ * This method generates the relevant artefacts based on
+ * the supplied model, within the specified Java project.
+ *
+ * @param jproj The Java project
+ * @param model The model
+ * @param buildSystem The build system to use
+ * @throws GeneratorException Failed to generate
+ */
+ public void generate(IJavaProject jproj,
+ ESBLanguageModel model, BuildSystem buildSystem)
+ throws GeneratorException {
+
+ IPath buildConfigPath=jproj.getPath().append(
+ new Path(buildSystem.getBuildFilePath()));
+
+ IFile buildConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(buildConfigPath);
+
+ GeneratorUtil.createParentFolder(buildConfigFile);
+
+ try {
+ buildConfigFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ String config=buildSystem.getBuildFileContents(jproj.getProject().getName());
+
+ if (config != null) {
+ buildConfigFile.setContents(new java.io.ByteArrayInputStream(
+ config.getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+ } catch(Exception e) {
+ throw new GeneratorException("Failed to create build config", e);
+ }
+ }
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildConfigurationGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildSystem.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BuildSystem.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildSystem.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+/**
+ * This interface represents a build system used when
+ * generating the ESB projects.
+ */
+public interface BuildSystem {
+
+ /**
+ * This method represents the name of the build
+ * system.
+ *
+ * @return The name
+ */
+ public String getName();
+
+ /**
+ * This method returns the build configuration file
+ * path.
+ *
+ * @return The build configuration file path
+ */
+ public String getBuildFilePath();
+
+ /**
+ * This method returns the contents for the build
+ * configuration file.
+ *
+ * @param projectName The project name
+ * @return The build file contents
+ */
+ public String getBuildFileContents(String projectName);
+
+ /**
+ * This method returns the ESB configuration file
+ * path.
+ *
+ * @return The ESB configuration file path
+ */
+ public String getESBConfigFilePath();
+
+ /**
+ * This method returns the deployment file
+ * path.
+ *
+ * @return The deployment file path
+ */
+ public String getDeploymentFilePath();
+
+ /**
+ * This method returns the JBMQ configuration file
+ * path.
+ *
+ * @return The JBMQ configuration file path
+ */
+ public String getJBMQConfigFilePath();
+
+ /**
+ * This method returns the Java source path.
+ *
+ * @return The Java source path
+ */
+ public String getJavaSourcePath();
+
+ /**
+ * This method returns the library path.
+ *
+ * @return The library path, or null if not required
+ */
+ public String getLibraryPath();
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BusinessObjectTypeGenerator.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/BusinessObjectTypeGenerator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BusinessObjectTypeGenerator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BusinessObjectTypeGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,429 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextElement;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ConversationUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.conversation.model.Conversation;
+import org.scribble.conversation.model.Variable;
+import org.scribble.conversation.model.VariableList;
+import org.scribble.model.Interaction;
+import org.scribble.model.ModelObject;
+import org.scribble.model.Role;
+import org.scribble.model.Visitor;
+
+/**
+ * This class implements the conversation based generator
+ * for generating the business object type associated with
+ * a conversation.
+ */
+public class BusinessObjectTypeGenerator implements ConversationBasedGenerator {
+
+ private static final String GENERATOR_MESSAGES = "org.jboss.tools.overlord.cdl.runtime.jbossesb.generator.Messages";
+
+ /**
+ * This method generates the relevant artefacts based on
+ * the supplied conversation, within the specified Java project.
+ *
+ * @param jproj The Java project
+ * @param conversation The conversation
+ * @param buildSystem The build system to use
+ * @throws GeneratorException Failed to generate
+ */
+ public void generate(IJavaProject jproj,
+ Conversation conversation, BuildSystem buildSystem)
+ throws GeneratorException {
+ IPath sourceLocation=jproj.getPath().append(
+ new Path(buildSystem.getJavaSourcePath()));
+
+ String javaClass=ConversationUtil.getBusinessObjectType(conversation);
+
+ String javaPath=javaClass.replace('.', '/')+".java";
+
+ IPath javaFile=sourceLocation.append(new Path(javaPath));
+
+ IFile file=jproj.getProject().getWorkspace().getRoot().getFile(javaFile);
+
+ GeneratorUtil.createParentFolder(file);
+
+ try {
+ file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch(Exception e) {
+ throw new GeneratorException("Failed to create the file", e);
+ }
+
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setResolveBindings(true);
+ parser.setSource(new char[0]);
+
+ CompilationUnit root=(CompilationUnit)parser.createAST(null);
+
+ AST ast=root.getAST();
+
+ org.eclipse.jface.text.IDocument doc=
+ new org.eclipse.jface.text.Document();
+
+ root.recordModifications();
+
+ PackageDeclaration pd=ast.newPackageDeclaration();
+ pd.setName(ast.newName(ConversationUtil.getBusinessObjectTypePackageName(conversation)));
+ root.setPackage(pd);
+
+ TypeDeclaration type=ast.newTypeDeclaration();
+
+ type.setName(ast.newSimpleName(ConversationUtil.getBusinessObjectTypeClassName(conversation)));
+
+ Modifier pubmod=ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD);
+ type.modifiers().add(pubmod);
+
+ root.types().add(type);
+
+ // Process conversation to obtain necessary methods and
+ // properties
+ generateBusinessObjectTypeMethods(type, conversation);
+
+ org.eclipse.text.edits.TextEdit edits=root.rewrite(doc, null);
+
+ try {
+ edits.apply(doc);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ java.io.ByteArrayInputStream is=
+ new java.io.ByteArrayInputStream(doc.get().getBytes());
+
+ try {
+ file.setContents(is, false, true, null);
+
+ is.close();
+ } catch(Exception e) {
+ throw new GeneratorException("Failed to set file contents and close", e);
+ }
+ }
+
+ protected void generateBusinessObjectTypeMethods(TypeDeclaration type,
+ final Conversation conversation) throws GeneratorException {
+ final java.util.List<Role> roles=new java.util.Vector<Role>();
+ final java.util.List<Variable> variables=new java.util.Vector<Variable>();
+
+ conversation.visit(new Visitor() {
+ public boolean visit(ModelObject obj) {
+ boolean ret=true;
+
+ if (obj instanceof Conversation &&
+ obj != conversation) {
+ ret = false;
+ } else if (obj instanceof Interaction) {
+ Interaction interaction=(Interaction)obj;
+
+ // If send and a response, then create
+ // 'to' role service category/name
+ // methods
+ if (InteractionUtil.isSend(interaction) &&
+ interaction.getReplyToLabel() == null &&
+ interaction.getToRole() != null &&
+ roles.contains(interaction.getToRole()) == false) {
+ roles.add(interaction.getToRole());
+ }
+ } else if (obj instanceof VariableList) {
+ VariableList vars=(VariableList)obj;
+
+ variables.addAll(vars.getVariables());
+ }
+
+ return(ret);
+ }
+ });
+
+ generateServiceCategoryAndNameMethods(type, roles);
+
+ generateAccessorAndModifierMethods(type, variables);
+ generateMemberVariables(type, variables);
+ }
+
+ /**
+ * This method generates the methods for returning the
+ * service category and name associated with a service
+ * being invoked.
+ *
+ * @param type The type declaration
+ * @param roles The list of roles representing the invoked
+ * services
+ */
+ protected void generateServiceCategoryAndNameMethods(TypeDeclaration type,
+ java.util.List<Role> roles) {
+ AST ast=type.getAST();
+
+ for (int i=0; i < roles.size(); i++) {
+ String methodName=
+ InteractionUtil.getRoleServiceCategoryAccessorMethod(roles.get(i).getName());
+
+ MethodDeclaration method=ast.newMethodDeclaration();
+ method.setName(ast.newSimpleName(methodName));
+ method.setReturnType2(ast.newSimpleType(
+ ast.newName("String")));
+
+ method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+
+ org.eclipse.jdt.core.dom.Block block=ast.newBlock();
+
+ ReturnStatement retStatement=ast.newReturnStatement();
+
+ retStatement.setExpression(ast.newNullLiteral());
+
+ block.statements().add(retStatement);
+
+ method.setBody(block);
+
+ type.bodyDeclarations().add(method);
+
+ methodName=
+ InteractionUtil.getRoleServiceNameAccessorMethod(roles.get(i).getName());
+
+ method=ast.newMethodDeclaration();
+ method.setName(ast.newSimpleName(methodName));
+ method.setReturnType2(ast.newSimpleType(
+ ast.newName("String")));
+
+ method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+
+ block=ast.newBlock();
+
+ retStatement=ast.newReturnStatement();
+
+ retStatement.setExpression(ast.newNullLiteral());
+
+ block.statements().add(retStatement);
+
+ method.setBody(block);
+
+ type.bodyDeclarations().add(method);
+ }
+ }
+
+ /**
+ * This method generates the accessor and modifier methods
+ * associated with the business state variables used by
+ * the conversation based actions.
+ *
+ * @param type The type declaration
+ * @param variables The list of variables
+ */
+ protected void generateAccessorAndModifierMethods(TypeDeclaration type,
+ java.util.List<Variable> variables) {
+ AST ast=type.getAST();
+
+ for (int i=0; i < variables.size(); i++) {
+ String methodName=
+ ConversationUtil.getVariableAccessorMethod(variables.get(i).getName());
+ String memberVariableName=
+ ConversationUtil.getMemberVariableName(variables.get(i).getName());
+
+ MethodDeclaration method=ast.newMethodDeclaration();
+ method.setName(ast.newSimpleName(methodName));
+
+ String typeName=TypeMapper.getJavaType(
+ variables.get(i).getType().getNamespace(),
+ variables.get(i).getType().getLocalpart());
+
+ Type returnType=null;
+
+ // Check if qualified or base type
+ if (typeName.indexOf('.') == -1) {
+ returnType = ast.newPrimitiveType(PrimitiveType.toCode(typeName));
+ } else {
+ returnType = getType(ast, typeName);
+ }
+
+ method.setReturnType2(returnType);
+
+ method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+
+ org.eclipse.jdt.core.dom.Block block=ast.newBlock();
+
+ ReturnStatement retStatement=ast.newReturnStatement();
+
+ retStatement.setExpression(ast.newSimpleName(memberVariableName));
+
+ block.statements().add(retStatement);
+
+ method.setBody(block);
+
+ Javadoc jdoc=ast.newJavadoc();
+ TagElement tag=ast.newTagElement();
+
+ TextElement text=ast.newTextElement();
+
+ text.setText(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ GENERATOR_MESSAGES),
+ "_ACCESSOR_DESCRIPTION",
+ new String[]{variables.get(i).getName()}));
+
+ tag.fragments().add(text);
+
+ jdoc.tags().add(tag);
+
+ method.setJavadoc(jdoc);
+
+ type.bodyDeclarations().add(method);
+
+ // Generate setter method
+ methodName=
+ ConversationUtil.getVariableModifierMethod(variables.get(i).getName());
+
+ method=ast.newMethodDeclaration();
+ method.setName(ast.newSimpleName(methodName));
+ method.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));
+
+ SingleVariableDeclaration svd=ast.newSingleVariableDeclaration();
+ svd.setName(ast.newSimpleName("value"));
+
+ Type paramType=null;
+
+ // Check if qualified or base type
+ if (typeName.indexOf('.') == -1) {
+ paramType = ast.newPrimitiveType(PrimitiveType.toCode(typeName));
+ } else {
+ paramType = getType(ast, typeName);
+ }
+
+ svd.setType(paramType);
+
+ method.parameters().add(svd);
+
+ method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+
+ block=ast.newBlock();
+
+ method.setBody(block);
+
+ // Assign value to member variable
+ Assignment assign=ast.newAssignment();
+ assign.setLeftHandSide(ast.newSimpleName(memberVariableName));
+ assign.setRightHandSide(ast.newSimpleName("value"));
+
+ ExpressionStatement statement=ast.newExpressionStatement(assign);
+
+ block.statements().add(statement);
+
+ jdoc = ast.newJavadoc();
+ tag = ast.newTagElement();
+
+ text = ast.newTextElement();
+
+ text.setText(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ GENERATOR_MESSAGES),
+ "_MODIFIER_DESCRIPTION",
+ new String[]{variables.get(i).getName()}));
+
+ tag.fragments().add(text);
+
+ jdoc.tags().add(tag);
+
+ method.setJavadoc(jdoc);
+
+ type.bodyDeclarations().add(method);
+ }
+ }
+
+ /**
+ * This method generates the member variables
+ * associated with the business state variables used by
+ * the conversation based actions.
+ *
+ * @param type The type declaration
+ * @param variables The list of variables
+ */
+ protected void generateMemberVariables(TypeDeclaration type,
+ java.util.List<Variable> variables) {
+ AST ast=type.getAST();
+
+ for (int i=0; i < variables.size(); i++) {
+ String memberVariableName=
+ ConversationUtil.getMemberVariableName(variables.get(i).getName());
+
+ VariableDeclarationFragment fragment=
+ ast.newVariableDeclarationFragment();
+ fragment.setName(ast.newSimpleName(memberVariableName));
+
+ FieldDeclaration memberVariable=ast.newFieldDeclaration(fragment);
+
+ Type paramType=null;
+ String typeName=TypeMapper.getJavaType(
+ variables.get(i).getType().getNamespace(),
+ variables.get(i).getType().getLocalpart());
+
+ // Check if qualified or base type
+ if (typeName.indexOf('.') == -1) {
+ paramType = ast.newPrimitiveType(PrimitiveType.toCode(typeName));
+ } else {
+ paramType = getType(ast, typeName);
+ }
+
+ memberVariable.setType(paramType);
+
+ memberVariable.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
+
+ type.bodyDeclarations().add(memberVariable);
+ }
+ }
+
+ protected Type getType(AST ast, String typeName) {
+ Type ret=null;
+
+ java.util.StringTokenizer st=new java.util.StringTokenizer(typeName, ".");
+ while (st.hasMoreTokens()) {
+ String token=st.nextToken();
+
+ if (ret == null) {
+ ret = ast.newSimpleType(ast.newSimpleName(token));
+ } else {
+ ret = ast.newQualifiedType(ret, ast.newSimpleName(token));
+ }
+ }
+
+ return(ret);
+ }
+
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/BusinessObjectTypeGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ConversationBasedGenerator.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ConversationBasedGenerator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ConversationBasedGenerator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ConversationBasedGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.scribble.conversation.model.Conversation;
+
+/**
+ * This interface represents a module that generates artefacts
+ * based on a specific conversation.
+ */
+public interface ConversationBasedGenerator {
+
+ /**
+ * This method generates the relevant artefacts based on
+ * the supplied conversation, within the specified Java project.
+ *
+ * @param jproj The Java project
+ * @param conversation The conversation
+ * @param buildSystem The build system to use
+ * @throws GeneratorException Failed to generate
+ */
+ public void generate(IJavaProject jproj,
+ Conversation conversation, BuildSystem buildSystem)
+ throws GeneratorException;
+
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ConversationBasedGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/DeploymentFileGenerator.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/DeploymentFileGenerator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/DeploymentFileGenerator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/DeploymentFileGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import java.util.logging.Logger;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBService;
+
+/**
+ * This class implements the model based generator to generate
+ * the deployment file.
+ */
+public class DeploymentFileGenerator implements ModelBasedGenerator {
+
+ /**
+ * This method generates the relevant artefacts based on
+ * the supplied model, within the specified Java project.
+ *
+ * @param jproj The Java project
+ * @param model The model
+ * @param buildSystem The build system to use
+ * @throws GeneratorException Failed to generate
+ */
+ public void generate(IJavaProject jproj,
+ ESBLanguageModel model, BuildSystem buildSystem)
+ throws GeneratorException {
+
+ try {
+ IPath deploymentPath=jproj.getPath().append(
+ new Path(buildSystem.getDeploymentFilePath()));
+
+ IFile deploymentFile=jproj.getProject().getWorkspace().getRoot().getFile(deploymentPath);
+ GeneratorUtil.createParentFolder(deploymentFile);
+ deploymentFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ StringBuffer buf=new StringBuffer();
+ buf.append("<jbossesb-deployment>\r\n");
+
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (iter.hasNext()) {
+ ESBService service=iter.next();
+
+ String dest=model.getJMSDefinition(service.getJMSBusIdRef());
+
+ if (dest != null) {
+ buf.append("\t<depends>"+service.getCategory()+
+ ".destination:service=Queue,name="+dest+
+ "</depends>\r\n");
+ } else {
+ logger.severe("Failed to find destination for JMS bus id '"+
+ service.getJMSBusIdRef()+"'");
+ }
+ }
+
+ buf.append("</jbossesb-deployment>\r\n");
+
+ deploymentFile.setContents(new java.io.ByteArrayInputStream(
+ buf.toString().getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch(Exception e) {
+ throw new GeneratorException("Failed to save deployment file", e);
+ }
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.generator");
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/DeploymentFileGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java (from rev 385, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Generator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,459 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.generator.BuildSystem;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.conversation.model.ConversationModel;
+import org.scribble.extensions.RegistryFactory;
+import org.scribble.model.*;
+import org.scribble.model.change.ModelGenerator;
+import org.scribble.conversation.model.*;
+import org.w3c.dom.Node;
+import org.eclipse.jdt.core.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+
+/**
+ * This class provides the mechanism for generating JBossESB
+ * service artefacts.
+ */
+public class Generator {
+
+ private static final String CLASSPATH_FILENAME = ".classpath";
+ private static final String OUTPUT_LOCATION = "classes";
+
+ /**
+ * This is the constructor for the generator.
+ *
+ */
+ public Generator(IFile file, BuildSystem buildSystem) {
+ m_file = file;
+ m_buildSystem = buildSystem;
+
+ initialize(m_file);
+ }
+
+ /**
+ * This method initializes the conversation model associated
+ * with the supplied file resource.
+ *
+ * @param res The file
+ */
+ protected void initialize(IFile res) {
+
+ // Initialize the artefact generators
+ m_conversationBasedGen.add(new BusinessObjectTypeGenerator());
+
+ m_modelBasedGen.add(new BuildConfigurationGenerator());
+ m_modelBasedGen.add(new JBMQConfigurationGenerator());
+ m_modelBasedGen.add(new DeploymentFileGenerator());
+
+ // Initialize the model
+ ModelReference ref=
+ org.scribble.osgi.model.OSGIModelRepository.createReference(res);
+
+ if (ref != null) {
+ ModelRepository mrep=(ModelRepository)
+ RegistryFactory.getRegistry().getExtension(
+ ModelRepository.class, null);
+
+ if (mrep != null) {
+ java.util.List<ModelInfo> models=mrep.getModels(ref,
+ new DefaultModelListener());
+
+ for (int i=0; m_conversationModel == null &&
+ i < models.size(); i++) {
+ if (models.get(i).getModel() instanceof ConversationModel) {
+ m_conversationModel = (ConversationModel)
+ models.get(i).getModel();
+
+ m_roles = m_conversationModel.getRoles();
+ }
+ }
+ }
+ }
+
+ if (m_conversationModel == null) {
+ logger.severe("Unable to load model used to generate " +
+ "the ESB artefacts");
+ }
+ }
+
+ /**
+ * This method returns the roles that can be generated.
+ *
+ * @return The roles
+ */
+ public java.util.List<Role> getRoles() {
+ return(m_roles);
+ }
+
+ /**
+ * This method generates the project associated with the
+ * supplied role.
+ *
+ * @param role The role
+ * @param projectName The project name
+ * @throws Exception Failed to generate role
+ */
+ public void generateRole(Role role, String projectName)
+ throws Exception {
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("Generate role '"+role+"' for: "+
+ m_conversationModel);
+ }
+
+ // Project to role
+ org.scribble.projector.Projector projector=
+ (org.scribble.projector.Projector)
+ RegistryFactory.getRegistry().getExtension(
+ org.scribble.projector.Projector.class, null);
+
+ if (projector != null) {
+ Model localModel=projector.project(m_conversationModel,
+ role, new DefaultModelListener());
+
+ if (localModel instanceof ConversationModel &&
+ ((ConversationModel)localModel).getConversation() != null) {
+ ConversationModel lcm=(ConversationModel)localModel;
+
+ ModelReference targetRef=
+ new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel target=
+ new DefaultESBLanguageModel(targetRef);
+
+ ModelGenerator generator=(ModelGenerator)
+ RegistryFactory.getRegistry().getExtension(
+ ModelGenerator.class, null);
+
+ if (generator != null) {
+ generator.generate(targetRef, role, target,
+ lcm);
+
+ generateRoleProject(projectName,
+ target.getESBConfiguration(),
+ lcm, target);
+ } else {
+ logger.severe("Unable to find model generator");
+ }
+ }
+ }
+ }
+
+ protected void generateRoleProject(String projectName,
+ org.w3c.dom.Element esbConfig, ConversationModel localcm,
+ ESBLanguageModel model) throws Exception {
+
+ final IJavaProject jproj=createJavaProject(projectName);
+
+ if (jproj != null && esbConfig != null) {
+ // Generate business object types for
+ // local conversation model
+ localcm.visit(new Visitor() {
+
+ public boolean visit(ModelObject obj) {
+
+ if (obj instanceof Conversation) {
+ for (int i=0; i < m_conversationBasedGen.size(); i++) {
+ try {
+ m_conversationBasedGen.get(i).generate(jproj,
+ (Conversation)obj, getBuildSystem());
+ } catch(GeneratorException e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to generate conversation based artefact",
+ e);
+ }
+ }
+ }
+
+ return true;
+ }
+ });
+
+ // Store ESB configuration
+ IPath esbConfigPath=jproj.getPath().append(
+ new Path(getBuildSystem().getESBConfigFilePath()));
+
+ IFile esbConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(esbConfigPath);
+ GeneratorUtil.createParentFolder(esbConfigFile);
+ esbConfigFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ String config=getText(esbConfig);
+
+ if (config != null) {
+ esbConfigFile.setContents(new java.io.ByteArrayInputStream(
+ config.getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+
+ for (int i=0; i < m_modelBasedGen.size(); i++) {
+ try {
+ m_modelBasedGen.get(i).generate(jproj, model,
+ getBuildSystem());
+ } catch(GeneratorException e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to generate model based artefact",
+ e);
+ }
+ }
+ }
+ }
+
+ protected IJavaProject createJavaProject(String projectName)
+ throws Exception {
+
+ // Create project
+ IProject project=m_file.getWorkspace().getRoot().getProject(projectName);
+ project.create(new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IJavaProject jproj=JavaCore.create(project);
+
+ project.open(new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IProjectDescription description = jproj.getProject().getDescription();
+
+ // Update the project natures to include Java Nature
+ String[] prevNatures= description.getNatureIds();
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= JavaCore.NATURE_ID;
+ description.setNatureIds(newNatures);
+
+ // Setup project reference to CDM project
+ IProject[] prevProjects=description.getReferencedProjects();
+ IProject[] newProjects=new IProject[prevProjects.length+1];
+ System.arraycopy(prevProjects, 0, newProjects, 0, prevProjects.length);
+ newProjects[prevProjects.length] = m_file.getProject();
+ description.setReferencedProjects(newProjects);
+
+ // Set the description
+ jproj.getProject().setDescription(description,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IPath outputLocation=jproj.getPath().append(new Path(OUTPUT_LOCATION));
+ IPath classpathLocation=jproj.getPath().append(new Path(CLASSPATH_FILENAME));
+ IPath sourceLocation=jproj.getPath().append(
+ new Path(getBuildSystem().getJavaSourcePath()));
+ IPath libLocation=null;
+
+ if (getBuildSystem().getLibraryPath() != null) {
+ libLocation=jproj.getPath().append(new Path(getBuildSystem().getLibraryPath()));
+ }
+
+ // create and set the output and source paths first
+ IFolder outputFolder= jproj.getProject().getWorkspace().getRoot().getFolder(outputLocation);
+ GeneratorUtil.createParentFolder(outputFolder);
+ outputFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ outputFolder.setDerived(true);
+
+ IFolder sourceFolder= jproj.getProject().getWorkspace().getRoot().getFolder(sourceLocation);
+ GeneratorUtil.createParentFolder(sourceFolder);
+ sourceFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ sourceFolder.setDerived(true);
+
+ if (libLocation != null) {
+ IFolder libFolder= jproj.getProject().getWorkspace().getRoot().getFolder(libLocation);
+ GeneratorUtil.createParentFolder(libFolder);
+ libFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ libFolder.setDerived(true);
+ }
+
+ IFile file=jproj.getProject().getWorkspace().getRoot().getFile(classpathLocation);
+ file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ file.setDerived(true);
+
+ // Write empty contents, to overcome 'Resource '..' is not local' exception
+ String classpath="<classpath/>";
+ file.setContents(new java.io.ByteArrayInputStream(classpath.getBytes()), true,
+ false, new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IClasspathEntry[] classpaths=new IClasspathEntry[2];
+
+ classpaths[0] = JavaCore.newContainerEntry(
+ new Path("org.eclipse.jdt.launching.JRE_CONTAINER"));
+
+ classpaths[1] = JavaCore.newSourceEntry(sourceLocation);
+
+ jproj.setRawClasspath(classpaths, outputLocation,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ return(jproj);
+ }
+
+ /**
+ * This class converts a DOM representation node to
+ * text.
+ *
+ * @param node The DOM node
+ * @return The text
+ * @throws Exception Failed to convert
+ */
+ protected String getText(Node node) throws Exception {
+ String ret=null;
+
+ try {
+ // Transform the DOM represent to text
+ java.io.ByteArrayOutputStream xmlstr=
+ new java.io.ByteArrayOutputStream();
+
+ DOMSource source=new DOMSource();
+ source.setNode(node);
+
+ StreamResult result=new StreamResult(xmlstr);
+
+ Transformer trans=
+ TransformerFactory.newInstance().newTransformer();
+ trans.transform(source, result);
+
+ xmlstr.close();
+
+ ret = new String(xmlstr.toByteArray());
+
+ if ((node instanceof org.w3c.dom.Document) == false) {
+
+ // Strip off any <?xml> header
+ int index=ret.indexOf("<?xml");
+ if (index != -1) {
+ index = ret.indexOf("<", 1);
+
+ if (index != -1) {
+ ret = ret.substring(index);
+ } else {
+ index = ret.indexOf("?>");
+
+ if (index != -1) {
+ index += 2;
+
+ // Remove any trailing whitespaces
+ // after XML header
+ while (index < ret.length() &&
+ Character.isWhitespace(ret.charAt(index))) {
+ index++;
+ }
+
+ ret = ret.substring(index);
+ }
+ }
+ }
+ }
+
+ } catch(Exception e) {
+ throw new Exception("Failed to transform " +
+ "DOM representation into text", e);
+ }
+
+ int pos=0;
+ int prevpos=0;
+ StringBuffer buf=new StringBuffer();
+ int level=0;
+
+ while ((pos=ret.indexOf('<', prevpos)) != -1) {
+
+ if (prevpos < pos &&
+ ret.substring(prevpos, pos).trim().length() > 0 &&
+ ret.charAt(prevpos-1) != '?') {
+
+ if (ret.charAt(prevpos) == '\r' &&
+ ret.charAt(prevpos+1) == '\n') {
+ prevpos += 2;
+ }
+ for (int i=0; i < level; i++) {
+ buf.append(" ");
+ }
+
+ buf.append(ret.substring(prevpos, pos).trim());
+ buf.append("\r\n");
+ }
+
+ int endpos=ret.indexOf('>', pos);
+
+ if (endpos > 0) {
+ boolean noreturn=false;
+
+ if (pos > 0 && ret.charAt(pos+1) == '/') {
+ level--;
+ }
+
+ for (int i=0; i < level; i++) {
+ buf.append(" ");
+ }
+ buf.append(ret.substring(pos, endpos+1));
+
+ if (ret.charAt(endpos-1)== '?') {
+ //noreturn = true;
+
+ } else if (ret.charAt(endpos-1) == '/') {
+ // Ignore
+ } else if (pos > 0 && ret.charAt(pos+1) == '/') {
+ // Ignore
+
+ } else if (pos > 0 && ret.charAt(pos+1) == '!') {
+ // Ignore
+
+ } else {
+ level++;
+ }
+
+ if (noreturn == false) {
+ buf.append("\r\n");
+ }
+
+ pos = endpos+1;
+ }
+
+ prevpos = pos;
+ }
+
+ if (prevpos != -1 &&
+ ret.substring(prevpos).trim().length() > 0) {
+ buf.append(ret.substring(prevpos));
+ }
+
+ ret = buf.toString();
+
+ return(ret);
+ }
+
+ public BuildSystem getBuildSystem() {
+ return(m_buildSystem);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.generator");
+
+ private IFile m_file=null;
+ private java.util.List<Role> m_roles=null;
+ private ConversationModel m_conversationModel=null;
+ private BuildSystem m_buildSystem=null;
+ private java.util.List<ConversationBasedGenerator> m_conversationBasedGen=
+ new java.util.Vector<ConversationBasedGenerator>();
+ private java.util.List<ModelBasedGenerator> m_modelBasedGen=
+ new java.util.Vector<ModelBasedGenerator>();
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorException.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorException.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorException.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorException.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+public class GeneratorException extends Exception {
+
+ private static final long serialVersionUID = -2263049447116467663L;
+
+ /**
+ * This constructor initializes the generator exception
+ * with a message and the underlying exception that
+ * caused the problem.
+ *
+ * @param mesg The message
+ * @param t The cause
+ */
+ public GeneratorException(String mesg, Throwable t) {
+ super(mesg, t);
+ }
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorException.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorUtil.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/GeneratorUtil.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorUtil.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * This class provides general utility functions for
+ * use when generating artefacts.
+ */
+public class GeneratorUtil {
+
+ /**
+ * This method checks whether the parent folder exists,
+ * and if not attempts to create it.
+ *
+ * @param res The current resource
+ */
+ public static void createParentFolder(IResource res) {
+
+ if (res.getParent() instanceof IFolder) {
+ IFolder parent=(IFolder)res.getParent();
+
+ if (parent.exists() == false) {
+ createParentFolder(parent);
+
+ try {
+ parent.create(true, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorUtil.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/JBMQConfigurationGenerator.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/JBMQConfigurationGenerator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/JBMQConfigurationGenerator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/JBMQConfigurationGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import java.util.logging.Logger;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBService;
+
+/**
+ * This class implements the model based generator to generate
+ * the JBMQ configuration.
+ */
+public class JBMQConfigurationGenerator implements ModelBasedGenerator {
+
+ /**
+ * This method generates the relevant artefacts based on
+ * the supplied model, within the specified Java project.
+ *
+ * @param jproj The Java project
+ * @param model The model
+ * @param buildSystem The build system to use
+ * @throws GeneratorException Failed to generate
+ */
+ public void generate(IJavaProject jproj,
+ ESBLanguageModel model, BuildSystem buildSystem)
+ throws GeneratorException {
+ IPath buildConfigPath=jproj.getPath().append(
+ new Path(buildSystem.getJBMQConfigFilePath()));
+
+ IFile jbmqConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(buildConfigPath);
+ GeneratorUtil.createParentFolder(jbmqConfigFile);
+
+ try {
+ jbmqConfigFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ StringBuffer buf=new StringBuffer();
+ buf.append("<server>\r\n");
+
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (iter.hasNext()) {
+ ESBService service=iter.next();
+
+ String dest=model.getJMSDefinition(service.getJMSBusIdRef());
+
+ if (dest != null) {
+ buf.append("\t<mbean code=\"org.jboss.mq.server.jmx.Queue\"\r\n");
+ buf.append("\t\t\tname=\""+service.getCategory()+".destination:service=Queue,name="+dest+"\">\r\n");
+ buf.append("\t\t<depends optional-attribute-name=\"DestinationManager\">\r\n");
+ buf.append("\t\t\tjboss.mq:service=DestinationManager\r\n");
+ buf.append("\t\t</depends>\r\n");
+ buf.append("\t</mbean>\r\n");
+ } else {
+ logger.severe("Failed to find destination for JMS bus id '"+
+ service.getJMSBusIdRef()+"'");
+ }
+ }
+
+ buf.append("</server>\r\n");
+
+ jbmqConfigFile.setContents(new java.io.ByteArrayInputStream(
+ buf.toString().getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch(Exception e) {
+ throw new GeneratorException("Failed to save JBMQ configuration", e);
+ }
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.generator");
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/JBMQConfigurationGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/MavenBuildSystem.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/MavenBuildSystem.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/MavenBuildSystem.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/MavenBuildSystem.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+/**
+ * This class represents the Ant build system.
+ */
+public class MavenBuildSystem extends AbstractBuildSystem {
+
+ private static final String BUILD_FILE = "pom.xml";
+ private static final String MAVEN = "Maven";
+ private static final String ESB_CONFIG_PATH = "src/main/resources/META-INF/jboss-esb.xml";
+ private static final String DEPLOYMENT_PATH = "src/main/resources/META-INF/deployment.xml";
+ private static final String JBMQ_CONFIG_PATH = "src/main/resources/jbmq-queue-service.xml";
+ private static final String JAVA_SOURCE_PATH = "src/main/java";
+ private static final String LIBRARY_PATH = null;
+
+ /**
+ * This method represents the name of the build
+ * system.
+ *
+ * @return The name
+ */
+ public String getName() {
+ return(MAVEN);
+ }
+
+ /**
+ * This method returns the build configuration file
+ * path.
+ *
+ * @return The build configuration file path
+ */
+ public String getBuildFilePath() {
+ return(BUILD_FILE);
+ }
+
+ /**
+ * This method returns the ESB configuration file
+ * path.
+ *
+ * @return The ESB configuration file path
+ */
+ public String getESBConfigFilePath() {
+ return(ESB_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the deployment file
+ * path.
+ *
+ * @return The deployment file path
+ */
+ public String getDeploymentFilePath() {
+ return(DEPLOYMENT_PATH);
+ }
+
+ /**
+ * This method returns the JBMQ configuration file
+ * path.
+ *
+ * @return The JBMQ configuration file path
+ */
+ public String getJBMQConfigFilePath() {
+ return(JBMQ_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the Java source path.
+ *
+ * @return The Java source path
+ */
+ public String getJavaSourcePath() {
+ return(JAVA_SOURCE_PATH);
+ }
+
+ /**
+ * This method returns the library path.
+ *
+ * @return The library path
+ */
+ public String getLibraryPath() {
+ return(LIBRARY_PATH);
+ }
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Messages.properties (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/Messages.properties)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Messages.properties (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Messages.properties 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,20 @@
+# /*
+# * JBoss, Home of Professional Open Source
+# * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+# * by the @authors tag. All rights reserved.
+# * See the copyright.txt in the distribution for a
+# * full listing of individual contributors.
+# * This copyrighted material is made available to anyone wishing to use,
+# * modify, copy, or redistribute it subject to the terms and conditions
+# * of the GNU Lesser General Public License, v. 2.1.
+# * This program is distributed in the hope that it will be useful, but WITHOUT A
+# * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+# * You should have received a copy of the GNU Lesser General Public License,
+# * v.2.1 along with this distribution; if not, write to the Free Software
+# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# * MA 02110-1301, USA.
+# */
+
+_ACCESSOR_DESCRIPTION=The accessor method for variable '{0}'.
+_MODIFIER_DESCRIPTION=The modifier method for variable '{0}'.
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Messages.properties
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ModelBasedGenerator.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/ModelBasedGenerator.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ModelBasedGenerator.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ModelBasedGenerator.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+
+/**
+ * This interface represents a module that generates artefacts
+ * based on the complete model.
+ */
+public interface ModelBasedGenerator {
+
+ /**
+ * This method generates the relevant artefacts based on
+ * the supplied model, within the specified Java project.
+ *
+ * @param jproj The Java project
+ * @param model The model
+ * @param buildSystem The build system to use
+ * @throws GeneratorException Failed to generate
+ */
+ public void generate(IJavaProject jproj,
+ ESBLanguageModel model, BuildSystem buildSystem)
+ throws GeneratorException;
+
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/ModelBasedGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapper.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/TypeMapper.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapper.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapper.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
+
+public class TypeMapper {
+
+ private static final String BOOLEAN_TYPE = "boolean";
+ private static final String STRING_TYPE = "string";
+ private static final String DECIMAL_TYPE = "decimal";
+ private static final String INTEGER_TYPE = "integer";
+ private static final String INT_TYPE = "int";
+ public static final String JAVA_PREFIX = "java:";
+ public static final String XSD_NAMESPACE = "http://www.w3.org/2001/XMLSchema";
+
+ /**
+ * This method determines the appropriate Java type associated
+ * with the supplied type namespace and localpart.
+ *
+ * @param namespace The namespace
+ * @param localpart The local part
+ * @return The Java type
+ */
+ public static String getJavaType(String namespace, String localpart) {
+ String ret=org.w3c.dom.Element.class.getName();
+
+ if (namespace != null && localpart != null) {
+
+ if (namespace.startsWith(JAVA_PREFIX)) {
+ ret = namespace.substring(JAVA_PREFIX.length())
+ +"."+localpart;
+ } else if (namespace.equals(XSD_NAMESPACE)) {
+
+ if (localpart.equals(STRING_TYPE)) {
+ ret = String.class.getName();
+ } else if (localpart.equals(DECIMAL_TYPE) ||
+ localpart.equals(INTEGER_TYPE)) {
+ ret = INT_TYPE;
+ } else if (localpart.equals(BOOLEAN_TYPE)) {
+ ret = BOOLEAN_TYPE;
+ }
+ }
+ }
+
+ return(ret);
+ }
+}
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapper.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/template (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/generator/template)
Property changes on: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/template
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ConversionContext.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ConversionContext.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ConversionContext.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ConversionContext.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ * 25 Jun 2008 : Initial version created by gary
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+public interface ConversionContext {
+
+ /**
+ * This method returns the role associated with the
+ * endpoint being converted.
+ *
+ *@return The role
+ */
+ public String getRole();
+
+ /**
+ * This method is invoked when an ESB service is being processed.
+ *
+ * @param service The service
+ */
+ public void processing(ESBService service);
+
+ /**
+ * This method is invoked when an ESB service has been processed.
+ *
+ * @param service The service
+ */
+ public void processed(ESBService service);
+
+ /**
+ * Push service on the stack of services in which the current
+ * context is contained.
+ *
+ * @param service The service
+ */
+ public void push(ESBService service);
+
+ /**
+ * Pop service from the stack of services in which the current
+ * context is contained.
+ *
+ * @param service The service
+ */
+ public void pop(ESBService service);
+
+ /**
+ * This method determines whether the supplied service is on
+ * the stack of services in which the current context is
+ * contained.
+ *
+ * @param service The service
+ * @return Whether the service is on the stack
+ */
+ public boolean isOnStack(ESBService service);
+
+ /**
+ * This method marks an ESB service as being a join state.
+ *
+ * @param service The service
+ */
+ public void markJoin(ESBService service);
+
+ /**
+ * This method determines whether the ESB service is a join
+ * state.
+ *
+ * @param service The serviice
+ * @return Whether the service is a join state
+ */
+ public boolean isJoin(ESBService service);
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContext.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContext.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContext.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContext.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,129 @@
+/*
+ * 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:
+ * 25 Jun 2008 : Initial version created by gary
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.logging.Logger;
+
+public class DefaultConversionContext implements ConversionContext {
+
+ /**
+ * This constructor initializes the role associated with
+ * the conversion.
+ *
+ * @param role The role
+ */
+ public DefaultConversionContext(String role) {
+ m_role = role;
+ }
+
+ /**
+ * This method returns the role associated with the
+ * endpoint being converted.
+ *
+ *@return The role
+ */
+ public String getRole() {
+ return(m_role);
+ }
+
+ /**
+ * This method is invoked when an ESB service is being processed.
+ *
+ * @param service The service
+ */
+ public void processing(ESBService service) {
+ m_joins.remove(service);
+ }
+
+ /**
+ * This method is invoked when an ESB service has been processed.
+ *
+ * @param service The service
+ */
+ public void processed(ESBService service) {
+
+ }
+
+ /**
+ * Push service on the stack of services in which the current
+ * context is contained.
+ *
+ * @param service The service
+ */
+ public void push(ESBService service) {
+ m_serviceStack.add(service);
+ }
+
+ /**
+ * Pop service from the stack of services in which the current
+ * context is contained.
+ *
+ * @param service The service
+ */
+ public void pop(ESBService service) {
+
+ // Check if the service is the last element on the stack
+ if (m_serviceStack.size() == 0 ||
+ m_serviceStack.get(m_serviceStack.size()-1) != service) {
+ logger.severe("Request to pop service '"+service+
+ "' that is not the most recent entry on the stack");
+ }
+
+ m_serviceStack.remove(service);
+ }
+
+ /**
+ * This method determines whether the supplied service is on
+ * the stack of services in which the current context is
+ * contained.
+ *
+ * @param service The service
+ * @return Whether the service is on the stack
+ */
+ public boolean isOnStack(ESBService service) {
+ return(m_serviceStack.contains(service));
+ }
+
+ /**
+ * This method marks an ESB service as being a join state.
+ *
+ * @param service The service
+ */
+ public void markJoin(ESBService service) {
+ m_joins.add(service);
+ }
+
+ /**
+ * This method determines whether the ESB service is a join
+ * state.
+ *
+ * @param service The service
+ * @return Whether the service is a join state
+ */
+ public boolean isJoin(ESBService service) {
+ return(m_joins.contains(service));
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model");
+
+ private java.util.List<ESBService> m_serviceStack=new java.util.Vector<ESBService>();
+ private java.util.List<ESBService> m_joins=new java.util.Vector<ESBService>();
+ private String m_role=null;
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModel.java (from rev 327, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModel.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModel.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModel.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,689 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.logging.Logger;
+
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryFactory;
+import org.scribble.model.*;
+import org.scribble.model.resolutions.*;
+
+/**
+ * This class represents an ESB model.
+ *
+ * @author gary
+ */
+public class DefaultESBLanguageModel extends org.scribble.lang.model.LanguageModel
+ implements ESBLanguageModel {
+
+ private static final String SERVICE_NAME_SEPARATOR = "__";
+ public static final String DEST_NAME_PREFIX = "queue/";
+ public static final String DEST_NAME_ATTR = "dest-name";
+ public static final String DEST_TYPE_VALUE = "QUEUE";
+ public static final String DEST_TYPE_ATTR = "dest-type";
+ public static final String JMS_MESSAGE_FILTER_ELEMENT = "jms-message-filter";
+ public static final String JMS_BUS_ELEMENT = "jms-bus";
+ public static final String BUSID_ATTR = "busid";
+ public static final String JBOSSESB_XML_NAMESPACE = "http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml...";
+ public static final String XMLNS = "xmlns";
+ public static final String TOP_LEVEL_ELEMENT = "jbossesb";
+ public static final String PARAMETER_RELOAD_SECS_ATTR = "parameterReloadSecs";
+ public static final String PROVIDERS_ELEMENT = "providers";
+ public static final String JMS_PROVIDER_ELEMENT = "jms-provider";
+ public static final String JAVA_NOTATION = "java";
+ public static final String SERVICE_ELEMENT = "service";
+ public static final String SERVICES_ELEMENT = "services";
+
+ public static final String JBOSSESB_NOTATION = "jboss-esb.xml";
+
+ /**
+ * This constructor is initialized with the ESB configuration.
+ *
+ * @param source The model reference for the JBossESB configuration source
+ * @param elem The ESB configuration
+ * @param contents The textual contents
+ */
+ public DefaultESBLanguageModel(ModelReference source, org.w3c.dom.Element elem,
+ String contents) {
+ m_source = source;
+ m_esbConfig = elem;
+ m_contents = contents;
+
+ // Extract service action pipelines
+ initializeExistingConfig();
+ }
+
+ /**
+ * This constructor initializes a new ESB configuration.
+ *
+ * @param source The model reference for the JBossESB configuration
+ */
+ public DefaultESBLanguageModel(ModelReference source) {
+ m_source = source;
+
+ initializeNewConfig();
+ }
+
+ /**
+ * This method creates a new ESB configuration.
+ */
+ protected void initializeNewConfig() {
+
+ org.w3c.dom.Document doc=null;
+
+ // Create an empty document
+ try {
+ doc = javax.xml.parsers.DocumentBuilderFactory.
+ newInstance().newDocumentBuilder().newDocument();
+
+ m_esbConfig = doc.createElement(TOP_LEVEL_ELEMENT);
+
+ m_esbConfig.setAttribute(XMLNS,
+ JBOSSESB_XML_NAMESPACE);
+ m_esbConfig.setAttribute(PARAMETER_RELOAD_SECS_ATTR,"5000");
+
+ doc.appendChild(m_esbConfig);
+
+ // Create provider information
+ org.w3c.dom.Element providers=doc.createElement(PROVIDERS_ELEMENT);
+ m_esbConfig.appendChild(providers);
+
+ m_jmsProviderElem = doc.createElement(JMS_PROVIDER_ELEMENT);
+ providers.appendChild(m_jmsProviderElem);
+
+ // Configure the jms provider
+ m_jmsProviderElem.setAttribute("name", "JBossMQ");
+ m_jmsProviderElem.setAttribute("connection-factory", "ConnectionFactory");
+ m_jmsProviderElem.setAttribute("jndi-context-factory", "org.jnp.interfaces.NamingContextFactory");
+ m_jmsProviderElem.setAttribute("jndi-URL", "localhost");
+
+ // Create services element
+ m_servicesElem = doc.createElement(SERVICES_ELEMENT);
+ m_esbConfig.appendChild(m_servicesElem);
+
+ } catch(Exception e) {
+ logger.severe("Failed to create initial jbossesb document: "+e);
+ }
+
+ }
+
+ /**
+ * This method initializes the ESB Model.
+ */
+ protected void initializeExistingConfig() {
+ org.w3c.dom.NodeList services=
+ m_esbConfig.getElementsByTagName(SERVICES_ELEMENT);
+
+ org.scribble.model.DependencyManager dm=
+ (org.scribble.model.DependencyManager)
+ org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
+ org.scribble.model.DependencyManager.class, null);
+
+ ModelName mname=new ModelName();
+ mname.setName(m_source.getLocalpart());
+
+ setModelName(mname);
+
+ Namespace ns=new Namespace();
+ ns.setName(m_source.getNamespace());
+ setNamespace(ns);
+
+ if (services != null && services.getLength() == 1 &&
+ services.item(0) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.NodeList nl=((org.w3c.dom.Element)
+ services.item(0)).getChildNodes();
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(SERVICE_ELEMENT)) {
+
+ ESBService service=new DefaultESBService(this,
+ (org.w3c.dom.Element)nl.item(i));
+ String key=getKey(service.getCategory(),
+ service.getName());
+
+ m_services.put(key, service);
+ }
+ }
+
+ java.util.Iterator<ESBService> iter=m_services.values().iterator();
+
+ while (iter.hasNext()) {
+ iter.next().initializeLinks();
+ }
+
+ // Initialize the conversations
+ java.util.List<String> sessionClasses=new java.util.Vector<String>();
+ java.util.Iterator<ESBService> serviter=getServices().iterator();
+
+ while (serviter.hasNext()) {
+ ESBService service=serviter.next();
+
+ if (service.isRoot()) {
+
+ /*
+ String convType=service.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(ConversationModel.CONVERSATION);
+ //ConformanceReference iref=
+ // new ConformanceReference(ConversationModel.CONVERSATION);
+
+ role = convType.substring(index+1);
+
+ iref.setLocatedRole(role);
+
+ // Need to locate the model name
+ modelName.setLocatedRole(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));
+ }
+
+ conv.getImplements().add(iref);
+ //conv.getConformsTo().add(iref);
+
+ dm.recordDependency(m_source, iref,
+ DependencyType.Implements);
+
+ } else {
+ logger.warning("Conversation type does not " +
+ "contain '@' located role separator");
+ }
+ } else {
+ logger.warning("No conversation type specified");
+ }
+
+ conv.setBlock(new Block());
+
+ service.convert(conv.getBlock().getContents(),
+ new DefaultConversionContext(role));
+
+ */
+
+ Conversation conv=service.convert(null);
+
+ if (conv != null) {
+ getConversations().add(conv);
+ }
+ }
+
+ //Add session class to list
+ String sessionClass=service.getSessionName();
+
+ if (sessionClass != null &&
+ sessionClasses.contains(sessionClass) == false) {
+ sessionClasses.add(sessionClass);
+ }
+ }
+
+ // Add dependency on session classes
+ for (int i=0; i < sessionClasses.size(); i++) {
+ String sessionClass=sessionClasses.get(i);
+ int index=sessionClass.lastIndexOf('.');
+ String nspace="";
+ String local=sessionClass;
+
+ if (index != -1) {
+ nspace = sessionClass.substring(0, index);
+ local = sessionClass.substring(index+1);
+
+ dm.recordDependency(getModelReference(),
+ new ModelReference(nspace, local,
+ null, JAVA_NOTATION),
+ DependencyType.Uses);
+ }
+ }
+ }
+
+ if (logger.isLoggable(java.util.logging.Level.FINEST)) {
+
+ org.scribble.export.Exporter exporter=
+ (org.scribble.export.Exporter)
+ RegistryFactory.getRegistry().getExtension(
+ org.scribble.export.Exporter.class, null);
+
+ try {
+ for (int i=0; i < getConversations().size(); i++) {
+ ConversationModel model=new ConversationModel();
+ Conversation conv=getConversations().get(i);
+ ModelObject parent=conv.getParent();
+
+ // This command will overwrite the parent of
+ // the conversation, so need to set this back
+ // at the end
+ model.setConversation(conv);
+
+ org.scribble.export.text.TextFormatter formatter=
+ new org.scribble.export.text.TextFormatter();
+
+ java.io.ByteArrayOutputStream os=
+ new java.io.ByteArrayOutputStream();
+
+ formatter.setOutputStream(os);
+
+ exporter.export(model, formatter);
+
+ String str=new String(os.toByteArray());
+
+ System.out.println("EXPORTED JBOSS-ESB TEXT:");
+ System.out.println(str);
+
+ // Re-establish the true parent
+ conv.setParent(parent);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public String getNotation() {
+ return(JBOSSESB_NOTATION);
+ }
+
+ /**
+ * 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) {
+
+ java.util.Iterator<ESBService> iter=m_services.values().iterator();
+
+ while (iter.hasNext()) {
+ ESBService service=iter.next();
+
+ service.validate(l);
+ }
+ }
+
+ /**
+ * This method returns the ESB service for the supplied
+ * category and name.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @return The ESB service, or null if not found
+ */
+ public ESBService getService(String category, String name) {
+ return(m_services.get(getKey(category, name)));
+ }
+
+ /**
+ * This method returns the collection of ESB services associated
+ * with the model.
+ *
+ * @return The collection of ESB services
+ */
+ public java.util.Collection<ESBService> getServices() {
+ return(m_services.values());
+ }
+
+ /**
+ * This method creates a new ESB service.
+ *
+ * @param category The category
+ * @param name The name
+ * @return The new ESB service
+ */
+ public ESBService createService(String category, String name) {
+ return(new DefaultESBService(this, category, name));
+ }
+
+ /**
+ * This method adds a new service to the model.
+ *
+ * @param service The service
+ */
+ public void addService(ESBService service) {
+ m_services.put(getKey(service.getCategory(), service.getName()),
+ service);
+
+ // Add service
+ if (service.getService() != null) {
+ m_servicesElem.appendChild(service.getService());
+ }
+
+ // Add provider information
+ String busId=service.getJMSBusIdRef();
+
+ // Check if busId is unique
+ if (busId == null || findJMSBus(busId) != null) {
+ busId = getUniqueBusId();
+ service.setJMSBusIdRef(busId);
+ }
+
+ if (busId != null) {
+ addJMSBus(busId, getJMSDestination(service.getCategory(),
+ service.getName()));
+ } else {
+ logger.severe("Service '"+service+
+ "' does not have a bus Id");
+ }
+ }
+
+ protected String getUniqueBusId() {
+ int index=1;
+ String ret="busId"+index;
+
+ while (findJMSBus(ret) != null) {
+ index++;
+ ret = "busId"+index;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the JMS destination associated with
+ * the supplied JMS Bus Id.
+ *
+ * @param jmsBusId The JMS bus id
+ * @return The JMS definition, or null if not found
+ */
+ public String getJMSDefinition(String jmsBusId) {
+ String ret=null;
+
+ org.w3c.dom.Element elem=findJMSBus(jmsBusId);
+
+ if (elem != null) {
+ org.w3c.dom.NodeList nl=
+ elem.getElementsByTagName(JMS_MESSAGE_FILTER_ELEMENT);
+
+ if (nl.getLength() != 0 &&
+ nl.item(0) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element filter=(org.w3c.dom.Element)
+ nl.item(0);
+
+ if (filter.hasAttribute(DEST_NAME_ATTR)) {
+ ret = filter.getAttribute(DEST_NAME_ATTR);
+
+ // If prefixed, then strip prefix away
+ if (ret.startsWith(DEST_NAME_PREFIX)) {
+ ret = ret.substring(DEST_NAME_PREFIX.length());
+ }
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ protected void addJMSBus(String jmsBusId, String dest) {
+
+ org.w3c.dom.Element jmsBus=
+ m_esbConfig.getOwnerDocument().createElement(JMS_BUS_ELEMENT);
+ m_jmsProviderElem.appendChild(jmsBus);
+
+ jmsBus.setAttribute(BUSID_ATTR, jmsBusId);
+
+ org.w3c.dom.Element mesgFilter=
+ m_esbConfig.getOwnerDocument().createElement(JMS_MESSAGE_FILTER_ELEMENT);
+ jmsBus.appendChild(mesgFilter);
+
+ mesgFilter.setAttribute(DEST_TYPE_ATTR, DEST_TYPE_VALUE);
+ mesgFilter.setAttribute(DEST_NAME_ATTR, DEST_NAME_PREFIX+dest);
+ }
+
+ protected org.w3c.dom.Element findJMSBus(String jmsBusId) {
+ org.w3c.dom.Element ret=null;
+
+ org.w3c.dom.NodeList nl=m_jmsProviderElem.getChildNodes();
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(JMS_BUS_ELEMENT) &&
+ ((org.w3c.dom.Element)nl.item(i)).
+ getAttribute(BUSID_ATTR).equals(jmsBusId)) {
+ ret = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+
+ return(ret);
+ }
+
+ protected void removeJMSBus(String jmsBusId) {
+ org.w3c.dom.Element bus=findJMSBus(jmsBusId);
+
+ if (bus != null) {
+ m_jmsProviderElem.removeChild(bus);
+ } else {
+ logger.severe("Remove JMS bus '"+jmsBusId+
+ "' failed, unable to find bus");
+ }
+ }
+
+ protected String getJMSDestination(String category, String name) {
+ String ret=category.replace('.', '_');
+
+ ret += "_"+name;
+
+ return(ret);
+ }
+
+ /**
+ * This method removes a service from the model.
+ *
+ * @param service The service
+ */
+ public void removeService(ESBService service) {
+ m_services.remove(getKey(service.getCategory(),
+ service.getName()));
+
+ // Remove provider information
+ String busId=service.getJMSBusIdRef();
+
+ if (busId != null) {
+ removeJMSBus(busId);
+ } else {
+ logger.severe("Service '"+service+
+ "' does not have a bus Id");
+ }
+ }
+
+ /**
+ * This textual contents of the model.
+ *
+ * @return The textual contents
+ */
+ public String getOriginalContents() {
+ return(m_contents);
+ }
+
+ /**
+ * This method returns a unique service name within
+ * the supplied category.
+ *
+ * @param category The category
+ * @param currentServiceName The name of the service creating
+ * the new service
+ * @return The unique service name
+ */
+ public String getUniqueServiceName(String category, String currentServiceName) {
+ String ret=null;
+
+ int index=currentServiceName.indexOf(SERVICE_NAME_SEPARATOR);
+ if (index != -1) {
+ currentServiceName = currentServiceName.substring(0, index);
+ }
+
+ index = 0;
+ do {
+ index++;
+ ret = currentServiceName+SERVICE_NAME_SEPARATOR+index;
+ } while(getService(category, ret) != null);
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the gateway service.
+ *
+ * @return The gateway service, or null if not found
+ */
+ public ESBService getGatewayService() {
+ ESBService ret=null;
+
+ java.util.Iterator<ESBService> iter=getServices().iterator();
+ while (ret == null && iter.hasNext()) {
+ ret = iter.next();
+
+ if (ret.isGateway() == false) {
+ ret = null;
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the reference to the DOM
+ * representation of the ESB configuration.
+ *
+ * @return The ESB configuration
+ */
+ public org.w3c.dom.Element getESBConfiguration() {
+ return(m_esbConfig);
+ }
+
+ /**
+ * This method returns a custom classloader that uses the project's
+ * classpath to locate classes referenced by the ESB config file.
+ *
+ * @see http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg17769.html
+ *
+ * @return The classloader
+ * @throws Exception Failed to obtain the classloader
+ */
+ public synchronized ClassLoader getModelClassLoader() throws Exception {
+
+ if (m_classLoader == null) {
+ m_classLoader = org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ClasspathUtil.createClassLoader(getModelReference());
+ }
+
+ return(m_classLoader);
+ }
+
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model");
+
+ private ModelReference m_source=null;
+ private org.w3c.dom.Element m_esbConfig=null;
+ private org.w3c.dom.Element m_jmsProviderElem=null;
+ private org.w3c.dom.Element m_servicesElem=null;
+ private String m_contents=null;
+ private java.util.Map<String,ESBService> m_services=new java.util.Hashtable<String,ESBService>();
+ private ClassLoader m_classLoader=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;
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java (from rev 329, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBService.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,848 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ESBModelUtil;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * This class represents an ESB service.
+ *
+ * @author gary
+ */
+public class DefaultESBService extends ModelObject implements ESBService {
+
+ public static final String LISTENERS_ELEMENT = "listeners";
+ public static final String BUSIDREF_ATTR = "busidref";
+ public static final String JMS_LISTENER_ELEMENT = "jms-listener";
+ public static final String MAX_THREADS_ATTR = "maxThreads";
+ public static final String NAME_ATTR = "name";
+ public static final String CATEGORY_ATTR = "category";
+ public static final String ROOT_PROPERTY = "root";
+ public static final String BUSINESS_OBJECT_TYPE_PROPERTY = "session";
+ public static final String CONVERSATION_TYPE_PROPERTY = "conversationType";
+ public static final String SERVICE_DESCRIPTION_NAME_PROPERTY = "serviceDescriptionName";
+ public static final String SERVICE_ANNOTATION = "org.jboss.soa.overlord.jbossesb.actions.Service";
+ public static final String SERVICE_ELEMENT = "service";
+ public static final String RETRIEVE_SESSION_ACTION_CLASS = "org.jboss.soa.overlord.jbossesb.actions.RetrieveSessionAction";
+ public static final String ACTION_ELEMENT = "action";
+ public static final String ACTIONS_ELEMENT = "actions";
+
+ /**
+ * This is the constructor for the ESB service. This construct
+ * creates a new DOM element, contained within the supplied
+ * model, to represent the service associated with the
+ * supplied category and name.
+ *
+ * @param model The ESB model in which the service has been defined
+ * @param service The XML configuration of the service
+ */
+ public DefaultESBService(ESBLanguageModel model,
+ String category, String name) {
+ m_model = model;
+
+ // Create new element for the service
+ initializeNewServiceElement(category, name);
+ }
+
+ /**
+ * This is the constructor for the ESB service. This construct
+ * creates a wrapper around the supplied DOM representation of
+ * the existing service element within an ESB configuration.
+ *
+ * @param model The ESB model in which the service has been defined
+ * @param service The XML configuration of the service
+ */
+ public DefaultESBService(ESBLanguageModel model, org.w3c.dom.Element service) {
+ m_model = model;
+ m_service = service;
+
+ if (m_model != null && m_service != null) {
+ initializeExistingServiceElement();
+ }
+ }
+
+ protected void initializeNewServiceElement(String category, String name) {
+
+ m_service = m_model.getESBConfiguration().
+ getOwnerDocument().createElement(SERVICE_ELEMENT);
+
+ m_service.setAttribute(CATEGORY_ATTR, category);
+ m_service.setAttribute(NAME_ATTR, name);
+
+ m_actionsElem = m_model.getESBConfiguration().
+ getOwnerDocument().createElement(ACTIONS_ELEMENT);
+ m_service.appendChild(m_actionsElem);
+ }
+
+ /**
+ * This method initializes the service.
+ */
+ protected void initializeExistingServiceElement() {
+ // Check if relevant action
+ org.w3c.dom.NodeList actions=m_service.getElementsByTagName(ACTIONS_ELEMENT);
+
+ if (actions != null && actions.getLength() == 1 &&
+ actions.item(0) instanceof org.w3c.dom.Element) {
+
+ m_actionsElem = (org.w3c.dom.Element)actions.item(0);
+
+ org.w3c.dom.NodeList nl=((org.w3c.dom.Element)
+ actions.item(0)).getChildNodes();
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(ACTION_ELEMENT)) {
+ m_actions.add(ESBActionFactory.createAction(this,
+ ((org.w3c.dom.Element)nl.item(i))));
+ }
+ }
+ }
+
+ // Find positional information
+ int servCount=getServicePosition();
+
+ String str=getModel().getOriginalContents();
+
+ if (str != null) {
+ int startPosition=str.indexOf("<service ");
+ int endPosition=-1;
+ int loggedEndPosition=-1;
+
+ while (startPosition != -1 && servCount > 0) {
+ servCount--;
+
+ loggedEndPosition = str.indexOf('>', startPosition);
+
+ endPosition = str.indexOf("</service>", startPosition);
+
+ if (servCount > 0) {
+ startPosition=str.indexOf("<service ", endPosition);
+ }
+ }
+
+ if (startPosition != -1) {
+ endPosition = str.indexOf("</service>", startPosition);
+
+ getSource().setStartPosition(startPosition);
+ getSource().setEndPosition(loggedEndPosition);
+
+ getSource().getProperties().put("path",
+ ESBModelUtil.getPath(m_service));
+ }
+ }
+
+ // Get jms listener
+ org.w3c.dom.NodeList nl=m_service.getElementsByTagName(DefaultESBService.JMS_LISTENER_ELEMENT);
+
+ if (nl.getLength() > 0 && nl.item(0) instanceof org.w3c.dom.Element) {
+ m_jmsListenerElem = (org.w3c.dom.Element)nl.item(0);
+ }
+ }
+
+ /**
+ * This method initializes the links.
+ */
+ public void initializeLinks() {
+
+ // Work through actions requesting them to
+ // establish their links
+ for (int i=0; i < m_actions.size(); i++) {
+ m_actions.get(i).initializeLinks();
+ }
+ }
+
+ /**
+ * This method validates the ESB service and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ public void validate(ModelListener l) {
+
+ // Check that the service specifies a session
+ if (isSessionBased() && getSessionClass() == null) {
+
+ // Find first conversation based action to use as
+ // focus - if not found then use the service itself
+ ESBAction focus=getFirstSessionBasedAction();
+ ModelObject src=this;
+
+ if (focus instanceof ModelObject) {
+ src = (ModelObject)focus;
+ }
+
+ l.error(new ModelIssue(src, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_SESSION_CLASS",
+ new String[]{})));
+ }
+
+ for (int i=0; i < m_actions.size(); i++) {
+ m_actions.get(i).validate(l);
+ }
+ }
+
+ /**
+ * This method returns the ESB model.
+ *
+ * @return The ESB model
+ */
+ public ESBLanguageModel getModel() {
+ return(m_model);
+ }
+
+ /**
+ * This method returns the category associated with the service
+ * descriptor.
+ *
+ * @return The service category
+ */
+ public String getCategory() {
+ return(m_service.getAttribute(CATEGORY_ATTR));
+ }
+
+ /**
+ * This method returns the name associated with the service
+ * descriptor.
+ *
+ * @return The service name
+ */
+ public String getName() {
+ return(m_service.getAttribute(NAME_ATTR));
+ }
+
+ /**
+ * This method returns the XML configuration representation of the service.
+ *
+ * @return The XML configuration for the service
+ */
+ public org.w3c.dom.Element getService() {
+ return(m_service);
+ }
+
+ /**
+ * This method returns the list of ESB actions.
+ *
+ * @return The ESB actions
+ */
+ public java.util.List<ESBAction> getActions() {
+ return(m_actions);
+ }
+
+ /**
+ * This method adds an action to the service.
+ *
+ * @param action The action to be added
+ * @param pos The position to add, or -1 if at the end
+ */
+ public void addAction(ESBAction action, int pos) {
+ // If position specified, then find element at
+ // the position and insert after the previous
+ // element
+
+ if (action.getAction() != null) {
+
+ if (pos == -1 || pos >= m_actions.size()) {
+ m_actionsElem.appendChild(action.getAction());
+ m_actions.add(action);
+ } else {
+ org.w3c.dom.NodeList nl=m_actionsElem.getChildNodes();
+ org.w3c.dom.Element elem=null;
+ int cur=-1;
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(ACTION_ELEMENT)) {
+ cur++;
+
+ if (cur == pos) {
+ elem = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (elem != null) {
+ m_actionsElem.insertBefore(action.getAction(), elem);
+ } else {
+ m_actionsElem.appendChild(action.getAction());
+ }
+
+ m_actions.add(pos, action);
+ }
+ }
+ }
+
+ /**
+ * This method removes an action from the service.
+ *
+ * @param action The action to be removed
+ * @return Whether the action was removed
+ */
+ public boolean removeAction(ESBAction action) {
+ return(false);
+ }
+
+ protected java.lang.annotation.Annotation getServiceAnnotation(String session) {
+ java.lang.annotation.Annotation ret=null;
+
+ try {
+ ClassLoader cl=
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ClasspathUtil.getClassLoader(getModel());
+
+ Class<?> cls=Class.forName(session, true, cl);
+
+ // TODO: This should be replaced by direct lookup
+ // of Service annotation - but library not available
+ // at the moment
+ java.lang.annotation.Annotation[] annotations=
+ cls.getAnnotations();
+ for (int i=0; ret == null &&
+ i < annotations.length; i++) {
+ try {
+ if (annotations[i].annotationType().getName().equals(
+ SERVICE_ANNOTATION)) {
+ ret = annotations[i];
+ }
+ } catch(Throwable ex) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "ANNOTATION: "+
+ annotations[i].annotationType(), ex);
+ }
+ }
+
+ } catch(Throwable e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get session class '"+session+"'", e);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the ESB service represents a
+ * loop construct.
+ *
+ * @return Whether the service represents a loop
+ */
+ public boolean isLoop() {
+ boolean ret=false;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null) {
+ ret = action.isLoop();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the ESB service descriptor represents
+ * a 'root' conversation.
+ *
+ * @return Whether the ESB service is associated with a root conversation
+ */
+ public boolean isRoot() {
+ boolean ret=false;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null) {
+ if (action.isCreateSession()) {
+ String bool=action.getPropertyValue(ROOT_PROPERTY);
+ if (bool != null) {
+ ret = bool.equalsIgnoreCase("true");
+ } else {
+ String session=action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
+
+ java.lang.annotation.Annotation annotation=
+ getServiceAnnotation(session);
+
+ if (annotation != null) {
+ try {
+ java.lang.reflect.Method method=
+ annotation.getClass().getMethod(ROOT_PROPERTY,
+ (Class<?>[])null);
+
+ Object val=method.invoke(annotation, (Object[])null);
+
+ if (val instanceof Boolean) {
+ ret = ((Boolean)val).booleanValue();
+ }
+ } catch(Throwable t) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get 'root' annotation value", t);
+ }
+ }
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the ESB service descriptor
+ * starts with a CreateSessionAction.
+ *
+ * @return Whether the service has a CreateSessionAction
+ */
+ public boolean isCreateSession() {
+ boolean ret=false;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null) {
+ ret = action.isCreateSession();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the service is a gateway
+ * for inbound requests.
+ *
+ * @return Whether the service is a gateway
+ */
+ public boolean isGateway() {
+ boolean ret=false;
+
+ for (int i=0; ret == false && i < m_actions.size(); i++) {
+ ret = m_actions.get(i).isGateway();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the gateway action if this is a
+ * gateway service.
+ *
+ * @return The gateway action
+ */
+ public ESBAction getGatewayAction() {
+ ESBAction ret=null;
+
+ for (int i=0; ret == null && i < m_actions.size(); i++) {
+ if (m_actions.get(i).isGateway()) {
+ ret = m_actions.get(i);
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the first session based action in the
+ * service descriptor.
+ *
+ * @return The first session based action, or null if none exist
+ */
+ public ESBAction getFirstSessionBasedAction() {
+ ESBAction ret=null;
+
+ for (int i=0; ret == null && i < m_actions.size(); i++) {
+ ret=m_actions.get(i);
+
+ if (ret.isSessionBased() == false) {
+ ret = null;
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the service description name associated with the
+ * ESB service.
+ *
+ * @return The service description name
+ */
+ public String getServiceDescriptionName() {
+ String ret=null;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null) {
+ if (action.isCreateSession() || (action.getActionClass() != null &&
+ action.getActionClass().equals(RETRIEVE_SESSION_ACTION_CLASS))) {
+ ret = action.getPropertyValue(SERVICE_DESCRIPTION_NAME_PROPERTY);
+
+ if (ret == null) {
+ String session=action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
+
+ java.lang.annotation.Annotation annotation=
+ getServiceAnnotation(session);
+
+ if (annotation != null) {
+ try {
+ java.lang.reflect.Method method=
+ annotation.getClass().getMethod(NAME_ATTR, (Class<?>[])null);
+
+ Object val=method.invoke(annotation, (Object[])null);
+
+ if (val instanceof String) {
+ ret = (String)val;
+ }
+ } catch(Throwable t) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get 'name' annotation value", t);
+ }
+ }
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the conversation type associated with the
+ * ESB service.
+ *
+ * @return The conversation type
+ */
+ public String getConversationType() {
+ String ret=null;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null) {
+ if (action.isCreateSession()) {
+ ret = action.getPropertyValue(CONVERSATION_TYPE_PROPERTY);
+
+ if (ret == null) {
+ String session=action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
+
+ java.lang.annotation.Annotation annotation=
+ getServiceAnnotation(session);
+
+ if (annotation != null) {
+ try {
+ java.lang.reflect.Method method=
+ annotation.getClass().getMethod(CONVERSATION_TYPE_PROPERTY,
+ (Class<?>[])null);
+
+ Object val=method.invoke(annotation, (Object[])null);
+
+ if (val instanceof String) {
+ ret = (String)val;
+ }
+ } catch(Throwable t) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get 'name' annotation value", t);
+ }
+ }
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the session name associated with the service
+ * descriptor.
+ *
+ * @return The session name
+ */
+ public String getSessionName() {
+ String ret=null;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null) {
+ ret = action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the session class associated with the service
+ * descriptor.
+ *
+ * @return The session class
+ */
+ public Class<?> getSessionClass() {
+ Class<?> ret=null;
+ String session=getSessionName();
+
+ if (session != null) {
+ try {
+ ClassLoader cl=
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ClasspathUtil.getClassLoader(getModel());
+
+ ret = Class.forName(session, true, cl);
+
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get session class '"+session+"'", e);
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the service is related to a behavioural
+ * session.
+ *
+ * @return Whether the service is session based
+ */
+ public boolean isSessionBased() {
+ boolean ret=false;
+
+ for (int i=0; ret == false && i < m_actions.size(); i++) {
+ ret = m_actions.get(i).isSessionBased();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method converts the ESB service into a Conversation, if
+ * the service represents a conversation.
+ *
+ * @param context The conversion context, or null if this is the
+ * root conversation
+ * @return The conversation
+ */
+ public Conversation convert(ConversionContext context) {
+ Conversation ret=null;
+
+ if (isCreateSession()) {
+ ret = new Conversation();
+
+ ret.derivedFrom(this);
+
+ ModelName modelName=new ModelName();
+ modelName.setName(getServiceDescriptionName());
+
+ ret.setModelName(modelName);
+
+ 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(ConversationModel.CONVERSATION);
+
+ role = convType.substring(index+1);
+
+ iref.setLocatedRole(role);
+
+ // Need to locate the model name
+ modelName.setLocatedRole(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);
+ //ret.getConformsTo().add(iref);
+
+ org.scribble.model.DependencyManager dm=
+ (org.scribble.model.DependencyManager)
+ org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
+ org.scribble.model.DependencyManager.class, null);
+
+ if (dm != null) {
+ dm.recordDependency(getModel().getModelReference(),
+ iref, DependencyType.Implements);
+ }
+
+ } else {
+ logger.warning("Conversation type does not " +
+ "contain '@' located role separator");
+ }
+ } else {
+ logger.warning("No conversation type specified");
+ }
+
+ ret.setBlock(new Block());
+
+ context = new DefaultConversionContext(role);
+
+ context.processing(this);
+
+ for (int i=0; i < m_actions.size(); i++) {
+ ((ESBAction)m_actions.get(i)).convert(
+ ret.getBlock().getContents(), context);
+ }
+
+ context.processed(this);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method converts the actions associated with the ESB service into
+ * activities that can be checked for conformance against a conversation
+ * type.
+ *
+ * @param activities The target list of activities associated with the
+ * ESB actions being converted
+ * @param context The conversion context
+ */
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ context.processing(this);
+
+ for (int i=0; i < m_actions.size(); i++) {
+ ((ESBAction)m_actions.get(i)).convert(
+ activities, context);
+ }
+
+ context.processed(this);
+ }
+
+ /**
+ * This method returns the position of the service node within the
+ * ESB configuration.
+ *
+ * @return The service node position
+ */
+ public int getServicePosition() {
+ org.w3c.dom.Node services=m_service.getParentNode();
+ int servCount=0;
+ boolean f_end=false;
+
+ for (int i=0; f_end == false &&
+ i < services.getChildNodes().getLength(); i++) {
+ org.w3c.dom.Node serv=services.getChildNodes().item(i);
+
+ if (serv.getNodeName().equals(SERVICE_ELEMENT)) {
+ servCount++;
+ if (serv == m_service) {
+ f_end = true;
+ }
+ }
+ }
+
+ return(servCount);
+ }
+
+ /**
+ * This method returns the JMS Bus Id Ref associated with the
+ * service's JMS listener.
+ *
+ * @return The JMS Bus Id Ref
+ */
+ public String getJMSBusIdRef() {
+ String ret=null;
+
+ if (m_jmsListenerElem != null) {
+ ret = m_jmsListenerElem.getAttribute(BUSIDREF_ATTR);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method sets the JMS Bus Id Ref associated with the
+ * service's JMS listener.
+ *
+ * @param busId The JMS Bus Id Ref
+ */
+ public void setJMSBusIdRef(String busId) {
+ if (m_jmsListenerElem == null) {
+ m_jmsListenerElem = m_service.getOwnerDocument().createElement(JMS_LISTENER_ELEMENT);
+
+ org.w3c.dom.NodeList nl=m_service.getElementsByTagName(LISTENERS_ELEMENT);
+ org.w3c.dom.Element listeners=null;
+
+ if (nl.getLength() > 0) {
+ listeners = (org.w3c.dom.Element)nl.item(0);
+ } else {
+ listeners = m_service.getOwnerDocument().createElement(LISTENERS_ELEMENT);
+
+ if (m_service.getFirstChild() != null) {
+ m_service.insertBefore(listeners,
+ m_service.getFirstChild());
+ } else {
+ m_service.appendChild(listeners);
+ }
+ }
+
+ if (listeners != null) {
+ listeners.appendChild(m_jmsListenerElem);
+ }
+ }
+
+ if (m_jmsListenerElem != null) {
+ m_jmsListenerElem.setAttribute(BUSIDREF_ATTR,
+ busId);
+
+ if (m_jmsListenerElem.hasAttribute(NAME_ATTR) == false) {
+ m_jmsListenerElem.setAttribute(NAME_ATTR,
+ getCategory()+"-"+getName());
+ }
+
+ if (m_jmsListenerElem.hasAttribute(MAX_THREADS_ATTR) == false) {
+ m_jmsListenerElem.setAttribute(MAX_THREADS_ATTR, "1");
+ }
+ }
+ }
+
+ public int hashCode() {
+ return(m_service.hashCode());
+ }
+
+ public boolean equals(Object obj) {
+ boolean ret=false;
+
+ if (obj instanceof DefaultESBService) {
+ DefaultESBService other=(DefaultESBService)obj;
+
+ if (m_service == other.m_service) {
+ ret = true;
+ }
+ }
+
+ return(ret);
+ }
+
+ public String toString() {
+ return("ESBService: "+getCategory()+"/"+getName()+"["+getSource()+"]");
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model");
+
+ private ESBLanguageModel m_model=null;
+ private org.w3c.dom.Element m_service=null;
+ private org.w3c.dom.Element m_jmsListenerElem=null;
+ private org.w3c.dom.Element m_actionsElem=null;
+ private java.util.List<ESBAction> m_actions=new java.util.Vector<ESBAction>();
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBAction.java (from rev 327, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import org.scribble.model.*;
+
+/**
+ * This interface represents the generic ESB action class.
+ *
+ * @author gary
+ */
+public interface ESBAction {
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ public void initializeLinks();
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ public void validate(ModelListener l);
+
+ /**
+ * This method determines if the action represents a loop construct.
+ *
+ * @return Whether the action represents a loop construct
+ */
+ public boolean isLoop();
+
+ /**
+ * This method determines whether the action is related to a behavioural
+ * session.
+ *
+ * @return Whether the action is session based
+ */
+ public boolean isSessionBased();
+
+ /**
+ * This method determines whether the ESB action represents
+ * a CreateSessionAction.
+ *
+ * @return Whether the action is a CreateSessionAction
+ */
+ public boolean isCreateSession();
+
+ /**
+ * This method determines whether the action is a gateway
+ * for inbound requests.
+ *
+ * @return Whether the action is a gateway
+ */
+ public boolean isGateway();
+
+ /**
+ * This method indicates whether this action performs another
+ * sub-conversation.
+ *
+ * @return Whether the action is a 'perform'
+ */
+ public boolean isPerform();
+
+ /**
+ * This method indicates whether the action is an initiator.
+ * Initiator actions must precede any other session based
+ * action, within an ESB service.
+ *
+ * @return Whether the action is an initiator
+ */
+ public boolean isInitiator();
+
+ /**
+ * This method returns the action's class name.
+ *
+ * @return The action's class name
+ */
+ public String getActionClass();
+
+ /**
+ * This method returns the property value associated
+ * with the supplied name.
+ *
+ * @param property The property name
+ * @return The property value, or null if not found
+ */
+ public String getPropertyValue(String property);
+
+ /**
+ * This method determines the property value, associated
+ * with the supplied name, is defined.
+ *
+ * @param property The property name
+ * @return Whether the property has been defined
+ */
+ public boolean hasProperty(String property);
+
+ /**
+ * This method returns the XML configuration representation of the action.
+ *
+ * @return The XML configuration for the action
+ */
+ public org.w3c.dom.Element getAction();
+
+ /**
+ * This method converts the ESB action 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);
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBActionFactory.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBActionFactory.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBActionFactory.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBActionFactory.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.UnsupportedAction;
+
+/**
+ * This class provides a factory for ESBAction instances.
+ *
+ * @author gary
+ */
+public class ESBActionFactory {
+
+ public static final String MODEL_ACTION_PACKAGE =
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions";
+ public static final String CLASS_ATTR = "class";
+ public static final String CONVERSATION_ACTION_PACKAGE =
+ "org.jboss.soa.overlord.jbossesb.actions";
+
+ /**
+ * This method creates an ESBAction instance relevant to the
+ * supplied JBossESB action, associated with the supplied
+ * service.
+ *
+ * @param service The service
+ * @param action The XML configuration of the action
+ * @return The ESBAction instance
+ */
+ public static ESBAction createAction(ESBService service,
+ org.w3c.dom.Element action) {
+ ESBAction ret=null;
+ String actionType=action.getAttribute(CLASS_ATTR);
+
+ // Check that it is a conversation based ESB action
+ if (actionType.startsWith(CONVERSATION_ACTION_PACKAGE)) {
+ int index=actionType.lastIndexOf('.');
+ if (index != -1) {
+ String actionName=actionType.substring(index+1);
+
+ try {
+ Class<?> cls=(Class<?>)
+ Class.forName(MODEL_ACTION_PACKAGE+"."+actionName);
+
+ java.lang.reflect.Constructor<?> con=
+ cls.getConstructor(new Class<?>[]{ESBService.class,
+ org.w3c.dom.Element.class});
+
+ ret = (ESBAction)con.newInstance(new Object[]{service, action});
+
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Unable to find action class '"+
+ MODEL_ACTION_PACKAGE+"."+actionName+"'", e);
+ }
+ }
+ }
+
+ if (ret == null) {
+ // Unrecognised or unsupported action
+ ret = new UnsupportedAction(service, action);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines the runtime action class based on
+ * the ESB model action class.
+ *
+ * @param cls The ESB model action class
+ * @return The conversation action class
+ */
+ public static String getConversationAction(Class<?> cls) {
+ String actionType=cls.getName();
+ String ret=null;
+
+ // Check that it is a conversation based ESB action
+ if (actionType.startsWith(MODEL_ACTION_PACKAGE)) {
+ int index=actionType.lastIndexOf('.');
+ if (index != -1) {
+ String actionName=actionType.substring(index+1);
+
+ ret = CONVERSATION_ACTION_PACKAGE+"."+actionName;
+ }
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model");
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLanguageModel.java (from rev 351, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLanguageModel.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLanguageModel.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLanguageModel.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import org.scribble.model.*;
+
+/**
+ * This class represents an ESB model.
+ *
+ * @author gary
+ */
+public interface ESBLanguageModel {
+
+ public static final String JBOSSESB_NOTATION = "jboss-esb.xml";
+
+ /**
+ * 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 method returns the ESB service for the supplied
+ * category and name.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @return The ESB service, or null if not found
+ */
+ public ESBService getService(String category, String name);
+
+ /**
+ * This method returns the collection of ESB services associated
+ * with the model.
+ *
+ * @return The collection of ESB services
+ */
+ public java.util.Collection<ESBService> getServices();
+
+ /**
+ * This textual contents of the model.
+ *
+ * @return The textual contents
+ */
+ public String getOriginalContents();
+
+ /**
+ * This method returns the gateway service.
+ *
+ * @return The gateway service, or null if not found
+ */
+ public ESBService getGatewayService();
+
+ /**
+ * This method creates a new ESB service.
+ *
+ * @param category The category
+ * @param name The name
+ * @return The new ESB service
+ */
+ public ESBService createService(String category, String name);
+
+ /**
+ * This method adds a new service to the model.
+ *
+ * @param service The service
+ */
+ public void addService(ESBService service);
+
+ /**
+ * This method removes a service from the model.
+ *
+ * @param service The service
+ */
+ public void removeService(ESBService service);
+
+ /**
+ * This method returns a unique service name within
+ * the supplied category.
+ *
+ * @param category The category
+ * @param currentServiceName The name of the service creating
+ * the new service
+ * @return The unique service name
+ */
+ public String getUniqueServiceName(String category,
+ String currentServiceName);
+
+ /**
+ * This method returns the reference to the DOM
+ * representation of the ESB configuration.
+ *
+ * @return The ESB configuration
+ */
+ public org.w3c.dom.Element getESBConfiguration();
+
+ /**
+ * This method returns the JMS destination associated with
+ * the supplied JMS Bus Id.
+ *
+ * @param jmsBusId The JMS bus id
+ * @return The JMS definition, or null if not found
+ */
+ public String getJMSDefinition(String jmsBusId);
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLink.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBLink.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLink.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBLink.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+/**
+ * This class represents the link from a ESB action to a service
+ * descriptor.
+ *
+ * @author gary
+ */
+public class ESBLink {
+
+ /**
+ * This is the constructor for the link.
+ *
+ * @param category The service category of the target service descriptor
+ * @param name The service name of the target descriptor
+ * @param service A reference to the service model containing the action
+ * that links to the service descriptor
+ * @param control Whether the link is a control link, if not then it
+ * represents a message link (i.e. to another service)
+ */
+ public ESBLink(String category, String name,
+ ESBService service, boolean control) {
+ this(category, name, service, control, false);
+ }
+
+ /**
+ * This is the constructor for the link.
+ *
+ * @param category The service category of the target service descriptor
+ * @param name The service name of the target descriptor
+ * @param service A reference to the service model containing the action
+ * that links to the service descriptor
+ * @param control Whether the link is a control link, if not then it
+ * represents a message link (i.e. to another service)
+ * @param remote Whether the link is to a remote service
+ */
+ public ESBLink(String category, String name,
+ ESBService service, boolean control, boolean remote) {
+ m_category = category;
+ m_name = name;
+ m_service = service;
+ m_control = control;
+ m_remote = remote;
+ }
+
+ /**
+ * This method indicates whether this is a control
+ * link, as opposed to a message link.
+ *
+ * @return Whether the link is a control link
+ */
+ public boolean isControl() {
+ return(m_control);
+ }
+
+ /**
+ * This method indicates whether this is a
+ * link to a remote service.
+ *
+ * @return Whether the link is to a remote service
+ */
+ public boolean isRemote() {
+ return(m_remote);
+ }
+
+ /**
+ * This method returns the service category.
+ *
+ * @return The service category
+ */
+ public String getCategory() {
+ return(m_category);
+ }
+
+ /**
+ * This method returns the service name.
+ *
+ * @return The service name
+ */
+ public String getName() {
+ return(m_name);
+ }
+
+ /**
+ * This method returns the reference to ESB Service
+ * model containing the action that links to the
+ * target service descriptor.
+ *
+ * @return The ESB service
+ */
+ public ESBService getService() {
+ return(m_service);
+ }
+
+ private String m_category=null;
+ private String m_name=null;
+ private ESBService m_service=null;
+ private boolean m_control=false;
+ private boolean m_remote=false;
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/ESBService.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import org.scribble.conversation.model.Conversation;
+import org.scribble.model.*;
+
+/**
+ * This interface represents an ESB service.
+ *
+ * @author gary
+ */
+public interface ESBService {
+
+ /**
+ * This method initializes the links.
+ */
+ public void initializeLinks();
+
+ /**
+ * This method validates the ESB service and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ public void validate(ModelListener l);
+
+ /**
+ * This method returns the category associated with the service
+ * descriptor.
+ *
+ * @return The service category
+ */
+ public String getCategory();
+
+ /**
+ * This method returns the name associated with the service
+ * descriptor.
+ *
+ * @return The service name
+ */
+ public String getName();
+
+ /**
+ * This method returns the ESB model.
+ *
+ * @return The ESB model
+ */
+ public ESBLanguageModel getModel();
+
+ /**
+ * This method returns the XML configuration representation of the service.
+ *
+ * @return The XML configuration for the service
+ */
+ public org.w3c.dom.Element getService();
+
+ /**
+ * This method returns the list of ESB actions.
+ *
+ * @return The ESB actions
+ */
+ public java.util.List<ESBAction> getActions();
+
+ /**
+ * This method adds an action to the service.
+ *
+ * @param action The action to be added
+ * @param pos The position to add, or -1 if at the end
+ */
+ public void addAction(ESBAction action, int pos);
+
+ /**
+ * This method removes an action from the service.
+ *
+ * @param action The action to be removed
+ * @return Whether the action was removed
+ */
+ public boolean removeAction(ESBAction action);
+
+ /**
+ * This method determines whether the ESB service represents a
+ * loop construct.
+ *
+ * @return Whether the service represents a loop
+ */
+ public boolean isLoop();
+
+ /**
+ * This method determines whether the ESB service descriptor represents
+ * a 'root' conversation.
+ *
+ * @return Whether the ESB service is associated with a root conversation
+ */
+ public boolean isRoot();
+
+ /**
+ * This method determines whether the ESB service descriptor
+ * starts with a CreateSessionAction.
+ *
+ * @return Whether the service has a CreateSessionAction
+ */
+ public boolean isCreateSession();
+
+ /**
+ * This method determines whether the service is a gateway
+ * for inbound requests.
+ *
+ * @return Whether the service is a gateway
+ */
+ public boolean isGateway();
+
+ /**
+ * This method returns the gateway action if this is a
+ * gateway service.
+ *
+ * @return The gateway action
+ */
+ public ESBAction getGatewayAction();
+
+ /**
+ * This method returns the service description name associated with the
+ * ESB service.
+ *
+ * @return The service description name
+ */
+ public String getServiceDescriptionName();
+
+ /**
+ * This method returns the conversation type associated with the
+ * ESB service.
+ *
+ * @return The conversation type
+ */
+ public String getConversationType();
+
+ /**
+ * This method returns the session name associated with the service
+ * descriptor.
+ *
+ * @return The session name
+ */
+ public String getSessionName();
+
+ /**
+ * This method returns the session class associated with the service
+ * descriptor.
+ *
+ * @return The session class
+ */
+ public Class<?> getSessionClass();
+
+ /**
+ * This method determines whether the service is related to a behavioural
+ * session.
+ *
+ * @return Whether the service is session based
+ */
+ public boolean isSessionBased();
+
+ /**
+ * This method returns the first session based action in the
+ * service descriptor.
+ *
+ * @return The first session based action, or null if none exist
+ */
+ public ESBAction getFirstSessionBasedAction();
+
+ /**
+ * This method converts the actions associated with the ESB service into
+ * activities that can be checked for conformance against a conversation
+ * type.
+ *
+ * @param activities The target list of activities associated with the
+ * ESB actions being converted
+ * @param context The conversion context
+ */
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context);
+
+ /**
+ * This method converts the ESB service into a Conversation, if
+ * the service represents a conversation.
+ *
+ * @param context The conversion context, or null if this is the
+ * root conversation
+ * @return The conversation
+ */
+ public Conversation convert(ConversionContext context);
+
+ /**
+ * This method returns the position of the service node within the
+ * ESB configuration.
+ *
+ * @return The service node position
+ */
+ public int getServicePosition();
+
+ /**
+ * This method returns the JMS Bus Id Ref associated with the
+ * service's JMS listener.
+ *
+ * @return The JMS Bus Id Ref
+ */
+ public String getJMSBusIdRef();
+
+ /**
+ * This method sets the JMS Bus Id Ref associated with the
+ * service's JMS listener.
+ *
+ * @param busId The JMS Bus Id Ref
+ */
+ public void setJMSBusIdRef(String busId);
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/Messages.properties (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/Messages.properties)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/Messages.properties (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/Messages.properties 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,21 @@
+# /*
+# * JBoss, Home of Professional Open Source
+# * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+# * by the @authors tag. All rights reserved.
+# * See the copyright.txt in the distribution for a
+# * full listing of individual contributors.
+# * This copyrighted material is made available to anyone wishing to use,
+# * modify, copy, or redistribute it subject to the terms and conditions
+# * of the GNU Lesser General Public License, v. 2.1.
+# * This program is distributed in the hope that it will be useful, but WITHOUT A
+# * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+# * You should have received a copy of the GNU Lesser General Public License,
+# * v.2.1 along with this distribution; if not, write to the Free Software
+# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# * MA 02110-1301, USA.
+# */
+
+_NOT_FOUND_BUSINESS_OBJECT_TYPE=Business object type '{0}' could not be found
+_NOT_FOUND_SERVICE_DESCRIPTOR=Service descriptor for category '{0}' and name '{1}' not found
+_NOT_SPECIFIED_SESSION_CLASS=First conversation action must specify a valid session class
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions)
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,581 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import java.util.logging.Logger;
-
-import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ESBModelUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ProblemDefinitions;
-
-/**
- * This is the generic ESB action class.
- *
- * @author gary
- */
-public abstract class AbstractESBAction extends ModelObject
- implements ESBAction {
-
- public static final String IDENTITIES = "identities";
- public static final String ACTION_ELEMENT = "action";
- public static final String VALUE_ATTR = "value";
- public static final String NAME_ATTR = "name";
- public static final String PROPERTY_ELEMENT = "property";
- public static final String CLASS_PROPERTY = "class";
-
- /**
- * The constructor for initializing the action based on
- * an existing DOM element.
- */
- protected AbstractESBAction(ESBService service,
- org.w3c.dom.Element action) {
- initExistingAction(service, action);
- }
-
- /**
- * The contructor for initializing a new action.
- */
- protected AbstractESBAction(ESBService service,
- String actionClass) {
- initNewAction(service, actionClass);
- }
-
- /**
- * This method initializes the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param actionClass The action class
- */
- protected void initNewAction(ESBService service,
- String actionClass) {
- m_service = service;
-
- m_action = service.getService().
- getOwnerDocument().createElement(ACTION_ELEMENT);
-
- m_action.setAttribute(CLASS_PROPERTY, actionClass);
- }
-
- /**
- * This method initializes the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- protected void initExistingAction(ESBService service,
- org.w3c.dom.Element action) {
- m_service = service;
- m_action = action;
-
- int servicesStartPos=-1;
-
- if (m_service.getModel() != null &&
- m_service.getModel().getOriginalContents() != null &&
- (servicesStartPos=m_service.getModel().
- getOriginalContents().indexOf("<services>")) != -1) {
-
- // Find positional information
- int servCount=m_service.getServicePosition();
- int actionCount=getActionPosition();
-
- String str=m_service.getModel().getOriginalContents();
-
- int startPosition=str.indexOf("<service", servicesStartPos+2);
- int endPosition=-1;
- int loggedEndPosition=-1;
-
- while (startPosition != -1 && servCount > 0) {
- servCount--;
-
- endPosition = str.indexOf("</service>", startPosition);
-
- if (servCount > 0) {
- startPosition=str.indexOf("<service", endPosition);
- }
- }
-
- int actionsStartPos=-1;
-
- if (actionCount > 0 &&
- startPosition != -1 && endPosition != -1 &&
- (actionsStartPos=str.indexOf("<actions",
- startPosition)) != -1 &&
- actionsStartPos < endPosition) {
- startPosition=str.indexOf("<action", actionsStartPos+2);
- endPosition=-1;
-
- while (startPosition != -1 && actionCount > 0) {
- actionCount--;
-
- loggedEndPosition = str.indexOf('>', startPosition);
-
- endPosition = str.indexOf("</action>", startPosition);
-
- if (actionCount > 0) {
- startPosition=str.indexOf("<action", endPosition);
- }
- }
-
- // Check whether single line element
- int inlineEndPos=str.indexOf("/>", startPosition);
- int nextStartPos=str.indexOf("<", startPosition+1);
-
- if (inlineEndPos != -1 && inlineEndPos < nextStartPos) {
- endPosition = inlineEndPos;
- }
- }
-
- getSource().setStartPosition(startPosition);
- getSource().setEndPosition(loggedEndPosition);
-
- getSource().getProperties().put("path",
- ESBModelUtil.getPath(m_action));
- }
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- public void initializeLinks() {
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l) {
-
- java.util.List<String> mandatory=getMandatoryProperties();
-
- for (int i=0; i < mandatory.size(); i++) {
- if (getPropertyValue(mandatory.get(i)) == null) {
- java.util.Map<String,Object> props=new java.util.HashMap<String,Object>();
- props.put(ProblemDefinitions.PROBLEM_PROPERTY,
- mandatory.get(i));
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{mandatory.get(i)}), props);
- }
- }
-
- java.util.List<String> propNames=getPropertyNames();
-
- for (int i=0; i < propNames.size(); i++) {
- String propName=propNames.get(i);
-
- if (getOptionalProperties().contains(propName) == false &&
- getMandatoryProperties().contains(propName) == false) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_UNKNOWN_PROPERTY",
- new String[]{propName}), null);
- }
- }
-
- String session=getPropertyValue(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
-
- if (session != null) {
- // Validate that the business object type exists
- try {
- ClassLoader cl=
- org.jboss.tools.overlord.cdl.jbossesb.model.util.ClasspathUtil.getClassLoader(getService().getModel());
-
- try {
- Class.forName(session, true, cl);
- } catch(ClassNotFoundException cfne) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_BUSINESS_OBJECT_TYPE",
- new String[]{session}), null);
- }
-
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to load business class '"+session+"'", e);
- }
- }
-
- // Validate links
- for (int i=0; i < m_links.size(); i++) {
- ESBLink link=(ESBLink)m_links.get(i);
-
- if (link.getService() == null) {
- // If target service not found, then report error
- // unless it is a remote service, so defined in a
- // different file
- if (link.isRemote() == false) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{link.getCategory(),link.getName()}), null);
- }
- } else if (getService().getSessionName() != null &&
- isPerform() == false && link.isRemote() == false &&
- link.getService().getSessionName() != null &&
- getService().getSessionName().equals(
- link.getService().getSessionName()) == false) {
-
- java.util.Map<String,Object> props=new java.util.HashMap<String,Object>();
- props.put(ProblemDefinitions.PROBLEM_PROPERTY,
- DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
-
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MISMATCH_SESSION_CLASS",
- new String[]{link.getCategory(),link.getName()}), props);
- }
- }
- }
-
- /**
- * This method determines if the action represents a loop construct.
- *
- * @return Whether the action represents a loop construct
- */
- public boolean isLoop() {
- return(false);
- }
-
- /**
- * This method determines whether the action is related to a behavioural
- * session.
- *
- * @return Whether the action is session based
- */
- public boolean isSessionBased() {
- return(true);
- }
-
- /**
- * This method determines whether the ESB action represents
- * a CreateSessionAction.
- *
- * @return Whether the action is a CreateSessionAction
- */
- public boolean isCreateSession() {
- return(false);
- }
-
- /**
- * This method determines whether the action is a gateway
- * for inbound requests.
- *
- * @return Whether the action is a gateway
- */
- public boolean isGateway() {
- return(false);
- }
-
- /**
- * This method indicates whether this action performs another
- * sub-conversation.
- *
- * @return Whether the action is a 'perform'
- */
- public boolean isPerform() {
- return(false);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=new java.util.Vector<String>();
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=new java.util.Vector<String>();
- ret.add(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
- ret.add(IDENTITIES);
- ret.add(DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY);
- return(ret);
- }
-
- /**
- * This method returns the action's class name.
- *
- * @return The action's class name
- */
- public String getActionClass() {
- String ret=null;
-
- if (m_action != null) {
- ret = m_action.getAttribute(CLASS_PROPERTY);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the property value associated
- * with the supplied name.
- *
- * @param property The property name
- * @return The property value, or null if not found
- */
- public String getPropertyValue(String property) {
- String ret=null;
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
- equals(property)) {
- ret = ((org.w3c.dom.Element)nl.item(i)).getAttribute(VALUE_ATTR);
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method determines the property value, associated
- * with the supplied name, is defined.
- *
- * @param property The property name
- * @return Whether the property has been defined
- */
- public boolean hasProperty(String property) {
- boolean ret=false;
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; ret == false && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
- equals(property)) {
- ret = true;
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the element associated with the
- * requested property. If the property does not exist, then
- * it will be created.
- *
- * @param property The property
- * @return The element
- */
- public org.w3c.dom.Element getPropertyElement(String property) {
- org.w3c.dom.Element ret=null;
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(property)) {
- ret = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (ret == null) {
- ret = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- ret.setAttribute(NAME_ATTR, property);
-
- m_action.appendChild(ret);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of property names defined for
- * this action.
- *
- * @return The list of property names
- */
- public java.util.List<String> getPropertyNames() {
- java.util.List<String> ret=new java.util.Vector<String>();
-
- if (m_action != null) {
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT)) {
- ret.add(((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR));
- }
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the 'property' child nodes, associated with the
- * supplied property name, within the action configuration.
- *
- * @param property The property name
- * @return The list of child nodes
- */
- public org.w3c.dom.NodeList getPropertyChildNodes(String property) {
- org.w3c.dom.NodeList ret=null;
-
- org.w3c.dom.NodeList nl=m_action.getChildNodes();
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element &&
- nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
- ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
- equals(property)) {
- ret = ((org.w3c.dom.Element)nl.item(i)).getChildNodes();
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the reference to the service that contains the
- * action.
- *
- * @return The service
- */
- protected ESBService getService() {
- return(m_service);
- }
-
- /**
- * This method sets the service description name property.
- *
- * @param name The service description name
- */
- public void setServiceDescriptionName(String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(
- DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- /**
- * This method sets the business object type property.
- *
- * @param name The business object type
- */
- public void setBusinessObjectType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(
- DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-
- /**
- * This method returns the XML configuration representation of the action.
- *
- * @return The XML configuration for the action
- */
- public org.w3c.dom.Element getAction() {
- return(m_action);
- }
-
- /**
- * This method returns the list of links established by this action.
- *
- * @return The list of links
- */
- protected java.util.List<ESBLink> getLinks() {
- return(m_links);
- }
-
- /**
- * This method converts the ESB action 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 node position of the action configuration
- * within the service descriptor.
- *
- * @return The action position
- */
- protected int getActionPosition() {
- org.w3c.dom.Element service=(org.w3c.dom.Element)
- getAction().getParentNode().getParentNode();
-
- int actionCount=0;
- boolean f_end=false;
-
- org.w3c.dom.NodeList acts=service.getElementsByTagName(ACTION_ELEMENT);
-
- for (int i=0; f_end == false &&
- i < acts.getLength(); i++) {
- org.w3c.dom.Node act=acts.item(i);
-
- actionCount++;
- if (act == getAction()) {
- f_end = true;
- }
- }
-
- return(actionCount);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model");
-
- private ESBService m_service=null;
- private org.w3c.dom.Element m_action=null;
- private java.util.List<ESBLink> m_links=new java.util.Vector<ESBLink>();
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java (from rev 398, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,624 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import java.util.logging.Logger;
+
+import org.scribble.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ESBModelUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ProblemDefinitions;
+
+/**
+ * This is the generic ESB action class.
+ *
+ * @author gary
+ */
+public abstract class AbstractESBAction extends ModelObject
+ implements ESBAction {
+
+ public static final String IDENTITIES = "identities";
+ public static final String ACTION_ELEMENT = "action";
+ public static final String VALUE_ATTR = "value";
+ public static final String NAME_ATTR = "name";
+ public static final String PROPERTY_ELEMENT = "property";
+ public static final String CLASS_PROPERTY = "class";
+
+ /**
+ * The constructor for initializing the action based on
+ * an existing DOM element.
+ */
+ protected AbstractESBAction(ESBService service,
+ org.w3c.dom.Element action) {
+ initExistingAction(service, action);
+ }
+
+ /**
+ * The contructor for initializing a new action.
+ */
+ protected AbstractESBAction(ESBService service,
+ String actionClass) {
+ initNewAction(service, actionClass);
+ }
+
+ /**
+ * This method initializes the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param actionClass The action class
+ */
+ protected void initNewAction(ESBService service,
+ String actionClass) {
+ m_service = service;
+
+ m_action = service.getService().
+ getOwnerDocument().createElement(ACTION_ELEMENT);
+
+ m_action.setAttribute(CLASS_PROPERTY, actionClass);
+
+ getSource().setObject(this);
+ }
+
+ /**
+ * This method initializes the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ protected void initExistingAction(ESBService service,
+ org.w3c.dom.Element action) {
+ m_service = service;
+ m_action = action;
+
+ int servicesStartPos=-1;
+
+ if (m_service.getModel() != null &&
+ m_service.getModel().getOriginalContents() != null &&
+ (servicesStartPos=m_service.getModel().
+ getOriginalContents().indexOf("<services>")) != -1) {
+
+ // Find positional information
+ int servCount=m_service.getServicePosition();
+ int actionCount=getActionPosition();
+
+ String str=m_service.getModel().getOriginalContents();
+
+ int startPosition=str.indexOf("<service", servicesStartPos+2);
+ int endPosition=-1;
+ int loggedEndPosition=-1;
+
+ while (startPosition != -1 && servCount > 0) {
+ servCount--;
+
+ endPosition = str.indexOf("</service>", startPosition);
+
+ if (servCount > 0) {
+ startPosition=str.indexOf("<service", endPosition);
+ }
+ }
+
+ int actionsStartPos=-1;
+
+ if (actionCount > 0 &&
+ startPosition != -1 && endPosition != -1 &&
+ (actionsStartPos=str.indexOf("<actions",
+ startPosition)) != -1 &&
+ actionsStartPos < endPosition) {
+ startPosition=str.indexOf("<action", actionsStartPos+2);
+ endPosition=-1;
+
+ while (startPosition != -1 && actionCount > 0) {
+ actionCount--;
+
+ loggedEndPosition = str.indexOf('>', startPosition);
+
+ endPosition = str.indexOf("</action>", startPosition);
+
+ if (actionCount > 0) {
+ startPosition=str.indexOf("<action", endPosition);
+ }
+ }
+
+ // Check whether single line element
+ int inlineEndPos=str.indexOf("/>", startPosition);
+ int nextStartPos=str.indexOf("<", startPosition+1);
+
+ if (inlineEndPos != -1 && inlineEndPos < nextStartPos) {
+ endPosition = inlineEndPos;
+ }
+ }
+
+ getSource().setStartPosition(startPosition);
+ getSource().setEndPosition(loggedEndPosition);
+
+ getSource().getProperties().put("path",
+ ESBModelUtil.getPath(m_action));
+
+ getSource().setObject(this);
+ }
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ public void initializeLinks() {
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ public void validate(ModelListener l) {
+
+ java.util.List<String> mandatory=getMandatoryProperties();
+
+ for (int i=0; i < mandatory.size(); i++) {
+ if (getPropertyValue(mandatory.get(i)) == null) {
+ java.util.Map<String,Object> props=new java.util.HashMap<String,Object>();
+ props.put(ProblemDefinitions.PROBLEM_PROPERTY,
+ mandatory.get(i));
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{mandatory.get(i)}), props));
+ }
+ }
+
+ java.util.List<String> propNames=getPropertyNames();
+
+ for (int i=0; i < propNames.size(); i++) {
+ String propName=propNames.get(i);
+
+ if (getOptionalProperties().contains(propName) == false &&
+ getMandatoryProperties().contains(propName) == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_UNKNOWN_PROPERTY",
+ new String[]{propName})));
+ }
+ }
+
+ String session=getPropertyValue(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
+
+ if (session != null) {
+ // Validate that the business object type exists
+ try {
+ ClassLoader cl=
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ClasspathUtil.getClassLoader(getService().getModel());
+
+ try {
+ Class.forName(session, true, cl);
+ } catch(ClassNotFoundException cfne) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
+ "_NOT_FOUND_BUSINESS_OBJECT_TYPE",
+ new String[]{session})));
+ }
+
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to load business class '"+session+"'", e);
+ }
+ }
+
+ // Validate links
+ for (int i=0; i < m_links.size(); i++) {
+ ESBLink link=(ESBLink)m_links.get(i);
+
+ if (link.getService() == null) {
+ // If target service not found, then report error
+ // unless it is a remote service, so defined in a
+ // different file
+ if (link.isRemote() == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
+ "_NOT_FOUND_SERVICE_DESCRIPTOR",
+ new String[]{link.getCategory(),link.getName()})));
+ }
+ } else if (getService().getSessionName() != null &&
+ isPerform() == false && link.isRemote() == false &&
+ link.getService().getSessionName() != null &&
+ getService().getSessionName().equals(
+ link.getService().getSessionName()) == false) {
+
+ java.util.Map<String,Object> props=new java.util.HashMap<String,Object>();
+ props.put(ProblemDefinitions.PROBLEM_PROPERTY,
+ DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
+
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MISMATCH_SESSION_CLASS",
+ new String[]{link.getCategory(),link.getName()}), props));
+ }
+ }
+ }
+
+ /**
+ * This method determines if the action represents a loop construct.
+ *
+ * @return Whether the action represents a loop construct
+ */
+ public boolean isLoop() {
+ return(false);
+ }
+
+ /**
+ * This method determines whether the action is related to a behavioural
+ * session.
+ *
+ * @return Whether the action is session based
+ */
+ public boolean isSessionBased() {
+ return(true);
+ }
+
+ /**
+ * This method determines whether the ESB action represents
+ * a CreateSessionAction.
+ *
+ * @return Whether the action is a CreateSessionAction
+ */
+ public boolean isCreateSession() {
+ return(false);
+ }
+
+ /**
+ * This method determines whether the action is a gateway
+ * for inbound requests.
+ *
+ * @return Whether the action is a gateway
+ */
+ public boolean isGateway() {
+ return(false);
+ }
+
+ /**
+ * This method indicates whether this action performs another
+ * sub-conversation.
+ *
+ * @return Whether the action is a 'perform'
+ */
+ public boolean isPerform() {
+ return(false);
+ }
+
+ /**
+ * This method indicates whether the action is an initiator.
+ * Initiator actions must precede any other session based
+ * action, within an ESB service.
+ *
+ * @return Whether the action is an initiator
+ */
+ public boolean isInitiator() {
+ return(false);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=new java.util.Vector<String>();
+ return(ret);
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=new java.util.Vector<String>();
+ ret.add(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
+ ret.add(IDENTITIES);
+ ret.add(DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY);
+ return(ret);
+ }
+
+ /**
+ * This method returns the action's class name.
+ *
+ * @return The action's class name
+ */
+ public String getActionClass() {
+ String ret=null;
+
+ if (m_action != null) {
+ ret = m_action.getAttribute(CLASS_PROPERTY);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the property value associated
+ * with the supplied name.
+ *
+ * @param property The property name
+ * @return The property value, or null if not found
+ */
+ public String getPropertyValue(String property) {
+ String ret=null;
+
+ if (m_action != null) {
+ org.w3c.dom.NodeList nl=m_action.getChildNodes();
+
+ for (int i=0; ret == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
+ ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
+ equals(property)) {
+ ret = ((org.w3c.dom.Element)nl.item(i)).getAttribute(VALUE_ATTR);
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines the property value, associated
+ * with the supplied name, is defined.
+ *
+ * @param property The property name
+ * @return Whether the property has been defined
+ */
+ public boolean hasProperty(String property) {
+ boolean ret=false;
+
+ if (m_action != null) {
+ org.w3c.dom.NodeList nl=m_action.getChildNodes();
+
+ for (int i=0; ret == false && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
+ ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
+ equals(property)) {
+ ret = true;
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the element associated with the
+ * requested property. If the property does not exist, then
+ * it will be created.
+ *
+ * @param property The property
+ * @return The element
+ */
+ public org.w3c.dom.Element getPropertyElement(String property) {
+ org.w3c.dom.Element ret=null;
+
+ if (m_action != null) {
+ org.w3c.dom.NodeList nl=
+ getAction().getElementsByTagName(PROPERTY_ELEMENT);
+
+ for (int i=0; ret == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
+
+ if (propName != null && propName.equals(property)) {
+ ret = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (ret == null) {
+ ret = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
+ ret.setAttribute(NAME_ATTR, property);
+
+ m_action.appendChild(ret);
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method removes the named property from the action.
+ *
+ * @param property The property name
+ */
+ public void removePropertyElement(String property) {
+
+ if (m_action != null) {
+ org.w3c.dom.Node prop=null;
+ org.w3c.dom.NodeList nl=
+ getAction().getElementsByTagName(PROPERTY_ELEMENT);
+
+ for (int i=0; prop == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
+
+ if (propName != null && propName.equals(property)) {
+ prop = nl.item(i);
+ }
+ }
+ }
+
+ if (prop != null) {
+ m_action.removeChild(prop);
+ }
+ }
+ }
+
+ /**
+ * This method returns the list of property names defined for
+ * this action.
+ *
+ * @return The list of property names
+ */
+ public java.util.List<String> getPropertyNames() {
+ java.util.List<String> ret=new java.util.Vector<String>();
+
+ if (m_action != null) {
+ org.w3c.dom.NodeList nl=m_action.getChildNodes();
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(PROPERTY_ELEMENT)) {
+ ret.add(((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR));
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the 'property' child nodes, associated with the
+ * supplied property name, within the action configuration.
+ *
+ * @param property The property name
+ * @return The list of child nodes
+ */
+ public org.w3c.dom.NodeList getPropertyChildNodes(String property) {
+ org.w3c.dom.NodeList ret=null;
+
+ org.w3c.dom.NodeList nl=m_action.getChildNodes();
+
+ for (int i=0; ret == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element &&
+ nl.item(i).getNodeName().equals(PROPERTY_ELEMENT) &&
+ ((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR).
+ equals(property)) {
+ ret = ((org.w3c.dom.Element)nl.item(i)).getChildNodes();
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the reference to the service that contains the
+ * action.
+ *
+ * @return The service
+ */
+ public ESBService getService() {
+ return(m_service);
+ }
+
+ /**
+ * This method sets the service description name property.
+ *
+ * @param name The service description name
+ */
+ public void setServiceDescriptionName(String name) {
+
+ org.w3c.dom.Element prop=getPropertyElement(
+ DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, name);
+ }
+ }
+
+ /**
+ * This method sets the business object type property.
+ *
+ * @param name The business object type
+ */
+ public void setBusinessObjectType(String type) {
+
+ org.w3c.dom.Element prop=getPropertyElement(
+ DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, type);
+ }
+ }
+
+ /**
+ * This method returns the XML configuration representation of the action.
+ *
+ * @return The XML configuration for the action
+ */
+ public org.w3c.dom.Element getAction() {
+ return(m_action);
+ }
+
+ /**
+ * This method returns the list of links established by this action.
+ *
+ * @return The list of links
+ */
+ protected java.util.List<ESBLink> getLinks() {
+ return(m_links);
+ }
+
+ /**
+ * This method converts the ESB action 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 node position of the action configuration
+ * within the service descriptor.
+ *
+ * @return The action position
+ */
+ protected int getActionPosition() {
+ org.w3c.dom.Element service=(org.w3c.dom.Element)
+ getAction().getParentNode().getParentNode();
+
+ int actionCount=0;
+ boolean f_end=false;
+
+ org.w3c.dom.NodeList acts=service.getElementsByTagName(ACTION_ELEMENT);
+
+ for (int i=0; f_end == false &&
+ i < acts.getLength(); i++) {
+ org.w3c.dom.Node act=acts.item(i);
+
+ actionCount++;
+ if (act == getAction()) {
+ f_end = true;
+ }
+ }
+
+ return(actionCount);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model");
+
+ private ESBService m_service=null;
+ private org.w3c.dom.Element m_action=null;
+ private java.util.List<ESBLink> m_links=new java.util.Vector<ESBLink>();
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractInteractionMessageAction.java (from rev 398, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractInteractionMessageAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/AbstractInteractionMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+
+/**
+ * The abstract model component for the 'ReceiveMessageAction'
+ * and 'SendMessageAction'.
+ *
+ * @author gary
+ */
+public abstract class AbstractInteractionMessageAction extends AbstractESBAction {
+
+ public static final String IDENTITIES = "identities";
+ public static final String MESSAGE_TYPE = "messageType";
+ public static final String OPERATION = "operation";
+ public static final String CLIENT_EPR = "clientEPR";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public AbstractInteractionMessageAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * The contructor for initializing a new action.
+ */
+ protected AbstractInteractionMessageAction(ESBService service,
+ String actionClass) {
+ super(service, actionClass);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(MESSAGE_TYPE);
+ ret.add(IDENTITIES);
+ return(ret);
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ @Override
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=super.getOptionalProperties();
+ ret.add(OPERATION);
+ ret.add(CLIENT_EPR);
+ return(ret);
+ }
+
+ /**
+ * This method sets the operation property.
+ *
+ * @param operation The operation
+ */
+ public void setOperation(String operation) {
+
+ if (operation != null) {
+ org.w3c.dom.Element prop=getPropertyElement(OPERATION);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, operation);
+ }
+ } else {
+ removePropertyElement(OPERATION);
+ }
+ }
+
+ /**
+ * This method sets the message type.
+ *
+ * @param type The message type
+ */
+ public void setMessageType(String type) {
+
+ org.w3c.dom.Element prop=getPropertyElement(MESSAGE_TYPE);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, type);
+ }
+ }
+
+ /**
+ * This method returns the message type.
+ *
+ * @return The message type
+ */
+ public String getMessageType() {
+ String ret=null;
+
+ org.w3c.dom.Element prop=getPropertyElement(MESSAGE_TYPE);
+
+ if (prop != null && prop.hasAttribute(VALUE_ATTR)) {
+ ret = prop.getAttribute(VALUE_ATTR);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method sets the client's EPR label property.
+ *
+ * @param epr The client EPR label
+ */
+ public void setClientEPR(String epr) {
+
+ org.w3c.dom.Element prop=getPropertyElement(CLIENT_EPR);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, epr);
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,170 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.ConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBActionFactory;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBService;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'CreateSessionAction'.
- *
- * @author gary
- */
-public class CreateSessionAction extends AbstractESBAction {
-
- public static final String ROOT = "root";
- public static final String CONVERSATION_TYPE = "conversationType";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public CreateSessionAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public CreateSessionAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- CreateSessionAction.class));
- }
-
- /**
- * This method determines whether the ESB action represents
- * a CreateSessionAction.
- *
- * @return Whether the action is a CreateSessionAction
- */
- public boolean isCreateSession() {
- return(true);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(CONVERSATION_TYPE);
- ret.add(ROOT);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Action must be first conversation based action in
- // the service
- if (getService() != null && getService().getActions().size() > 0) {
- ESBAction act=getService().getActions().get(0);
-
- if (act != this) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"CreateSession"}), null);
- }
- }
-
- // If service is root, then need to defined conversation type
- if (getService().isRoot()) {
- if (getService().getConversationType() == null) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_CONVERSATION_TYPE",
- new String[]{}), null);
- } else {
- int index=getService().getConversationType().indexOf('@');
- String convType=getService().getConversationType().trim();
-
- if (index == -1 || index == convType.length()-1) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_CONVERSATION_TYPE_ROLE",
- new String[]{convType}), null);
- }
- }
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- /**
- * This method sets the root property.
- *
- * @param root The root
- */
- public void setRoot(boolean root) {
-
- org.w3c.dom.Element prop=getPropertyElement(ROOT);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, ""+root);
- }
- }
-
- /**
- * This method sets the conversation type property.
- *
- * @param name The conversation type
- */
- public void setConversationType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(CONVERSATION_TYPE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,170 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ConversionContext;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBActionFactory;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBService;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'CreateSessionAction'.
+ *
+ * @author gary
+ */
+public class CreateSessionAction extends AbstractESBAction {
+
+ public static final String ROOT = "root";
+ public static final String CONVERSATION_TYPE = "conversationType";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public CreateSessionAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public CreateSessionAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ CreateSessionAction.class));
+ }
+
+ /**
+ * This method determines whether the ESB action represents
+ * a CreateSessionAction.
+ *
+ * @return Whether the action is a CreateSessionAction
+ */
+ public boolean isCreateSession() {
+ return(true);
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ @Override
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=super.getOptionalProperties();
+ ret.add(CONVERSATION_TYPE);
+ ret.add(ROOT);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // Action must be first conversation based action in
+ // the service
+ if (getService() != null && getService().getActions().size() > 0) {
+ ESBAction act=getService().getActions().get(0);
+
+ if (act != this) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_BE_FIRST_ACTION",
+ new String[]{"CreateSession"})));
+ }
+ }
+
+ // If service is root, then need to defined conversation type
+ if (getService().isRoot()) {
+ if (getService().getConversationType() == null) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_SPECIFIED_CONVERSATION_TYPE",
+ new String[]{})));
+ } else {
+ int index=getService().getConversationType().indexOf('@');
+ String convType=getService().getConversationType().trim();
+
+ if (index == -1 || index == convType.length()-1) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_SPECIFIED_CONVERSATION_TYPE_ROLE",
+ new String[]{convType})));
+ }
+ }
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+ /**
+ * This method sets the root property.
+ *
+ * @param root The root
+ */
+ public void setRoot(boolean root) {
+
+ org.w3c.dom.Element prop=getPropertyElement(ROOT);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, ""+root);
+ }
+ }
+
+ /**
+ * This method sets the conversation type property.
+ *
+ * @param name The conversation type
+ */
+ public void setConversationType(String type) {
+
+ org.w3c.dom.Element prop=getPropertyElement(CONVERSATION_TYPE);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, type);
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,322 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'IfAction'.
- *
- * @author gary
- */
-public class IfAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String IMMEDIATE = "immediate";
- public static final String EXPRESSION = "expression";
- public static final String ELSE = "else";
- public static final String ELSEIF = "elseif";
- public static final String IF = "if";
- public static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public IfAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public IfAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- IfAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- (n.getNodeName().equals(IF) ||
- n.getNodeName().equals(ELSEIF) ||
- n.getNodeName().equals(ELSE))) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_if=false;
- boolean f_else=false;
- boolean f_orderWrong=false;
- boolean f_serviceDetailsMissing=false;
- boolean f_immediateInvalid=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(IF)) {
- if (f_if) {
- f_orderWrong = true;
- }
-
- f_if = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(ELSEIF)) {
-
- if (f_if == false || f_else) {
- f_orderWrong = true;
- }
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(ELSE)) {
-
- if (f_if == false || f_else) {
- f_orderWrong = true;
- }
-
- f_else = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && (f_if == false || f_orderWrong)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_IF_ORDER_WRONG",
- new String[]{}), null);
- }
-
- if (f_serviceDetailsMissing) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}), null);
- }
-
- if (f_immediateInvalid) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- If choice=new If();
- activities.add(choice);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(IF) ||
- n.getNodeName().equals(ELSEIF)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // TODO: Convert the conditional expression if defined
-
- ConditionalBlock cond=new ConditionalBlock();
- choice.getConditionalBlocks().add(cond);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(cond.getContents(), context);
- }
- } else if (n.getNodeName().equals(ELSE)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- Block block=new Block();
- choice.setElseBlock(block);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(block.getContents(), context);
- }
- }
- }
- }
- }
-
- /**
- * This method adds a path to the if action.
- *
- * @param type The type of path (IF, ELSEIF or ELSE)
- * @param category The service category
- * @param name The service name
- * @param immediate Whether invocation should be immediate
- * @param expr The expression, if type is IF or ELSEIF
- * @param position The position, if type is ELSEIF
- */
- public void addPath(String type, String category, String name,
- boolean immediate, String expr, int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=getAction().getOwnerDocument().createElement(type);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
- path.setAttribute(IMMEDIATE, ""+immediate);
-
- if (expr != null && (type == IF || type == ELSEIF)) {
- path.setAttribute(EXPRESSION, expr);
- }
-
- paths.appendChild(path);
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,322 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'IfAction'.
+ *
+ * @author gary
+ */
+public class IfAction extends AbstractESBAction {
+
+ public static final String SERVICE_NAME = "service-name";
+ public static final String SERVICE_CATEGORY = "service-category";
+ public static final String IMMEDIATE = "immediate";
+ public static final String EXPRESSION = "expression";
+ public static final String ELSE = "else";
+ public static final String ELSEIF = "elseif";
+ public static final String IF = "if";
+ public static final String PATHS = "paths";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public IfAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public IfAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ IfAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element &&
+ (n.getNodeName().equals(IF) ||
+ n.getNodeName().equals(ELSEIF) ||
+ n.getNodeName().equals(ELSE))) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ ESBService service=getService().getModel().getService(category, name);
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(category, name, service,
+ (immediate != null && immediate.equalsIgnoreCase("true"))));
+ }
+ }
+ }
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(PATHS);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+ boolean f_if=false;
+ boolean f_else=false;
+ boolean f_orderWrong=false;
+ boolean f_serviceDetailsMissing=false;
+ boolean f_immediateInvalid=false;
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(IF)) {
+ if (f_if) {
+ f_orderWrong = true;
+ }
+
+ f_if = true;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
+ immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ f_immediateInvalid = true;
+ }
+ } else if (n.getNodeName().equals(ELSEIF)) {
+
+ if (f_if == false || f_else) {
+ f_orderWrong = true;
+ }
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
+ immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ f_immediateInvalid = true;
+ }
+ } else if (n.getNodeName().equals(ELSE)) {
+
+ if (f_if == false || f_else) {
+ f_orderWrong = true;
+ }
+
+ f_else = true;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
+ immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ f_immediateInvalid = true;
+ }
+ }
+ }
+ }
+
+ // Report any errors
+ if (nl != null && (f_if == false || f_orderWrong)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_IF_ORDER_WRONG",
+ new String[]{})));
+ }
+
+ if (f_serviceDetailsMissing) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PATH_SERVICE_DETAILS_MISSING",
+ new String[]{})));
+ }
+
+ if (f_immediateInvalid) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_BOOLEAN",
+ new String[]{IMMEDIATE})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ If choice=new If();
+ activities.add(choice);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(IF) ||
+ n.getNodeName().equals(ELSEIF)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // TODO: Convert the conditional expression if defined
+
+ ConditionalBlock cond=new ConditionalBlock();
+ choice.getConditionalBlocks().add(cond);
+
+ ESBService service=getService().getModel().getService(category, name);
+
+ if (service != null) {
+ service.convert(cond.getContents(), context);
+ }
+ } else if (n.getNodeName().equals(ELSE)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ Block block=new Block();
+ choice.setElseBlock(block);
+
+ ESBService service=getService().getModel().getService(category, name);
+
+ if (service != null) {
+ service.convert(block.getContents(), context);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method adds a path to the if action.
+ *
+ * @param type The type of path (IF, ELSEIF or ELSE)
+ * @param category The service category
+ * @param name The service name
+ * @param immediate Whether invocation should be immediate
+ * @param expr The expression, if type is IF or ELSEIF
+ * @param position The position, if type is ELSEIF
+ */
+ public void addPath(String type, String category, String name,
+ boolean immediate, String expr, int position) {
+
+ org.w3c.dom.NodeList nl=
+ getAction().getElementsByTagName(PROPERTY_ELEMENT);
+
+ org.w3c.dom.Element paths=null;
+
+ for (int i=0; paths == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
+
+ if (propName != null && propName.equals(PATHS)) {
+ paths = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (paths == null) {
+ paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
+ paths.setAttribute(NAME_ATTR, PATHS);
+
+ getAction().appendChild(paths);
+ }
+
+ org.w3c.dom.Element path=getAction().getOwnerDocument().createElement(type);
+ path.setAttribute(SERVICE_CATEGORY, category);
+ path.setAttribute(SERVICE_NAME, name);
+ path.setAttribute(IMMEDIATE, ""+immediate);
+
+ if (expr != null && (type == IF || type == ELSEIF)) {
+ path.setAttribute(EXPRESSION, expr);
+ }
+
+ paths.appendChild(path);
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,342 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.IdentityUtil;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'MessageRouterAction'. Although
- * not an integral part of the behaviour of a service, it provides
- * a behavioural gateway to ensure that messages sent to a
- * specific endpoint reference are routed to the appropriate
- * ESB service descriptor. Therefore the routing configuration
- * needs to be synchronized with the definition of the service
- * descriptors representing the various behavioural states associated
- * with a service.
- *
- * @author gary
- */
-public class MessageRouterAction extends AbstractESBAction {
-
- public static final String IDENTITIES_ELEMENT = "identities";
- public static final String INITIATE = "initiate";
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String ROUTE = "route";
- public static final String PATHS = "paths";
- public static final String MESSAGE_ELEMENT="message";
- public static final String TYPE_ATTR="type";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public MessageRouterAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public MessageRouterAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- MessageRouterAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(ROUTE)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
- String initiate=((org.w3c.dom.Element)n).getAttribute(INITIATE);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service, true));
-
- if (service != null) {
- if (initiate != null && initiate.equalsIgnoreCase("true")) {
- m_initiateServices.add(service);
- } else {
- m_services.add(service);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * This method determines whether the action is related to a behavioural
- * session.
- *
- * @return Whether the action is session based
- */
- public boolean isSessionBased() {
- return(false);
- }
-
- /**
- * This method determines whether the action is a gateway
- * for inbound requests.
- *
- * @return Whether the action is a gateway
- */
- public boolean isGateway() {
- return(true);
- }
-
- /**
- * This method adds a route to the message router action.
- *
- * @param category The service category
- * @param name The service name
- * @param initiate Whether the route initiates the service
- * @param messageTypes The list of message types
- */
- public void addRoute(String category, String name, boolean initiate,
- java.util.List<MessageSignature> messageTypes) {
-
- org.w3c.dom.Element paths=getPropertyElement(PATHS);
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(ROUTE);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- if (initiate) {
- path.setAttribute(INITIATE, Boolean.toString(initiate));
- }
-
- for (int i=0; i < messageTypes.size(); i++) {
- org.w3c.dom.Element mt=
- getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
-
- if (messageTypes.get(i).getTypes().size() == 1) {
- TypeReference ref=messageTypes.get(i).getTypes().get(0);
- String type="";
-
- if (ref.getNamespace() != null) {
- type += "{"+ref.getNamespace()+"}";
- }
- type += ref.getLocalpart();
-
- mt.setAttribute(TYPE_ATTR, type);
-
- path.appendChild(mt);
-
- if (messageTypes.get(i).getParent() instanceof ConversationInteraction &&
- ((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition() instanceof Conversation &&
- ((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition().getModel()
- instanceof ConversationModel) {
-
- org.w3c.dom.Element identities=
- mt.getOwnerDocument().createElement(IDENTITIES_ELEMENT);
-
- java.util.List<Identity> ids=((Conversation)
- ((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition()).getIdentities();
-
- java.util.List<IdentityLocator> locators=
- ((ConversationModel)((ConversationInteraction)messageTypes.get(i).getParent()).
- getEnclosingDefinition().
- getModel()).getIdentityLocators();
-
- IdentityUtil.defineIdentities(identities, messageTypes.get(i),
- ids, locators);
-
- mt.appendChild(identities);
- }
-
- } else {
- logger.warning("Can only handle single type message signatures");
- }
- }
-
- paths.appendChild(path);
- }
-
- /**
- * This method returns the number of routes associated with
- * the message router.
- *
- * @return The number of routes
- */
- public int getNumberOfRoutes() {
- int ret=0;
-
- org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
-
- ret = nl.getLength();
-
- return(ret);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Check that message router has no other session based
- // ESB actions in the same service descriptor
- if (getService().isSessionBased()) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER",
- new String[]{}), null);
- }
-
- // Check that 'initate' services have a 'CreateSessionAction' and
- // represent the root behaviour
- for (int i=0; i < m_initiateServices.size(); i++) {
- ESBService service=m_initiateServices.get(i);
-
- if (service.isRoot() == false) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_CANNOT_INITIATE_NON_ROOT",
- new String[]{service.getCategory(),
- service.getName()}), null);
- }
- }
-
- // Check that non-'initate' services don't have a 'CreateSessionAction' and
- // represent the root behaviour
- for (int i=0; i < m_services.size(); i++) {
- ESBService service=m_services.get(i);
-
- if (service.isRoot()) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_INITIATE_ROOT",
- new String[]{service.getCategory(),
- service.getName()}), null);
- }
- }
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_serviceDetailsMissing=false;
- int routeCount=0;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(ROUTE)) {
- routeCount++;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && routeCount < 1) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_ROUTER_ONE_OR_MORE_PATHS",
- new String[]{}), null);
- }
-
- if (f_serviceDetailsMissing) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.actions");
-
- private java.util.List<ESBService> m_initiateServices=new java.util.Vector<ESBService>();
- private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,384 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.IdentityUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'MessageRouterAction'. Although
+ * not an integral part of the behaviour of a service, it provides
+ * a behavioural gateway to ensure that messages sent to a
+ * specific endpoint reference are routed to the appropriate
+ * ESB service descriptor. Therefore the routing configuration
+ * needs to be synchronized with the definition of the service
+ * descriptors representing the various behavioural states associated
+ * with a service.
+ *
+ * @author gary
+ */
+public class MessageRouterAction extends AbstractESBAction {
+
+ public static final String IDENTITIES_ELEMENT = "identities";
+ public static final String INITIATE = "initiate";
+ public static final String SERVICE_NAME = "service-name";
+ public static final String SERVICE_CATEGORY = "service-category";
+ public static final String ROUTE = "route";
+ public static final String PATHS = "paths";
+ public static final String MESSAGE_ELEMENT="message";
+ public static final String TYPE_ATTR="type";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public MessageRouterAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public MessageRouterAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ MessageRouterAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(ROUTE)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+ String initiate=((org.w3c.dom.Element)n).getAttribute(INITIATE);
+
+ // Lookup service associated with category and name
+ ESBService service=getService().getModel().getService(category, name);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(category, name, service, true));
+
+ if (service != null) {
+ if (initiate != null && initiate.equalsIgnoreCase("true")) {
+ m_initiateServices.add(service);
+ } else {
+ m_services.add(service);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method determines whether the action is related to a behavioural
+ * session.
+ *
+ * @return Whether the action is session based
+ */
+ public boolean isSessionBased() {
+ return(false);
+ }
+
+ /**
+ * This method determines whether the action is a gateway
+ * for inbound requests.
+ *
+ * @return Whether the action is a gateway
+ */
+ public boolean isGateway() {
+ return(true);
+ }
+
+ /**
+ * This method adds a route to the message router action.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @param initiate Whether the route initiates the service
+ * @param messageTypes The list of message types
+ */
+ public void addRoute(String category, String name, boolean initiate,
+ java.util.List<MessageSignature> messageTypes) {
+
+ org.w3c.dom.Element paths=getPropertyElement(PATHS);
+
+ org.w3c.dom.Element path=
+ getAction().getOwnerDocument().createElement(ROUTE);
+ path.setAttribute(SERVICE_CATEGORY, category);
+ path.setAttribute(SERVICE_NAME, name);
+
+ if (initiate) {
+ path.setAttribute(INITIATE, Boolean.toString(initiate));
+ }
+
+ for (int i=0; i < messageTypes.size(); i++) {
+ org.w3c.dom.Element mt=
+ getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
+
+ if (messageTypes.get(i).getTypes().size() == 1) {
+ TypeReference ref=messageTypes.get(i).getTypes().get(0);
+
+ mt.setAttribute(TYPE_ATTR, InteractionUtil.getTypeString(ref));
+
+ path.appendChild(mt);
+
+ if (messageTypes.get(i).getParent() instanceof ConversationInteraction &&
+ ((ConversationInteraction)messageTypes.get(i).getParent()).
+ getEnclosingDefinition() instanceof Conversation &&
+ ((ConversationInteraction)messageTypes.get(i).getParent()).
+ getEnclosingDefinition().getModel()
+ instanceof ConversationModel) {
+
+ org.w3c.dom.Element identities=
+ mt.getOwnerDocument().createElement(IDENTITIES_ELEMENT);
+
+ java.util.List<Identity> ids=((Conversation)
+ ((ConversationInteraction)messageTypes.get(i).getParent()).
+ getEnclosingDefinition()).getIdentities();
+
+ java.util.List<IdentityLocator> locators=
+ ((ConversationModel)((ConversationInteraction)messageTypes.get(i).getParent()).
+ getEnclosingDefinition().
+ getModel()).getIdentityLocators();
+
+ IdentityUtil.defineIdentities(identities, messageTypes.get(i),
+ ids, locators);
+
+ mt.appendChild(identities);
+ }
+
+ } else {
+ logger.warning("Can only handle single type message signatures");
+ }
+ }
+
+ paths.appendChild(path);
+ }
+
+ /**
+ * This method returns the number of routes associated with
+ * the message router.
+ *
+ * @return The number of routes
+ */
+ public int getNumberOfRoutes() {
+ int ret=0;
+
+ org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
+
+ ret = nl.getLength();
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the DOM element associated with the
+ * specified route.
+ *
+ * @param index The index of the required route
+ * @return The route element, or null if not found
+ */
+ public org.w3c.dom.Element getRouteElement(int index) {
+ org.w3c.dom.Element ret=null;
+
+ org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
+
+ if (index >= 0 && index < nl.getLength() &&
+ nl.item(index) instanceof org.w3c.dom.Element) {
+ ret = (org.w3c.dom.Element)nl.item(index);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the DOM element associated with the
+ * specified service category and name.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @return The route element, or null if not found
+ */
+ public org.w3c.dom.Element getRouteElement(String category,
+ String name) {
+ org.w3c.dom.Element ret=null;
+
+ org.w3c.dom.NodeList nl=getAction().getElementsByTagName(ROUTE);
+
+ for (int i=0; ret == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ ret = (org.w3c.dom.Element)nl.item(i);
+
+ if (ret.getAttribute(SERVICE_CATEGORY).equals(category) == false ||
+ ret.getAttribute(SERVICE_NAME).equals(name) == false) {
+ ret = null;
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(PATHS);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // Check that message router has no other session based
+ // ESB actions in the same service descriptor
+ if (getService().isSessionBased()) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER",
+ new String[]{})));
+ }
+
+ // Check that 'initate' services have a 'CreateSessionAction' and
+ // represent the root behaviour
+ for (int i=0; i < m_initiateServices.size(); i++) {
+ ESBService service=m_initiateServices.get(i);
+
+ if (service.isRoot() == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_CANNOT_INITIATE_NON_ROOT",
+ new String[]{service.getCategory(),
+ service.getName()})));
+ }
+ }
+
+ // Check that non-'initate' services don't have a 'CreateSessionAction' and
+ // represent the root behaviour
+ for (int i=0; i < m_services.size(); i++) {
+ ESBService service=m_services.get(i);
+
+ if (service.isRoot()) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_INITIATE_ROOT",
+ new String[]{service.getCategory(),
+ service.getName()})));
+ }
+ }
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+ boolean f_serviceDetailsMissing=false;
+ int routeCount=0;
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(ROUTE)) {
+ routeCount++;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+ }
+ }
+ }
+
+ // Report any errors
+ if (nl != null && routeCount < 1) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_ROUTER_ONE_OR_MORE_PATHS",
+ new String[]{})));
+ }
+
+ if (f_serviceDetailsMissing) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PATH_SERVICE_DETAILS_MISSING",
+ new String[]{})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions");
+
+ private java.util.List<ESBService> m_initiateServices=new java.util.Vector<ESBService>();
+ private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,325 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'ParallelAction'.
- *
- * @author gary
- */
-public class ParallelAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String IMMEDIATE = "immediate";
- private static final String JOIN = "join";
- private static final String PATH = "path";
- private static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public ParallelAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public ParallelAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- ParallelAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(PATH)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
-
- if (service != null) {
- m_services.add(service);
- }
- }
- } else if (n.getNodeName().equals(JOIN)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- m_joinCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- m_joinName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
- }
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_joined=false;
- int pathCount=0;
- boolean f_pathAfterJoin=false;
- boolean f_multipleJoins=false;
- boolean f_serviceDetailsMissing=false;
- boolean f_immediateInvalid=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(PATH)) {
- pathCount++;
-
- if (f_joined) {
- f_pathAfterJoin = true;
- }
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(JOIN)) {
-
- if (f_joined) {
- f_multipleJoins = true;
- }
-
- f_joined = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && pathCount < 2) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PARALLEL_MORE_THAN_TWO_PATHS",
- new String[]{}), null);
- }
-
- if (f_pathAfterJoin) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PARALLEL_PATH_AFTER_JOIN",
- new String[]{}), null);
- }
-
- if (f_multipleJoins) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MULTIPLE_JOINS",
- new String[]{}), null);
- }
-
- if (f_serviceDetailsMissing) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}), null);
- }
-
- if (f_immediateInvalid) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- Parallel parallel=new Parallel();
- activities.add(parallel);
-
- parallel.derivedFrom(this);
-
- if (m_joinService != null) {
- context.markJoin(m_joinService);
- }
-
- for (int i=0; i < m_services.size(); i++) {
- Block block=new Block();
-
- ESBService service=m_services.get(i);
-
- if (service != null) {
- service.convert(block.getContents(), context);
- }
-
- // TODO: Only temporary check while conformance
- // check does not handle
- //if (block.getContents().size() > 0) {
- parallel.getBlocks().add(block);
- //}
- }
-
- // TODO: Only temporary check while conformance
- // check does not handle
- //if (parallel.getBlocks().size() == 0) {
- // activities.remove(parallel);
- //}
-
- if (m_joinService != null) {
- m_joinService.convert(activities, context);
- }
- }
-
- /**
- * This method adds a path to the parallel action.
- *
- * @param category The service category
- * @param name The service name
- * @param immediate Whether invocation should be immediate
- * @param join Whether the path is for the parallel, or join
- * @param position The position
- */
- public void addPath(String category, String name,
- boolean immediate, boolean join, int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(join ? JOIN : PATH);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- if (immediate) {
- path.setAttribute(IMMEDIATE, Boolean.TRUE.toString());
- }
-
- paths.appendChild(path);
- }
-
- private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
- private String m_joinCategory=null;
- private String m_joinName=null;
- private ESBService m_joinService=null;
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,325 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'ParallelAction'.
+ *
+ * @author gary
+ */
+public class ParallelAction extends AbstractESBAction {
+
+ public static final String SERVICE_NAME = "service-name";
+ public static final String SERVICE_CATEGORY = "service-category";
+ public static final String IMMEDIATE = "immediate";
+ private static final String JOIN = "join";
+ private static final String PATH = "path";
+ private static final String PATHS = "paths";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public ParallelAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public ParallelAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ ParallelAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(PATH)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ ESBService service=getService().getModel().getService(category, name);
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(category, name, service,
+ (immediate != null && immediate.equalsIgnoreCase("true"))));
+
+ if (service != null) {
+ m_services.add(service);
+ }
+ }
+ } else if (n.getNodeName().equals(JOIN)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ m_joinCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ m_joinName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(PATHS);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+ boolean f_joined=false;
+ int pathCount=0;
+ boolean f_pathAfterJoin=false;
+ boolean f_multipleJoins=false;
+ boolean f_serviceDetailsMissing=false;
+ boolean f_immediateInvalid=false;
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(PATH)) {
+ pathCount++;
+
+ if (f_joined) {
+ f_pathAfterJoin = true;
+ }
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
+ immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ f_immediateInvalid = true;
+ }
+ } else if (n.getNodeName().equals(JOIN)) {
+
+ if (f_joined) {
+ f_multipleJoins = true;
+ }
+
+ f_joined = true;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+ }
+ }
+ }
+
+ // Report any errors
+ if (nl != null && pathCount < 2) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PARALLEL_MORE_THAN_TWO_PATHS",
+ new String[]{})));
+ }
+
+ if (f_pathAfterJoin) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PARALLEL_PATH_AFTER_JOIN",
+ new String[]{})));
+ }
+
+ if (f_multipleJoins) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MULTIPLE_JOINS",
+ new String[]{})));
+ }
+
+ if (f_serviceDetailsMissing) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PATH_SERVICE_DETAILS_MISSING",
+ new String[]{})));
+ }
+
+ if (f_immediateInvalid) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_BOOLEAN",
+ new String[]{IMMEDIATE})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ Parallel parallel=new Parallel();
+ activities.add(parallel);
+
+ parallel.derivedFrom(this);
+
+ if (m_joinService != null) {
+ context.markJoin(m_joinService);
+ }
+
+ for (int i=0; i < m_services.size(); i++) {
+ Block block=new Block();
+
+ ESBService service=m_services.get(i);
+
+ if (service != null) {
+ service.convert(block.getContents(), context);
+ }
+
+ // TODO: Only temporary check while conformance
+ // check does not handle
+ //if (block.getContents().size() > 0) {
+ parallel.getBlocks().add(block);
+ //}
+ }
+
+ // TODO: Only temporary check while conformance
+ // check does not handle
+ //if (parallel.getBlocks().size() == 0) {
+ // activities.remove(parallel);
+ //}
+
+ if (m_joinService != null) {
+ m_joinService.convert(activities, context);
+ }
+ }
+
+ /**
+ * This method adds a path to the parallel action.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @param immediate Whether invocation should be immediate
+ * @param join Whether the path is for the parallel, or join
+ * @param position The position
+ */
+ public void addPath(String category, String name,
+ boolean immediate, boolean join, int position) {
+
+ org.w3c.dom.NodeList nl=
+ getAction().getElementsByTagName(PROPERTY_ELEMENT);
+
+ org.w3c.dom.Element paths=null;
+
+ for (int i=0; paths == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
+
+ if (propName != null && propName.equals(PATHS)) {
+ paths = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (paths == null) {
+ paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
+ paths.setAttribute(NAME_ATTR, PATHS);
+
+ getAction().appendChild(paths);
+ }
+
+ org.w3c.dom.Element path=
+ getAction().getOwnerDocument().createElement(join ? JOIN : PATH);
+ path.setAttribute(SERVICE_CATEGORY, category);
+ path.setAttribute(SERVICE_NAME, name);
+
+ if (immediate) {
+ path.setAttribute(IMMEDIATE, Boolean.TRUE.toString());
+ }
+
+ paths.appendChild(path);
+ }
+
+ private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
+ private String m_joinCategory=null;
+ private String m_joinName=null;
+ private ESBService m_joinService=null;
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,275 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.PropertyUtil;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'WhenAction'.
- *
- * @author gary
- */
-public class PerformAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "serviceName";
- public static final String SERVICE_CATEGORY = "serviceCategory";
- public static final String RETURN_SERVICE_NAME = "returnServiceName";
- public static final String RETURN_SERVICE_CATEGORY = "returnServiceCategory";
- public static final String BIND_DETAILS = "bindDetails";
- public static final String PARENT_PROPERTY = "parentProperty";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public PerformAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public PerformAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- PerformAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- m_category=getPropertyValue(SERVICE_CATEGORY);
- m_name=getPropertyValue(SERVICE_NAME);
-
- if (m_category != null && m_name != null) {
- m_service=getService().getModel().getService(m_category, m_name);
-
- getLinks().add(new ESBLink(m_category, m_name, m_service, true));
- }
-
- m_joinCategory=getPropertyValue(RETURN_SERVICE_CATEGORY);
- m_joinName=getPropertyValue(RETURN_SERVICE_NAME);
-
- if (m_joinCategory != null && m_joinName != null) {
- m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
-
- getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
- }
- }
-
- /**
- * This method indicates whether this action performs another
- * sub-conversation.
- *
- * @return Whether the action is a 'perform'
- */
- @Override
- public boolean isPerform() {
- return(true);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(SERVICE_CATEGORY);
- ret.add(SERVICE_NAME);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(RETURN_SERVICE_NAME);
- ret.add(RETURN_SERVICE_CATEGORY);
- ret.add(BIND_DETAILS);
- ret.add(PARENT_PROPERTY);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Check if performed state starts with a create session action
- if (m_service != null) {
-
- if (m_service.isCreateSession() == false) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_PERFORM_CREATE_SESSION",
- new String[]{}), null);
- }
-
- // Check if performed service has relevant bind
- // and parent properties
- if (m_service.getSessionClass() != null &&
- hasProperty(PARENT_PROPERTY)) {
- String parentProperty=getPropertyValue(PARENT_PROPERTY);
-
- if (PropertyUtil.hasWritableProperty(m_service.getSessionClass(),
- parentProperty) == false) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{parentProperty,
- m_service.getSessionClass().getName()}), null);
- }
-
-
- Class<?> parentCls=PropertyUtil.getPropertyType(
- m_service.getSessionClass(), parentProperty);
-
- if (parentCls != null && getService() != null &&
- getService().getSessionClass() != null &&
- parentCls != getService().getSessionClass()) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_INVALID_PROPERTY_TYPE",
- new String[]{parentProperty,
- m_service.getSessionClass().getName(),
- getService().getSessionClass().getName()}), null);
- }
-
- }
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- Compose elem=null;
-
- // Check if perform is asynchronous
- if (hasProperty(RETURN_SERVICE_NAME)) {
- elem = new Run();
- } else {
- elem = new Spawn();
- }
-
- activities.add(elem);
-
- elem.derivedFrom(this);
-
- Conversation definition=new Conversation();
-
- elem.setInlineDefinition(definition);
-
- if (m_service != null) {
- // TODO: May need to be separate definition, in case the
- // same state is called from a number of different
- // places
- m_service.convert(definition.getBlock().getContents(), context);
- }
-
- if (m_joinService != null) {
- m_joinService.convert(activities, context);
- }
- }
-
- /**
- * This method sets the destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- /**
- * This method sets the return destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setReturnDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(RETURN_SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(RETURN_SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- private String m_category=null;
- private String m_name=null;
- private ESBService m_service=null;
- private String m_joinCategory=null;
- private String m_joinName=null;
- private ESBService m_joinService=null;
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java (from rev 369, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,323 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.PropertyUtil;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'WhenAction'.
+ *
+ * @author gary
+ */
+public class PerformAction extends AbstractESBAction {
+
+ private static final String BIND_ELEMENT = "bind";
+ private static final String TO_VARIABLE_ATTR = "to-variable";
+ public static final String SERVICE_NAME = "serviceName";
+ public static final String SERVICE_CATEGORY = "serviceCategory";
+ public static final String RETURN_SERVICE_NAME = "returnServiceName";
+ public static final String RETURN_SERVICE_CATEGORY = "returnServiceCategory";
+ public static final String BIND_DETAILS = "bindDetails";
+ public static final String PARENT_REFERENCE = "parentReference";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public PerformAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public PerformAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ PerformAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ m_category=getPropertyValue(SERVICE_CATEGORY);
+ m_name=getPropertyValue(SERVICE_NAME);
+
+ if (m_category != null && m_name != null) {
+ m_service=getService().getModel().getService(m_category, m_name);
+
+ getLinks().add(new ESBLink(m_category, m_name, m_service, true));
+ }
+
+ m_joinCategory=getPropertyValue(RETURN_SERVICE_CATEGORY);
+ m_joinName=getPropertyValue(RETURN_SERVICE_NAME);
+
+ if (m_joinCategory != null && m_joinName != null) {
+ m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
+
+ getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
+ }
+ }
+
+ /**
+ * This method indicates whether this action performs another
+ * sub-conversation.
+ *
+ * @return Whether the action is a 'perform'
+ */
+ @Override
+ public boolean isPerform() {
+ return(true);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(SERVICE_CATEGORY);
+ ret.add(SERVICE_NAME);
+ return(ret);
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ @Override
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=super.getOptionalProperties();
+ ret.add(RETURN_SERVICE_NAME);
+ ret.add(RETURN_SERVICE_CATEGORY);
+ ret.add(BIND_DETAILS);
+ ret.add(PARENT_REFERENCE);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // Check if performed state starts with a create session action
+ if (m_service != null &&
+ m_service.isCreateSession() == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_PERFORM_CREATE_SESSION",
+ new String[]{})));
+ }
+
+ // Check if performed service has relevant bind
+ // and parent properties
+ if (m_service != null &&
+ m_service.getSessionClass() != null) {
+
+ if (hasProperty(PARENT_REFERENCE)) {
+ String parentRefProperty=getPropertyValue(PARENT_REFERENCE);
+
+ if (PropertyUtil.isProperty(m_service.getSessionClass(),
+ parentRefProperty) == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_VARIABLE",
+ new String[]{parentRefProperty,
+ m_service.getSessionClass().getName()})));
+ } else if (PropertyUtil.hasWritableProperty(m_service.getSessionClass(),
+ parentRefProperty) == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_WRITABLE_PROPERTY",
+ new String[]{parentRefProperty,
+ m_service.getSessionClass().getName()})));
+ }
+
+ Class<?> parentCls=PropertyUtil.getPropertyType(
+ m_service.getSessionClass(), parentRefProperty);
+
+ if (parentCls != null && getService() != null &&
+ getService().getSessionClass() != null &&
+ parentCls.isAssignableFrom(
+ getService().getSessionClass()) == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_INVALID_PROPERTY_TYPE",
+ new String[]{parentRefProperty,
+ m_service.getSessionClass().getName(),
+ getService().getSessionClass().getName()})));
+ }
+ }
+
+ if (hasProperty(BIND_DETAILS)) {
+ org.w3c.dom.Element elem=getPropertyElement(BIND_DETAILS);
+
+ org.w3c.dom.NodeList nl=elem.getElementsByTagName(BIND_ELEMENT);
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element bind=(org.w3c.dom.Element)nl.item(i);
+
+ if (bind.hasAttribute(TO_VARIABLE_ATTR)) {
+ String variable=bind.getAttribute(TO_VARIABLE_ATTR);
+
+ if (PropertyUtil.isProperty(m_service.getSessionClass(),
+ variable) == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_VARIABLE",
+ new String[]{variable,
+ m_service.getSessionClass().getName()})));
+
+ } else if (PropertyUtil.hasWritableProperty(m_service.getSessionClass(),
+ variable) == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_WRITABLE_PROPERTY",
+ new String[]{variable,
+ m_service.getSessionClass().getName()})));
+ }
+ } else {
+ // Possibly report if 'to-variable' not
+ // defined?
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ Compose elem=null;
+
+ // Check if perform is asynchronous
+ if (hasProperty(RETURN_SERVICE_NAME)) {
+ elem = new Run();
+ } else {
+ elem = new Spawn();
+ }
+
+ activities.add(elem);
+
+ elem.derivedFrom(this);
+
+ Conversation definition=new Conversation();
+
+ elem.setInlineDefinition(definition);
+
+ if (m_service != null) {
+ // TODO: May need to be separate definition, in case the
+ // same state is called from a number of different
+ // places
+ m_service.convert(definition.getBlock().getContents(), context);
+ }
+
+ if (m_joinService != null) {
+ m_joinService.convert(activities, context);
+ }
+ }
+
+ /**
+ * This method sets the destination service descriptor properties.
+ *
+ * @param category The category
+ * @param name The name
+ */
+ public void setDestination(String category, String name) {
+
+ org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, category);
+ }
+
+ prop = getPropertyElement(SERVICE_NAME);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, name);
+ }
+ }
+
+ /**
+ * This method sets the return destination service descriptor properties.
+ *
+ * @param category The category
+ * @param name The name
+ */
+ public void setReturnDestination(String category, String name) {
+
+ org.w3c.dom.Element prop=getPropertyElement(RETURN_SERVICE_CATEGORY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, category);
+ }
+
+ prop = getPropertyElement(RETURN_SERVICE_NAME);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, name);
+ }
+ }
+
+ private String m_category=null;
+ private String m_name=null;
+ private ESBService m_service=null;
+ private String m_joinCategory=null;
+ private String m_joinName=null;
+ private ESBService m_joinService=null;
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,178 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'ReceiveMessageAction'.
- *
- * @author gary
- */
-public class ReceiveMessageAction extends AbstractESBAction {
-
- public static final String IDENTITIES = "identities";
- public static final String MESSAGE_TYPE = "messageType";
- public static final String OPERATION = "operation";
- public static final String CLIENT_EPR = "clientEPR";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public ReceiveMessageAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public ReceiveMessageAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- ReceiveMessageAction.class));
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(MESSAGE_TYPE);
- ret.add(IDENTITIES);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(OPERATION);
- ret.add(CLIENT_EPR);
- return(ret);
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- ConversationInteraction recv=new ConversationInteraction();
- activities.add(recv);
-
- recv.derivedFrom(this);
-
- MessageSignature ms=new MessageSignature();
- recv.setMessageSignature(ms);
-
- ms.setOperation(getPropertyValue(OPERATION));
-
- String type=getPropertyValue(MESSAGE_TYPE);
- if (type != null && type.length() > 0) {
- String ns=null;
- String local=type;
-
- if (type.charAt(0) == '{') {
- int endindex=type.indexOf('}');
-
- if (endindex != -1) {
- ns = type.substring(1, endindex);
- local = type.substring(endindex+1);
- }
- }
-
- TypeReference ref=new TypeReference();
- ref.setLocalpart(local);
- ref.setNamespace(ns);
-
- ref.derivedFrom(this);
-
- ms.getTypes().add(ref);
- }
-
- // Initialize the 'to' role to be this participant
- if (context.getRole() != null) {
- recv.setToRole(new Role(context.getRole()));
- }
- }
-
- /**
- * This method sets the operation property.
- *
- * @param operation The operation
- */
- public void setOperation(String operation) {
-
- org.w3c.dom.Element prop=getPropertyElement(OPERATION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, operation);
- }
- }
-
- /**
- * This method sets the message type.
- *
- * @param type The message type
- */
- public void setMessageType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(MESSAGE_TYPE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-
- /**
- * This method sets the client's EPR label property.
- *
- * @param epr The client EPR label
- */
- public void setClientEPR(String epr) {
-
- org.w3c.dom.Element prop=getPropertyElement(CLIENT_EPR);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, epr);
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java (from rev 398, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'ReceiveMessageAction'.
+ *
+ * @author gary
+ */
+public class ReceiveMessageAction extends AbstractInteractionMessageAction {
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public ReceiveMessageAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public ReceiveMessageAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ ReceiveMessageAction.class));
+ }
+
+ /**
+ * This method indicates whether the action is an initiator.
+ * Initiator actions must precede any other session based
+ * action, within an ESB service.
+ *
+ * @return Whether the action is an initiator
+ */
+ @Override
+ public boolean isInitiator() {
+ return(true);
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ ConversationInteraction recv=new ConversationInteraction();
+ activities.add(recv);
+
+ recv.derivedFrom(this);
+
+ MessageSignature ms=new MessageSignature();
+ ms.derivedFrom(this);
+
+ recv.setMessageSignature(ms);
+
+ ms.setOperation(getPropertyValue(OPERATION));
+
+ String type=getPropertyValue(MESSAGE_TYPE);
+ if (type != null && type.length() > 0) {
+ String ns=null;
+ String local=type;
+
+ if (type.charAt(0) == '{') {
+ int endindex=type.indexOf('}');
+
+ if (endindex != -1) {
+ ns = type.substring(1, endindex);
+ local = type.substring(endindex+1);
+ }
+ }
+
+ TypeReference ref=new TypeReference();
+ ref.setLocalpart(local);
+ ref.setNamespace(ns);
+
+ ref.derivedFrom(this);
+
+ ms.getTypes().add(ref);
+ }
+
+ // Initialize the 'to' role to be this participant
+ if (context.getRole() != null) {
+ recv.setToRole(new Role(context.getRole()));
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'RetrieveSessionAction'.
- *
- * @author gary
- */
-public class RetrieveSessionAction extends AbstractESBAction {
-
- public static final String IDENTITIES = "identities";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public RetrieveSessionAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(IDENTITIES);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // Action must be first conversation based action in
- // the service
- if (getService() != null && getService().getActions().size() > 0) {
- ESBAction act=getService().getActions().get(0);
-
- if (act != this) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"RetrieveSession"}), null);
- }
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
\ No newline at end of file
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'RetrieveSessionAction'.
+ *
+ * @author gary
+ */
+public class RetrieveSessionAction extends AbstractESBAction {
+
+ public static final String IDENTITIES = "identities";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public RetrieveSessionAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(IDENTITIES);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // Action must be first conversation based action in
+ // the service
+ if (getService() != null && getService().getActions().size() > 0) {
+ ESBAction act=getService().getActions().get(0);
+
+ if (act != this) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_BE_FIRST_ACTION",
+ new String[]{"RetrieveSession"})));
+ }
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+}
\ No newline at end of file
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,182 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'ScheduleStateAction'.
- *
- * @author gary
- */
-public class ScheduleStateAction extends AbstractESBAction {
-
- public static final String IMMEDIATE = "immediate";
- public static final String SERVICE_NAME = "serviceName";
- public static final String SERVICE_CATEGORY = "serviceCategory";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public ScheduleStateAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public ScheduleStateAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- ScheduleStateAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
- String serviceName=getPropertyValue(SERVICE_NAME);
- String immediate=getPropertyValue(IMMEDIATE);
-
- m_service=getService().getModel().getService(serviceCategory, serviceName);
-
- getLinks().add(new ESBLink(serviceCategory, serviceName, m_service,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(SERVICE_CATEGORY);
- ret.add(SERVICE_NAME);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(IMMEDIATE);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- String immediate=getPropertyValue(IMMEDIATE);
-
- if (immediate != null && immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- // If the service has been located, then convert its activities
- // if it is either not a loop construct (i.e. a while action), or
- // if it is a loop, then we need to ensure that it is not in the
- // current stack of ESB services that logically 'contain' this
- // action. If this action is within the scope of the loop, then
- // the default behaviour should be to return to the loop
- // condition (i.e. just let the loop return implicitly).
- if (m_service != null &&
- (m_service.isLoop() == false ||
- context.isOnStack(m_service) == false) &&
- context.isJoin(m_service) == false) {
- m_service.convert(activities, context);
- }
- }
-
- /**
- * This method sets the destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- * @param immediate Whether the invoke immediately
- */
- public void setDestination(String category, String name,
- boolean immediate) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
-
- if (immediate) {
- prop = getPropertyElement(IMMEDIATE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, Boolean.toString(immediate));
- }
- }
- }
-
- private ESBService m_service=null;
-}
\ No newline at end of file
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'ScheduleStateAction'.
+ *
+ * @author gary
+ */
+public class ScheduleStateAction extends AbstractESBAction {
+
+ public static final String IMMEDIATE = "immediate";
+ public static final String SERVICE_NAME = "serviceName";
+ public static final String SERVICE_CATEGORY = "serviceCategory";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public ScheduleStateAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public ScheduleStateAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ ScheduleStateAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
+ String serviceName=getPropertyValue(SERVICE_NAME);
+ String immediate=getPropertyValue(IMMEDIATE);
+
+ m_service=getService().getModel().getService(serviceCategory, serviceName);
+
+ getLinks().add(new ESBLink(serviceCategory, serviceName, m_service,
+ (immediate != null && immediate.equalsIgnoreCase("true"))));
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(SERVICE_CATEGORY);
+ ret.add(SERVICE_NAME);
+ return(ret);
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ @Override
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=super.getOptionalProperties();
+ ret.add(IMMEDIATE);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ String immediate=getPropertyValue(IMMEDIATE);
+
+ if (immediate != null && immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_BOOLEAN",
+ new String[]{IMMEDIATE})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ // If the service has been located, then convert its activities
+ // if it is either not a loop construct (i.e. a while action), or
+ // if it is a loop, then we need to ensure that it is not in the
+ // current stack of ESB services that logically 'contain' this
+ // action. If this action is within the scope of the loop, then
+ // the default behaviour should be to return to the loop
+ // condition (i.e. just let the loop return implicitly).
+ if (m_service != null &&
+ (m_service.isLoop() == false ||
+ context.isOnStack(m_service) == false) &&
+ context.isJoin(m_service) == false) {
+ m_service.convert(activities, context);
+ }
+ }
+
+ /**
+ * This method sets the destination service descriptor properties.
+ *
+ * @param category The category
+ * @param name The name
+ * @param immediate Whether the invoke immediately
+ */
+ public void setDestination(String category, String name,
+ boolean immediate) {
+
+ org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, category);
+ }
+
+ prop = getPropertyElement(SERVICE_NAME);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, name);
+ }
+
+ if (immediate) {
+ prop = getPropertyElement(IMMEDIATE);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, Boolean.toString(immediate));
+ }
+ }
+ }
+
+ private ESBService m_service=null;
+}
\ No newline at end of file
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,344 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'SendMessageAction'.
- *
- * @author gary
- */
-public class SendMessageAction extends AbstractESBAction {
-
- public static final String CLIENT_EPR = "clientEPR";
- public static final String RESPONSE_SERVICE_NAME = "responseServiceName";
- public static final String RESPONSE_SERVICE_CATEGORY = "responseServiceCategory";
- public static final String SERVICE_NAME = "serviceName";
- public static final String SERVICE_CATEGORY = "serviceCategory";
- public static final String SERVICE_NAME_EXPRESSION = "serviceNameExpression";
- public static final String SERVICE_CATEGORY_EXPRESSION = "serviceCategoryExpression";
- public static final String MESSAGE_TYPE = "messageType";
- public static final String OPERATION = "operation";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SendMessageAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public SendMessageAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- SendMessageAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
- String serviceName=getPropertyValue(SERVICE_NAME);
- String responseServiceCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
- String responseServiceName=getPropertyValue(RESPONSE_SERVICE_NAME);
-
- if (serviceCategory != null && serviceName != null) {
- ESBService service=getService().getModel().getService(
- serviceCategory, serviceName);
-
- getLinks().add(new ESBLink(serviceCategory, serviceName,
- service, true, true));
- }
-
- if (responseServiceCategory != null && responseServiceName != null) {
- ESBService service=getService().getModel().getService(
- responseServiceCategory, responseServiceName);
-
- getLinks().add(new ESBLink(responseServiceCategory,
- responseServiceName, service, false));
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(MESSAGE_TYPE);
- ret.add(IDENTITIES);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(OPERATION);
- ret.add(CLIENT_EPR);
- ret.add(RESPONSE_SERVICE_NAME);
- ret.add(RESPONSE_SERVICE_CATEGORY);
- ret.add(SERVICE_NAME);
- ret.add(SERVICE_CATEGORY);
- ret.add(SERVICE_NAME_EXPRESSION);
- ret.add(SERVICE_CATEGORY_EXPRESSION);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // If sending request, then category/name must be specified,
- // else a response requires the 'client epr'. Validate that
- // either case is true.
- if (getPropertyValue(SERVICE_CATEGORY) != null &&
- getPropertyValue(SERVICE_NAME) != null) {
- // Sending a request
-
- } else if (getPropertyValue(SERVICE_CATEGORY_EXPRESSION) != null &&
- getPropertyValue(SERVICE_NAME_EXPRESSION) != null) {
- // Sending a request to service derived from expression
- // on the pojo state
-
- } else if (getPropertyValue(CLIENT_EPR) != null) {
- // Sending a response
-
- // TODO: Validate that the client EPR has been sent on
- // a preceding received request
- } else {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_REQ_RESP_EPR",
- new String[]{}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- ConversationInteraction send=new ConversationInteraction();
- activities.add(send);
-
- send.derivedFrom(this);
-
- MessageSignature ms=new MessageSignature();
- send.setMessageSignature(ms);
-
- ms.setOperation(getPropertyValue(OPERATION));
-
- String type=getPropertyValue(MESSAGE_TYPE);
- if (type != null && type.length() > 0) {
- String ns=null;
- String local=type;
-
- if (type.charAt(0) == '{') {
- int endindex=type.indexOf('}');
-
- if (endindex != -1) {
- ns = type.substring(1, endindex);
- local = type.substring(endindex+1);
- }
- }
-
- TypeReference ref=new TypeReference();
- ref.setLocalpart(local);
- ref.setNamespace(ns);
-
- ref.derivedFrom(this);
-
- ms.getTypes().add(ref);
- }
-
- // Initialize the 'from' role to be this participant
- // (for now until 'to' role can be set)
- if (context.getRole() != null) {
- send.setFromRole(new Role(context.getRole()));
- }
-
- // TODO: Initialize the 'to' role (possibly to a
- // namespace=service category and localpart=service
- // name. This would need to be mapped when doing
- // conformance checking - might be an issue, may
- // need to declare the name.
-
- // Check if a response control link has been
- // specified
- String responseServiceCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
- String responseServiceName=getPropertyValue(RESPONSE_SERVICE_NAME);
-
- if (responseServiceCategory != null && responseServiceName != null) {
- ESBService service=getService().getModel().getService(
- responseServiceCategory, responseServiceName);
-
- // Add activities from the 'response' service descriptor into
- // the set of activities. If service not found, then ignore
- // here as will be reported as part of the validation of links.
- if (service != null) {
- service.convert(activities, context);
- }
- }
- }
-
- /**
- * This method sets the operation property.
- *
- * @param operation The operation
- */
- public void setOperation(String operation) {
-
- org.w3c.dom.Element prop=getPropertyElement(OPERATION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, operation);
- }
- }
-
- /**
- * This method sets the client's EPR label property.
- *
- * @param epr The client EPR label
- */
- public void setClientEPR(String epr) {
-
- org.w3c.dom.Element prop=getPropertyElement(CLIENT_EPR);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, epr);
- }
- }
-
- /**
- * This method sets the message type.
- *
- * @param type The message type
- */
- public void setMessageType(String type) {
-
- org.w3c.dom.Element prop=getPropertyElement(MESSAGE_TYPE);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, type);
- }
- }
-
- /**
- * This method sets the destination service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-
- /**
- * This method sets the destination expressions for the
- * service descriptor properties.
- *
- * @param categoryExpr The category expression
- * @param nameExpr The name expression
- */
- public void setDestinationExpression(String categoryExpr,
- String nameExpr) {
-
- org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY_EXPRESSION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, categoryExpr);
- }
-
- prop = getPropertyElement(SERVICE_NAME_EXPRESSION);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, nameExpr);
- }
- }
-
- /**
- * This method sets the response service descriptor properties.
- *
- * @param category The category
- * @param name The name
- */
- public void setResponseDestination(String category, String name) {
-
- org.w3c.dom.Element prop=getPropertyElement(RESPONSE_SERVICE_CATEGORY);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, category);
- }
-
- prop = getPropertyElement(RESPONSE_SERVICE_NAME);
-
- if (prop != null) {
- prop.setAttribute(VALUE_ATTR, name);
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java (from rev 398, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,286 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'SendMessageAction'.
+ *
+ * @author gary
+ */
+public class SendMessageAction extends AbstractInteractionMessageAction {
+
+ public static final String RESPONSE_SERVICE_NAME = "responseServiceName";
+ public static final String RESPONSE_SERVICE_CATEGORY = "responseServiceCategory";
+ public static final String SERVICE_NAME = "serviceName";
+ public static final String SERVICE_CATEGORY = "serviceCategory";
+ public static final String SERVICE_NAME_EXPRESSION = "serviceNameExpression";
+ public static final String SERVICE_CATEGORY_EXPRESSION = "serviceCategoryExpression";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public SendMessageAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public SendMessageAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ SendMessageAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
+ String serviceName=getPropertyValue(SERVICE_NAME);
+ String responseServiceCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
+ String responseServiceName=getPropertyValue(RESPONSE_SERVICE_NAME);
+
+ if (serviceCategory != null && serviceName != null) {
+ ESBService service=getService().getModel().getService(
+ serviceCategory, serviceName);
+
+ getLinks().add(new ESBLink(serviceCategory, serviceName,
+ service, true, true));
+ }
+
+ if (responseServiceCategory != null && responseServiceName != null) {
+ ESBService service=getService().getModel().getService(
+ responseServiceCategory, responseServiceName);
+
+ getLinks().add(new ESBLink(responseServiceCategory,
+ responseServiceName, service, false));
+ }
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ @Override
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=super.getOptionalProperties();
+ ret.add(RESPONSE_SERVICE_NAME);
+ ret.add(RESPONSE_SERVICE_CATEGORY);
+ ret.add(SERVICE_NAME);
+ ret.add(SERVICE_CATEGORY);
+ ret.add(SERVICE_NAME_EXPRESSION);
+ ret.add(SERVICE_CATEGORY_EXPRESSION);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // If sending request, then category/name must be specified,
+ // else a response requires the 'client epr'. Validate that
+ // either case is true.
+ if (getPropertyValue(SERVICE_CATEGORY) != null &&
+ getPropertyValue(SERVICE_NAME) != null) {
+ // Sending a request
+
+ } else if (getPropertyValue(SERVICE_CATEGORY_EXPRESSION) != null &&
+ getPropertyValue(SERVICE_NAME_EXPRESSION) != null) {
+ // Sending a request to service derived from expression
+ // on the pojo state
+
+ } else if (getPropertyValue(CLIENT_EPR) != null) {
+ // Sending a response
+
+ // TODO: Validate that the client EPR has been sent on
+ // a preceding received request
+ } else {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_SPECIFIED_REQ_RESP_EPR",
+ new String[]{})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ ConversationInteraction send=new ConversationInteraction();
+ activities.add(send);
+
+ send.derivedFrom(this);
+
+ MessageSignature ms=new MessageSignature();
+ ms.derivedFrom(this);
+
+ send.setMessageSignature(ms);
+
+ ms.setOperation(getPropertyValue(OPERATION));
+
+ String type=getPropertyValue(MESSAGE_TYPE);
+ if (type != null && type.length() > 0) {
+ String ns=null;
+ String local=type;
+
+ if (type.charAt(0) == '{') {
+ int endindex=type.indexOf('}');
+
+ if (endindex != -1) {
+ ns = type.substring(1, endindex);
+ local = type.substring(endindex+1);
+ }
+ }
+
+ TypeReference ref=new TypeReference();
+ ref.setLocalpart(local);
+ ref.setNamespace(ns);
+
+ ref.derivedFrom(this);
+
+ ms.getTypes().add(ref);
+ }
+
+ // Initialize the 'from' role to be this participant
+ // (for now until 'to' role can be set)
+ if (context.getRole() != null) {
+ send.setFromRole(new Role(context.getRole()));
+ }
+
+ // TODO: Initialize the 'to' role (possibly to a
+ // namespace=service category and localpart=service
+ // name. This would need to be mapped when doing
+ // conformance checking - might be an issue, may
+ // need to declare the name.
+
+ // Check if a response control link has been
+ // specified
+ String responseServiceCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
+ String responseServiceName=getPropertyValue(RESPONSE_SERVICE_NAME);
+
+ if (responseServiceCategory != null && responseServiceName != null) {
+ ESBService service=getService().getModel().getService(
+ responseServiceCategory, responseServiceName);
+
+ // Add activities from the 'response' service descriptor into
+ // the set of activities. If service not found, then ignore
+ // here as will be reported as part of the validation of links.
+ if (service != null) {
+ service.convert(activities, context);
+ }
+ }
+ }
+
+ /**
+ * This method sets the destination service descriptor properties.
+ *
+ * @param category The category
+ * @param name The name
+ */
+ public void setDestination(String category, String name) {
+
+ org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, category);
+ }
+
+ prop = getPropertyElement(SERVICE_NAME);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, name);
+ }
+ }
+
+ /**
+ * This method sets the destination expressions for the
+ * service descriptor properties.
+ *
+ * @param categoryExpr The category expression
+ * @param nameExpr The name expression
+ */
+ public void setDestinationExpression(String categoryExpr,
+ String nameExpr) {
+
+ org.w3c.dom.Element prop=getPropertyElement(SERVICE_CATEGORY_EXPRESSION);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, categoryExpr);
+ }
+
+ prop = getPropertyElement(SERVICE_NAME_EXPRESSION);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, nameExpr);
+ }
+ }
+
+ /**
+ * This method sets the response service descriptor properties.
+ *
+ * @param category The category
+ * @param name The name
+ */
+ public void setResponseDestination(String category, String name) {
+
+ org.w3c.dom.Element prop=getPropertyElement(RESPONSE_SERVICE_CATEGORY);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, category);
+ }
+
+ prop = getPropertyElement(RESPONSE_SERVICE_NAME);
+
+ if (prop != null) {
+ prop.setAttribute(VALUE_ATTR, name);
+ }
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetMessageAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,9 +15,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
import org.scribble.model.*;
/**
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.PropertyUtil;
-import org.scribble.model.*;
-
-/**
- * The model component for the 'SetStateAction'.
- *
- * @author gary
- */
-public class SetStateAction extends AbstractESBAction {
-
- public static final String STATE_EXPRESSION = "stateExpression";
- public static final String MESSAGE_EXPRESSION = "messageExpression";
- public static final String VARIABLE = "variable";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SetStateAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(VARIABLE);
- return(ret);
- }
-
- /**
- * This method returns the optional property names.
- *
- * @return The optional property names
- */
- @Override
- protected java.util.List<String> getOptionalProperties() {
- java.util.List<String> ret=super.getOptionalProperties();
- ret.add(STATE_EXPRESSION);
- ret.add(MESSAGE_EXPRESSION);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- String variable=getPropertyValue(VARIABLE);
-
- if (variable != null) {
-
- // Check that variable defined on session class
- Class<?> cls=getService().getSessionClass();
-
- java.util.StringTokenizer st=new java.util.StringTokenizer(variable, ".");
-
- while (cls != null && st.hasMoreTokens()) {
- String token=st.nextToken();
-
- if (cls != null) {
- if (PropertyUtil.isProperty(cls, token) == false) {
-
- if (variable.equals(token)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{variable, cls.getName()}), null);
- } else {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE_PROPERTY",
- new String[]{variable, token, cls.getName()}), null);
- }
- } else if (st.hasMoreTokens()) {
- // Check property can be read
- if (!PropertyUtil.hasReadableProperty(cls, token)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_READABLE_PROPERTY",
- new String[]{token, cls.getName()}), null);
- }
- } else {
- // Check property can be written
- if (!PropertyUtil.hasWritableProperty(cls, token)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{token, cls.getName()}), null);
- }
- }
-
- cls = PropertyUtil.getPropertyType(cls, token);
- }
- }
- }
-
- // Check that state or message expression defined
- String stateExpression=getPropertyValue(STATE_EXPRESSION);
- String messageExpression=getPropertyValue(MESSAGE_EXPRESSION);
-
- if ((stateExpression == null && messageExpression == null) ||
- (stateExpression != null && messageExpression != null)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
- new String[]{}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.actions");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.PropertyUtil;
+import org.scribble.model.*;
+
+/**
+ * The model component for the 'SetStateAction'.
+ *
+ * @author gary
+ */
+public class SetStateAction extends AbstractESBAction {
+
+ public static final String STATE_EXPRESSION = "stateExpression";
+ public static final String MESSAGE_EXPRESSION = "messageExpression";
+ public static final String VARIABLE = "variable";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public SetStateAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(VARIABLE);
+ return(ret);
+ }
+
+ /**
+ * This method returns the optional property names.
+ *
+ * @return The optional property names
+ */
+ @Override
+ protected java.util.List<String> getOptionalProperties() {
+ java.util.List<String> ret=super.getOptionalProperties();
+ ret.add(STATE_EXPRESSION);
+ ret.add(MESSAGE_EXPRESSION);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ String variable=getPropertyValue(VARIABLE);
+
+ if (variable != null) {
+
+ // Check that variable defined on session class
+ Class<?> cls=getService().getSessionClass();
+
+ java.util.StringTokenizer st=new java.util.StringTokenizer(variable, ".");
+
+ while (cls != null && st.hasMoreTokens()) {
+ String token=st.nextToken();
+
+ if (cls != null) {
+ if (PropertyUtil.isProperty(cls, token) == false) {
+
+ if (variable.equals(token)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_VARIABLE",
+ new String[]{variable, cls.getName()})));
+ } else {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_VARIABLE_PROPERTY",
+ new String[]{variable, token, cls.getName()})));
+ }
+ } else if (st.hasMoreTokens()) {
+ // Check property can be read
+ if (!PropertyUtil.hasReadableProperty(cls, token)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_READABLE_PROPERTY",
+ new String[]{token, cls.getName()})));
+ }
+ } else {
+ // Check property can be written
+ if (!PropertyUtil.hasWritableProperty(cls, token)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_WRITABLE_PROPERTY",
+ new String[]{token, cls.getName()})));
+ }
+ }
+
+ cls = PropertyUtil.getPropertyType(cls, token);
+ }
+ }
+ }
+
+ // Check that state or message expression defined
+ String stateExpression=getPropertyValue(STATE_EXPRESSION);
+ String messageExpression=getPropertyValue(MESSAGE_EXPRESSION);
+
+ if ((stateExpression == null && messageExpression == null) ||
+ (stateExpression != null && messageExpression != null)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
+ new String[]{})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,238 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'SwitchAction'.
- *
- * @author gary
- */
-public class SwitchAction extends AbstractESBAction {
-
- public static final String TYPE_ATTR = "type";
- public static final String MESSAGE_ELEMENT = "message";
- private static final String SERVICE_NAME = "service-name";
- private static final String SERVICE_CATEGORY = "service-category";
- private static final String CASE = "case";
- private static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public SwitchAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public SwitchAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- SwitchAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- n.getNodeName().equals(CASE)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service, true));
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- int pathCount=0;
- boolean f_serviceDetailsMissing=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(CASE)) {
- pathCount++;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && pathCount < 1) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_SWITCH_ONE_OR_MORE_PATHS",
- new String[]{}), null);
- }
-
- if (f_serviceDetailsMissing) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- If choice=new If();
- activities.add(choice);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- n.getNodeName().equals(CASE)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Conditional block with no expression - i.e. the
- // expression is non-observable, as the path will be
- // selected based on the next message that arrives
- ConditionalBlock block=new ConditionalBlock();
- choice.getConditionalBlocks().add(block);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(block.getContents(), context);
- }
- }
- }
- }
-
- /**
- * This method adds a path to the switch action.
- *
- * @param category The service category
- * @param name The service name
- * @param messageTypes The set of interactions
- * @param position The position
- */
- public void addCase(String category, String name,
- java.util.Set<Interaction> messageTypes, int position) {
-
- org.w3c.dom.Element paths=getPropertyElement(PATHS);
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(CASE);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- if (messageTypes != null) {
- java.util.Iterator<Interaction> iter=messageTypes.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getMessageSignature().getTypes().size()==1) {
- org.w3c.dom.Element mt=
- getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
-
- mt.setAttribute(TYPE_ATTR,
- InteractionUtil.getTypeString(
- interaction.getMessageSignature().
- getTypes().get(0)));
-
- path.appendChild(mt);
- }
- }
- }
-
- paths.appendChild(path);
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java (from rev 327, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'SwitchAction'.
+ *
+ * @author gary
+ */
+public class SwitchAction extends AbstractESBAction {
+
+ public static final String TYPE_ATTR = "type";
+ public static final String MESSAGE_ELEMENT = "message";
+ private static final String SERVICE_NAME = "service-name";
+ private static final String SERVICE_CATEGORY = "service-category";
+ private static final String CASE = "case";
+ private static final String PATHS = "paths";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public SwitchAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public SwitchAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ SwitchAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element &&
+ n.getNodeName().equals(CASE)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ ESBService service=getService().getModel().getService(category, name);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(category, name, service, true));
+ }
+ }
+ }
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(PATHS);
+ return(ret);
+ }
+
+ /**
+ * This method indicates whether the action is an initiator.
+ * Initiator actions must precede any other session based
+ * action, within an ESB service.
+ *
+ * @return Whether the action is an initiator
+ */
+ @Override
+ public boolean isInitiator() {
+ return(true);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+ int pathCount=0;
+ boolean f_serviceDetailsMissing=false;
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(CASE)) {
+ pathCount++;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+ }
+ }
+ }
+
+ // Report any errors
+ if (nl != null && pathCount < 1) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_SWITCH_ONE_OR_MORE_PATHS",
+ new String[]{})));
+ }
+
+ if (f_serviceDetailsMissing) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PATH_SERVICE_DETAILS_MISSING",
+ new String[]{})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ If choice=new If();
+ activities.add(choice);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element &&
+ n.getNodeName().equals(CASE)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Conditional block with no expression - i.e. the
+ // expression is non-observable, as the path will be
+ // selected based on the next message that arrives
+ ConditionalBlock block=new ConditionalBlock();
+ choice.getConditionalBlocks().add(block);
+
+ ESBService service=getService().getModel().getService(category, name);
+
+ if (service != null) {
+ service.convert(block.getContents(), context);
+ }
+ }
+ }
+ }
+
+ /**
+ * This method adds a path to the switch action.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @param messageTypes The set of interactions
+ * @param position The position
+ */
+ public void addCase(String category, String name,
+ java.util.Set<Interaction> messageTypes, int position) {
+
+ org.w3c.dom.Element paths=getPropertyElement(PATHS);
+
+ org.w3c.dom.Element path=
+ getAction().getOwnerDocument().createElement(CASE);
+ path.setAttribute(SERVICE_CATEGORY, category);
+ path.setAttribute(SERVICE_NAME, name);
+
+ if (messageTypes != null) {
+ java.util.Iterator<Interaction> iter=messageTypes.iterator();
+
+ while (iter.hasNext()) {
+ Interaction interaction=iter.next();
+
+ //TODO: Only deals with single type for now
+ if (InteractionUtil.isSend(interaction) == false &&
+ interaction.getMessageSignature().getTypes().size()==1) {
+ org.w3c.dom.Element mt=
+ getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
+
+ mt.setAttribute(TYPE_ATTR,
+ InteractionUtil.getTypeString(
+ interaction.getMessageSignature().
+ getTypes().get(0)));
+
+ path.appendChild(mt);
+ }
+ }
+ }
+
+ paths.appendChild(path);
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/UnsupportedAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/UnsupportedAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/UnsupportedAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,9 +15,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
import org.scribble.model.*;
/**
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,239 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'WhenAction'.
- *
- * @author gary
- */
-public class WhenAction extends AbstractESBAction {
-
- private static final String SERVICE_NAME = "service-name";
- private static final String SERVICE_CATEGORY = "service-category";
- private static final String WHEN = "when";
- private static final String PATHS = "paths";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public WhenAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public WhenAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- WhenAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHEN)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- ESBService service=getService().getModel().getService(category, name);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(category, name, service, true));
-
- if (service != null) {
- m_services.add(service);
- }
- }
- }
- }
- }
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // TODO: Valid if decision-method
- // specified, that method exists, if expression, then
- // validate the expression etc.
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- int pathCount=0;
- boolean f_serviceDetailsMissing=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHEN)) {
- pathCount++;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && pathCount < 1) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_WHEN_ONE_OR_MORE_PATHS",
- new String[]{}), null);
- }
-
- if (f_serviceDetailsMissing) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- When elem=new When();
- activities.add(elem);
-
- elem.derivedFrom(this);
-
- if (m_joinService != null) {
- context.markJoin(m_joinService);
- }
-
- for (int i=0; i < m_services.size(); i++) {
- ConditionalBlock block=new ConditionalBlock();
-
- m_services.get(i).convert(block.getContents(), context);
-
- elem.getConditionalBlocks().add(block);
- }
-
- if (m_joinService != null) {
- m_joinService.convert(activities, context);
- }
- }
-
- /**
- * This method adds a path to the when action.
- *
- * @param category The service category
- * @param name The service name
- * @param position The position
- */
- public void addPath(String category, String name,
- int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(WHEN);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- paths.appendChild(path);
- }
-
- private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
- private String m_joinCategory=null;
- private String m_joinName=null;
- private ESBService m_joinService=null;
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,239 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'WhenAction'.
+ *
+ * @author gary
+ */
+public class WhenAction extends AbstractESBAction {
+
+ private static final String SERVICE_NAME = "service-name";
+ private static final String SERVICE_CATEGORY = "service-category";
+ private static final String WHEN = "when";
+ private static final String PATHS = "paths";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public WhenAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public WhenAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ WhenAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(WHEN)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ ESBService service=getService().getModel().getService(category, name);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(category, name, service, true));
+
+ if (service != null) {
+ m_services.add(service);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(PATHS);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // TODO: Valid if decision-method
+ // specified, that method exists, if expression, then
+ // validate the expression etc.
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+ int pathCount=0;
+ boolean f_serviceDetailsMissing=false;
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(WHEN)) {
+ pathCount++;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+ }
+ }
+ }
+
+ // Report any errors
+ if (nl != null && pathCount < 1) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_WHEN_ONE_OR_MORE_PATHS",
+ new String[]{})));
+ }
+
+ if (f_serviceDetailsMissing) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PATH_SERVICE_DETAILS_MISSING",
+ new String[]{})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ When elem=new When();
+ activities.add(elem);
+
+ elem.derivedFrom(this);
+
+ if (m_joinService != null) {
+ context.markJoin(m_joinService);
+ }
+
+ for (int i=0; i < m_services.size(); i++) {
+ ConditionalBlock block=new ConditionalBlock();
+
+ m_services.get(i).convert(block.getContents(), context);
+
+ elem.getConditionalBlocks().add(block);
+ }
+
+ if (m_joinService != null) {
+ m_joinService.convert(activities, context);
+ }
+ }
+
+ /**
+ * This method adds a path to the when action.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @param position The position
+ */
+ public void addPath(String category, String name,
+ int position) {
+
+ org.w3c.dom.NodeList nl=
+ getAction().getElementsByTagName(PROPERTY_ELEMENT);
+
+ org.w3c.dom.Element paths=null;
+
+ for (int i=0; paths == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
+
+ if (propName != null && propName.equals(PATHS)) {
+ paths = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (paths == null) {
+ paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
+ paths.setAttribute(NAME_ATTR, PATHS);
+
+ getAction().appendChild(paths);
+ }
+
+ org.w3c.dom.Element path=
+ getAction().getOwnerDocument().createElement(WHEN);
+ path.setAttribute(SERVICE_CATEGORY, category);
+ path.setAttribute(SERVICE_NAME, name);
+
+ paths.appendChild(path);
+ }
+
+ private java.util.List<ESBService> m_services=new java.util.Vector<ESBService>();
+ private String m_joinCategory=null;
+ private String m_joinName=null;
+ private ESBService m_joinService=null;
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileAction.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,372 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-/**
- * The model component for the 'WhileAction'.
- *
- * @author gary
- */
-public class WhileAction extends AbstractESBAction {
-
- public static final String SERVICE_NAME = "service-name";
- public static final String SERVICE_CATEGORY = "service-category";
- public static final String IMMEDIATE = "immediate";
- private static final String WHILE = "while";
- private static final String EXIT = "exit";
- private static final String PATHS = "paths";
- public static final String MESSAGE_ELEMENT="message";
- public static final String TYPE_ATTR="type";
-
- /**
- * The constructor for the action.
- *
- * @param service The reference to the service in which
- * the action is contained
- * @param action The XML configuration details for the action
- */
- public WhileAction(ESBService service,
- org.w3c.dom.Element action) {
- super(service, action);
- }
-
- /**
- * This constructor initializes the DOM element for
- * the action.
- *
- * @param service The reference to the service in which
- * the action will be contained
- */
- public WhileAction(ESBService service) {
- super(service, ESBActionFactory.getConversationAction(
- WhileAction.class));
- }
-
- /**
- * This method initializes the links with the ESB service descriptors
- * identified in each path of the action.
- */
- @Override
- public void initializeLinks() {
- super.initializeLinks();
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
-
- for (int i=0; i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHILE)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- m_loopCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- m_loopName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- m_loopService=getService().getModel().getService(m_loopCategory, m_loopName);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(m_loopCategory, m_loopName, m_loopService,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
- } else if (n.getNodeName().equals(EXIT)) {
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
- m_exitCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- m_exitName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // Lookup service associated with category and name
- m_exitService=getService().getModel().getService(m_exitCategory, m_exitName);
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- // Initialize link, even if service is null - this will be
- // reported as a validation error later
- getLinks().add(new ESBLink(m_exitCategory, m_exitName, m_exitService,
- (immediate != null && immediate.equalsIgnoreCase("true"))));
- }
- }
- }
- }
- }
-
- /**
- * This method determines if the action represents a loop construct.
- *
- * @return Whether the action represents a loop construct
- */
- @Override
- public boolean isLoop() {
- return(true);
- }
-
- /**
- * This method returns the mandatory property names.
- *
- * @return The mandatory property names
- */
- @Override
- protected java.util.List<String> getMandatoryProperties() {
- java.util.List<String> ret=super.getMandatoryProperties();
- ret.add(PATHS);
- return(ret);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- super.validate(l);
-
- // While action must be first conversation based action in
- // the service
- if (getService() != null && getService().getActions().size() > 0) {
- ESBAction act=getService().getActions().get(0);
-
- if (act != this) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"While"}), null);
- }
- }
-
- // TODO: Validate while/exit order, if decision-method
- // specified, that method exists, if expression, then
- // validate the expression etc.
-
- // TODO: Validate that the loop service returns back to the
- // while action for all paths
-
- org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
- boolean f_while=false;
- boolean f_exit=false;
- boolean f_multipleWhiles=false;
- boolean f_multipleExits=false;
- boolean f_serviceDetailsMissing=false;
- boolean f_pathAfterExit=false;
- boolean f_immediateInvalid=false;
-
- for (int i=0; nl != null && i < nl.getLength(); i++) {
-
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element) {
- if (n.getNodeName().equals(WHILE)) {
-
- if (f_while) {
- f_multipleWhiles = true;
- }
-
- if (f_exit) {
- f_pathAfterExit = true;
- }
-
- f_while = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- } else if (n.getNodeName().equals(EXIT)) {
-
- if (f_exit) {
- f_multipleExits = true;
- }
-
- f_exit = true;
-
- if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
- ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
- f_serviceDetailsMissing = true;
- }
-
- String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
-
- if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
- immediate.equalsIgnoreCase("true") == false &&
- immediate.equalsIgnoreCase("false") == false) {
- f_immediateInvalid = true;
- }
- }
- }
- }
-
- // Report any errors
- if (nl != null && (f_while == false || f_multipleWhiles)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_DEFINE_SINGLE_WHILE_PATH",
- new String[]{}), null);
- }
-
- if (nl != null && (f_exit == false || f_multipleExits)) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_DEFINE_SINGLE_WHILE_EXIT",
- new String[]{}), null);
- }
-
- if (f_pathAfterExit) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_WHILE_PATH_AFTER_EXIT",
- new String[]{}), null);
- }
-
- if (f_serviceDetailsMissing) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}), null);
- }
-
- if (f_immediateInvalid) {
- l.error(this, org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IMMEDIATE}), null);
- }
- }
-
- /**
- * This method converts the ESB action 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
- */
- @Override
- public void convert(java.util.List<Activity> activities,
- ConversionContext context) {
-
- While elem=new While();
- activities.add(elem);
-
- elem.derivedFrom(this);
-
- ConditionalBlock block=new ConditionalBlock();
- elem.setBlock(block);
-
- if (m_loopService != null) {
- context.push(getService());
-
- m_loopService.convert(elem.getBlock().getContents(), context);
-
- context.pop(getService());
- }
-
- if (m_exitService != null) {
- m_exitService.convert(activities, context);
- }
- }
-
- /**
- * This method adds a path to the when action.
- *
- * @param category The service category
- * @param name The service name
- * @param position The position
- */
- public void addPath(String category, String name, boolean exit,
- java.util.List<MessageSignature> messageTypes,
- int position) {
-
- org.w3c.dom.NodeList nl=
- getAction().getElementsByTagName(PROPERTY_ELEMENT);
-
- org.w3c.dom.Element paths=null;
-
- for (int i=0; paths == null && i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
-
- if (propName != null && propName.equals(PATHS)) {
- paths = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (paths == null) {
- paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
- paths.setAttribute(NAME_ATTR, PATHS);
-
- getAction().appendChild(paths);
- }
-
- org.w3c.dom.Element path=
- getAction().getOwnerDocument().createElement(exit?EXIT:WHILE);
- path.setAttribute(SERVICE_CATEGORY, category);
- path.setAttribute(SERVICE_NAME, name);
-
- paths.appendChild(path);
-
- for (int i=0; i < messageTypes.size(); i++) {
- org.w3c.dom.Element mt=
- getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
-
- if (messageTypes.get(i).getTypes().size() == 1) {
- TypeReference ref=messageTypes.get(i).getTypes().get(0);
- String type="";
-
- if (ref.getNamespace() != null) {
- type += "{"+ref.getNamespace()+"}";
- }
- type += ref.getLocalpart();
-
- mt.setAttribute(TYPE_ATTR, type);
-
- path.appendChild(mt);
- }
- }
- }
-
- private String m_loopCategory=null;
- private String m_loopName=null;
- private ESBService m_loopService=null;
- private String m_exitCategory=null;
- private String m_exitName=null;
- private ESBService m_exitService=null;
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java (from rev 327, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,384 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'WhileAction'.
+ *
+ * @author gary
+ */
+public class WhileAction extends AbstractESBAction {
+
+ public static final String SERVICE_NAME = "service-name";
+ public static final String SERVICE_CATEGORY = "service-category";
+ public static final String IMMEDIATE = "immediate";
+ private static final String WHILE = "while";
+ private static final String EXIT = "exit";
+ private static final String PATHS = "paths";
+ public static final String MESSAGE_ELEMENT="message";
+ public static final String TYPE_ATTR="type";
+
+ /**
+ * The constructor for the action.
+ *
+ * @param service The reference to the service in which
+ * the action is contained
+ * @param action The XML configuration details for the action
+ */
+ public WhileAction(ESBService service,
+ org.w3c.dom.Element action) {
+ super(service, action);
+ }
+
+ /**
+ * This constructor initializes the DOM element for
+ * the action.
+ *
+ * @param service The reference to the service in which
+ * the action will be contained
+ */
+ public WhileAction(ESBService service) {
+ super(service, ESBActionFactory.getConversationAction(
+ WhileAction.class));
+ }
+
+ /**
+ * This method initializes the links with the ESB service descriptors
+ * identified in each path of the action.
+ */
+ @Override
+ public void initializeLinks() {
+ super.initializeLinks();
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(WHILE)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ m_loopCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ m_loopName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ m_loopService=getService().getModel().getService(m_loopCategory, m_loopName);
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(m_loopCategory, m_loopName, m_loopService,
+ (immediate != null && immediate.equalsIgnoreCase("true"))));
+ }
+ } else if (n.getNodeName().equals(EXIT)) {
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) &&
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME)) {
+ m_exitCategory=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ m_exitName=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // Lookup service associated with category and name
+ m_exitService=getService().getModel().getService(m_exitCategory, m_exitName);
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ // Initialize link, even if service is null - this will be
+ // reported as a validation error later
+ getLinks().add(new ESBLink(m_exitCategory, m_exitName, m_exitService,
+ (immediate != null && immediate.equalsIgnoreCase("true"))));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method determines if the action represents a loop construct.
+ *
+ * @return Whether the action represents a loop construct
+ */
+ @Override
+ public boolean isLoop() {
+ return(true);
+ }
+
+ /**
+ * This method indicates whether the action is an initiator.
+ * Initiator actions must precede any other session based
+ * action, within an ESB service.
+ *
+ * @return Whether the action is an initiator
+ */
+ @Override
+ public boolean isInitiator() {
+ return(true);
+ }
+
+ /**
+ * This method returns the mandatory property names.
+ *
+ * @return The mandatory property names
+ */
+ @Override
+ protected java.util.List<String> getMandatoryProperties() {
+ java.util.List<String> ret=super.getMandatoryProperties();
+ ret.add(PATHS);
+ return(ret);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ super.validate(l);
+
+ // While action must be first conversation based action in
+ // the service
+ if (getService() != null && getService().getActions().size() > 0) {
+ ESBAction act=getService().getActions().get(0);
+
+ if (act != this) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_BE_FIRST_ACTION",
+ new String[]{"While"})));
+ }
+ }
+
+ // TODO: Validate while/exit order, if decision-method
+ // specified, that method exists, if expression, then
+ // validate the expression etc.
+
+ // TODO: Validate that the loop service returns back to the
+ // while action for all paths
+
+ org.w3c.dom.NodeList nl=getPropertyChildNodes(PATHS);
+ boolean f_while=false;
+ boolean f_exit=false;
+ boolean f_multipleWhiles=false;
+ boolean f_multipleExits=false;
+ boolean f_serviceDetailsMissing=false;
+ boolean f_pathAfterExit=false;
+ boolean f_immediateInvalid=false;
+
+ for (int i=0; nl != null && i < nl.getLength(); i++) {
+
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(WHILE)) {
+
+ if (f_while) {
+ f_multipleWhiles = true;
+ }
+
+ if (f_exit) {
+ f_pathAfterExit = true;
+ }
+
+ f_while = true;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
+ immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ f_immediateInvalid = true;
+ }
+ } else if (n.getNodeName().equals(EXIT)) {
+
+ if (f_exit) {
+ f_multipleExits = true;
+ }
+
+ f_exit = true;
+
+ if (((org.w3c.dom.Element)n).hasAttribute(SERVICE_CATEGORY) == false ||
+ ((org.w3c.dom.Element)n).hasAttribute(SERVICE_NAME) == false) {
+ f_serviceDetailsMissing = true;
+ }
+
+ String immediate=((org.w3c.dom.Element)n).getAttribute(IMMEDIATE);
+
+ if (((org.w3c.dom.Element)n).hasAttribute(IMMEDIATE) &&
+ immediate.equalsIgnoreCase("true") == false &&
+ immediate.equalsIgnoreCase("false") == false) {
+ f_immediateInvalid = true;
+ }
+ }
+ }
+ }
+
+ // Report any errors
+ if (nl != null && (f_while == false || f_multipleWhiles)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_DEFINE_SINGLE_WHILE_PATH",
+ new String[]{})));
+ }
+
+ if (nl != null && (f_exit == false || f_multipleExits)) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_MUST_DEFINE_SINGLE_WHILE_EXIT",
+ new String[]{})));
+ }
+
+ if (f_pathAfterExit) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_WHILE_PATH_AFTER_EXIT",
+ new String[]{})));
+ }
+
+ if (f_serviceDetailsMissing) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_PATH_SERVICE_DETAILS_MISSING",
+ new String[]{})));
+ }
+
+ if (f_immediateInvalid) {
+ l.error(new ModelIssue(this, org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_BOOLEAN",
+ new String[]{IMMEDIATE})));
+ }
+ }
+
+ /**
+ * This method converts the ESB action 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
+ */
+ @Override
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+
+ While elem=new While();
+ activities.add(elem);
+
+ elem.derivedFrom(this);
+
+ ConditionalBlock block=new ConditionalBlock();
+ elem.setBlock(block);
+
+ if (m_loopService != null) {
+ context.push(getService());
+
+ m_loopService.convert(elem.getBlock().getContents(), context);
+
+ context.pop(getService());
+ }
+
+ if (m_exitService != null) {
+ m_exitService.convert(activities, context);
+ }
+ }
+
+ /**
+ * This method adds a path to the when action.
+ *
+ * @param category The service category
+ * @param name The service name
+ * @param position The position
+ */
+ public void addPath(String category, String name, boolean exit,
+ java.util.List<MessageSignature> messageTypes,
+ int position) {
+
+ org.w3c.dom.NodeList nl=
+ getAction().getElementsByTagName(PROPERTY_ELEMENT);
+
+ org.w3c.dom.Element paths=null;
+
+ for (int i=0; paths == null && i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ String propName=((org.w3c.dom.Element)nl.item(i)).getAttribute(NAME_ATTR);
+
+ if (propName != null && propName.equals(PATHS)) {
+ paths = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (paths == null) {
+ paths = getAction().getOwnerDocument().createElement(PROPERTY_ELEMENT);
+ paths.setAttribute(NAME_ATTR, PATHS);
+
+ getAction().appendChild(paths);
+ }
+
+ org.w3c.dom.Element path=
+ getAction().getOwnerDocument().createElement(exit?EXIT:WHILE);
+ path.setAttribute(SERVICE_CATEGORY, category);
+ path.setAttribute(SERVICE_NAME, name);
+
+ paths.appendChild(path);
+
+ for (int i=0; i < messageTypes.size(); i++) {
+ org.w3c.dom.Element mt=
+ getAction().getOwnerDocument().createElement(MESSAGE_ELEMENT);
+
+ if (messageTypes.get(i).getTypes().size() == 1) {
+ TypeReference ref=messageTypes.get(i).getTypes().get(0);
+ String type="";
+
+ if (ref.getNamespace() != null) {
+ type += "{"+ref.getNamespace()+"}";
+ }
+ type += ref.getLocalpart();
+
+ mt.setAttribute(TYPE_ATTR, type);
+
+ path.appendChild(mt);
+ }
+ }
+ }
+
+ private String m_loopCategory=null;
+ private String m_loopName=null;
+ private ESBService m_loopService=null;
+ private String m_exitCategory=null;
+ private String m_exitName=null;
+ private ESBService m_exitService=null;
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change)
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/AbstractESBModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/AbstractESBModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/AbstractESBModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/AbstractESBModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.scribble.conversation.model.ConversationInteraction;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+
+/**
+ * This is the abstract ESB model change rule.
+ */
+public abstract class AbstractESBModelChangeRule extends AbstractModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if ((context.getParent() instanceof ESBService ||
+ (ref != null && ref.getSource().getObject()
+ instanceof AbstractESBAction &&
+ ((AbstractESBAction)ref.getSource().getObject()).getService() != null)) &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the ESB service associated with the
+ * optional model object reference or the context.
+ *
+ * @param context The context
+ * @param ref The optional model object
+ * @return The ESB service, or null if not found
+ */
+ protected ESBService getESBService(ModelChangeContext context,
+ ModelObject ref) {
+ ESBService ret=(ESBService)context.getParent();
+
+ if (ref != null && ref.getSource().getObject() instanceof AbstractESBAction) {
+ ret = ((AbstractESBAction)ref.getSource().getObject()).getService();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines the position of the supplied
+ * model object within the supplied service.
+ *
+ * @param service The service
+ * @param ref The optional model object
+ * @return The position, or -1 if not found
+ */
+ protected int getPosition(ESBService service, ModelObject ref) {
+ int ret=-1;
+
+ // Check if reference model object provided, and if so,
+ // if it has a position within the service
+ if (ref != null && ref.getSource().getObject() instanceof ESBAction) {
+ ret = service.getActions().indexOf((ESBAction)
+ ref.getSource().getObject());
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether an 'initiator' action,
+ * inserted at the defined position in the specified
+ * service, should actually be placed in a new scheduled
+ * service.
+ *
+ * @param service The current service
+ * @param pos The insertion position in that service
+ * @return Whether a new service needs to be scheduled to
+ * accommodate the initiator action
+ */
+ protected boolean shouldScheduleNewService(ESBService service,
+ int pos) {
+ boolean ret=false;
+
+ for (int i=0; ret == false && i < pos; i++) {
+ ESBAction action=service.getActions().get(i);
+
+ if (action.isSessionBased() && !action.isCreateSession()) {
+ ret = true;
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and deleted model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object to be removed
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isDeleteSupported(ModelChangeContext context,
+ Model model, ModelObject mobj) {
+ boolean ret=false;
+
+ if (mobj.getSource().getObject() instanceof AbstractESBAction &&
+ (context.getParent() instanceof ESBService ||
+ ((AbstractESBAction)mobj.getSource().getObject()).getService() != null) &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method removes the supplied model object from the
+ * supplied model. The model object representation must
+ * contain the necessary model specific to remove the
+ * object from the underlying model representation.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object to be deleted
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean delete(ModelChangeContext context,
+ Model model, ModelObject mobj) {
+ boolean ret=false;
+ ESBService service=getESBService(context, mobj);
+ ESBAction action=(ESBAction)mobj.getSource().getObject();
+
+ if (action != null && service != null) {
+ ret = service.getActions().remove(action);
+ }
+
+ return(ret);
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -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.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.IdentityUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Conversation Interaction.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ConversationInteractionModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof ConversationInteraction &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ConversationInteraction interaction=(ConversationInteraction)mobj;
-
- // Check if send or receive
- if (InteractionUtil.isSend(interaction)) {
-
- // Send
- insertSend(context, esbModel, interaction, position);
-
- } else {
- // Receive
- insertReceive(context, esbModel, interaction, position);
- }
-
- return(true);
- }
-
- protected void insertSend(ModelChangeContext context,
- ESBLanguageModel esbModel, ConversationInteraction interaction,
- int position) {
- ESBService service=(ESBService)context.getParent();
-
- SendMessageAction action=
- new SendMessageAction(service);
-
- if (interaction.getMessageSignature().getOperation() != null) {
- action.setOperation(interaction.getMessageSignature().getOperation());
- }
-
- if (interaction.getMessageSignature().getTypes().size() == 1) {
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- // TODO: Search for an implementation associated with
- // the type reference, so that the type can be
- // abstract - possibly have the required message type
- // notation as part of the context, so that if multiple
- // implementations found, then can select e.g. XML or
- // Java as message type representation.
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- action.setMessageType(mtype);
- }
-
- service.addAction(action, position);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action &&
- interaction.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)interaction.getEnclosingDefinition())));
- }
-
- if (interaction.getRequestLabel() != null) {
-
- // Create new ESB service
- ESBService respService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(respService);
-
- action.setResponseDestination(respService.getCategory(),
- respService.getName());
-
- context.setParent(respService);
-
- } else if (interaction.getReplyToLabel() != null) {
-
- if (interaction.getToRole() != null) {
- action.setClientEPR(interaction.getToRole().getName());
- } else {
- action.setClientEPR("client");
- }
- }
-
- // If not reply, then include the target service
- // details
- if (interaction.getReplyToLabel() == null &&
- interaction.getToRole() != null &&
- interaction.getToRole().getName() != null &&
- interaction.getToRole().getName().length() > 0) {
- String roleName=Character.toLowerCase(
- interaction.getToRole().getName().charAt(0))+
- interaction.getToRole().getName().substring(1);
-
- action.setDestinationExpression(
- InteractionUtil.getRoleServiceCategoryProperty(roleName),
- InteractionUtil.getRoleServiceNameProperty(roleName));
- }
-
- if (interaction.getEnclosingDefinition() instanceof Conversation &&
- interaction.getEnclosingDefinition().getModel()
- instanceof ConversationModel) {
-
- java.util.List<Identity> ids=((Conversation)
- interaction.getEnclosingDefinition()).getIdentities();
-
- java.util.List<IdentityLocator> locators=
- ((ConversationModel)interaction.getEnclosingDefinition().
- getModel()).getIdentityLocators();
-
- IdentityUtil.defineIdentities(action.getPropertyElement(
- SendMessageAction.IDENTITIES),
- interaction.getMessageSignature(), ids, locators);
- }
- }
-
- protected void insertReceive(ModelChangeContext context,
- ESBLanguageModel esbModel, ConversationInteraction interaction,
- int position) {
- ESBService service=(ESBService)context.getParent();
-
- // TODO: Create a new service to receive the
- // message and add a schedule service to link
- // to this new service - issue, how do we
- // deal with request/response
- if (service.isCreateSession() == false &&
- service.isSessionBased()) {
- // Already has activities, so need to separate
- // into another service descriptor
- ESBService recvService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(recvService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- schedule.setDestination(recvService.getCategory(),
- recvService.getName(), false);
-
- service.addAction(schedule, position);
-
- context.setParent(recvService);
- }
-
- ReceiveMessageAction action=
- new ReceiveMessageAction((ESBService)context.getParent());
-
- if (interaction.getMessageSignature().getOperation() != null) {
- action.setOperation(interaction.getMessageSignature().getOperation());
- }
-
- if (interaction.getMessageSignature().getTypes().size() == 1) {
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- // TODO: Search for an implementation associated with
- // the type reference, so that the type can be
- // abstract - possibly have the required message type
- // notation as part of the context, so that if multiple
- // implementations found, then can select e.g. XML or
- // Java as message type representation.
- String mtype=InteractionUtil.getTypeString(ref);
-
- action.setMessageType(mtype);
- }
-
- ((ESBService)context.getParent()).addAction(action, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action &&
- interaction.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)interaction.getEnclosingDefinition())));
- }
-
- // If not a response, then add to the gateway
- if (interaction.getReplyToLabel() == null) {
- ESBService gwService=esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- java.util.List<MessageSignature> mtypes=
- new java.util.Vector<MessageSignature>();
- mtypes.add(interaction.getMessageSignature());
-
- mra.addRoute(((ESBService)context.getParent()).getCategory(),
- ((ESBService)context.getParent()).getName(),
- service.isRoot(), mtypes);
- }
- }
-
- // Set client EPR
- if (interaction.getFromRole() != null) {
- action.setClientEPR(interaction.getFromRole().getName());
- } else {
- action.setClientEPR("client");
- }
- }
-
- if (interaction.getEnclosingDefinition() instanceof Conversation &&
- interaction.getEnclosingDefinition().getModel()
- instanceof ConversationModel) {
-
- java.util.List<Identity> ids=((Conversation)
- interaction.getEnclosingDefinition()).getIdentities();
-
- java.util.List<IdentityLocator> locators=
- ((ConversationModel)interaction.getEnclosingDefinition().
- getModel()).getIdentityLocators();
-
- IdentityUtil.defineIdentities(action.getPropertyElement(
- SendMessageAction.IDENTITIES),
- interaction.getMessageSignature(), ids, locators);
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,553 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ConversationUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.IdentityUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Conversation Interaction.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class ConversationInteractionModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj,
+ ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof ConversationInteraction &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ConversationInteraction interaction=(ConversationInteraction)mobj;
+
+ // Check if send or receive
+ if (InteractionUtil.isSend(interaction)) {
+
+ // Send
+ insertSend(context, esbModel, interaction, ref);
+
+ } else {
+ // Receive
+ insertReceive(context, esbModel, interaction, ref);
+ }
+
+ return(true);
+ }
+
+ protected void insertSend(ModelChangeContext context,
+ ESBLanguageModel esbModel, ConversationInteraction interaction,
+ ModelObject ref) {
+ ESBService service=getESBService(context, ref);
+
+ SendMessageAction action=
+ new SendMessageAction(service);
+
+ if (interaction.getMessageSignature().getOperation() != null) {
+ action.setOperation(interaction.getMessageSignature().getOperation());
+ }
+
+ setMessageType(action, interaction);
+
+ boolean f_subsequentInitiator=false;
+ boolean f_moveActions=false;
+
+ // Check if reference model object provided, and if so,
+ // if it has a position within the service
+ int pos=getPosition(service, ref);
+
+ // Check if subsequent action(s) are initiators
+ if (pos != -1) {
+ for (int i=pos; f_subsequentInitiator == false &&
+ i < service.getActions().size(); i++) {
+ f_subsequentInitiator =
+ service.getActions().get(i).isInitiator();
+ }
+ }
+
+ // Move actions if a subsequent initiator has been found
+ f_moveActions = f_subsequentInitiator;
+
+ service.addAction(action, pos);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action &&
+ interaction.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)interaction.getEnclosingDefinition())));
+ }
+
+ if (interaction.getRequestLabel() != null) {
+
+ // Create new ESB service
+ ESBService respService=esbModel.createService(
+ service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(respService);
+
+ action.setResponseDestination(respService.getCategory(),
+ respService.getName());
+
+ context.setParent(respService);
+
+ // Clear the sub-sequent initiator flag, as
+ // subsequent actions will be moved to new service
+ // anyway
+ f_subsequentInitiator = false;
+
+ } else if (interaction.getReplyToLabel() != null) {
+
+ if (interaction.getToRole() != null) {
+ action.setClientEPR(interaction.getToRole().getName());
+ } else {
+ action.setClientEPR("client");
+ }
+ }
+
+ // Check if subsequent initiator found, requiring
+ // a new service
+ if (f_subsequentInitiator) {
+
+ ESBService extraService=esbModel.createService(
+ service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(extraService);
+
+ // Add schedule action
+ ScheduleStateAction schedule=
+ new ScheduleStateAction(service);
+
+ schedule.setDestination(extraService.getCategory(),
+ extraService.getName(), false);
+
+ service.addAction(schedule, pos+1);
+
+ // Move pointer on, as now additional 'schedule' action
+ pos++;
+
+ context.setParent(extraService);
+ }
+
+ // Check if existing actions need to be moved
+ if (f_moveActions) {
+ for (int i=pos+1; i < service.getActions().size();) {
+ ESBService extraService=(ESBService)context.getParent();
+
+ ESBAction act=service.getActions().get(i);
+ service.getActions().remove(i);
+
+ extraService.addAction(act, -1);
+ }
+ }
+
+ // If not reply, then include the target service
+ // details
+ if (interaction.getReplyToLabel() == null &&
+ interaction.getToRole() != null &&
+ interaction.getToRole().getName() != null &&
+ interaction.getToRole().getName().length() > 0) {
+ String roleName=Character.toLowerCase(
+ interaction.getToRole().getName().charAt(0))+
+ interaction.getToRole().getName().substring(1);
+
+ action.setDestinationExpression(
+ InteractionUtil.getRoleServiceCategoryProperty(roleName),
+ InteractionUtil.getRoleServiceNameProperty(roleName));
+ }
+
+ if (interaction.getEnclosingDefinition() instanceof Conversation &&
+ interaction.getEnclosingDefinition().getModel()
+ instanceof ConversationModel) {
+
+ java.util.List<Identity> ids=((Conversation)
+ interaction.getEnclosingDefinition()).getIdentities();
+
+ java.util.List<IdentityLocator> locators=
+ ((ConversationModel)interaction.getEnclosingDefinition().
+ getModel()).getIdentityLocators();
+
+ IdentityUtil.defineIdentities(action.getPropertyElement(
+ SendMessageAction.IDENTITIES),
+ interaction.getMessageSignature(), ids, locators);
+ }
+ }
+
+ protected void insertReceive(ModelChangeContext context,
+ ESBLanguageModel esbModel, ConversationInteraction interaction,
+ ModelObject ref) {
+ ESBService service=getESBService(context, ref);
+ ESBService endService=service;
+
+ int endPos=-1;
+ boolean f_subsequentInitiator=false;
+
+ // Check if reference model object provided, and if so,
+ // if it has a position within the service
+ int pos=getPosition(service, ref);
+
+ // Check if subsequent action(s) are initiators
+ if (pos != -1) {
+ for (int i=pos; f_subsequentInitiator == false &&
+ i < service.getActions().size(); i++) {
+ f_subsequentInitiator =
+ service.getActions().get(i).isInitiator();
+ }
+ }
+
+ endPos = pos;
+
+ // Check if receive needs to be placed in new service
+ // descriptor - i.e. if insert at end, but current service
+ // already has service based actions, or reference object
+ // provided, but is not first position
+ if (shouldScheduleNewService(service, (pos == -1 ?
+ service.getActions().size() : pos))) {
+
+ // Already has activities, so need to separate
+ // into another service descriptor
+ ESBService recvService=esbModel.createService(
+ service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(recvService);
+
+ // Add schedule action
+ ScheduleStateAction schedule=
+ new ScheduleStateAction(service);
+
+ schedule.setDestination(recvService.getCategory(),
+ recvService.getName(), false);
+
+ service.addAction(schedule, pos);
+
+ context.setParent(recvService);
+
+ endService = recvService;
+ endPos = 0;
+ }
+
+ ReceiveMessageAction action=
+ new ReceiveMessageAction(endService);
+
+ if (interaction.getMessageSignature().getOperation() != null) {
+ action.setOperation(interaction.getMessageSignature().getOperation());
+ }
+
+ setMessageType(action, interaction);
+
+ endService.addAction(action, endPos);
+
+ if (endService.getFirstSessionBasedAction() == action &&
+ interaction.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)interaction.getEnclosingDefinition())));
+ }
+
+ // Check if subsequent initiator found, requiring
+ // a new service
+ if (f_subsequentInitiator) {
+
+ ESBService extraService=esbModel.createService(
+ service.getCategory(),
+ esbModel.getUniqueServiceName(endService.getCategory(),
+ endService.getName()));
+
+ esbModel.addService(extraService);
+
+ // Add schedule action
+ ScheduleStateAction schedule=
+ new ScheduleStateAction(endService);
+
+ schedule.setDestination(extraService.getCategory(),
+ extraService.getName(), false);
+
+ endService.addAction(schedule, endPos+1);
+
+ // Move pointer on, as now additional 'schedule' action
+ pos++;
+
+ context.setParent(extraService);
+
+ endService = extraService;
+ endPos = -1;
+ }
+
+ // Check if existing actions need to be moved
+ if (pos != -1 && service != endService) {
+ for (int i=pos+1; i < service.getActions().size();) {
+ ESBAction act=service.getActions().get(i);
+ service.getActions().remove(i);
+
+ endService.addAction(act, -1);
+ }
+ }
+
+ // If not a response, then add to the gateway
+ if (interaction.getReplyToLabel() == null) {
+ ESBService gwService=esbModel.getGatewayService();
+
+ if (gwService != null) {
+ ESBAction gwAction=gwService.getGatewayAction();
+
+ if (gwAction instanceof MessageRouterAction) {
+ MessageRouterAction mra=(MessageRouterAction)
+ gwAction;
+
+ java.util.List<MessageSignature> mtypes=
+ new java.util.Vector<MessageSignature>();
+ mtypes.add(interaction.getMessageSignature());
+
+ mra.addRoute(endService.getCategory(),
+ endService.getName(),
+ service.isRoot(), mtypes);
+ }
+ }
+
+ // Set client EPR
+ if (interaction.getFromRole() != null) {
+ action.setClientEPR(interaction.getFromRole().getName());
+ } else {
+ action.setClientEPR("client");
+ }
+ }
+
+ if (interaction.getEnclosingDefinition() instanceof Conversation &&
+ interaction.getEnclosingDefinition().getModel()
+ instanceof ConversationModel) {
+
+ java.util.List<Identity> ids=((Conversation)
+ interaction.getEnclosingDefinition()).getIdentities();
+
+ java.util.List<IdentityLocator> locators=
+ ((ConversationModel)interaction.getEnclosingDefinition().
+ getModel()).getIdentityLocators();
+
+ IdentityUtil.defineIdentities(action.getPropertyElement(
+ SendMessageAction.IDENTITIES),
+ interaction.getMessageSignature(), ids, locators);
+ }
+ }
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and modified model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param fromObj The source model object
+ * @param toObj The model object to be updated
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isUpdateSupported(ModelChangeContext context,
+ Model model, ModelObject fromObj, ModelObject toObj) {
+ boolean ret=false;
+
+ if (fromObj instanceof ConversationInteraction &&
+ toObj instanceof ConversationInteraction &&
+ context.getParent() instanceof ESBService &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method modifies an existing model object, within a
+ * parent model object, with the details supplied in
+ * another model object.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param fromObj The source model object
+ * @param toObj The model object to be updated
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean update(ModelChangeContext context,
+ Model model, ModelObject fromObj, ModelObject toObj) {
+ boolean ret=false;
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ConversationInteraction fromInteraction=(ConversationInteraction)fromObj;
+ ConversationInteraction toInteraction=(ConversationInteraction)toObj;
+ ESBService service=(ESBService)context.getParent();
+
+ // Get action from 'toInteraction'
+ if (toInteraction.getSource().getObject() instanceof
+ AbstractInteractionMessageAction) {
+ AbstractInteractionMessageAction ma=
+ (AbstractInteractionMessageAction)
+ toInteraction.getSource().getObject();
+
+ String origMesgType=ma.getMessageType();
+
+ // Set message type
+ setMessageType(ma, fromInteraction);
+
+ // Update message type in router if appropriate
+ if (InteractionUtil.isSend(fromInteraction) == false &&
+ fromInteraction.getReplyToLabel() == null) {
+ updateRouterMessageType(esbModel, service,
+ origMesgType, ma);
+ }
+
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ protected void updateRouterMessageType(ESBLanguageModel esbModel,
+ ESBService service, String origMesgType,
+ AbstractInteractionMessageAction ma) {
+ ESBService gwService=esbModel.getGatewayService();
+
+ if (gwService != null) {
+ ESBAction gwAction=gwService.getGatewayAction();
+
+ if (gwAction instanceof MessageRouterAction) {
+ MessageRouterAction mra=(MessageRouterAction)
+ gwAction;
+
+ org.w3c.dom.Element route=
+ mra.getRouteElement(service.getCategory(),
+ service.getName());
+
+ if (route != null) {
+ org.w3c.dom.NodeList nl=
+ route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element mesg=
+ (org.w3c.dom.Element)nl.item(i);
+
+ if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).
+ equals(origMesgType)) {
+ mesg.setAttribute(MessageRouterAction.TYPE_ATTR,
+ ma.getMessageType());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void setMessageType(AbstractInteractionMessageAction action,
+ ConversationInteraction interaction) {
+
+ if (interaction.getMessageSignature().getTypes().size() == 1) {
+ TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
+
+ // TODO: Search for an implementation associated with
+ // the type reference, so that the type can be
+ // abstract - possibly have the required message type
+ // notation as part of the context, so that if multiple
+ // implementations found, then can select e.g. XML or
+ // Java as message type representation.
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ action.setMessageType(mtype);
+ }
+ }
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and deleted model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object to be removed
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isDeleteSupported(ModelChangeContext context,
+ Model model, ModelObject mobj) {
+ boolean ret=false;
+
+ if (mobj instanceof ConversationInteraction &&
+ super.isDeleteSupported(context, model, mobj)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Conversation.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ConversationModelChangeRule extends AbstractModelChangeRule {
-
- private static final String NAME_SUFFIX = "_main";
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof Conversation &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- Conversation conv=(Conversation)mobj;
-
- String namespace=((Model)conv.getModel()).
- getNamespace().getName();
-
- String category=ConversationUtil.getServiceCategory(conv);
-
- String name=ConversationUtil.getServiceName(conv);
-
- String sdname="";
-
-
- // Check if root conversation
- if (conv.getParent() instanceof Model) {
-
- // Register gateway service
- DefaultESBService gateway=new DefaultESBService(esbModel,
- category, name);
-
- MessageRouterAction mra=new MessageRouterAction(gateway);
-
- // Construct service description name
- if (namespace != null) {
- sdname = "{"+namespace+"}";
- }
-
- sdname += conv.getModelName().getName()+"-"+
- conv.getModelName().getLocatedRole().getName();
-
- mra.setServiceDescriptionName(sdname);
-
- gateway.addAction(mra, -1);
-
- esbModel.addService(gateway);
-
- name += NAME_SUFFIX;
- }
-
- // Create new ESB service
- ESBService service=esbModel.createService(category, name);
-
- esbModel.addService(service);
-
- // Create 'CreateSession' activity
- CreateSessionAction csa=new CreateSessionAction(service);
-
- // Check if root conversation
- if (conv.getParent() instanceof Model) {
- csa.setRoot(true);
-
- String ctype=null;
-
- // Check if conversation has a 'conforms to' reference
- if (conv.getConformsTo().size() > 0) {
- // Set conversation type based on first 'conforms to'
- // reference
- ConformanceReference cref=conv.getConformsTo().get(0);
-
- ctype = cref.getNamespace()+"."+
- cref.getLocalpart()+"@"+
- cref.getLocatedRole();
- } else {
- // Set conversation type based on conversation
- // namespace and name
- ctype = namespace+"."+
- conv.getModelName().getName()+"@"+
- conv.getModelName().getLocatedRole().getName();
- }
-
- if (ctype != null) {
- csa.setConversationType(ctype);
- }
- }
-
- csa.setServiceDescriptionName(sdname);
- csa.setBusinessObjectType(ConversationUtil.getBusinessObjectType(conv));
-
- service.addAction(csa, -1);
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=conv.getBlock().getContents();
-
- context.setParent(service);
-
- for (int i=0; i < acts.size(); i++) {
- context.insert(model, acts.get(i), i);
- }
-
- return(true);
- }
-
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java (from rev 349, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,181 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ConversationUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Conversation.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class ConversationModelChangeRule extends AbstractModelChangeRule {
+
+ private static final String NAME_SUFFIX = "_main";
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object causing the change
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof Conversation &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ Conversation conv=(Conversation)mobj;
+
+ String namespace=((Model)conv.getModel()).
+ getNamespace().getName();
+
+ String category=ConversationUtil.getServiceCategory(conv);
+
+ String name=ConversationUtil.getServiceName(conv);
+
+ String sdname="";
+
+ // Check if root conversation
+ if (conv.getParent() instanceof Model) {
+
+ // Register gateway service
+ DefaultESBService gateway=new DefaultESBService(esbModel,
+ category, name);
+
+ MessageRouterAction mra=new MessageRouterAction(gateway);
+
+ // Construct service description name
+ if (namespace != null) {
+ sdname = "{"+namespace+"}";
+ }
+
+ sdname += conv.getModelName().getName()+"-"+
+ conv.getModelName().getLocatedRole().getName();
+
+ mra.setServiceDescriptionName(sdname);
+
+ gateway.addAction(mra, -1);
+
+ esbModel.addService(gateway);
+
+ name += NAME_SUFFIX;
+ }
+
+ // Create new ESB service
+ ESBService service=esbModel.createService(category, name);
+
+ esbModel.addService(service);
+
+ // Create 'CreateSession' activity
+ CreateSessionAction csa=new CreateSessionAction(service);
+
+ // Check if root conversation
+ if (conv.getParent() instanceof Model) {
+ csa.setRoot(true);
+
+ String ctype=null;
+
+ // Check if conversation has a 'conforms to' reference
+ if (conv.getConformsTo().size() > 0) {
+ // Set conversation type based on first 'conforms to'
+ // reference
+ ConformanceReference cref=conv.getConformsTo().get(0);
+
+ ctype = cref.getNamespace()+"."+
+ cref.getLocalpart()+"@"+
+ cref.getLocatedRole();
+ } else {
+ // Set conversation type based on conversation
+ // namespace and name
+ ctype = namespace+"."+
+ conv.getModelName().getName()+"@"+
+ conv.getModelName().getLocatedRole().getName();
+ }
+
+ if (ctype != null) {
+ csa.setConversationType(ctype);
+ }
+ }
+
+ csa.setServiceDescriptionName(sdname);
+ csa.setBusinessObjectType(ConversationUtil.getBusinessObjectType(conv));
+
+ service.addAction(csa, -1);
+
+ // Process the activities within the conversation
+ java.util.List<Activity> acts=conv.getBlock().getContents();
+
+ context.setParent(service);
+
+ for (int i=0; i < acts.size(); i++) {
+ context.insert(model, acts.get(i), null);
+ }
+
+ return(true);
+ }
+
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,344 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the If grouping construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class IfModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof If &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=(ESBService)context.getParent();
- If ifElem=(If)mobj;
-
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
-
- // Check if should be an 'if' or a 'switch' action
- if (ifElem.getRoles().contains(context.getRole())) {
-
- // If action, because the role is a decision maker
- IfAction ifAction=new IfAction(service);
-
- service.addAction(ifAction, position);
-
- for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
- ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), j);
- }
-
- boolean immediate=false;
-
- ifAction.addPath((i==0 ? IfAction.IF : IfAction.ELSEIF),
- subService.getCategory(), subService.getName(),
- immediate, null, i);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- if (ifElem.getElseBlock() != null) {
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
- context.insert(model,
- ifElem.getElseBlock().getContents().get(j), j);
- }
-
- boolean immediate=false;
-
- ifAction.addPath(IfAction.ELSE,
- subService.getCategory(), subService.getName(),
- immediate, null, -1);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- if (service.getFirstSessionBasedAction() == ifAction &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- ifAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- } else {
-
- // Switch action, as role is a decision observer
- SwitchAction switchAction=new SwitchAction(service);
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to find lookahead analyser");
- }
-
- service.addAction(switchAction, position);
-
- java.util.List<MessageSignature> messageTypes=
- new java.util.Vector<MessageSignature>();
-
- for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
- ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), j);
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(cb);
- }
-
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, i);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- }
-
- if (ifElem.getElseBlock() != null) {
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
- context.insert(model,
- ifElem.getElseBlock().getContents().get(j), j);
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(ifElem.getElseBlock());
- }
-
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, -1);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- }
-
- // Only record message router 'routes' if the switch
- // receives request interactions, and it is the first
- // session based action in the service
- if (messageTypes.size() > 0 &&
- service.getFirstSessionBasedAction() == switchAction) {
- ESBService gwService=
- esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- mra.addRoute(service.getCategory(),
- service.getName(),
- false, messageTypes);
- }
- }
- }
-
- if (service.getFirstSessionBasedAction() == switchAction &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- }
-
- context.setParent(joinService);
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,416 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ConversationUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.model.analysis.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.*;
+
+/**
+ * This is the model change rule for the If grouping construct.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class IfModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof If &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ESBService service=getESBService(context, ref);
+ If ifElem=(If)mobj;
+
+ int pos=getPosition(service, ref);
+
+ ESBService joinService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(joinService);
+
+ // Check if should be an 'if' or a 'switch' action
+ if (ifElem.getRoles().contains(context.getRole())) {
+
+ insertIf(context, model, service, ifElem, joinService, pos);
+ } else {
+ insertSwitch(context, model, service, ifElem, joinService, pos);
+ }
+
+
+ context.setParent(joinService);
+
+ // If reference provided, then move subsequent activities
+ // to the 'join service'
+ if (pos != -1) {
+ for (int i=pos+1; i < service.getActions().size();) {
+ ESBAction act=service.getActions().get(i);
+ service.getActions().remove(i);
+
+ joinService.addAction(act, -1);
+ }
+ }
+
+ return(true);
+ }
+
+ protected void insertIf(ModelChangeContext context,
+ Model model, ESBService service,
+ If ifElem, ESBService joinService, int pos) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+
+ // If action, because the role is a decision maker
+ IfAction ifAction=new IfAction(service);
+
+ service.addAction(ifAction, pos);
+
+ for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
+ ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < cb.getContents().size(); j++) {
+ context.insert(model, cb.getContents().get(j), null);
+ }
+
+ boolean immediate=false;
+
+ ifAction.addPath((i==0 ? IfAction.IF : IfAction.ELSEIF),
+ subService.getCategory(), subService.getName(),
+ immediate, null, i);
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
+ }
+
+ if (ifElem.getElseBlock() != null) {
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
+ context.insert(model,
+ ifElem.getElseBlock().getContents().get(j), null);
+ }
+
+ boolean immediate=false;
+
+ ifAction.addPath(IfAction.ELSE,
+ subService.getCategory(), subService.getName(),
+ immediate, null, -1);
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
+ }
+
+ if (service.getFirstSessionBasedAction() == ifAction &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ ifAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
+ }
+
+ protected void insertSwitch(ModelChangeContext context,
+ Model model, ESBService service,
+ If ifElem, ESBService joinService, int pos) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+
+ // Check if 'when' needs to be placed in new service
+ // descriptor - i.e. if insert at end, but current service
+ // already has service based actions, or reference object
+ // provided, but is not first position
+ if (shouldScheduleNewService(service, (pos == -1 ?
+ service.getActions().size() : pos))) {
+
+ // Already has activities, so need to separate
+ // into another service descriptor
+ ESBService switchService=esbModel.createService(
+ service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(switchService);
+
+ // Add schedule action
+ ScheduleStateAction schedule=
+ new ScheduleStateAction(service);
+
+ schedule.setDestination(switchService.getCategory(),
+ switchService.getName(), false);
+
+ service.addAction(schedule, pos);
+
+ context.setParent(switchService);
+
+ service = switchService;
+ pos = -1;
+ }
+
+ // Switch action, as role is a decision observer
+ SwitchAction switchAction=new SwitchAction(service);
+
+ // Get lookahead analyser
+ LookaheadAnalyser la=(LookaheadAnalyser)
+ RegistryFactory.getRegistry().getExtension(
+ LookaheadAnalyser.class, null);
+
+ if (la == null) {
+ logger.severe("Failed to find lookahead analyser");
+ }
+
+ service.addAction(switchAction, pos);
+
+ java.util.List<MessageSignature> messageTypes=
+ new java.util.Vector<MessageSignature>();
+
+ for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
+ ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < cb.getContents().size(); j++) {
+ context.insert(model, cb.getContents().get(j), null);
+ }
+
+ java.util.Set<Interaction> interactions=null;
+
+ if (la != null) {
+ interactions = la.getInteractions(cb);
+ }
+
+ switchAction.addCase(subService.getCategory(),
+ subService.getName(), interactions, i);
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
+
+ if (interactions != null) {
+ java.util.Iterator<Interaction> iter=interactions.iterator();
+
+ while (iter.hasNext()) {
+ Interaction interaction=iter.next();
+
+ //TODO: Only deals with single type for now
+ // If a receive and not a response, then
+ // add to the gateway
+ if (InteractionUtil.isSend(interaction) == false &&
+ interaction.getReplyToLabel() == null &&
+ interaction.getMessageSignature().getTypes().size()==1) {
+
+ messageTypes.add(interaction.getMessageSignature());
+ }
+ }
+ }
+ }
+
+ if (ifElem.getElseBlock() != null) {
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
+ context.insert(model,
+ ifElem.getElseBlock().getContents().get(j), null);
+ }
+
+ java.util.Set<Interaction> interactions=null;
+
+ if (la != null) {
+ interactions = la.getInteractions(ifElem.getElseBlock());
+ }
+
+ switchAction.addCase(subService.getCategory(),
+ subService.getName(), interactions, -1);
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
+
+ if (interactions != null) {
+ java.util.Iterator<Interaction> iter=interactions.iterator();
+
+ while (iter.hasNext()) {
+ Interaction interaction=iter.next();
+
+ //TODO: Only deals with single type for now
+ // If a receive and not a response, then
+ // add to the gateway
+ if (InteractionUtil.isSend(interaction) == false &&
+ interaction.getReplyToLabel() == null &&
+ interaction.getMessageSignature().getTypes().size()==1) {
+
+ messageTypes.add(interaction.getMessageSignature());
+ }
+ }
+ }
+ }
+
+ // Only record message router 'routes' if the switch
+ // receives request interactions, and it is the first
+ // session based action in the service
+ if (messageTypes.size() > 0 &&
+ service.getFirstSessionBasedAction() == switchAction) {
+ ESBService gwService=
+ esbModel.getGatewayService();
+
+ if (gwService != null) {
+ ESBAction gwAction=gwService.getGatewayAction();
+
+ if (gwAction instanceof MessageRouterAction) {
+ MessageRouterAction mra=(MessageRouterAction)
+ gwAction;
+
+ mra.addRoute(service.getCategory(),
+ service.getName(),
+ false, messageTypes);
+ }
+ }
+ }
+
+ if (service.getFirstSessionBasedAction() == switchAction &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryInfo;
-
-/**
- * This is the model change rule for the Language Model to
- * Conversation Model.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class LanguageToConversationModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof ConversationModel &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ConversationModel cm=(ConversationModel)mobj;
-
- if (cm.getConversation() != null) {
- context.insert(model, cm.getConversation(), -1);
- }
-
- return(true);
- }
-
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java (from rev 349, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/LanguageToConversationModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Language Model to
+ * Conversation Model.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class LanguageToConversationModelChangeRule extends AbstractModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof ConversationModel &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ConversationModel cm=(ConversationModel)mobj;
+
+ if (cm.getConversation() != null) {
+ context.insert(model, cm.getConversation(), null);
+ }
+
+ return(true);
+ }
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/MessageSignatureModelChangeRule.java (from rev 398, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/MessageSignatureModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/MessageSignatureModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/MessageSignatureModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the MessageSignature.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class MessageSignatureModelChangeRule extends AbstractModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and modified model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param fromObj The source model object
+ * @param toObj The model object to be updated
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isUpdateSupported(ModelChangeContext context,
+ Model model, ModelObject fromObj, ModelObject toObj) {
+ boolean ret=false;
+
+ if (fromObj instanceof MessageSignature &&
+ toObj instanceof MessageSignature &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method modifies an existing model object, within a
+ * parent model object, with the details supplied in
+ * another model object.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param fromObj The source model object
+ * @param toObj The model object to be updated
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean update(ModelChangeContext context,
+ Model model, ModelObject fromObj, ModelObject toObj) {
+ boolean ret=false;
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ MessageSignature fromMS=(MessageSignature)fromObj;
+ MessageSignature toMS=(MessageSignature)toObj;
+ ConversationInteraction toInteraction=null;
+ ConversationInteraction fromInteraction=null;
+
+ if (toMS != null &&
+ toMS.getParent() instanceof ConversationInteraction) {
+ toInteraction = (ConversationInteraction)toMS.getParent();
+ }
+
+ if (fromMS != null &&
+ fromMS.getParent() instanceof ConversationInteraction) {
+ fromInteraction = (ConversationInteraction)fromMS.getParent();
+ }
+
+ // Get action from 'toInteraction'
+ if (toInteraction != null &&
+ toInteraction.getSource().getObject() instanceof
+ AbstractInteractionMessageAction) {
+ AbstractInteractionMessageAction ma=
+ (AbstractInteractionMessageAction)
+ toInteraction.getSource().getObject();
+
+ // Update operation
+ setOperation(ma, fromInteraction);
+
+ ESBService service = ma.getService();
+
+ String origMesgType=ma.getMessageType();
+
+ // Set message type
+ setMessageType(ma, fromInteraction);
+
+ // Update message type in router if appropriate
+ if (InteractionUtil.isSend(fromInteraction) == false &&
+ fromInteraction.getReplyToLabel() == null) {
+ updateRouterMessageType(esbModel, service,
+ origMesgType, ma);
+ }
+
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ protected void updateRouterMessageType(ESBLanguageModel esbModel,
+ ESBService service, String origMesgType,
+ AbstractInteractionMessageAction ma) {
+ ESBService gwService=esbModel.getGatewayService();
+
+ if (gwService != null) {
+ ESBAction gwAction=gwService.getGatewayAction();
+
+ if (gwAction instanceof MessageRouterAction) {
+ MessageRouterAction mra=(MessageRouterAction)
+ gwAction;
+
+ org.w3c.dom.Element route=
+ mra.getRouteElement(service.getCategory(),
+ service.getName());
+
+ if (route != null) {
+ org.w3c.dom.NodeList nl=
+ route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element mesg=
+ (org.w3c.dom.Element)nl.item(i);
+
+ if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).
+ equals(origMesgType)) {
+ mesg.setAttribute(MessageRouterAction.TYPE_ATTR,
+ ma.getMessageType());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void setMessageType(AbstractInteractionMessageAction action,
+ ConversationInteraction interaction) {
+
+ if (interaction.getMessageSignature().getTypes().size() == 1) {
+ TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
+
+ // TODO: Search for an implementation associated with
+ // the type reference, so that the type can be
+ // abstract - possibly have the required message type
+ // notation as part of the context, so that if multiple
+ // implementations found, then can select e.g. XML or
+ // Java as message type representation.
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ action.setMessageType(mtype);
+ }
+ }
+
+ protected void setOperation(AbstractInteractionMessageAction action,
+ ConversationInteraction interaction) {
+ action.setOperation(interaction.getMessageSignature().getOperation());
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,167 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the Parallel grouping construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class ParallelModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof Parallel &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=(ESBService)context.getParent();
- Parallel parallel=(Parallel)mobj;
-
- // Create the join service
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
-
- // Create and configure the parallel action
- ParallelAction parAction=new ParallelAction(service);
-
- service.addAction(parAction, position);
-
- for (int i=0; i < parallel.getBlocks().size(); i++) {
- Block b=parallel.getBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < b.getContents().size(); j++) {
- context.insert(model, b.getContents().get(j), j);
- }
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- parallel.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)parallel.getEnclosingDefinition())));
- }
-
- boolean immediate=true;
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to get lookahead analyser");
- } else {
- java.util.Iterator<Interaction> iter=
- la.getInteractions(b, true).iterator();
-
- while (immediate && iter.hasNext()) {
- Interaction interaction=iter.next();
-
- // If interaction is a receive, then immediate
- // invocation will be false
- immediate = InteractionUtil.isSend(interaction);
- }
- }
-
- parAction.addPath(subService.getCategory(),
- subService.getName(), immediate, false, i);
- }
-
- context.setParent(joinService);
-
- parAction.addPath(joinService.getCategory(),
- joinService.getName(), false, true, -1);
-
- // Check if business object type needs to be specified
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == parAction &&
- parallel.getEnclosingDefinition() instanceof Conversation) {
- parAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)parallel.getEnclosingDefinition())));
- }
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,192 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.model.analysis.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.*;
+
+/**
+ * This is the model change rule for the Parallel grouping construct.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class ParallelModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof Parallel &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ESBService service=getESBService(context, ref);
+ Parallel parallel=(Parallel)mobj;
+
+ int pos=getPosition(service, ref);
+
+ // Create the join service
+ ESBService joinService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(joinService);
+
+ // Create and configure the parallel action
+ ParallelAction parAction=new ParallelAction(service);
+
+ service.addAction(parAction, pos);
+
+ for (int i=0; i < parallel.getBlocks().size(); i++) {
+ Block b=parallel.getBlocks().get(i);
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < b.getContents().size(); j++) {
+ context.insert(model, b.getContents().get(j), null);
+ }
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ parallel.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)parallel.getEnclosingDefinition())));
+ }
+
+ boolean immediate=true;
+
+ // Get lookahead analyser
+ LookaheadAnalyser la=(LookaheadAnalyser)
+ RegistryFactory.getRegistry().getExtension(
+ LookaheadAnalyser.class, null);
+
+ if (la == null) {
+ logger.severe("Failed to get lookahead analyser");
+ } else {
+ java.util.Iterator<Interaction> iter=
+ la.getInteractions(b, true).iterator();
+
+ while (immediate && iter.hasNext()) {
+ Interaction interaction=iter.next();
+
+ // If interaction is a receive, then immediate
+ // invocation will be false
+ immediate = InteractionUtil.isSend(interaction);
+ }
+ }
+
+ parAction.addPath(subService.getCategory(),
+ subService.getName(), immediate, false, i);
+ }
+
+ context.setParent(joinService);
+
+ parAction.addPath(joinService.getCategory(),
+ joinService.getName(), false, true, -1);
+
+ // Check if business object type needs to be specified
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == parAction &&
+ parallel.getEnclosingDefinition() instanceof Conversation) {
+ parAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)parallel.getEnclosingDefinition())));
+ }
+
+ // If reference provided, then move subsequent activities
+ // to the 'join service'
+ if (pos != -1) {
+ for (int i=pos+1; i < service.getActions().size();) {
+ ESBAction act=service.getActions().get(i);
+ service.getActions().remove(i);
+
+ joinService.addAction(act, -1);
+ }
+ }
+
+ return(true);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the Run composition construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class RunModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof Run &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=(ESBService)context.getParent();
- Run run=(Run)mobj;
-
- PerformAction action=new PerformAction(service);
-
- service.addAction(action, position);
-
- String category=ConversationUtil.getServiceCategory(run.getDefinition());
- String name=ConversationUtil.getServiceName(run.getDefinition());
-
- action.setDestination(category, name);
-
- // Check if business object type needs to be specified
- if (service.getFirstSessionBasedAction() == action &&
- run.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)run.getEnclosingDefinition())));
- }
-
- // Create return service
- ESBService returnService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(returnService);
-
- context.setParent(returnService);
-
- action.setReturnDestination(returnService.getCategory(),
- returnService.getName());
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,201 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.model.analysis.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.*;
+
+/**
+ * This is the model change rule for the Run composition construct.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class RunModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof Run &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ESBService service=getESBService(context, ref);
+ Run run=(Run)mobj;
+
+ int pos=getPosition(service, ref);
+
+ PerformAction action=new PerformAction(service);
+
+ service.addAction(action, pos);
+
+ String category=ConversationUtil.getServiceCategory(run.getDefinition());
+ String name=ConversationUtil.getServiceName(run.getDefinition());
+
+ action.setDestination(category, name);
+
+ // Check if business object type needs to be specified
+ if (service.getFirstSessionBasedAction() == action &&
+ run.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)run.getEnclosingDefinition())));
+ }
+
+ // Create return service
+ ESBService returnService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(returnService);
+
+ context.setParent(returnService);
+
+ action.setReturnDestination(returnService.getCategory(),
+ returnService.getName());
+
+ // If reference provided, then move subsequent activities
+ // to the 'return service'
+ if (pos != -1) {
+ for (int i=pos+1; i < service.getActions().size();) {
+ ESBAction act=service.getActions().get(i);
+ service.getActions().remove(i);
+
+ returnService.addAction(act, -1);
+ }
+ }
+
+ return(true);
+ }
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and deleted model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object to be removed
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isDeleteSupported(ModelChangeContext context,
+ Model model, ModelObject mobj) {
+ boolean ret=false;
+
+ if (mobj instanceof Run &&
+ super.isDeleteSupported(context, model, mobj)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method removes the supplied model object from the
+ * supplied model. The model object representation must
+ * contain the necessary model specific to remove the
+ * object from the underlying model representation.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object to be deleted
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean delete(ModelChangeContext context,
+ Model model, ModelObject mobj) {
+ boolean ret=false;
+ ESBService service=getESBService(context, mobj);
+ ESBAction action=(ESBAction)mobj.getSource().getObject();
+
+ int pos=getPosition(service, mobj);
+
+ if (action instanceof PerformAction && pos != -1) {
+ ScheduleStateAction schedule=
+ new ScheduleStateAction(service);
+
+ PerformAction perform=(PerformAction)action;
+
+ schedule.setDestination(perform.getPropertyValue(PerformAction.RETURN_SERVICE_CATEGORY),
+ perform.getPropertyValue(PerformAction.RETURN_SERVICE_NAME), true);
+
+ service.addAction(schedule, pos);
+
+ ret = super.delete(context, model, mobj);
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-//import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the Spawn composition construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class SpawnModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof Spawn &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBService service=(ESBService)context.getParent();
- Spawn spawn=(Spawn)mobj;
-
- PerformAction action=new PerformAction(service);
-
- service.addAction(action, position);
-
- String category=ConversationUtil.getServiceCategory(spawn.getDefinition());
- String name=ConversationUtil.getServiceName(spawn.getDefinition());
-
- action.setDestination(category, name);
-
- // Check if business object type needs to be specified
- if (service.getFirstSessionBasedAction() == action &&
- spawn.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)spawn.getEnclosingDefinition())));
- }
-
- return(true);
- }
-
- //private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+//import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.*;
+
+/**
+ * This is the model change rule for the Spawn composition construct.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class SpawnModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof Spawn &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBService service=getESBService(context, ref);
+ Spawn spawn=(Spawn)mobj;
+
+ int pos=getPosition(service, ref);
+
+ PerformAction action=new PerformAction(service);
+
+ service.addAction(action, pos);
+
+ String category=ConversationUtil.getServiceCategory(spawn.getDefinition());
+ String name=ConversationUtil.getServiceName(spawn.getDefinition());
+
+ action.setDestination(category, name);
+
+ // Check if business object type needs to be specified
+ if (service.getFirstSessionBasedAction() == action &&
+ spawn.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)spawn.getEnclosingDefinition())));
+ }
+
+ return(true);
+ }
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and deleted model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object to be removed
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isDeleteSupported(ModelChangeContext context,
+ Model model, ModelObject mobj) {
+ boolean ret=false;
+
+ if (mobj instanceof Spawn &&
+ super.isDeleteSupported(context, model, mobj)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ //private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change");
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/TypeReferenceModelChangeRule.java (from rev 328, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/TypeReferenceModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/TypeReferenceModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/TypeReferenceModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Type Reference.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class TypeReferenceModelChangeRule extends AbstractModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context)
+ * and modified model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param fromObj The source model object
+ * @param toObj The model object to be updated
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isUpdateSupported(ModelChangeContext context,
+ Model model, ModelObject fromObj, ModelObject toObj) {
+ boolean ret=false;
+
+ if (fromObj instanceof TypeReference &&
+ toObj instanceof TypeReference &&
+ model instanceof ESBLanguageModel) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method modifies an existing model object, within a
+ * parent model object, with the details supplied in
+ * another model object.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param fromObj The source model object
+ * @param toObj The model object to be updated
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean update(ModelChangeContext context,
+ Model model, ModelObject fromObj, ModelObject toObj) {
+ boolean ret=false;
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ TypeReference fromTypeRef=(TypeReference)fromObj;
+ TypeReference toTypeRef=(TypeReference)toObj;
+ ConversationInteraction toInteraction=null;
+ ConversationInteraction fromInteraction=null;
+
+ if (toTypeRef != null && toTypeRef.getParent() instanceof MessageSignature &&
+ toTypeRef.getParent().getParent() instanceof ConversationInteraction) {
+ toInteraction = (ConversationInteraction)toTypeRef.getParent().getParent();
+ }
+
+ if (fromTypeRef != null && fromTypeRef.getParent() instanceof MessageSignature &&
+ fromTypeRef.getParent().getParent() instanceof ConversationInteraction) {
+ fromInteraction = (ConversationInteraction)fromTypeRef.getParent().getParent();
+ }
+
+ // Get action from 'toInteraction'
+ if (toInteraction != null &&
+ toInteraction.getSource().getObject() instanceof
+ AbstractInteractionMessageAction) {
+ AbstractInteractionMessageAction ma=
+ (AbstractInteractionMessageAction)
+ toInteraction.getSource().getObject();
+
+ ESBService service = ma.getService();
+
+ String origMesgType=ma.getMessageType();
+
+ // Set message type
+ setMessageType(ma, fromInteraction);
+
+ // Update message type in router if appropriate
+ if (InteractionUtil.isSend(fromInteraction) == false &&
+ fromInteraction.getReplyToLabel() == null) {
+ updateRouterMessageType(esbModel, service,
+ origMesgType, ma);
+ }
+
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ protected void updateRouterMessageType(ESBLanguageModel esbModel,
+ ESBService service, String origMesgType,
+ AbstractInteractionMessageAction ma) {
+ ESBService gwService=esbModel.getGatewayService();
+
+ if (gwService != null) {
+ ESBAction gwAction=gwService.getGatewayAction();
+
+ if (gwAction instanceof MessageRouterAction) {
+ MessageRouterAction mra=(MessageRouterAction)
+ gwAction;
+
+ org.w3c.dom.Element route=
+ mra.getRouteElement(service.getCategory(),
+ service.getName());
+
+ if (route != null) {
+ org.w3c.dom.NodeList nl=
+ route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element mesg=
+ (org.w3c.dom.Element)nl.item(i);
+
+ if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).
+ equals(origMesgType)) {
+ mesg.setAttribute(MessageRouterAction.TYPE_ATTR,
+ ma.getMessageType());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void setMessageType(AbstractInteractionMessageAction action,
+ ConversationInteraction interaction) {
+
+ if (interaction.getMessageSignature().getTypes().size() == 1) {
+ TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
+
+ // TODO: Search for an implementation associated with
+ // the type reference, so that the type can be
+ // abstract - possibly have the required message type
+ // notation as part of the context, so that if multiple
+ // implementations found, then can select e.g. XML or
+ // Java as message type representation.
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ action.setMessageType(mtype);
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,247 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the When grouping construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class WhenModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof When &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=(ESBService)context.getParent();
- When when=(When)mobj;
-
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
-
- // Check if context role is decision maker
- if (when.getRoles().contains(context.getRole())) {
- WhenAction action=new WhenAction(service);
-
- service.addAction(action, position);
-
- for (int i=0; i < when.getConditionalBlocks().size(); i++) {
- ConditionalBlock b=when.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < b.getContents().size(); j++) {
- context.insert(model, b.getContents().get(j), j);
- }
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
-
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- when.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
-
- action.addPath(subService.getCategory(),
- subService.getName(), i);
- }
-
- if (service.getFirstSessionBasedAction() == action &&
- when.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
- } else {
-
- // Switch action, as role is a decision observer
- SwitchAction switchAction=new SwitchAction(service);
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to find lookahead analyser");
- }
-
- service.addAction(switchAction, position);
-
- java.util.List<MessageSignature> messageTypes=
- new java.util.Vector<MessageSignature>();
-
- for (int i=0; i < when.getConditionalBlocks().size(); i++) {
- ConditionalBlock cb=when.getConditionalBlocks().get(i);
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- context.setParent(subService);
-
- for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), j);
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(cb);
- }
-
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, i);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
-
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- when.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- }
-
- // Only record message router 'routes' if the switch
- // receives request interactions, and it is the first
- // session based action in the service
- if (messageTypes.size() > 0 &&
- service.getFirstSessionBasedAction() == switchAction) {
- ESBService gwService=
- esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof MessageRouterAction) {
- MessageRouterAction mra=(MessageRouterAction)
- gwAction;
-
- mra.addRoute(service.getCategory(),
- service.getName(),
- false, messageTypes);
- }
- }
- }
-
- if (service.getFirstSessionBasedAction() == switchAction &&
- when.getEnclosingDefinition() instanceof Conversation) {
- switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)when.getEnclosingDefinition())));
- }
- }
-
- context.setParent(joinService);
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,322 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.model.analysis.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.*;
+
+/**
+ * This is the model change rule for the When grouping construct.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class WhenModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof When &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ESBService service=getESBService(context, ref);
+ When when=(When)mobj;
+
+ int pos=getPosition(service, ref);
+
+ // Create join service
+ ESBService joinService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(joinService);
+
+ // Check if context role is decision maker
+ if (when.getRoles().contains(context.getRole())) {
+
+ insertWhen(context, model, service,
+ when, joinService, pos);
+ } else {
+ insertSwitch(context, model, service,
+ when, joinService, pos);
+ }
+
+ context.setParent(joinService);
+
+ // If reference provided, then move subsequent activities
+ // to the 'join service'
+ if (pos != -1) {
+ for (int i=pos+1; i < service.getActions().size();) {
+ ESBAction act=service.getActions().get(i);
+ service.getActions().remove(i);
+
+ joinService.addAction(act, -1);
+ }
+ }
+
+ return(true);
+ }
+
+ protected void insertWhen(ModelChangeContext context,
+ Model model, ESBService service,
+ When when, ESBService joinService, int pos) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+
+ WhenAction action=new WhenAction(service);
+
+ service.addAction(action, pos);
+
+ for (int i=0; i < when.getConditionalBlocks().size(); i++) {
+ ConditionalBlock b=when.getConditionalBlocks().get(i);
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < b.getContents().size(); j++) {
+ context.insert(model, b.getContents().get(j), null);
+ }
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ when.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)when.getEnclosingDefinition())));
+ }
+
+ action.addPath(subService.getCategory(),
+ subService.getName(), i);
+ }
+
+ if (service.getFirstSessionBasedAction() == action &&
+ when.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)when.getEnclosingDefinition())));
+ }
+ }
+
+ protected void insertSwitch(ModelChangeContext context,
+ Model model, ESBService service,
+ When when, ESBService joinService, int pos) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+
+ // Check if 'when' needs to be placed in new service
+ // descriptor - i.e. if insert at end, but current service
+ // already has service based actions, or reference object
+ // provided, but is not first position
+ if (shouldScheduleNewService(service, (pos == -1 ?
+ service.getActions().size() : pos))) {
+
+ // Already has activities, so need to separate
+ // into another service descriptor
+ ESBService switchService=esbModel.createService(
+ service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(switchService);
+
+ // Add schedule action
+ ScheduleStateAction schedule=
+ new ScheduleStateAction(service);
+
+ schedule.setDestination(switchService.getCategory(),
+ switchService.getName(), false);
+
+ service.addAction(schedule, pos);
+
+ context.setParent(switchService);
+
+ service = switchService;
+ pos = -1;
+ }
+
+ // Switch action, as role is a decision observer
+ SwitchAction switchAction=new SwitchAction(service);
+
+ // Get lookahead analyser
+ LookaheadAnalyser la=(LookaheadAnalyser)
+ RegistryFactory.getRegistry().getExtension(
+ LookaheadAnalyser.class, null);
+
+ if (la == null) {
+ logger.severe("Failed to find lookahead analyser");
+ }
+
+ service.addAction(switchAction, pos);
+
+ java.util.List<MessageSignature> messageTypes=
+ new java.util.Vector<MessageSignature>();
+
+ for (int i=0; i < when.getConditionalBlocks().size(); i++) {
+ ConditionalBlock cb=when.getConditionalBlocks().get(i);
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ context.setParent(subService);
+
+ for (int j=0; j < cb.getContents().size(); j++) {
+ context.insert(model, cb.getContents().get(j), null);
+ }
+
+ java.util.Set<Interaction> interactions=null;
+
+ if (la != null) {
+ interactions = la.getInteractions(cb);
+ }
+
+ switchAction.addCase(subService.getCategory(),
+ subService.getName(), interactions, i);
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ schedule.setDestination(joinService.getCategory(),
+ joinService.getName(), true);
+
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ when.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)when.getEnclosingDefinition())));
+ }
+
+ if (interactions != null) {
+ java.util.Iterator<Interaction> iter=interactions.iterator();
+
+ while (iter.hasNext()) {
+ Interaction interaction=iter.next();
+
+ //TODO: Only deals with single type for now
+ // If a receive and not a response, then
+ // add to the gateway
+ if (InteractionUtil.isSend(interaction) == false &&
+ interaction.getReplyToLabel() == null &&
+ interaction.getMessageSignature().getTypes().size()==1) {
+
+ messageTypes.add(interaction.getMessageSignature());
+ }
+ }
+ }
+ }
+
+ // Only record message router 'routes' if the switch
+ // receives request interactions, and it is the first
+ // session based action in the service
+ if (messageTypes.size() > 0 &&
+ service.getFirstSessionBasedAction() == switchAction) {
+ ESBService gwService=
+ esbModel.getGatewayService();
+
+ if (gwService != null) {
+ ESBAction gwAction=gwService.getGatewayAction();
+
+ if (gwAction instanceof MessageRouterAction) {
+ MessageRouterAction mra=(MessageRouterAction)
+ gwAction;
+
+ mra.addRoute(service.getCategory(),
+ service.getName(),
+ false, messageTypes);
+ }
+ }
+ }
+
+ if (service.getFirstSessionBasedAction() == switchAction &&
+ when.getEnclosingDefinition() instanceof Conversation) {
+ switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)when.getEnclosingDefinition())));
+ }
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -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.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import java.util.logging.Logger;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.*;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.model.analysis.*;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.*;
-
-/**
- * This is the model change rule for the While repetition construct.
- */
-(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class WhileModelChangeRule extends AbstractModelChangeRule {
-
- /**
- * This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
- * model object.
- *
- * @param context The context
- * @param model The model
- * @param mobj The model object causing the change
- * @return Whether the rule supports the supplied information
- */
- @Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
- boolean ret=false;
-
- if (mobj instanceof While &&
- context.getParent() instanceof ESBService &&
- model instanceof ESBLanguageModel) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method adds a new model object, within a
- * parent model object, with the details supplied in
- * another model object. The supplied model object
- * will usually be from a different model representation
- * (e.g. due to a merge), so the details will be
- * copied and placed in the representation associated
- * with the supplied model and parent model object.
- *
- * @param context The context
- * @param model The model being changed
- * @param mobj The model object details to be inserted
- * @param position The position, where relevant
- * @return Whether the change has been applied
- */
- @Override
- public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
- ESBLanguageModel esbModel=(ESBLanguageModel)model;
- ESBService service=(ESBService)context.getParent();
- While whileElem=(While)mobj;
-
- // Check if current service is session based
- // If so, then need to put while in a separate new
- // service
- if (service.isSessionBased()) {
- ESBService whileService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(whileService);
-
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- // 'immediate' flag set depending on whether the role
- // is an initiator of the while. If not, then the
- // immediate flag is false, which means the loop will be
- // evaluated based on the next received message
- schedule.setDestination(whileService.getCategory(),
- whileService.getName(),
- whileElem.getRoles().contains(context.getRole()));
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- context.setParent(whileService);
-
- service = whileService;
- }
-
- WhileAction action=new WhileAction(service);
-
- service.addAction(action, position);
-
- // Check if business object type needs to be specified
- if (service.getFirstSessionBasedAction() == action &&
- whileElem.getEnclosingDefinition() instanceof Conversation) {
- action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)whileElem.getEnclosingDefinition())));
- }
-
- ESBService subService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(subService);
-
- // Configure the while loop service
- context.setParent(subService);
-
- for (int j=0; j < whileElem.getBlock().getContents().size(); j++) {
- context.insert(model, whileElem.getBlock().getContents().get(j), j);
- }
-
- // Need to insert a 'ScheduleStateAction' to return back
- // to the 'WhileAction', to re-evaluate the expression
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- // 'immediate' flag set depending on whether the role
- // is an initiator of the while. If not, then the
- // immediate flag is false, which means the loop will be
- // evaluated based on the next received message
- schedule.setDestination(service.getCategory(),
- service.getName(),
- whileElem.getRoles().contains(context.getRole()));
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- // Check if business object type needs to be specified
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- whileElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)whileElem.getEnclosingDefinition())));
- }
-
- // Check whether message types need to be defined in
- // place of an expression
- java.util.List<MessageSignature> messageTypes=
- new java.util.Vector<MessageSignature>();
-
- // Check if context role is NOT the decision maker
- if (whileElem.getRoles().contains(context.getRole()) == false) {
-
- // Get lookahead analyser
- LookaheadAnalyser la=(LookaheadAnalyser)
- RegistryFactory.getRegistry().getExtension(
- LookaheadAnalyser.class, null);
-
- if (la == null) {
- logger.severe("Failed to find lookahead analyser");
- }
-
- java.util.Set<Interaction> interactions=null;
-
- if (la != null) {
- interactions = la.getInteractions(whileElem.getBlock());
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
-
- }
-
- action.addPath(subService.getCategory(),
- subService.getName(), false, messageTypes, -1);
-
- // Create exit service
- ESBService exitService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(exitService);
-
- context.setParent(exitService);
-
- action.addPath(exitService.getCategory(),
- exitService.getName(), true,
- new java.util.Vector<MessageSignature>(), -1);
-
- return(true);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.change");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,246 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.model.analysis.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.*;
+
+/**
+ * This is the model change rule for the While repetition construct.
+ */
+(a)RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class WhileModelChangeRule extends AbstractESBModelChangeRule {
+
+ /**
+ * This method determines whether the rule is appropriate
+ * for the supplied type of model, parent (in the context) and inserted
+ * model object.
+ *
+ * @param context The context
+ * @param model The model
+ * @param mobj The model object being inserted
+ * @param ref The optional reference model object
+ * @return Whether the rule supports the supplied information
+ */
+ @Override
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ boolean ret=false;
+
+ if (mobj instanceof While &&
+ super.isInsertSupported(context, model, mobj, ref)) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method adds a new model object, within a
+ * parent model object, with the details supplied in
+ * another model object. The supplied model object
+ * will usually be from a different model representation
+ * (e.g. due to a merge), so the details will be
+ * copied and placed in the representation associated
+ * with the supplied model and parent model object.<p>
+ * <p>
+ * If a reference model object is supplied, then the
+ * insertion will occur relative to it. If the reference
+ * object is a block, then it means that the insertion
+ * should occur at the end of the block. Otherwise the
+ * new model object should be inserted before the
+ * reference object, within the containing block.<p>
+ * <p>
+ * If the reference object is not supplied, then the
+ * new model object should be inserted at the end of
+ * the behaviour associated with the parent in the model
+ * change context.
+ *
+ * @param context The context
+ * @param model The model being changed
+ * @param mobj The model object details to be inserted
+ * @param ref The optional reference model object
+ * @return Whether the change has been applied
+ */
+ @Override
+ public boolean insert(ModelChangeContext context,
+ Model model, ModelObject mobj, ModelObject ref) {
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ESBService service=getESBService(context, ref);
+ ESBService original=service;
+ While whileElem=(While)mobj;
+
+ int pos=getPosition(service, ref);
+
+ // Check if action needs to be placed in new service
+ // descriptor - i.e. if insert at end, but current service
+ // already has service based actions, or reference object
+ // provided, but is not first position
+ if (shouldScheduleNewService(service, (pos == -1 ?
+ service.getActions().size() : pos))) {
+
+ ESBService whileService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(whileService);
+
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ // 'immediate' flag set depending on whether the role
+ // is an initiator of the while. If not, then the
+ // immediate flag is false, which means the loop will be
+ // evaluated based on the next received message
+ schedule.setDestination(whileService.getCategory(),
+ whileService.getName(),
+ whileElem.getRoles().contains(context.getRole()));
+ service.addAction(schedule, pos);
+
+ context.setParent(whileService);
+
+ service = whileService;
+ }
+
+ WhileAction action=new WhileAction(service);
+
+ service.addAction(action, -1);
+
+ // Check if business object type needs to be specified
+ if (service.getFirstSessionBasedAction() == action &&
+ whileElem.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)whileElem.getEnclosingDefinition())));
+ }
+
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(subService);
+
+ // Configure the while loop service
+ context.setParent(subService);
+
+ for (int j=0; j < whileElem.getBlock().getContents().size(); j++) {
+ context.insert(model, whileElem.getBlock().getContents().get(j), null);
+ }
+
+ // Need to insert a 'ScheduleStateAction' to return back
+ // to the 'WhileAction', to re-evaluate the expression
+ ScheduleStateAction schedule=
+ new ScheduleStateAction((ESBService)context.getParent());
+
+ // 'immediate' flag set depending on whether the role
+ // is an initiator of the while. If not, then the
+ // immediate flag is false, which means the loop will be
+ // evaluated based on the next received message
+ schedule.setDestination(service.getCategory(),
+ service.getName(),
+ whileElem.getRoles().contains(context.getRole()));
+ ((ESBService)context.getParent()).addAction(schedule, -1);
+
+ // Check if business object type needs to be specified
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
+ whileElem.getEnclosingDefinition() instanceof Conversation) {
+ schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)whileElem.getEnclosingDefinition())));
+ }
+
+ // Check whether message types need to be defined in
+ // place of an expression
+ java.util.List<MessageSignature> messageTypes=
+ new java.util.Vector<MessageSignature>();
+
+ // Check if context role is NOT the decision maker
+ if (whileElem.getRoles().contains(context.getRole()) == false) {
+
+ // Get lookahead analyser
+ LookaheadAnalyser la=(LookaheadAnalyser)
+ RegistryFactory.getRegistry().getExtension(
+ LookaheadAnalyser.class, null);
+
+ if (la == null) {
+ logger.severe("Failed to find lookahead analyser");
+ }
+
+ java.util.Set<Interaction> interactions=null;
+
+ if (la != null) {
+ interactions = la.getInteractions(whileElem.getBlock());
+ }
+
+ if (interactions != null) {
+ java.util.Iterator<Interaction> iter=interactions.iterator();
+
+ while (iter.hasNext()) {
+ Interaction interaction=iter.next();
+
+ if (InteractionUtil.isSend(interaction) == false &&
+ interaction.getMessageSignature().getTypes().size()==1) {
+
+ messageTypes.add(interaction.getMessageSignature());
+ }
+ }
+ }
+
+ }
+
+ action.addPath(subService.getCategory(),
+ subService.getName(), false, messageTypes, -1);
+
+ // Create exit service
+ ESBService exitService=
+ esbModel.createService(service.getCategory(),
+ esbModel.getUniqueServiceName(service.getCategory(),
+ service.getName()));
+
+ esbModel.addService(exitService);
+
+ context.setParent(exitService);
+
+ action.addPath(exitService.getCategory(),
+ exitService.getName(), true,
+ new java.util.Vector<MessageSignature>(), -1);
+
+ // If reference provided, then move subsequent activities
+ // to the 'exit service'
+ if (pos != -1) {
+ for (int i=pos+1; i < original.getActions().size();) {
+ ESBAction act=original.getActions().get(i);
+ original.getActions().remove(i);
+
+ exitService.addAction(act, -1);
+ }
+ }
+
+ return(true);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change");
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ClasspathUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
import org.scribble.model.*;
import org.scribble.osgi.model.OSGIModelRepository;
@@ -26,7 +26,7 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
public class ClasspathUtil {
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ConversationUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ConversationUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ConversationUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
import org.scribble.conversation.model.*;
import org.scribble.model.Model;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ESBModelUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ESBModelUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ESBModelUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -17,7 +17,7 @@
* Change History:
* 21 Aug 2008 : Initial version created by gary
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
public class ESBModelUtil {
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/IdentityUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/IdentityUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/IdentityUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
import org.scribble.model.*;
import org.scribble.conversation.model.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/InteractionUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/InteractionUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/InteractionUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
import org.scribble.model.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ProblemDefinitions.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/ProblemDefinitions.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ProblemDefinitions.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
public class ProblemDefinitions {
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/PropertyUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,135 +0,0 @@
-/*
- * 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:
- * 27 Aug 2008 : Initial version created by gary
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class PropertyUtil {
-
- /**
- * This method determines whether the supplied class has
- * a writable property associated with the specified name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return Whether the class has a writable property
- */
- public static boolean isProperty(Class<?> type, String prop) {
- boolean ret=false;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied class has
- * a writable property associated with the specified name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return Whether the class has a writable property
- */
- public static boolean hasWritableProperty(Class<?> type, String prop) {
- boolean ret=false;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null && pd.getWriteMethod() != null) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied class has
- * a readable property associated with the specified name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return Whether the class has a readable property
- */
- public static boolean hasReadableProperty(Class<?> type, String prop) {
- boolean ret=false;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null && pd.getReadMethod() != null) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the type of the property associated
- * with the supplied class and property name.
- *
- * @param type The class to be checked
- * @param prop The property
- * @return The type of the property, or null if not found
- */
- public static Class<?> getPropertyType(Class<?> type, String prop) {
- Class<?> ret=null;
-
- java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
- if (pd != null) {
- ret = pd.getPropertyType();
- }
-
- return(ret);
- }
-
- /**
- * This method returns the property descriptor with the
- * supplied name on the supplied class.
- *
- * @param type The class
- * @param prop The property name
- * @return The property descriptor, or null if not found
- */
- protected static java.beans.PropertyDescriptor getPropertyDescriptor(Class<?> type, String prop) {
- java.beans.PropertyDescriptor ret=null;
-
- try {
- java.beans.BeanInfo bi=java.beans.Introspector.getBeanInfo(type);
-
- java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
-
- for (int i=0; ret == null && pds != null &&
- i < pds.length; i++) {
- if (pds[i].getName().equals(prop)) {
- ret = pds[i];
- }
- }
-
- } catch(Exception e) {
- logger.log(Level.SEVERE, "Failed to find property '"+prop+
- "' on class '"+type+"'", e);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.model.util");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java (from rev 329, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/util/PropertyUtil.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/PropertyUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ * 27 Aug 2008 : Initial version created by gary
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class PropertyUtil {
+
+ /**
+ * This method determines whether the supplied class has
+ * a writable property associated with the specified name.
+ *
+ * @param type The class to be checked
+ * @param prop The property
+ * @return Whether the class has a writable property
+ */
+ public static boolean isProperty(Class<?> type, String prop) {
+ boolean ret=false;
+
+ java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
+ if (pd != null) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the supplied class has
+ * a writable property associated with the specified name.
+ *
+ * @param type The class to be checked
+ * @param prop The property
+ * @return Whether the class has a writable property
+ */
+ public static boolean hasWritableProperty(Class<?> type, String prop) {
+ boolean ret=false;
+
+ java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
+ if (pd != null && pd.getWriteMethod() != null) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the supplied class has
+ * a readable property associated with the specified name.
+ *
+ * @param type The class to be checked
+ * @param prop The property
+ * @return Whether the class has a readable property
+ */
+ public static boolean hasReadableProperty(Class<?> type, String prop) {
+ boolean ret=false;
+
+ java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
+ if (pd != null && pd.getReadMethod() != null) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the type of the property associated
+ * with the supplied class and property name.
+ *
+ * @param type The class to be checked
+ * @param prop The property
+ * @return The type of the property, or null if not found
+ */
+ public static Class<?> getPropertyType(Class<?> type, String prop) {
+ Class<?> ret=null;
+
+ java.beans.PropertyDescriptor pd=getPropertyDescriptor(type, prop);
+ if (pd != null) {
+ ret = pd.getPropertyType();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the property descriptor with the
+ * supplied name on the supplied class.
+ *
+ * @param type The class
+ * @param prop The property name
+ * @return The property descriptor, or null if not found
+ */
+ protected static java.beans.PropertyDescriptor getPropertyDescriptor(Class<?> type, String prop) {
+ java.beans.PropertyDescriptor ret=null;
+
+ try {
+ java.beans.BeanInfo bi=java.beans.Introspector.getBeanInfo(type);
+
+ java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
+
+ for (int i=0; ret == null && pds != null &&
+ i < pds.length; i++) {
+ if (pds[i].getName().equals(prop)) {
+ ret = pds[i];
+ }
+ }
+
+ } catch(Throwable e) {
+ logger.log(Level.SEVERE, "Failed to find property '"+prop+
+ "' on class '"+type+"'", e);
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util");
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBNotation.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBNotation.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBNotation.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,11 +15,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.parser;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.parser;
import org.scribble.extensions.*;
import org.scribble.model.ModelReference;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
/**
*
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBParser.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.parser;
-
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.scribble.extensions.*;
-import org.scribble.parser.Parser;
-
-/**
- * This JBossESB implementation of the Parser interface.
- *
- * @author gary
- */
-(a)RegistryInfo(extension=Parser.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
-public class JBossESBParser implements Parser {
-
- /**
- * This method parses the source located using the supplied
- * scribble reference, to return a model. If any
- * errors are detected, they will be reported to the parser
- * listener.
- *
- * @param ref The scribble source reference
- * @param is The input stream
- * @param l The model listener
- * @return The model, or null if not found
- */
- public Model parse(ModelReference ref, InputStream is,
- ModelListener l) {
- DefaultESBLanguageModel ret=null;
-
- org.scribble.model.DependencyManager dm=
- (org.scribble.model.DependencyManager)
- org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
- org.scribble.model.DependencyManager.class, null);
-
- if (dm != null) {
-
- // Clear the dependencies so that they can be
- // re-initialized during the parsing of the model
- dm.clearDependencies(ref);
- }
-
- try {
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- DocumentBuilder builder=fact.newDocumentBuilder();
-
- byte[] b=new byte[is.available()];
- is.read(b);
-
- // 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(b);
-
- org.w3c.dom.Document doc=builder.parse(bais);
-
- // Identify the model associated with the
- // changed resource
- ret = new DefaultESBLanguageModel(ref, doc.getDocumentElement(),
- new String(b));
-
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to load model", e);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.jbossesb.parser");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java (from rev 376, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/parser/JBossESBParser.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.parser;
+
+import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.scribble.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.scribble.extensions.*;
+import org.scribble.parser.Parser;
+
+/**
+ * This JBossESB implementation of the Parser interface.
+ *
+ * @author gary
+ */
+(a)RegistryInfo(extension=Parser.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
+public class JBossESBParser implements Parser {
+
+ /**
+ * This method parses the source located using the supplied
+ * scribble reference, to return a model. If any
+ * errors are detected, they will be reported to the parser
+ * listener.
+ *
+ * @param ref The scribble source reference
+ * @param is The input stream
+ * @param l The model listener
+ * @return The model, or null if not found
+ */
+ public Model parse(ModelReference ref, InputStream is,
+ ModelListener l) {
+ DefaultESBLanguageModel ret=null;
+
+ org.scribble.model.DependencyManager dm=
+ (org.scribble.model.DependencyManager)
+ org.scribble.extensions.RegistryFactory.getRegistry().getExtension(
+ org.scribble.model.DependencyManager.class, null);
+
+ try {
+ // Transform the text representation to DOM
+ DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+
+ DocumentBuilder builder=fact.newDocumentBuilder();
+
+ byte[] b=new byte[is.available()];
+ is.read(b);
+
+ // 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(b);
+
+ org.w3c.dom.Document doc=builder.parse(bais);
+
+ // Identify the model associated with the
+ // changed resource
+ ret = new DefaultESBLanguageModel(ref, doc.getDocumentElement(),
+ new String(b));
+
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "Failed to load model", e);
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.parser");
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/validation (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/validation)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/validation/ESBLanguageModelValidationRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/validation/ESBLanguageModelValidationRule.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/validation/ESBLanguageModelValidationRule.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.validation;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.validation;
import org.scribble.validation.*;
import org.scribble.extensions.*;
import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
/**
* This class implements the validation rule for the
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContextTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContextTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContextTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultESBService;
-
-import junit.framework.TestCase;
-
-public class DefaultConversionContextTest extends TestCase {
-
- public void testIsJoin() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- DefaultConversionContext context=new DefaultConversionContext(null);
- context.markJoin(service);
-
- if (context.isJoin(service) == false) {
- fail("Service should be join");
- }
- }
-
- public void testIsJoinFalse() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- DefaultConversionContext context=new DefaultConversionContext(null);
-
- if (context.isJoin(service)) {
- fail("Service should not be join");
- }
- }
-
- public void testJoinProcessing() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- DefaultConversionContext context=new DefaultConversionContext(null);
- context.markJoin(service);
-
- if (context.isJoin(service) == false) {
- fail("Service should be join");
- }
-
- context.processing(service);
-
- if (context.isJoin(service)) {
- fail("Service should no longer be marked as join");
- }
- }
-
- public void testIsOnStack() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- DefaultConversionContext context=new DefaultConversionContext(null);
- context.push(service);
-
- if (context.isOnStack(service) == false) {
- fail("Service should be on stack");
- }
- }
-
- public void testIsOnStackFalse() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- DefaultConversionContext context=new DefaultConversionContext(null);
-
- if (context.isOnStack(service)) {
- fail("Service should not be on stack");
- }
- }
-
- public void testStackPushPop() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- DefaultConversionContext context=new DefaultConversionContext(null);
- context.push(service);
-
- if (context.isOnStack(service) == false) {
- fail("Service should be on stack");
- }
-
- context.pop(service);
-
- if (context.isOnStack(service)) {
- fail("Service should no longer be on stack after pop");
- }
- }
-
- public void testGetRole() {
- String role="myRole";
-
- DefaultConversionContext context=new DefaultConversionContext(role);
-
- if (context.getRole() == null) {
- fail("Role is null");
- }
-
- if (context.getRole().equals(role) == false) {
- fail("Role should be '"+role+"', but got: "+context.getRole());
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModelTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModelTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModelTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,270 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-import org.scribble.model.*;
-
-public class DefaultESBLanguageModelTest extends TestCase {
-
- public void testBaseConfiguration() {
-
- ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
-
- DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
-
- org.w3c.dom.Element config=model.getESBConfiguration();
-
- if (config.getNodeName().equals(DefaultESBLanguageModel.TOP_LEVEL_ELEMENT) == false) {
- fail("Top level element should be '"+
- DefaultESBLanguageModel.TOP_LEVEL_ELEMENT+"' but found: "+
- config.getNodeName());
- }
-
- boolean f_providers=false;
- boolean f_services=false;
-
- org.w3c.dom.NodeList nl=config.getChildNodes();
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Element elem=
- (org.w3c.dom.Element)nl.item(i);
-
- if (elem.getNodeName().equals(DefaultESBLanguageModel.PROVIDERS_ELEMENT)) {
-
- if (f_providers) {
- fail("Duplicate '"+DefaultESBLanguageModel.PROVIDERS_ELEMENT+"' elements");
- } else {
-
- // Check if jms provider defined
- org.w3c.dom.NodeList nl2=
- elem.getChildNodes();
- boolean f_jmsProvider=false;
-
- for (int j=0; j < nl2.getLength(); j++) {
- if (nl2.item(j) instanceof org.w3c.dom.Element) {
-
- if (nl2.item(j).getNodeName().equals(
- DefaultESBLanguageModel.JMS_PROVIDER_ELEMENT)) {
-
- if (f_jmsProvider) {
- fail("JMS Provider already defined");
- }
-
- f_jmsProvider = true;
- } else {
- fail("Unknown provider element: "+
- nl2.item(j).getNodeName());
- }
- }
- }
-
- if (f_jmsProvider == false) {
- fail("JMS provider not defined");
- }
- }
-
- f_providers = true;
- } else if (elem.getNodeName().equals(DefaultESBLanguageModel.SERVICES_ELEMENT)) {
-
- if (f_services) {
- fail("Duplicate '"+DefaultESBLanguageModel.SERVICES_ELEMENT+"' elements");
- }
-
- f_services = true;
- } else {
- fail("Unknown element: "+nl.item(i).getNodeName());
- }
- }
- }
-
- if (f_providers == false) {
- fail("Element '"+DefaultESBLanguageModel.PROVIDERS_ELEMENT+"' not found");
- }
-
- if (f_services == false) {
- fail("Element '"+DefaultESBLanguageModel.SERVICES_ELEMENT+"' not found");
- }
- }
-
- public void testAddService() {
- String busId="TestBusId";
- String category="category.one";
- String name="serviceName";
-
- ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
-
- DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
-
- org.w3c.dom.Element config=model.getESBConfiguration();
-
- TestESBService service=new TestESBService();
- service.setJMSBusIdRef(busId);
- service.setCategory(category);
- service.setName(name);
-
- model.addService(service);
-
- if (service.getJMSBusIdRef() == null) {
- fail("JMS BusIdRef not set");
- }
-
- if (service.getJMSBusIdRef().equals(busId) == false) {
- fail("Bus Id should be '"+busId+"', but got: "+service.getJMSBusIdRef());
- }
-
- // Check that the jms bus id has been created
- org.w3c.dom.NodeList nl=config.getElementsByTagName(
- DefaultESBLanguageModel.JMS_PROVIDER_ELEMENT);
-
- if (nl.getLength() != 1) {
- fail("JMS provider element not found");
- }
-
- org.w3c.dom.Element provider=(org.w3c.dom.Element)nl.item(0);
-
- nl = provider.getElementsByTagName(
- DefaultESBLanguageModel.JMS_BUS_ELEMENT);
-
- if (nl.getLength() != 1) {
- fail("JMS bus element not found");
- }
-
- org.w3c.dom.Element bus=(org.w3c.dom.Element)nl.item(0);
-
- if (bus.getAttribute("busid").equals(busId) == false) {
- fail("Bus had invalid busid '"+bus.getAttribute("busid")+
- "', was expecting: "+busId);
- }
-
- if (bus.getParentNode() != provider) {
- fail("Bus not contained directly within provider");
- }
-
- // Check bus retrieved directly
- org.w3c.dom.Element bus2=model.findJMSBus(busId);
-
- if (bus2 != bus) {
- fail("Bus elements not the same");
- }
- }
-
- public void testRemoveService() {
- String busId="TestBusId";
- String category="category.two";
- String name="serviceName";
-
- ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
-
- DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
-
- org.w3c.dom.Element config=model.getESBConfiguration();
-
- TestESBService service=new TestESBService();
- service.setJMSBusIdRef(busId);
- service.setCategory(category);
- service.setName(name);
-
- model.addService(service);
-
- // Check that the jms bus id has been created
- org.w3c.dom.NodeList nl=config.getElementsByTagName(
- DefaultESBLanguageModel.JMS_PROVIDER_ELEMENT);
-
- if (nl.getLength() != 1) {
- fail("JMS provider element not found");
- }
-
- org.w3c.dom.Element provider=(org.w3c.dom.Element)nl.item(0);
-
- nl = provider.getElementsByTagName(
- DefaultESBLanguageModel.JMS_BUS_ELEMENT);
-
- if (nl.getLength() != 1) {
- fail("JMS bus element not found");
- }
-
- // Remove the service and check that the bus entry
- // is no longer there
- model.removeService(service);
-
- nl = provider.getElementsByTagName(
- DefaultESBLanguageModel.JMS_BUS_ELEMENT);
-
- if (nl.getLength() != 0) {
- fail("JMS bus element should NOT be found");
- }
- }
-
- public void testAddServiceWithNoBusId() {
- String category="category.one";
- String name="serviceName";
-
- ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
-
- DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
-
- TestESBService service=new TestESBService();
- service.setCategory(category);
- service.setName(name);
-
- model.addService(service);
-
- if (service.getJMSBusIdRef() == null) {
- fail("JMS BusIdRef not set");
- }
- }
-
- public void testAddMultipleServiceWithNoBusId() {
- String category="category.one";
- String name1="serviceName1";
- String name2="serviceName2";
-
- ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
-
- DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
-
- TestESBService service1=new TestESBService();
- service1.setCategory(category);
- service1.setName(name1);
-
- model.addService(service1);
-
- if (service1.getJMSBusIdRef() == null) {
- fail("JMS BusIdRef1 not set");
- }
-
- TestESBService service2=new TestESBService();
- service2.setCategory(category);
- service2.setName(name2);
-
- model.addService(service2);
-
- if (service2.getJMSBusIdRef() == null) {
- fail("JMS BusIdRef2 not set");
- }
-
- if (service1.getJMSBusIdRef().equals(service2.getJMSBusIdRef())) {
- fail("Service JMS bus ids should be unique");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBServiceTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBServiceTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBServiceTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,365 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-
-public class DefaultESBServiceTest extends TestCase {
-
- public void testValidateSessionClassRequired() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
-
- service.getActions().add(act1);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_SPECIFIED_SESSION_CLASS",
- new String[]{}));
-
- service.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateSessionClassNotRequired() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestModelListener l=new TestModelListener();
-
- service.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testIsLoop() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
- act1.setLoop(true);
-
- service.getActions().add(act1);
-
- if (service.isLoop() == false) {
- fail("Service should be loop");
- }
- }
-
- public void testIsLoopFalse() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
-
- service.getActions().add(act1);
-
- if (service.isLoop()) {
- fail("Service is not a loop");
- }
- }
-
- public void testIsRoot() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
- act1.setCreateSession(true);
- act1.setPropertyValue(DefaultESBService.ROOT_PROPERTY, "true");
-
- service.getActions().add(act1);
-
- if (service.isRoot() == false) {
- fail("Service should be root");
- }
- }
-
- public void testIsRootFalse() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
-
- service.getActions().add(act1);
-
- if (service.isRoot()) {
- fail("Service should NOT be root");
- }
- }
-
- public void testIsSessionBased() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
-
- service.getActions().add(act1);
-
- if (service.isSessionBased() == false) {
- fail("Service should be SessionBased");
- }
- }
-
- public void testIsSessionBasedFalse() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
-
- service.getActions().add(act1);
-
- if (service.isSessionBased()) {
- fail("Service should NOT be SessionBased");
- }
- }
-
- public void testIsCreateSession() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
- act1.setCreateSession(true);
-
- service.getActions().add(act1);
-
- if (service.isCreateSession() == false) {
- fail("Service should be 'create session'");
- }
- }
-
- public void testIsCreateSessionFalse() {
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
-
- service.getActions().add(act1);
-
- if (service.isCreateSession()) {
- fail("Service should NOT be 'create session'");
- }
- }
-
- public void testGetServiceName() {
- String name="serviceName1";
-
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
- act1.setCreateSession(true);
- act1.setPropertyValue(DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY,
- name);
-
- service.getActions().add(act1);
-
- if (service.getServiceDescriptionName().equals(name) == false) {
- fail("Service name '"+service.getServiceDescriptionName()+
- "' invalid, expecting: "+name);
- }
- }
-
- public void testGetConversationType() {
- String name="convType1";
-
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
- act1.setCreateSession(true);
- act1.setPropertyValue(DefaultESBService.CONVERSATION_TYPE_PROPERTY,
- name);
-
- service.getActions().add(act1);
-
- if (service.getConversationType().equals(name) == false) {
- fail("Conversation type '"+service.getConversationType()+
- "' invalid, expecting: "+name);
- }
- }
-
- public void testGetSessionName() {
- String name="session1";
-
- DefaultESBService service=new DefaultESBService(null, null);
-
- TestESBAction act1=new TestESBAction();
- act1.setSessionBased(true);
- act1.setPropertyValue(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY,
- name);
-
- service.getActions().add(act1);
-
- if (service.getSessionName().equals(name) == false) {
- fail("Session name '"+service.getSessionName()+
- "' invalid, expecting: "+name);
- }
- }
-
- public void testBaseConfiguration() {
- String category="category";
- String name="name";
-
- DefaultESBService service=new DefaultESBService(new TestESBLanguageModel(),
- category, name);
-
- org.w3c.dom.Element servElem=service.getService();
-
- if (servElem == null) {
- fail("Service element is null");
- }
-
- if (servElem.getNodeName().equals(DefaultESBService.SERVICE_ELEMENT) == false) {
- fail("Root element is incorrect: "+servElem.getNodeName());
- }
-
- if (servElem.getAttribute(DefaultESBService.CATEGORY_ATTR).equals(category) == false) {
- fail("Category invalid: "+servElem.getAttribute(DefaultESBService.CATEGORY_ATTR));
- }
-
- if (servElem.getAttribute(DefaultESBService.NAME_ATTR).equals(name) == false) {
- fail("Name invalid: "+servElem.getAttribute(DefaultESBService.NAME_ATTR));
- }
- }
-
- public void testSetInitialBusIdRef() {
- String category="category";
- String name="name";
- String busId="myBusId";
-
- DefaultESBService service=new DefaultESBService(new TestESBLanguageModel(),
- category, name);
-
- org.w3c.dom.Element servElem=service.getService();
-
- service.setJMSBusIdRef(busId);
-
- if (service.getJMSBusIdRef() == null) {
- fail("Bus id not set");
- }
-
- if (service.getJMSBusIdRef().equals(busId) == false) {
- fail("Bus Id not '"+busId+"', got: "+service.getJMSBusIdRef());
- }
-
- org.w3c.dom.NodeList nl=servElem.getElementsByTagName(DefaultESBService.JMS_LISTENER_ELEMENT);
-
- if (nl.getLength() != 1) {
- fail("Expecting one JMS listener element, but got: "+
- nl.getLength());
- }
-
- org.w3c.dom.Element jmslistener=(org.w3c.dom.Element)nl.item(0);
-
- if (jmslistener.getParentNode().getNodeName().equals(DefaultESBService.LISTENERS_ELEMENT) == false) {
- fail("JMS listener parent not expected");
- }
-
- if (jmslistener.getParentNode().getParentNode() != servElem) {
- fail("JMS listener grandparent should be service");
- }
-
- if (jmslistener.getAttribute(DefaultESBService.BUSIDREF_ATTR).equals(busId) == false) {
- fail("Bus Id not '"+busId+"', got: "+jmslistener.getAttribute(DefaultESBService.BUSIDREF_ATTR));
- }
-
- if (jmslistener.hasAttribute(DefaultESBService.NAME_ATTR) == false) {
- fail("Name attribute not set on jms listener");
- }
-
- if (jmslistener.hasAttribute(DefaultESBService.MAX_THREADS_ATTR) == false) {
- fail("Max Threads attribute not set on jms listener");
- }
- }
-
- public void testChangeBusIdRef() {
- String initialBusId="busId1";
- String initialName="name1";
- String initialMaxThreads="2";
- String changedBusId="busId2";
-
- org.w3c.dom.Element top=null;
-
- // Create an empty document
- org.w3c.dom.Document doc=null;
- try {
- doc = javax.xml.parsers.DocumentBuilderFactory.
- newInstance().newDocumentBuilder().newDocument();
-
- top = doc.createElement(DefaultESBLanguageModel.TOP_LEVEL_ELEMENT);
-
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- org.w3c.dom.Element services=doc.createElement(DefaultESBLanguageModel.SERVICES_ELEMENT);
- top.appendChild(services);
-
- org.w3c.dom.Element serviceElem=doc.createElement(DefaultESBLanguageModel.SERVICE_ELEMENT);
- services.appendChild(serviceElem);
-
- org.w3c.dom.Element listeners=doc.createElement(DefaultESBService.LISTENERS_ELEMENT);
- serviceElem.appendChild(listeners);
-
- org.w3c.dom.Element jmslistener=doc.createElement(DefaultESBService.JMS_LISTENER_ELEMENT);
- listeners.appendChild(jmslistener);
-
- jmslistener.setAttribute(DefaultESBService.BUSIDREF_ATTR, initialBusId);
- jmslistener.setAttribute(DefaultESBService.NAME_ATTR, initialName);
- jmslistener.setAttribute(DefaultESBService.MAX_THREADS_ATTR, initialMaxThreads);
-
- DefaultESBService service=new DefaultESBService(new TestESBLanguageModel(),
- serviceElem);
-
- if (service.getJMSBusIdRef() == null) {
- fail("JMS bus id not set");
- }
-
- if (service.getJMSBusIdRef().equals(initialBusId) == false) {
- fail("JMS bus id not '"+initialBusId+"', got: "+service.getJMSBusIdRef());
- }
-
- service.setJMSBusIdRef(changedBusId);
-
- if (service.getJMSBusIdRef().equals(changedBusId) == false) {
- fail("Changed JMS bus id not '"+changedBusId+"', got: "+service.getJMSBusIdRef());
- }
-
- if (jmslistener.getAttribute(DefaultESBService.BUSIDREF_ATTR).equals(changedBusId)==false) {
- fail("Changed bus id not reflected in element");
- }
-
- if (jmslistener.getAttribute(DefaultESBService.NAME_ATTR).equals(initialName)==false) {
- fail("Name attribute incorrect");
- }
-
- if (jmslistener.getAttribute(DefaultESBService.MAX_THREADS_ATTR).equals(initialMaxThreads)==false) {
- fail("MaxThreads attribute incorrect");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBAction.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.List;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.ConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBAction;
-import org.scribble.model.Activity;
-import org.scribble.model.ModelListener;
-import org.w3c.dom.Element;
-
-public class TestESBAction implements ESBAction {
-
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- public Element getAction() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getActionClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getPropertyValue(String property) {
- return(m_property.get(property));
- }
-
- public void setPropertyValue(String property, String value) {
- m_property.put(property, value);
- }
-
- public void initializeLinks() {
- // TODO Auto-generated method stub
-
- }
-
- public boolean isInitiator() {
- return(m_initiator);
- }
-
- public void setInitiator(boolean initiator) {
- m_initiator = initiator;
- }
-
- public boolean isLoop() {
- return(m_loop);
- }
-
- public void setLoop(boolean bool) {
- m_loop = bool;
- }
-
- public boolean isPerform() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isSessionBased() {
- return(m_sessionBased);
- }
-
- public void setSessionBased(boolean bool) {
- m_sessionBased = bool;
- }
-
- public boolean isCreateSession() {
- return(m_createSession);
- }
-
- public void setCreateSession(boolean bool) {
- m_createSession = bool;
- }
-
- public boolean isGateway() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean hasProperty(String property) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void validate(ModelListener l) {
- // TODO Auto-generated method stub
-
- }
-
- private boolean m_sessionBased=false;
- private boolean m_loop=false;
- private boolean m_initiator=false;
- private boolean m_createSession=false;
- private java.util.Map<String,String> m_property=new java.util.Hashtable<String, String>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBLanguageModel.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBLanguageModel.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBLanguageModel.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.Collection;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBService;
-import org.scribble.model.ModelListener;
-import org.scribble.model.ModelReference;
-import org.w3c.dom.Element;
-
-public class TestESBLanguageModel extends org.scribble.lang.model.LanguageModel
- implements org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel {
-
- public TestESBLanguageModel() {
- org.w3c.dom.Document doc=null;
-
- // Create an empty document
- try {
- doc = javax.xml.parsers.DocumentBuilderFactory.
- newInstance().newDocumentBuilder().newDocument();
-
- m_esbConfig = doc.createElement(DefaultESBLanguageModel.TOP_LEVEL_ELEMENT);
-
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
- public String getOriginalContents() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ModelReference getModelReference() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ESBService createService(String category, String name) {
- TestESBService ret=new TestESBService(category, name);
-
- org.w3c.dom.Element service=m_esbConfig.getOwnerDocument().
- createElement(DefaultESBService.SERVICE_ELEMENT);
- m_esbConfig.appendChild(service);
-
- ret.setService(service);
-
- return(ret);
- }
-
- public void addService(ESBService service) {
- m_services.put(service.getCategory()+":"+service.getName(), service);
- }
-
- public void removeService(ESBService service) {
- m_services.remove(service.getCategory()+":"+service.getName());
- }
-
- public ESBService getService(String category, String name) {
- return(m_services.get(category+":"+name));
- }
-
- public Collection<ESBService> getServices() {
- return(m_services.values());
- }
-
- public ESBService getGatewayService() {
- return(m_gatewayService);
- }
-
- public void setGatewayService(ESBService gw) {
- m_gatewayService = gw;
- }
-
- public void validate(ModelListener l) {
- // TODO Auto-generated method stub
-
- }
-
- public String getUniqueServiceName(String category, String name) {
- return("serviceName__"+m_count++);
- }
-
- public Element getESBConfiguration() {
- return(m_esbConfig);
- }
-
- @Override
- public String getNotation() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getJMSDefinition(String jmsBusId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- private java.util.Map<String,ESBService> m_services=new java.util.Hashtable<String,ESBService>();
- private ESBService m_gatewayService=null;
- private org.w3c.dom.Element m_esbConfig=null;
- private int m_count=0;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBService.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBService.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,222 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import java.util.List;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.ConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.ESBLanguageModel;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-import org.w3c.dom.Element;
-
-public class TestESBService extends ModelObject
- implements org.jboss.tools.overlord.cdl.jbossesb.model.ESBService {
-
- public TestESBService() {
- }
-
- public TestESBService(String category, String name) {
- m_category = category;
- m_name = name;
- }
-
- public void convert(List<Activity> activities, ConversionContext context) {
- activities.addAll(m_contents);
- }
-
- public Conversation convert(ConversionContext context) {
- return(null);
- }
-
- public List<Activity> getContents() {
- return(m_contents);
- }
-
- public List<ESBAction> getActions() {
- return(m_actions);
- }
-
- public void setCategory(String cat) {
- m_category = cat;
- }
-
- public String getCategory() {
- return(m_category);
- }
-
- public void setConversationType(String type) {
- m_conversationType = type;
- }
-
- public String getConversationType() {
- return(m_conversationType);
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- public String getName() {
- return(m_name);
- }
-
- public void setModel(ESBLanguageModel model) {
- m_model = model;
- }
-
- public ESBLanguageModel getModel() {
- return(m_model);
- }
-
- public Element getService() {
- return(m_service);
- }
-
- public void setService(Element service) {
- m_service = service;
- }
-
- public ClassLoader getServiceClassLoader() throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getServiceDescriptionName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getServicePosition() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public void setSessionClass(Class<?> cls) {
- m_sessionClass = cls;
- }
-
- public Class<?> getSessionClass() {
- return(m_sessionClass);
- }
-
- public String getSessionName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void initializeLinks() {
- // TODO Auto-generated method stub
-
- }
-
- public void setLoop(boolean bool) {
- m_loop = bool;
- }
-
- public boolean isLoop() {
- return(m_loop);
- }
-
- public void setRoot(boolean bool) {
- m_root = bool;
- }
-
- public boolean isRoot() {
- return(m_root);
- }
-
- public void setCreateSession(boolean bool) {
- m_createSession = bool;
- }
-
- public boolean isCreateSession() {
- return(m_createSession);
- }
-
- public void setSessionBased(boolean bool) {
- m_sessionBased = bool;
- }
-
- public boolean isSessionBased() {
- return(m_sessionBased);
- }
-
- public ESBAction getFirstSessionBasedAction() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isGateway() {
- return(m_gateway);
- }
-
- public void setGateway(boolean gw) {
- m_gateway = gw;
- }
-
- public ESBAction getGatewayAction() {
- return(m_gatewayAction);
- }
-
- public void setGatewayAction(ESBAction act) {
- m_gatewayAction = act;
- }
-
- public void validate(ModelListener l) {
- // TODO Auto-generated method stub
-
- }
-
- public String getJMSBusIdRef() {
- return(m_jmsBusIdRef);
- }
-
- public void setJMSBusIdRef(String busId) {
- m_jmsBusIdRef = busId;
- }
-
- public void addAction(ESBAction action, int pos) {
- if (pos == -1) {
- m_actions.add(action);
- } else {
- m_actions.add(pos, action);
- }
- }
-
- public boolean removeAction(ESBAction action) {
- return(m_actions.remove(action));
- }
-
- private String m_category=null;
- private String m_name=null;
- private ESBLanguageModel m_model=null;
- private Element m_service;
- private List<ESBAction> m_actions=new java.util.Vector<ESBAction>();
- private boolean m_root=false;
- private boolean m_gateway=false;
- private ESBAction m_gatewayAction=null;
- private boolean m_loop=false;
- private boolean m_sessionBased=false;
- private boolean m_createSession=false;
- private Class<?> m_sessionClass=null;
- private String m_conversationType=null;
- private List<Activity> m_contents=new java.util.Vector<Activity>();
- private String m_jmsBusIdRef=null;
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestModelListener.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestModelListener.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestModelListener.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model;
-
-import org.scribble.model.ModelIssue;
-import org.scribble.model.ModelObject;
-
-public class TestModelListener implements org.scribble.model.ModelListener {
-
- public void error(ModelIssue issue) {
- reported(issue.getMessage());
- }
-
- public void warning(ModelIssue issue) {
- reported(issue.getMessage());
- }
-
- protected void reported(String mesg) {
- if (mesg != null) {
-
- // Check if in the list of messages to be
- // detected
- if (m_errorsToDetect.contains(mesg)) {
- m_errorsToDetect.remove(mesg);
- } else {
- m_unexpectedErrors.add(mesg);
- }
- }
- }
-
- public void addExpectedError(String mesg) {
- m_errorsToDetect.add(mesg);
- }
-
- public boolean isValid() {
- // If there are no more errors to detect, and no
- // unexpected errors have been reported, then
- // the expression has been validated as expected
- return(m_errorsToDetect.size() == 0 &&
- m_unexpectedErrors.size() == 0);
- }
-
- public String invalidMessage() {
- String ret="\r\n";
-
- if (m_errorsToDetect.size() > 0) {
- ret += "Errors not detected:\r\n";
-
- for (int i=0; i < m_errorsToDetect.size(); i++) {
- ret += m_errorsToDetect.get(i)+"\r\n";
- }
- }
-
- if (m_unexpectedErrors.size() > 0) {
- ret += "Unexpected Errors:\r\n";
-
- for (int i=0; i < m_unexpectedErrors.size(); i++) {
- ret += m_unexpectedErrors.get(i)+"\r\n";
- }
- }
-
- return(ret);
- }
-
- private java.util.List<String> m_errorsToDetect=new java.util.Vector<String>();
- private java.util.List<String> m_unexpectedErrors=new java.util.Vector<String>();
- private java.util.List<String> m_messages=new java.util.Vector<String>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,189 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.CreateSessionAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.UnsupportedAction;
-
-import junit.framework.TestCase;
-
-public class CreateSessionActionTest extends TestCase {
-
- public void testValidateFirstAction() {
- TestESBService service=new TestESBService();
-
- UnsupportedAction unsupported=new UnsupportedAction(service, null);
-
- CreateSessionAction action=new CreateSessionAction(service, null);
-
- service.getActions().add(action);
- service.getActions().add(unsupported);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNotFirstAction() {
- TestESBService service=new TestESBService();
-
- UnsupportedAction unsupported=new UnsupportedAction(service, null);
-
- CreateSessionAction action=new CreateSessionAction(service, null);
-
- service.getActions().add(unsupported);
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"CreateSession"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateRootNoConversationType() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- CreateSessionAction action=new CreateSessionAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_CONVERSATION_TYPE",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateRootWithConversationType() {
- String convType="test.Type@MyRole";
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("conversationType", convType);
-
- service.setConversationType(convType);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- CreateSessionAction action=new CreateSessionAction(service, elem);
-
- service.getActions().add(action);
-
- service.setModel(model);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
-
- public void testValidateRootWithConversationTypeNoRole() {
- String convType="test.Type";
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("conversationType", convType);
-
- service.setConversationType(convType);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- CreateSessionAction action=new CreateSessionAction(service, elem);
-
- service.getActions().add(action);
-
- service.setModel(model);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_CONVERSATION_TYPE_ROLE",
- new String[]{convType}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- CreateSessionAction action=new CreateSessionAction(service, null);
-
- if (action.isCreateSession() == false) {
- fail("Action is not flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- CreateSessionAction action=new CreateSessionAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ESBActionTestUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ESBActionTestUtil.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ESBActionTestUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-public class ESBActionTestUtil {
-
- public static org.w3c.dom.Element getAction(String actionClass,
- java.util.Map<String,String> simpleProps,
- java.util.Map<String,String> customProps) {
-
- org.w3c.dom.Element ret=null;
-
- // Create an empty document
- try {
- org.w3c.dom.Document doc=javax.xml.parsers.DocumentBuilderFactory.
- newInstance().newDocumentBuilder().newDocument();
-
- if (doc != null) {
- ret = doc.createElement("action");
-
- if (actionClass != null) {
- ret.setAttribute("class", actionClass);
- }
-
- if (simpleProps != null) {
- java.util.Iterator<String> props=simpleProps.keySet().iterator();
-
- while (props.hasNext()) {
- String key=props.next();
- String value=simpleProps.get(key);
-
- org.w3c.dom.Element property=ret.getOwnerDocument().createElement("property");
- ret.appendChild(property);
-
- property.setAttribute("name", key);
- property.setAttribute("value", value);
- }
- }
-
- if (customProps != null) {
- java.util.Iterator<String> props=customProps.keySet().iterator();
-
- while (props.hasNext()) {
- String key=props.next();
- String value=customProps.get(key);
-
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- java.io.InputStream xmlstr=
- new java.io.ByteArrayInputStream(value.getBytes());
-
- DocumentBuilder builder=fact.newDocumentBuilder();
- org.w3c.dom.Document valuedoc=builder.parse(xmlstr);
- org.w3c.dom.Element valueroot=valuedoc.getDocumentElement();
-
- org.w3c.dom.NodeList nl=valueroot.getChildNodes();
-
- org.w3c.dom.Element property=ret.getOwnerDocument().createElement("property");
- ret.appendChild(property);
-
- property.setAttribute("name", key);
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- org.w3c.dom.Node valueelem=
- nl.item(i).cloneNode(true);
-
- doc.adoptNode(valueelem);
-
- property.appendChild(valueelem);
- }
- }
- }
-
- }
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- return(ret);
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,630 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.IfAction;
-import org.scribble.model.*;
-import org.scribble.conversation.model.*;
-
-public class IfActionTest extends TestCase {
-
- public void testValidatePathsSpecified() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- IfAction action=new IfAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"paths"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1","name1"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2","name2"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat3","name3"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoPathsContent() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat3");
- other2.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_IF_ORDER_WRONG",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOnlyOneIf() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /><if service-category=\"cat3\" " +
- "service-name=\"name3\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_IF_ORDER_WRONG",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOutOfOrderElse() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_IF_ORDER_WRONG",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingServiceDetails() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif " +
- "service-name=\"name2\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateImmediateIf() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" immediate=\"fred\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IfAction.IMMEDIATE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateImmediateElseIf() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" immediate=\"fred\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IfAction.IMMEDIATE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateImmediateElse() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" immediate=\"fred\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{IfAction.IMMEDIATE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvert() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof If) == false) {
- fail("Expecting an 'If' activity");
- }
-
- If ifAction=(If)act;
-
- if (ifAction.getConditionalBlocks().size() != 2) {
- fail("Expecting two conditional blocks: "+ifAction.getConditionalBlocks().size());
- }
-
- if (ifAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (ifAction.getConditionalBlocks().get(1).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(1).getContents().get(0) != act2) {
- fail("Second conditional block should have 1 activity = act2");
- }
-
- if (ifAction.getElseBlock() == null) {
- fail("Else block not defined");
- }
-
- if (ifAction.getElseBlock().getContents().size() != 1 ||
- ifAction.getElseBlock().getContents().get(0) != act3) {
- fail("Else block should have 1 activity = act3");
- }
- }
-
- public void testConvertNotExcludingEmptyPaths() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><if service-category=\"cat1\" " +
- "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
- "service-name=\"name2\" /><else service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- IfAction action=new IfAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof If) == false) {
- fail("Expecting an 'If' activity");
- }
-
- If ifAction=(If)act;
-
- if (ifAction.getConditionalBlocks().size() != 2) {
- fail("Expecting two conditional blocks: "+ifAction.getConditionalBlocks().size());
- }
-
- if (ifAction.getConditionalBlocks().get(0).getContents().size() != 0) {
- fail("First conditional block should be empty");
- }
-
- if (ifAction.getConditionalBlocks().get(1).getContents().size() != 0) {
- fail("Second conditional block should be empty");
- }
-
- if (ifAction.getElseBlock() == null) {
- fail("Else block not defined");
- }
-
- if (ifAction.getElseBlock().getContents().size() != 0) {
- fail("Else block should have be empty");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- IfAction action=new IfAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- IfAction action=new IfAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,272 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.MessageRouterAction;
-
-import junit.framework.TestCase;
-
-public class MessageRouterActionTest extends TestCase {
-
- public void testValidatePathsSpecified() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"paths"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateSessionBasedService() {
- TestESBService service=new TestESBService();
- service.setSessionBased(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><route service-category=\"cat1\" " +
- "service-name=\"name1\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><route service-category=\"cat1\" " +
- "service-name=\"name1\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1","name1"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateInitiateServiceNotRoot() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><route service-category=\"cat1\" " +
- "service-name=\"name1\" initiate=\"true\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other=new TestESBService();
- other.setCategory("cat1");
- other.setName("name1");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other);
- model.addService(service);
-
- service.setModel(model);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_CANNOT_INITIATE_NON_ROOT",
- new String[]{other.getCategory(),
- other.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNotInitiateRootService() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><route service-category=\"cat1\" " +
- "service-name=\"name1\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other=new TestESBService();
- other.setCategory("cat1");
- other.setName("name1");
- other.setRoot(true);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other);
- model.addService(service);
-
- service.setModel(model);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_INITIATE_ROOT",
- new String[]{other.getCategory(),
- other.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoRoutes() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_ROUTER_ONE_OR_MORE_PATHS",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceDetailsMissing() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><route service-category=\"cat1\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- MessageRouterAction action=new MessageRouterAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- MessageRouterAction action=new MessageRouterAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- MessageRouterAction action=new MessageRouterAction(service, null);
-
- if (action.isSessionBased() == true) {
- fail("Action is flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,526 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.scribble.conversation.model.*;
-import org.scribble.model.Activity;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.ParallelAction;
-
-import junit.framework.TestCase;
-
-public class ParallelActionTest extends TestCase {
-
- public void testValidatePathsSpecified() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- ParallelAction action=new ParallelAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"paths"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><path service-category=\"cat2\" " +
- "service-name=\"name2\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1","name1"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2","name2"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat3","name3"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateLessThanTwoPaths() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat3");
- other2.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PARALLEL_MORE_THAN_TWO_PATHS",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOnlyOneJoin() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><path service-category=\"cat2\" " +
- "service-name=\"name2\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MULTIPLE_JOINS",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOutOfOrderJoin() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /><path service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PARALLEL_PATH_AFTER_JOIN",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingServiceDetails() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><path " +
- "service-name=\"name2\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateImmediate() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><path service-category=\"cat2\" " +
- "service-name=\"name2\" immediate=\"fred\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{ParallelAction.IMMEDIATE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvert() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><path service-category=\"cat2\" " +
- "service-name=\"name2\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(null));
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Parallel) == false) {
- fail("Expecting an 'Parallel' activity");
- }
-
- Parallel parallelAction=(Parallel)act;
-
- if (parallelAction.getBlocks().size() != 2) {
- fail("Expecting two blocks: "+parallelAction.getBlocks().size());
- }
-
- if (parallelAction.getBlocks().get(0).getContents().size() != 1 ||
- parallelAction.getBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (parallelAction.getBlocks().get(1).getContents().size() != 1 ||
- parallelAction.getBlocks().get(1).getContents().get(0) != act2) {
- fail("Second conditional block should have 1 activity = act2");
- }
-
- if (activities.get(1) != act3) {
- fail("Activity after parallel should be act3");
- }
- }
-
- public void testConvertNotExcludingEmptyPaths() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><path service-category=\"cat1\" " +
- "service-name=\"name1\" /><path service-category=\"cat2\" " +
- "service-name=\"name2\" /><join service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- ParallelAction action=new ParallelAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(null));
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Parallel) == false) {
- fail("Expecting an 'Parallel' activity");
- }
-
- Parallel parallelAction=(Parallel)act;
-
- if (parallelAction.getBlocks().size() != 2) {
- fail("Expecting two blocks: "+parallelAction.getBlocks().size());
- }
-
- if (parallelAction.getBlocks().get(0).getContents().size() != 1 ||
- parallelAction.getBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (parallelAction.getBlocks().get(1).getContents().size() != 0) {
- fail("Second conditional block should be empty");
- }
-
- if (activities.get(1) != act3) {
- fail("Activity after parallel should be act3");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- ParallelAction action=new ParallelAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- ParallelAction action=new ParallelAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,779 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.PerformAction;
-import org.scribble.conversation.model.*;
-import org.scribble.model.Activity;
-
-import junit.framework.TestCase;
-
-public class PerformActionTest extends TestCase {
-
- public void testValidateNoServiceCategory() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_NAME, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- PerformAction action=new PerformAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"serviceCategory"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoServiceName() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- PerformAction action=new PerformAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"serviceName"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateService() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1", "name1"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateReturnService() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2", "name2"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceCreatesSession() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(false);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_PERFORM_CREATE_SESSION",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateParentReferenceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.PARENT_REFERENCE, "fred");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(Object.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{"fred", Object.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateParentReferenceNotWritable() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.PARENT_REFERENCE, "class");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(Object.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{"class", Object.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateParentReferenceIncorrectType() {
- TestESBService service=new TestESBService();
- service.setSessionClass(ParentPojo.class);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.PARENT_REFERENCE, "invalidParent");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(ChildPojo.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_INVALID_PROPERTY_TYPE",
- new String[]{"invalidParent",
- ChildPojo.class.getName(),
- ParentPojo.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateParentReferenceCorrectType() {
- TestESBService service=new TestESBService();
- service.setSessionClass(ParentPojo.class);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.PARENT_REFERENCE, "validParent");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(ChildPojo.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateParentReferenceCorrectType2() {
- TestESBService service=new TestESBService();
- service.setSessionClass(ParentPojo.class);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.PARENT_REFERENCE, "validParentView");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(ChildPojo.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateBindDetailsNotFound() {
- TestESBService service=new TestESBService();
-
- String varName="fred";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- java.util.Map<String,String> customProps=new java.util.Hashtable<String,String>();
- customProps.put(PerformAction.BIND_DETAILS,
- "<root><bind to-variable=\""+varName+"\" /></root>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, customProps);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(Object.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{varName, Object.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateBindDetailsNotWritable() {
- TestESBService service=new TestESBService();
-
- String varName="class";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- java.util.Map<String,String> customProps=new java.util.Hashtable<String,String>();
- customProps.put(PerformAction.BIND_DETAILS,
- "<root><bind to-variable=\""+varName+"\" /></root>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, customProps);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(Object.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{varName, Object.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateBindDetailsCorrect() {
- TestESBService service=new TestESBService();
-
- String varName="validParent";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- java.util.Map<String,String> customProps=new java.util.Hashtable<String,String>();
- customProps.put(PerformAction.BIND_DETAILS,
- "<root><bind to-variable=\""+varName+"\" /></root>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, customProps);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
- other1.setSessionClass(ChildPojo.class);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvertRun() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Run) == false) {
- fail("Expecting an 'Run' activity");
- }
-
- Run runAction=(Run)act;
-
- if (runAction.getDefinition() == null) {
- fail("Run definition was null");
- }
-
- if (runAction.getDefinition().getBlock().getContents().size() != 1) {
- fail("Expecting one ran block activity: "+runAction.getDefinition().getBlock().getContents().size());
- }
-
- if (runAction.getDefinition().getBlock().getContents().get(0) != act1) {
- fail("Run model block should have 1 activity = act1");
- }
-
- if (activities.get(1) != act2) {
- fail("Subsequent activity after run was not act2");
- }
- }
-
- public void testConvertSpawn() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting 1 activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Spawn) == false) {
- fail("Expecting a 'Spawn' activity");
- }
-
- Spawn spawnAction=(Spawn)act;
-
- if (spawnAction.getDefinition() == null) {
- fail("Run definition was null");
- }
-
- if (spawnAction.getDefinition().getBlock().getContents().size() != 1) {
- fail("Expecting one block activity: "+spawnAction.getDefinition().getBlock().getContents().size());
- }
-
- if (spawnAction.getDefinition().getBlock().getContents().get(0) != act1) {
- fail("Spawn model block should have 1 activity = act1");
- }
- }
-
- public void testConvertNotExcludingEmptyPath() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Run) == false) {
- fail("Expecting an 'Run' activity");
- }
-
- Run runAction=(Run)act;
-
- if (runAction.getDefinition() == null) {
- fail("Run definition was null");
- }
-
- if (runAction.getDefinition().getBlock().getContents().size() != 0) {
- fail("Expecting zero ran block activities: "+runAction.getDefinition().getBlock().getContents().size());
- }
-
- if (activities.get(1) != act2) {
- fail("Subsequent activity after run was not act2");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- PerformAction action=new PerformAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- PerformAction action=new PerformAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-
- public interface ParentView {
-
- }
-
- public class ParentPojo implements ParentView {
-
- }
-
- public class ChildPojo {
-
- public void setValidParent(ParentPojo p) {
- }
-
- public void setValidParentView(ParentView p) {
- }
-
- public void setInvalidParent(String p) {
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,287 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.ReceiveMessageAction;
-
-import junit.framework.TestCase;
-
-public class ReceiveMessageActionTest extends TestCase {
-
- public void testValidateNoMessageType() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("identities", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"messageType"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoIdentities() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"identities"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvertRoles() {
- TestESBService service=new TestESBService();
-
- String ns="MessageTypeNS";
- String lp="MessageType";
- String role="Buyer";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "{"+ns+"}"+lp);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(role));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Interaction) == false) {
- fail("Expecting an 'Interaction' activity");
- }
-
- Interaction interaction=(Interaction)act;
-
- if (interaction.getToRole() == null) {
- fail("'To' role is null");
- }
-
- if (interaction.getToRole().getName().equals(role) == false) {
- fail("'To' role should be '"+role+"', but found: "+interaction.getToRole().getName());
- }
-
- if (interaction.getFromRole() != null) {
- fail("'From' role should be null");
- }
- }
-
- public void testConvertMessageBased() {
- TestESBService service=new TestESBService();
-
- String ns="MessageTypeNS";
- String lp="MessageType";
- String role="Buyer";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "{"+ns+"}"+lp);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(role));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Interaction) == false) {
- fail("Expecting an 'Interaction' activity");
- }
-
- Interaction interaction=(Interaction)act;
-
- if (interaction.getMessageSignature() == null) {
- fail("Message signature is null");
- }
-
- if (interaction.getMessageSignature().getOperation() != null) {
- fail("Operation should be null");
- }
-
- if (interaction.getMessageSignature().getTypes().size() != 1) {
- fail("Only one type expected, but got: "+interaction.getMessageSignature().getTypes().size());
- }
-
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- if (ref.getNamespace() == null ||
- ref.getNamespace().equals(ns) == false) {
- fail("Namespace should be '"+ns+"', but found: "+ref.getNamespace());
- }
-
- if (ref.getLocalpart() == null ||
- ref.getLocalpart().equals(lp) == false) {
- fail("Local type should be '"+lp+"', but found: "+ref.getLocalpart());
- }
- }
-
- public void testConvertRPCBased() {
- TestESBService service=new TestESBService();
-
- String ns="MessageTypeNS";
- String lp="MessageType";
- String opname="op";
- String role="Buyer";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("operation", opname);
- props.put("messageType", "{"+ns+"}"+lp);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(role));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Interaction) == false) {
- fail("Expecting an 'Interaction' activity");
- }
-
- Interaction interaction=(Interaction)act;
-
- if (interaction.getMessageSignature() == null) {
- fail("Message signature is null");
- }
-
- if (interaction.getMessageSignature().getOperation() == null) {
- fail("Operation should not be null");
- }
-
- if (interaction.getMessageSignature().getOperation().equals(opname) == false) {
- fail("Operation expected '"+opname+"', but got: "+
- interaction.getMessageSignature().getOperation());
- }
-
- if (interaction.getMessageSignature().getTypes().size() != 1) {
- fail("Only one type expected, but got: "+interaction.getMessageSignature().getTypes().size());
- }
-
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- if (ref.getNamespace() == null ||
- ref.getNamespace().equals(ns) == false) {
- fail("Namespace should be '"+ns+"', but found: "+ref.getNamespace());
- }
-
- if (ref.getLocalpart() == null ||
- ref.getLocalpart().equals(lp) == false) {
- fail("Local type should be '"+lp+"', but found: "+ref.getLocalpart());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- ReceiveMessageAction action=new ReceiveMessageAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.RetrieveSessionAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.UnsupportedAction;
-
-import junit.framework.TestCase;
-
-public class RetrieveSessionActionTest extends TestCase {
-
- public void testValidateFirstAction() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("identities", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- UnsupportedAction unsupported=new UnsupportedAction(service, null);
-
- RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
-
- service.getActions().add(action);
- service.getActions().add(unsupported);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNotFirstAction() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("identities", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- UnsupportedAction unsupported=new UnsupportedAction(service, null);
-
- RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
-
- service.getActions().add(unsupported);
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_BE_FIRST_ACTION",
- new String[]{"RetrieveSession"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoIdentities() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"identities"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- RetrieveSessionAction action=new RetrieveSessionAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- RetrieveSessionAction action=new RetrieveSessionAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,257 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.scribble.model.Activity;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.ScheduleStateAction;
-
-import junit.framework.TestCase;
-
-public class ScheduleStateActionTest extends TestCase {
-
- public void testValidateNoServiceCategory() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("serviceName", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- ScheduleStateAction action=new ScheduleStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"serviceCategory"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoServiceName() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("serviceCategory", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- ScheduleStateAction action=new ScheduleStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"serviceName"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateService() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("serviceCategory", "cat1");
- props.put("serviceName", "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- ScheduleStateAction action=new ScheduleStateAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1", "name1"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvert() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("serviceCategory", "cat1");
- props.put("serviceName", "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- ScheduleStateAction action=new ScheduleStateAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(null));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- if (activities.get(0) != act1) {
- fail("Activity was not act1");
- }
- }
-
- public void testConvertBackToWhileLoop() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("serviceCategory", "cat1");
- props.put("serviceName", "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setLoop(true);
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- ScheduleStateAction action=new ScheduleStateAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- DefaultConversionContext context=new DefaultConversionContext(null);
- context.push(other1);
-
- action.convert(activities, context);
-
- if (activities.size() != 0) {
- fail("Should be no activities, but found: "+activities.size());
- }
- }
-
- public void testConvertBackToJoinState() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("serviceCategory", "cat1");
- props.put("serviceName", "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- ScheduleStateAction action=new ScheduleStateAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- DefaultConversionContext context=new DefaultConversionContext(null);
- context.markJoin(other1);
-
- action.convert(activities, context);
-
- if (activities.size() != 0) {
- fail("Should be no activities, but found: "+activities.size());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- ScheduleStateAction action=new ScheduleStateAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- ScheduleStateAction action=new ScheduleStateAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,363 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SendMessageAction;
-import org.scribble.model.Activity;
-import org.scribble.model.Interaction;
-import org.scribble.model.TypeReference;
-
-import junit.framework.TestCase;
-
-public class SendMessageActionTest extends TestCase {
-
- public void testValidateNoMessageType() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("identities", "");
- props.put("serviceCategory", "");
- props.put("serviceName", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- SendMessageAction action=new SendMessageAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"messageType"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoIdentities() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "");
- props.put("clientEPR", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- SendMessageAction action=new SendMessageAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"identities"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoDestination() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "");
- props.put("identities", "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- SendMessageAction action=new SendMessageAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_REQ_RESP_EPR",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateResponseService() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "");
- props.put("identities", "");
- props.put("serviceCategory", "cat1");
- props.put("serviceName", "name1");
- props.put("responseServiceCategory", "cat2");
- props.put("responseServiceName", "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- SendMessageAction action=new SendMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2", "name2"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvertRoles() {
- TestESBService service=new TestESBService();
-
- String ns="MessageTypeNS";
- String lp="MessageType";
- String role="Buyer";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "{"+ns+"}"+lp);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- SendMessageAction action=new SendMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(role));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Interaction) == false) {
- fail("Expecting an 'Interaction' activity");
- }
-
- Interaction interaction=(Interaction)act;
-
- if (interaction.getFromRole() == null) {
- fail("'From' role is null");
- }
-
- if (interaction.getFromRole().getName().equals(role) == false) {
- fail("'From' role should be '"+role+"', but found: "+interaction.getFromRole().getName());
- }
-
- if (interaction.getToRole() != null) {
- fail("'To' role should be null");
- }
- }
-
- public void testConvertMessageBased() {
- TestESBService service=new TestESBService();
-
- String ns="MessageTypeNS";
- String lp="MessageType";
- String role="Buyer";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("messageType", "{"+ns+"}"+lp);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- SendMessageAction action=new SendMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(role));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Interaction) == false) {
- fail("Expecting an 'Interaction' activity");
- }
-
- Interaction interaction=(Interaction)act;
-
- if (interaction.getMessageSignature() == null) {
- fail("Message signature is null");
- }
-
- if (interaction.getMessageSignature().getOperation() != null) {
- fail("Operation should be null");
- }
-
- if (interaction.getMessageSignature().getTypes().size() != 1) {
- fail("Only one type expected, but got: "+interaction.getMessageSignature().getTypes().size());
- }
-
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- if (ref.getNamespace() == null ||
- ref.getNamespace().equals(ns) == false) {
- fail("Namespace should be '"+ns+"', but found: "+ref.getNamespace());
- }
-
- if (ref.getLocalpart() == null ||
- ref.getLocalpart().equals(lp) == false) {
- fail("Local type should be '"+lp+"', but found: "+ref.getLocalpart());
- }
- }
-
- public void testConvertRPCBased() {
- TestESBService service=new TestESBService();
-
- String ns="MessageTypeNS";
- String lp="MessageType";
- String opname="op";
- String role="Buyer";
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("operation", opname);
- props.put("messageType", "{"+ns+"}"+lp);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- SendMessageAction action=new SendMessageAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(role));
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Interaction) == false) {
- fail("Expecting an 'Interaction' activity");
- }
-
- Interaction interaction=(Interaction)act;
-
- if (interaction.getMessageSignature() == null) {
- fail("Message signature is null");
- }
-
- if (interaction.getMessageSignature().getOperation() == null) {
- fail("Operation should not be null");
- }
-
- if (interaction.getMessageSignature().getOperation().equals(opname) == false) {
- fail("Operation expected '"+opname+"', but got: "+
- interaction.getMessageSignature().getOperation());
- }
-
- if (interaction.getMessageSignature().getTypes().size() != 1) {
- fail("Only one type expected, but got: "+interaction.getMessageSignature().getTypes().size());
- }
-
- TypeReference ref=interaction.getMessageSignature().getTypes().get(0);
-
- if (ref.getNamespace() == null ||
- ref.getNamespace().equals(ns) == false) {
- fail("Namespace should be '"+ns+"', but found: "+ref.getNamespace());
- }
-
- if (ref.getLocalpart() == null ||
- ref.getLocalpart().equals(lp) == false) {
- fail("Local type should be '"+lp+"', but found: "+ref.getLocalpart());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- SendMessageAction action=new SendMessageAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- SendMessageAction action=new SendMessageAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SetMessageAction;
-
-import junit.framework.TestCase;
-
-public class SetMessageActionTest extends TestCase {
-
- public void testValidateNoExpression() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- SetMessageAction action=new SetMessageAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{SetMessageAction.STATE_EXPRESSION}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- SetMessageAction action=new SetMessageAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- SetMessageAction action=new SetMessageAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,358 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SetStateAction;
-
-import junit.framework.TestCase;
-
-public class SetStateActionTest extends TestCase {
-
- public void testValidateNoVariable() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.STATE_EXPRESSION, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{SetStateAction.VARIABLE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateVariableNotClassProperty() {
- String varName="classX";
- Class<?> cls=java.lang.Object.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.STATE_EXPRESSION, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_VARIABLE",
- new String[]{varName, cls.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateVariableIsClassProperty() {
- String varName="writableProperty";
- Class<?> cls=TestClass2.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.STATE_EXPRESSION, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMultiPartVariableIsClassWritableProperty() {
- String varName="testClass2.writableProperty";
- Class<?> cls=TestClass1.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.STATE_EXPRESSION, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMultiPartVariableIsClassNotWritableProperty() {
- String varName="testClass2.readableProperty";
- Class<?> cls=TestClass1.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.STATE_EXPRESSION, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_WRITABLE_PROPERTY",
- new String[]{"readableProperty", TestClass2.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMultiPartVariableIsClassNotReadableProperty() {
- String varName="testClass2.writableProperty";
- Class<?> cls=TestClass3.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.STATE_EXPRESSION, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_READABLE_PROPERTY",
- new String[]{"testClass2", TestClass3.class.getName()}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingExpression() {
- String varName="writableProperty";
- Class<?> cls=TestClass2.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateBothExpressions() {
- String varName="writableProperty";
- Class<?> cls=TestClass2.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.MESSAGE_EXPRESSION, "mesg");
- props.put(SetStateAction.STATE_EXPRESSION, "state");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMessageExpression() {
- String varName="writableProperty";
- Class<?> cls=TestClass2.class;
-
- TestESBService service=new TestESBService();
- service.setRoot(true);
- service.setSessionClass(cls);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(SetStateAction.VARIABLE, varName);
- props.put(SetStateAction.MESSAGE_EXPRESSION, "mesg");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null,
- props, null);
-
- SetStateAction action=new SetStateAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- SetStateAction action=new SetStateAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- SetStateAction action=new SetStateAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-
- public class TestClass1 {
- public TestClass1() {
- }
-
- public TestClass2 getTestClass2() {
- return(null);
- }
- }
-
- public class TestClass2 {
- public TestClass2() {
- }
-
- public String getReadableProperty() {
- return(null);
- }
-
- public void setWritableProperty(String str) {
- }
- }
-
- public class TestClass3 {
- public TestClass3() {
- }
-
- public void setTestClass2(TestClass2 tc2) {
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,382 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SwitchAction;
-import org.scribble.conversation.model.If;
-import org.scribble.model.Activity;
-
-import junit.framework.TestCase;
-
-public class SwitchActionTest extends TestCase {
-
- public void testValidatePathsSpecified() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- SwitchAction action=new SwitchAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"paths"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><case service-category=\"cat1\" " +
- "service-name=\"name1\" /><case service-category=\"cat2\" " +
- "service-name=\"name2\" /><case service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- SwitchAction action=new SwitchAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1","name1"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2","name2"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat3","name3"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateLessThanOnePath() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat3");
- other2.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- SwitchAction action=new SwitchAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_SWITCH_ONE_OR_MORE_PATHS",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingServiceDetails() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><case service-category=\"cat1\" " +
- "service-name=\"name1\" /><case " +
- "service-name=\"name2\" /><case service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- SwitchAction action=new SwitchAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvert() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><case service-category=\"cat1\" " +
- "service-name=\"name1\" /><case service-category=\"cat2\" " +
- "service-name=\"name2\" /><case service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- SwitchAction action=new SwitchAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof If) == false) {
- fail("Expecting an 'If' activity");
- }
-
- If ifAction=(If)act;
-
- if (ifAction.getConditionalBlocks().size() != 3) {
- fail("Expecting three conditional blocks: "+ifAction.getConditionalBlocks().size());
- }
-
- if (ifAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (ifAction.getConditionalBlocks().get(1).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(1).getContents().get(0) != act2) {
- fail("Second conditional block should have 1 activity = act2");
- }
-
- if (ifAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
- fail("Third conditional block should have 1 activity = act3");
- }
-
- if (ifAction.getElseBlock() != null) {
- fail("Else block should not be defined");
- }
- }
-
- public void testConvertNotExcludingEmptyPaths() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><case service-category=\"cat1\" " +
- "service-name=\"name1\" /><case service-category=\"cat2\" " +
- "service-name=\"name2\" /><case service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- SwitchAction action=new SwitchAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof If) == false) {
- fail("Expecting an 'If' activity");
- }
-
- If ifAction=(If)act;
-
- if (ifAction.getConditionalBlocks().size() != 3) {
- fail("Expecting three conditional blocks: "+ifAction.getConditionalBlocks().size());
- }
-
- if (ifAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (ifAction.getConditionalBlocks().get(1).getContents().size() != 0) {
- fail("Second conditional block should be empty");
- }
-
- if (ifAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
- ifAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
- fail("Third conditional block should have 1 activity = act3");
- }
-
- if (ifAction.getElseBlock() != null) {
- fail("Else block should not be defined");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- SwitchAction action=new SwitchAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- SwitchAction action=new SwitchAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/TestActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/TestActivity.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/TestActivity.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-public class TestActivity extends org.scribble.model.Activity {
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,374 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.WhenAction;
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-
-import junit.framework.TestCase;
-
-public class WhenActionTest extends TestCase {
-
- public void testValidatePathsSpecified() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- WhenAction action=new WhenAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"paths"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><when service-category=\"cat1\" " +
- "service-name=\"name1\" /><when service-category=\"cat2\" " +
- "service-name=\"name2\" /><when service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- WhenAction action=new WhenAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1","name1"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2","name2"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat3","name3"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateLessThanOnePath() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat3");
- other2.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhenAction action=new WhenAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_WHEN_ONE_OR_MORE_PATHS",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingServiceDetails() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><when service-category=\"cat1\" " +
- "service-name=\"name1\" /><when " +
- "service-name=\"name2\" /><when service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- WhenAction action=new WhenAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvert() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><when service-category=\"cat1\" " +
- "service-name=\"name1\" /><when service-category=\"cat2\" " +
- "service-name=\"name2\" /><when service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- WhenAction action=new WhenAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof When) == false) {
- fail("Expecting an 'When' activity");
- }
-
- When whenAction=(When)act;
-
- if (whenAction.getConditionalBlocks().size() != 3) {
- fail("Expecting three conditional blocks: "+whenAction.getConditionalBlocks().size());
- }
-
- if (whenAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
- whenAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (whenAction.getConditionalBlocks().get(1).getContents().size() != 1 ||
- whenAction.getConditionalBlocks().get(1).getContents().get(0) != act2) {
- fail("Second conditional block should have 1 activity = act2");
- }
-
- if (whenAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
- whenAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
- fail("Second conditional block should have 1 activity = act3");
- }
- }
-
- public void testConvertNotExcludingEmptyPath() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><when service-category=\"cat1\" " +
- "service-name=\"name1\" /><when service-category=\"cat2\" " +
- "service-name=\"name2\" /><when service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestActivity act3=new TestActivity();
- other3.getContents().add(act3);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- WhenAction action=new WhenAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting one activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof When) == false) {
- fail("Expecting an 'When' activity");
- }
-
- When whenAction=(When)act;
-
- if (whenAction.getConditionalBlocks().size() != 3) {
- fail("Expecting three conditional blocks: "+whenAction.getConditionalBlocks().size());
- }
-
- if (whenAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
- whenAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
- fail("First conditional block should have 1 activity = act1");
- }
-
- if (whenAction.getConditionalBlocks().get(1).getContents().size() != 0) {
- fail("Second conditional block should be empty");
- }
-
- if (whenAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
- whenAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
- fail("Third conditional block should have 1 activity = act3");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- WhenAction action=new WhenAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- WhenAction action=new WhenAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileActionTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,565 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.scribble.conversation.model.*;
-import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.WhileAction;
-
-import junit.framework.TestCase;
-
-public class WhileActionTest extends TestCase {
-
- public void testValidatePathsSpecified() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- WhileAction action=new WhileAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"paths"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceNotFound() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat1\" " +
- "service-name=\"name1\" /><exit service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1","name1"}));
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2","name2"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOneWhilePath() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat1\" " +
- "service-name=\"name1\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat3");
- other2.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_DEFINE_SINGLE_WHILE_EXIT",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOneWhileExit() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><exit service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_MUST_DEFINE_SINGLE_WHILE_PATH",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingServiceDetails1() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while " +
- "service-name=\"name2\" /><exit service-category=\"cat3\" " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateMissingServiceDetails2() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat2\" " +
- "service-name=\"name2\" /><exit " +
- "service-name=\"name3\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_PATH_SERVICE_DETAILS_MISSING",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateOutOfOrderExit() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><exit service-category=\"cat1\" " +
- "service-name=\"name1\" /><while service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBService other3=new TestESBService();
- other3.setCategory("cat3");
- other3.setName("name3");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(other3);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_WHILE_PATH_AFTER_EXIT",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateImmediateWhile() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat1\" " +
- "service-name=\"name1\" immediate=\"fred\" /><exit service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{WhileAction.IMMEDIATE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateImmediateExit() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat1\" " +
- "service-name=\"name1\" /><exit service-category=\"cat2\" " +
- "service-name=\"name2\" immediate=\"fred\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_BOOLEAN",
- new String[]{WhileAction.IMMEDIATE}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvert() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat1\" " +
- "service-name=\"name1\" /><exit service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(null));
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof While) == false) {
- fail("Expecting an 'While' activity");
- }
-
- While whileAction=(While)act;
-
- if (whileAction.getBlock().getContents().size() != 1) {
- fail("Expecting one entry in while block: "+whileAction.getBlock().getContents().size());
- }
-
- if (whileAction.getBlock().getContents().get(0) != act1) {
- fail("While block should have 1 activity = act1");
- }
-
- if (activities.get(1) != act2) {
- fail("Activity following while should be act2");
- }
- }
-
- public void testConvertNotExcludingEmptyBody() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put("paths", "<property><while service-category=\"cat1\" " +
- "service-name=\"name1\" /><exit service-category=\"cat2\" " +
- "service-name=\"name2\" /></property>");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- WhileAction action=new WhileAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, new DefaultConversionContext(null));
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof While) == false) {
- fail("Expecting an 'While' activity");
- }
-
- While whileAction=(While)act;
-
- if (whileAction.getBlock().getContents().size() != 0) {
- fail("Expecting zero entries in while block: "+whileAction.getBlock().getContents().size());
- }
-
- if (activities.get(1) != act2) {
- fail("Activity following while should be act2");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- WhileAction action=new WhileAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- WhileAction action=new WhileAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,1847 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.ConversationInteractionModelChangeRule;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class ConversationInteractionModelChangeRuleTest extends TestCase {
-
- public void testInsertFirstReceiveAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setToRole(role);
- conv.getBlock().getContents().add(mobj);
-
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- if (mra.getNumberOfRoutes() != 1) {
- fail("One route expected: "+mra.getNumberOfRoutes());
- }
- }
-
- public void testInsertFirstReceiveAfterCreateSessionAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add 'create session' action
- TestESBAction act=new TestESBAction();
- act.setCreateSession(true);
- service.addAction(act, -1);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setToRole(role);
- conv.getBlock().getContents().add(mobj);
-
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof TestESBAction) == false) {
- fail("Action was not TestESBAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(1);
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- if (mra.getNumberOfRoutes() != 1) {
- fail("One route expected: "+mra.getNumberOfRoutes());
- }
- }
-
- public void testInsertSecondReceiveAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setToRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, null) == false) {
- fail("Failed to insert 1");
- }
-
- ConversationInteraction mobj2=new ConversationInteraction();
- mobj2.setToRole(role);
- conv.getBlock().getContents().add(mobj2);
-
- MessageSignature msig2=new MessageSignature();
- mobj2.setMessageSignature(msig2);
-
- TypeReference ref2=new TypeReference();
- ref2.setNamespace("ns");
- ref2.setLocalpart("lp2");
-
- msig2.getTypes().add(ref2);
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- if (rule.insert(context, model, mobj2, null) == false) {
- fail("Failed to insert 2");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- // Check schedule details
- ScheduleStateAction schedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (newService.getCategory().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- service.getCategory());
- }
-
- if (newService.getName().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- service.getName());
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.IMMEDIATE) != null) {
- fail("Schedule should not be immediate");
- }
-
- if (newService.getActions().size() != 1) {
- fail("Expecting 1 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)newService.getActions().get(0);
-
- String mtype=InteractionUtil.getTypeString(ref2);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- if (mra.getNumberOfRoutes() != 2) {
- fail("Two routes expected: "+mra.getNumberOfRoutes());
- }
- }
-
-
- public void testInsertMiddleReceiveBetweenTwoReceives() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setToRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, null) == false) {
- fail("Failed to insert 1");
- }
-
- ConversationInteraction mobj2=new ConversationInteraction();
- mobj2.setToRole(role);
- conv.getBlock().getContents().add(mobj2);
-
- MessageSignature msig2=new MessageSignature();
- mobj2.setMessageSignature(msig2);
-
- TypeReference ref2=new TypeReference();
- ref2.setNamespace("ns");
- ref2.setLocalpart("lp2");
-
- msig2.getTypes().add(ref2);
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- if (rule.insert(context, model, mobj2, null) == false) {
- fail("Failed to insert 2");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- ((TestESBService)newService).setSessionBased(true);
-
- // Check schedule details
- ScheduleStateAction schedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (newService.getCategory().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- service.getCategory());
- }
-
- if (newService.getName().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- service.getName());
- }
-
- // Check actions
- if (newService.getActions().size() != 1) {
- fail("Expecting 1 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- ReceiveMessageAction recv2=(ReceiveMessageAction)
- newService.getActions().get(0);
-
-
- String mtype=InteractionUtil.getTypeString(ref2);
-
- if (recv2.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+recv2.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- recv2.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // Now second service identified, add new receive
- // action to ensure that third service inserted in the
- // middle
- ConversationInteraction mobj3=new ConversationInteraction();
- mobj3.setToRole(role);
- conv.getBlock().getContents().add(mobj3);
-
- MessageSignature msig3=new MessageSignature();
- mobj3.setMessageSignature(msig3);
-
- TypeReference ref3=new TypeReference();
- ref3.setNamespace("ns");
- ref3.setLocalpart("lp3");
-
- msig3.getTypes().add(ref3);
-
- // Insert into position 1, which should be after first
- // receive
-
- // TODO: Need to pass representation of last interaction
- if (rule.insert(context, model, mobj3, acts.get(0)) == false) {
- fail("Failed to insert 3");
- }
-
- // Re-Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- // TODO: Need to check if new service has been inserted
- // in the middle of the previously inserted interactions
-
- // Check actions
- if (newService.getActions().size() != 2) {
- fail("Now Expecting 2 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- if ((newService.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+newService.getActions().get(1));
- }
-
- ScheduleStateAction ssa=(ScheduleStateAction)newService.getActions().get(1);
-
- ESBService newService2=model.getService(ssa.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY),ssa.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME));
-
- if (newService2 == null) {
- fail("Failed to find final service");
- }
-
- if (newService2.getActions().size() != 1) {
- fail("Only expecting one action: "+newService2.getActions().size());
- }
-
- ReceiveMessageAction recv4=(ReceiveMessageAction)
- newService2.getActions().get(0);
-
- String mtype4=InteractionUtil.getTypeString(ref2);
-
- if (recv4.getPropertyValue("messageType").equals(mtype4)==false) {
- fail("Message type '"+recv4.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype4);
- }
-
-
- ReceiveMessageAction recv3=(ReceiveMessageAction)
- newService.getActions().get(0);
-
- String mtype3=InteractionUtil.getTypeString(ref3);
-
- if (recv3.getPropertyValue("messageType").equals(mtype3)==false) {
- fail("Message type '"+recv3.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype3);
- }
- }
-
- public void testInsertMiddleSendBetweenTwoReceives() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setToRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, null) == false) {
- fail("Failed to insert 1");
- }
-
- ConversationInteraction mobj2=new ConversationInteraction();
- mobj2.setToRole(role);
- conv.getBlock().getContents().add(mobj2);
-
- MessageSignature msig2=new MessageSignature();
- mobj2.setMessageSignature(msig2);
-
- TypeReference ref2=new TypeReference();
- ref2.setNamespace("ns");
- ref2.setLocalpart("lp2");
-
- msig2.getTypes().add(ref2);
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- if (rule.insert(context, model, mobj2, null) == false) {
- fail("Failed to insert 2");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- ((TestESBService)newService).setSessionBased(true);
-
- // Check schedule details
- ScheduleStateAction schedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (newService.getCategory().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- service.getCategory());
- }
-
- if (newService.getName().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- service.getName());
- }
-
- // Check actions
- if (newService.getActions().size() != 1) {
- fail("Expecting 1 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- ReceiveMessageAction recv2=(ReceiveMessageAction)
- newService.getActions().get(0);
-
-
- String mtype=InteractionUtil.getTypeString(ref2);
-
- if (recv2.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+recv2.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- recv2.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // Now second service identified, add new receive
- // action to ensure that third service inserted in the
- // middle
- ConversationInteraction mobj3=new ConversationInteraction();
- mobj3.setFromRole(role);
- conv.getBlock().getContents().add(mobj3);
-
- MessageSignature msig3=new MessageSignature();
- mobj3.setMessageSignature(msig3);
-
- TypeReference ref3=new TypeReference();
- ref3.setNamespace("ns");
- ref3.setLocalpart("lp3");
-
- msig3.getTypes().add(ref3);
-
- // Insert into position 1, which should be after first
- // receive
-
- // TODO: Need to pass representation of last interaction
- if (rule.insert(context, model, mobj3, acts.get(0)) == false) {
- fail("Failed to insert 3");
- }
-
- // Re-Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- // TODO: Need to check if new service has been inserted
- // in the middle of the previously inserted interactions
-
- // Check actions
- if (newService.getActions().size() != 2) {
- fail("Now Expecting 2 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action 1 was not SendMessageAction: "+newService.getActions().get(0));
- }
-
- if ((newService.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+newService.getActions().get(1));
- }
-
- ScheduleStateAction ssa=(ScheduleStateAction)newService.getActions().get(1);
-
- ESBService newService2=model.getService(ssa.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY),ssa.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME));
-
- if (newService2 == null) {
- fail("Failed to find final service");
- }
-
- if (newService2.getActions().size() != 1) {
- fail("Only expecting one action: "+newService2.getActions().size());
- }
-
- if ((newService2.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Expecting ReceiveMessageAction, but got: "+newService2.getActions().get(0));
- }
-
- ReceiveMessageAction recv4=(ReceiveMessageAction)
- newService2.getActions().get(0);
-
- String mtype4=InteractionUtil.getTypeString(ref2);
-
- if (recv4.getPropertyValue("messageType").equals(mtype4)==false) {
- fail("Message type '"+recv4.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype4);
- }
-
-
- SendMessageAction send3=(SendMessageAction)
- newService.getActions().get(0);
-
- String mtype3=InteractionUtil.getTypeString(ref3);
-
- if (send3.getPropertyValue("messageType").equals(mtype3)==false) {
- fail("Message type '"+send3.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype3);
- }
- }
-
- public void testInsertMiddleReceiveBetweenTwoSends() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setFromRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, null) == false) {
- fail("Failed to insert 1");
- }
-
- ConversationInteraction mobj2=new ConversationInteraction();
- mobj2.setFromRole(role);
- conv.getBlock().getContents().add(mobj2);
-
- MessageSignature msig2=new MessageSignature();
- mobj2.setMessageSignature(msig2);
-
- TypeReference ref2=new TypeReference();
- ref2.setNamespace("ns");
- ref2.setLocalpart("lp2");
-
- msig2.getTypes().add(ref2);
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- if (rule.insert(context, model, mobj2, null) == false) {
- fail("Failed to insert 2");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action 1 was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof SendMessageAction) == false) {
- fail("Action 2 was not SendMessageAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- SendMessageAction send2=(SendMessageAction)
- service.getActions().get(1);
-
-
- String mtype=InteractionUtil.getTypeString(ref2);
-
- if (send2.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+send2.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- send2.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // Now second service identified, add new receive
- // action to ensure that third service inserted in the
- // middle
- ConversationInteraction mobj3=new ConversationInteraction();
- mobj3.setToRole(role);
- conv.getBlock().getContents().add(mobj3);
-
- MessageSignature msig3=new MessageSignature();
- mobj3.setMessageSignature(msig3);
-
- TypeReference ref3=new TypeReference();
- ref3.setNamespace("ns");
- ref3.setLocalpart("lp3");
-
- msig3.getTypes().add(ref3);
-
- // Insert into position 1, which should be after first
- // send
-
- // TODO: Need to pass representation of last interaction
- if (rule.insert(context, model, mobj3, acts.get(0)) == false) {
- fail("Failed to insert 3");
- }
-
- // Re-Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action 1 was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- // Check actions
- if (newService.getActions().size() != 2) {
- fail("Now Expecting 2 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- if ((newService.getActions().get(1) instanceof SendMessageAction) == false) {
- fail("Action 2 was not SendMessageAction: "+newService.getActions().get(1));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (newService.getCategory().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- service.getCategory());
- }
-
- if (newService.getName().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- service.getName());
- }
-
- ReceiveMessageAction recv3=(ReceiveMessageAction)
- newService.getActions().get(0);
-
- String mtype3=InteractionUtil.getTypeString(ref3);
-
- if (recv3.getPropertyValue("messageType").equals(mtype3)==false) {
- fail("Message type '"+recv3.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype3);
- }
- }
-
- public void testInsertReceiveRequestAction() {
- String fromRoleName="role1";
- String toRoleName="role2";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role fromRole=new Role();
- fromRole.setName(fromRoleName);
-
- Role toRole=new Role();
- toRole.setName(toRoleName);
-
- context.setRole(toRole);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(toRole);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(fromRole);
- mobj.setToRole(toRole);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setRequestLabel("reqLabel");
-
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
-
- if (action.getPropertyValue(ReceiveMessageAction.CLIENT_EPR).equals(fromRoleName) == false) {
- fail("Client EPR '"+action.getPropertyValue(ReceiveMessageAction.CLIENT_EPR)+
- "' invalid, expecting: "+fromRoleName);
- }
- }
-
- public void testInsertFirstSendAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(role);
- conv.getBlock().getContents().add(mobj);
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
- }
-
- public void testInsertSendRequestAction() {
- String roleName="role1";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName(roleName);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(role);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setRequestLabel("reqLabel");
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two service expected: "+model.getServices().size());
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- if (newService.getCategory().equals(action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- newService.getCategory());
- }
-
- if (newService.getName().equals(action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_NAME)+
- "' invalid, expecting: "+
- newService.getName());
- }
- }
-
- public void testInsertSendNotReplyAction() {
- String fromRoleName="role1";
- String toRoleName="role2";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role fromRole=new Role();
- fromRole.setName(fromRoleName);
-
- Role toRole=new Role();
- toRole.setName(toRoleName);
-
- context.setRole(fromRole);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(fromRole);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(fromRole);
- mobj.setToRole(toRole);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setRequestLabel("reqLabel");
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two service expected: "+model.getServices().size());
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- if (action.getPropertyValue(SendMessageAction.SERVICE_CATEGORY_EXPRESSION).
- equals(InteractionUtil.getRoleServiceCategoryProperty(toRoleName)) == false) {
- fail("Service category expression '"+
- action.getPropertyValue(SendMessageAction.SERVICE_CATEGORY_EXPRESSION)+
- "' invalid, expecting: "+
- InteractionUtil.getRoleServiceCategoryProperty(toRoleName));
- }
-
- if (action.getPropertyValue(SendMessageAction.SERVICE_NAME_EXPRESSION).
- equals(InteractionUtil.getRoleServiceNameProperty(toRoleName)) == false) {
- fail("Service name expression '"+
- action.getPropertyValue(SendMessageAction.SERVICE_NAME_EXPRESSION)+
- "' invalid, expecting: "+
- InteractionUtil.getRoleServiceNameProperty(toRoleName));
- }
- }
-
- public void testInsertSendReplyAction() {
- String fromRoleName="role1";
- String toRoleName="role2";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role fromRole=new Role();
- fromRole.setName(fromRoleName);
-
- Role toRole=new Role();
- toRole.setName(toRoleName);
-
- context.setRole(fromRole);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(fromRole);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(fromRole);
- mobj.setToRole(toRole);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setReplyToLabel("replyLabel");
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- if (action.getPropertyValue(SendMessageAction.CLIENT_EPR).equals(toRoleName) == false) {
- fail("Client EPR '"+action.getPropertyValue(SendMessageAction.CLIENT_EPR)+
- "' invalid, expecting: "+toRoleName);
- }
- }
-
- public void testChangeFirstReceiveAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setToRole(role);
- conv.getBlock().getContents().add(mobj);
-
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp1");
-
- msig.getTypes().add(ref);
-
- // Create ReceiveMessageAction
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
- action.convert(activities, new DefaultConversionContext(null));
-
- if (activities.size() != 1) {
- fail("Expecting single interaction activity from ReceiveMessageAction: "+activities.size());
- }
-
- if ((activities.get(0) instanceof ConversationInteraction) == false) {
- fail("Not conversation interaction");
- }
-
- ConversationInteraction recvci=(ConversationInteraction)activities.get(0);
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- // Change local part
- ref.setLocalpart("lp2");
-
- if (rule.update(context, model, mobj, recvci) == false) {
- fail("Failed to update");
- }
-
- // Re-check the message type, to make sure has been updated
- mtype = InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- if (mra.getNumberOfRoutes() != 1) {
- fail("One route expected: "+mra.getNumberOfRoutes());
- }
-
- org.w3c.dom.Element route=mra.getRouteElement(0);
-
- org.w3c.dom.NodeList mesgs=route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
-
- if (mesgs.getLength() != 1) {
- fail("Too many route message elements: "+mesgs.getLength());
- }
-
- org.w3c.dom.Element mesg=(org.w3c.dom.Element)mesgs.item(0);
-
- if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).equals(mtype) == false) {
- fail("Route message type has not been updated");
- }
- }
-
- public void testDeleteMiddleReceiveBetweenTwoActions() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setToRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, null) == false) {
- fail("Failed to insert 1");
- }
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- TestESBAction act2=new TestESBAction();
- ((ESBService)context.getParent()).addAction(act2, -1);
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action 1 was not test ESB action: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- ((TestESBService)newService).setSessionBased(true);
-
- // Check schedule details
- ScheduleStateAction schedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (newService.getCategory().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- service.getCategory());
- }
-
- if (newService.getName().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- service.getName());
- }
-
- // Check actions
- if (newService.getActions().size() != 2) {
- fail("Expecting 2 actions: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- if (newService.getActions().get(1) != act2) {
- fail("Action 2 was not 2nd test ESB action: "+newService.getActions().get(1));
- }
-
- ReceiveMessageAction recv=(ReceiveMessageAction)
- newService.getActions().get(0);
-
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- recv.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // TODO: Need to pass representation of last interaction
- if (rule.delete(context, model, acts.get(0)) == false) {
- fail("Failed to delete receive");
- }
-
- // Re-Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action 1 was not test ESB action: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- // TODO: Need to check if new service has been inserted
- // in the middle of the previously inserted interactions
-
- // Check actions
- if (newService.getActions().size() != 1) {
- fail("Now Expecting 1 action: "+newService.getActions().size());
- }
-
- if (newService.getActions().get(0) != act2) {
- fail("Action 1 was not 2nd test ESB action: "+newService.getActions().get(0));
- }
- }
-
- public void testDeleteMiddleSendBetweenTwoActions() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setFromRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, null) == false) {
- fail("Failed to insert 1");
- }
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- TestESBAction act2=new TestESBAction();
- ((ESBService)context.getParent()).addAction(act2, -1);
-
- // Check actions
- if (service.getActions().size() != 3) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action 1 was not test ESB action: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof SendMessageAction) == false) {
- fail("Action 2 was not SendMessageAction: "+service.getActions().get(1));
- }
-
- if (service.getActions().get(2) != act2) {
- fail("Action 3 was not 2nd test ESB action: "+service.getActions().get(2));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
-
- SendMessageAction send=(SendMessageAction)
- service.getActions().get(1);
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- send.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // TODO: Need to pass representation of last interaction
- if (rule.delete(context, model, acts.get(0)) == false) {
- fail("Failed to delete send");
- }
-
- // Re-Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action 1 was not test ESB action: "+service.getActions().get(0));
- }
-
- if (service.getActions().get(1) != act2) {
- fail("Action 2 was not 2nd test ESB action: "+service.getActions().get(1));
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,1069 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.IfModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class IfModelChangeRuleTest extends TestCase {
-
- public void testInsertIfAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (ifService == null && iter.hasNext()) {
- ifService = iter.next();
- if (ifService == service) {
- ifService = null;
- }
- }
-
- IfAction action=(IfAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 1) {
- fail("Only one path child expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("if") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+ifService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+ifService.getName());
- }
- }
-
- public void testInsertIfActionWithSubsequentActions() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- service.addAction(act1, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((ifService == null || join == null) && iter.hasNext()) {
- ESBService s = iter.next();
- if (s != service) {
- if (ifService == null) {
- ifService = s;
- } else if (join == null) {
- join = s;
- }
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act1) {
- fail("Join action is not test ESB action");
- }
- }
-
- public void testInsertIfActionWithPrecedingActions() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action 1 was not test ESB action");
- }
-
- if ((service.getActions().get(1) instanceof IfAction) == false) {
- fail("Action 2 was not IfAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((ifService == null || join == null) && iter.hasNext()) {
- ESBService s = iter.next();
- if (s != service) {
- if (ifService == null) {
- ifService = s;
- } else if (join == null) {
- join = s;
- }
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act2) {
- fail("Join action is not test ESB action");
- }
- }
-
- public void testInsertIfElseIfAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- ESBService elseIfService1=null;
- ESBService elseIfService2=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((ifService == null || elseIfService1 == null ||
- elseIfService2 == null || join==null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- ifService = serv;
- }
- if (serv.getName().endsWith("__2")) {
- elseIfService1 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- elseIfService2 = serv;
- }
- }
-
- IfAction action=(IfAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("if") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+ifService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+ifService.getName());
- }
-
- if (ifService.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+ifService.getActions().size());
- }
-
- if ((ifService.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+ifService.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)ifService.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("elseif") == false) {
- fail("ElseIf expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(elseIfService1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+elseIfService1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(elseIfService1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+elseIfService1.getName());
- }
-
- if (elseIfService1.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+elseIfService1.getActions().size());
- }
-
- if ((elseIfService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+elseIfService1.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)elseIfService1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("elseif") == false) {
- fail("ElseIf(2) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(elseIfService2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+elseIfService2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(elseIfService2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+elseIfService2.getName());
- }
-
- if (elseIfService2.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+elseIfService2.getActions().size());
- }
-
- if ((elseIfService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+elseIfService2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)elseIfService2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-
- public void testInsertIfElseAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- Block b1=new Block();
- mobj.setElseBlock(b1);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 4) {
- fail("Four services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- ESBService elseService=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((ifService == null || elseService == null ||
- join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- ifService = serv;
- }
- if (serv.getName().endsWith("__2")) {
- elseService = serv;
- }
- }
-
- IfAction action=(IfAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("if") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+ifService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+ifService.getName());
- }
-
- if (ifService.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+ifService.getActions().size());
- }
-
- if ((ifService.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+ifService.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)ifService.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("else") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(elseService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+elseService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(elseService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+elseService.getName());
- }
-
- if (elseService.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+elseService.getActions().size());
- }
-
- if ((elseService.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+elseService.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)ifService.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- }
-
- public void testInsertSwitchAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- If mobj=new If();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService switchService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (switchService == null && iter.hasNext()) {
- switchService = iter.next();
- if (switchService == service) {
- switchService = null;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 1) {
- fail("Only one path child expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Switch expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(switchService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+switchService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(switchService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+switchService.getName());
- }
- }
-
- public void testInsertSwitchMultipleCaseAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- If mobj=new If();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- Block b1=new Block();
- mobj.setElseBlock(b1);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- ESBService caseService1=null;
- ESBService caseService2=null;
- ESBService caseService3=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((caseService1 == null || caseService2 == null ||
- caseService3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- caseService1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- caseService2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- caseService3 = serv;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService1.getName());
- }
-
- if (caseService1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+caseService1.getActions().size());
- }
-
- if ((caseService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)caseService1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService2.getName());
- }
-
- if (caseService2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+caseService2.getActions().size());
- }
-
- if ((caseService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService3.getName());
- }
-
- if (caseService3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+caseService3.getActions().size());
- }
-
- if ((caseService3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-
- public void testInsertSwitchActionWithSubsequentActions() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- service.addAction(act1, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- If mobj=new If();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService switchService=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((switchService == null || join == null) && iter.hasNext()) {
- ESBService s = iter.next();
- if (s != service) {
- if (switchService == null) {
- switchService = s;
- } else if (join == null) {
- join = s;
- }
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act1) {
- fail("Join action is not test ESB action");
- }
- }
-
- public void testInsertSwitchActionWithPrecedingActions() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- If mobj=new If();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("First action not test ESB action");
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)service.getActions().get(1);
-
- ESBService addedService=model.getService(
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY),
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
-
- if (addedService == null) {
- fail("Failed to find service '"+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+"' '"+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+"'");
- }
-
- if (addedService.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((addedService.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 4) {
- fail("Four services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (join == null && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act2) {
- fail("Join action is not test ESB action");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,624 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.ParallelModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.analysis.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class ParallelModelChangeRuleTest extends TestCase {
-
- public void testInsertParallelAction() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Parallel mobj=new Parallel();
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- Block cb2=new Block();
- mobj.getBlocks().add(cb2);
-
- Block cb3=new Block();
- mobj.getBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- ESBService s3=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null || s3 == null ||
- join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- s3 = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 4) {
- fail("Four path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(1) immediate not set");
- }
-
- if (s1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+s1.getActions().size());
- }
-
- if ((s1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)s1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(2) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(2) immediate not set");
- }
-
- if (s2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+s2.getActions().size());
- }
-
- if ((s2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(3) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s3.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(3) immediate not set");
- }
-
- if (s3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+s3.getActions().size());
- }
-
- if ((s3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(3);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
- }
-
- public void testInsertParallelActionWithImmediateFalse() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
-
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- Parallel mobj=new Parallel();
- conv.getBlock().getContents().add(mobj);
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- cb1.getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("path(1) should not be immediate");
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
- }
-
- public void testInsertParallelActionWithImmediateTrue() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setFromRole(role);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- Parallel mobj=new Parallel();
- conv.getBlock().getContents().add(mobj);
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- cb1.getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(1) should be immediate");
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
- }
-
- public void testInsertParallelMiddleAction() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject moref=new ModelObject() {};
- moref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Parallel mobj=new Parallel();
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- Block cb2=new Block();
- mobj.getBlocks().add(cb2);
-
- Block cb3=new Block();
- mobj.getBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, moref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action was not test ESB action 1: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (join == null && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(1);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 4) {
- fail("Four path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(3);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
-
- if (join.getActions().size() != 1) {
- fail("Expecting 1 join action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act2) {
- fail("Action was not test ESB action 2: "+join.getActions().get(0));
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,471 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.RunModelChangeRule;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class RunModelChangeRuleTest extends TestCase {
-
- public void testInsertPerformAction() {
- String runName="subconv";
-
- RunModelChangeRule rule=new RunModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Run mobj=new Run();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(0);
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
- if (newService.getCategory().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
- fail("Perform return service category '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- newService.getCategory());
- }
-
- if (newService.getName().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)) == false) {
- fail("Perform return service name '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)+
- "' invalid, expecting: "+
- newService.getName());
- }
- }
-
- public void testInsertPerformActionMiddle() {
- String runName="subconv";
-
- RunModelChangeRule rule=new RunModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject moref=new ModelObject() {};
- moref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Run mobj=new Run();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
-
- if (rule.insert(context, model, mobj, moref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Expecting test ESB action 1: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(1);
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
- if (newService.getCategory().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
- fail("Perform return service category '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- newService.getCategory());
- }
-
- if (newService.getName().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)) == false) {
- fail("Perform return service name '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)+
- "' invalid, expecting: "+
- newService.getName());
- }
-
- if (newService.getActions().size() != 1) {
- fail("Return service should have 1 action: "+newService.getActions().size());
- }
-
- if (newService.getActions().get(0) != act2) {
- fail("Expecting test ESB action 2: "+newService.getActions().get(0));
- }
-
- }
- public void testDeletePerformActionMiddle() {
- String runName="subconv";
-
- RunModelChangeRule rule=new RunModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Run mobj=new Run();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- TestESBAction act2=new TestESBAction();
- ((ESBService)context.getParent()).addAction(act2, -1);
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Expecting test ESB action 1: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(1);
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
- if (newService.getCategory().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
- fail("Perform return service category '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- newService.getCategory());
- }
-
- if (newService.getName().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)) == false) {
- fail("Perform return service name '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)+
- "' invalid, expecting: "+
- newService.getName());
- }
-
- if (newService.getActions().size() != 1) {
- fail("Return service should have 1 action: "+newService.getActions().size());
- }
-
- if (newService.getActions().get(0) != act2) {
- fail("Expecting test ESB action 2: "+newService.getActions().get(0));
- }
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- action.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // TODO: Need to pass representation of last interaction
- if (rule.delete(context, model, acts.get(0)) == false) {
- fail("Failed to delete spawn");
- }
-
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Expecting test ESB action 1: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- ScheduleStateAction ssa=(ScheduleStateAction)service.getActions().get(1);
-
- if (ssa.getPropertyValue(PerformAction.SERVICE_CATEGORY).equals(newService.getCategory()) == false) {
- fail("Category not correct '"+ssa.getPropertyValue(PerformAction.SERVICE_CATEGORY)+
- "' expecting: "+newService.getCategory());
- }
-
- if (ssa.getPropertyValue(PerformAction.SERVICE_NAME).equals(newService.getName()) == false) {
- fail("Name not correct '"+ssa.getPropertyValue(PerformAction.SERVICE_NAME)+
- "' expecting: "+newService.getName());
- }
-
- if (newService.getActions().size() != 1) {
- fail("Return service should have 1 action: "+newService.getActions().size());
- }
-
- if (newService.getActions().get(0) != act2) {
- fail("Expecting test ESB action 2: "+newService.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,345 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.RunModelChangeRule;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class SpawnModelChangeRuleTest extends TestCase {
-
- public void testInsertPerformAction() {
- String runName="subconv";
-
- SpawnModelChangeRule rule=new SpawnModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Spawn mobj=new Spawn();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(0);
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
- }
-
- public void testInsertPerformActionMiddle() {
- String runName="subconv";
-
- SpawnModelChangeRule rule=new SpawnModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject moref=new ModelObject() {};
- moref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Spawn mobj=new Spawn();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
-
- if (rule.insert(context, model, mobj, moref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 3) {
- fail("Expecting 3 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Expecting test ESB action 1: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(1));
- }
-
- if (service.getActions().get(2) != act2) {
- fail("Expecting test ESB action 2: "+service.getActions().get(2));
- }
-
- if (model.getServices().size() != 1) {
- fail("One services expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(1);
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
- }
-
- public void testDeletePerformActionMiddle() {
- String runName="subconv";
-
- SpawnModelChangeRule rule=new SpawnModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Spawn mobj=new Spawn();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- // Check actions
- if (service.getActions().size() != 3) {
- fail("Expecting 3 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Expecting test ESB action 1: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(1));
- }
-
- if (service.getActions().get(2) != act2) {
- fail("Expecting test ESB action 2: "+service.getActions().get(2));
- }
-
- if (model.getServices().size() != 1) {
- fail("One services expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(1);
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
-
- java.util.List<Activity> acts=new java.util.Vector<Activity>();
-
- DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
- action.convert(acts, convContext);
-
- if (acts.size() != 1) {
- fail("Expecting 1 activity: "+acts.size());
- }
-
- // TODO: Need to pass representation of last interaction
- if (rule.delete(context, model, acts.get(0)) == false) {
- fail("Failed to delete spawn");
- }
-
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Expecting test ESB action 1: "+service.getActions().get(0));
- }
-
- if (service.getActions().get(1) != act2) {
- fail("Expecting test ESB action 2: "+service.getActions().get(1));
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,903 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.WhenModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class WhenModelChangeRuleTest extends TestCase {
-
- public void testInsertWhenAction() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- When mobj=new When();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhenAction) == false) {
- fail("Action was not WhenAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- ESBService s3=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null ||
- s3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- s3 = serv;
- }
- }
-
- WhenAction action=(WhenAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("when") == false) {
- fail("when(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (s1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+s1.getActions().size());
- }
-
- if ((s1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)s1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("when") == false) {
- fail("when(2) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
-
- if (s2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+s2.getActions().size());
- }
-
- if ((s2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("when") == false) {
- fail("when(3) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s3.getName());
- }
-
- if (s3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+s3.getActions().size());
- }
-
- if ((s3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-
- public void testInsertWhenActionWithSubsequentActions() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- service.addAction(act1, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- When mobj=new When();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhenAction) == false) {
- fail("Action was not WhenAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- ESBService s3=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null ||
- s3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- s3 = serv;
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act1) {
- fail("Join action is not test ESB action");
- }
- }
-
-
- public void testInsertWhenActionWithPrecedingActions() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- When mobj=new When();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action 1 was not test ESB action");
- }
-
- if ((service.getActions().get(1) instanceof WhenAction) == false) {
- fail("Action 2 was not WhenAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- ESBService s3=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null ||
- s3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- s3 = serv;
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act2) {
- fail("Join action is not test ESB action 2");
- }
- }
-
- public void testInsertSwitchAction() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- When mobj=new When();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService switchService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (switchService == null && iter.hasNext()) {
- switchService = iter.next();
- if (switchService == service) {
- switchService = null;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 1) {
- fail("Only one path child expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Switch expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(switchService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+switchService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(switchService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+switchService.getName());
- }
- }
-
- public void testInsertSwitchMultipleCaseAction() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- When mobj=new When();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- ESBService caseService1=null;
- ESBService caseService2=null;
- ESBService caseService3=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((caseService1 == null || caseService2 == null ||
- caseService3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- caseService1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- caseService2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- caseService3 = serv;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Case expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService1.getName());
- }
-
- if (caseService1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+caseService1.getActions().size());
- }
-
- if ((caseService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)caseService1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Case expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService2.getName());
- }
-
- if (caseService2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+caseService2.getActions().size());
- }
-
- if ((caseService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService3.getName());
- }
-
- if (caseService3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+caseService3.getActions().size());
- }
-
- if ((caseService3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-
- public void testInsertSwitchActionWithSubsequentActions() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- service.addAction(act1, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- When mobj=new When();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- ESBService caseService1=null;
- ESBService caseService2=null;
- ESBService caseService3=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((caseService1 == null || caseService2 == null ||
- caseService3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- caseService1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- caseService2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- caseService3 = serv;
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act1) {
- fail("Join action is not test ESB action");
- }
- }
-
- public void testInsertSwitchActionWithPrecedingActions() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject ref=new ModelObject() {};
- ref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- When mobj=new When();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, ref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("First action not test ESB action");
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)service.getActions().get(1);
-
- ESBService addedService=model.getService(
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY),
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
-
- if (addedService == null) {
- fail("Failed to find service '"+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+"' '"+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+"'");
- }
-
- if (addedService.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((addedService.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 6) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (join == null && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- }
-
- if (join.getActions().size() != 1) {
- fail("Join service does not have 1 action: "+join.getActions().size());
- }
-
- if (join.getActions().get(0) != act2) {
- fail("Join action is not test ESB action");
- }
- }
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java 2008-10-21 10:57:55 UTC (rev 399)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,706 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.WhileModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.analysis.TestLookaheadAnalyser;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class WhileModelChangeRuleTest extends TestCase {
-
- public void testInsertWhileActionInitiator() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s2 = serv;
- }
- }
-
- WhileAction action=(WhileAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 0) {
- fail("Should have no message types: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileActionRecipient() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getBlock().getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s2 = serv;
- }
- }
-
- WhileAction action=(WhileAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 1) {
- fail("Should have single message type: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileActionRecipientNoRecvLookahead() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setFromRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getBlock().getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s2 = serv;
- }
- }
-
- WhileAction action=(WhileAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 0) {
- fail("Should have no message type: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileNotFirstSessionAction() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Make session based service
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, null) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action was not test ESB action: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- ScheduleStateAction whileSchedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (model.getServices().size() != 4) {
- fail("Four services expected: "+model.getServices().size());
- }
-
- ESBService whileService=null;
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null || whileService == null) &&
- iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- whileService = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- }
-
- if (whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(whileService.getCategory()) == false) {
- fail("While schedule action category '"+
- whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+
- "' not expected: "+whileService.getCategory());
- }
-
- if (whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(whileService.getName()) == false) {
- fail("While schedule action service name '"+
- whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+
- "' not expected: "+whileService.getName());
- }
-
- if (whileService.getActions().size() != 1) {
- fail("Expecting 1 action: "+whileService.getActions().size());
- }
-
- if ((whileService.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+whileService.getActions().get(0));
- }
-
- WhileAction action=(WhileAction)whileService.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 0) {
- fail("Should have no message types: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileMiddleAction() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Make session based service
- TestESBAction act1=new TestESBAction();
- act1.setInitiator(true);
- act1.setSessionBased(true);
- service.addAction(act1, -1);
-
- TestESBAction act2=new TestESBAction();
- service.addAction(act2, -1);
-
- ModelObject moref=new ModelObject() {};
- moref.getSource().setObject(act2);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, moref) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if (service.getActions().get(0) != act1) {
- fail("Action was not test ESB action: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- ScheduleStateAction whileSchedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (model.getServices().size() != 4) {
- fail("Four services expected: "+model.getServices().size());
- }
-
- ESBService whileService=null;
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null || whileService == null) &&
- iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- whileService = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- }
-
- if (s2.getActions().size() != 1) {
- fail("Expecting 1 action in exit service: "+s2.getActions().size());
- }
-
- if (s2.getActions().get(0) != act2) {
- fail("Action in exit is not test ESB action: "+s2.getActions().get(0));
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/generator)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapperTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/generator/TypeMapperTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/TypeMapperTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,9 +15,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.generator;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.generator;
-import org.jboss.tools.overlord.cdl.jbossesb.generator.TypeMapper;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.generator.TypeMapper;
import junit.framework.TestCase;
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContextTest.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultConversionContextTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContextTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultConversionContextTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultConversionContext;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBService;
+
+import junit.framework.TestCase;
+
+public class DefaultConversionContextTest extends TestCase {
+
+ public void testIsJoin() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ DefaultConversionContext context=new DefaultConversionContext(null);
+ context.markJoin(service);
+
+ if (context.isJoin(service) == false) {
+ fail("Service should be join");
+ }
+ }
+
+ public void testIsJoinFalse() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ DefaultConversionContext context=new DefaultConversionContext(null);
+
+ if (context.isJoin(service)) {
+ fail("Service should not be join");
+ }
+ }
+
+ public void testJoinProcessing() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ DefaultConversionContext context=new DefaultConversionContext(null);
+ context.markJoin(service);
+
+ if (context.isJoin(service) == false) {
+ fail("Service should be join");
+ }
+
+ context.processing(service);
+
+ if (context.isJoin(service)) {
+ fail("Service should no longer be marked as join");
+ }
+ }
+
+ public void testIsOnStack() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ DefaultConversionContext context=new DefaultConversionContext(null);
+ context.push(service);
+
+ if (context.isOnStack(service) == false) {
+ fail("Service should be on stack");
+ }
+ }
+
+ public void testIsOnStackFalse() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ DefaultConversionContext context=new DefaultConversionContext(null);
+
+ if (context.isOnStack(service)) {
+ fail("Service should not be on stack");
+ }
+ }
+
+ public void testStackPushPop() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ DefaultConversionContext context=new DefaultConversionContext(null);
+ context.push(service);
+
+ if (context.isOnStack(service) == false) {
+ fail("Service should be on stack");
+ }
+
+ context.pop(service);
+
+ if (context.isOnStack(service)) {
+ fail("Service should no longer be on stack after pop");
+ }
+ }
+
+ public void testGetRole() {
+ String role="myRole";
+
+ DefaultConversionContext context=new DefaultConversionContext(role);
+
+ if (context.getRole() == null) {
+ fail("Role is null");
+ }
+
+ if (context.getRole().equals(role) == false) {
+ fail("Role should be '"+role+"', but got: "+context.getRole());
+ }
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModelTest.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBLanguageModelTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModelTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBLanguageModelTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,270 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+import org.scribble.model.*;
+
+public class DefaultESBLanguageModelTest extends TestCase {
+
+ public void testBaseConfiguration() {
+
+ ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
+
+ org.w3c.dom.Element config=model.getESBConfiguration();
+
+ if (config.getNodeName().equals(DefaultESBLanguageModel.TOP_LEVEL_ELEMENT) == false) {
+ fail("Top level element should be '"+
+ DefaultESBLanguageModel.TOP_LEVEL_ELEMENT+"' but found: "+
+ config.getNodeName());
+ }
+
+ boolean f_providers=false;
+ boolean f_services=false;
+
+ org.w3c.dom.NodeList nl=config.getChildNodes();
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element elem=
+ (org.w3c.dom.Element)nl.item(i);
+
+ if (elem.getNodeName().equals(DefaultESBLanguageModel.PROVIDERS_ELEMENT)) {
+
+ if (f_providers) {
+ fail("Duplicate '"+DefaultESBLanguageModel.PROVIDERS_ELEMENT+"' elements");
+ } else {
+
+ // Check if jms provider defined
+ org.w3c.dom.NodeList nl2=
+ elem.getChildNodes();
+ boolean f_jmsProvider=false;
+
+ for (int j=0; j < nl2.getLength(); j++) {
+ if (nl2.item(j) instanceof org.w3c.dom.Element) {
+
+ if (nl2.item(j).getNodeName().equals(
+ DefaultESBLanguageModel.JMS_PROVIDER_ELEMENT)) {
+
+ if (f_jmsProvider) {
+ fail("JMS Provider already defined");
+ }
+
+ f_jmsProvider = true;
+ } else {
+ fail("Unknown provider element: "+
+ nl2.item(j).getNodeName());
+ }
+ }
+ }
+
+ if (f_jmsProvider == false) {
+ fail("JMS provider not defined");
+ }
+ }
+
+ f_providers = true;
+ } else if (elem.getNodeName().equals(DefaultESBLanguageModel.SERVICES_ELEMENT)) {
+
+ if (f_services) {
+ fail("Duplicate '"+DefaultESBLanguageModel.SERVICES_ELEMENT+"' elements");
+ }
+
+ f_services = true;
+ } else {
+ fail("Unknown element: "+nl.item(i).getNodeName());
+ }
+ }
+ }
+
+ if (f_providers == false) {
+ fail("Element '"+DefaultESBLanguageModel.PROVIDERS_ELEMENT+"' not found");
+ }
+
+ if (f_services == false) {
+ fail("Element '"+DefaultESBLanguageModel.SERVICES_ELEMENT+"' not found");
+ }
+ }
+
+ public void testAddService() {
+ String busId="TestBusId";
+ String category="category.one";
+ String name="serviceName";
+
+ ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
+
+ org.w3c.dom.Element config=model.getESBConfiguration();
+
+ TestESBService service=new TestESBService();
+ service.setJMSBusIdRef(busId);
+ service.setCategory(category);
+ service.setName(name);
+
+ model.addService(service);
+
+ if (service.getJMSBusIdRef() == null) {
+ fail("JMS BusIdRef not set");
+ }
+
+ if (service.getJMSBusIdRef().equals(busId) == false) {
+ fail("Bus Id should be '"+busId+"', but got: "+service.getJMSBusIdRef());
+ }
+
+ // Check that the jms bus id has been created
+ org.w3c.dom.NodeList nl=config.getElementsByTagName(
+ DefaultESBLanguageModel.JMS_PROVIDER_ELEMENT);
+
+ if (nl.getLength() != 1) {
+ fail("JMS provider element not found");
+ }
+
+ org.w3c.dom.Element provider=(org.w3c.dom.Element)nl.item(0);
+
+ nl = provider.getElementsByTagName(
+ DefaultESBLanguageModel.JMS_BUS_ELEMENT);
+
+ if (nl.getLength() != 1) {
+ fail("JMS bus element not found");
+ }
+
+ org.w3c.dom.Element bus=(org.w3c.dom.Element)nl.item(0);
+
+ if (bus.getAttribute("busid").equals(busId) == false) {
+ fail("Bus had invalid busid '"+bus.getAttribute("busid")+
+ "', was expecting: "+busId);
+ }
+
+ if (bus.getParentNode() != provider) {
+ fail("Bus not contained directly within provider");
+ }
+
+ // Check bus retrieved directly
+ org.w3c.dom.Element bus2=model.findJMSBus(busId);
+
+ if (bus2 != bus) {
+ fail("Bus elements not the same");
+ }
+ }
+
+ public void testRemoveService() {
+ String busId="TestBusId";
+ String category="category.two";
+ String name="serviceName";
+
+ ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
+
+ org.w3c.dom.Element config=model.getESBConfiguration();
+
+ TestESBService service=new TestESBService();
+ service.setJMSBusIdRef(busId);
+ service.setCategory(category);
+ service.setName(name);
+
+ model.addService(service);
+
+ // Check that the jms bus id has been created
+ org.w3c.dom.NodeList nl=config.getElementsByTagName(
+ DefaultESBLanguageModel.JMS_PROVIDER_ELEMENT);
+
+ if (nl.getLength() != 1) {
+ fail("JMS provider element not found");
+ }
+
+ org.w3c.dom.Element provider=(org.w3c.dom.Element)nl.item(0);
+
+ nl = provider.getElementsByTagName(
+ DefaultESBLanguageModel.JMS_BUS_ELEMENT);
+
+ if (nl.getLength() != 1) {
+ fail("JMS bus element not found");
+ }
+
+ // Remove the service and check that the bus entry
+ // is no longer there
+ model.removeService(service);
+
+ nl = provider.getElementsByTagName(
+ DefaultESBLanguageModel.JMS_BUS_ELEMENT);
+
+ if (nl.getLength() != 0) {
+ fail("JMS bus element should NOT be found");
+ }
+ }
+
+ public void testAddServiceWithNoBusId() {
+ String category="category.one";
+ String name="serviceName";
+
+ ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
+
+ TestESBService service=new TestESBService();
+ service.setCategory(category);
+ service.setName(name);
+
+ model.addService(service);
+
+ if (service.getJMSBusIdRef() == null) {
+ fail("JMS BusIdRef not set");
+ }
+ }
+
+ public void testAddMultipleServiceWithNoBusId() {
+ String category="category.one";
+ String name1="serviceName1";
+ String name2="serviceName2";
+
+ ModelReference ref=new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel model=new DefaultESBLanguageModel(ref);
+
+ TestESBService service1=new TestESBService();
+ service1.setCategory(category);
+ service1.setName(name1);
+
+ model.addService(service1);
+
+ if (service1.getJMSBusIdRef() == null) {
+ fail("JMS BusIdRef1 not set");
+ }
+
+ TestESBService service2=new TestESBService();
+ service2.setCategory(category);
+ service2.setName(name2);
+
+ model.addService(service2);
+
+ if (service2.getJMSBusIdRef() == null) {
+ fail("JMS BusIdRef2 not set");
+ }
+
+ if (service1.getJMSBusIdRef().equals(service2.getJMSBusIdRef())) {
+ fail("Service JMS bus ids should be unique");
+ }
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBServiceTest.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/DefaultESBServiceTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBServiceTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBServiceTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,365 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+
+public class DefaultESBServiceTest extends TestCase {
+
+ public void testValidateSessionClassRequired() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+
+ service.getActions().add(act1);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_SESSION_CLASS",
+ new String[]{}));
+
+ service.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateSessionClassNotRequired() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestModelListener l=new TestModelListener();
+
+ service.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testIsLoop() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+ act1.setLoop(true);
+
+ service.getActions().add(act1);
+
+ if (service.isLoop() == false) {
+ fail("Service should be loop");
+ }
+ }
+
+ public void testIsLoopFalse() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+
+ service.getActions().add(act1);
+
+ if (service.isLoop()) {
+ fail("Service is not a loop");
+ }
+ }
+
+ public void testIsRoot() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+ act1.setCreateSession(true);
+ act1.setPropertyValue(DefaultESBService.ROOT_PROPERTY, "true");
+
+ service.getActions().add(act1);
+
+ if (service.isRoot() == false) {
+ fail("Service should be root");
+ }
+ }
+
+ public void testIsRootFalse() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+
+ service.getActions().add(act1);
+
+ if (service.isRoot()) {
+ fail("Service should NOT be root");
+ }
+ }
+
+ public void testIsSessionBased() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+
+ service.getActions().add(act1);
+
+ if (service.isSessionBased() == false) {
+ fail("Service should be SessionBased");
+ }
+ }
+
+ public void testIsSessionBasedFalse() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+
+ service.getActions().add(act1);
+
+ if (service.isSessionBased()) {
+ fail("Service should NOT be SessionBased");
+ }
+ }
+
+ public void testIsCreateSession() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+ act1.setCreateSession(true);
+
+ service.getActions().add(act1);
+
+ if (service.isCreateSession() == false) {
+ fail("Service should be 'create session'");
+ }
+ }
+
+ public void testIsCreateSessionFalse() {
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+
+ service.getActions().add(act1);
+
+ if (service.isCreateSession()) {
+ fail("Service should NOT be 'create session'");
+ }
+ }
+
+ public void testGetServiceName() {
+ String name="serviceName1";
+
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+ act1.setCreateSession(true);
+ act1.setPropertyValue(DefaultESBService.SERVICE_DESCRIPTION_NAME_PROPERTY,
+ name);
+
+ service.getActions().add(act1);
+
+ if (service.getServiceDescriptionName().equals(name) == false) {
+ fail("Service name '"+service.getServiceDescriptionName()+
+ "' invalid, expecting: "+name);
+ }
+ }
+
+ public void testGetConversationType() {
+ String name="convType1";
+
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+ act1.setCreateSession(true);
+ act1.setPropertyValue(DefaultESBService.CONVERSATION_TYPE_PROPERTY,
+ name);
+
+ service.getActions().add(act1);
+
+ if (service.getConversationType().equals(name) == false) {
+ fail("Conversation type '"+service.getConversationType()+
+ "' invalid, expecting: "+name);
+ }
+ }
+
+ public void testGetSessionName() {
+ String name="session1";
+
+ DefaultESBService service=new DefaultESBService(null, null);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setSessionBased(true);
+ act1.setPropertyValue(DefaultESBService.BUSINESS_OBJECT_TYPE_PROPERTY,
+ name);
+
+ service.getActions().add(act1);
+
+ if (service.getSessionName().equals(name) == false) {
+ fail("Session name '"+service.getSessionName()+
+ "' invalid, expecting: "+name);
+ }
+ }
+
+ public void testBaseConfiguration() {
+ String category="category";
+ String name="name";
+
+ DefaultESBService service=new DefaultESBService(new TestESBLanguageModel(),
+ category, name);
+
+ org.w3c.dom.Element servElem=service.getService();
+
+ if (servElem == null) {
+ fail("Service element is null");
+ }
+
+ if (servElem.getNodeName().equals(DefaultESBService.SERVICE_ELEMENT) == false) {
+ fail("Root element is incorrect: "+servElem.getNodeName());
+ }
+
+ if (servElem.getAttribute(DefaultESBService.CATEGORY_ATTR).equals(category) == false) {
+ fail("Category invalid: "+servElem.getAttribute(DefaultESBService.CATEGORY_ATTR));
+ }
+
+ if (servElem.getAttribute(DefaultESBService.NAME_ATTR).equals(name) == false) {
+ fail("Name invalid: "+servElem.getAttribute(DefaultESBService.NAME_ATTR));
+ }
+ }
+
+ public void testSetInitialBusIdRef() {
+ String category="category";
+ String name="name";
+ String busId="myBusId";
+
+ DefaultESBService service=new DefaultESBService(new TestESBLanguageModel(),
+ category, name);
+
+ org.w3c.dom.Element servElem=service.getService();
+
+ service.setJMSBusIdRef(busId);
+
+ if (service.getJMSBusIdRef() == null) {
+ fail("Bus id not set");
+ }
+
+ if (service.getJMSBusIdRef().equals(busId) == false) {
+ fail("Bus Id not '"+busId+"', got: "+service.getJMSBusIdRef());
+ }
+
+ org.w3c.dom.NodeList nl=servElem.getElementsByTagName(DefaultESBService.JMS_LISTENER_ELEMENT);
+
+ if (nl.getLength() != 1) {
+ fail("Expecting one JMS listener element, but got: "+
+ nl.getLength());
+ }
+
+ org.w3c.dom.Element jmslistener=(org.w3c.dom.Element)nl.item(0);
+
+ if (jmslistener.getParentNode().getNodeName().equals(DefaultESBService.LISTENERS_ELEMENT) == false) {
+ fail("JMS listener parent not expected");
+ }
+
+ if (jmslistener.getParentNode().getParentNode() != servElem) {
+ fail("JMS listener grandparent should be service");
+ }
+
+ if (jmslistener.getAttribute(DefaultESBService.BUSIDREF_ATTR).equals(busId) == false) {
+ fail("Bus Id not '"+busId+"', got: "+jmslistener.getAttribute(DefaultESBService.BUSIDREF_ATTR));
+ }
+
+ if (jmslistener.hasAttribute(DefaultESBService.NAME_ATTR) == false) {
+ fail("Name attribute not set on jms listener");
+ }
+
+ if (jmslistener.hasAttribute(DefaultESBService.MAX_THREADS_ATTR) == false) {
+ fail("Max Threads attribute not set on jms listener");
+ }
+ }
+
+ public void testChangeBusIdRef() {
+ String initialBusId="busId1";
+ String initialName="name1";
+ String initialMaxThreads="2";
+ String changedBusId="busId2";
+
+ org.w3c.dom.Element top=null;
+
+ // Create an empty document
+ org.w3c.dom.Document doc=null;
+ try {
+ doc = javax.xml.parsers.DocumentBuilderFactory.
+ newInstance().newDocumentBuilder().newDocument();
+
+ top = doc.createElement(DefaultESBLanguageModel.TOP_LEVEL_ELEMENT);
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ org.w3c.dom.Element services=doc.createElement(DefaultESBLanguageModel.SERVICES_ELEMENT);
+ top.appendChild(services);
+
+ org.w3c.dom.Element serviceElem=doc.createElement(DefaultESBLanguageModel.SERVICE_ELEMENT);
+ services.appendChild(serviceElem);
+
+ org.w3c.dom.Element listeners=doc.createElement(DefaultESBService.LISTENERS_ELEMENT);
+ serviceElem.appendChild(listeners);
+
+ org.w3c.dom.Element jmslistener=doc.createElement(DefaultESBService.JMS_LISTENER_ELEMENT);
+ listeners.appendChild(jmslistener);
+
+ jmslistener.setAttribute(DefaultESBService.BUSIDREF_ATTR, initialBusId);
+ jmslistener.setAttribute(DefaultESBService.NAME_ATTR, initialName);
+ jmslistener.setAttribute(DefaultESBService.MAX_THREADS_ATTR, initialMaxThreads);
+
+ DefaultESBService service=new DefaultESBService(new TestESBLanguageModel(),
+ serviceElem);
+
+ if (service.getJMSBusIdRef() == null) {
+ fail("JMS bus id not set");
+ }
+
+ if (service.getJMSBusIdRef().equals(initialBusId) == false) {
+ fail("JMS bus id not '"+initialBusId+"', got: "+service.getJMSBusIdRef());
+ }
+
+ service.setJMSBusIdRef(changedBusId);
+
+ if (service.getJMSBusIdRef().equals(changedBusId) == false) {
+ fail("Changed JMS bus id not '"+changedBusId+"', got: "+service.getJMSBusIdRef());
+ }
+
+ if (jmslistener.getAttribute(DefaultESBService.BUSIDREF_ATTR).equals(changedBusId)==false) {
+ fail("Changed bus id not reflected in element");
+ }
+
+ if (jmslistener.getAttribute(DefaultESBService.NAME_ATTR).equals(initialName)==false) {
+ fail("Name attribute incorrect");
+ }
+
+ if (jmslistener.getAttribute(DefaultESBService.MAX_THREADS_ATTR).equals(initialMaxThreads)==false) {
+ fail("MaxThreads attribute incorrect");
+ }
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBAction.java (from rev 327, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBAction.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBAction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBAction.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ConversionContext;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBAction;
+import org.scribble.model.Activity;
+import org.scribble.model.ModelListener;
+import org.w3c.dom.Element;
+
+public class TestESBAction implements ESBAction {
+
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Element getAction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getActionClass() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getPropertyValue(String property) {
+ return(m_property.get(property));
+ }
+
+ public void setPropertyValue(String property, String value) {
+ m_property.put(property, value);
+ }
+
+ public void initializeLinks() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isInitiator() {
+ return(m_initiator);
+ }
+
+ public void setInitiator(boolean initiator) {
+ m_initiator = initiator;
+ }
+
+ public boolean isLoop() {
+ return(m_loop);
+ }
+
+ public void setLoop(boolean bool) {
+ m_loop = bool;
+ }
+
+ public boolean isPerform() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isSessionBased() {
+ return(m_sessionBased);
+ }
+
+ public void setSessionBased(boolean bool) {
+ m_sessionBased = bool;
+ }
+
+ public boolean isCreateSession() {
+ return(m_createSession);
+ }
+
+ public void setCreateSession(boolean bool) {
+ m_createSession = bool;
+ }
+
+ public boolean isGateway() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean hasProperty(String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void validate(ModelListener l) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private boolean m_sessionBased=false;
+ private boolean m_loop=false;
+ private boolean m_initiator=false;
+ private boolean m_createSession=false;
+ private java.util.Map<String,String> m_property=new java.util.Hashtable<String, String>();
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBLanguageModel.java (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBLanguageModel.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBLanguageModel.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBLanguageModel.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.Collection;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBService;
+import org.scribble.model.ModelListener;
+import org.scribble.model.ModelReference;
+import org.w3c.dom.Element;
+
+public class TestESBLanguageModel extends org.scribble.lang.model.LanguageModel
+ implements org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel {
+
+ public TestESBLanguageModel() {
+ org.w3c.dom.Document doc=null;
+
+ // Create an empty document
+ try {
+ doc = javax.xml.parsers.DocumentBuilderFactory.
+ newInstance().newDocumentBuilder().newDocument();
+
+ m_esbConfig = doc.createElement(DefaultESBLanguageModel.TOP_LEVEL_ELEMENT);
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ public String getOriginalContents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ModelReference getModelReference() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ESBService createService(String category, String name) {
+ TestESBService ret=new TestESBService(category, name);
+
+ org.w3c.dom.Element service=m_esbConfig.getOwnerDocument().
+ createElement(DefaultESBService.SERVICE_ELEMENT);
+ m_esbConfig.appendChild(service);
+
+ ret.setService(service);
+
+ return(ret);
+ }
+
+ public void addService(ESBService service) {
+ m_services.put(service.getCategory()+":"+service.getName(), service);
+ }
+
+ public void removeService(ESBService service) {
+ m_services.remove(service.getCategory()+":"+service.getName());
+ }
+
+ public ESBService getService(String category, String name) {
+ return(m_services.get(category+":"+name));
+ }
+
+ public Collection<ESBService> getServices() {
+ return(m_services.values());
+ }
+
+ public ESBService getGatewayService() {
+ return(m_gatewayService);
+ }
+
+ public void setGatewayService(ESBService gw) {
+ m_gatewayService = gw;
+ }
+
+ public void validate(ModelListener l) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getUniqueServiceName(String category, String name) {
+ return("serviceName__"+m_count++);
+ }
+
+ public Element getESBConfiguration() {
+ return(m_esbConfig);
+ }
+
+ @Override
+ public String getNotation() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getJMSDefinition(String jmsBusId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private java.util.Map<String,ESBService> m_services=new java.util.Hashtable<String,ESBService>();
+ private ESBService m_gatewayService=null;
+ private org.w3c.dom.Element m_esbConfig=null;
+ private int m_count=0;
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBService.java (from rev 327, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestESBService.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBService.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestESBService.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,222 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ConversionContext;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBLanguageModel;
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+import org.w3c.dom.Element;
+
+public class TestESBService extends ModelObject
+ implements org.jboss.tools.overlord.cdl.runtime.jbossesb.model.ESBService {
+
+ public TestESBService() {
+ }
+
+ public TestESBService(String category, String name) {
+ m_category = category;
+ m_name = name;
+ }
+
+ public void convert(List<Activity> activities, ConversionContext context) {
+ activities.addAll(m_contents);
+ }
+
+ public Conversation convert(ConversionContext context) {
+ return(null);
+ }
+
+ public List<Activity> getContents() {
+ return(m_contents);
+ }
+
+ public List<ESBAction> getActions() {
+ return(m_actions);
+ }
+
+ public void setCategory(String cat) {
+ m_category = cat;
+ }
+
+ public String getCategory() {
+ return(m_category);
+ }
+
+ public void setConversationType(String type) {
+ m_conversationType = type;
+ }
+
+ public String getConversationType() {
+ return(m_conversationType);
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ public String getName() {
+ return(m_name);
+ }
+
+ public void setModel(ESBLanguageModel model) {
+ m_model = model;
+ }
+
+ public ESBLanguageModel getModel() {
+ return(m_model);
+ }
+
+ public Element getService() {
+ return(m_service);
+ }
+
+ public void setService(Element service) {
+ m_service = service;
+ }
+
+ public ClassLoader getServiceClassLoader() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getServiceDescriptionName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getServicePosition() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public void setSessionClass(Class<?> cls) {
+ m_sessionClass = cls;
+ }
+
+ public Class<?> getSessionClass() {
+ return(m_sessionClass);
+ }
+
+ public String getSessionName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void initializeLinks() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setLoop(boolean bool) {
+ m_loop = bool;
+ }
+
+ public boolean isLoop() {
+ return(m_loop);
+ }
+
+ public void setRoot(boolean bool) {
+ m_root = bool;
+ }
+
+ public boolean isRoot() {
+ return(m_root);
+ }
+
+ public void setCreateSession(boolean bool) {
+ m_createSession = bool;
+ }
+
+ public boolean isCreateSession() {
+ return(m_createSession);
+ }
+
+ public void setSessionBased(boolean bool) {
+ m_sessionBased = bool;
+ }
+
+ public boolean isSessionBased() {
+ return(m_sessionBased);
+ }
+
+ public ESBAction getFirstSessionBasedAction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isGateway() {
+ return(m_gateway);
+ }
+
+ public void setGateway(boolean gw) {
+ m_gateway = gw;
+ }
+
+ public ESBAction getGatewayAction() {
+ return(m_gatewayAction);
+ }
+
+ public void setGatewayAction(ESBAction act) {
+ m_gatewayAction = act;
+ }
+
+ public void validate(ModelListener l) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getJMSBusIdRef() {
+ return(m_jmsBusIdRef);
+ }
+
+ public void setJMSBusIdRef(String busId) {
+ m_jmsBusIdRef = busId;
+ }
+
+ public void addAction(ESBAction action, int pos) {
+ if (pos == -1) {
+ m_actions.add(action);
+ } else {
+ m_actions.add(pos, action);
+ }
+ }
+
+ public boolean removeAction(ESBAction action) {
+ return(m_actions.remove(action));
+ }
+
+ private String m_category=null;
+ private String m_name=null;
+ private ESBLanguageModel m_model=null;
+ private Element m_service;
+ private List<ESBAction> m_actions=new java.util.Vector<ESBAction>();
+ private boolean m_root=false;
+ private boolean m_gateway=false;
+ private ESBAction m_gatewayAction=null;
+ private boolean m_loop=false;
+ private boolean m_sessionBased=false;
+ private boolean m_createSession=false;
+ private Class<?> m_sessionClass=null;
+ private String m_conversationType=null;
+ private List<Activity> m_contents=new java.util.Vector<Activity>();
+ private String m_jmsBusIdRef=null;
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestModelListener.java (from rev 309, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/TestModelListener.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestModelListener.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/TestModelListener.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model;
+
+import org.scribble.model.ModelIssue;
+import org.scribble.model.ModelObject;
+
+public class TestModelListener implements org.scribble.model.ModelListener {
+
+ public void error(ModelIssue issue) {
+ reported(issue.getMessage());
+ }
+
+ public void warning(ModelIssue issue) {
+ reported(issue.getMessage());
+ }
+
+ protected void reported(String mesg) {
+ if (mesg != null) {
+
+ // Check if in the list of messages to be
+ // detected
+ if (m_errorsToDetect.contains(mesg)) {
+ m_errorsToDetect.remove(mesg);
+ } else {
+ m_unexpectedErrors.add(mesg);
+ }
+ }
+ }
+
+ public void addExpectedError(String mesg) {
+ m_errorsToDetect.add(mesg);
+ }
+
+ public boolean isValid() {
+ // If there are no more errors to detect, and no
+ // unexpected errors have been reported, then
+ // the expression has been validated as expected
+ return(m_errorsToDetect.size() == 0 &&
+ m_unexpectedErrors.size() == 0);
+ }
+
+ public String invalidMessage() {
+ String ret="\r\n";
+
+ if (m_errorsToDetect.size() > 0) {
+ ret += "Errors not detected:\r\n";
+
+ for (int i=0; i < m_errorsToDetect.size(); i++) {
+ ret += m_errorsToDetect.get(i)+"\r\n";
+ }
+ }
+
+ if (m_unexpectedErrors.size() > 0) {
+ ret += "Unexpected Errors:\r\n";
+
+ for (int i=0; i < m_unexpectedErrors.size(); i++) {
+ ret += m_unexpectedErrors.get(i)+"\r\n";
+ }
+ }
+
+ return(ret);
+ }
+
+ private java.util.List<String> m_errorsToDetect=new java.util.Vector<String>();
+ private java.util.List<String> m_unexpectedErrors=new java.util.Vector<String>();
+ private java.util.List<String> m_messages=new java.util.Vector<String>();
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/CreateSessionActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/CreateSessionActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,13 +15,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.CreateSessionAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.UnsupportedAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.CreateSessionAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.UnsupportedAction;
import junit.framework.TestCase;
@@ -60,7 +60,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_BE_FIRST_ACTION",
new String[]{"CreateSession"}));
@@ -87,7 +87,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_CONVERSATION_TYPE",
new String[]{}));
@@ -156,7 +156,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_CONVERSATION_TYPE_ROLE",
new String[]{convType}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ESBActionTestUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ESBActionTestUtil.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ESBActionTestUtil.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/IfActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/IfActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,14 +15,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
import junit.framework.TestCase;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.IfAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.IfAction;
import org.scribble.model.*;
import org.scribble.conversation.model.*;
@@ -43,7 +43,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"paths"}));
@@ -79,17 +79,17 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1","name1"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat2","name2"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat3","name3"}));
@@ -132,7 +132,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_IF_ORDER_WRONG",
new String[]{}));
@@ -184,7 +184,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_IF_ORDER_WRONG",
new String[]{}));
@@ -235,7 +235,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_IF_ORDER_WRONG",
new String[]{}));
@@ -286,7 +286,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
@@ -337,7 +337,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_BOOLEAN",
new String[]{IfAction.IMMEDIATE}));
@@ -388,7 +388,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_BOOLEAN",
new String[]{IfAction.IMMEDIATE}));
@@ -439,7 +439,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_BOOLEAN",
new String[]{IfAction.IMMEDIATE}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/MessageRouterActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.MessageRouterAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.MessageRouterAction;
import junit.framework.TestCase;
@@ -41,7 +41,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"paths"}));
@@ -70,7 +70,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER",
new String[]{}));
@@ -104,7 +104,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1","name1"}));
@@ -143,7 +143,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_CANNOT_INITIATE_NON_ROOT",
new String[]{other.getCategory(),
other.getName()}));
@@ -184,7 +184,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_INITIATE_ROOT",
new String[]{other.getCategory(),
other.getName()}));
@@ -212,7 +212,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_ROUTER_ONE_OR_MORE_PATHS",
new String[]{}));
@@ -239,7 +239,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ParallelActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ParallelActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
import org.scribble.conversation.model.*;
import org.scribble.model.Activity;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.ParallelAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.ParallelAction;
import junit.framework.TestCase;
@@ -41,7 +41,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"paths"}));
@@ -77,17 +77,17 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1","name1"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat2","name2"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat3","name3"}));
@@ -132,7 +132,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PARALLEL_MORE_THAN_TWO_PATHS",
new String[]{}));
@@ -184,7 +184,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MULTIPLE_JOINS",
new String[]{}));
@@ -235,7 +235,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PARALLEL_PATH_AFTER_JOIN",
new String[]{}));
@@ -286,7 +286,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
@@ -337,7 +337,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_BOOLEAN",
new String[]{ParallelAction.IMMEDIATE}));
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,421 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.PerformAction;
-import org.scribble.conversation.model.*;
-import org.scribble.model.Activity;
-
-import junit.framework.TestCase;
-
-public class PerformActionTest extends TestCase {
-
- public void testValidateNoServiceCategory() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_NAME, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- PerformAction action=new PerformAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"serviceCategory"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateNoServiceName() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- PerformAction action=new PerformAction(service, elem);
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_SPECIFIED_PROPERTY",
- new String[]{"serviceName"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateService() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat1", "name1"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateReturnService() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(true);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
- "_NOT_FOUND_SERVICE_DESCRIPTOR",
- new String[]{"cat2", "name2"}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testValidateServiceCreatesSession() {
- TestESBService service=new TestESBService();
- service.setRoot(true);
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
- other1.setCreateSession(false);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- TestModelListener l=new TestModelListener();
-
- l.addExpectedError(org.scribble.util.MessageUtil.format(
- java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
- "_NOT_FOUND_PERFORM_CREATE_SESSION",
- new String[]{}));
-
- action.validate(l);
-
- if (l.isValid() == false) {
- fail(l.invalidMessage());
- }
- }
-
- public void testConvertRun() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Run) == false) {
- fail("Expecting an 'Run' activity");
- }
-
- Run runAction=(Run)act;
-
- if (runAction.getDefinition() == null) {
- fail("Run definition was null");
- }
-
- if (runAction.getDefinition().getBlock().getContents().size() != 1) {
- fail("Expecting one ran block activity: "+runAction.getDefinition().getBlock().getContents().size());
- }
-
- if (runAction.getDefinition().getBlock().getContents().get(0) != act1) {
- fail("Run model block should have 1 activity = act1");
- }
-
- if (activities.get(1) != act2) {
- fail("Subsequent activity after run was not act2");
- }
- }
-
- public void testConvertSpawn() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestActivity act1=new TestActivity();
- other1.getContents().add(act1);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 1) {
- fail("Expecting 1 activity, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Spawn) == false) {
- fail("Expecting a 'Spawn' activity");
- }
-
- Spawn spawnAction=(Spawn)act;
-
- if (spawnAction.getDefinition() == null) {
- fail("Run definition was null");
- }
-
- if (spawnAction.getDefinition().getBlock().getContents().size() != 1) {
- fail("Expecting one block activity: "+spawnAction.getDefinition().getBlock().getContents().size());
- }
-
- if (spawnAction.getDefinition().getBlock().getContents().get(0) != act1) {
- fail("Spawn model block should have 1 activity = act1");
- }
- }
-
- public void testConvertNotExcludingEmptyPath() {
- TestESBService service=new TestESBService();
-
- java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
- props.put(PerformAction.SERVICE_CATEGORY, "cat1");
- props.put(PerformAction.SERVICE_NAME, "name1");
- props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
- props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
-
- org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
-
- TestESBService other1=new TestESBService();
- other1.setCategory("cat1");
- other1.setName("name1");
-
- TestESBService other2=new TestESBService();
- other2.setCategory("cat2");
- other2.setName("name2");
-
- TestActivity act2=new TestActivity();
- other2.getContents().add(act2);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
- model.addService(other1);
- model.addService(other2);
- model.addService(service);
-
- service.setModel(model);
-
- PerformAction action=new PerformAction(service, elem);
- action.initializeLinks();
-
- service.getActions().add(action);
-
- java.util.List<Activity> activities=new java.util.Vector<Activity>();
-
- action.convert(activities, null);
-
- if (activities.size() != 2) {
- fail("Expecting two activities, but got: "+activities.size());
- }
-
- Activity act=activities.get(0);
-
- if ((act instanceof Run) == false) {
- fail("Expecting an 'Run' activity");
- }
-
- Run runAction=(Run)act;
-
- if (runAction.getDefinition() == null) {
- fail("Run definition was null");
- }
-
- if (runAction.getDefinition().getBlock().getContents().size() != 0) {
- fail("Expecting zero ran block activities: "+runAction.getDefinition().getBlock().getContents().size());
- }
-
- if (activities.get(1) != act2) {
- fail("Subsequent activity after run was not act2");
- }
- }
-
- public void testIsCreateSession() {
- TestESBService service=new TestESBService();
-
- PerformAction action=new PerformAction(service, null);
-
- if (action.isCreateSession() == true) {
- fail("Action is flagged as a 'CreateSession'");
- }
- }
-
- public void testIsSessionBased() {
- TestESBService service=new TestESBService();
-
- PerformAction action=new PerformAction(service, null);
-
- if (action.isSessionBased() == false) {
- fail("Action is not flagged as a 'SessionBased'");
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java (from rev 387, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/PerformActionTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/PerformActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,779 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.PerformAction;
+import org.scribble.conversation.model.*;
+import org.scribble.model.Activity;
+
+import junit.framework.TestCase;
+
+public class PerformActionTest extends TestCase {
+
+ public void testValidateNoServiceCategory() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_NAME, "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ PerformAction action=new PerformAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"serviceCategory"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateNoServiceName() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ PerformAction action=new PerformAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"serviceName"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateService() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
+ "_NOT_FOUND_SERVICE_DESCRIPTOR",
+ new String[]{"cat1", "name1"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateReturnService() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
+ props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
+ "_NOT_FOUND_SERVICE_DESCRIPTOR",
+ new String[]{"cat2", "name2"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateServiceCreatesSession() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
+ props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(false);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_PERFORM_CREATE_SESSION",
+ new String[]{}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateParentReferenceNotFound() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.PARENT_REFERENCE, "fred");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(Object.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_VARIABLE",
+ new String[]{"fred", Object.class.getName()}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateParentReferenceNotWritable() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.PARENT_REFERENCE, "class");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(Object.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_WRITABLE_PROPERTY",
+ new String[]{"class", Object.class.getName()}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateParentReferenceIncorrectType() {
+ TestESBService service=new TestESBService();
+ service.setSessionClass(ParentPojo.class);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.PARENT_REFERENCE, "invalidParent");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(ChildPojo.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_INVALID_PROPERTY_TYPE",
+ new String[]{"invalidParent",
+ ChildPojo.class.getName(),
+ ParentPojo.class.getName()}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateParentReferenceCorrectType() {
+ TestESBService service=new TestESBService();
+ service.setSessionClass(ParentPojo.class);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.PARENT_REFERENCE, "validParent");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(ChildPojo.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateParentReferenceCorrectType2() {
+ TestESBService service=new TestESBService();
+ service.setSessionClass(ParentPojo.class);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.PARENT_REFERENCE, "validParentView");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(ChildPojo.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateBindDetailsNotFound() {
+ TestESBService service=new TestESBService();
+
+ String varName="fred";
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+
+ java.util.Map<String,String> customProps=new java.util.Hashtable<String,String>();
+ customProps.put(PerformAction.BIND_DETAILS,
+ "<root><bind to-variable=\""+varName+"\" /></root>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, customProps);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(Object.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_VARIABLE",
+ new String[]{varName, Object.class.getName()}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateBindDetailsNotWritable() {
+ TestESBService service=new TestESBService();
+
+ String varName="class";
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+
+ java.util.Map<String,String> customProps=new java.util.Hashtable<String,String>();
+ customProps.put(PerformAction.BIND_DETAILS,
+ "<root><bind to-variable=\""+varName+"\" /></root>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, customProps);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(Object.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
+ "_NOT_WRITABLE_PROPERTY",
+ new String[]{varName, Object.class.getName()}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateBindDetailsCorrect() {
+ TestESBService service=new TestESBService();
+
+ String varName="validParent";
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+
+ java.util.Map<String,String> customProps=new java.util.Hashtable<String,String>();
+ customProps.put(PerformAction.BIND_DETAILS,
+ "<root><bind to-variable=\""+varName+"\" /></root>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, customProps);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+ other1.setSessionClass(ChildPojo.class);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testConvertRun() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
+ props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 2) {
+ fail("Expecting two activities, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof Run) == false) {
+ fail("Expecting an 'Run' activity");
+ }
+
+ Run runAction=(Run)act;
+
+ if (runAction.getDefinition() == null) {
+ fail("Run definition was null");
+ }
+
+ if (runAction.getDefinition().getBlock().getContents().size() != 1) {
+ fail("Expecting one ran block activity: "+runAction.getDefinition().getBlock().getContents().size());
+ }
+
+ if (runAction.getDefinition().getBlock().getContents().get(0) != act1) {
+ fail("Run model block should have 1 activity = act1");
+ }
+
+ if (activities.get(1) != act2) {
+ fail("Subsequent activity after run was not act2");
+ }
+ }
+
+ public void testConvertSpawn() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting 1 activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof Spawn) == false) {
+ fail("Expecting a 'Spawn' activity");
+ }
+
+ Spawn spawnAction=(Spawn)act;
+
+ if (spawnAction.getDefinition() == null) {
+ fail("Run definition was null");
+ }
+
+ if (spawnAction.getDefinition().getBlock().getContents().size() != 1) {
+ fail("Expecting one block activity: "+spawnAction.getDefinition().getBlock().getContents().size());
+ }
+
+ if (spawnAction.getDefinition().getBlock().getContents().get(0) != act1) {
+ fail("Spawn model block should have 1 activity = act1");
+ }
+ }
+
+ public void testConvertNotExcludingEmptyPath() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put(PerformAction.SERVICE_CATEGORY, "cat1");
+ props.put(PerformAction.SERVICE_NAME, "name1");
+ props.put(PerformAction.RETURN_SERVICE_CATEGORY, "cat2");
+ props.put(PerformAction.RETURN_SERVICE_NAME, "name2");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 2) {
+ fail("Expecting two activities, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof Run) == false) {
+ fail("Expecting an 'Run' activity");
+ }
+
+ Run runAction=(Run)act;
+
+ if (runAction.getDefinition() == null) {
+ fail("Run definition was null");
+ }
+
+ if (runAction.getDefinition().getBlock().getContents().size() != 0) {
+ fail("Expecting zero ran block activities: "+runAction.getDefinition().getBlock().getContents().size());
+ }
+
+ if (activities.get(1) != act2) {
+ fail("Subsequent activity after run was not act2");
+ }
+ }
+
+ public void testIsCreateSession() {
+ TestESBService service=new TestESBService();
+
+ PerformAction action=new PerformAction(service, null);
+
+ if (action.isCreateSession() == true) {
+ fail("Action is flagged as a 'CreateSession'");
+ }
+ }
+
+ public void testIsSessionBased() {
+ TestESBService service=new TestESBService();
+
+ PerformAction action=new PerformAction(service, null);
+
+ if (action.isSessionBased() == false) {
+ fail("Action is not flagged as a 'SessionBased'");
+ }
+ }
+
+ public interface ParentView {
+
+ }
+
+ public class ParentPojo implements ParentView {
+
+ }
+
+ public class ChildPojo {
+
+ public void setValidParent(ParentPojo p) {
+ }
+
+ public void setValidParentView(ParentView p) {
+ }
+
+ public void setInvalidParent(String p) {
+ }
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ReceiveMessageActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,11 +15,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.ReceiveMessageAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.ReceiveMessageAction;
import junit.framework.TestCase;
@@ -42,7 +42,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"messageType"}));
@@ -70,7 +70,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"identities"}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/RetrieveSessionActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/RetrieveSessionActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.RetrieveSessionAction;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.UnsupportedAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.RetrieveSessionAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.UnsupportedAction;
import junit.framework.TestCase;
@@ -69,7 +69,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_BE_FIRST_ACTION",
new String[]{"RetrieveSession"}));
@@ -95,7 +95,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"identities"}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ScheduleStateActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/ScheduleStateActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,11 +15,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
import org.scribble.model.Activity;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.ScheduleStateAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.ScheduleStateAction;
import junit.framework.TestCase;
@@ -42,7 +42,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"serviceCategory"}));
@@ -70,7 +70,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"serviceName"}));
@@ -105,7 +105,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1", "name1"}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SendMessageActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,13 +15,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.DefaultConversionContext;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SendMessageAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultConversionContext;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.SendMessageAction;
import org.scribble.model.Activity;
import org.scribble.model.Interaction;
import org.scribble.model.TypeReference;
@@ -49,7 +49,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"messageType"}));
@@ -78,7 +78,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"identities"}));
@@ -107,7 +107,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_REQ_RESP_EPR",
new String[]{}));
@@ -146,7 +146,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat2", "name2"}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetMessageActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetMessageActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetMessageActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,11 +15,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SetMessageAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.SetMessageAction;
import junit.framework.TestCase;
@@ -41,7 +41,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{SetMessageAction.STATE_EXPRESSION}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SetStateActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SetStateActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,11 +15,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SetStateAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.SetStateAction;
import junit.framework.TestCase;
@@ -42,7 +42,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{SetStateAction.VARIABLE}));
@@ -76,7 +76,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_FOUND_VARIABLE",
new String[]{varName, cls.getName()}));
@@ -166,7 +166,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_WRITABLE_PROPERTY",
new String[]{"readableProperty", TestClass2.class.getName()}));
@@ -200,7 +200,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_READABLE_PROPERTY",
new String[]{"testClass2", TestClass3.class.getName()}));
@@ -233,7 +233,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
new String[]{}));
@@ -268,7 +268,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_SPECIFY_STATE_OR_MESSAGE_EXPRESSION",
new String[]{}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SwitchActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/SwitchActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.SwitchAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.SwitchAction;
import org.scribble.conversation.model.If;
import org.scribble.model.Activity;
@@ -43,7 +43,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"paths"}));
@@ -79,17 +79,17 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1","name1"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat2","name2"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat3","name3"}));
@@ -132,7 +132,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_SWITCH_ONE_OR_MORE_PATHS",
new String[]{}));
@@ -183,7 +183,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/TestActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/TestActivity.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/TestActivity.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,7 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
public class TestActivity extends org.scribble.model.Activity {
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhenActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhenActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBLanguageModel;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestESBService;
-import org.jboss.tools.overlord.cdl.jbossesb.model.TestModelListener;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.WhenAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestESBService;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.TestModelListener;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.WhenAction;
import org.scribble.conversation.model.*;
import org.scribble.model.*;
@@ -43,7 +43,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"paths"}));
@@ -79,17 +79,17 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1","name1"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat2","name2"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat3","name3"}));
@@ -132,7 +132,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_WHEN_ONE_OR_MORE_PATHS",
new String[]{}));
@@ -183,7 +183,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/actions/WhileActionTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/WhileActionTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -15,12 +15,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.actions;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions;
import org.scribble.conversation.model.*;
import org.scribble.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.WhileAction;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.WhileAction;
import junit.framework.TestCase;
@@ -41,7 +41,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_NOT_SPECIFIED_PROPERTY",
new String[]{"paths"}));
@@ -76,12 +76,12 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat1","name1"}));
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.Messages"),
"_NOT_FOUND_SERVICE_DESCRIPTOR",
new String[]{"cat2","name2"}));
@@ -125,7 +125,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_DEFINE_SINGLE_WHILE_EXIT",
new String[]{}));
@@ -169,7 +169,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_MUST_DEFINE_SINGLE_WHILE_PATH",
new String[]{}));
@@ -219,7 +219,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
@@ -269,7 +269,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_PATH_SERVICE_DETAILS_MISSING",
new String[]{}));
@@ -319,7 +319,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_WHILE_PATH_AFTER_EXIT",
new String[]{}));
@@ -364,7 +364,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_BOOLEAN",
new String[]{WhileAction.IMMEDIATE}));
@@ -409,7 +409,7 @@
l.addExpectedError(org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.cdl.jbossesb.model.actions.Messages"),
+ "org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.Messages"),
"_BOOLEAN",
new String[]{WhileAction.IMMEDIATE}));
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change)
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,634 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.ConversationInteractionModelChangeRule;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class ConversationInteractionModelChangeRuleTest extends TestCase {
-
- public void testInsertFirstReceiveAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setToRole(role);
- conv.getBlock().getContents().add(mobj);
-
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- if (mra.getNumberOfRoutes() != 1) {
- fail("One route expected: "+mra.getNumberOfRoutes());
- }
- }
-
- public void testInsertSecondReceiveAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Add gateway service
- TestESBService gwservice=(TestESBService)
- model.createService("testcategory", "gateway");
- gwservice.setGateway(true);
-
- MessageRouterAction mra=new MessageRouterAction(gwservice);
- gwservice.setGatewayAction(mra);
-
- model.setGatewayService(gwservice);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj1=new ConversationInteraction();
- mobj1.setToRole(role);
- conv.getBlock().getContents().add(mobj1);
-
- MessageSignature msig1=new MessageSignature();
- mobj1.setMessageSignature(msig1);
-
- TypeReference ref1=new TypeReference();
- ref1.setNamespace("ns");
- ref1.setLocalpart("lp1");
-
- msig1.getTypes().add(ref1);
-
- if (rule.insert(context, model, mobj1, -1) == false) {
- fail("Failed to insert 1");
- }
-
- ConversationInteraction mobj2=new ConversationInteraction();
- mobj2.setToRole(role);
- conv.getBlock().getContents().add(mobj2);
-
- MessageSignature msig2=new MessageSignature();
- mobj2.setMessageSignature(msig2);
-
- TypeReference ref2=new TypeReference();
- ref2.setNamespace("ns");
- ref2.setLocalpart("lp2");
-
- msig2.getTypes().add(ref2);
-
- // Once first interaction associated with service it
- // will become session based
- service.setSessionBased(true);
-
- if (rule.insert(context, model, mobj2, -1) == false) {
- fail("Failed to insert 2");
- }
-
- // Check actions
- if (service.getActions().size() != 2) {
- fail("Expecting 2 actions: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
- fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- // Check schedule details
- ScheduleStateAction schedule=(ScheduleStateAction)
- service.getActions().get(1);
-
- if (newService.getCategory().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- service.getCategory());
- }
-
- if (newService.getName().equals(schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- schedule.getPropertyValue(
- ScheduleStateAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- service.getName());
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.IMMEDIATE) != null) {
- fail("Schedule should not be immediate");
- }
-
- if (newService.getActions().size() != 1) {
- fail("Expecting 1 action: "+newService.getActions().size());
- }
-
- if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+newService.getActions().get(0));
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)newService.getActions().get(0);
-
- String mtype=InteractionUtil.getTypeString(ref2);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
-
- if (mra.getNumberOfRoutes() != 2) {
- fail("Two routes expected: "+mra.getNumberOfRoutes());
- }
- }
-
- public void testInsertReceiveRequestAction() {
- String fromRoleName="role1";
- String toRoleName="role2";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role fromRole=new Role();
- fromRole.setName(fromRoleName);
-
- Role toRole=new Role();
- toRole.setName(toRoleName);
-
- context.setRole(toRole);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(toRole);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(fromRole);
- mobj.setToRole(toRole);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setRequestLabel("reqLabel");
-
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
- fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
-
- if (action.getPropertyValue(ReceiveMessageAction.CLIENT_EPR).equals(fromRoleName) == false) {
- fail("Client EPR '"+action.getPropertyValue(ReceiveMessageAction.CLIENT_EPR)+
- "' invalid, expecting: "+fromRoleName);
- }
- }
-
- public void testInsertFirstSendAction() {
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(role);
- conv.getBlock().getContents().add(mobj);
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 1) {
- fail("One service expected: "+model.getServices().size());
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- String mtype=InteractionUtil.getTypeString(ref);
-
- if (action.getPropertyValue("messageType").equals(mtype)==false) {
- fail("Message type '"+action.getPropertyValue("messageType")+
- "' invalid, expecting: "+mtype);
- }
- }
-
- public void testInsertSendRequestAction() {
- String roleName="role1";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName(roleName);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(role);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setRequestLabel("reqLabel");
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two service expected: "+model.getServices().size());
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- if (newService.getCategory().equals(action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_CATEGORY)) == false) {
- fail("Schedule service category '"+
- action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- newService.getCategory());
- }
-
- if (newService.getName().equals(action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_NAME)) == false) {
- fail("Schedule service name '"+
- action.getPropertyValue(
- SendMessageAction.RESPONSE_SERVICE_NAME)+
- "' invalid, expecting: "+
- newService.getName());
- }
- }
-
- public void testInsertSendNotReplyAction() {
- String fromRoleName="role1";
- String toRoleName="role2";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role fromRole=new Role();
- fromRole.setName(fromRoleName);
-
- Role toRole=new Role();
- toRole.setName(toRoleName);
-
- context.setRole(fromRole);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(fromRole);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(fromRole);
- mobj.setToRole(toRole);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setRequestLabel("reqLabel");
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two service expected: "+model.getServices().size());
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- if (action.getPropertyValue(SendMessageAction.SERVICE_CATEGORY_EXPRESSION).
- equals(InteractionUtil.getRoleServiceCategoryProperty(toRoleName)) == false) {
- fail("Service category expression '"+
- action.getPropertyValue(SendMessageAction.SERVICE_CATEGORY_EXPRESSION)+
- "' invalid, expecting: "+
- InteractionUtil.getRoleServiceCategoryProperty(toRoleName));
- }
-
- if (action.getPropertyValue(SendMessageAction.SERVICE_NAME_EXPRESSION).
- equals(InteractionUtil.getRoleServiceNameProperty(toRoleName)) == false) {
- fail("Service name expression '"+
- action.getPropertyValue(SendMessageAction.SERVICE_NAME_EXPRESSION)+
- "' invalid, expecting: "+
- InteractionUtil.getRoleServiceNameProperty(toRoleName));
- }
- }
-
- public void testInsertSendReplyAction() {
- String fromRoleName="role1";
- String toRoleName="role2";
- ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role fromRole=new Role();
- fromRole.setName(fromRoleName);
-
- Role toRole=new Role();
- toRole.setName(toRoleName);
-
- context.setRole(fromRole);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(fromRole);
- conv.setModelName(mname);
-
- ConversationInteraction mobj=new ConversationInteraction();
- mobj.setFromRole(fromRole);
- mobj.setToRole(toRole);
- conv.getBlock().getContents().add(mobj);
-
- mobj.setReplyToLabel("replyLabel");
-
- MessageSignature msig=new MessageSignature();
- mobj.setMessageSignature(msig);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- msig.getTypes().add(ref);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
- fail("Action was not SendMessageAction: "+service.getActions().get(0));
- }
-
- SendMessageAction action=(SendMessageAction)service.getActions().get(0);
-
- if (action.getPropertyValue(SendMessageAction.CLIENT_EPR).equals(toRoleName) == false) {
- fail("Client EPR '"+action.getPropertyValue(SendMessageAction.CLIENT_EPR)+
- "' invalid, expecting: "+toRoleName);
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,1847 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.ConversationInteractionModelChangeRule;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class ConversationInteractionModelChangeRuleTest extends TestCase {
+
+ public void testInsertFirstReceiveAction() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setToRole(role);
+ conv.getBlock().getContents().add(mobj);
+
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
+
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ if (action.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+action.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ if (mra.getNumberOfRoutes() != 1) {
+ fail("One route expected: "+mra.getNumberOfRoutes());
+ }
+ }
+
+ public void testInsertFirstReceiveAfterCreateSessionAction() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add 'create session' action
+ TestESBAction act=new TestESBAction();
+ act.setCreateSession(true);
+ service.addAction(act, -1);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setToRole(role);
+ conv.getBlock().getContents().add(mobj);
+
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof TestESBAction) == false) {
+ fail("Action was not TestESBAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ReceiveMessageAction) == false) {
+ fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(1);
+
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ if (action.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+action.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ if (mra.getNumberOfRoutes() != 1) {
+ fail("One route expected: "+mra.getNumberOfRoutes());
+ }
+ }
+
+ public void testInsertSecondReceiveAction() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj1=new ConversationInteraction();
+ mobj1.setToRole(role);
+ conv.getBlock().getContents().add(mobj1);
+
+ MessageSignature msig1=new MessageSignature();
+ mobj1.setMessageSignature(msig1);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setNamespace("ns");
+ ref1.setLocalpart("lp1");
+
+ msig1.getTypes().add(ref1);
+
+ if (rule.insert(context, model, mobj1, null) == false) {
+ fail("Failed to insert 1");
+ }
+
+ ConversationInteraction mobj2=new ConversationInteraction();
+ mobj2.setToRole(role);
+ conv.getBlock().getContents().add(mobj2);
+
+ MessageSignature msig2=new MessageSignature();
+ mobj2.setMessageSignature(msig2);
+
+ TypeReference ref2=new TypeReference();
+ ref2.setNamespace("ns");
+ ref2.setLocalpart("lp2");
+
+ msig2.getTypes().add(ref2);
+
+ // Once first interaction associated with service it
+ // will become session based
+ service.setSessionBased(true);
+
+ if (rule.insert(context, model, mobj2, null) == false) {
+ fail("Failed to insert 2");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ // Check schedule details
+ ScheduleStateAction schedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (newService.getCategory().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)) == false) {
+ fail("Schedule service category '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ service.getCategory());
+ }
+
+ if (newService.getName().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)) == false) {
+ fail("Schedule service name '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ service.getName());
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.IMMEDIATE) != null) {
+ fail("Schedule should not be immediate");
+ }
+
+ if (newService.getActions().size() != 1) {
+ fail("Expecting 1 action: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action was not ReceiveMessageAction: "+newService.getActions().get(0));
+ }
+
+ ReceiveMessageAction action=(ReceiveMessageAction)newService.getActions().get(0);
+
+ String mtype=InteractionUtil.getTypeString(ref2);
+
+ if (action.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+action.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ if (mra.getNumberOfRoutes() != 2) {
+ fail("Two routes expected: "+mra.getNumberOfRoutes());
+ }
+ }
+
+
+ public void testInsertMiddleReceiveBetweenTwoReceives() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj1=new ConversationInteraction();
+ mobj1.setToRole(role);
+ conv.getBlock().getContents().add(mobj1);
+
+ MessageSignature msig1=new MessageSignature();
+ mobj1.setMessageSignature(msig1);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setNamespace("ns");
+ ref1.setLocalpart("lp1");
+
+ msig1.getTypes().add(ref1);
+
+ if (rule.insert(context, model, mobj1, null) == false) {
+ fail("Failed to insert 1");
+ }
+
+ ConversationInteraction mobj2=new ConversationInteraction();
+ mobj2.setToRole(role);
+ conv.getBlock().getContents().add(mobj2);
+
+ MessageSignature msig2=new MessageSignature();
+ mobj2.setMessageSignature(msig2);
+
+ TypeReference ref2=new TypeReference();
+ ref2.setNamespace("ns");
+ ref2.setLocalpart("lp2");
+
+ msig2.getTypes().add(ref2);
+
+ // Once first interaction associated with service it
+ // will become session based
+ service.setSessionBased(true);
+
+ if (rule.insert(context, model, mobj2, null) == false) {
+ fail("Failed to insert 2");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ ((TestESBService)newService).setSessionBased(true);
+
+ // Check schedule details
+ ScheduleStateAction schedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (newService.getCategory().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)) == false) {
+ fail("Schedule service category '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ service.getCategory());
+ }
+
+ if (newService.getName().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)) == false) {
+ fail("Schedule service name '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ service.getName());
+ }
+
+ // Check actions
+ if (newService.getActions().size() != 1) {
+ fail("Expecting 1 action: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
+ }
+
+ ReceiveMessageAction recv2=(ReceiveMessageAction)
+ newService.getActions().get(0);
+
+
+ String mtype=InteractionUtil.getTypeString(ref2);
+
+ if (recv2.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+recv2.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ recv2.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // Now second service identified, add new receive
+ // action to ensure that third service inserted in the
+ // middle
+ ConversationInteraction mobj3=new ConversationInteraction();
+ mobj3.setToRole(role);
+ conv.getBlock().getContents().add(mobj3);
+
+ MessageSignature msig3=new MessageSignature();
+ mobj3.setMessageSignature(msig3);
+
+ TypeReference ref3=new TypeReference();
+ ref3.setNamespace("ns");
+ ref3.setLocalpart("lp3");
+
+ msig3.getTypes().add(ref3);
+
+ // Insert into position 1, which should be after first
+ // receive
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.insert(context, model, mobj3, acts.get(0)) == false) {
+ fail("Failed to insert 3");
+ }
+
+ // Re-Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ // TODO: Need to check if new service has been inserted
+ // in the middle of the previously inserted interactions
+
+ // Check actions
+ if (newService.getActions().size() != 2) {
+ fail("Now Expecting 2 action: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
+ }
+
+ if ((newService.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+newService.getActions().get(1));
+ }
+
+ ScheduleStateAction ssa=(ScheduleStateAction)newService.getActions().get(1);
+
+ ESBService newService2=model.getService(ssa.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY),ssa.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME));
+
+ if (newService2 == null) {
+ fail("Failed to find final service");
+ }
+
+ if (newService2.getActions().size() != 1) {
+ fail("Only expecting one action: "+newService2.getActions().size());
+ }
+
+ ReceiveMessageAction recv4=(ReceiveMessageAction)
+ newService2.getActions().get(0);
+
+ String mtype4=InteractionUtil.getTypeString(ref2);
+
+ if (recv4.getPropertyValue("messageType").equals(mtype4)==false) {
+ fail("Message type '"+recv4.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype4);
+ }
+
+
+ ReceiveMessageAction recv3=(ReceiveMessageAction)
+ newService.getActions().get(0);
+
+ String mtype3=InteractionUtil.getTypeString(ref3);
+
+ if (recv3.getPropertyValue("messageType").equals(mtype3)==false) {
+ fail("Message type '"+recv3.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype3);
+ }
+ }
+
+ public void testInsertMiddleSendBetweenTwoReceives() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj1=new ConversationInteraction();
+ mobj1.setToRole(role);
+ conv.getBlock().getContents().add(mobj1);
+
+ MessageSignature msig1=new MessageSignature();
+ mobj1.setMessageSignature(msig1);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setNamespace("ns");
+ ref1.setLocalpart("lp1");
+
+ msig1.getTypes().add(ref1);
+
+ if (rule.insert(context, model, mobj1, null) == false) {
+ fail("Failed to insert 1");
+ }
+
+ ConversationInteraction mobj2=new ConversationInteraction();
+ mobj2.setToRole(role);
+ conv.getBlock().getContents().add(mobj2);
+
+ MessageSignature msig2=new MessageSignature();
+ mobj2.setMessageSignature(msig2);
+
+ TypeReference ref2=new TypeReference();
+ ref2.setNamespace("ns");
+ ref2.setLocalpart("lp2");
+
+ msig2.getTypes().add(ref2);
+
+ // Once first interaction associated with service it
+ // will become session based
+ service.setSessionBased(true);
+
+ if (rule.insert(context, model, mobj2, null) == false) {
+ fail("Failed to insert 2");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ ((TestESBService)newService).setSessionBased(true);
+
+ // Check schedule details
+ ScheduleStateAction schedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (newService.getCategory().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)) == false) {
+ fail("Schedule service category '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ service.getCategory());
+ }
+
+ if (newService.getName().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)) == false) {
+ fail("Schedule service name '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ service.getName());
+ }
+
+ // Check actions
+ if (newService.getActions().size() != 1) {
+ fail("Expecting 1 action: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
+ }
+
+ ReceiveMessageAction recv2=(ReceiveMessageAction)
+ newService.getActions().get(0);
+
+
+ String mtype=InteractionUtil.getTypeString(ref2);
+
+ if (recv2.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+recv2.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ recv2.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // Now second service identified, add new receive
+ // action to ensure that third service inserted in the
+ // middle
+ ConversationInteraction mobj3=new ConversationInteraction();
+ mobj3.setFromRole(role);
+ conv.getBlock().getContents().add(mobj3);
+
+ MessageSignature msig3=new MessageSignature();
+ mobj3.setMessageSignature(msig3);
+
+ TypeReference ref3=new TypeReference();
+ ref3.setNamespace("ns");
+ ref3.setLocalpart("lp3");
+
+ msig3.getTypes().add(ref3);
+
+ // Insert into position 1, which should be after first
+ // receive
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.insert(context, model, mobj3, acts.get(0)) == false) {
+ fail("Failed to insert 3");
+ }
+
+ // Re-Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ // TODO: Need to check if new service has been inserted
+ // in the middle of the previously inserted interactions
+
+ // Check actions
+ if (newService.getActions().size() != 2) {
+ fail("Now Expecting 2 action: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action 1 was not SendMessageAction: "+newService.getActions().get(0));
+ }
+
+ if ((newService.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+newService.getActions().get(1));
+ }
+
+ ScheduleStateAction ssa=(ScheduleStateAction)newService.getActions().get(1);
+
+ ESBService newService2=model.getService(ssa.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY),ssa.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME));
+
+ if (newService2 == null) {
+ fail("Failed to find final service");
+ }
+
+ if (newService2.getActions().size() != 1) {
+ fail("Only expecting one action: "+newService2.getActions().size());
+ }
+
+ if ((newService2.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Expecting ReceiveMessageAction, but got: "+newService2.getActions().get(0));
+ }
+
+ ReceiveMessageAction recv4=(ReceiveMessageAction)
+ newService2.getActions().get(0);
+
+ String mtype4=InteractionUtil.getTypeString(ref2);
+
+ if (recv4.getPropertyValue("messageType").equals(mtype4)==false) {
+ fail("Message type '"+recv4.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype4);
+ }
+
+
+ SendMessageAction send3=(SendMessageAction)
+ newService.getActions().get(0);
+
+ String mtype3=InteractionUtil.getTypeString(ref3);
+
+ if (send3.getPropertyValue("messageType").equals(mtype3)==false) {
+ fail("Message type '"+send3.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype3);
+ }
+ }
+
+ public void testInsertMiddleReceiveBetweenTwoSends() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj1=new ConversationInteraction();
+ mobj1.setFromRole(role);
+ conv.getBlock().getContents().add(mobj1);
+
+ MessageSignature msig1=new MessageSignature();
+ mobj1.setMessageSignature(msig1);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setNamespace("ns");
+ ref1.setLocalpart("lp1");
+
+ msig1.getTypes().add(ref1);
+
+ if (rule.insert(context, model, mobj1, null) == false) {
+ fail("Failed to insert 1");
+ }
+
+ ConversationInteraction mobj2=new ConversationInteraction();
+ mobj2.setFromRole(role);
+ conv.getBlock().getContents().add(mobj2);
+
+ MessageSignature msig2=new MessageSignature();
+ mobj2.setMessageSignature(msig2);
+
+ TypeReference ref2=new TypeReference();
+ ref2.setNamespace("ns");
+ ref2.setLocalpart("lp2");
+
+ msig2.getTypes().add(ref2);
+
+ // Once first interaction associated with service it
+ // will become session based
+ service.setSessionBased(true);
+
+ if (rule.insert(context, model, mobj2, null) == false) {
+ fail("Failed to insert 2");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action 1 was not SendMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof SendMessageAction) == false) {
+ fail("Action 2 was not SendMessageAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ SendMessageAction send2=(SendMessageAction)
+ service.getActions().get(1);
+
+
+ String mtype=InteractionUtil.getTypeString(ref2);
+
+ if (send2.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+send2.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ send2.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // Now second service identified, add new receive
+ // action to ensure that third service inserted in the
+ // middle
+ ConversationInteraction mobj3=new ConversationInteraction();
+ mobj3.setToRole(role);
+ conv.getBlock().getContents().add(mobj3);
+
+ MessageSignature msig3=new MessageSignature();
+ mobj3.setMessageSignature(msig3);
+
+ TypeReference ref3=new TypeReference();
+ ref3.setNamespace("ns");
+ ref3.setLocalpart("lp3");
+
+ msig3.getTypes().add(ref3);
+
+ // Insert into position 1, which should be after first
+ // send
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.insert(context, model, mobj3, acts.get(0)) == false) {
+ fail("Failed to insert 3");
+ }
+
+ // Re-Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action 1 was not SendMessageAction: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ // Check actions
+ if (newService.getActions().size() != 2) {
+ fail("Now Expecting 2 action: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
+ }
+
+ if ((newService.getActions().get(1) instanceof SendMessageAction) == false) {
+ fail("Action 2 was not SendMessageAction: "+newService.getActions().get(1));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (newService.getCategory().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)) == false) {
+ fail("Schedule service category '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ service.getCategory());
+ }
+
+ if (newService.getName().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)) == false) {
+ fail("Schedule service name '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ service.getName());
+ }
+
+ ReceiveMessageAction recv3=(ReceiveMessageAction)
+ newService.getActions().get(0);
+
+ String mtype3=InteractionUtil.getTypeString(ref3);
+
+ if (recv3.getPropertyValue("messageType").equals(mtype3)==false) {
+ fail("Message type '"+recv3.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype3);
+ }
+ }
+
+ public void testInsertReceiveRequestAction() {
+ String fromRoleName="role1";
+ String toRoleName="role2";
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role fromRole=new Role();
+ fromRole.setName(fromRoleName);
+
+ Role toRole=new Role();
+ toRole.setName(toRoleName);
+
+ context.setRole(toRole);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(toRole);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setFromRole(fromRole);
+ mobj.setToRole(toRole);
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.setRequestLabel("reqLabel");
+
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
+
+ if (action.getPropertyValue(ReceiveMessageAction.CLIENT_EPR).equals(fromRoleName) == false) {
+ fail("Client EPR '"+action.getPropertyValue(ReceiveMessageAction.CLIENT_EPR)+
+ "' invalid, expecting: "+fromRoleName);
+ }
+ }
+
+ public void testInsertFirstSendAction() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setFromRole(role);
+ conv.getBlock().getContents().add(mobj);
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action was not SendMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ SendMessageAction action=(SendMessageAction)service.getActions().get(0);
+
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ if (action.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+action.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+ }
+
+ public void testInsertSendRequestAction() {
+ String roleName="role1";
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName(roleName);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setFromRole(role);
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.setRequestLabel("reqLabel");
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action was not SendMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two service expected: "+model.getServices().size());
+ }
+
+ SendMessageAction action=(SendMessageAction)service.getActions().get(0);
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ if (newService.getCategory().equals(action.getPropertyValue(
+ SendMessageAction.RESPONSE_SERVICE_CATEGORY)) == false) {
+ fail("Schedule service category '"+
+ action.getPropertyValue(
+ SendMessageAction.RESPONSE_SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ newService.getCategory());
+ }
+
+ if (newService.getName().equals(action.getPropertyValue(
+ SendMessageAction.RESPONSE_SERVICE_NAME)) == false) {
+ fail("Schedule service name '"+
+ action.getPropertyValue(
+ SendMessageAction.RESPONSE_SERVICE_NAME)+
+ "' invalid, expecting: "+
+ newService.getName());
+ }
+ }
+
+ public void testInsertSendNotReplyAction() {
+ String fromRoleName="role1";
+ String toRoleName="role2";
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role fromRole=new Role();
+ fromRole.setName(fromRoleName);
+
+ Role toRole=new Role();
+ toRole.setName(toRoleName);
+
+ context.setRole(fromRole);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(fromRole);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setFromRole(fromRole);
+ mobj.setToRole(toRole);
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.setRequestLabel("reqLabel");
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action was not SendMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two service expected: "+model.getServices().size());
+ }
+
+ SendMessageAction action=(SendMessageAction)service.getActions().get(0);
+
+ if (action.getPropertyValue(SendMessageAction.SERVICE_CATEGORY_EXPRESSION).
+ equals(InteractionUtil.getRoleServiceCategoryProperty(toRoleName)) == false) {
+ fail("Service category expression '"+
+ action.getPropertyValue(SendMessageAction.SERVICE_CATEGORY_EXPRESSION)+
+ "' invalid, expecting: "+
+ InteractionUtil.getRoleServiceCategoryProperty(toRoleName));
+ }
+
+ if (action.getPropertyValue(SendMessageAction.SERVICE_NAME_EXPRESSION).
+ equals(InteractionUtil.getRoleServiceNameProperty(toRoleName)) == false) {
+ fail("Service name expression '"+
+ action.getPropertyValue(SendMessageAction.SERVICE_NAME_EXPRESSION)+
+ "' invalid, expecting: "+
+ InteractionUtil.getRoleServiceNameProperty(toRoleName));
+ }
+ }
+
+ public void testInsertSendReplyAction() {
+ String fromRoleName="role1";
+ String toRoleName="role2";
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role fromRole=new Role();
+ fromRole.setName(fromRoleName);
+
+ Role toRole=new Role();
+ toRole.setName(toRoleName);
+
+ context.setRole(fromRole);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(fromRole);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setFromRole(fromRole);
+ mobj.setToRole(toRole);
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.setReplyToLabel("replyLabel");
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ msig.getTypes().add(ref);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SendMessageAction) == false) {
+ fail("Action was not SendMessageAction: "+service.getActions().get(0));
+ }
+
+ SendMessageAction action=(SendMessageAction)service.getActions().get(0);
+
+ if (action.getPropertyValue(SendMessageAction.CLIENT_EPR).equals(toRoleName) == false) {
+ fail("Client EPR '"+action.getPropertyValue(SendMessageAction.CLIENT_EPR)+
+ "' invalid, expecting: "+toRoleName);
+ }
+ }
+
+ public void testChangeFirstReceiveAction() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj=new ConversationInteraction();
+ mobj.setToRole(role);
+ conv.getBlock().getContents().add(mobj);
+
+
+ MessageSignature msig=new MessageSignature();
+ mobj.setMessageSignature(msig);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp1");
+
+ msig.getTypes().add(ref);
+
+ // Create ReceiveMessageAction
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action was not ReceiveMessageAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ ReceiveMessageAction action=(ReceiveMessageAction)service.getActions().get(0);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+ action.convert(activities, new DefaultConversionContext(null));
+
+ if (activities.size() != 1) {
+ fail("Expecting single interaction activity from ReceiveMessageAction: "+activities.size());
+ }
+
+ if ((activities.get(0) instanceof ConversationInteraction) == false) {
+ fail("Not conversation interaction");
+ }
+
+ ConversationInteraction recvci=(ConversationInteraction)activities.get(0);
+
+ String mtype=InteractionUtil.getTypeString(ref);
+
+ if (action.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+action.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ // Change local part
+ ref.setLocalpart("lp2");
+
+ if (rule.update(context, model, mobj, recvci) == false) {
+ fail("Failed to update");
+ }
+
+ // Re-check the message type, to make sure has been updated
+ mtype = InteractionUtil.getTypeString(ref);
+
+ if (action.getPropertyValue("messageType").equals(mtype)==false) {
+ fail("Message type '"+action.getPropertyValue("messageType")+
+ "' invalid, expecting: "+mtype);
+ }
+
+ if (mra.getNumberOfRoutes() != 1) {
+ fail("One route expected: "+mra.getNumberOfRoutes());
+ }
+
+ org.w3c.dom.Element route=mra.getRouteElement(0);
+
+ org.w3c.dom.NodeList mesgs=route.getElementsByTagName(MessageRouterAction.MESSAGE_ELEMENT);
+
+ if (mesgs.getLength() != 1) {
+ fail("Too many route message elements: "+mesgs.getLength());
+ }
+
+ org.w3c.dom.Element mesg=(org.w3c.dom.Element)mesgs.item(0);
+
+ if (mesg.getAttribute(MessageRouterAction.TYPE_ATTR).equals(mtype) == false) {
+ fail("Route message type has not been updated");
+ }
+ }
+
+ public void testDeleteMiddleReceiveBetweenTwoActions() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj1=new ConversationInteraction();
+ mobj1.setToRole(role);
+ conv.getBlock().getContents().add(mobj1);
+
+ MessageSignature msig1=new MessageSignature();
+ mobj1.setMessageSignature(msig1);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setNamespace("ns");
+ ref1.setLocalpart("lp1");
+
+ msig1.getTypes().add(ref1);
+
+ if (rule.insert(context, model, mobj1, null) == false) {
+ fail("Failed to insert 1");
+ }
+
+ // Once first interaction associated with service it
+ // will become session based
+ service.setSessionBased(true);
+
+ TestESBAction act2=new TestESBAction();
+ ((ESBService)context.getParent()).addAction(act2, -1);
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action 1 was not test ESB action: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ ((TestESBService)newService).setSessionBased(true);
+
+ // Check schedule details
+ ScheduleStateAction schedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (newService.getCategory().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)) == false) {
+ fail("Schedule service category '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ service.getCategory());
+ }
+
+ if (newService.getName().equals(schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)) == false) {
+ fail("Schedule service name '"+
+ schedule.getPropertyValue(
+ ScheduleStateAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ service.getName());
+ }
+
+ // Check actions
+ if (newService.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+newService.getActions().size());
+ }
+
+ if ((newService.getActions().get(0) instanceof ReceiveMessageAction) == false) {
+ fail("Action 1 was not ReceiveMessageAction: "+newService.getActions().get(0));
+ }
+
+ if (newService.getActions().get(1) != act2) {
+ fail("Action 2 was not 2nd test ESB action: "+newService.getActions().get(1));
+ }
+
+ ReceiveMessageAction recv=(ReceiveMessageAction)
+ newService.getActions().get(0);
+
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ recv.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.delete(context, model, acts.get(0)) == false) {
+ fail("Failed to delete receive");
+ }
+
+ // Re-Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action 1 was not test ESB action: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action 2 was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ // TODO: Need to check if new service has been inserted
+ // in the middle of the previously inserted interactions
+
+ // Check actions
+ if (newService.getActions().size() != 1) {
+ fail("Now Expecting 1 action: "+newService.getActions().size());
+ }
+
+ if (newService.getActions().get(0) != act2) {
+ fail("Action 1 was not 2nd test ESB action: "+newService.getActions().get(0));
+ }
+ }
+
+ public void testDeleteMiddleSendBetweenTwoActions() {
+ ConversationInteractionModelChangeRule rule=new ConversationInteractionModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ // Add gateway service
+ TestESBService gwservice=(TestESBService)
+ model.createService("testcategory", "gateway");
+ gwservice.setGateway(true);
+
+ MessageRouterAction mra=new MessageRouterAction(gwservice);
+ gwservice.setGatewayAction(mra);
+
+ model.setGatewayService(gwservice);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ ConversationInteraction mobj1=new ConversationInteraction();
+ mobj1.setFromRole(role);
+ conv.getBlock().getContents().add(mobj1);
+
+ MessageSignature msig1=new MessageSignature();
+ mobj1.setMessageSignature(msig1);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setNamespace("ns");
+ ref1.setLocalpart("lp1");
+
+ msig1.getTypes().add(ref1);
+
+ if (rule.insert(context, model, mobj1, null) == false) {
+ fail("Failed to insert 1");
+ }
+
+ // Once first interaction associated with service it
+ // will become session based
+ service.setSessionBased(true);
+
+ TestESBAction act2=new TestESBAction();
+ ((ESBService)context.getParent()).addAction(act2, -1);
+
+ // Check actions
+ if (service.getActions().size() != 3) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action 1 was not test ESB action: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof SendMessageAction) == false) {
+ fail("Action 2 was not SendMessageAction: "+service.getActions().get(1));
+ }
+
+ if (service.getActions().get(2) != act2) {
+ fail("Action 3 was not 2nd test ESB action: "+service.getActions().get(2));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+
+ SendMessageAction send=(SendMessageAction)
+ service.getActions().get(1);
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ send.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.delete(context, model, acts.get(0)) == false) {
+ fail("Failed to delete send");
+ }
+
+ // Re-Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action 1 was not test ESB action: "+service.getActions().get(0));
+ }
+
+ if (service.getActions().get(1) != act2) {
+ fail("Action 2 was not 2nd test ESB action: "+service.getActions().get(1));
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,736 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.IfModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class IfModelChangeRuleTest extends TestCase {
-
- public void testInsertIfAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (ifService == null && iter.hasNext()) {
- ifService = iter.next();
- if (ifService == service) {
- ifService = null;
- }
- }
-
- IfAction action=(IfAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 1) {
- fail("Only one path child expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("if") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+ifService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+ifService.getName());
- }
- }
-
- public void testInsertIfElseIfAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- ESBService elseIfService1=null;
- ESBService elseIfService2=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((ifService == null || elseIfService1 == null ||
- elseIfService2 == null || join==null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- ifService = serv;
- }
- if (serv.getName().endsWith("__2")) {
- elseIfService1 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- elseIfService2 = serv;
- }
- }
-
- IfAction action=(IfAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("if") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+ifService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+ifService.getName());
- }
-
- if (ifService.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+ifService.getActions().size());
- }
-
- if ((ifService.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+ifService.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)ifService.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("elseif") == false) {
- fail("ElseIf expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(elseIfService1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+elseIfService1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(elseIfService1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+elseIfService1.getName());
- }
-
- if (elseIfService1.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+elseIfService1.getActions().size());
- }
-
- if ((elseIfService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+elseIfService1.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)elseIfService1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("elseif") == false) {
- fail("ElseIf(2) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(elseIfService2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+elseIfService2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(elseIfService2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+elseIfService2.getName());
- }
-
- if (elseIfService2.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+elseIfService2.getActions().size());
- }
-
- if ((elseIfService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+elseIfService2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)elseIfService2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-
- public void testInsertIfElseAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- If mobj=new If();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- Block b1=new Block();
- mobj.setElseBlock(b1);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof IfAction) == false) {
- fail("Action was not IfAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 4) {
- fail("Four services expected: "+model.getServices().size());
- }
-
- ESBService ifService=null;
- ESBService elseService=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((ifService == null || elseService == null ||
- join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- ifService = serv;
- }
- if (serv.getName().endsWith("__2")) {
- elseService = serv;
- }
- }
-
- IfAction action=(IfAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("if") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+ifService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+ifService.getName());
- }
-
- if (ifService.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+ifService.getActions().size());
- }
-
- if ((ifService.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+ifService.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)ifService.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("else") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(elseService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+elseService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(elseService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+elseService.getName());
- }
-
- if (elseService.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+elseService.getActions().size());
- }
-
- if ((elseService.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+elseService.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)ifService.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- }
-
- public void testInsertSwitchAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- If mobj=new If();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService switchService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (switchService == null && iter.hasNext()) {
- switchService = iter.next();
- if (switchService == service) {
- switchService = null;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 1) {
- fail("Only one path child expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Switch expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(switchService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+switchService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(switchService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+switchService.getName());
- }
- }
-
- public void testInsertSwitchMultipleCaseAction() {
- IfModelChangeRule rule=new IfModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- If mobj=new If();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- Block b1=new Block();
- mobj.setElseBlock(b1);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- ESBService caseService1=null;
- ESBService caseService2=null;
- ESBService caseService3=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((caseService1 == null || caseService2 == null ||
- caseService3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- caseService1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- caseService2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- caseService3 = serv;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("If expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService1.getName());
- }
-
- if (caseService1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+caseService1.getActions().size());
- }
-
- if ((caseService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)caseService1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService2.getName());
- }
-
- if (caseService2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+caseService2.getActions().size());
- }
-
- if ((caseService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService3.getName());
- }
-
- if (caseService3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+caseService3.getActions().size());
- }
-
- if ((caseService3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java (from rev 354, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/IfModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,1069 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.IfModelChangeRule;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class IfModelChangeRuleTest extends TestCase {
+
+ public void testInsertIfAction() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ If mobj=new If();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof IfAction) == false) {
+ fail("Action was not IfAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService ifService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (ifService == null && iter.hasNext()) {
+ ifService = iter.next();
+ if (ifService == service) {
+ ifService = null;
+ }
+ }
+
+ IfAction action=(IfAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 1) {
+ fail("Only one path child expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("if") == false) {
+ fail("If expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+ifService.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+ifService.getName());
+ }
+ }
+
+ public void testInsertIfActionWithSubsequentActions() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ service.addAction(act1, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ If mobj=new If();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof IfAction) == false) {
+ fail("Action was not IfAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService ifService=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((ifService == null || join == null) && iter.hasNext()) {
+ ESBService s = iter.next();
+ if (s != service) {
+ if (ifService == null) {
+ ifService = s;
+ } else if (join == null) {
+ join = s;
+ }
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act1) {
+ fail("Join action is not test ESB action");
+ }
+ }
+
+ public void testInsertIfActionWithPrecedingActions() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ If mobj=new If();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action 1 was not test ESB action");
+ }
+
+ if ((service.getActions().get(1) instanceof IfAction) == false) {
+ fail("Action 2 was not IfAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService ifService=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((ifService == null || join == null) && iter.hasNext()) {
+ ESBService s = iter.next();
+ if (s != service) {
+ if (ifService == null) {
+ ifService = s;
+ } else if (join == null) {
+ join = s;
+ }
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act2) {
+ fail("Join action is not test ESB action");
+ }
+ }
+
+ public void testInsertIfElseIfAction() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ If mobj=new If();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof IfAction) == false) {
+ fail("Action was not IfAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService ifService=null;
+ ESBService elseIfService1=null;
+ ESBService elseIfService2=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((ifService == null || elseIfService1 == null ||
+ elseIfService2 == null || join==null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ ifService = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ elseIfService1 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ elseIfService2 = serv;
+ }
+ }
+
+ IfAction action=(IfAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 3) {
+ fail("Three path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("if") == false) {
+ fail("If expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+ifService.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+ifService.getName());
+ }
+
+ if (ifService.getActions().size() != 1) {
+ fail("Path(1) does not have 1 action: "+ifService.getActions().size());
+ }
+
+ if ((ifService.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+ifService.getActions().get(0));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)ifService.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("elseif") == false) {
+ fail("ElseIf expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(elseIfService1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+elseIfService1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(elseIfService1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+elseIfService1.getName());
+ }
+
+ if (elseIfService1.getActions().size() != 1) {
+ fail("Path(2) does not have 1 action: "+elseIfService1.getActions().size());
+ }
+
+ if ((elseIfService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+elseIfService1.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)elseIfService1.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(2);
+
+ if (elem.getNodeName().equals("elseif") == false) {
+ fail("ElseIf(2) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(elseIfService2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+elseIfService2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(elseIfService2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+elseIfService2.getName());
+ }
+
+ if (elseIfService2.getActions().size() != 1) {
+ fail("Path(3) does not have 1 action: "+elseIfService2.getActions().size());
+ }
+
+ if ((elseIfService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+elseIfService2.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)elseIfService2.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+ }
+
+ public void testInsertIfElseAction() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ If mobj=new If();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ Block b1=new Block();
+ mobj.setElseBlock(b1);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof IfAction) == false) {
+ fail("Action was not IfAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 4) {
+ fail("Four services expected: "+model.getServices().size());
+ }
+
+ ESBService ifService=null;
+ ESBService elseService=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((ifService == null || elseService == null ||
+ join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ ifService = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ elseService = serv;
+ }
+ }
+
+ IfAction action=(IfAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Three path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("if") == false) {
+ fail("If expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(ifService.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+ifService.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(ifService.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+ifService.getName());
+ }
+
+ if (ifService.getActions().size() != 1) {
+ fail("Path(1) does not have 1 action: "+ifService.getActions().size());
+ }
+
+ if ((ifService.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+ifService.getActions().get(0));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)ifService.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("else") == false) {
+ fail("Else expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(elseService.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+elseService.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(elseService.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+elseService.getName());
+ }
+
+ if (elseService.getActions().size() != 1) {
+ fail("Path(2) does not have 1 action: "+elseService.getActions().size());
+ }
+
+ if ((elseService.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+elseService.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)ifService.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ }
+
+ public void testInsertSwitchAction() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ If mobj=new If();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService switchService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (switchService == null && iter.hasNext()) {
+ switchService = iter.next();
+ if (switchService == service) {
+ switchService = null;
+ }
+ }
+
+ SwitchAction action=(SwitchAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 1) {
+ fail("Only one path child expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Switch expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(switchService.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+switchService.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(switchService.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+switchService.getName());
+ }
+ }
+
+ public void testInsertSwitchMultipleCaseAction() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ If mobj=new If();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ Block b1=new Block();
+ mobj.setElseBlock(b1);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService join=null;
+ ESBService caseService1=null;
+ ESBService caseService2=null;
+ ESBService caseService3=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((caseService1 == null || caseService2 == null ||
+ caseService3 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ caseService1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ caseService2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ caseService3 = serv;
+ }
+ }
+
+ SwitchAction action=(SwitchAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 3) {
+ fail("Three path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("If expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(caseService1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+caseService1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(caseService1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+caseService1.getName());
+ }
+
+ if (caseService1.getActions().size() != 1) {
+ fail("Path(1) does not have 1 action: "+caseService1.getActions().size());
+ }
+
+ if ((caseService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+caseService1.getActions().get(0));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)caseService1.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Else expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(caseService2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+caseService2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(caseService2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+caseService2.getName());
+ }
+
+ if (caseService2.getActions().size() != 1) {
+ fail("Path(2) does not have 1 action: "+caseService2.getActions().size());
+ }
+
+ if ((caseService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+caseService2.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)caseService2.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(2);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Else expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(caseService3.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+caseService3.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(caseService3.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+caseService3.getName());
+ }
+
+ if (caseService3.getActions().size() != 1) {
+ fail("Path(3) does not have 1 action: "+caseService3.getActions().size());
+ }
+
+ if ((caseService3.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+caseService3.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)caseService3.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+ }
+
+ public void testInsertSwitchActionWithSubsequentActions() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ service.addAction(act1, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ If mobj=new If();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService switchService=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((switchService == null || join == null) && iter.hasNext()) {
+ ESBService s = iter.next();
+ if (s != service) {
+ if (switchService == null) {
+ switchService = s;
+ } else if (join == null) {
+ join = s;
+ }
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act1) {
+ fail("Join action is not test ESB action");
+ }
+ }
+
+ public void testInsertSwitchActionWithPrecedingActions() {
+ IfModelChangeRule rule=new IfModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ If mobj=new If();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("First action not test ESB action");
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)service.getActions().get(1);
+
+ ESBService addedService=model.getService(
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY),
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+
+ if (addedService == null) {
+ fail("Failed to find service '"+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+"' '"+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+"'");
+ }
+
+ if (addedService.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((addedService.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 4) {
+ fail("Four services expected: "+model.getServices().size());
+ }
+
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (join == null && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act2) {
+ fail("Join action is not test ESB action");
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,512 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.ParallelModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.analysis.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class ParallelModelChangeRuleTest extends TestCase {
-
- public void testInsertParallelAction() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- Parallel mobj=new Parallel();
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- Block cb2=new Block();
- mobj.getBlocks().add(cb2);
-
- Block cb3=new Block();
- mobj.getBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- ESBService s3=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null || s3 == null ||
- join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- s3 = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 4) {
- fail("Four path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(1) immediate not set");
- }
-
- if (s1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+s1.getActions().size());
- }
-
- if ((s1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)s1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(2) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(2) immediate not set");
- }
-
- if (s2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+s2.getActions().size());
- }
-
- if ((s2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(3) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s3.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(3) immediate not set");
- }
-
- if (s3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+s3.getActions().size());
- }
-
- if ((s3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(3);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
- }
-
- public void testInsertParallelActionWithImmediateFalse() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
-
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- Parallel mobj=new Parallel();
- conv.getBlock().getContents().add(mobj);
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- cb1.getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("path(1) should not be immediate");
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
- }
-
- public void testInsertParallelActionWithImmediateTrue() {
- ParallelModelChangeRule rule=new ParallelModelChangeRule();
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setFromRole(role);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- Parallel mobj=new Parallel();
- conv.getBlock().getContents().add(mobj);
-
- Block cb1=new Block();
- mobj.getBlocks().add(cb1);
-
- cb1.getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ParallelAction) == false) {
- fail("Action was not ParallelAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- }
-
- ParallelAction action=(ParallelAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("path") == false) {
- fail("path(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (elem.getAttribute("immediate").equals("true") == false) {
- fail("path(1) should be immediate");
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("join") == false) {
- fail("join expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+join.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(join.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+join.getName());
- }
-
- if (elem.hasAttribute("immediate")) {
- fail("Join should not be immediate");
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java (from rev 354, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/ParallelModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,624 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.ParallelModelChangeRule;
+import org.scribble.model.*;
+import org.scribble.model.analysis.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class ParallelModelChangeRuleTest extends TestCase {
+
+ public void testInsertParallelAction() {
+ ParallelModelChangeRule rule=new ParallelModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Parallel mobj=new Parallel();
+
+ Block cb1=new Block();
+ mobj.getBlocks().add(cb1);
+
+ Block cb2=new Block();
+ mobj.getBlocks().add(cb2);
+
+ Block cb3=new Block();
+ mobj.getBlocks().add(cb3);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ParallelAction) == false) {
+ fail("Action was not ParallelAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ ESBService s3=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null || s3 == null ||
+ join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ s2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ s3 = serv;
+ }
+ }
+
+ ParallelAction action=(ParallelAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 4) {
+ fail("Four path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("path") == false) {
+ fail("path(1) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ if (elem.getAttribute("immediate").equals("true") == false) {
+ fail("path(1) immediate not set");
+ }
+
+ if (s1.getActions().size() != 1) {
+ fail("Path(1) does not have 1 action: "+s1.getActions().size());
+ }
+
+ if ((s1.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+s1.getActions().get(0));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)s1.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("path") == false) {
+ fail("path(2) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s2.getName());
+ }
+
+ if (elem.getAttribute("immediate").equals("true") == false) {
+ fail("path(2) immediate not set");
+ }
+
+ if (s2.getActions().size() != 1) {
+ fail("Path(2) does not have 1 action: "+s2.getActions().size());
+ }
+
+ if ((s2.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+s2.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)s2.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(2);
+
+ if (elem.getNodeName().equals("path") == false) {
+ fail("path(3) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s3.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s3.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s3.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s3.getName());
+ }
+
+ if (elem.getAttribute("immediate").equals("true") == false) {
+ fail("path(3) immediate not set");
+ }
+
+ if (s3.getActions().size() != 1) {
+ fail("Path(3) does not have 1 action: "+s3.getActions().size());
+ }
+
+ if ((s3.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+s3.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)s3.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(3);
+
+ if (elem.getNodeName().equals("join") == false) {
+ fail("join expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+join.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(join.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+join.getName());
+ }
+
+ if (elem.hasAttribute("immediate")) {
+ fail("Join should not be immediate");
+ }
+ }
+
+ public void testInsertParallelActionWithImmediateFalse() {
+ ParallelModelChangeRule rule=new ParallelModelChangeRule();
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setToRole(role);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ Parallel mobj=new Parallel();
+ conv.getBlock().getContents().add(mobj);
+
+ Block cb1=new Block();
+ mobj.getBlocks().add(cb1);
+
+ cb1.getContents().add(interaction);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ParallelAction) == false) {
+ fail("Action was not ParallelAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ }
+
+ ParallelAction action=(ParallelAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Two path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("path") == false) {
+ fail("path(1) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ if (elem.hasAttribute("immediate")) {
+ fail("path(1) should not be immediate");
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("join") == false) {
+ fail("join expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+join.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(join.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+join.getName());
+ }
+
+ if (elem.hasAttribute("immediate")) {
+ fail("Join should not be immediate");
+ }
+ }
+
+ public void testInsertParallelActionWithImmediateTrue() {
+ ParallelModelChangeRule rule=new ParallelModelChangeRule();
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setFromRole(role);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ Parallel mobj=new Parallel();
+ conv.getBlock().getContents().add(mobj);
+
+ Block cb1=new Block();
+ mobj.getBlocks().add(cb1);
+
+ cb1.getContents().add(interaction);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof ParallelAction) == false) {
+ fail("Action was not ParallelAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ }
+
+ ParallelAction action=(ParallelAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Two path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("path") == false) {
+ fail("path(1) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ if (elem.getAttribute("immediate").equals("true") == false) {
+ fail("path(1) should be immediate");
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("join") == false) {
+ fail("join expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+join.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(join.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+join.getName());
+ }
+
+ if (elem.hasAttribute("immediate")) {
+ fail("Join should not be immediate");
+ }
+ }
+
+ public void testInsertParallelMiddleAction() {
+ ParallelModelChangeRule rule=new ParallelModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject moref=new ModelObject() {};
+ moref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ Parallel mobj=new Parallel();
+
+ Block cb1=new Block();
+ mobj.getBlocks().add(cb1);
+
+ Block cb2=new Block();
+ mobj.getBlocks().add(cb2);
+
+ Block cb3=new Block();
+ mobj.getBlocks().add(cb3);
+
+ if (rule.insert(context, model, mobj, moref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action was not test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ParallelAction) == false) {
+ fail("Action was not ParallelAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (join == null && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ }
+
+ ParallelAction action=(ParallelAction)service.getActions().get(1);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 4) {
+ fail("Four path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(3);
+
+ if (elem.getNodeName().equals("join") == false) {
+ fail("join expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(join.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+join.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(join.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+join.getName());
+ }
+
+ if (elem.hasAttribute("immediate")) {
+ fail("Join should not be immediate");
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Expecting 1 join action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act2) {
+ fail("Action was not test ESB action 2: "+join.getActions().get(0));
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.RunModelChangeRule;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ConversationUtil;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class RunModelChangeRuleTest extends TestCase {
-
- public void testInsertPerformAction() {
- String runName="subconv";
-
- RunModelChangeRule rule=new RunModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- ConversationModel cm=new ConversationModel();
-
- Namespace ns=new Namespace();
- cm.setNamespace(ns);
- ns.setName("ns");
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- mname.setLocatedRole(role);
- conv.setModelName(mname);
-
- cm.setConversation(conv);
-
- Conversation subconv=new Conversation();
- ModelName submname=new ModelName();
- submname.setName(runName);
- submname.setLocatedRole(role);
- subconv.setModelName(mname);
-
- Run mobj=new Run();
- mobj.setInlineDefinition(subconv);
-
- conv.getBlock().getContents().add(mobj);
-
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof PerformAction) == false) {
- fail("Action was not PerformAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 2) {
- fail("Two services expected: "+model.getServices().size());
- }
-
- PerformAction action=(PerformAction)service.getActions().get(0);
-
- ESBService newService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
- while (newService == null && iter.hasNext()) {
- ESBService s=iter.next();
-
- if (s != service) {
- newService = s;
- }
- }
-
- if (newService == null) {
- fail("Other service not found");
- }
-
- // Check details
- if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)) == false) {
- fail("Perform service category '"+
- action.getPropertyValue(
- PerformAction.SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceCategory(mobj.getDefinition()));
- }
-
- if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
- PerformAction.SERVICE_NAME)) == false) {
- fail("Perform service name '"+
- action.getPropertyValue(
- PerformAction.SERVICE_NAME)+
- "' invalid, expecting: "+
- ConversationUtil.getServiceName(mobj.getDefinition()));
- }
- if (newService.getCategory().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
- fail("Perform return service category '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_CATEGORY)+
- "' invalid, expecting: "+
- newService.getCategory());
- }
-
- if (newService.getName().equals(action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)) == false) {
- fail("Perform return service name '"+
- action.getPropertyValue(
- PerformAction.RETURN_SERVICE_NAME)+
- "' invalid, expecting: "+
- newService.getName());
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/RunModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,471 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.RunModelChangeRule;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ConversationUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class RunModelChangeRuleTest extends TestCase {
+
+ public void testInsertPerformAction() {
+ String runName="subconv";
+
+ RunModelChangeRule rule=new RunModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ ConversationModel cm=new ConversationModel();
+
+ Namespace ns=new Namespace();
+ cm.setNamespace(ns);
+ ns.setName("ns");
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ cm.setConversation(conv);
+
+ Conversation subconv=new Conversation();
+ ModelName submname=new ModelName();
+ submname.setName(runName);
+ submname.setLocatedRole(role);
+ subconv.setModelName(mname);
+
+ Run mobj=new Run();
+ mobj.setInlineDefinition(subconv);
+
+ conv.getBlock().getContents().add(mobj);
+
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof PerformAction) == false) {
+ fail("Action was not PerformAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ PerformAction action=(PerformAction)service.getActions().get(0);
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ // Check details
+ if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)) == false) {
+ fail("Perform service category '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceCategory(mobj.getDefinition()));
+ }
+
+ if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_NAME)) == false) {
+ fail("Perform service name '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceName(mobj.getDefinition()));
+ }
+ if (newService.getCategory().equals(action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
+ fail("Perform return service category '"+
+ action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ newService.getCategory());
+ }
+
+ if (newService.getName().equals(action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_NAME)) == false) {
+ fail("Perform return service name '"+
+ action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_NAME)+
+ "' invalid, expecting: "+
+ newService.getName());
+ }
+ }
+
+ public void testInsertPerformActionMiddle() {
+ String runName="subconv";
+
+ RunModelChangeRule rule=new RunModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject moref=new ModelObject() {};
+ moref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ ConversationModel cm=new ConversationModel();
+
+ Namespace ns=new Namespace();
+ cm.setNamespace(ns);
+ ns.setName("ns");
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ cm.setConversation(conv);
+
+ Conversation subconv=new Conversation();
+ ModelName submname=new ModelName();
+ submname.setName(runName);
+ submname.setLocatedRole(role);
+ subconv.setModelName(mname);
+
+ Run mobj=new Run();
+ mobj.setInlineDefinition(subconv);
+
+ conv.getBlock().getContents().add(mobj);
+
+
+ if (rule.insert(context, model, mobj, moref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Expecting test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof PerformAction) == false) {
+ fail("Action was not PerformAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ PerformAction action=(PerformAction)service.getActions().get(1);
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ // Check details
+ if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)) == false) {
+ fail("Perform service category '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceCategory(mobj.getDefinition()));
+ }
+
+ if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_NAME)) == false) {
+ fail("Perform service name '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceName(mobj.getDefinition()));
+ }
+ if (newService.getCategory().equals(action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
+ fail("Perform return service category '"+
+ action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ newService.getCategory());
+ }
+
+ if (newService.getName().equals(action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_NAME)) == false) {
+ fail("Perform return service name '"+
+ action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_NAME)+
+ "' invalid, expecting: "+
+ newService.getName());
+ }
+
+ if (newService.getActions().size() != 1) {
+ fail("Return service should have 1 action: "+newService.getActions().size());
+ }
+
+ if (newService.getActions().get(0) != act2) {
+ fail("Expecting test ESB action 2: "+newService.getActions().get(0));
+ }
+
+ }
+ public void testDeletePerformActionMiddle() {
+ String runName="subconv";
+
+ RunModelChangeRule rule=new RunModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ ConversationModel cm=new ConversationModel();
+
+ Namespace ns=new Namespace();
+ cm.setNamespace(ns);
+ ns.setName("ns");
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ cm.setConversation(conv);
+
+ Conversation subconv=new Conversation();
+ ModelName submname=new ModelName();
+ submname.setName(runName);
+ submname.setLocatedRole(role);
+ subconv.setModelName(mname);
+
+ Run mobj=new Run();
+ mobj.setInlineDefinition(subconv);
+
+ conv.getBlock().getContents().add(mobj);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ TestESBAction act2=new TestESBAction();
+ ((ESBService)context.getParent()).addAction(act2, -1);
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Expecting test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof PerformAction) == false) {
+ fail("Action was not PerformAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ PerformAction action=(PerformAction)service.getActions().get(1);
+
+ ESBService newService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+ while (newService == null && iter.hasNext()) {
+ ESBService s=iter.next();
+
+ if (s != service) {
+ newService = s;
+ }
+ }
+
+ if (newService == null) {
+ fail("Other service not found");
+ }
+
+ // Check details
+ if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)) == false) {
+ fail("Perform service category '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceCategory(mobj.getDefinition()));
+ }
+
+ if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_NAME)) == false) {
+ fail("Perform service name '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceName(mobj.getDefinition()));
+ }
+ if (newService.getCategory().equals(action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_CATEGORY)) == false) {
+ fail("Perform return service category '"+
+ action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ newService.getCategory());
+ }
+
+ if (newService.getName().equals(action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_NAME)) == false) {
+ fail("Perform return service name '"+
+ action.getPropertyValue(
+ PerformAction.RETURN_SERVICE_NAME)+
+ "' invalid, expecting: "+
+ newService.getName());
+ }
+
+ if (newService.getActions().size() != 1) {
+ fail("Return service should have 1 action: "+newService.getActions().size());
+ }
+
+ if (newService.getActions().get(0) != act2) {
+ fail("Expecting test ESB action 2: "+newService.getActions().get(0));
+ }
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ action.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.delete(context, model, acts.get(0)) == false) {
+ fail("Failed to delete spawn");
+ }
+
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Expecting test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ ScheduleStateAction ssa=(ScheduleStateAction)service.getActions().get(1);
+
+ if (ssa.getPropertyValue(PerformAction.SERVICE_CATEGORY).equals(newService.getCategory()) == false) {
+ fail("Category not correct '"+ssa.getPropertyValue(PerformAction.SERVICE_CATEGORY)+
+ "' expecting: "+newService.getCategory());
+ }
+
+ if (ssa.getPropertyValue(PerformAction.SERVICE_NAME).equals(newService.getName()) == false) {
+ fail("Name not correct '"+ssa.getPropertyValue(PerformAction.SERVICE_NAME)+
+ "' expecting: "+newService.getName());
+ }
+
+ if (newService.getActions().size() != 1) {
+ fail("Return service should have 1 action: "+newService.getActions().size());
+ }
+
+ if (newService.getActions().get(0) != act2) {
+ fail("Expecting test ESB action 2: "+newService.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 2) {
+ fail("Two services expected: "+model.getServices().size());
+ }
+
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRuleTest.java (from rev 356, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/SpawnModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,346 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.RunModelChangeRule;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.SpawnModelChangeRule;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ConversationUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.InteractionUtil;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class SpawnModelChangeRuleTest extends TestCase {
+
+ public void testInsertPerformAction() {
+ String runName="subconv";
+
+ SpawnModelChangeRule rule=new SpawnModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ ConversationModel cm=new ConversationModel();
+
+ Namespace ns=new Namespace();
+ cm.setNamespace(ns);
+ ns.setName("ns");
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ cm.setConversation(conv);
+
+ Conversation subconv=new Conversation();
+ ModelName submname=new ModelName();
+ submname.setName(runName);
+ submname.setLocatedRole(role);
+ subconv.setModelName(mname);
+
+ Spawn mobj=new Spawn();
+ mobj.setInlineDefinition(subconv);
+
+ conv.getBlock().getContents().add(mobj);
+
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof PerformAction) == false) {
+ fail("Action was not PerformAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One service expected: "+model.getServices().size());
+ }
+
+ PerformAction action=(PerformAction)service.getActions().get(0);
+
+ // Check details
+ if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)) == false) {
+ fail("Perform service category '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceCategory(mobj.getDefinition()));
+ }
+
+ if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_NAME)) == false) {
+ fail("Perform service name '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceName(mobj.getDefinition()));
+ }
+ }
+
+ public void testInsertPerformActionMiddle() {
+ String runName="subconv";
+
+ SpawnModelChangeRule rule=new SpawnModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject moref=new ModelObject() {};
+ moref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ ConversationModel cm=new ConversationModel();
+
+ Namespace ns=new Namespace();
+ cm.setNamespace(ns);
+ ns.setName("ns");
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ cm.setConversation(conv);
+
+ Conversation subconv=new Conversation();
+ ModelName submname=new ModelName();
+ submname.setName(runName);
+ submname.setLocatedRole(role);
+ subconv.setModelName(mname);
+
+ Spawn mobj=new Spawn();
+ mobj.setInlineDefinition(subconv);
+
+ conv.getBlock().getContents().add(mobj);
+
+
+ if (rule.insert(context, model, mobj, moref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 3) {
+ fail("Expecting 3 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Expecting test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof PerformAction) == false) {
+ fail("Action was not PerformAction: "+service.getActions().get(1));
+ }
+
+ if (service.getActions().get(2) != act2) {
+ fail("Expecting test ESB action 2: "+service.getActions().get(2));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One services expected: "+model.getServices().size());
+ }
+
+ PerformAction action=(PerformAction)service.getActions().get(1);
+
+ // Check details
+ if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)) == false) {
+ fail("Perform service category '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceCategory(mobj.getDefinition()));
+ }
+
+ if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_NAME)) == false) {
+ fail("Perform service name '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceName(mobj.getDefinition()));
+ }
+ }
+
+ public void testDeletePerformActionMiddle() {
+ String runName="subconv";
+
+ SpawnModelChangeRule rule=new SpawnModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ ConversationModel cm=new ConversationModel();
+
+ Namespace ns=new Namespace();
+ cm.setNamespace(ns);
+ ns.setName("ns");
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ mname.setLocatedRole(role);
+ conv.setModelName(mname);
+
+ cm.setConversation(conv);
+
+ Conversation subconv=new Conversation();
+ ModelName submname=new ModelName();
+ submname.setName(runName);
+ submname.setLocatedRole(role);
+ subconv.setModelName(mname);
+
+ Spawn mobj=new Spawn();
+ mobj.setInlineDefinition(subconv);
+
+ conv.getBlock().getContents().add(mobj);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ // Check actions
+ if (service.getActions().size() != 3) {
+ fail("Expecting 3 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Expecting test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof PerformAction) == false) {
+ fail("Action was not PerformAction: "+service.getActions().get(1));
+ }
+
+ if (service.getActions().get(2) != act2) {
+ fail("Expecting test ESB action 2: "+service.getActions().get(2));
+ }
+
+ if (model.getServices().size() != 1) {
+ fail("One services expected: "+model.getServices().size());
+ }
+
+ PerformAction action=(PerformAction)service.getActions().get(1);
+
+ // Check details
+ if (ConversationUtil.getServiceCategory(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)) == false) {
+ fail("Perform service category '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_CATEGORY)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceCategory(mobj.getDefinition()));
+ }
+
+ if (ConversationUtil.getServiceName(mobj.getDefinition()).equals(action.getPropertyValue(
+ PerformAction.SERVICE_NAME)) == false) {
+ fail("Perform service name '"+
+ action.getPropertyValue(
+ PerformAction.SERVICE_NAME)+
+ "' invalid, expecting: "+
+ ConversationUtil.getServiceName(mobj.getDefinition()));
+ }
+
+ java.util.List<Activity> acts=new java.util.Vector<Activity>();
+
+ DefaultConversionContext convContext=new DefaultConversionContext(role.getName());
+ action.convert(acts, convContext);
+
+ if (acts.size() != 1) {
+ fail("Expecting 1 activity: "+acts.size());
+ }
+
+ // TODO: Need to pass representation of last interaction
+ if (rule.delete(context, model, acts.get(0)) == false) {
+ fail("Failed to delete spawn");
+ }
+
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Expecting test ESB action 1: "+service.getActions().get(0));
+ }
+
+ if (service.getActions().get(1) != act2) {
+ fail("Expecting test ESB action 2: "+service.getActions().get(1));
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,513 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.WhenModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class WhenModelChangeRuleTest extends TestCase {
-
- public void testInsertWhenAction() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role=new Role();
- role.setName("role1");
-
- context.setRole(role);
-
- When mobj=new When();
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhenAction) == false) {
- fail("Action was not WhenAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- ESBService s3=null;
- ESBService join=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null ||
- s3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- s3 = serv;
- }
- }
-
- WhenAction action=(WhenAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("when") == false) {
- fail("when(1) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- if (s1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+s1.getActions().size());
- }
-
- if ((s1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)s1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("when") == false) {
- fail("when(2) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
-
- if (s2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+s2.getActions().size());
- }
-
- if ((s2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("when") == false) {
- fail("when(3) expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s3.getName());
- }
-
- if (s3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+s3.getActions().size());
- }
-
- if ((s3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+s3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)s3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-
- public void testInsertSwitchAction() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- When mobj=new When();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService switchService=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while (switchService == null && iter.hasNext()) {
- switchService = iter.next();
- if (switchService == service) {
- switchService = null;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 1) {
- fail("Only one path child expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Switch expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(switchService.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+switchService.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(switchService.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+switchService.getName());
- }
- }
-
- public void testInsertSwitchMultipleCaseAction() {
- WhenModelChangeRule rule=new WhenModelChangeRule();
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(null);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- Role role1=new Role();
- role1.setName("role1");
-
- Role role2=new Role();
- role2.setName("role2");
-
- context.setRole(role1);
-
- When mobj=new When();
-
- mobj.getRoles().add(role2);
-
- ConditionalBlock cb1=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb1);
-
- ConditionalBlock cb2=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb2);
-
- ConditionalBlock cb3=new ConditionalBlock();
- mobj.getConditionalBlocks().add(cb3);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof SwitchAction) == false) {
- fail("Action was not SwitchAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 5) {
- fail("Five services expected: "+model.getServices().size());
- }
-
- ESBService join=null;
- ESBService caseService1=null;
- ESBService caseService2=null;
- ESBService caseService3=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((caseService1 == null || caseService2 == null ||
- caseService3 == null || join == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- join = serv;
- }
- if (serv.getName().endsWith("__1")) {
- caseService1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- caseService2 = serv;
- }
- if (serv.getName().endsWith("__3")) {
- caseService3 = serv;
- }
- }
-
- SwitchAction action=(SwitchAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 3) {
- fail("Three path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Case expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService1.getName());
- }
-
- if (caseService1.getActions().size() != 1) {
- fail("Path(1) does not have 1 action: "+caseService1.getActions().size());
- }
-
- if ((caseService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService1.getActions().get(0));
- }
-
- ScheduleStateAction schedule=(ScheduleStateAction)caseService1.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Case expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService2.getName());
- }
-
- if (caseService2.getActions().size() != 1) {
- fail("Path(2) does not have 1 action: "+caseService2.getActions().size());
- }
-
- if ((caseService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService2.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService2.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
-
- elem=(org.w3c.dom.Element)paths.item(2);
-
- if (elem.getNodeName().equals("case") == false) {
- fail("Else expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(caseService3.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+caseService3.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(caseService3.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+caseService3.getName());
- }
-
- if (caseService3.getActions().size() != 1) {
- fail("Path(3) does not have 1 action: "+caseService3.getActions().size());
- }
-
- if ((caseService3.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action not schedule state: "+caseService3.getActions().get(0));
- }
-
- schedule=(ScheduleStateAction)caseService3.getActions().get(0);
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(join.getCategory()) == false) {
- fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
- }
-
- if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(join.getName()) == false) {
- fail("Schedule name is not join '"+join.getName()+"': "+
- schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java (from rev 352, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhenModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,903 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.WhenModelChangeRule;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class WhenModelChangeRuleTest extends TestCase {
+
+ public void testInsertWhenAction() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ When mobj=new When();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof WhenAction) == false) {
+ fail("Action was not WhenAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ ESBService s3=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null ||
+ s3 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ s2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ s3 = serv;
+ }
+ }
+
+ WhenAction action=(WhenAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 3) {
+ fail("Three path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("when") == false) {
+ fail("when(1) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ if (s1.getActions().size() != 1) {
+ fail("Path(1) does not have 1 action: "+s1.getActions().size());
+ }
+
+ if ((s1.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+s1.getActions().get(0));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)s1.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("when") == false) {
+ fail("when(2) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s2.getName());
+ }
+
+ if (s2.getActions().size() != 1) {
+ fail("Path(2) does not have 1 action: "+s2.getActions().size());
+ }
+
+ if ((s2.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+s2.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)s2.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(2);
+
+ if (elem.getNodeName().equals("when") == false) {
+ fail("when(3) expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s3.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s3.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s3.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s3.getName());
+ }
+
+ if (s3.getActions().size() != 1) {
+ fail("Path(3) does not have 1 action: "+s3.getActions().size());
+ }
+
+ if ((s3.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+s3.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)s3.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+ }
+
+ public void testInsertWhenActionWithSubsequentActions() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ service.addAction(act1, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ When mobj=new When();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 actions: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof WhenAction) == false) {
+ fail("Action was not WhenAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ ESBService s3=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null ||
+ s3 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ s2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ s3 = serv;
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act1) {
+ fail("Join action is not test ESB action");
+ }
+ }
+
+
+ public void testInsertWhenActionWithPrecedingActions() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ context.setRole(role);
+
+ When mobj=new When();
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 actions: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action 1 was not test ESB action");
+ }
+
+ if ((service.getActions().get(1) instanceof WhenAction) == false) {
+ fail("Action 2 was not WhenAction: "+service.getActions().get(1));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ ESBService s3=null;
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null ||
+ s3 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ s2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ s3 = serv;
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act2) {
+ fail("Join action is not test ESB action 2");
+ }
+ }
+
+ public void testInsertSwitchAction() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ When mobj=new When();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService switchService=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (switchService == null && iter.hasNext()) {
+ switchService = iter.next();
+ if (switchService == service) {
+ switchService = null;
+ }
+ }
+
+ SwitchAction action=(SwitchAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 1) {
+ fail("Only one path child expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Switch expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(switchService.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+switchService.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(switchService.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+switchService.getName());
+ }
+ }
+
+ public void testInsertSwitchMultipleCaseAction() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ When mobj=new When();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService join=null;
+ ESBService caseService1=null;
+ ESBService caseService2=null;
+ ESBService caseService3=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((caseService1 == null || caseService2 == null ||
+ caseService3 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ caseService1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ caseService2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ caseService3 = serv;
+ }
+ }
+
+ SwitchAction action=(SwitchAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 3) {
+ fail("Three path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Case expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(caseService1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+caseService1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(caseService1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+caseService1.getName());
+ }
+
+ if (caseService1.getActions().size() != 1) {
+ fail("Path(1) does not have 1 action: "+caseService1.getActions().size());
+ }
+
+ if ((caseService1.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+caseService1.getActions().get(0));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)caseService1.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Case expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(caseService2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+caseService2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(caseService2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+caseService2.getName());
+ }
+
+ if (caseService2.getActions().size() != 1) {
+ fail("Path(2) does not have 1 action: "+caseService2.getActions().size());
+ }
+
+ if ((caseService2.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+caseService2.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)caseService2.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(2);
+
+ if (elem.getNodeName().equals("case") == false) {
+ fail("Else expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(caseService3.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+caseService3.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(caseService3.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+caseService3.getName());
+ }
+
+ if (caseService3.getActions().size() != 1) {
+ fail("Path(3) does not have 1 action: "+caseService3.getActions().size());
+ }
+
+ if ((caseService3.getActions().get(0) instanceof ScheduleStateAction) == false) {
+ fail("Action not schedule state: "+caseService3.getActions().get(0));
+ }
+
+ schedule=(ScheduleStateAction)caseService3.getActions().get(0);
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(join.getCategory()) == false) {
+ fail("Schedule cateogry is not join '"+join.getCategory()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY));
+ }
+
+ if (schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(join.getName()) == false) {
+ fail("Schedule name is not join '"+join.getName()+"': "+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+ }
+ }
+
+ public void testInsertSwitchActionWithSubsequentActions() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ service.addAction(act1, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ When mobj=new When();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 5) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService join=null;
+ ESBService caseService1=null;
+ ESBService caseService2=null;
+ ESBService caseService3=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((caseService1 == null || caseService2 == null ||
+ caseService3 == null || join == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ caseService1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ caseService2 = serv;
+ }
+ if (serv.getName().endsWith("__3")) {
+ caseService3 = serv;
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act1) {
+ fail("Join action is not test ESB action");
+ }
+ }
+
+ public void testInsertSwitchActionWithPrecedingActions() {
+ WhenModelChangeRule rule=new WhenModelChangeRule();
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(null);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject ref=new ModelObject() {};
+ ref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ Role role1=new Role();
+ role1.setName("role1");
+
+ Role role2=new Role();
+ role2.setName("role2");
+
+ context.setRole(role1);
+
+ When mobj=new When();
+
+ mobj.getRoles().add(role2);
+
+ ConditionalBlock cb1=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb1);
+
+ ConditionalBlock cb2=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb2);
+
+ ConditionalBlock cb3=new ConditionalBlock();
+ mobj.getConditionalBlocks().add(cb3);
+
+ if (rule.insert(context, model, mobj, ref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 2 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("First action not test ESB action");
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ ScheduleStateAction schedule=(ScheduleStateAction)service.getActions().get(1);
+
+ ESBService addedService=model.getService(
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY),
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME));
+
+ if (addedService == null) {
+ fail("Failed to find service '"+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+"' '"+
+ schedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+"'");
+ }
+
+ if (addedService.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((addedService.getActions().get(0) instanceof SwitchAction) == false) {
+ fail("Action was not SwitchAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 6) {
+ fail("Five services expected: "+model.getServices().size());
+ }
+
+ ESBService join=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (join == null && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ join = serv;
+ }
+ }
+
+ if (join.getActions().size() != 1) {
+ fail("Join service does not have 1 action: "+join.getActions().size());
+ }
+
+ if (join.getActions().get(0) != act2) {
+ fail("Join action is not test ESB action");
+ }
+ }
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -1,584 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.jbossesb.model.change;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.overlord.cdl.jbossesb.model.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.actions.*;
-import org.jboss.tools.overlord.cdl.jbossesb.model.change.WhileModelChangeRule;
-import org.scribble.model.*;
-import org.scribble.model.analysis.TestLookaheadAnalyser;
-import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
-
-public class WhileModelChangeRuleTest extends TestCase {
-
- public void testInsertWhileActionInitiator() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s2 = serv;
- }
- }
-
- WhileAction action=(WhileAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 0) {
- fail("Should have no message types: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileActionRecipient() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getBlock().getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s2 = serv;
- }
- }
-
- WhileAction action=(WhileAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 1) {
- fail("Should have single message type: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileActionRecipientNoRecvLookahead() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setFromRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getBlock().getContents().add(interaction);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+service.getActions().get(0));
- }
-
- if (model.getServices().size() != 3) {
- fail("Three services expected: "+model.getServices().size());
- }
-
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null) && iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s2 = serv;
- }
- }
-
- WhileAction action=(WhileAction)service.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 0) {
- fail("Should have no message type: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-
- public void testInsertWhileNotFirstSessionAction() {
- WhileModelChangeRule rule=new WhileModelChangeRule();
-
- TestESBLanguageModel model=new TestESBLanguageModel();
-
- TestESBService service=(TestESBService)
- model.createService("testcategory", "testname");
-
- model.addService(service);
-
- // Make session based service
- service.setSessionBased(true);
-
- TestModelChangeContext context=new TestModelChangeContext();
- context.setParent(service);
-
- java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
-
- TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
- tla.setInteractions(interactions);
-
- Role role=new Role();
- role.setName("role1");
-
- Interaction interaction=new Interaction();
- interaction.setToRole(role);
-
- TypeReference ref=new TypeReference();
- ref.setNamespace("ns");
- ref.setLocalpart("lp");
-
- MessageSignature msig=new MessageSignature();
- interaction.setMessageSignature(msig);
- msig.getTypes().add(ref);
-
- interactions.add(interaction);
-
- org.scribble.extensions.TestSingleExtensionRegistry reg=
- new org.scribble.extensions.TestSingleExtensionRegistry(tla);
- org.scribble.extensions.RegistryFactory.setRegistry(reg);
-
- context.setRole(role);
-
- Conversation conv=new Conversation();
- ModelName mname=new ModelName();
- conv.setModelName(mname);
-
- mname.setLocatedRole(role);
-
- While mobj=new While();
- conv.getBlock().getContents().add(mobj);
-
- mobj.getRoles().add(role);
-
- if (rule.insert(context, model, mobj, -1) == false) {
- fail("Failed to insert");
- }
-
- // Check actions
- if (service.getActions().size() != 1) {
- fail("Expecting 1 action: "+service.getActions().size());
- }
-
- if ((service.getActions().get(0) instanceof ScheduleStateAction) == false) {
- fail("Action was not ScheduleStateAction: "+service.getActions().get(0));
- }
-
- ScheduleStateAction whileSchedule=(ScheduleStateAction)
- service.getActions().get(0);
-
- if (model.getServices().size() != 4) {
- fail("Four services expected: "+model.getServices().size());
- }
-
- ESBService whileService=null;
- ESBService s1=null;
- ESBService s2=null;
- java.util.Iterator<ESBService> iter=model.getServices().iterator();
-
- while ((s1 == null || s2 == null || whileService == null) &&
- iter.hasNext()) {
- ESBService serv = iter.next();
- if (serv.getName().endsWith("__0")) {
- whileService = serv;
- }
- if (serv.getName().endsWith("__1")) {
- s1 = serv;
- }
- if (serv.getName().endsWith("__2")) {
- s2 = serv;
- }
- }
-
- if (whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
- equals(whileService.getCategory()) == false) {
- fail("While schedule action category '"+
- whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+
- "' not expected: "+whileService.getCategory());
- }
-
- if (whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
- equals(whileService.getName()) == false) {
- fail("While schedule action service name '"+
- whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+
- "' not expected: "+whileService.getName());
- }
-
- if (whileService.getActions().size() != 1) {
- fail("Expecting 1 action: "+whileService.getActions().size());
- }
-
- if ((whileService.getActions().get(0) instanceof WhileAction) == false) {
- fail("Action was not WhileAction: "+whileService.getActions().get(0));
- }
-
- WhileAction action=(WhileAction)whileService.getActions().get(0);
-
- org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
-
- if (paths.getLength() != 2) {
- fail("Two path children expected: "+paths.getLength());
- }
-
- org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
-
- if (elem.getNodeName().equals("while") == false) {
- fail("while expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s1.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s1.getName());
- }
-
- // Check no message types
- org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
-
- if (mtypeNL.getLength() != 0) {
- fail("Should have no message types: "+mtypeNL.getLength());
- }
-
- elem=(org.w3c.dom.Element)paths.item(1);
-
- if (elem.getNodeName().equals("exit") == false) {
- fail("exit expected but got: "+elem.getNodeName());
- }
-
- if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
- fail("Service category '"+elem.getAttribute("service-category")+
- "' not expected: "+s2.getCategory());
- }
-
- if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
- fail("Service name '"+elem.getAttribute("service-name")+
- "' not expected: "+s2.getName());
- }
- }
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java (from rev 353, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/WhileModelChangeRuleTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -0,0 +1,706 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.WhileModelChangeRule;
+import org.scribble.model.*;
+import org.scribble.model.analysis.TestLookaheadAnalyser;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+
+public class WhileModelChangeRuleTest extends TestCase {
+
+ public void testInsertWhileActionInitiator() {
+ WhileModelChangeRule rule=new WhileModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setToRole(role);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ MessageSignature msig=new MessageSignature();
+ interaction.setMessageSignature(msig);
+ msig.getTypes().add(ref);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ While mobj=new While();
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof WhileAction) == false) {
+ fail("Action was not WhileAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s2 = serv;
+ }
+ }
+
+ WhileAction action=(WhileAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Two path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("while") == false) {
+ fail("while expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ // Check no message types
+ org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
+
+ if (mtypeNL.getLength() != 0) {
+ fail("Should have no message types: "+mtypeNL.getLength());
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("exit") == false) {
+ fail("exit expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s2.getName());
+ }
+ }
+
+ public void testInsertWhileActionRecipient() {
+ WhileModelChangeRule rule=new WhileModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setToRole(role);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ MessageSignature msig=new MessageSignature();
+ interaction.setMessageSignature(msig);
+ msig.getTypes().add(ref);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ While mobj=new While();
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.getBlock().getContents().add(interaction);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof WhileAction) == false) {
+ fail("Action was not WhileAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s2 = serv;
+ }
+ }
+
+ WhileAction action=(WhileAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Two path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("while") == false) {
+ fail("while expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ // Check no message types
+ org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
+
+ if (mtypeNL.getLength() != 1) {
+ fail("Should have single message type: "+mtypeNL.getLength());
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("exit") == false) {
+ fail("exit expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s2.getName());
+ }
+ }
+
+ public void testInsertWhileActionRecipientNoRecvLookahead() {
+ WhileModelChangeRule rule=new WhileModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setFromRole(role);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ MessageSignature msig=new MessageSignature();
+ interaction.setMessageSignature(msig);
+ msig.getTypes().add(ref);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ While mobj=new While();
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.getBlock().getContents().add(interaction);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 1) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if ((service.getActions().get(0) instanceof WhileAction) == false) {
+ fail("Action was not WhileAction: "+service.getActions().get(0));
+ }
+
+ if (model.getServices().size() != 3) {
+ fail("Three services expected: "+model.getServices().size());
+ }
+
+ ESBService s1=null;
+ ESBService s2=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null) && iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s2 = serv;
+ }
+ }
+
+ WhileAction action=(WhileAction)service.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Two path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("while") == false) {
+ fail("while expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ // Check no message types
+ org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
+
+ if (mtypeNL.getLength() != 0) {
+ fail("Should have no message type: "+mtypeNL.getLength());
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("exit") == false) {
+ fail("exit expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s2.getName());
+ }
+ }
+
+ public void testInsertWhileNotFirstSessionAction() {
+ WhileModelChangeRule rule=new WhileModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Make session based service
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setToRole(role);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ MessageSignature msig=new MessageSignature();
+ interaction.setMessageSignature(msig);
+ msig.getTypes().add(ref);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ While mobj=new While();
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, null) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action was not test ESB action: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ ScheduleStateAction whileSchedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (model.getServices().size() != 4) {
+ fail("Four services expected: "+model.getServices().size());
+ }
+
+ ESBService whileService=null;
+ ESBService s1=null;
+ ESBService s2=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null || whileService == null) &&
+ iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ whileService = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ s2 = serv;
+ }
+ }
+
+ if (whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY).
+ equals(whileService.getCategory()) == false) {
+ fail("While schedule action category '"+
+ whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_CATEGORY)+
+ "' not expected: "+whileService.getCategory());
+ }
+
+ if (whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME).
+ equals(whileService.getName()) == false) {
+ fail("While schedule action service name '"+
+ whileSchedule.getPropertyValue(ScheduleStateAction.SERVICE_NAME)+
+ "' not expected: "+whileService.getName());
+ }
+
+ if (whileService.getActions().size() != 1) {
+ fail("Expecting 1 action: "+whileService.getActions().size());
+ }
+
+ if ((whileService.getActions().get(0) instanceof WhileAction) == false) {
+ fail("Action was not WhileAction: "+whileService.getActions().get(0));
+ }
+
+ WhileAction action=(WhileAction)whileService.getActions().get(0);
+
+ org.w3c.dom.NodeList paths=action.getPropertyChildNodes("paths");
+
+ if (paths.getLength() != 2) {
+ fail("Two path children expected: "+paths.getLength());
+ }
+
+ org.w3c.dom.Element elem=(org.w3c.dom.Element)paths.item(0);
+
+ if (elem.getNodeName().equals("while") == false) {
+ fail("while expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s1.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s1.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s1.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s1.getName());
+ }
+
+ // Check no message types
+ org.w3c.dom.NodeList mtypeNL=elem.getElementsByTagName("message");
+
+ if (mtypeNL.getLength() != 0) {
+ fail("Should have no message types: "+mtypeNL.getLength());
+ }
+
+ elem=(org.w3c.dom.Element)paths.item(1);
+
+ if (elem.getNodeName().equals("exit") == false) {
+ fail("exit expected but got: "+elem.getNodeName());
+ }
+
+ if (elem.getAttribute("service-category").equals(s2.getCategory()) == false) {
+ fail("Service category '"+elem.getAttribute("service-category")+
+ "' not expected: "+s2.getCategory());
+ }
+
+ if (elem.getAttribute("service-name").equals(s2.getName()) == false) {
+ fail("Service name '"+elem.getAttribute("service-name")+
+ "' not expected: "+s2.getName());
+ }
+ }
+
+ public void testInsertWhileMiddleAction() {
+ WhileModelChangeRule rule=new WhileModelChangeRule();
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+
+ TestESBService service=(TestESBService)
+ model.createService("testcategory", "testname");
+
+ model.addService(service);
+
+ // Make session based service
+ TestESBAction act1=new TestESBAction();
+ act1.setInitiator(true);
+ act1.setSessionBased(true);
+ service.addAction(act1, -1);
+
+ TestESBAction act2=new TestESBAction();
+ service.addAction(act2, -1);
+
+ ModelObject moref=new ModelObject() {};
+ moref.getSource().setObject(act2);
+
+ TestModelChangeContext context=new TestModelChangeContext();
+ context.setParent(service);
+
+ java.util.Set<Interaction> interactions=new java.util.HashSet<Interaction>();
+
+ TestLookaheadAnalyser tla=new TestLookaheadAnalyser();
+ tla.setInteractions(interactions);
+
+ Role role=new Role();
+ role.setName("role1");
+
+ Interaction interaction=new Interaction();
+ interaction.setToRole(role);
+
+ TypeReference ref=new TypeReference();
+ ref.setNamespace("ns");
+ ref.setLocalpart("lp");
+
+ MessageSignature msig=new MessageSignature();
+ interaction.setMessageSignature(msig);
+ msig.getTypes().add(ref);
+
+ interactions.add(interaction);
+
+ org.scribble.extensions.TestSingleExtensionRegistry reg=
+ new org.scribble.extensions.TestSingleExtensionRegistry(tla);
+ org.scribble.extensions.RegistryFactory.setRegistry(reg);
+
+ context.setRole(role);
+
+ Conversation conv=new Conversation();
+ ModelName mname=new ModelName();
+ conv.setModelName(mname);
+
+ mname.setLocatedRole(role);
+
+ While mobj=new While();
+ conv.getBlock().getContents().add(mobj);
+
+ mobj.getRoles().add(role);
+
+ if (rule.insert(context, model, mobj, moref) == false) {
+ fail("Failed to insert");
+ }
+
+ // Check actions
+ if (service.getActions().size() != 2) {
+ fail("Expecting 1 action: "+service.getActions().size());
+ }
+
+ if (service.getActions().get(0) != act1) {
+ fail("Action was not test ESB action: "+service.getActions().get(0));
+ }
+
+ if ((service.getActions().get(1) instanceof ScheduleStateAction) == false) {
+ fail("Action was not ScheduleStateAction: "+service.getActions().get(1));
+ }
+
+ ScheduleStateAction whileSchedule=(ScheduleStateAction)
+ service.getActions().get(1);
+
+ if (model.getServices().size() != 4) {
+ fail("Four services expected: "+model.getServices().size());
+ }
+
+ ESBService whileService=null;
+ ESBService s1=null;
+ ESBService s2=null;
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while ((s1 == null || s2 == null || whileService == null) &&
+ iter.hasNext()) {
+ ESBService serv = iter.next();
+ if (serv.getName().endsWith("__0")) {
+ whileService = serv;
+ }
+ if (serv.getName().endsWith("__1")) {
+ s1 = serv;
+ }
+ if (serv.getName().endsWith("__2")) {
+ s2 = serv;
+ }
+ }
+
+ if (s2.getActions().size() != 1) {
+ fail("Expecting 1 action in exit service: "+s2.getActions().size());
+ }
+
+ if (s2.getActions().get(0) != act2) {
+ fail("Action in exit is not test ESB action: "+s2.getActions().get(0));
+ }
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util (from rev 282, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/util)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ESBModelUtilTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/util/ESBModelUtilTest.java 2008-08-27 15:22:22 UTC (rev 282)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ESBModelUtilTest.java 2008-10-21 13:21:03 UTC (rev 400)
@@ -17,9 +17,9 @@
* Change History:
* 21 Aug 2008 : Initial version created by gary
*/
-package org.jboss.tools.overlord.cdl.jbossesb.model.util;
+package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
-import org.jboss.tools.overlord.cdl.jbossesb.model.util.ESBModelUtil;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util.ESBModelUtil;
import junit.framework.TestCase;
15 years, 6 months