[jboss-svn-commits] JBL Code SVN: r20077 - in labs/jbossesb/workspace/jimma/product: rosetta/src/org/jboss/internal/soa/esb/publish and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue May 20 06:01:33 EDT 2008
Author: jim.ma
Date: 2008-05-20 06:01:32 -0400 (Tue, 20 May 2008)
New Revision: 20077
Added:
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/SerivceContractPublisher.java
labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_06.xml
Modified:
labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
Log:
Added in, out and fault xsd attribute to actions element;Added initial ESBServiceContractPublisher
Modified: labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2008-05-20 08:03:48 UTC (rev 20076)
+++ labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2008-05-20 10:01:32 UTC (rev 20077)
@@ -341,6 +341,9 @@
ref="jesb:action" />
</xsd:sequence>
<xsd:attribute name="mep" type="jesb:mepType" />
+ <xsd:attribute name="inXsd" type="xsd:string" />
+ <xsd:attribute name="outXsd" type="xsd:string" />
+ <xsd:attribute name="faultXsd" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="action">
Added: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/SerivceContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/SerivceContractPublisher.java (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/SerivceContractPublisher.java 2008-05-20 10:01:32 UTC (rev 20077)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.publish;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionsDocument.Actions;
+
+public class SerivceContractPublisher implements ContractPublisher {
+ String wsdl;
+
+ public void setActionConfig(Actions actionsConfig)
+ throws ConfigurationException {
+ wsdl = "esb_service.wsdl";
+ }
+
+ public ContractInfo getContractInfo(EPR epr) {
+ return new ContractInfo("text/xml", wsdl);
+ }
+}
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2008-05-20 08:03:48 UTC (rev 20076)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2008-05-20 10:01:32 UTC (rev 20077)
@@ -64,7 +64,10 @@
public static final String DEPLOYMENT_NAME_TAG = "deployment";
/** ActionProcessingPipeline */
- public static final String MEP_ATTRIBUTE_TAG = "mep";
+ public static final String MEP_ATTRIBUTE_TAG = "mep";
+ public static final String IN_XSD_ATTRIBUTE_TAG = "inXsd";
+ public static final String OUT_XSD_ATTRIBUTE_TAG = "outXsd";
+ public static final String FAULT_XSD_ATTRIBUTE_TAG = "faultXsd";
public static final String ACTION_ELEMENT_TAG = "action";
public static final String ACTION_CLASS_TAG = "class";
public static final String PROCESS_METHOD_TAG = "process";
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java 2008-05-20 08:03:48 UTC (rev 20076)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java 2008-05-20 10:01:32 UTC (rev 20077)
@@ -10,6 +10,8 @@
import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
import org.jboss.internal.soa.esb.publish.ContractPublisher;
import org.jboss.internal.soa.esb.publish.Publish;
+import org.jboss.internal.soa.esb.publish.SerivceContractPublisher;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument.Action;
import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
@@ -170,7 +172,16 @@
}
}
}
-
+ if (service.getActions().getInXsd() != null)
+ {
+ SerivceContractPublisher publisher = new SerivceContractPublisher();
+ try {
+ publisher.setActionConfig(service.getActions());
+ } catch (ConfigurationException e) {
+ throw new RuntimeException("Failed to instantiate Service Contract Publisher '" + publisher.getClass().getName() + "'. Class must implement a public default constructor.", e);
+ }
+ return publisher;
+ }
// No publisher configured on any of the actions in the processing chain...
return null;
}
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java 2008-05-20 08:03:48 UTC (rev 20076)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java 2008-05-20 10:01:32 UTC (rev 20077)
@@ -61,6 +61,25 @@
{
listenerConfigTree.setAttribute(ListenerTagNames.MEP_ATTRIBUTE_TAG, mep.toString()) ;
}
+ final String inxsd = actions.getInXsd();
+ if (inxsd != null)
+ {
+ listenerConfigTree.setAttribute(ListenerTagNames.IN_XSD_ATTRIBUTE_TAG, inxsd);
+ }
+ final String outxsd = actions.getOutXsd();
+ if (outxsd != null)
+ {
+ listenerConfigTree.setAttribute(ListenerTagNames.OUT_XSD_ATTRIBUTE_TAG, outxsd);
+ }
+
+ final String faultxsd = actions.getFaultXsd();
+
+ if (faultxsd != null)
+ {
+ listenerConfigTree.setAttribute(ListenerTagNames.FAULT_XSD_ATTRIBUTE_TAG, faultxsd);
+ }
+
+
List<Action> actionList = actions.getActionList();
try {
Modified: labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java 2008-05-20 08:03:48 UTC (rev 20076)
+++ labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java 2008-05-20 10:01:32 UTC (rev 20077)
@@ -5,47 +5,114 @@
import junit.framework.TestCase;
+import org.jboss.internal.soa.esb.publish.SerivceContractPublisher;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryFactory;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
/**
* @author
*/
public class ServicePublisherUnitTest extends TestCase {
- public void test() throws ConfigurationException, IOException {
- Generator generator;
- ManagedLifecycleController controller1 = new ManagedLifecycleController(null); // TODO: Introduce an interface and Mock for ManagedLifecycleController
- ManagedLifecycleController controller2 = new ManagedLifecycleController(null); // TODO: Introduce an interface and Mock for ManagedLifecycleController
+ public void test() throws ConfigurationException, IOException {
+ Generator generator;
+ ManagedLifecycleController controller1 = new ManagedLifecycleController(
+ null); // TODO:
+ // Introduce
+ // an
+ // interface
+ // and
+ // Mock
+ // for
+ // ManagedLifecycleController
+ ManagedLifecycleController controller2 = new ManagedLifecycleController(
+ null); // TODO:
+ // Introduce
+ // an
+ // interface
+ // and
+ // Mock
+ // for
+ // ManagedLifecycleController
- generator = new Generator(getClass().getResourceAsStream("jbossesb_config_04.xml"));
- ServicePublisher.addServicePublishers(controller1, generator.getModel());
- List<ServicePublisher> publishers = ServicePublisher.getServicePublishers();
- assertEquals(2, publishers.size());
- assertEquals("A1", publishers.get(0).getCategory() + publishers.get(0).getServiceName());
- assertEquals(null, publishers.get(0).getContractPublisher());
- assertEquals("B2", publishers.get(1).getCategory() + publishers.get(1).getServiceName());
- assertEquals(null, publishers.get(1).getContractPublisher());
+ generator = new Generator(getClass().getResourceAsStream(
+ "jbossesb_config_04.xml"));
+ ServicePublisher
+ .addServicePublishers(controller1, generator.getModel());
+ List<ServicePublisher> publishers = ServicePublisher
+ .getServicePublishers();
+ assertEquals(2, publishers.size());
+ assertEquals("A1", publishers.get(0).getCategory()
+ + publishers.get(0).getServiceName());
+ assertEquals(null, publishers.get(0).getContractPublisher());
+ assertEquals("B2", publishers.get(1).getCategory()
+ + publishers.get(1).getServiceName());
+ assertEquals(null, publishers.get(1).getContractPublisher());
- generator = new Generator(getClass().getResourceAsStream("jbossesb_config_05.xml"));
- ServicePublisher.addServicePublishers(controller2, generator.getModel());
- publishers = ServicePublisher.getServicePublishers();
- assertEquals(4, publishers.size());
- assertEquals("A1", publishers.get(0).getCategory() + publishers.get(0).getServiceName());
- assertEquals(null, publishers.get(0).getContractPublisher());
- assertEquals("B2", publishers.get(1).getCategory() + publishers.get(1).getServiceName());
- assertEquals(null, publishers.get(1).getContractPublisher());
- assertEquals("C3", publishers.get(2).getCategory() + publishers.get(2).getServiceName());
- assertEquals(null, publishers.get(2).getContractPublisher());
- assertEquals("D4", publishers.get(3).getCategory() + publishers.get(3).getServiceName());
- assertTrue(publishers.get(3).getContractPublisher() instanceof MockContractPublisher);
+ generator = new Generator(getClass().getResourceAsStream(
+ "jbossesb_config_05.xml"));
+ ServicePublisher
+ .addServicePublishers(controller2, generator.getModel());
+ publishers = ServicePublisher.getServicePublishers();
+ assertEquals(4, publishers.size());
+ assertEquals("A1", publishers.get(0).getCategory()
+ + publishers.get(0).getServiceName());
+ assertEquals(null, publishers.get(0).getContractPublisher());
+ assertEquals("B2", publishers.get(1).getCategory()
+ + publishers.get(1).getServiceName());
+ assertEquals(null, publishers.get(1).getContractPublisher());
+ assertEquals("C3", publishers.get(2).getCategory()
+ + publishers.get(2).getServiceName());
+ assertEquals(null, publishers.get(2).getContractPublisher());
+ assertEquals("D4", publishers.get(3).getCategory()
+ + publishers.get(3).getServiceName());
+ assertTrue(publishers.get(3).getContractPublisher() instanceof MockContractPublisher);
- ServicePublisher.removeServicePublishers(controller1);
- publishers = ServicePublisher.getServicePublishers();
- assertEquals(2, publishers.size());
- assertEquals("C3", publishers.get(0).getCategory() + publishers.get(0).getServiceName());
- assertEquals(null, publishers.get(0).getContractPublisher());
- assertEquals("D4", publishers.get(1).getCategory() + publishers.get(1).getServiceName());
- assertTrue(publishers.get(1).getContractPublisher() instanceof MockContractPublisher);
- }
+ ServicePublisher.removeServicePublishers(controller1);
+ publishers = ServicePublisher.getServicePublishers();
+ assertEquals(2, publishers.size());
+ assertEquals("C3", publishers.get(0).getCategory()
+ + publishers.get(0).getServiceName());
+ assertEquals(null, publishers.get(0).getContractPublisher());
+ assertEquals("D4", publishers.get(1).getCategory()
+ + publishers.get(1).getServiceName());
+ assertTrue(publishers.get(1).getContractPublisher() instanceof MockContractPublisher);
+ }
+
+ public void testEsbServicePublisher() throws ConfigurationException,
+ IOException {
+
+ try {
+
+ ESBConfigUtil configUtil = new ESBConfigUtil(getClass()
+ .getResourceAsStream("jbossesb_config_06.xml"));
+ configUtil.setInstallMockRegistry(true);
+ configUtil.startController();
+ List<ServicePublisher> publishers = ServicePublisher
+ .getServicePublishers();
+
+ assertTrue(
+ "ServiceContractPublisher should be added to service publishers",
+ (publishers.get(2).getContractPublisher() instanceof SerivceContractPublisher));
+ Registry registry;
+
+ registry = RegistryFactory.getRegistry();
+ EPR epr = registry.findEPR(publishers.get(2).getCategory(),
+ publishers.get(2).getServiceName());
+ assertEquals("esb_service.wsdl",
+ publishers.get(2).getContractPublisher().getContractInfo(epr).getData());
+
+ configUtil.stopController();
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
}
Added: labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_06.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_06.xml (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_06.xml 2008-05-20 10:01:32 UTC (rev 20077)
@@ -0,0 +1,10 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+ <services>
+ <service category="C" name="3" description="A1" invmScope="GLOBAL">
+ <actions inXsd="request.xsd" outXsd="response.xsd" faultXsd="fault.xsd">
+ <action name="a1" class="org.jboss.soa.esb.actions.converters.ByteArrayToString" />
+ </actions>
+ </service>
+ </services>
+</jbossesb>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list