[jboss-svn-commits] JBL Code SVN: r24186 - in labs/jbossesb/workspace/skeagh: container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus and 17 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Dec 1 13:02:51 EST 2008
Author: tfennelly
Date: 2008-12-01 13:02:51 -0500 (Mon, 01 Dec 2008)
New Revision: 24186
Added:
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleUtil.java
labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/log4j.xml
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/test/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/log4j.xml
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/test/
labs/jbossesb/workspace/skeagh/examples/jms-bus/jmsbus.properties
labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestBusProvider.java
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestRunner.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java
Removed:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestBusProvider.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestRunner.java
Modified:
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/DeploymentContext.java
labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java
labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml
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/JmsOutboundRouterTest.java
labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2182
Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/DeploymentContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/DeploymentContext.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/DeploymentContext.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -51,6 +51,9 @@
* Context ThreadLocal.
*/
private static ThreadLocal<DeploymentContext> contextTL = new ThreadLocal<DeploymentContext>();
+ /**
+ * The deployment ID.
+ */
private String deploymentId;
/**
Modified: labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -19,11 +19,14 @@
*/
package org.jboss.esb.osgi.jmsbus;
+import org.apache.log4j.Logger;
import org.jboss.esb.api.bus.BusProvider;
import org.jboss.esb.jms.JmsBusProvider;
import org.jboss.esb.osgi.bundle.BundleResourceLocator;
+import org.jboss.esb.osgi.bundle.BundleUtil;
import org.jboss.esb.osgi.bus.AbstractBusProviderActivator;
import org.jboss.esb.osgi.config.OsgiConfigUtil;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -42,10 +45,22 @@
public class JmsBusProviderActivator extends AbstractBusProviderActivator implements ManagedService
{
/**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(JmsBusProviderActivator.class);
+ /**
* Service PID for the JMS Bus.
*/
public static final String JMSBUS_SERVICE_PID = "org.jboss.esb.jmsbus";
/**
+ * Provider Name config key.
+ */
+ public static final String PROVIDER_NAME = "provider.name";
+ /**
+ * Provider Version config key.
+ */
+ public static final String PROVIDER_VERSION = "provider.version";
+ /**
* Bundle context.
*/
private BundleContext bundleContext;
@@ -80,9 +95,20 @@
if(dictionary != null)
{
Properties config = OsgiConfigUtil.toProperties(dictionary);
- BusProvider busProvider = new JmsBusProvider(config, new BundleResourceLocator(bundleContext.getBundle()));
+ String jmsProviderName = config.getProperty(PROVIDER_NAME);
+ String jmsProviderVersion = config.getProperty(PROVIDER_VERSION, "");
+ Bundle providerBundle = BundleUtil.findBundle(jmsProviderName, jmsProviderVersion, bundleContext.getBundles());
- registerBusProviderService(busProvider, bundleContext);
+ // TODO: Fixme... This looking up of the provider bundle so as to load the client classes is a bit of a hack. Doesn't seem to be a OSGi JMS Provider Service??
+ if(providerBundle == null)
+ {
+ logger.error("JMS Bus provider '" + jmsProviderName + ":" + jmsProviderVersion + "' bundle not deployed. Not deploying Bus.");
+ }
+ else
+ {
+ BusProvider busProvider = new JmsBusProvider(config, new BundleResourceLocator(providerBundle));
+ registerBusProviderService(busProvider, bundleContext);
+ }
}
}
Modified: labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -23,7 +23,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke,org.jboss.esb.osgi*</Export-Package>
+ <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke,org.jboss.esb.test,org.jboss.esb.osgi*</Export-Package>
<Private-Package>org.jboss.esb.osgi.deploy</Private-Package>
<Import-Package>org.jboss.esb.api*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
<Bundle-Activator>org.jboss.esb.osgi.deploy.DeploymentActivator</Bundle-Activator>
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleUtil.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleUtil.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.osgi.bundle;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+import java.util.Dictionary;
+
+/**
+ * Bundle utilities.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public final class BundleUtil
+{
+
+ /**
+ * Bundle utils.
+ */
+ private BundleUtil()
+ {
+ }
+
+ /**
+ * Fins the specified bundle.
+ *
+ * @param name The bundle name.
+ * @param version The bundle version. Can be null, to match any version.
+ * @param bundles The full list of bundles.
+ * @return The matching bundle, or null if a match was not found.
+ */
+ public static Bundle findBundle(final String name, final String version, final Bundle[] bundles)
+ {
+ for (Bundle bundle : bundles)
+ {
+ Dictionary headers = bundle.getHeaders();
+ String bundleName = (String) headers.get(Constants.BUNDLE_NAME);
+ String bundleVersion = (String) headers.get(Constants.BUNDLE_VERSION);
+
+ if (bundleVersion == null)
+ {
+ bundleVersion = "";
+ }
+
+ // Exact name match. Just a startsWith match on the version, allowing
+ // partial matches...
+ if (bundleName.equals(name) && bundleVersion.startsWith(version))
+ {
+ return bundle;
+ }
+ }
+
+ return null;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleUtil.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -51,7 +51,8 @@
<version>${jboss.esb.version}</version>
</dependency>
- <dependency>
+ <!-- TODO: Is this still needed Danny? -->
+ <dependency>
<groupId>jboss.jbossesb</groupId>
<artifactId>jbossesb-routing-jms</artifactId>
<version>${jboss.esb.version}</version>
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,79 @@
+About This Example:
+===================
+ This example illustrates simple JMS Inbound and Outbound Routing.
+
+ The example is composed of a number of parts:
+ * A JMS Client. This send a JMS message (captured from stdin) to a JMS Queue that is being
+ listened to by a JmsInboundRouter configured on the ESB. Execute in step #7 below.
+ * An ESB Server instance deployed in an Apache Felix OSGi container. This contains the ESB
+ components, as well as an ESB deployment instance (see src/main/resources/jboss-esb.xml).
+ This part of the example is in the "esb" folder and started in step #6 below.
+ * A JMS message "consumer" application which is routed to by the ESB through a
+ JmsOutboundRouter. This is started in step #3 below.
+
+ So the flow of the message is:
+ _________
+ | |
+ JMS Client --> JMS Queue <-- | ESB | --> JMS Queue <-- JMS Consumer App
+ |_________|
+
+How to Run?
+===========
+ Requirements:
+ 1. JDK 1.5
+ 2. Maven 2.x (http://maven.apache.org/download.html)
+
+ Building:
+ Just type "mvn clean install" inside this folder.
+
+ Running:
+ 1. From the "examples/util/jms-provider" directory run:
+ "mvn activemq:run"
+ This starts the JMS Provider.
+ 2. Open a new console window ("Window 2")
+ 3. From the "jms-consumer" directory run:
+ "mvn exec:java"
+ This starts a JMS Consumer that listens to the outbound routers queue.
+ 4. Open a new console window ("Window 3")
+ 5. From the "esb" directory run:
+ "mvn pax:provision"
+ This will start JBossESB in OSGi container Felix.
+ 6. Open a new console window ("Window 4")
+ 7. From the "esb" directory run:
+ "mvn exec:java"
+ Type something at the command line and hit return. The text typed will become the message payload.
+ This will post a JMS Message to the inbound routers queue.
+ To exit the client type CTRL-C.
+
+ We recommend that you setup the windows so they call can be seen at the same time. The jms-provider
+ window does not need to be visible as no output is expected to it.
+
+Expected output
+===============
+ "Window 4" (JMS Client):
+ > Specify message payload test >some text
+ Sent message [ID:danbev-laptop-41003-1227008237853-1:0:1:1:1] to [jbossesb.TestQueue]
+
+ "Window 3" (esb service deployment):
+ ---------------------------------------------------------------------->
+ Message payload 'some text'
+ <----------------------------------------------------------------------
+
+ "Window 2" (jms-consumer):
+ [ Received Message[1]
+ [JMSMessageID : ID:danbev-laptop-54663-1227008186571-1:0:1:1:1]
+ [JMSCorrelelationID : ID:danbev-laptop-41003-1227008237853-1:0:1:1:1]
+ [MessageType : TextMessage]
+ [Text :
+ some text]
+ ]
+
+Things to try
+=============
+ At the felix commmand prompt ("Window 2"):
+ >ps // will list all bundles
+ >stop <id> // use the id of the JBoss ESB - JMS Router Example (5.0.0.SNAPSHOT)
+ >start <id> // use the id of the JBoss ESB - JMS Router Example (5.0.0.SNAPSHOT)
+
+ Notice how the esb undeploy and deploys the bundle.
+
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-examples-jms-bus</artifactId>
+ <version>${jboss.esb.version}</version>
+ </parent>
+ <name>JBoss ESB - JMS Bus Routing Example (ESB 1)</name>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-examples-jms-bus-esb1</artifactId>
+ <version>${jboss.esb.version}</version>
+ <url>http://www.jboss.org/jbossesb/</url>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <felix.log.level>1</felix.log.level><!-- 4=debug -->
+ <org.jboss.esb.properties.dir>../../</org.jboss.esb.properties.dir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-api</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-runtime</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-configloader</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-routing-file</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <!-- Required by the JMS Bus -->
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-routing-jms</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-jmsbus</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.ops4j</groupId>
+ <artifactId>maven-pax-plugin</artifactId>
+ <version>1.3</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.apache.commons.logging</Export-Package> <!-- Exporting commons-logging because activemq needs it and there doesn't seem to be a bundled version available. -->
+ <Import-Package>org.jboss.esb.api.routing, org.jboss.esb.api.*, org.jboss.esb.file, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
+ <Embed-Dependency>log4j, commons-logging</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>
+ <JBossESB-DeploymentName>JMS-Bus-Example-OSGi-ESB1</JBossESB-DeploymentName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,22 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+ <resources>
+ <resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
+ <property name="frequency">2000</property>
+ </resource>
+ </resources>
+
+ <services>
+ <service serviceCategory="ESB1" serviceName="Service" serviceDescription="ESB1 Service" class="org.jboss.esb.test.PrintlnService">
+ <inRouter name="fileRouter" class="org.jboss.esb.file.FileInboundRouter">
+ <property name="scheduleResourceId">schedule1</property>
+ <property name="fileSelectorPattern">target/*.txt</property>
+ </inRouter>
+ <outRouter name="route-to-ESB2-Service" class="org.jboss.esb.invoke.ServiceRouter">
+ <property name="toCategory">ESB2</property>
+ <property name="toService">Service</property>
+ </outRouter>
+ </service>
+ </services>
+
+</jbossesb>
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/log4j.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.milyn">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.quartz">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.jboss.esb">
+ <priority value="info"/>
+ </category>
+
+ <category name="org.apache.activemq">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
+
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/log4j.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-examples-jms-bus</artifactId>
+ <version>${jboss.esb.version}</version>
+ </parent>
+ <name>JBoss ESB - JMS Bus Routing Example (ESB 2)</name>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-examples-jms-bus-esb2</artifactId>
+ <version>${jboss.esb.version}</version>
+ <url>http://www.jboss.org/jbossesb/</url>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <felix.log.level>1</felix.log.level><!-- 4=debug -->
+ <org.jboss.esb.properties.dir>../</org.jboss.esb.properties.dir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-api</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-runtime</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-configloader</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-routing-file</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-jmsbus</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <configuration>
+ <executable>java</executable>
+ <mainClass>org.jboss.esb.examples.jmsrouter.JmsClient</mainClass>
+ <arguments>
+ <argument>jbossesb.TestQueue</argument>
+ <!--argument>Message payload text...</argument-->
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.ops4j</groupId>
+ <artifactId>maven-pax-plugin</artifactId>
+ <version>1.3</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.apache.commons.logging</Export-Package> <!-- Exporting commons-logging because activemq needs it and there doesn't seem to be a bundled version available. -->
+ <Import-Package>org.jboss.esb.api.routing, org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
+ <Embed-Dependency>log4j, commons-logging</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>
+ <JBossESB-DeploymentName>JMS-Bus-Example-OSGi</JBossESB-DeploymentName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,7 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+ <services>
+ <service serviceCategory="ESB2" serviceName="Service" serviceDescription="ESB1 Service" class="org.jboss.esb.test.PrintlnService" />
+ </services>
+
+</jbossesb>
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/log4j.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.milyn">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.quartz">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.jboss.esb">
+ <priority value="debug"/>
+ </category>
+
+ <category name="org.jboss.esb.examples.helloworld">
+ <priority value="info"/>
+ </category>
+
+ <category name="org.apache.activemq">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
+
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/log4j.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/jmsbus.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/jmsbus.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/jmsbus.properties 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,23 @@
+###########################################################################################
+# JMS bus config.
+##########################################################################################
+
+# Service PID used by the Property Loader Service for loading the properties into the
+# Configuration Admin Service...
+service.pid=org.jboss.esb.jmsbus
+
+# The provider bundle details (hack!!)...
+provider.name=activemq-core
+provider.version=5.2.0
+
+# JNDI Settings...
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:61717
+
+# Bus Queues and Topics...
+deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+deployment.bus.queue=jbossesb.jms.bus
+
+# ActiveMQ Queue and Topic deployments...
+topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+queue.jbossesb.jms.bus=jbossesb.jms.bus
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/jmsbus.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-examples</artifactId>
+ <version>${jboss.esb.version}</version>
+ </parent>
+ <name>JBoss ESB - JMS Bus Routing Example</name>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-examples-jms-bus</artifactId>
+ <version>${jboss.esb.version}</version>
+ <url>http://www.jboss.org/jbossesb/</url>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>esb1</module>
+ <module>esb2</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ <version>3.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
+ <version>1.0-M1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-tools</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestBusProvider.java (from rev 24170, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestBusProvider.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestBusProvider.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestBusProvider.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.jms.test;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.jndi.ActiveMQInitialContextFactory;
+import org.jboss.esb.test.TestBusProvider;
+
+import javax.naming.Context;
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Jms Provider that can be uses in funtional/integration tests.
+ * <p/>
+ * <br>
+ * Usage:
+ * <pre>
+ * private static JmsTestProvider jmsProvider;
+ *
+ * @BeforeClass
+ * public static void startProvider() throws Exception
+ * {
+ * jmsProvider = new JmsTestProvider();
+ * jmsProvider.start();
+ * }
+ *
+ * @AfterClass
+ * public static void stopProvider() throws Exception
+ * {
+ * jmsProvider.stop();
+ * }
+ *
+ * @Test
+ * public void testSomething()
+ * {
+ * ...
+ * }
+ * </pre>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class JmsTestBusProvider implements TestBusProvider
+{
+ /**
+ * Default provider URL.
+ */
+ public static final String DEFAULT_PROVIDER_URL = "tcp://localhost:61717";
+
+ /**
+ * JNDI properties.
+ */
+ private Properties jndiProperties;
+
+ /**
+ * Default JNDI Provider URL.
+ */
+ private String providerUrl = DEFAULT_PROVIDER_URL;
+
+ /**
+ * Jms broker.
+ */
+ private BrokerService broker;
+
+ /**
+ * Public constructor.
+ */
+ public JmsTestBusProvider()
+ {
+ jndiProperties = new Properties();
+ jndiProperties.setProperty(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
+ jndiProperties.setProperty(Context.PROVIDER_URL, DEFAULT_PROVIDER_URL);
+ }
+
+ /**
+ * Public constructor.
+ *
+ * @param providerUrl Provider URL.
+ */
+ public JmsTestBusProvider(final String providerUrl)
+ {
+ this();
+ jndiProperties.setProperty(Context.PROVIDER_URL, providerUrl);
+ this.providerUrl = providerUrl;
+ }
+
+ /**
+ * Get the JNDI properties in use by this test runner instance.
+ *
+ * @return The JNDI properties.
+ */
+ public final Properties getJndiProperties()
+ {
+ return (Properties) jndiProperties.clone();
+ }
+
+ /**
+ * Start the JMS Broker.
+ *
+ * @throws Exception Error starting the broker.
+ */
+ public final void start() throws Exception
+ {
+ broker = new BrokerService();
+
+ // configure the broker
+ broker.setDataDirectory(new File("./target/activeMQData"));
+ broker.addConnector(providerUrl);
+
+ broker.start();
+
+ }
+
+ /**
+ * Stop the JMS Broker.
+ *
+ * @throws Exception Error stopping the broker.
+ */
+ public final void stop() throws Exception
+ {
+ if (broker != null)
+ {
+ broker.stop();
+ }
+ }
+
+}
Property changes on: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestBusProvider.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestRunner.java (from rev 24170, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestRunner.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestRunner.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestRunner.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.jms.test;
+
+
+/**
+ * Starts a JMS broker and makes sure it gets shutdown.
+ * <p/>
+ * <br>
+ * Usage:
+ * <pre>
+ * new JMSTestRunner() {
+ * public void test() throws Exception {
+ * ...
+ * }
+ * }.run();
+ * </pre>
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class JmsTestRunner extends JmsTestBusProvider
+{
+ /**
+ * Public constructor.
+ */
+ public JmsTestRunner()
+ {
+ super();
+ }
+
+ /**
+ * Public constructor.
+ *
+ * @param providerUrl Provider URL.
+ */
+ public JmsTestRunner(final String providerUrl)
+ {
+ super(providerUrl);
+ }
+
+ /**
+ * Run the test.
+ *
+ * @throws Exception Error running test.
+ */
+ public final void run() throws Exception
+ {
+ start();
+ try
+ {
+ test();
+ }
+ finally
+ {
+ stop();
+ }
+ }
+
+ /**
+ * Test method.
+ *
+ * @throws Exception Test exception.
+ */
+ public abstract void test() throws Exception;
+}
Property changes on: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/test/JmsTestRunner.java
___________________________________________________________________
Name: svn:eol-style
+ native
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-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -22,7 +22,7 @@
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestBusProvider;
+import org.jboss.esb.jms.test.JmsTestBusProvider;
import org.junit.AfterClass;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsOutboundRouterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsOutboundRouterTest.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsOutboundRouterTest.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -48,7 +48,7 @@
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.deploy.config.OutboundRouterConfig;
-import org.jboss.esb.test.JmsTestBusProvider;
+import org.jboss.esb.jms.test.JmsTestBusProvider;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -28,7 +28,7 @@
import org.jboss.esb.api.exception.DeploymentException;
import org.jboss.esb.federate.notify.DeploymentHeartbeatNotification;
import org.jboss.esb.properties.ApplicationProperties;
-import org.jboss.esb.test.JmsTestRunner;
+import org.jboss.esb.jms.test.JmsTestRunner;
import org.jboss.esb.jms.JmsBus;
import java.io.IOException;
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -70,6 +70,18 @@
* Represents the basic JBoss ESB deployment runtime, managing the deployment
* of a set of resources, routers and services.
*
+ * <h3>Component Initialization</h3>
+ * All components initialized by this deployer inject the following:
+ * <ol>
+ * <li><b>{@link DeploymentContext}</b>: If a property of that type named "deploymentContext"
+ * is defined on the object.</li>
+ * <li><b>{@link ServiceName}</b>: If a property of that type named "serviceName"
+ * is defined on the object.</li>
+ * <li><b>objectName</b>: If a property of that type {@link String} and named "objectName"
+ * is defined on the object. This is the name given to the deployment object as
+ * defined in the configuration (typically under a "name" attribute).</li>
+ * </ol>
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class DeploymentRuntime implements Deployable
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestBusProvider.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestBusProvider.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestBusProvider.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -1,143 +0,0 @@
-/*
- * 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.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.test;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.jndi.ActiveMQInitialContextFactory;
-
-import javax.naming.Context;
-import java.io.File;
-import java.util.Properties;
-
-/**
- * Jms Provider that can be uses in funtional/integration tests.
- * <p/>
- * <br>
- * Usage:
- * <pre>
- * private static JmsTestProvider jmsProvider;
- *
- * @BeforeClass
- * public static void startProvider() throws Exception
- * {
- * jmsProvider = new JmsTestProvider();
- * jmsProvider.start();
- * }
- *
- * @AfterClass
- * public static void stopProvider() throws Exception
- * {
- * jmsProvider.stop();
- * }
- *
- * @Test
- * public void testSomething()
- * {
- * ...
- * }
- * </pre>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class JmsTestBusProvider implements TestBusProvider
-{
- /**
- * Default provider URL.
- */
- public static final String DEFAULT_PROVIDER_URL = "tcp://localhost:61717";
-
- /**
- * JNDI properties.
- */
- private Properties jndiProperties;
-
- /**
- * Default JNDI Provider URL.
- */
- private String providerUrl = DEFAULT_PROVIDER_URL;
-
- /**
- * Jms broker.
- */
- private BrokerService broker;
-
- /**
- * Public constructor.
- */
- public JmsTestBusProvider()
- {
- jndiProperties = new Properties();
- jndiProperties.setProperty(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
- jndiProperties.setProperty(Context.PROVIDER_URL, DEFAULT_PROVIDER_URL);
- }
-
- /**
- * Public constructor.
- *
- * @param providerUrl Provider URL.
- */
- public JmsTestBusProvider(final String providerUrl)
- {
- this();
- jndiProperties.setProperty(Context.PROVIDER_URL, providerUrl);
- this.providerUrl = providerUrl;
- }
-
- /**
- * Get the JNDI properties in use by this test runner instance.
- *
- * @return The JNDI properties.
- */
- public final Properties getJndiProperties()
- {
- return (Properties) jndiProperties.clone();
- }
-
- /**
- * Start the JMS Broker.
- *
- * @throws Exception Error starting the broker.
- */
- public final void start() throws Exception
- {
- broker = new BrokerService();
-
- // configure the broker
- broker.setDataDirectory(new File("./target/activeMQData"));
- broker.addConnector(providerUrl);
-
- broker.start();
-
- }
-
- /**
- * Stop the JMS Broker.
- *
- * @throws Exception Error stopping the broker.
- */
- public final void stop() throws Exception
- {
- if (broker != null)
- {
- broker.stop();
- }
- }
-
-}
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestRunner.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestRunner.java 2008-12-01 15:43:15 UTC (rev 24185)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/JmsTestRunner.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -1,82 +0,0 @@
-/*
- * 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.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.test;
-
-
-/**
- * Starts a JMS broker and makes sure it gets shutdown.
- * <p/>
- * <br>
- * Usage:
- * <pre>
- * new JMSTestRunner() {
- * public void test() throws Exception {
- * ...
- * }
- * }.run();
- * </pre>
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public abstract class JmsTestRunner extends JmsTestBusProvider
-{
- /**
- * Public constructor.
- */
- public JmsTestRunner()
- {
- super();
- }
-
- /**
- * Public constructor.
- *
- * @param providerUrl Provider URL.
- */
- public JmsTestRunner(final String providerUrl)
- {
- super(providerUrl);
- }
-
- /**
- * Run the test.
- *
- * @throws Exception Error running test.
- */
- public final void run() throws Exception
- {
- start();
- try
- {
- test();
- }
- finally
- {
- stop();
- }
- }
-
- /**
- * Test method.
- *
- * @throws Exception Test exception.
- */
- public abstract void test() throws Exception;
-}
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java 2008-12-01 18:02:51 UTC (rev 24186)
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.test;
+
+import org.jboss.esb.api.context.DeploymentContext;
+import org.jboss.esb.api.context.InvocationContext;
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.service.Service;
+import org.jboss.esb.api.service.ServiceName;
+
+/**
+ * Println Service.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class PrintlnService implements Service
+{
+ /**
+ * The Service name. Injected.
+ */
+ private ServiceName serviceName;
+ /**
+ * Deployment context. Injected.
+ */
+ private DeploymentContext deploymentContext;
+
+ /**
+ * Print the message and the state of the invocation context.
+ *
+ * @param message The message.
+ * @return The message, unmodified.
+ */
+ public final Message process(final Message message)
+ {
+ InvocationContext invocationContext = InvocationContext.getContext();
+
+ System.out.println("-------------------");
+ System.out.println("Message received by Service '" + serviceName + "' on deployment '" + deploymentContext.getDeploymentId() + "'.");
+ System.out.println();
+ System.out.println("Invocation Params: " + invocationContext.getInvocationParameters());
+ System.out.println();
+ System.out.println("Message Payload: " + message.getPayload());
+ System.out.println();
+ System.out.println("Message Attachments: " + message.getAttachments());
+ System.out.println();
+ System.out.println("-------------------");
+
+ return message;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list