[jboss-svn-commits] JBL Code SVN: r22867 - in labs/jbossesb/workspace/skeagh: commons/src/main/java/org/jboss/esb/lifecycle and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 18 04:44:21 EDT 2008
Author: tfennelly
Date: 2008-09-18 04:44:21 -0400 (Thu, 18 Sep 2008)
New Revision: 22867
Added:
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/Closeable.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/package.html
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/inrouter-config.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/outrouter-config.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/service-config.xml
Removed:
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBusTest.java
Modified:
labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/ScheduleListenerTest.java
Log:
Adding some tests for the bus code.
Added: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/Closeable.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/Closeable.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/Closeable.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.lifecycle;
+
+/**
+ * Closeable Object interface.
+ * <p/>
+ * Effectively the same as the {@link java.io} equivalent. Now exceptions are thrown.
+ * Implementations are expected to handle any errors encountered.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface Closeable
+{
+ /**
+ * Close the resource.
+ */
+ void close();
+}
Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/Closeable.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/package.html (from rev 22853, labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/package.html 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,8 @@
+<html>
+ <head></head>
+ <body>
+ Simple Lifecycle types and utilities.
+
+ <h2>Package Specification</h2>
+ </body>
+</html>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/lifecycle/package.html
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -30,7 +30,7 @@
import javax.jms.TextMessage;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
+import org.jboss.esb.deploy.DeploymentUtil;
import org.junit.Test;
/**
@@ -64,7 +64,7 @@
@Override
public void test() throws Exception
{
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream(config));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream(config));
runtime.deploy();
try
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentUtil.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentUtil.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.deploy;
+
+import org.jboss.esb.deploy.config.DeploymentUnit;
+import org.jboss.esb.deploy.config.InboundRouterConfig;
+import org.jboss.esb.deploy.config.OutboundRouterConfig;
+import org.jboss.esb.deploy.config.ServiceConfig;
+import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.util.AssertArgument;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+/**
+ * Deployment utilities.
+ * <p/>
+ * Useful for testing etc.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class DeploymentUtil
+{
+ /**
+ * Private default constructor.
+ */
+ private DeploymentUtil()
+ {
+ }
+
+ /**
+ * Digest the supplied config stream and create a DeploymentRuntime instance.
+ * <p/>
+ * Uses the {@link org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester}.
+ *
+ * @param deploymentConfig The config stream.
+ * @return The DeploymentRuntime instance (undeployed).
+ * @throws org.jboss.esb.deploy.DeploymentException
+ * Error digesting configuration.
+ * @throws java.io.IOException Error reading configuration stream.
+ */
+ public static DeploymentRuntime createRuntime(final InputStream deploymentConfig) throws DeploymentException, IOException
+ {
+ DeploymentRuntime runtime = new DeploymentRuntime();
+ DefaultConfigurationDigester digester = new DefaultConfigurationDigester();
+ DeploymentUnit deploymentUnit = digester.digest(deploymentConfig);
+
+ runtime.add(deploymentUnit);
+
+ return runtime;
+ }
+
+ /**
+ * Get an inrouter config from the runtime.
+ *
+ * @param service The service name associated with the config.
+ * @param configName The configuration name.
+ * @param runtime The runtime instance.
+ * @return The router configuration instance, or null if no such router config exists.
+ */
+ public static InboundRouterConfig getInboundRouter(final ServiceName service, final String configName, final DeploymentRuntime runtime)
+ {
+ AssertArgument.isNotNull(service, "service");
+ AssertArgument.isNotNullAndNotEmpty(configName, "configName");
+ AssertArgument.isNotNull(runtime, "runtime");
+
+ List<DeploymentUnit> deploymentUnits = runtime.getDeploymentUnits();
+ for (DeploymentUnit deploymentUnit : deploymentUnits)
+ {
+ InboundRouterConfig inrouterConfig = deploymentUnit.getInboundRouter(service, configName);
+ if (inrouterConfig != null)
+ {
+ return inrouterConfig;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get a service config from the runtime.
+ *
+ * @param service The service name associated with the config.
+ * @param runtime The runtime instance.
+ * @return The service configuration instance, or null if no such service config exists.
+ */
+ public static ServiceConfig getService(final ServiceName service, final DeploymentRuntime runtime)
+ {
+ AssertArgument.isNotNull(service, "service");
+ AssertArgument.isNotNull(runtime, "runtime");
+
+ List<DeploymentUnit> deploymentUnits = runtime.getDeploymentUnits();
+ for (DeploymentUnit deploymentUnit : deploymentUnits)
+ {
+ ServiceConfig serviceConfig = deploymentUnit.getServices().get(service);
+ if (serviceConfig != null)
+ {
+ return serviceConfig;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get an outrouter config from the runtime.
+ *
+ * @param service The service name associated with the config.
+ * @param configName The configuration name.
+ * @param runtime The runtime instance.
+ * @return The router configuration instance, or null if no such router config exists.
+ */
+ public static OutboundRouterConfig getOutboundRouter(final ServiceName service, final String configName, final DeploymentRuntime runtime)
+ {
+ AssertArgument.isNotNull(service, "service");
+ AssertArgument.isNotNullAndNotEmpty(configName, "configName");
+ AssertArgument.isNotNull(runtime, "runtime");
+
+ List<DeploymentUnit> deploymentUnits = runtime.getDeploymentUnits();
+ for (DeploymentUnit deploymentUnit : deploymentUnits)
+ {
+ OutboundRouterConfig outrouterConfig = deploymentUnit.getOutboundRouter(service, configName);
+ if (outrouterConfig != null)
+ {
+ return outrouterConfig;
+ }
+ }
+
+ return null;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentUtil.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -19,9 +19,6 @@
*/
package org.jboss.esb.deploy.config.digest;
-import org.jboss.esb.deploy.DeploymentException;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.DeploymentUnit;
import org.jboss.esb.xml.XMLParseUtils;
import org.milyn.Smooks;
import org.milyn.cdr.SmooksResourceConfigurationList;
@@ -242,25 +239,4 @@
return list;
}
-
- /**
- * Digest the supplied config stream and create a DeploymentRuntime instance.
- * <p/>
- * Uses the {@link org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester}.
- *
- * @param config The config stream.
- * @return The DeploymentRuntime instance (undeployed).
- * @throws DeploymentException Error digesting configuration.
- * @throws IOException Error reading configuration stream.
- */
- public static DeploymentRuntime digestConfig(final InputStream config) throws DeploymentException, IOException
- {
- DeploymentRuntime runtime = new DeploymentRuntime();
- DefaultConfigurationDigester digester = new DefaultConfigurationDigester();
- DeploymentUnit deploymentUnit = digester.digest(config);
-
- runtime.add(deploymentUnit);
-
- return runtime;
- }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -398,7 +398,7 @@
* @param notification The notification.
* @throws DeploymentException Invalid deployment detected.
*/
- public final void onNotification(final AbstractDeploymentNotification notification) throws DeploymentException
+ public final synchronized void onNotification(final AbstractDeploymentNotification notification) throws DeploymentException
{
String deploymentId = notification.getDeploymentId();
@@ -515,7 +515,7 @@
ServiceName toService = addressing.getTo();
if (toService == null)
{
- throw new RoutingException("Invalid ESB Message. To address not set. Message from '" + addressing.getFrom() + "'.");
+ throw new RoutingException("Invalid ESB Message. 'To' address not set. Message from '" + addressing.getFrom() + "'.");
}
BusInboundRouter inRouter = busInRouters.get(toService);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -30,6 +30,9 @@
/**
* Bus dispatcher.
+ * <p/>
+ * This class is used by the {@link org.jboss.esb.federate.bus.BusInboundRouter}. It is
+ * used to dispatch messages from a Bus to a Service.
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -62,6 +62,13 @@
InvocationContext invocationContext = busMessage.getInvocationContext();
Message esbMessage = busMessage.getMessage();
- dispatcher.dispatch(esbMessage, invocationContext);
+ AddressingContext.setContext(addressingContext);
+ try
+ {
+ dispatcher.dispatch(esbMessage, invocationContext);
+ } finally
+ {
+ AddressingContext.setContext(null);
+ }
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -22,8 +22,7 @@
import junit.framework.TestCase;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
+import org.jboss.esb.deploy.DeploymentUtil;
import java.io.IOException;
@@ -43,7 +42,7 @@
public void test_deploy_01_noexception() throws DeploymentException, IOException
{
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
assertDeployed(false);
runtime.deploy();
assertDeployed(true);
@@ -53,7 +52,7 @@
public void test_deploy_01_exception() throws DeploymentException, IOException
{
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
assertDeployed(false);
MyInRouter.exception = new Exception("deploy exception");
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -22,7 +22,7 @@
import junit.framework.TestCase;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
+import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.service.ServiceName;
@@ -38,12 +38,12 @@
public void test_no_service_processor() throws DeploymentException, IOException, RoutingException
{
ServiceName service = new ServiceName("hello", "hello");
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-dispatch-no-service.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-dispatch-no-service.xml"));
runtime.deploy();
try {
- HelloInboundRouter inRouter = (HelloInboundRouter) runtime.getDeploymentUnits().get(0).getInboundRouter(service, "inrouter1").getRouter();
- HelloOutboundRouter outRouter = (HelloOutboundRouter) runtime.getDeploymentUnits().get(0).getOutboundRouter(service, "outrouter1").getRouter();
+ HelloInboundRouter inRouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(service, "inrouter1", runtime).getRouter();
+ HelloOutboundRouter outRouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(service, "outrouter1", runtime).getRouter();
assertEquals(null, outRouter.getHelloMessage());
inRouter.sendHello("Hey there");
@@ -56,13 +56,13 @@
public void test_with_service_processor() throws DeploymentException, IOException, RoutingException
{
ServiceName service = new ServiceName("hello", "hello");
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-dispatch-with-service.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-dispatch-with-service.xml"));
runtime.deploy();
try {
- HelloInboundRouter inRouter = (HelloInboundRouter) runtime.getDeploymentUnits().get(0).getInboundRouter(service, "inrouter1").getRouter();
- HelloWorldService helloService = (HelloWorldService) runtime.getDeploymentUnits().get(0).getServices().get(service).getService();
- HelloOutboundRouter outRouter = (HelloOutboundRouter) runtime.getDeploymentUnits().get(0).getOutboundRouter(service, "outrouter1").getRouter();
+ HelloInboundRouter inRouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(service, "inrouter1", runtime).getRouter();
+ HelloWorldService helloService = (HelloWorldService) DeploymentUtil.getService(service, runtime).getService();
+ HelloOutboundRouter outRouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(service, "outrouter1", runtime).getRouter();
assertEquals(null, helloService.getHelloMessage());
assertEquals(null, outRouter.getHelloMessage());
@@ -79,13 +79,13 @@
public void test_with_intransform() throws DeploymentException, IOException, RoutingException
{
ServiceName service = new ServiceName("hello", "hello");
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-dispatch-with-intransform.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-dispatch-with-intransform.xml"));
runtime.deploy();
try {
- HelloInboundRouter inRouter = (HelloInboundRouter) runtime.getDeploymentUnits().get(0).getInboundRouter(service, "inrouter1").getRouter();
- HelloWorldService helloService = (HelloWorldService) runtime.getDeploymentUnits().get(0).getServices().get(service).getService();
- HelloOutboundRouter outRouter = (HelloOutboundRouter) runtime.getDeploymentUnits().get(0).getOutboundRouter(service, "outrouter1").getRouter();
+ HelloInboundRouter inRouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(service, "inrouter1", runtime).getRouter();
+ HelloWorldService helloService = (HelloWorldService) DeploymentUtil.getService(service, runtime).getService();
+ HelloOutboundRouter outRouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(service, "outrouter1", runtime).getRouter();
assertEquals(null, outRouter.getHelloMessage());
assertEquals(null, helloService.getHelloMessage());
@@ -122,13 +122,13 @@
public void test_with_outtransform() throws DeploymentException, IOException, RoutingException
{
ServiceName service = new ServiceName("hello", "hello");
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-dispatch-with-outtransform.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-dispatch-with-outtransform.xml"));
runtime.deploy();
try {
- HelloInboundRouter inRouter = (HelloInboundRouter) runtime.getDeploymentUnits().get(0).getInboundRouter(service, "inrouter1").getRouter();
- HelloWorldService helloService = (HelloWorldService) runtime.getDeploymentUnits().get(0).getServices().get(service).getService();
- HelloOutboundRouter outRouter = (HelloOutboundRouter) runtime.getDeploymentUnits().get(0).getOutboundRouter(service, "outrouter1").getRouter();
+ HelloInboundRouter inRouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(service, "inrouter1", runtime).getRouter();
+ HelloWorldService helloService = (HelloWorldService) DeploymentUtil.getService(service, runtime).getService();
+ HelloOutboundRouter outRouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(service, "outrouter1", runtime).getRouter();
assertEquals(null, outRouter.getHelloMessage());
assertEquals(null, helloService.getHelloMessage());
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -21,7 +21,7 @@
import junit.framework.TestCase;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
+import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.jms.JMSTestRunner;
/**
@@ -34,12 +34,12 @@
new JMSTestRunner() {
public void test() throws Exception
{
- DeploymentRuntime deployment1 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-01.xml"));
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-01.xml"));
deployment1.setDeploymentName("deployment1");
deployment1.deploy();
try {
DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
- DeploymentRuntime deployment2 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-02.xml"));
+ DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-02.xml"));
deployment2.setDeploymentName("deployment2");
deployment2.deploy();
@@ -62,7 +62,7 @@
assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
// Now lets deploy another services
- DeploymentRuntime deployment3 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-03.xml"));
+ DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-03.xml"));
deployment3.setDeploymentName("deployment3");
deployment3.deploy();
try {
@@ -127,12 +127,12 @@
new JMSTestRunner() {
public void test() throws Exception
{
- DeploymentRuntime deployment1 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-01.xml"));
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-01.xml"));
deployment1.setDeploymentName("deployment1");
deployment1.deploy();
try {
DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
- DeploymentRuntime deployment2 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-02.xml"));
+ DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-02.xml"));
deployment2.setDeploymentName("deployment2");
deployment2.deploy();
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBusTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBusTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBusTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -1,225 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, 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.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.federate.bus.jms;
-
-import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentException;
-import org.jboss.esb.federate.bus.BusMessage;
-import org.jboss.esb.federate.bus.BusMessageListener;
-import org.jboss.esb.federate.notify.NotificationListener;
-import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
-import org.jboss.esb.federate.notify.DeploymentHeartbeatNotification;
-import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.properties.ApplicationProperties;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JMSBusTest extends TestCase
-{
- public void test_send_message() throws Exception
- {
- new JMSTestRunner()
- {
- public void test() throws Exception
- {
- JMSBus interface1 = createBusInterfaceInstance("deployment1");
- TestBusMessageListener interface1Listener = new TestBusMessageListener();
- interface1.setBusMessageListener(interface1Listener);
- try
- {
- JMSBus interface2 = createBusInterfaceInstance("deployment2");
- TestBusMessageListener interface2Listener = new TestBusMessageListener();
- interface2.setBusMessageListener(interface2Listener);
- try
- {
- JMSBus interface3 = createBusInterfaceInstance("deployment3");
- TestBusMessageListener interface3Listener = new TestBusMessageListener();
- interface3.setBusMessageListener(interface3Listener);
- try
- {
- BusMessage message = new BusMessage();
-
- // Send a message from deployment1 to deployment2
- assertEquals(0, interface1Listener.messagesReceived.size());
- assertEquals(0, interface2Listener.messagesReceived.size());
- assertEquals(0, interface3Listener.messagesReceived.size());
- interface1.send(message, "deployment2");
- Thread.sleep(100);
- assertEquals(0, interface1Listener.messagesReceived.size());
- assertEquals(1, interface2Listener.messagesReceived.size());
- assertEquals(0, interface3Listener.messagesReceived.size());
- interface2Listener.messagesReceived.clear();
-
- // Send a message from deployment2 to deployment3
- assertEquals(0, interface1Listener.messagesReceived.size());
- assertEquals(0, interface2Listener.messagesReceived.size());
- assertEquals(0, interface3Listener.messagesReceived.size());
- interface2.send(message, "deployment3");
- Thread.sleep(100);
- assertEquals(0, interface1Listener.messagesReceived.size());
- assertEquals(0, interface2Listener.messagesReceived.size());
- assertEquals(1, interface3Listener.messagesReceived.size());
- interface3Listener.messagesReceived.clear();
-
- // Send a message from deployment3 to deployment1
- assertEquals(0, interface1Listener.messagesReceived.size());
- assertEquals(0, interface2Listener.messagesReceived.size());
- assertEquals(0, interface3Listener.messagesReceived.size());
- interface3.send(message, "deployment1");
- Thread.sleep(100);
- assertEquals(1, interface1Listener.messagesReceived.size());
- assertEquals(0, interface2Listener.messagesReceived.size());
- assertEquals(0, interface3Listener.messagesReceived.size());
- interface1Listener.messagesReceived.clear();
- }
- finally
- {
- interface3.close();
- }
- }
- finally
- {
- interface2.close();
- }
- }
- finally
- {
- interface1.close();
- }
- }
- }.run();
- }
-
- public void test_send_notification() throws Exception
- {
- new JMSTestRunner()
- {
- public void test() throws Exception
- {
- JMSBus interface1 = createBusInterfaceInstance("deployment1");
- TestNotificationListener interface1Listener = new TestNotificationListener();
- interface1.setNotificationListener(interface1Listener);
- try
- {
- JMSBus interface2 = createBusInterfaceInstance("deployment2");
- TestNotificationListener interface2Listener = new TestNotificationListener();
- interface2.setNotificationListener(interface2Listener);
- try
- {
- JMSBus interface3 = createBusInterfaceInstance("deployment3");
- TestNotificationListener interface3Listener = new TestNotificationListener();
- interface3.setNotificationListener(interface3Listener);
- try
- {
- DeploymentHeartbeatNotification notification = new DeploymentHeartbeatNotification();
-
- // deployment1 send a notification...
- assertEquals(0, interface1Listener.notificationsReceived.size());
- assertEquals(0, interface2Listener.notificationsReceived.size());
- assertEquals(0, interface3Listener.notificationsReceived.size());
- interface1.sendNotification(notification);
- Thread.sleep(100);
- assertEquals(0, interface1Listener.notificationsReceived.size());
- assertEquals(1, interface2Listener.notificationsReceived.size());
- assertEquals(1, interface3Listener.notificationsReceived.size());
- interface2Listener.notificationsReceived.clear();
- interface3Listener.notificationsReceived.clear();
-
- // deployment2 send a notification...
- assertEquals(0, interface1Listener.notificationsReceived.size());
- assertEquals(0, interface2Listener.notificationsReceived.size());
- assertEquals(0, interface3Listener.notificationsReceived.size());
- interface2.sendNotification(notification);
- Thread.sleep(100);
- assertEquals(1, interface1Listener.notificationsReceived.size());
- assertEquals(0, interface2Listener.notificationsReceived.size());
- assertEquals(1, interface3Listener.notificationsReceived.size());
- interface1Listener.notificationsReceived.clear();
- interface3Listener.notificationsReceived.clear();
-
- // deployment3 send a notification...
- assertEquals(0, interface1Listener.notificationsReceived.size());
- assertEquals(0, interface2Listener.notificationsReceived.size());
- assertEquals(0, interface3Listener.notificationsReceived.size());
- interface3.sendNotification(notification);
- Thread.sleep(100);
- assertEquals(1, interface1Listener.notificationsReceived.size());
- assertEquals(1, interface2Listener.notificationsReceived.size());
- assertEquals(0, interface3Listener.notificationsReceived.size());
- interface1Listener.notificationsReceived.clear();
- interface3Listener.notificationsReceived.clear();
- }
- finally
- {
- interface3.close();
- }
- }
- finally
- {
- interface2.close();
- }
- }
- finally
- {
- interface1.close();
- }
- }
- }.run();
- }
-
- private JMSBus createBusInterfaceInstance(String name) throws IOException, DeploymentException, InterruptedException
- {
- JMSBus busInterface1 = new JMSBus();
- ApplicationProperties properties = ApplicationProperties.loadProperties(getClass().getResourceAsStream("jmsbus.properties"));
-
- busInterface1.setDeploymentName(name);
- busInterface1.setDeploymentId(name); // using the name as the ID for testing
- busInterface1.setProperties(properties);
- busInterface1.connect();
-
- Thread.sleep(500);
-
- return busInterface1;
- }
-
- private class TestBusMessageListener implements BusMessageListener
- {
- private List<BusMessage> messagesReceived = new ArrayList<BusMessage>();
- public void onMessage(BusMessage busMessage)
- {
- messagesReceived.add(busMessage);
- }
- }
-
- private class TestNotificationListener implements NotificationListener
- {
- private List<AbstractDeploymentNotification> notificationsReceived = new ArrayList<AbstractDeploymentNotification>();
-
- public void onNotification(AbstractDeploymentNotification notification)
- {
- notificationsReceived.add(notification);
- }
- }
-}
Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java (from rev 22853, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBusTest.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,225 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus.jms;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentException;
+import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.federate.bus.BusMessageListener;
+import org.jboss.esb.federate.notify.NotificationListener;
+import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
+import org.jboss.esb.federate.notify.DeploymentHeartbeatNotification;
+import org.jboss.esb.jms.JMSTestRunner;
+import org.jboss.esb.properties.ApplicationProperties;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JMSBus_Standalone_Test extends TestCase
+{
+ public void test_send_message() throws Exception
+ {
+ new JMSTestRunner()
+ {
+ public void test() throws Exception
+ {
+ JMSBus interface1 = createBusInterfaceInstance("deployment1");
+ TestBusMessageListener interface1Listener = new TestBusMessageListener();
+ interface1.setBusMessageListener(interface1Listener);
+ try
+ {
+ JMSBus interface2 = createBusInterfaceInstance("deployment2");
+ TestBusMessageListener interface2Listener = new TestBusMessageListener();
+ interface2.setBusMessageListener(interface2Listener);
+ try
+ {
+ JMSBus interface3 = createBusInterfaceInstance("deployment3");
+ TestBusMessageListener interface3Listener = new TestBusMessageListener();
+ interface3.setBusMessageListener(interface3Listener);
+ try
+ {
+ BusMessage message = new BusMessage();
+
+ // Send a message from deployment1 to deployment2
+ assertEquals(0, interface1Listener.messagesReceived.size());
+ assertEquals(0, interface2Listener.messagesReceived.size());
+ assertEquals(0, interface3Listener.messagesReceived.size());
+ interface1.send(message, "deployment2");
+ Thread.sleep(100);
+ assertEquals(0, interface1Listener.messagesReceived.size());
+ assertEquals(1, interface2Listener.messagesReceived.size());
+ assertEquals(0, interface3Listener.messagesReceived.size());
+ interface2Listener.messagesReceived.clear();
+
+ // Send a message from deployment2 to deployment3
+ assertEquals(0, interface1Listener.messagesReceived.size());
+ assertEquals(0, interface2Listener.messagesReceived.size());
+ assertEquals(0, interface3Listener.messagesReceived.size());
+ interface2.send(message, "deployment3");
+ Thread.sleep(100);
+ assertEquals(0, interface1Listener.messagesReceived.size());
+ assertEquals(0, interface2Listener.messagesReceived.size());
+ assertEquals(1, interface3Listener.messagesReceived.size());
+ interface3Listener.messagesReceived.clear();
+
+ // Send a message from deployment3 to deployment1
+ assertEquals(0, interface1Listener.messagesReceived.size());
+ assertEquals(0, interface2Listener.messagesReceived.size());
+ assertEquals(0, interface3Listener.messagesReceived.size());
+ interface3.send(message, "deployment1");
+ Thread.sleep(100);
+ assertEquals(1, interface1Listener.messagesReceived.size());
+ assertEquals(0, interface2Listener.messagesReceived.size());
+ assertEquals(0, interface3Listener.messagesReceived.size());
+ interface1Listener.messagesReceived.clear();
+ }
+ finally
+ {
+ interface3.close();
+ }
+ }
+ finally
+ {
+ interface2.close();
+ }
+ }
+ finally
+ {
+ interface1.close();
+ }
+ }
+ }.run();
+ }
+
+ public void test_send_notification() throws Exception
+ {
+ new JMSTestRunner()
+ {
+ public void test() throws Exception
+ {
+ JMSBus interface1 = createBusInterfaceInstance("deployment1");
+ TestNotificationListener interface1Listener = new TestNotificationListener();
+ interface1.setNotificationListener(interface1Listener);
+ try
+ {
+ JMSBus interface2 = createBusInterfaceInstance("deployment2");
+ TestNotificationListener interface2Listener = new TestNotificationListener();
+ interface2.setNotificationListener(interface2Listener);
+ try
+ {
+ JMSBus interface3 = createBusInterfaceInstance("deployment3");
+ TestNotificationListener interface3Listener = new TestNotificationListener();
+ interface3.setNotificationListener(interface3Listener);
+ try
+ {
+ DeploymentHeartbeatNotification notification = new DeploymentHeartbeatNotification();
+
+ // deployment1 send a notification...
+ assertEquals(0, interface1Listener.notificationsReceived.size());
+ assertEquals(0, interface2Listener.notificationsReceived.size());
+ assertEquals(0, interface3Listener.notificationsReceived.size());
+ interface1.sendNotification(notification);
+ Thread.sleep(100);
+ assertEquals(0, interface1Listener.notificationsReceived.size());
+ assertEquals(1, interface2Listener.notificationsReceived.size());
+ assertEquals(1, interface3Listener.notificationsReceived.size());
+ interface2Listener.notificationsReceived.clear();
+ interface3Listener.notificationsReceived.clear();
+
+ // deployment2 send a notification...
+ assertEquals(0, interface1Listener.notificationsReceived.size());
+ assertEquals(0, interface2Listener.notificationsReceived.size());
+ assertEquals(0, interface3Listener.notificationsReceived.size());
+ interface2.sendNotification(notification);
+ Thread.sleep(100);
+ assertEquals(1, interface1Listener.notificationsReceived.size());
+ assertEquals(0, interface2Listener.notificationsReceived.size());
+ assertEquals(1, interface3Listener.notificationsReceived.size());
+ interface1Listener.notificationsReceived.clear();
+ interface3Listener.notificationsReceived.clear();
+
+ // deployment3 send a notification...
+ assertEquals(0, interface1Listener.notificationsReceived.size());
+ assertEquals(0, interface2Listener.notificationsReceived.size());
+ assertEquals(0, interface3Listener.notificationsReceived.size());
+ interface3.sendNotification(notification);
+ Thread.sleep(100);
+ assertEquals(1, interface1Listener.notificationsReceived.size());
+ assertEquals(1, interface2Listener.notificationsReceived.size());
+ assertEquals(0, interface3Listener.notificationsReceived.size());
+ interface1Listener.notificationsReceived.clear();
+ interface3Listener.notificationsReceived.clear();
+ }
+ finally
+ {
+ interface3.close();
+ }
+ }
+ finally
+ {
+ interface2.close();
+ }
+ }
+ finally
+ {
+ interface1.close();
+ }
+ }
+ }.run();
+ }
+
+ private JMSBus createBusInterfaceInstance(String name) throws IOException, DeploymentException, InterruptedException
+ {
+ JMSBus busInterface1 = new JMSBus();
+ ApplicationProperties properties = ApplicationProperties.loadProperties(getClass().getResourceAsStream("jmsbus.properties"));
+
+ busInterface1.setDeploymentName(name);
+ busInterface1.setDeploymentId(name); // using the name as the ID for testing
+ busInterface1.setProperties(properties);
+ busInterface1.connect();
+
+ Thread.sleep(500);
+
+ return busInterface1;
+ }
+
+ private class TestBusMessageListener implements BusMessageListener
+ {
+ private List<BusMessage> messagesReceived = new ArrayList<BusMessage>();
+ public void onMessage(BusMessage busMessage)
+ {
+ messagesReceived.add(busMessage);
+ }
+ }
+
+ private class TestNotificationListener implements NotificationListener
+ {
+ private List<AbstractDeploymentNotification> notificationsReceived = new ArrayList<AbstractDeploymentNotification>();
+
+ public void onNotification(AbstractDeploymentNotification notification)
+ {
+ notificationsReceived.add(notification);
+ }
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus.scenario1;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.dispatch.HelloInboundRouter;
+import org.jboss.esb.dispatch.HelloOutboundRouter;
+import org.jboss.esb.dispatch.HelloWorldService;
+import org.jboss.esb.jms.JMSTestRunner;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BusTest extends TestCase
+{
+
+ public void test() throws Exception
+ {
+ new JMSTestRunner() {
+ public void test() throws Exception
+ {
+ ServiceName serviceA = new ServiceName("Service", "A");
+ DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("outrouter-config.xml"));
+
+ outrouterDeployment.setDeploymentName("outrouter");
+ outrouterDeployment.deploy();
+ try
+ {
+ DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("service-config.xml"));
+
+ serviceDeployment.setDeploymentName("service");
+ serviceDeployment.deploy();
+ try
+ {
+ DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("inrouter-config.xml"));
+
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ try
+ {
+ HelloInboundRouter inrouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(serviceA, "inrouter", inrouterDeployment).getRouter();
+ HelloWorldService service = (HelloWorldService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
+ HelloOutboundRouter outrouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "outrouter", outrouterDeployment).getRouter();
+
+ inrouter.sendHello("Hi there!!");
+ Thread.sleep(100);
+
+ //assertEquals("Hi there!!", service.getHelloMessage());
+ //assertEquals("Hi there!!", outrouter.getHelloMessage());
+ }
+ finally
+ {
+ inrouterDeployment.undeploy();
+ Thread.sleep(500);
+ }
+ }
+ finally
+ {
+ serviceDeployment.undeploy();
+ Thread.sleep(500);
+ }
+ }
+ finally
+ {
+ outrouterDeployment.undeploy();
+ Thread.sleep(500);
+ }
+ }
+ }.run();
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/inrouter-config.xml (from rev 22853, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/inrouter-config.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/inrouter-config.xml 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,9 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+
+ <routing>
+ <inRouters serviceCategory="Service" serviceName="A">
+ <inRouter name="inrouter" class="org.jboss.esb.dispatch.HelloInboundRouter" />
+ </inRouters>
+ </routing>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/inrouter-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/outrouter-config.xml (from rev 22853, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/outrouter-config.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/outrouter-config.xml 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,8 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+
+ <routing>
+ <outRouters serviceCategory="Service" serviceName="A">
+ <outRouter name="outrouter" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+ </outRouters>
+ </routing>
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/outrouter-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/service-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/service-config.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/service-config.xml 2008-09-18 08:44:21 UTC (rev 22867)
@@ -0,0 +1,7 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+
+ <services>
+ <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
+ </services>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/service-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -2,9 +2,9 @@
package org.jboss.esb.federate.notify;
import junit.framework.TestCase;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
import java.io.IOException;
@@ -16,7 +16,7 @@
public void test() throws DeploymentException, IOException
{
- DeploymentRuntime rt = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-config.xml"));
+ DeploymentRuntime rt = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-config.xml"));
DeploymentDetailsNotification notification = DeploymentDetailsNotification.toNotification(rt);
assertEquals("$UNKNOWN$", notification.getDeploymentName());
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/ScheduleListenerTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/ScheduleListenerTest.java 2008-09-18 07:41:53 UTC (rev 22866)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/ScheduleListenerTest.java 2008-09-18 08:44:21 UTC (rev 22867)
@@ -22,9 +22,7 @@
import junit.framework.TestCase;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
-import org.jboss.esb.deploy.config.DeploymentUnit;
+import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.service.ServiceName;
import org.jboss.esb.dispatch.HelloWorldService;
@@ -41,7 +39,7 @@
public void test_OK() throws DeploymentException, IOException, RoutingException, InterruptedException
{
ServiceName service = new ServiceName("hello", "hello");
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("schedule-listener-01.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("schedule-listener-01.xml"));
// Set the mock router's message before deploying...
MockScheduledInboundRouter.inMessage = new Message("Hi, this is the mock scheduled inRouter!");
@@ -60,7 +58,7 @@
public void test_no_schedule() throws DeploymentException, IOException, RoutingException, InterruptedException
{
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("schedule-listener-02.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("schedule-listener-02.xml"));
// Set the mock router's message before deploying...
MockScheduledInboundRouter.inMessage = new Message("Hi, this is the mock scheduled inRouter!");
@@ -75,7 +73,7 @@
public void test_not_a_schedule() throws DeploymentException, IOException, RoutingException, InterruptedException
{
- DeploymentRuntime runtime = DigestUtil.digestConfig(getClass().getResourceAsStream("schedule-listener-03.xml"));
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("schedule-listener-03.xml"));
// Set the mock router's message before deploying...
MockScheduledInboundRouter.inMessage = new Message("Hi, this is the mock scheduled inRouter!");
More information about the jboss-svn-commits
mailing list