Author: objectiser
Date: 2008-09-05 16:12:05 -0400 (Fri, 05 Sep 2008)
New Revision: 308
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java
Modified:
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/MessageRouterAction.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/SendMessageAction.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/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/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/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/WhenModelChangeRuleTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java
Log:
Update to reflect change in model change APIs.
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractESBAction.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -71,6 +71,8 @@
getOwnerDocument().createElement(ACTION_ELEMENT);
m_action.setAttribute(CLASS_PROPERTY, actionClass);
+
+ getSource().setObject(this);
}
/**
@@ -148,6 +150,8 @@
getSource().getProperties().put("path",
ESBModelUtil.getPath(m_action));
+
+ getSource().setObject(this);
}
}
@@ -482,7 +486,7 @@
*
* @return The service
*/
- protected ESBService getService() {
+ public ESBService getService() {
return(m_service);
}
Added:
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
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/AbstractInteractionMessageAction.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with 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) {
+
+ 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 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);
+ }
+ }
+}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/MessageRouterAction.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -20,8 +20,8 @@
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.jboss.tools.overlord.cdl.jbossesb.model.util.InteractionUtil;
import org.scribble.conversation.model.*;
import org.scribble.model.*;
@@ -162,15 +162,9 @@
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, InteractionUtil.getTypeString(ref));
- mt.setAttribute(TYPE_ATTR, type);
-
path.appendChild(mt);
if (messageTypes.get(i).getParent() instanceof ConversationInteraction &&
@@ -221,8 +215,56 @@
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
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/ReceiveMessageAction.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -26,13 +26,8 @@
*
* @author gary
*/
-public class ReceiveMessageAction extends AbstractESBAction {
+public class ReceiveMessageAction extends AbstractInteractionMessageAction {
- 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.
*
@@ -58,32 +53,6 @@
}
/**
- * 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.
*
@@ -133,46 +102,4 @@
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);
- }
- }
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/actions/SendMessageAction.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -26,17 +26,14 @@
*
* @author gary
*/
-public class SendMessageAction extends AbstractESBAction {
+public class SendMessageAction extends AbstractInteractionMessageAction {
- 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.
@@ -93,19 +90,6 @@
}
/**
- * 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
@@ -113,8 +97,6 @@
@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);
@@ -236,48 +218,6 @@
}
/**
- * 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
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -35,16 +35,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -64,17 +64,29 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
ConversationInteraction interaction=(ConversationInteraction)mobj;
@@ -82,11 +94,11 @@
if (InteractionUtil.isSend(interaction)) {
// Send
- insertSend(context, esbModel, interaction, position);
+ insertSend(context, esbModel, interaction, ref);
} else {
// Receive
- insertReceive(context, esbModel, interaction, position);
+ insertReceive(context, esbModel, interaction, ref);
}
return(true);
@@ -94,8 +106,8 @@
protected void insertSend(ModelChangeContext context,
ESBLanguageModel esbModel, ConversationInteraction interaction,
- int position) {
- ESBService service=(ESBService)context.getParent();
+ ModelObject ref) {
+ ESBService service=getESBService(context, ref);
SendMessageAction action=
new SendMessageAction(service);
@@ -104,22 +116,18 @@
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);
+ setMessageType(action, interaction);
+
+ int pos=-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) {
+ pos = service.getActions().indexOf((ESBAction)
+ ref.getSource().getObject());
}
- service.addAction(action, position);
+ service.addAction(action, pos);
if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action
&&
interaction.getEnclosingDefinition() instanceof Conversation) {
@@ -182,11 +190,22 @@
interaction.getMessageSignature(), ids, locators);
}
}
+
+ 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);
+ }
protected void insertReceive(ModelChangeContext context,
ESBLanguageModel esbModel, ConversationInteraction interaction,
- int position) {
- ESBService service=(ESBService)context.getParent();
+ ModelObject ref) {
+ ESBService service=getESBService(context, ref);
// TODO: Create a new service to receive the
// message and add a schedule service to link
@@ -210,7 +229,17 @@
schedule.setDestination(recvService.getCategory(),
recvService.getName(), false);
- service.addAction(schedule, position);
+// service.addAction(schedule, -1);
+ int pos=-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) {
+ pos = service.getActions().indexOf((ESBAction)
+ ref.getSource().getObject());
+ }
+
+ service.addAction(schedule, pos);
context.setParent(recvService);
}
@@ -222,20 +251,10 @@
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);
- }
+ setMessageType(action, interaction);
+ // TODO: Decide how to determine position, in situations
+ // where new service no created
((ESBService)context.getParent()).addAction(action, -1);
if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action
&&
@@ -289,4 +308,105 @@
interaction.getMessageSignature(), ids, locators);
}
}
+
+ /**
+ * 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 mobj The model object details to be modified
+ * @param position The position, where relevant
+ * @return Whether the change has been applied
+ */
+ public boolean update(ModelChangeContext context,
+ Model model, ModelObject mobj, int position) {
+ boolean ret=false;
+ ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ ConversationInteraction interaction=(ConversationInteraction)mobj;
+ ESBService service=(ESBService)context.getParent();
+
+ // Get action at position
+ if (position != -1 && position < service.getActions().size()) {
+ ESBAction action=service.getActions().get(position);
+
+ // Check action is an interaction
+ if (action instanceof AbstractInteractionMessageAction) {
+ AbstractInteractionMessageAction ma=
+ (AbstractInteractionMessageAction)action;
+
+ String origMesgType=ma.getMessageType();
+
+ // Set message type
+ setMessageType(ma, interaction);
+
+ // Update message type in router if appropriate
+ if (InteractionUtil.isSend(interaction) == false &&
+ interaction.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);
+ }
+ }
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -44,7 +44,7 @@
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -63,17 +63,29 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
Conversation conv=(Conversation)mobj;
@@ -85,8 +97,7 @@
String name=ConversationUtil.getServiceName(conv);
String sdname="";
-
-
+
// Check if root conversation
if (conv.getParent() instanceof Model) {
@@ -160,7 +171,7 @@
context.setParent(service);
for (int i=0; i < acts.size(); i++) {
- context.insert(model, acts.get(i), i);
+ context.insert(model, acts.get(i), null);
}
return(true);
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -37,16 +37,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -66,17 +66,29 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
ESBService service=(ESBService)context.getParent();
If ifElem=(If)mobj;
@@ -94,7 +106,7 @@
// If action, because the role is a decision maker
IfAction ifAction=new IfAction(service);
- service.addAction(ifAction, position);
+ service.addAction(ifAction, -1);
for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
@@ -109,7 +121,7 @@
context.setParent(subService);
for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), j);
+ context.insert(model, cb.getContents().get(j), null);
}
boolean immediate=false;
@@ -145,7 +157,7 @@
for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
context.insert(model,
- ifElem.getElseBlock().getContents().get(j), j);
+ ifElem.getElseBlock().getContents().get(j), null);
}
boolean immediate=false;
@@ -187,7 +199,7 @@
logger.severe("Failed to find lookahead analyser");
}
- service.addAction(switchAction, position);
+ service.addAction(switchAction, -1);
java.util.List<MessageSignature> messageTypes=
new java.util.Vector<MessageSignature>();
@@ -205,7 +217,7 @@
context.setParent(subService);
for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), j);
+ context.insert(model, cb.getContents().get(j), null);
}
java.util.Set<Interaction> interactions=null;
@@ -262,7 +274,7 @@
for (int j=0; j < ifElem.getElseBlock().getContents().size(); j++) {
context.insert(model,
- ifElem.getElseBlock().getContents().get(j), j);
+ ifElem.getElseBlock().getContents().get(j), null);
}
java.util.Set<Interaction> interactions=null;
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/LanguageToConversationModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -33,17 +33,17 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
- Model model, ModelObject mobj) {
+ public boolean isInsertSupported(ModelChangeContext context,
+ Model model, ModelObject mobj) {
boolean ret=false;
if (mobj instanceof ConversationModel &&
@@ -61,21 +61,33 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ConversationModel cm=(ConversationModel)mobj;
if (cm.getConversation() != null) {
- context.insert(model, cm.getConversation(), -1);
+ context.insert(model, cm.getConversation(), null);
}
return(true);
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -36,16 +36,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -65,17 +65,29 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
ESBService service=(ESBService)context.getParent();
Parallel parallel=(Parallel)mobj;
@@ -91,7 +103,7 @@
// Create and configure the parallel action
ParallelAction parAction=new ParallelAction(service);
- service.addAction(parAction, position);
+ service.addAction(parAction, -1);
for (int i=0; i < parallel.getBlocks().size(); i++) {
Block b=parallel.getBlocks().get(i);
@@ -106,7 +118,7 @@
context.setParent(subService);
for (int j=0; j < b.getContents().size(); j++) {
- context.insert(model, b.getContents().get(j), j);
+ context.insert(model, b.getContents().get(j), null);
}
ScheduleStateAction schedule=
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -36,16 +36,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -65,24 +65,36 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
ESBService service=(ESBService)context.getParent();
Run run=(Run)mobj;
PerformAction action=new PerformAction(service);
- service.addAction(action, position);
+ service.addAction(action, -1);
String category=ConversationUtil.getServiceCategory(run.getDefinition());
String name=ConversationUtil.getServiceName(run.getDefinition());
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/SpawnModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -35,16 +35,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -64,23 +64,35 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBService service=(ESBService)context.getParent();
Spawn spawn=(Spawn)mobj;
PerformAction action=new PerformAction(service);
- service.addAction(action, position);
+ service.addAction(action, -1);
String category=ConversationUtil.getServiceCategory(spawn.getDefinition());
String name=ConversationUtil.getServiceName(spawn.getDefinition());
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -36,16 +36,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -65,17 +65,29 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
ESBService service=(ESBService)context.getParent();
When when=(When)mobj;
@@ -91,7 +103,7 @@
if (when.getRoles().contains(context.getRole())) {
WhenAction action=new WhenAction(service);
- service.addAction(action, position);
+ service.addAction(action, -1);
for (int i=0; i < when.getConditionalBlocks().size(); i++) {
ConditionalBlock b=when.getConditionalBlocks().get(i);
@@ -106,7 +118,7 @@
context.setParent(subService);
for (int j=0; j < b.getContents().size(); j++) {
- context.insert(model, b.getContents().get(j), j);
+ context.insert(model, b.getContents().get(j), null);
}
ScheduleStateAction schedule=
@@ -146,7 +158,7 @@
logger.severe("Failed to find lookahead analyser");
}
- service.addAction(switchAction, position);
+ service.addAction(switchAction, -1);
java.util.List<MessageSignature> messageTypes=
new java.util.Vector<MessageSignature>();
@@ -164,7 +176,7 @@
context.setParent(subService);
for (int j=0; j < cb.getContents().size(); j++) {
- context.insert(model, cb.getContents().get(j), j);
+ context.insert(model, cb.getContents().get(j), null);
}
java.util.Set<Interaction> interactions=null;
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/java/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRule.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -36,16 +36,16 @@
/**
* This method determines whether the rule is appropriate
- * for the supplied type of model, parent (in the context) and
+ * 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 causing the change
+ * @param mobj The model object being inserted
* @return Whether the rule supports the supplied information
*/
@Override
- protected boolean isChangeSupported(ModelChangeContext context,
+ public boolean isInsertSupported(ModelChangeContext context,
Model model, ModelObject mobj) {
boolean ret=false;
@@ -65,17 +65,29 @@
* 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.
+ * 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 position The position, where relevant
+ * @param ref The optional reference model object
* @return Whether the change has been applied
*/
@Override
public boolean insert(ModelChangeContext context,
- Model model, ModelObject mobj, int position) {
+ Model model, ModelObject mobj, ModelObject ref) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
ESBService service=(ESBService)context.getParent();
While whileElem=(While)mobj;
@@ -110,7 +122,7 @@
WhileAction action=new WhileAction(service);
- service.addAction(action, position);
+ service.addAction(action, -1);
// Check if business object type needs to be specified
if (service.getFirstSessionBasedAction() == action &&
@@ -130,7 +142,7 @@
context.setParent(subService);
for (int j=0; j < whileElem.getBlock().getContents().size(); j++) {
- context.insert(model, whileElem.getBlock().getContents().get(j), j);
+ context.insert(model, whileElem.getBlock().getContents().get(j), null);
}
// Need to insert a 'ScheduleStateAction' to return back
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ConversationInteractionModelChangeRuleTest.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -77,7 +77,7 @@
msig.getTypes().add(ref);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -155,7 +155,7 @@
msig1.getTypes().add(ref1);
- if (rule.insert(context, model, mobj1, -1) == false) {
+ if (rule.insert(context, model, mobj1, null) == false) {
fail("Failed to insert 1");
}
@@ -176,7 +176,7 @@
// will become session based
service.setSessionBased(true);
- if (rule.insert(context, model, mobj2, -1) == false) {
+ if (rule.insert(context, model, mobj2, null) == false) {
fail("Failed to insert 2");
}
@@ -259,6 +259,256 @@
}
}
+
+ public void testInsertThirdMiddleReceiveAction() {
+ 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 testInsertReceiveRequestAction() {
String fromRoleName="role1";
String toRoleName="role2";
@@ -305,7 +555,7 @@
msig.getTypes().add(ref);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -366,7 +616,7 @@
msig.getTypes().add(ref);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -433,7 +683,7 @@
msig.getTypes().add(ref);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -530,7 +780,7 @@
msig.getTypes().add(ref);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -611,7 +861,7 @@
msig.getTypes().add(ref);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -631,4 +881,105 @@
"' 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");
+ }
+
+ // Change local part
+ ref.setLocalpart("lp2");
+
+ if (rule.update(context, model, mobj, 0) == false) {
+ fail("Failed to update");
+ }
+
+ // 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());
+ }
+
+ 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");
+ }
+ }
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/IfModelChangeRuleTest.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -53,7 +53,7 @@
mobj.getRoles().add(role);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -136,7 +136,7 @@
mobj.getRoles().add(role);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -327,7 +327,7 @@
mobj.getRoles().add(role);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -481,7 +481,7 @@
ConditionalBlock cb1=new ConditionalBlock();
mobj.getConditionalBlocks().add(cb1);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -571,7 +571,7 @@
Block b1=new Block();
mobj.setElseBlock(b1);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/ParallelModelChangeRuleTest.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -62,7 +62,7 @@
Block cb3=new Block();
mobj.getBlocks().add(cb3);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -304,7 +304,7 @@
cb1.getContents().add(interaction);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -430,7 +430,7 @@
cb1.getContents().add(interaction);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/RunModelChangeRuleTest.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -76,7 +76,7 @@
conv.getBlock().getContents().add(mobj);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhenModelChangeRuleTest.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -63,7 +63,7 @@
mobj.getRoles().add(role);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -258,7 +258,7 @@
ConditionalBlock cb1=new ConditionalBlock();
mobj.getConditionalBlocks().add(cb1);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -348,7 +348,7 @@
ConditionalBlock cb3=new ConditionalBlock();
mobj.getConditionalBlocks().add(cb3);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
Modified:
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-09-03
15:32:42 UTC (rev 307)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.jbossesb/src/test/org/jboss/tools/overlord/cdl/jbossesb/model/change/WhileModelChangeRuleTest.java 2008-09-05
20:12:05 UTC (rev 308)
@@ -80,7 +80,7 @@
mobj.getRoles().add(role);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -210,7 +210,7 @@
mobj.getBlock().getContents().add(interaction);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -340,7 +340,7 @@
mobj.getBlock().getContents().add(interaction);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}
@@ -473,7 +473,7 @@
mobj.getRoles().add(role);
- if (rule.insert(context, model, mobj, -1) == false) {
+ if (rule.insert(context, model, mobj, null) == false) {
fail("Failed to insert");
}