JBoss Tools SVN: r44683 - in branches/jbosstools-3.3.x/esb: plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2013-06-21 16:10:58 -0400 (Fri, 21 Jun 2013)
New Revision: 44683
Modified:
branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBRouteToImpl.java
branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.3/jboss-esb-cbr.xml
branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
Log:
JBIDE-14956 ESB editor removes routes to the same service
Implemented route key as in
org.jboss.soa.esb.actions.ContentBasedWiretap
Modified: branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
===================================================================
--- branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2013-06-21 00:49:59 UTC (rev 44682)
+++ branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2013-06-21 20:10:58 UTC (rev 44683)
@@ -3478,7 +3478,7 @@
<XDependencies/>
</XModelEntity>
<XModelEntity
- ImplementingClass="org.jboss.tools.esb.core.model.ESBRouteToImpl"
+ ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=path"
XMLSUBPATH="object-path" name="ESBPreObjectPath">
<XChildrenEntities/>
@@ -3543,7 +3543,7 @@
<Constraint loader="ListString"/>
<Editor name="ESBServiceCategoryList"/>
</XModelAttribute>
- <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ <XModelAttribute PROPERTIES="category=general;save=always"
name="service name" xmlname="service-name">
<Constraint loader="ListString"/>
<Editor name="ESBServiceNameList"/>
@@ -3594,7 +3594,7 @@
<XDependencies/>
</XModelEntity>
<XModelEntity
- ImplementingClass="org.jboss.tools.esb.core.model.ESBRouteToImpl"
+ ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=send;formDependencies=org.jboss.tools.esb.ui.editor.attribute.adapter.RoutingFormDependency"
XMLSUBPATH="send-to" name="ESBPreSendTo">
<XChildrenEntities/>
Modified: branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBRouteToImpl.java
===================================================================
--- branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBRouteToImpl.java 2013-06-21 00:49:59 UTC (rev 44682)
+++ branches/jbosstools-3.3.x/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBRouteToImpl.java 2013-06-21 20:10:58 UTC (rev 44683)
@@ -15,13 +15,21 @@
*/
public class ESBRouteToImpl extends ESBCustomizedObjectImpl {
private static final long serialVersionUID = 1L;
+
+ public static final String ATTR_DESTINATION_NAME = "destination name";
+ public static final String ATTR_SERVICE_NAME = "service name";
+ public static final String ATTR_SERVICE_CATEGORY = "service category";
public ESBRouteToImpl() {}
- public String getPresentationString() {
- String dn = getAttributeValue("destination name");
- if(dn != null && dn.length() > 0) return dn;
- return super.getPresentationString();
+ public String name() {
+ String dn = getAttributeValue(ATTR_DESTINATION_NAME);
+ if(dn != null && dn.length() > 0) {
+ return dn;
+ }
+ String category = getAttributeValue(ATTR_SERVICE_CATEGORY);
+ String name = getAttributeValue(ATTR_SERVICE_NAME);
+ return "" + category + "-" + name;
}
}
Modified: branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.3/jboss-esb-cbr.xml
===================================================================
--- branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.3/jboss-esb-cbr.xml 2013-06-21 00:49:59 UTC (rev 44682)
+++ branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.3/jboss-esb-cbr.xml 2013-06-21 20:10:58 UTC (rev 44683)
@@ -47,6 +47,19 @@
<object-path esb="body.'org.jboss.soa.esb.message.defaultEntry'" />
</property>
</action>
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter"
+ name="Route" process="process">
+ <property name="cbrAlias" value="Xpath"/>
+ <property name="ruleSet" value="/rules/route-xpath.properties"/>
+ <property name="ruleLanguage"/>
+ <property name="ruleReload" value="true"/>
+ <property name="destinations">
+ <route-to destination-name="ALL-1"
+ service-category="Trade OTC" service-name="FTP Service"/>
+ <route-to destination-name="ALL-2"
+ service-category="Trade OTC" service-name="FTP Service"/>
+ </property>
+ </action>
</actions>
</service>
</services>
Modified: branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
===================================================================
--- branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2013-06-21 00:49:59 UTC (rev 44682)
+++ branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2013-06-21 20:10:58 UTC (rev 44683)
@@ -471,7 +471,7 @@
};
checkAttributes(object, objectPath, objectAttrValues, errorList);
- String routePath = cbrRouterPath + "/error-service";
+ String routePath = cbrRouterPath + "/ERROR";
String[][] routeAttrValues = {
{"service name", "error-service"},
{"service category", "com.example.soa"},
@@ -482,6 +482,35 @@
assertTrue(errorList.toString(), errorList.length() == 0);
}
+ /**
+ * Two routes with same service category and service name.
+ */
+ public void testContentBasedRouter2() {
+ XModelObject object = getFileObject("esb-1.3", "jboss-esb-cbr.xml", ESBConstants.ENT_ESB_FILE_130);
+
+ StringBuffer errorList = new StringBuffer();
+
+ String cbrRouterPath = "Services/s/Actions/Route";
+
+ String routePath = cbrRouterPath + "/ALL-1";
+ String[][] routeAttrValues = new String[][]{
+ {"service name", "FTP Service"},
+ {"service category", "Trade OTC"},
+ {"destination name", "ALL-1"},
+ };
+ checkAttributes(object, routePath, routeAttrValues, errorList);
+
+ routePath = cbrRouterPath + "/ALL-2";
+ routeAttrValues = new String[][]{
+ {"service name", "FTP Service"},
+ {"service category", "Trade OTC"},
+ {"destination name", "ALL-2"},
+ };
+ checkAttributes(object, routePath, routeAttrValues, errorList);
+
+ assertTrue(errorList.toString(), errorList.length() == 0);
+ }
+
public void testContentBasedWiretap() {
//Check that ContentBasedWiretap is treated in the same way as ContentBasedRouter
XModelObject object = getFileObject("esb-1.3", "jboss-esb-cbr.xml", ESBConstants.ENT_ESB_FILE_130);
11 years, 3 months