[overlord-commits] Overlord SVN: r566 - 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 18:32:34 EDT 2009
Author: objectiser
Date: 2009-04-01 18:32:33 -0400 (Wed, 01 Apr 2009)
New Revision: 566
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/InvokeTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReceiveTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReplyTest.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/Invoke.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.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/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java
Log:
Added main attributes on interaction types with associated tests.
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-04-01 20:57:22 UTC (rev 565)
+++ 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 22:32:33 UTC (rev 566)
@@ -27,7 +27,10 @@
*/
public abstract class AbstractInteraction extends BPELActivity {
+ private static final String PARTNER_LINK = "partnerLink";
+ private static final String PORT_TYPE = "portType";
private static final String OPERATION = "operation";
+
private static final long serialVersionUID = -5048477859609625462L;
/**
@@ -70,6 +73,42 @@
}
/**
+ * This method sets the partner link.
+ *
+ * @param pl The partner link
+ */
+ public void setPartnerLink(String pl) {
+ getDOMElement().setAttribute(PARTNER_LINK, pl);
+ }
+
+ /**
+ * This method returns the partner link.
+ *
+ * @return The partner link
+ */
+ public String getPartnerLink() {
+ return(getDOMElement().getAttribute(PARTNER_LINK));
+ }
+
+ /**
+ * This method sets the port type.
+ *
+ * @param pt The port type
+ */
+ public void setPortType(String pt) {
+ getDOMElement().setAttribute(PORT_TYPE, pt);
+ }
+
+ /**
+ * This method returns the port type.
+ *
+ * @return The port type
+ */
+ public String getPortType() {
+ return(getDOMElement().getAttribute(PORT_TYPE));
+ }
+
+ /**
* 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/Invoke.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-04-01 20:57:22 UTC (rev 565)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-04-01 22:32:33 UTC (rev 566)
@@ -29,7 +29,10 @@
*/
public class Invoke extends AbstractInteraction {
- private static final String INVOKE = "invoke";
+ private static final String INPUT_VARIABLE = "inputVariable";
+ private static final String OUTPUT_VARIABLE = "outputVariable";
+ public static final String INVOKE = "invoke";
+
private static final long serialVersionUID = 928076947383263387L;
/**
@@ -53,6 +56,42 @@
}
/**
+ * This method sets the input variable.
+ *
+ * @param var The input variable
+ */
+ public void setInputVariable(String var) {
+ getDOMElement().setAttribute(INPUT_VARIABLE, var);
+ }
+
+ /**
+ * This method returns the input variable.
+ *
+ * @return The input variable
+ */
+ public String getInputVariable() {
+ return(getDOMElement().getAttribute(INPUT_VARIABLE));
+ }
+
+ /**
+ * This method sets the output variable.
+ *
+ * @param var The output variable
+ */
+ public void setOutputVariable(String var) {
+ getDOMElement().setAttribute(OUTPUT_VARIABLE, var);
+ }
+
+ /**
+ * This method returns the output variable.
+ *
+ * @return The output variable
+ */
+ public String getOutputVariable() {
+ return(getDOMElement().getAttribute(OUTPUT_VARIABLE));
+ }
+
+ /**
* 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/Receive.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-04-01 20:57:22 UTC (rev 565)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-04-01 22:32:33 UTC (rev 566)
@@ -17,10 +17,10 @@
*/
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.*;
+
/**
* This class represents an unsupported (or custom) action within
* the conversation based ESB service descriptor.
@@ -29,6 +29,9 @@
*/
public class Receive extends AbstractInteraction {
+ private static final String CREATE_INSTANCE = "createInstance";
+ private static final String VARIABLE = "variable";
+
public static final String RECEIVE = "receive";
private static final long serialVersionUID = -3041725198724191842L;
@@ -54,6 +57,54 @@
}
/**
+ * This method sets the variable.
+ *
+ * @param var The variable
+ */
+ public void setVariable(String var) {
+ getDOMElement().setAttribute(VARIABLE, var);
+ }
+
+ /**
+ * This method returns the variable.
+ *
+ * @return The variable
+ */
+ public String getVariable() {
+ return(getDOMElement().getAttribute(VARIABLE));
+ }
+
+ /**
+ * This method sets the 'create instance'
+ * attribute.
+ *
+ * @param b Whether to create instance
+ */
+ public void setCreateInstance(boolean b) {
+ String create=(b?"yes":"no");
+
+ getDOMElement().setAttribute(CREATE_INSTANCE, create);
+ }
+
+ /**
+ * This method returns whether to create instance.
+ *
+ * @return Whether to create instance
+ */
+ public boolean getCreateInstance() {
+ boolean ret=false;
+ String create=
+ getDOMElement().getAttribute(CREATE_INSTANCE);
+
+ if (create != null &&
+ create.equals("yes")) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
* This method validates the BPEL activity and reports warnings or
* errors to the supplied model listener.
*
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-04-01 20:57:22 UTC (rev 565)
+++ 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 22:32:33 UTC (rev 566)
@@ -28,6 +28,9 @@
*/
public class Reply extends AbstractInteraction {
+ private static final String VARIABLE = "variable";
+ private static final String FAULT_NAME = "faultName";
+
public static final String REPLY = "reply";
private static final long serialVersionUID = 8582738107125170604L;
@@ -53,6 +56,42 @@
}
/**
+ * This method sets the variable.
+ *
+ * @param var The variable
+ */
+ public void setVariable(String var) {
+ getDOMElement().setAttribute(VARIABLE, var);
+ }
+
+ /**
+ * This method returns the variable.
+ *
+ * @return The variable
+ */
+ public String getVariable() {
+ return(getDOMElement().getAttribute(VARIABLE));
+ }
+
+ /**
+ * This method sets the fault name.
+ *
+ * @param fname The fault name
+ */
+ public void setFaultName(String fname) {
+ getDOMElement().setAttribute(FAULT_NAME, fname);
+ }
+
+ /**
+ * This method returns the fault name.
+ *
+ * @return The fault name
+ */
+ public String getFaultName() {
+ return(getDOMElement().getAttribute(FAULT_NAME));
+ }
+
+ /**
* 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/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java 2009-04-01 20:57:22 UTC (rev 565)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java 2009-04-01 22:32:33 UTC (rev 566)
@@ -33,13 +33,18 @@
}
}
- public void testGetOperationFromDOM() {
+ public void testBuildFromDOM() {
BPELLanguageModel model=new DefaultBPELLanguageModel(null);
String op="testOp";
+ String portType="testPortType";
+ String partnerLink="testPartnerLink";
String xml="<interaction xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
- "operation=\""+op+"\" />";
+ "operation=\""+op+"\" "+
+ "partnerLink=\""+partnerLink+"\" "+
+ "portType=\""+portType+"\" "+
+ "/>";
org.w3c.dom.Element elem=null;
@@ -68,6 +73,16 @@
fail("Operation not correct, expecting '"+op+"': "+
component.getOperation());
}
+
+ if (component.getPartnerLink().equals(partnerLink) == false) {
+ fail("PartnerLink not correct, expecting '"+partnerLink+"': "+
+ component.getPartnerLink());
+ }
+
+ if (component.getPortType().equals(portType) == false) {
+ fail("Port type not correct, expecting '"+portType+"': "+
+ component.getPortType());
+ }
}
public void testGetOperation() {
@@ -84,4 +99,34 @@
component.getOperation());
}
}
+
+ public void testGetPortType() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pt="testPortType";
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model);
+
+ component.setPortType(pt);
+
+ if (component.getPortType().equals(pt) == false) {
+ fail("Port type not correct, expecting '"+pt+"': "+
+ component.getPortType());
+ }
+ }
+
+ public void testGetPartnerLink() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String pl="testPartnerLink";
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model);
+
+ component.setPartnerLink(pl);
+
+ if (component.getPartnerLink().equals(pl) == false) {
+ fail("Partner link not correct, expecting '"+pl+"': "+
+ component.getPartnerLink());
+ }
+ }
}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/InvokeTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/InvokeTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/InvokeTest.java 2009-04-01 22:32:33 UTC (rev 566)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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 InvokeTest extends TestCase {
+
+ public void testIsActivity() {
+ Invoke act=
+ new Invoke(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String iv="testIV";
+ String ov="testOV";
+
+ String xml="<invoke xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "inputVariable=\""+iv+"\" "+
+ "outputVariable=\""+ov+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Invoke component=new Invoke(model, elem);
+
+ if (component.getInputVariable().equals(iv) == false) {
+ fail("Input variable not correct, expecting '"+iv+"': "+
+ component.getInputVariable());
+ }
+
+ if (component.getOutputVariable().equals(ov) == false) {
+ fail("Output variable not correct, expecting '"+ov+"': "+
+ component.getOutputVariable());
+ }
+ }
+
+ public void testGetInputVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Invoke component=new Invoke(model);
+
+ component.setInputVariable(var);
+
+ if (component.getInputVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getInputVariable());
+ }
+ }
+
+ public void testGetOutputVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Invoke component=new Invoke(model);
+
+ component.setOutputVariable(var);
+
+ if (component.getOutputVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getOutputVariable());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReceiveTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReceiveTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReceiveTest.java 2009-04-01 22:32:33 UTC (rev 566)
@@ -0,0 +1,195 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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 ReceiveTest extends TestCase {
+
+ public void testIsActivity() {
+ Receive act=
+ new Receive(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String create="yes";
+
+ String xml="<receive xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "variable=\""+var+"\" "+
+ "createInstance=\""+create+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Receive component=new Receive(model, elem);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+
+ if (component.getCreateInstance() == false) {
+ fail("createInstance not correct, expecting 'true': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testGetVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Receive component=new Receive(model);
+
+ component.setVariable(var);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+ }
+
+ public void testCreateInstanceFromDOMTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="yes";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "createInstance=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Receive component=new Receive(model, elem);
+
+ if (component.getCreateInstance() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testCreateInstanceFromDOMFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String value="no";
+
+ String xml="<activity xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "createInstance=\""+value+"\" />";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Receive component=new Receive(model, elem);
+
+ if (component.getCreateInstance() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testGetCreateInstanceTrue() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Receive component=new Receive(model);
+
+ component.setCreateInstance(true);
+
+ if (component.getCreateInstance() == false) {
+ fail("'Suppress Join Failure' not correct, expecting 'true': "+
+ component.getCreateInstance());
+ }
+ }
+
+ public void testGetCreateInstanceFalse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ Receive component=new Receive(model);
+
+ component.setCreateInstance(false);
+
+ if (component.getCreateInstance() == true) {
+ fail("'Suppress Join Failure' not correct, expecting 'false': "+
+ component.getCreateInstance());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReplyTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReplyTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ReplyTest.java 2009-04-01 22:32:33 UTC (rev 566)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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 ReplyTest extends TestCase {
+
+ public void testIsActivity() {
+ Reply act=
+ new Reply(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testBuildFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVar";
+ String fault="testFault";
+
+ String xml="<reply xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "variable=\""+var+"\" "+
+ "faultName=\""+fault+"\" "+
+ "/>";
+
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Reply component=new Reply(model, elem);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+
+ public void testGetVariable() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String var="testVariable";
+
+ Reply component=new Reply(model);
+
+ component.setVariable(var);
+
+ if (component.getVariable().equals(var) == false) {
+ fail("Variable not correct, expecting '"+var+"': "+
+ component.getVariable());
+ }
+ }
+
+ public void testGetFaultName() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String fault="testFault";
+
+ Reply component=new Reply(model);
+
+ component.setFaultName(fault);
+
+ if (component.getFaultName().equals(fault) == false) {
+ fail("Fault name not correct, expecting '"+fault+"': "+
+ component.getFaultName());
+ }
+ }
+}
More information about the overlord-commits
mailing list