[overlord-commits] Overlord SVN: r565 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src: test/org/jboss/tools/overlord/cdl/bpel/model/component and 1 other directory.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Wed Apr 1 16:57:23 EDT 2009
Author: objectiser
Date: 2009-04-01 16:57:22 -0400 (Wed, 01 Apr 2009)
New Revision: 565
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELGroupingConstruct.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivityTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntilTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELActivity.java
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java
Log:
Added repeatUntil activity, and an abstract activity base class with the name and 'suppressJoinFailure' attributes.
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -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.bpel.model.component;
-
-import org.apache.log4j.Logger;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This is the generic BPEL activity class.
- *
- * @author gary
- */
-public abstract class AbstractGroupingConstruct extends BPELElement {
-
- private static final long serialVersionUID = -5550042312010190598L;
-
- /**
- * The constructor for initializing the activity based on
- * an existing DOM element.
- */
- protected AbstractGroupingConstruct(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The contructor for initializing a new activity.
- */
- protected AbstractGroupingConstruct(BPELLanguageModel model,
- String activityName) {
- super(model, activityName);
- }
-
- /**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
- * This method sets the contained activity.
- *
- * @param act The contained activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- getDOMElement().appendChild(act.getDOMElement());
- }
-
- /**
- * This method returns the contained activity.
- *
- * @return The contained activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- private static Logger logger = Logger.getLogger(AbstractGroupingConstruct.class);
-
- private BPELElement m_activity=null;
-}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -17,7 +17,6 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model.component;
-import org.scribble.conversation.model.ConversationInteraction;
import org.scribble.model.admin.ModelListener;
import org.jboss.tools.overlord.cdl.bpel.model.*;
@@ -26,7 +25,7 @@
*
* @author gary
*/
-public abstract class AbstractInteraction extends BPELElement {
+public abstract class AbstractInteraction extends BPELActivity {
private static final String OPERATION = "operation";
private static final long serialVersionUID = -5048477859609625462L;
@@ -53,17 +52,6 @@
}
/**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
* This method sets the operation.
*
* @param op The operation
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivity.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivity.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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.bpel.model.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+
+/**
+ * This class represents the base class for all BPEL
+ * activities.
+ */
+public abstract class BPELActivity extends BPELElement {
+
+ private static final String SUPPRESS_JOIN_FAILURE = "suppressJoinFailure";
+
+ private static final String NAME = "name";
+
+ private static final long serialVersionUID = 2885165314780298048L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public BPELActivity(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ */
+ public BPELActivity(BPELLanguageModel model,
+ String name) {
+ super(model, name);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method sets the name.
+ *
+ * @param name The name
+ */
+ public void setName(String name) {
+ getDOMElement().setAttribute(NAME, name);
+ }
+
+ /**
+ * This method returns the name.
+ *
+ * @return The name
+ */
+ public String getName() {
+ return(getDOMElement().getAttribute(NAME));
+ }
+
+ /**
+ * This method sets the 'suppress join failure'
+ * attribute.
+ *
+ * @param b Whether to suppress join failure
+ */
+ public void setSuppressJoinFailure(boolean b) {
+ String suppress=(b?"yes":"no");
+
+ getDOMElement().setAttribute(SUPPRESS_JOIN_FAILURE, suppress);
+ }
+
+ /**
+ * This method returns whether the join should
+ * be suppressed.
+ *
+ * @return Whether the join should be suppressed
+ */
+ public boolean getSuppressJoinFailure() {
+ boolean ret=false;
+ String suppress=
+ getDOMElement().getAttribute(SUPPRESS_JOIN_FAILURE);
+
+ if (suppress != null &&
+ suppress.equals("yes")) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELGroupingConstruct.java (from rev 564, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELGroupingConstruct.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELGroupingConstruct.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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.bpel.model.component;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This is the generic BPEL activity class.
+ *
+ * @author gary
+ */
+public abstract class BPELGroupingConstruct extends BPELActivity {
+
+ private static final long serialVersionUID = -5550042312010190598L;
+
+ /**
+ * The constructor for initializing the activity based on
+ * an existing DOM element.
+ */
+ protected BPELGroupingConstruct(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The contructor for initializing a new activity.
+ */
+ protected BPELGroupingConstruct(BPELLanguageModel model,
+ String activityName) {
+ super(model, activityName);
+ }
+
+ /**
+ * This method sets the contained activity.
+ *
+ * @param act The contained activity
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ getDOMElement().appendChild(act.getDOMElement());
+ }
+
+ /**
+ * This method returns the contained activity.
+ *
+ * @return The contained activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private static Logger logger = Logger.getLogger(BPELGroupingConstruct.class);
+
+ private BPELElement m_activity=null;
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -27,7 +27,7 @@
*
* @author gary
*/
-public class If extends BPELElement {
+public class If extends BPELActivity {
private static final long serialVersionUID = -763221632866464831L;
@@ -82,17 +82,6 @@
}
/**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
* This method validates the BPEL activity and reports warnings or
* errors to the supplied model listener.
*
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntil.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntil.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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.bpel.model.component;
+
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents a RepeatUntil grouping activity.
+ *
+ * @author gary
+ */
+public class RepeatUntil extends BPELGroupingConstruct {
+
+ private static final long serialVersionUID = -4479515591509703188L;
+
+ public static final String REPEATUNTIL = "repeatUntil";
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public RepeatUntil(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+
+ m_activity = findChildActivity();
+
+ org.w3c.dom.Element cond=
+ findChildElement(Condition.CONDITION);
+
+ if (cond == null) {
+ m_condition = new Condition(model);
+ } else {
+ m_condition = new Condition(model, cond);
+ }
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ */
+ public RepeatUntil(BPELLanguageModel model) {
+ super(model, REPEATUNTIL);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+ /**
+ * This method converts the BPEL activity into an equivalent
+ * behavioural description for conformance checking.
+ *
+ * @param activities The list of activities that will contain
+ * the converted action(s)
+ * @param context The conversion context
+ */
+ public void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+ /**
+ * This method sets the condition.
+ *
+ * @param cond The condition
+ */
+ public void setCondition(Condition cond) {
+ m_condition = cond;
+
+ setChildElement(findChildElement(Condition.CONDITION),
+ cond.getDOMElement(), null);
+ }
+
+ /**
+ * This method returns the condition.
+ *
+ * @return The condition
+ */
+ public Condition getCondition() {
+ return(m_condition);
+ }
+
+ /**
+ * This method sets the main 'if' activity.
+ *
+ * @param act The activity associated with the 'if'
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ BPELElement existing=findChildActivity();
+ org.w3c.dom.Element existingElem=null;
+
+ if (existing != null) {
+ existingElem = existing.getDOMElement();
+ }
+
+ setChildElement(existingElem, act.getDOMElement(),
+ getDOMElement().getFirstChild());
+ }
+
+ /**
+ * This method returns the activity associated with
+ * the 'if' path.
+ *
+ * @return The 'if' activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private Condition m_condition=null;
+ private BPELElement m_activity=null;
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -17,7 +17,6 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model.component;
-import org.scribble.conversation.model.ConversationInteraction;
import org.scribble.model.*;
import org.scribble.model.admin.ModelListener;
import org.jboss.tools.overlord.cdl.bpel.model.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class Sequence extends BPELElement {
+public class Sequence extends BPELActivity {
public static final String SEQUENCE = "sequence";
@@ -62,17 +62,6 @@
}
/**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
* This method validates the BPEL activity and reports warnings or
* errors to the supplied model listener.
*
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class While extends AbstractGroupingConstruct {
+public class While extends BPELGroupingConstruct {
private static final long serialVersionUID = -4173984531470466407L;
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivityTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivityTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELActivityTest.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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.bpel.model.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class BPELActivityTest extends TestCase {
+
+ public void testIsActivity() {
+ TestBPELActivity act=
+ new TestBPELActivity(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testGetNameFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String name="testName";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "name=\""+name+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELActivity component=new TestBPELActivity(model, elem);
+
+ if (component.getName().equals(name) == false) {
+ fail("Name not correct, expecting '"+name+"': "+
+ component.getName());
+ }
+ }
+
+ public void testGetName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String name="testName";
+
+ TestBPELActivity component=new TestBPELActivity(model);
+
+ component.setName(name);
+
+ if (component.getName().equals(name) == false) {
+ fail("Name not correct, expecting '"+name+"': "+
+ component.getName());
+ }
+ }
+
+ public void testSuppressJoinFailureFromDOMTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="yes";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "suppressJoinFailure=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELActivity component=new TestBPELActivity(model, elem);
+
+ if (component.getSuppressJoinFailure() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+
+ public void testSuppressJoinFailureFromDOMFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="no";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "suppressJoinFailure=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ TestBPELActivity component=new TestBPELActivity(model, elem);
+
+ if (component.getSuppressJoinFailure() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+
+ public void testGetSuppressJoinFailureTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ TestBPELActivity component=new TestBPELActivity(model);
+
+ component.setSuppressJoinFailure(true);
+
+ if (component.getSuppressJoinFailure() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+
+ public void testGetSuppressJoinFailureFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ TestBPELActivity component=new TestBPELActivity(model);
+
+ component.setSuppressJoinFailure(false);
+
+ if (component.getSuppressJoinFailure() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getSuppressJoinFailure());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntilTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntilTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/RepeatUntilTest.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -0,0 +1,336 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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.bpel.model.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class RepeatUntilTest extends TestCase {
+
+ public void testIsActivity() {
+ RepeatUntil act=new RepeatUntil(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence/>"+
+ "<condition>"+expr1+"</condition>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+ }
+
+ public void testSetConditionNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ RepeatUntil component=new RepeatUntil(model);
+
+ component.setCondition(condition);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetConditionReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ String xml2="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</condition>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ RepeatUntil component=new RepeatUntil(model);
+
+ component.setCondition(condition1);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setCondition(condition2);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetActivityNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("One child element expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("First element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+ }
+
+ public void testSetActivityReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<repeatUntil xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<sequence/>"+
+ "<condition/>"+
+ "</repeatUntil>";
+
+ org.w3c.dom.Element ifelem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ RepeatUntil component=new RepeatUntil(model, ifelem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+
+ component.setActivity(sub);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(0).
+ getLocalName().equals(If.IF) == false) {
+ fail("First element was not an 'if': "+
+ component.getDOMElement().getChildNodes().item(0).
+ getLocalName());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELActivity.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELActivity.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+import org.w3c.dom.Element;
+
+public class TestBPELActivity extends BPELActivity {
+
+ private static final long serialVersionUID = 6706918585744310399L;
+
+ public TestBPELActivity(BPELLanguageModel model, Element elem) {
+ super(model, elem);
+ }
+
+ public TestBPELActivity(BPELLanguageModel model) {
+ super(model, "test");
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java 2009-03-31 21:09:02 UTC (rev 564)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java 2009-04-01 20:57:22 UTC (rev 565)
@@ -32,7 +32,7 @@
}
}
- public void testIfFromDOM() {
+ public void testFromDOM() {
BPELLanguageModel model=new DefaultBPELLanguageModel(null);
String expr1="Test Expression 1";
More information about the overlord-commits
mailing list