[jboss-svn-commits] JBL Code SVN: r26925 - in labs/jbossesb/workspace/tfennelly/httpgateway: product/etc/schemas/xml and 26 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jun 11 06:15:19 EDT 2009
Author: tfennelly
Date: 2009-06-11 06:15:18 -0400 (Thu, 11 Jun 2009)
New Revision: 26925
Added:
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/BusDeploymentFactory.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/web.xml.ftl
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/DeploymentArchive.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/FreeMarkerTemplate.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/util/DeploymentArchiveUnitTest.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/lib/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-jboss-web.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/TestDeploymentArchive.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java
Removed:
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/lib/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/
labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/DeploymentArchive.java
Modified:
labs/jbossesb/workspace/tfennelly/httpgateway/product/build-distr.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/etc/schemas/xml/jbossesb-1.1.0.xsd
labs/jbossesb/workspace/tfennelly/httpgateway/product/install/conf/jbossesb-properties.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/ivy.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/LifecycleUtil.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/MapperUtil.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_esbaware.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_gateways.xml
labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/TestUtils.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/epr/LogicalEPRUnitTest.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/jms/JmsGatewayListenerUnitTest.java
labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/build.xml
Log:
Test merge of http gateway from 4.4.FP branch.
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/build-distr.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/build-distr.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/build-distr.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -135,9 +135,11 @@
<fileset dir="${lib.ext.dir}" includes="commons-ssl-*.jar"/>
<!-- groovy -->
<fileset dir="${lib.dir}" includes="groovy-*.jar"/>
- <!-- Mina -->
- <fileset dir="${lib.dir}" includes="mina-*.jar"/>
- <fileset dir="${lib.dir}" includes="slf4j-*.jar"/>
+ <!-- Mina -->
+ <fileset dir="${lib.dir}" includes="mina-*.jar"/>
+ <fileset dir="${lib.dir}" includes="slf4j-*.jar"/>
+
+ <fileset dir="${lib.dir}" includes="freemarker-*.jar"/>
<fileset dir="${lib.dir}" includes="xmlunit-*.jar"/>
</copy>
<copy todir="${build.dir}/jbossesb.sar">
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/etc/schemas/xml/jbossesb-1.1.0.xsd
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/etc/schemas/xml/jbossesb-1.1.0.xsd 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/etc/schemas/xml/jbossesb-1.1.0.xsd 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1699,14 +1699,20 @@
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="jesb:bus">
- <xsd:attribute name="context" type="xsd:string"
- use="required">
+ <xsd:attribute name="webXml" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation xml:lang="en">
- Http server startup context
+ web.xml file for additional web context settings e.g. authentication etc.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
+ <xsd:attribute name="jbossWebXml" type="xsd:string" use="optional">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ jboss-web.xml file for additional for jboss specific settings.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -1720,26 +1726,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
- <xsd:extension base="jesb:bus-provider">
- <xsd:attribute name="host" type="xsd:string" use="required">
- <xsd:annotation>
- <xsd:documentation xml:lang="en" >
- Http Server based on JbossWeb bind address. When
- not specified, defaults to
- InetAddress.getLocalHost().getHostName().
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
-
- <xsd:attribute name="port" type="xsd:int" use="required">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">
- Http server listening port
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
-
- </xsd:extension>
+ <xsd:extension base="jesb:bus-provider" />
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
@@ -1752,10 +1739,31 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
- <xsd:extension base="jesb:listener" />
+ <xsd:extension base="jesb:listener">
+ <xsd:attribute name="urlPattern" type="xsd:string" use="required">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ The URL Pattern of requests to be filtered to this listener.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="payloadAs" type="jesb:payloadAs" use="optional">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Set the ESB Message payload ass either a String or an array of bytes.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
+ <xsd:simpleType name="payloadAs">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="STRING"/>
+ <xsd:enumeration value="BYTES"/>
+ </xsd:restriction>
+ </xsd:simpleType>
<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Groovy Gateway Type Implementations.
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/install/conf/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/install/conf/jbossesb-properties.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/install/conf/jbossesb-properties.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -35,6 +35,7 @@
<property name="org.jboss.soa.esb.jndi.server.url" value="${jboss.esb.bind.address}:1099"/>
<property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
<property name="org.jboss.soa.esb.loadbalancer.policy" value="org.jboss.soa.esb.listeners.ha.RoundRobin"/>
+ <property name="org.jboss.soa.esb.mime.text.types" value="text/*;application/xml;application/*-xml"/>
<property name="jboss.esb.invm.scope.default" value="NONE"/>
</properties>
<properties name="security">
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/ivy.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/ivy.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/ivy.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -81,5 +81,7 @@
<!-- xmlunit -->
<dependency org="xmlunit" name="xmlunit" rev="1.2"/>
+
+ <dependency org="org.freemarker" name="freemarker" rev="2.3.9"/>
</dependencies>
</ivy-module>
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/LifecycleUtil.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/LifecycleUtil.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/LifecycleUtil.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -29,6 +29,7 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.listeners.config.BusDeploymentFactory;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
import org.jboss.soa.esb.util.ClassUtil;
@@ -131,9 +132,16 @@
{
throw new ManagedLifecycleException("Could not locate managed instance " + classname) ;
}
-
+
if (!ManagedLifecycle.class.isAssignableFrom(instanceClass))
{
+ if (BusDeploymentFactory.class.isAssignableFrom(instanceClass)) {
+ // These guys are deployed as sub deployments by the main
+ // deployer, so we skip them here if they don't implement
+ // ManagedLifecycle...
+ continue;
+ }
+
throw new ManagedLifecycleException("Managed instance " + classname + " does not implement ManagedLifecycle") ;
}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -63,6 +63,9 @@
public static final String TRANSACTED_TAG = "transacted";
public static final String ROLLBACK_ON_PIPELINE_FAULTS = "rollbackOnPipelineFaults";
+ /** Gateways and Listeners */
+ public static final String BUSIDREF_ATTRIBUTE_TAG = "busIdRef";
+
/** Deployment */
public static final String DEPLOYMENT_NAME_TAG = "deployment";
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/BusDeploymentFactory.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/BusDeploymentFactory.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/BusDeploymentFactory.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/BusDeploymentFactory.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,52 @@
+/*
+ * 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.soa.esb.listeners.config;
+
+import org.jboss.soa.esb.util.DeploymentArchive;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+
+import java.util.List;
+
+/**
+ * Bus Deployment Factory.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface BusDeploymentFactory {
+
+ /**
+ * Set the name of the bus configuration associated with the deployment.
+ * @param busName The bus name.
+ */
+ public void setBusName(String busName);
+
+ /**
+ * Set the listener configurations associated with the Gateway.
+ * @param listeners The listener configurations.
+ */
+ public void setListeners(List<ConfigTree> listeners);
+
+ /**
+ * Get the deployment archives to be deployed.
+ * @return The deployment archives.
+ * @throws ConfigurationException Failed to create the Deployment Archives.
+ */
+ public List<DeploymentArchive> getDeploymentArchives() throws ConfigurationException;
+}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -72,6 +72,15 @@
}
}
+ public static String getMep(ConfigTree listenerConfig) {
+ String mep = listenerConfig.getAttribute(ListenerTagNames.MEP_ATTRIBUTE_TAG);
+ if(mep != null) {
+ return mep;
+ } else {
+ return ListenerTagNames.MEP_REQUEST_RESPONSE;
+ }
+ }
+
public static ManagedLifecycleController create(String configXml) {
return create (configXml, null);
}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -21,37 +21,6 @@
*/
package org.jboss.soa.esb.listeners.config;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.SubDeployer;
@@ -59,30 +28,44 @@
import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
import org.jboss.internal.soa.esb.util.StreamUtils;
import org.jboss.internal.soa.esb.util.XMLHelper;
-import org.jboss.internal.soa.esb.webservice.AddressingHandler;
-import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
-import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
-import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
-import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
+import org.jboss.internal.soa.esb.webservice.*;
import org.jboss.logging.Logger;
import org.jboss.metadata.MetaData;
import org.jboss.metadata.XmlFileLoader;
import org.jboss.mx.loading.LoaderRepositoryFactory;
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.ObjectNameConverter;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
import org.jboss.soa.esb.listeners.config.model.ModelParser;
import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.util.DeploymentArchive;
import org.jboss.soa.esb.util.FileUtil;
import org.jboss.system.ServiceControllerMBean;
import org.jboss.system.server.ServerConfig;
import org.jboss.system.server.ServerConfigLocator;
import org.jboss.web.AbstractWebContainer;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import javax.management.JMException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.io.*;
+import java.net.URL;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
/**
* comment
*
@@ -96,11 +79,12 @@
private ServiceControllerMBean serviceController;
private Properties actionArtifactProperties;
- private final File esbWarFiles ;
+ private final File esbWarFiles;
private final Set<String> esbNames = new HashSet<String>() ;
private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
private static final String ESB_ARTIFACT_NAME = "jbossesb.esb" ;
+ private static final String SUB_DEPLOYMENTS = JBoss4ESBDeployer.class.getName() + "#SUB_DEPLOYMENTS";
private final String HANDLER_CHAIN_PREFIX = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<handler-chains xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
@@ -116,8 +100,10 @@
private final String WSADDR_CONTEXT_NAME = "WSAddressing Context Handler" ;
private final String WSADDR_CONTEXT_HANDLER = AddressingHandler.class.getName() ;
-
- /**
+ private File serverTempDeployDir;
+ private File esbGateways;
+
+ /**
* Default CTOR used to set default values to the Suffixes and RelativeOrder
* attributes. Those are read at subdeployer registration time by the MainDeployer
* to alter its SuffixOrder.
@@ -127,8 +113,11 @@
setSuffixes(new String[]{".esb"});
setRelativeOrder(1000); // before old EJB 2.1 deployer
final ServerConfig config = ServerConfigLocator.locate();
- esbWarFiles = new File(config.getServerTempDeployDir(), "esbwarfiles") ;
+ serverTempDeployDir = config.getServerTempDeployDir();
+ esbWarFiles = new File(serverTempDeployDir, "esbwarfiles") ;
esbWarFiles.mkdirs() ;
+ esbGateways = new File(serverTempDeployDir, "esbgateways") ;
+ esbGateways.mkdirs();
}
public static boolean hasFile(DeploymentInfo di, String filePath)
@@ -294,7 +283,10 @@
JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(jbossEsbXml, di.shortName);
initialiseDeploymentName(deployment) ;
final String deploymentName = deployment.getDeploymentName() ;
- di.context.put(JBoss4ESBDeploymentMetaData.class, new JBoss4ESBDeploymentMetaData(deployment, deploymentName, deps)) ;
+
+ di.context.put(JBoss4ESBDeploymentMetaData.class, new JBoss4ESBDeploymentMetaData(deployment, deploymentName, deps)) ;
+ di.context.put(SUB_DEPLOYMENTS, new ArrayList<File>()) ;
+
// invoke super-class initialization
super.init(di);
// create webservice WAR
@@ -316,6 +308,9 @@
final URL warFileURL = warFile.toURL() ;
deployUrl(di, warFileURL, warFile.getName()) ;
}
+
+ // Deploy all "deployable" gateways...
+ deployDeployableGateways(model, di);
}
catch (Exception e)
{
@@ -498,10 +493,10 @@
{
final Service service = webserviceInfo.getService() ;
- // Copy all schemas to the wsdl directory to support imports.
+ // Copy all schemas to the wsdl directory to support imports.
final File esbArchive = new File(di.watch.getFile());
final Map<String, String> schemasMap = JBoss4ESBDeployer.getSchemas(esbArchive);
- final String wsdlDir = "WEB-INF/wsdl/" + service.getCategory().replace('/', '_') + "/";
+ final String wsdlDir = "WEB-INF/wsdl/" + service.getCategory().replace('/', '_') + "/";
for (Entry<String, String> schemaEntry : schemasMap.entrySet())
{
try
@@ -514,7 +509,7 @@
log.debug(e.getMessage(), e);
}
}
-
+
final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(webserviceInfo) ;
final String wsdl = ESBContractGenerator.generateWSDL(webserviceInfo, serviceInfo) ;
addFile(zos, serviceInfo.getWSDLFileName(), wsdl) ;
@@ -588,6 +583,11 @@
final FileOutputStream fos = new FileOutputStream(warFile) ;
fos.write(baos.toByteArray()) ;
fos.close() ;
+
+ // Maintain a list of sub deployments so we can clean them
+ // up on undeploy...
+ getSubDeployments(di).add(warFile);
+
return warFile ;
}
catch (final Exception ex)
@@ -599,13 +599,112 @@
return null ;
}
- private void addFile(final ZipOutputStream zos, final String filename, final String contents)
+ private void deployDeployableGateways(ModelAdapter model, DeploymentInfo di) throws ConfigurationException, DeploymentException, JMException {
+
+ // Gather the listener groups associated with each of the buses...
+ Map<String, List<ConfigTree>> listenerGroups = getListenerGroups(model);
+
+ // For each bus, gather the deployment archives to be deployed (can be one or more)...
+ List<DeploymentArchive> deploymentArchives = new ArrayList<DeploymentArchive>();
+ Set<Map.Entry<String, List<ConfigTree>>> listenerGroupEntries = listenerGroups.entrySet();
+
+ for(Map.Entry<String, List<ConfigTree>> listenerGroup : listenerGroupEntries) {
+ String busIdRef = listenerGroup.getKey();
+ List<ConfigTree> listeners = listenerGroup.getValue();
+
+ String gatewayClassName = listeners.get(0).getAttribute(ListenerTagNames.GATEWAY_CLASS_TAG);
+
+ Class gatewayClass;
+ ClassLoader originalTCCL = Thread.currentThread().getContextClassLoader();
+
+ Thread.currentThread().setContextClassLoader(di.localCl) ;
+ try {
+ try {
+ gatewayClass = ClassUtil.forName(gatewayClassName, getClass());
+ } catch (ClassNotFoundException e) {
+ throw new ConfigurationException("Gateway Class '" + gatewayClassName + "' not found on classpath.");
+ }
+
+ if(BusDeploymentFactory.class.isAssignableFrom(gatewayClass)) {
+ try {
+ BusDeploymentFactory deploymentFactory = (BusDeploymentFactory) gatewayClass.newInstance();
+
+ deploymentFactory.setBusName(busIdRef);
+ deploymentFactory.setListeners(listeners);
+
+ deploymentArchives.addAll(deploymentFactory.getDeploymentArchives());
+ } catch (InstantiationException e) {
+ throw new ConfigurationException("Unable to create instance of BusDeploymentFactory '" + gatewayClassName + "'.", e);
+ } catch (IllegalAccessException e) {
+ throw new ConfigurationException("Unable to create instance of BusDeploymentFactory '" + gatewayClassName + "'.", e);
+ }
+ }
+ } finally {
+ Thread.currentThread().setContextClassLoader(originalTCCL) ;
+ }
+ }
+
+ // Now run the deploys...
+ for(DeploymentArchive deployment : deploymentArchives) {
+ File file = createGatewayTempDeployment(deployment, di);
+ try {
+ deployUrl(di, file.toURL(), deployment.getArchiveName());
+
+ // Maintain a list of sub deployments so we can clean them
+ // up on undeploy...
+ getSubDeployments(di).add(file);
+ } catch (Throwable throwable ) {
+ if(file.exists()) {
+ file.delete();
+ }
+ throw new ConfigurationException("Error deploying '" + file.getAbsolutePath() + "'.", throwable);
+ }
+ }
+ }
+
+ /**
+ * Get the lister groups (by busIdRef) in this configuration model.
+ * <p/>
+ * Only looks at gateways at the moment.
+ *
+ * @param model The configuration model.
+ * @return A {@link Map} containing Lists of listener configurations, by busIdRef.
+ * @throws ConfigurationException Unable to convert the model to a DOM.
+ */
+ private Map<String, List<ConfigTree>> getListenerGroups(ModelAdapter model) throws ConfigurationException {
+ Map<String, List<ConfigTree>> listenerGroups = new LinkedHashMap<String, List<ConfigTree>>();
+ Document gatewayConfig = model.generateGatewayConfig();
+ NodeList nodeList = gatewayConfig.getDocumentElement().getChildNodes();
+ int count = nodeList.getLength();
+
+ for(int i = 0; i < count; i++) {
+ Node child = nodeList.item(i);
+
+ if(child.getNodeType() == Node.ELEMENT_NODE) {
+ Element listenerElement = (Element) child;
+ String busIdRef = listenerElement.getAttribute(ListenerTagNames.BUSIDREF_ATTRIBUTE_TAG);
+ String listenerName = listenerElement.getAttribute("name");
+
+ List<ConfigTree> listenerGroup = listenerGroups.get(busIdRef);
+
+ if(listenerGroup == null) {
+ listenerGroup = new ArrayList<ConfigTree>();
+ listenerGroups.put(busIdRef, listenerGroup);
+ }
+ listenerGroup.add(ConfigTree.fromElement(listenerElement));
+ }
+ }
+
+ return listenerGroups;
+ }
+
+ private void addFile(final ZipOutputStream zos, final String filename, final String contents)
throws IOException
{
addFile(zos, filename, contents.getBytes()) ;
}
-
- private void addFile(final ZipOutputStream zos, final String filename, final byte[] contents)
+
+ private void addFile(final ZipOutputStream zos, final String filename, final byte[] contents)
throws IOException
{
final ZipEntry entry = new ZipEntry(filename) ;
@@ -614,7 +713,7 @@
zos.closeEntry() ;
}
- public synchronized void start(DeploymentInfo di)
+ public synchronized void start(DeploymentInfo di)
throws DeploymentException
{
try
@@ -638,7 +737,7 @@
super.start(di);
}
- public void stop(DeploymentInfo di)
+ public void stop(DeploymentInfo di)
throws DeploymentException
{
if (di.deployedObject != null)
@@ -656,19 +755,25 @@
super.stop(di);
}
- public void destroy(DeploymentInfo di)
- throws DeploymentException
+ public void destroy(DeploymentInfo di) throws DeploymentException
{
final JBoss4ESBDeploymentMetaData metaData = (JBoss4ESBDeploymentMetaData)di.context.get(JBoss4ESBDeploymentMetaData.class) ;
+
+ for(File subDeployment : getSubDeployments(di)) {
+ try {
+ if(subDeployment.exists()) {
+ if(!subDeployment.delete()) {
+ log.debug("Failed to delete sub deployment '" + subDeployment.getAbsolutePath() + "'.");
+ }
+ }
+ } catch (Exception e) {
+ log.debug("Failed to delete deployment file '" + subDeployment.getAbsolutePath() + "'. Exception: " + e.getMessage());
+ }
+ }
+
if (metaData != null)
- {
+ {
final String deploymentName = metaData.getDeploymentName() ;
- final File warFile = getESBWarFile(deploymentName, di.shortName, false) ;
- if (warFile != null)
- {
- warFile.delete();
- warFile.getParentFile().delete() ;
- }
removeDeploymentName(deploymentName) ;
}
if (di.deployedObject != null)
@@ -686,7 +791,52 @@
}
super.destroy(di);
}
-
+
+ private File createGatewayTempDeployment(DeploymentArchive deploymentArchive, DeploymentInfo di) throws ConfigurationException {
+ File gatewayDeployFile = createTempDeploymentFile(esbGateways, di.shortName, deploymentArchive.getArchiveName(), true);
+ FileOutputStream fileOutStream;
+
+ try {
+ fileOutStream = new FileOutputStream(gatewayDeployFile);
+ } catch (FileNotFoundException e) {
+ throw new ConfigurationException("Unexpected exception.", e);
+ }
+
+ try {
+ deploymentArchive.toOutputStream(fileOutStream);
+ } catch (IOException e) {
+ throw new ConfigurationException("Error writing deployment archive '" + gatewayDeployFile.getAbsolutePath() + "'.", e);
+ } finally {
+ try {
+ fileOutStream.close();
+ } catch (IOException e) {
+ log.warn("Error closing deployment archive stream '" + gatewayDeployFile.getAbsolutePath() + "'", e);
+ }
+ }
+
+ return gatewayDeployFile;
+ }
+
+ private File createTempDeploymentFile(final File tempDir, final String deploymentName, final String archiveName, final boolean createDir) throws ConfigurationException {
+ final File deploymentDir = new File(tempDir, deploymentName) ;
+
+ if (!deploymentDir.exists())
+ {
+ if (!createDir)
+ {
+ return null ;
+ }
+ deploymentDir.mkdir() ;
+ }
+
+ File file = new File(deploymentDir, archiveName);
+ if(file.exists()) {
+ log.debug("Deployment archive '" + archiveName + "' already exists. Overwriting!!");
+ }
+
+ return file;
+ }
+
private File getESBWarFile(final String deploymentName, final String esbName, final boolean createDir)
{
final File esbDir = new File(esbWarFiles, deploymentName) ;
@@ -698,13 +848,13 @@
}
esbDir.mkdir() ;
}
-
+
final int lastSeparator = esbName.lastIndexOf('.') ;
final String warFileName = ((lastSeparator >= 0) ? esbName.substring(0, lastSeparator) : esbName) + ".war" ;
-
+
return new File(esbDir, warFileName) ;
}
-
+
private synchronized void initialiseDeploymentName(final JBoss4ESBDeployment deployment)
{
final String deploymentName = deployment.getDeploymentName() ;
@@ -718,6 +868,10 @@
{
esbNames.remove(deploymentName) ;
}
+
+ private List<File> getSubDeployments(DeploymentInfo di) {
+ return (List<File>) di.context.get(SUB_DEPLOYMENTS);
+ }
private String getHandlers(final ESBServiceEndpointInfo serviceInfo)
{
@@ -794,7 +948,7 @@
private static boolean isXsd(final String fileName)
{
- return fileName.endsWith(".xsd");
+ return fileName.endsWith(".xsd");
}
static Map<String, String> getSchemasFromArchive(final File archive) throws DeploymentException
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -29,9 +29,7 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.xbeanmodel101.Bus;
-import org.jboss.soa.esb.listeners.config.xbeanmodel101.Listener;
-import org.jboss.soa.esb.listeners.config.xbeanmodel101.Provider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel101.*;
import org.jboss.soa.esb.listeners.config.xbeanmodel101.PropertyDocument.Property;
import org.jboss.soa.esb.listeners.config.xbeanmodel101.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.message.MessageAwareListener;
@@ -61,6 +59,21 @@
if (!isGateway && !listenerNode.hasAttribute(ListenerTagNames.LISTENER_CLASS_TAG)) {
listenerNode.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, MessageAwareListener.class.getName());
}
+
+ ActionsDocument.Actions actions = service.getActions();
+ if(actions != null) {
+ MepType.Enum mep = actions.getMep();
+ if(mep != null) {
+ // Intentionally not setting a default of RequestResponse because the action pipeline
+ // has a "defaultProcessing" state that exists if the mep is not set (dubious??)....
+ listenerNode.setAttribute(ListenerTagNames.MEP_ATTRIBUTE_TAG, mep.toString());
+ }
+ }
+
+ String busIdRef = listener.getBusidref();
+ if(busIdRef != null) {
+ listenerNode.setAttribute(ListenerTagNames.BUSIDREF_ATTRIBUTE_TAG, busIdRef);
+ }
}
/**
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -8,7 +8,8 @@
import org.jboss.soa.esb.listeners.config.xbeanmodel110.HttpBusDocument.HttpBus;
import org.jboss.soa.esb.listeners.config.xbeanmodel110.HttpListenerDocument.HttpListener;
import org.jboss.soa.esb.listeners.config.xbeanmodel110.HttpProviderDocument.HttpProvider;
-import org.jboss.soa.esb.listeners.gateway.HttpGatewayListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel110.PayloadAs;
+import org.jboss.soa.esb.listeners.gateway.HttpGatewayDeploymentFactory;
import org.w3c.dom.Element;
/**
@@ -53,24 +54,28 @@
listenerNode.appendChild(propertyElement);
}
-
-
-
MapperUtil.mapProperties(bus.getPropertyList(), listenerNode);
MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);
if(listener.getIsGateway()) {
- String host = provider.getHost();
- int port = provider.getPort();
-
- listenerNode.setAttribute("gatewayClass", HttpGatewayListener.class.getName());
- listenerNode.setAttribute(ListenerTagNames.IS_GATEWAY_TAG, Boolean.toString(listener.getIsGateway()));
+ String webXml = bus.getWebXml();
+ String jbossWebXml = bus.getJbossWebXml();
+ String urlPattern = listener.getUrlPattern();
+ PayloadAs.Enum payloadAs = listener.getPayloadAs();
- if(host != null) {
- listenerNode.setAttribute(HttpGatewayListener.SERVER_HOST_TAG, host);
+ listenerNode.setAttribute("gatewayClass", HttpGatewayDeploymentFactory.class.getName());
+ listenerNode.setAttribute(ListenerTagNames.IS_GATEWAY_TAG, "true");
+
+ if(webXml != null) {
+ listenerNode.setAttribute("webXml", webXml);
}
- listenerNode.setAttribute(HttpGatewayListener.REQUEST_CONTEXT_TAG, bus.getContext());
- listenerNode.setAttribute(HttpGatewayListener.SERVER_PORT_TAG, Integer.toString(port));
+ if(jbossWebXml != null) {
+ listenerNode.setAttribute("jbossWebXml", jbossWebXml);
+ }
+ listenerNode.setAttribute("urlPattern", urlPattern);
+ if(payloadAs != null) {
+ listenerNode.setAttribute("payloadAs", payloadAs.toString());
+ }
} else {
throw new ConfigurationException("Invalid <http-listener> config [" + listener.getName() +"]. <http-listener> is currently only supported as a gateway listener.");
}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/MapperUtil.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/MapperUtil.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/MapperUtil.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -29,9 +29,7 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.xbeanmodel110.Bus;
-import org.jboss.soa.esb.listeners.config.xbeanmodel110.Listener;
-import org.jboss.soa.esb.listeners.config.xbeanmodel110.Provider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel110.*;
import org.jboss.soa.esb.listeners.config.xbeanmodel110.PropertyDocument.Property;
import org.jboss.soa.esb.listeners.config.xbeanmodel110.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.message.MessageAwareListener;
@@ -61,6 +59,21 @@
if (!isGateway && !listenerNode.hasAttribute(ListenerTagNames.LISTENER_CLASS_TAG)) {
listenerNode.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, MessageAwareListener.class.getName());
}
+
+ ActionsDocument.Actions actions = service.getActions();
+ if(actions != null) {
+ MepType.Enum mep = actions.getMep();
+ if(mep != null) {
+ // Intentionally not setting a default of RequestResponse because the action pipeline
+ // has a "defaultProcessing" state that exists if the mep is not set (dubious??)....
+ listenerNode.setAttribute(ListenerTagNames.MEP_ATTRIBUTE_TAG, mep.toString());
+ }
+ }
+
+ String busIdRef = listener.getBusidref();
+ if(busIdRef != null) {
+ listenerNode.setAttribute(ListenerTagNames.BUSIDREF_ATTRIBUTE_TAG, busIdRef);
+ }
}
/**
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,237 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.gateway;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.couriers.FaultMessageException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter;
-import org.jboss.soa.esb.message.Message;
-
-/**
- * This class is for dispatching the http request to ESB action process pipe
- * line.By default, this servlet will be used to set to default servlet mapping
- * in the created StandardContext.
- * This class will also return the esb error message and error stack trace to client
- *
- * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
- */
-public class HttpDispatchServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
-
- private static final String METHOD_DELETE = "DELETE";
- private static final String METHOD_HEAD = "HEAD";
- private static final String METHOD_GET = "GET";
- private static final String METHOD_OPTIONS = "OPTIONS";
- private static final String METHOD_POST = "POST";
- private static final String METHOD_PUT = "PUT";
- private static final String METHOD_TRACE = "TRACE";
-
- /** If this a synchronous invocation * */
- private boolean synchronous = true;
-
- /** asyncResponse file location */
- private String asyncResponse = null;
-
- private int serviceTimeout = 20000;
-
- /** Default allow http method list */
- private String allowHttpMethods = "POST,GET";
-
- /** ESB message delivery adapter */
- public UncomposedMessageDeliveryAdapter messageDeliveryAdapter = null;
-
- /**
- * Initilize method
- *
- * @throws ServletException
- * If error occured
- */
- public void init() throws ServletException {
- ConfigTree config = (ConfigTree) getServletContext().getAttribute(
- "config");
- synchronous = !config.getAttribute("synchronous", "true").equalsIgnoreCase("false");
-
- serviceTimeout = Integer.parseInt(config.getAttribute("serviceTimeout", "20000"));
-
- asyncResponse = config.getAttribute("asyncResponse");
-
- try {
- messageDeliveryAdapter = UncomposedMessageDeliveryAdapter
- .getGatewayDeliveryAdapter(config,
- new HttpMessageComposer<HttpRequestWrapper>());
- } catch (ConfigurationException e) {
- throw new ServletException(e);
- }
-
- if (config.getAttribute(HttpGatewayListener.ALLOW_HTTP_METHOD) != null) {
- allowHttpMethods = config.getAttribute(HttpGatewayListener.ALLOW_HTTP_METHOD).toUpperCase();
- }
-
- }
-
- /**
- * Service method to process the inboud servlet request and reply the http
- * servlet response
- *
- * @param request
- * HttpServlet request
- * @param response
- * HttpServlet response
- * @param content
- * @throws ServletException
- * For error occured during process
- */
- protected void serveRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- String servletPath = request.getServletPath();
-
- //block the invalid request
- if (!"/".equals(servletPath)) {
- response.setStatus(404);
- return;
- }
-
- HttpRequestWrapper wrapper = new HttpRequestWrapper(request, response);
-
- try {
- if (synchronous) {
- messageDeliveryAdapter.deliverSync(wrapper, serviceTimeout);
- } else {
- messageDeliveryAdapter.deliverAsync(wrapper);
- if (asyncResponse != null) {
- response.getOutputStream().write(StreamUtils.readStream(getClass().getResourceAsStream(asyncResponse)));
- }
- }
- } catch (FaultMessageException fme) {
- Message faultMessage = fme.getReturnedMessage();
- if (faultMessage != null) {
- Object obj = faultMessage.getProperties().getProperty(HttpMessageComposer.HTTP_RESPONSE_STATUS);
- if (obj != null && obj instanceof Integer) {
- response.setStatus((Integer)obj);
- } else {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
-
- fme.printStackTrace(response.getWriter());
- }
-
- } catch (Exception ex) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- ex.printStackTrace(response.getWriter());
- }
-
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- if (isSupportMethod(METHOD_GET)) {
- serveRequest(request, response);
- } else {
- super.doGet(request, response);
- }
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- if (isSupportMethod(METHOD_POST)) {
- serveRequest(request, response);
- } else {
- super.doPost(request, response);
- }
- }
-
- @Override
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- if (isSupportMethod(METHOD_PUT)) {
- serveRequest(request, response);
- } else {
- super.doPut(request, response);
- }
- }
- @Override
- protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- if (isSupportMethod(METHOD_DELETE)) {
- serveRequest(request, response);
- } else {
- super.doDelete(request, response);
- }
- }
-
- protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-
- boolean ALLOW_GET = isSupportMethod(METHOD_GET);
- boolean ALLOW_HEAD = ALLOW_GET;
- boolean ALLOW_POST = isSupportMethod(METHOD_POST);
- boolean ALLOW_PUT = isSupportMethod(METHOD_PUT);
- boolean ALLOW_DELETE = isSupportMethod(METHOD_DELETE);
- boolean ALLOW_TRACE = true;
- boolean ALLOW_OPTIONS = true;
-
- String allow = null;
- if (ALLOW_GET)
- if (allow == null) allow = METHOD_GET;
- if (ALLOW_HEAD)
- if (allow == null) allow = METHOD_HEAD;
- else
- allow += ", " + METHOD_HEAD;
- if (ALLOW_POST)
- if (allow == null) allow = METHOD_POST;
- else
- allow += ", " + METHOD_POST;
- if (ALLOW_PUT)
- if (allow == null) allow = METHOD_PUT;
- else
- allow += ", " + METHOD_PUT;
- if (ALLOW_DELETE)
- if (allow == null) allow = METHOD_DELETE;
- else
- allow += ", " + METHOD_DELETE;
- if (ALLOW_TRACE)
- if (allow == null) allow = METHOD_TRACE;
- else
- allow += ", " + METHOD_TRACE;
- if (ALLOW_OPTIONS)
- if (allow == null) allow = METHOD_OPTIONS;
- else
- allow += ", " + METHOD_OPTIONS;
-
- resp.setHeader("Allow", allow);
- }
-
-
- /**
- * Check if support this http method
- * @param http method name
- * @return true if supported or false if not supported
- */
- private boolean isSupportMethod(String name) {
- return allowHttpMethods.indexOf(name) >= 0;
- }
-}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,210 @@
+/*
+ * 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.soa.esb.listeners.gateway;
+
+import org.jboss.soa.esb.listeners.config.BusDeploymentFactory;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.util.DeploymentArchive;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.util.FreeMarkerTemplate;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.apache.log4j.Logger;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.TemplateException;
+
+/**
+ * Http Gateway deployment factory.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class HttpGatewayDeploymentFactory implements BusDeploymentFactory {
+
+ private static Logger logger = Logger.getLogger(HttpGatewayDeploymentFactory.class);
+
+ private String busName;
+ private List<ConfigTree> listeners;
+
+ public void setBusName(String busName) {
+ AssertArgument.isNotNullAndNotEmpty(busName, "busName");
+ this.busName = busName;
+ }
+
+ public void setListeners(List<ConfigTree> listeners) {
+ AssertArgument.isNotNullAndNotEmpty(listeners, "listeners");
+ this.listeners = listeners;
+ }
+
+ public List<DeploymentArchive> getDeploymentArchives() throws ConfigurationException {
+ List<ListenerConfig> listenerConfigModels = new ArrayList<ListenerConfig>();
+ Set listenerNameSet = new HashSet<String>();
+
+ for(ConfigTree listener : listeners) {
+ ListenerConfig config = new ListenerConfig();
+
+ config.setName(listener.getRequiredAttribute("name"));
+ if(!listenerNameSet.contains(config.name)) {
+ config.setUrlPattern(listener.getAttribute("urlPattern", "/"));
+ config.setAttributes(listener.attributesAsList());
+ listenerConfigModels.add(config);
+
+ listenerNameSet.add(config.name);
+ } else {
+ throw new ConfigurationException("Duplicate listener/Gateway name '" + config.name + "'. Listener/Gateway names must be unique.");
+ }
+ }
+
+ // Build the base web.xml from the list of listeners "listening" on this bus...
+ String baseWebXML = constructBaseWebXML(listenerConfigModels);
+
+ // If the user defined an extension web.xml. We need to merge it with the generated (base)
+ // web.xml...
+ String userWebXML = getFile("webXml");
+ if(userWebXML != null) {
+ try {
+ baseWebXML = merge(baseWebXML, userWebXML);
+ } catch (SAXException e) {
+ throw new RuntimeException("Error parsing user defined web.xml.", e);
+ }
+ }
+
+ // Now lets build the web archive...
+ DeploymentArchive war = new DeploymentArchive(busName + ".war");
+ try {
+ war.addEntry("WEB-INF/web.xml", new ByteArrayInputStream(baseWebXML.getBytes("UTF-8")));
+
+ String jbossWebXml = getFile("jbossWebXml");
+ if(jbossWebXml != null) {
+ war.addEntry("WEB-INF/jboss-web.xml", new ByteArrayInputStream(jbossWebXml.getBytes("UTF-8")));
+ }
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("Unexpected character encoding exception.", e);
+ }
+
+ List<DeploymentArchive> list = new ArrayList<DeploymentArchive>();
+ list.add(war);
+
+ return list;
+ }
+
+ private String constructBaseWebXML(List<ListenerConfig> listenerConfigModels) throws ConfigurationException {
+ FreeMarkerTemplate template = new FreeMarkerTemplate("web.xml.ftl", HttpGatewayDeploymentFactory.class);
+ Map contextObj = new HashMap();
+
+ contextObj.put("listeners", listenerConfigModels);
+
+ try {
+ return template.apply(contextObj);
+ } catch (TemplateException e) {
+ throw new ConfigurationException("Error constructing web.xml file from listener configuration.", e);
+ }
+ }
+
+ private String getFile(String specifierAttribute) throws ConfigurationException {
+ String fileName = listeners.get(0).getAttribute(specifierAttribute);
+
+ if(fileName != null) {
+ InputStream inputStream = ClassUtil.getResourceAsStream(fileName, HttpGatewayDeploymentFactory.class);
+ if(inputStream != null) {
+ try {
+ return StreamUtils.readStreamString(inputStream, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("Unexpected exception.", e);
+ } finally {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ logger.debug("Failed to close stream to resource '" + fileName + "'.", e);
+ }
+ }
+ } else {
+ throw new ConfigurationException("Failed to locate '" + specifierAttribute + "' file '" + fileName + "'.");
+ }
+ }
+
+ return null;
+ }
+
+ private String merge(String baseWebXML, String userWebXML) throws SAXException {
+ try {
+ Document baseWebXmlDoc = YADOMUtil.parse(baseWebXML);
+ Document userWebXmlDoc = YADOMUtil.parse(userWebXML);
+ NodeList nodes = userWebXmlDoc.getDocumentElement().getChildNodes();
+ int childCount = nodes.getLength();
+
+ // Import the child nodes...
+ for(int i = 0; i < childCount; i++) {
+ Node child = nodes.item(i);
+ baseWebXmlDoc.getDocumentElement().appendChild(baseWebXmlDoc.importNode(child, true));
+ }
+
+ StringWriter result = new StringWriter();
+ try {
+ YADOMUtil.serialize(baseWebXmlDoc, new StreamResult(result));
+ } catch (ConfigurationException e) {
+ throw new RuntimeException("Unexpected exception.", e);
+ }
+
+ return result.toString();
+ } catch (IOException e) {
+ throw new IllegalStateException("Unexpected exception.", e);
+ }
+ }
+
+ public static class ListenerConfig {
+ private String name;
+ private String urlPattern;
+ private List<KeyValuePair> attributes;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUrlPattern() {
+ return urlPattern;
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ this.urlPattern = urlPattern;
+ }
+
+ public List<KeyValuePair> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(List<KeyValuePair> attributes) {
+ this.attributes = attributes;
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,489 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.gateway;
-
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.LinkRef;
-import javax.naming.NamingException;
-
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.core.StandardContext;
-import org.apache.catalina.core.StandardWrapper;
-import org.apache.catalina.deploy.LoginConfig;
-import org.apache.catalina.deploy.SecurityCollection;
-import org.apache.catalina.deploy.SecurityConstraint;
-import org.apache.catalina.loader.WebappLoader;
-import org.apache.catalina.startup.ContextConfig;
-import org.apache.log4j.Logger;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.naming.Util;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryFactory;
-import org.jboss.soa.esb.util.ClassUtil;
-
-/**
- * Tomcat Listener provids the functionality to pass the http request
- * to ESB service .
- * <p> This class will generate {@link org.apache.catalina.connector.Connector},
- * {@link org.apache.catalina.core.StandardHost} and {@link org.apache.catalina.core.StandardContext}
- * for user defined http port, host and context. These generated tomcat components will be
- * attached to jboss embeded tomcat(aka jboss web). You can monitor and control these new generated
- * components through jboss JMX console. When this listener is stoped, these components will be
- * destoried automatically.
- *
- * <p>The different tomcat listner can be started in same port with different context.for example:
- * <code> http://localhost:8765/jbossesb/servicecategory/servicename </code>
- *
- * <p>This class uses the {@link org.jboss.soa.esb.listeners.gateway.HttpMessageComposer}
- * by default.
- * @see org.jboss.soa.esb.listeners.gateway.HttpMessageComposer
- * @see Torg.jboss.soa.esb.listeners.gateway.HttpDispatchServlet
- * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
- */
-public class HttpGatewayListener extends AbstractManagedLifecycle {
-
- private static final long serialVersionUID = 1L;
-
-
- private static Logger logger = Logger.getLogger(HttpGatewayListener.class);
-
-
- /**The tag used to read the host value from configuration */
- public static String SERVER_HOST_TAG = "http_host";
-
- /**The tag used to read the port value from configuration */
- public static String SERVER_PORT_TAG = "http_port";
-
- /**The tag used to read the context value from configuration */
- public static String REQUEST_CONTEXT_TAG = "http_context";
-
- /**The tag used to read the dispatch servlet class name value from configuration */
- public static String DISPATCH_SERVLET_CLASS = "dispatch_servlet";
-
- /**Allow http method config attribute name*/
- public static final String ALLOW_HTTP_METHOD = "allowHttpMethod";
-
- /**Auth method config attribute name */
- public static final String AUTH_METHOD = "authMethod";
-
- /**Security domain config attribute name */
- public static final String SECURITY_DOMAIN = "securityDomain";
-
- /**Security role config attribute name */
- public static final String SECURITY_ROLE = "securityRole";
-
- /**Http host value*/
- public String host = null;
-
- /**Http address value*/
- public String address = null;
-
- /**Http port value*/
- public String port = null;
-
- /** Default max threads */
-
- public String maxThreads = "5";
-
- /**listener contenxt */
- public String httpContext = null;
-
- /** Endpoint reference that presents this listener */
- private EPR endpointReference = null;
-
- /**Service category*/
- private String serviceCategory = null;
-
- /**Service name*/
- private String serviceName = null;
-
- /**The new created tomcat standard context, it reprents a web app*/
- private StandardContext ctx = null;
-
- /** The default servlet used to dispatch the http request to ESB service*/
- private String dispatchServletClassName = HttpDispatchServlet.class.getName();
-
- /** Protocol value */
- private Object protocol = "http";
-
- /** Imply if the port number is the jboss.web used, if yes , the new created context will be attched to jboss web Servlet engine */
- private boolean useJBossWebServletEngine = false;
-
- /**Constuct the TomcatGatewyListner
- * @param config The listener configuration
- * @throws ConfigurationException Exception during construction
- */
- @SuppressWarnings("unchecked")
- public HttpGatewayListener(ConfigTree config) throws ConfigurationException {
- super(config);
- host = config.getAttribute(SERVER_HOST_TAG);
- try {
- address = InetAddress.getByName(host).getHostAddress();
- }catch (Exception e) {
- throw new ConfigurationException("Invalid host configuration");
- }
- port = config.getAttribute(SERVER_PORT_TAG);
- httpContext = config.getAttribute(REQUEST_CONTEXT_TAG);
- serviceCategory = config.getAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG);
- serviceName = config.getAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG);
-
- if (config.getAttribute(DISPATCH_SERVLET_CLASS) != null) {
- dispatchServletClassName = config.getAttribute(DISPATCH_SERVLET_CLASS);
- }
-
- boolean synchronous = !config.getAttribute("synchronous", "true").equalsIgnoreCase("false");
- if (!synchronous) {
- String asyncResponse = config.getAttribute("asyncResponse");
- if (asyncResponse != null) {
- if (ClassUtil.getResourceAsStream(asyncResponse, getClass()) == null) {
- throw new ConfigurationException("Asynchronous response resource file '" + asyncResponse
- + "' not found on classpath.");
- }
- }
- }
-
- //validate allow http method configuration
- if (config.getAttribute(ALLOW_HTTP_METHOD) != null) {
- String allowMethods = config.getAttribute(ALLOW_HTTP_METHOD);
- String[] methods = allowMethods.split(",");
- List<String> standardMesthods = new ArrayList<String>();
- standardMesthods.add("GET");
- standardMesthods.add("POST");
- standardMesthods.add("DELETE");
- standardMesthods.add("PUT");
- standardMesthods.add("OPTIONS");
- standardMesthods.add("HEAD");
- standardMesthods.add("TRACE");
-
- for (String method : methods) {
- if (!standardMesthods.contains(method.toUpperCase())) {
- throw new ConfigurationException("Invalid allow http method configuration, please specify the specify method list with comma-separated(e.g. POST,GET,PUT,DELETE");
- }
- }
- }
-
- try {
- Set ports = HttpServerDelegate.getInstance().queryObjects("jboss.web:port="+ port+",type=Connector,*");
- if (ports.size() > 0) {
- //When this gateway stared on JBoss default port 8080 or 80, the configured host will be ignored
- Set contexts = HttpServerDelegate.getInstance().queryObjects("jboss.web:host=localhost" + ",path=" + httpContext + ",*");
- if (contexts.size() > 0) {
- throw new ConfigurationException("There is already an http context named " + httpContext + ", choose another one");
- }
- logger.info("This http gateway listener [" + config.getAttribute(ListenerTagNames.NAME_TAG) + "] will be started on JBoss default port " + port + " and the configured host will be ignored.");
- //the created context will be attached jboss.web domain
- useJBossWebServletEngine = true;
- } else {
- //if the port is not the jboss.web used, check if the http context name is duplicate
- Set contexts = HttpServerDelegate.getInstance().queryObjects(HttpServerDelegate.DOMAIN_NAME + ":host=" + HttpServerDelegate.defaultVHost + ",path=" + httpContext + ",*");
- if (contexts.size() > 0) {
- throw new ConfigurationException("There is already an http context named " + httpContext + ", choose another one");
- }
- }
- } catch (Exception e) {
- throw new ConfigurationException(e);
- }
-
- //Check the http security configuration
- if (config.getAttribute(AUTH_METHOD) != null) {
- if (config.getAttribute(SECURITY_DOMAIN) == null) {
- throw new ConfigurationException("Security domain configuration for this context not found for http authentication method " + config.getAttribute(AUTH_METHOD));
- }
-
- if (config.getAttribute(SECURITY_ROLE) == null) {
- throw new ConfigurationException("Security role configuration for this context not found for http authentication method " + config.getAttribute(AUTH_METHOD));
- }
- }
- }
-
- /*
- * Start the Tomcat listner
- *
- * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doStart()
- */
- protected void doStart() throws ManagedLifecycleException {
-
- try {
- startHttpServer();
- } catch (Exception e) {
- throw new ManagedLifecycleException(
- "Failed to start Http gateway listener", e);
- }
-
- try {
- registerEndpoint();
- } catch (Throwable t) {
- logger.error("Unable to register service endpoint '" + endpointReference.getAddr().getAddress()
- + "' for service '" + serviceCategory + ":" + serviceName + "'. Stopping Http Listener Server...", t);
- try {
- stopHttpServer();
- } catch (Exception e) {
- throw new ManagedLifecycleException(
- "Failed to stop Http gateway listener", e);
- }
- }
- }
-
- /*
- * Stop the tomcat listener
- *
- * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doStop()
- */
- protected void doStop() throws ManagedLifecycleException {
- unregisterEndpoint();
- try {
- stopHttpServer();
- } catch (Exception e) {
- throw new ManagedLifecycleException(
- "Failed to stop Http gateway listener", e);
- }
-
-
- }
-
- /*
- * Initialize the tomcat listener
- *
- * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doInitialise()
- */
- protected void doInitialise() throws ManagedLifecycleException {
-
- }
-
- /*
- * Destory the tomcat listener
- *
- * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doDestroy()
- */
- protected void doDestroy() throws ManagedLifecycleException {
- }
-
-
-
- /**
- * Start the tomcat http server.It will check if it really needs to create
- * Tomcat connector and host. Then add these new tomcat component to tomcat Engine
- * tree through JMX server.
- * @throws Exception For error during start tomcat context
- */
- @SuppressWarnings("unchecked")
- protected void startHttpServer() throws Exception {
-
- ctx = new StandardContext();
- URL[] urls = new URL[]{};
- URLClassLoader urlClassLoader = new URLClassLoader(urls, getClass().getClassLoader());
-
- WebappLoader loader = new WebappLoader(urlClassLoader);
- ctx.setLoader(loader);
- ContextConfig ctxCfg = new ContextConfig();
- ctx.addLifecycleListener(ctxCfg);
-
- ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
- ctx.setPath(httpContext);
- ctx.setDocBase(".");
-
-
- ClassLoader oldloader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(urlClassLoader);
- initWebappDefaults(ctx);
- Thread.currentThread().setContextClassLoader(oldloader);
- String encodedAddr = URLEncoder.encode("/" + address).toString();
- String connectorName = HttpServerDelegate.DOMAIN_NAME + ":address=" + encodedAddr + ",port=" + port + ",type=Connector";
- if (!useJBossWebServletEngine) {
- //Create default Tomcat standard vHost "localhost"
- HttpServerDelegate.getInstance().createHost(HttpServerDelegate.defaultVHost);
-
- List<KeyValuePair> properties = getConfig().childPropertyList();
- if (getConfig().getAttribute(ListenerTagNames.MAX_THREADS_TAG) != null) {
- maxThreads = getConfig().getAttribute(ListenerTagNames.MAX_THREADS_TAG);
- }
- properties.add(new KeyValuePair("maxThreads", maxThreads));
-
- HttpServerDelegate.getInstance().createConnector(address, port, properties);
- HttpServerDelegate.getInstance().addContext(HttpServerDelegate.defaultVHost, ctx);
- } else {
- //add it to jboss.web servlet engine
- connectorName = "jboss.web:port=" + port + ",type=Connector,*";
- HttpServerDelegate.getInstance().addContext(new ObjectName("jboss.web:host=localhost,type=Host"), ctx);
- }
-
- Set connectors = HttpServerDelegate.getInstance().queryObjects(connectorName);
- if (connectors.isEmpty()) {
- throw new javax.management.InstanceNotFoundException("ObjectName: "+ connectorName + " Not found");
- }
- ObjectName obj = (ObjectName)connectors.iterator().next();
- try {
- protocol = MBeanServerLocator.locateJBoss().getAttribute(obj, "scheme");
- } catch (Exception e) {
- //do nothing and use default http
- protocol = "http";
- }
-
- }
-
- /**Register this endpoint
- * @throws ConfigurationException For configuration error
- * @throws RegistryException For registry error when register this EPR
- */
- private void registerEndpoint() throws ConfigurationException, RegistryException {
- try {
- endpointReference = new HTTPEpr(new URI(protocol + "://"+ address + ":" + port + this.httpContext));
- endpointReference.getAddr().addExtension("is-gateway", "true");
- } catch (Exception e) {
- throw new RegistryException("Tomcat gateway listener registration failed", e);
- }
- String serviceDescription = getConfig().getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG);
- RegistryFactory.getRegistry().registerEPR(serviceCategory, serviceName, serviceDescription,
- endpointReference, endpointReference.getAddr().getAddress());
- }
-
- /**Unregister this endpoint
- */
- private void unregisterEndpoint() {
- try {
- RegistryFactory.getRegistry().unRegisterEPR(serviceCategory, serviceName, endpointReference);
- } catch (Throwable t) {
- logger.error("Unable to unregister service endpoint '" + endpointReference.getAddr().getAddress()
- + "' for service '" + serviceCategory + ":" + serviceName + "'.", t);
- }
- }
-
- /**Stop tomcat server. It will destroy the generated tomcat connector or host .
- * Before do it , it will check if the reference count for it is zero .When there
- * is no tomcat listener uses the generated host or connector, it will destroy it
- * @throws Exception For errors during stop tomcat connector or host
- */
- @SuppressWarnings("unchecked")
- public void stopHttpServer() throws Exception {
- //Destroy the created context
- if (!useJBossWebServletEngine) {
- HttpServerDelegate.getInstance().destroyContext(HttpServerDelegate.defaultVHost, address, port, httpContext);
- } else {
- Set<ObjectName> contexts = HttpServerDelegate.getInstance().queryObjects("jboss.web:j2eeType=WebModule,name=//localhost" + httpContext + ",*");
- for (ObjectName obName : contexts) {
- HttpServerDelegate.getInstance().destroyContext(obName);
- }
- }
- }
-
- /**Get the uncomposed message delivery dapater
- * @return uncomposed message delivery adapter
- * @throws ConfigurationException For configuation error
- */
- protected UncomposedMessageDeliveryAdapter createDeliveryAdapter()
- throws ConfigurationException {
- return UncomposedMessageDeliveryAdapter.getGatewayDeliveryAdapter(
- getConfig(),
- new HttpMessageComposer<HttpRequestWrapper>());
- }
-
- /**Initialize the StandardContext.By default it will uses
- * {@link org.jboss.soa.esb.listeners.gateway.TomcatDefaultServlet} as default servlet mapping
- * @param ctx Created tomcat standard context
- * @throws Exception For errors during initialization
- */
- protected void initWebappDefaults(StandardContext ctx) throws Exception {
- if (isHttpAuthConfiured()) {
-
- InitialContext iniCtx = new InitialContext();
-
- Context envCtx;
- try {
- envCtx = (Context) iniCtx.lookup("java:comp/env");
- } catch (NamingException e) {
- envCtx = (Context) iniCtx.lookup("java:comp");
- envCtx = envCtx.createSubcontext("env");
- }
-
- String securityDomain = getConfig().getAttribute(SECURITY_DOMAIN);
- Util.bind(envCtx, "security/securityMgr", new LinkRef(securityDomain));
- Util.bind(envCtx, "security/realmMapping", new LinkRef(securityDomain));
- Util.bind(envCtx, "security/security-domain", new LinkRef(securityDomain));
- Util.bind(envCtx, "security/subject", new LinkRef(securityDomain));
- }
-
- StandardWrapper sw = (StandardWrapper) ctx.createWrapper();
-
- sw.setServletClass(dispatchServletClassName);
- sw.setName("default");
- ctx.addChild(sw);
- ctx.getServletContext().setAttribute("config", this.getConfig());
-
- sw.addInitParameter("listings", "false");
- sw.setLoadOnStartup(1);
-
- try {
- sw.start();
- } catch (LifecycleException e) {
- logger.error("Unexpected error when start the default servlet");
- throw e;
- }
- ctx.addServletMapping("/", "default");
-
-
- //Add security support
- if (isHttpAuthConfiured()) {
- String securityRole = this.getConfig().getAttribute(SECURITY_ROLE);
- SecurityConstraint constraint = new SecurityConstraint();
- constraint.addAuthRole(securityRole);
- SecurityCollection collection = new SecurityCollection("all");
- collection.addPattern("/*");
- constraint.addCollection(collection);
- ctx.addConstraint(constraint);
-
- ctx.addSecurityRole(securityRole);
-
- String authMethod = this.getConfig().getAttribute(AUTH_METHOD);
- LoginConfig config = new LoginConfig(authMethod, securityRole,
- null, null);
- ctx.setLoginConfig(config);
- }
- }
-
- private boolean isHttpAuthConfiured() {
- if (getConfig().getAttribute(AUTH_METHOD) != null) {
- return true;
- }
- return false;
- }
-
-}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,140 @@
+/*
+ * 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.soa.esb.listeners.gateway;
+
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.couriers.FaultMessageException;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.listeners.message.MessageComposer;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.soa.esb.client.ServiceInvoker;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletConfig;
+import java.io.IOException;
+import java.util.Enumeration;
+
+/**
+ * Http Gateway Servlet.
+ * <p/>
+ * An instance of this class gets configured for each http-listener urlPattern.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @see HttpGatewayDeploymentFactory
+ */
+public class HttpGatewayServlet extends HttpServlet {
+
+ private Service service;
+ private ServiceInvoker serviceInvoker;
+ private MessageComposer<HttpRequestWrapper> messageComposer;
+ private String mep;
+ private long blockingTimeout;
+
+ public void init(ServletConfig config) throws ServletException {
+ service = new Service(config.getInitParameter(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG), config.getInitParameter(ListenerTagNames.TARGET_SERVICE_NAME_TAG));
+ try {
+ serviceInvoker = new ServiceInvoker(service);
+ } catch (MessageDeliverException e) {
+ throw new ServletException("Unable to create ServiceInvoker for Service '" + service + "'.", e);
+ }
+
+ ConfigTree configTree = toConfigTree(config);
+ try {
+ messageComposer = MessageComposer.Factory.getInstance(configTree.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG, HttpMessageComposer.class.getName()), configTree);
+ } catch (ConfigurationException e) {
+ throw new ServletException("Failed to create message composer.", e);
+ } catch (MessageDeliverException e) {
+ throw new ServletException("Failed to create message composer.", e);
+ }
+
+ blockingTimeout = configTree.getLongAttribute("synchronousTimeout", 30000);
+ mep = Configuration.getMep(configTree);
+ }
+
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ HttpRequestWrapper wrapper = new HttpRequestWrapper(req, resp, service);
+
+ Message inMessage;
+ try {
+ inMessage = messageComposer.compose(wrapper);
+ } catch (MessageDeliverException e) {
+ throw new ServletException("Failed to create message.", e);
+ }
+
+ Message outMessage;
+ try {
+ // Dispatch the message to the action pipeline, using the service mep to decide
+ // whether to invoke sync or async...
+ if(mep.equals(ListenerTagNames.MEP_REQUEST_RESPONSE)) {
+ outMessage = serviceInvoker.deliverSync(inMessage, blockingTimeout);
+
+ // Set the mep as a header on the response...
+ resp.setHeader("mep", mep);
+ } else {
+ serviceInvoker.deliverAsync(inMessage);
+ resp.setContentLength(0);
+ resp.setStatus(HttpServletResponse.SC_OK);
+
+ // Set the mep as a header on the response...
+ resp.setHeader("mep", mep);
+
+ return;
+ }
+ } catch (MessageDeliverException e) {
+ throw new ServletException("Failed to deliver message.", e);
+ } catch (RegistryException e) {
+ throw new ServletException("Failed to deliver message.", e);
+ } catch (FaultMessageException e) {
+ throw new ServletException("Failed to deliver message.", e);
+ }
+
+ if(outMessage != null) {
+ try {
+ messageComposer.decompose(outMessage, wrapper);
+ } catch (MessageDeliverException e) {
+ throw new ServletException("Failed to decompose response message.", e);
+ }
+ } else {
+ resp.setContentLength(0);
+ resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ return;
+ }
+ }
+
+ private ConfigTree toConfigTree(ServletConfig config) {
+ ConfigTree configTree = new ConfigTree("config");
+ Enumeration configNames = config.getInitParameterNames();
+
+ while(configNames.hasMoreElements()) {
+ String name = (String) configNames.nextElement();
+ configTree.setAttribute(name, config.getInitParameter(name));
+ }
+
+ return configTree;
+ }
+}
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,195 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.gateway;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.tomcat.util.IntrospectionUtils;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.AbstractMessageComposer;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.MessagePayloadProxy;
-import org.jboss.soa.esb.message.MessagePayloadProxy.NullPayloadHandling;
-import org.jboss.soa.esb.message.body.content.BytesBody;
-/**
- * TomcatMessageComposer class is used to compose the HttpServletRquest
- * to ESB aware message and decompse the ESB aware message to HttpServletRespones
- * <p>
- * This class will put the http request header and other requst information in ESB message properties with the key "RequestInfoMap".
- * <p>If the request is the submitted from html form(with the <code>Content-Type: application/x-www-form-urlencoded</code>), HttpServletRequest.getParameterMap() result)
- * will be put in ESB message properties. The key for it is "RequestParamterMap". It put the the byte array read from request inputstream in message payload.
- * <p>In decompose process, the header map in message properties will be added
- * in HttpServletResponse. The value for "ReponseStatus" store in ESB message properties will
- * put in the http response. The message payload byte[] or String object will be wrote to HttpServletResponse.
- * If the object in message payload is not byte[],it will throw exception when the ESB message
- * is decomposed
- *
- * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
- */
-public class HttpMessageComposer<T extends HttpRequestWrapper>
- extends AbstractMessageComposer<T> {
-
- /** Request parameter map key in esb message properties */
- public static final String HTTP_REQUEST_PARAMETER_MAP = "RequestParameterMap";
-
- /** Request information map key in esb message properties */
- public static final String HTTP_REQUEST_INFO_MAP = "RequestInfoMap";
-
- /** Reponse header map key in esb message properties */
- public static final String HTTP_RESPONSE_HEADER_MAP = "ResponseHeaderMap";
-
- /** Response status key in esb message properties */
- public static final String HTTP_RESPONSE_STATUS = "ReponseStatus";
-
- /** Message payload proxy */
- private MessagePayloadProxy payloadProxy;
-
- /*
- * Method for configue the payload proxy
- */
- public void setConfiguration(ConfigTree config) {
- super.setConfiguration(config);
- payloadProxy = new MessagePayloadProxy(config, new String[] {
- ActionUtils.POST_ACTION_DATA, Body.DEFAULT_LOCATION,
- BytesBody.BYTES_LOCATION },
- new String[] { ActionUtils.POST_ACTION_DATA });
- payloadProxy.setNullSetPayloadHandling(NullPayloadHandling.LOG);
- }
-
- protected MessagePayloadProxy getPayloadProxy() {
- return payloadProxy;
- }
-
- /*
- *Method for populating the ESB aware message from a HttpServletRequest
- */
- @SuppressWarnings("unchecked")
- protected void populateMessage(Message message, T requestWrapper)
- throws MessageDeliverException {
- HttpServletRequest request = requestWrapper.getRequest();
- Map paraMap = request.getParameterMap();;
- byte[] bodyBytes = null;
- try {
- bodyBytes = StreamUtils.readStream(request.getInputStream());
- } catch (IOException e) {
- throw new MessageDeliverException(
- "Failed to read body data from http request", e);
- }
- //Set http request info
- message.getProperties().setProperty(HTTP_REQUEST_INFO_MAP, getRequestInfo(request));
- if (paraMap != null && paraMap.size() > 0) {
- message.getProperties().setProperty(this.HTTP_REQUEST_PARAMETER_MAP, paraMap);
- }
- payloadProxy.setPayload(message, bodyBytes);
- }
-
- /*
- * Method for decompsing a esb message to a HttpServletResponse
- */
- @SuppressWarnings("unchecked")
- public Object decompose(Message message, T requestWrapper) throws MessageDeliverException {
- HttpServletResponse httpResponse = (HttpServletResponse)requestWrapper.getResponse();
- Object header = message.getProperties().getProperty(HTTP_RESPONSE_HEADER_MAP);
- Object status = message.getProperties().getProperty(HTTP_RESPONSE_STATUS);
- if (header != null) {
- Map headerMap = (Map)header;
- Iterator ite = headerMap.keySet().iterator();
- while (ite.hasNext()) {
- String name = (String)ite.next();
- String value = (String)headerMap.get(name);
- httpResponse.setHeader(name, value);
- }
-
- }
- if (status != null) {
- int reponseStatus = (Integer)status;
- httpResponse.setStatus(reponseStatus);
- }
-
- Object obj = payloadProxy.getPayload(message);
- try {
- if (obj instanceof String) {
-
- requestWrapper.getResponse().getWriter().write((String) obj);
-
- } else if (obj instanceof byte[]) {
- requestWrapper.getResponse().getOutputStream().write(
- (byte[]) obj);
- } else {
- throw new MessageDeliverException(
- "Message payload is not byte array or String");
- }
- } catch (IOException e) {
- throw new MessageDeliverException("Unexpected error when write the message to http response", e);
- }
- return requestWrapper.getResponse();
- }
-
- /**
- * Method for get request information from a servlet request
- * The result includes the http header and other servlet request information
- * @param request ServletRequest
- * @return Request information includes the http header and other information parsed by
- * servlet container from a servlet request
- */
- public Map<String, Object> getRequestInfo(HttpServletRequest request) {
- Map<String, Object> requestInfoMap = new HashMap<String, Object>();
- requestInfoMap.put("authType", request.getAuthType());
- requestInfoMap.put("characterEncoding", request.getCharacterEncoding());
- requestInfoMap.put("contentType", request.getContentType());
- requestInfoMap.put("contextPath", request.getContextPath());
- requestInfoMap.put("localAddr", request.getLocalAddr());
- requestInfoMap.put("localName", request.getLocalName());
- requestInfoMap.put("method", request.getMethod());
- requestInfoMap.put("pathInfo", request.getPathInfo());
- requestInfoMap.put("protocol", request.getProtocol());
- requestInfoMap.put("queryString", request.getQueryString());
- requestInfoMap.put("remoteAddr", request.getRemoteAddr());
- requestInfoMap.put("remoteHost", request.getRemoteHost());
- requestInfoMap.put("remoteUser", request.getRemoteUser());
- requestInfoMap.put("contentLength", Integer.toString(request.getContentLength()));
- requestInfoMap.put("requestSessionId", request.getRequestedSessionId());
- requestInfoMap.put("requestURI", request.getRequestURI());
- requestInfoMap.put("schema", request.getScheme());
- requestInfoMap.put("serverName", request.getServerName());
-
- //Add http header
- Enumeration enumeration = request.getHeaderNames();
- while (enumeration.hasMoreElements()) {
- String name = (String) enumeration.nextElement();
- String value = request.getHeader(name);
- requestInfoMap.put(name, value);
- }
- return requestInfoMap;
- }
-}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,300 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.gateway;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.nio.charset.Charset;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.AbstractMessageComposer;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.MessagePayloadProxy;
+import org.jboss.soa.esb.message.MessagePayloadProxy.NullPayloadHandling;
+import org.jboss.soa.esb.message.body.content.BytesBody;
+import org.jboss.soa.esb.common.ModulePropertyManager;
+
+/**
+ * Http Message Composer.
+ * <p/>
+ * This class is used to compose the HttpServletRquest
+ * to ESB aware message and decompse the ESB aware message to HttpServletRespones
+ * <p>
+ * This class will put the http request header and other requst information in ESB message properties with the key "RequestInfoMap".
+ * <p>
+ * If the request is the submitted from html form(with the <code>Content-Type: application/x-www-form-urlencoded</code>), HttpServletRequest.getParameterMap() result)
+ * will be put in ESB message properties. The key for it is "RequestParamterMap". It put the the byte array read from request inputstream in message payload.
+ * <p>
+ * In decompose process, the header map in message properties will be added
+ * in HttpServletResponse. The value for "ReponseStatus" store in ESB message properties will
+ * put in the http response. The message payload byte[] or String object will be wrote to HttpServletResponse.
+ * If the object in message payload is not byte[],it will throw exception when the ESB message
+ * is decomposed
+ *
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class HttpMessageComposer<T extends HttpRequestWrapper> extends AbstractMessageComposer<T> {
+
+ private static final Logger logger = Logger.getLogger(HttpMessageComposer.class);
+
+ /** Request parameter map key in esb message properties */
+ public static final String HTTP_REQUEST_PARAMETER_MAP = "RequestParameterMap";
+
+ /** Request information map key in esb message properties */
+ public static final String HTTP_REQUEST_INFO_MAP = "RequestInfoMap";
+
+ /** Reponse header map key in esb message properties */
+ public static final String HTTP_RESPONSE_HEADER_MAP = "ResponseHeaderMap";
+
+ /** Response status key in esb message properties */
+ public static final String HTTP_RESPONSE_STATUS = "ReponseStatus";
+
+ /** Message payload proxy */
+ private MessagePayloadProxy payloadProxy;
+
+ private String payloadAs;
+ private Pattern[] textMimePatterns;
+
+ /*
+ * Method for configue the payload proxy
+ */
+ public void setConfiguration(ConfigTree config) {
+ super.setConfiguration(config);
+ payloadProxy = new MessagePayloadProxy(config, new String[] {
+ ActionUtils.POST_ACTION_DATA, Body.DEFAULT_LOCATION,
+ BytesBody.BYTES_LOCATION },
+ new String[] { ActionUtils.POST_ACTION_DATA });
+ payloadProxy.setNullSetPayloadHandling(NullPayloadHandling.LOG);
+
+ payloadAs = config.getAttribute("payloadAs");
+ if(payloadAs == null) {
+ // Get the globally configured text mime types...
+ String[] textTypes = ModulePropertyManager.getPropertyManager("core").getProperty("org.jboss.soa.esb.mime.text.types", "text/*;application/xml;application/*-xml").split(";");
+ textMimePatterns = new Pattern[textTypes.length];
+ for(int i = 0; i < textMimePatterns.length; i++) {
+ textMimePatterns[i] = Pattern.compile(textTypes[i].trim().replace("*", ".*"));
+ }
+ }
+ }
+
+ protected MessagePayloadProxy getPayloadProxy() {
+ return payloadProxy;
+ }
+
+ /*
+ *Method for populating the ESB aware message from a HttpServletRequest
+ */
+ @SuppressWarnings("unchecked")
+ protected void populateMessage(Message message, T requestWrapper) throws MessageDeliverException {
+ HttpServletRequest request = requestWrapper.getRequest();
+ Map paraMap = request.getParameterMap();
+ byte[] bodyBytes = null;
+
+ try {
+ bodyBytes = StreamUtils.readStream(request.getInputStream());
+ } catch (IOException e) {
+ throw new MessageDeliverException("Failed to read body data from http request", e);
+ }
+
+ String characterEncoding = request.getCharacterEncoding();
+ Charset charset;
+ if(characterEncoding == null) {
+ charset = Charset.defaultCharset();
+ } else {
+ charset = Charset.forName(characterEncoding);
+ }
+
+ if(payloadAs == null) {
+ String contentType = request.getContentType();
+
+ if(contentType != null && isTextMimetype(contentType)) {
+ try {
+ payloadProxy.setPayload(message, new String(bodyBytes, charset.name()));
+ } catch (UnsupportedEncodingException e) {
+ throw new MessageDeliverException("Invalid Character encoding '" + characterEncoding + "' set on request.", e);
+ }
+ } else {
+ payloadProxy.setPayload(message, bodyBytes);
+ }
+ } else if(payloadAs.equals("STRING")) {
+ try {
+ payloadProxy.setPayload(message, new String(bodyBytes, charset.name()));
+ } catch (UnsupportedEncodingException e) {
+ throw new MessageDeliverException("Invalid Character encoding '" + characterEncoding + "' set on request.", e);
+ }
+ } else {
+ payloadProxy.setPayload(message, bodyBytes);
+ }
+
+ //Set http request info
+ message.getProperties().setProperty(HTTP_REQUEST_INFO_MAP, getRequestInfo(request));
+ if (paraMap != null && !paraMap.isEmpty()) {
+ message.getProperties().setProperty(this.HTTP_REQUEST_PARAMETER_MAP, paraMap);
+ }
+ }
+
+ private boolean isTextMimetype(String contentType) {
+ for(int i = 0; i < textMimePatterns.length; i++) {
+ if(textMimePatterns[i].matcher(contentType).matches()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ /*
+ * Method for decompsing a esb message to a HttpServletResponse
+ */
+ @SuppressWarnings("unchecked")
+ public Object decompose(Message message, T requestWrapper) throws MessageDeliverException {
+ HttpServletRequest request = requestWrapper.getRequest();
+ HttpServletResponse response = requestWrapper.getResponse();
+ Map<String, String> headers;
+ Integer status;
+
+ try {
+ headers = (Map<String, String>) message.getProperties().getProperty(HTTP_RESPONSE_HEADER_MAP);
+ } catch(ClassCastException e) {
+ response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
+ logger.debug("'" + HTTP_RESPONSE_HEADER_MAP + "' must be of type " + Map.class.getName());
+ return null;
+ }
+
+ try {
+ status = (Integer) message.getProperties().getProperty(HTTP_RESPONSE_STATUS);
+ } catch(ClassCastException e) {
+ response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
+ logger.debug("'" + HTTP_RESPONSE_STATUS + "' must be of type Integer.");
+ return null;
+ }
+
+ if (headers != null) {
+ Set<Map.Entry<String, String>> entries = headers.entrySet();
+ for(Map.Entry<String, String> entry : entries) {
+ String headerName = entry.getKey();
+ if(headerName.equals("Content-Type")) {
+ response.setContentType(entry.getValue());
+ } else {
+ response.setHeader(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ Object obj = payloadProxy.getPayload(message);
+ try {
+ byte[] outBytes;
+
+ if (obj instanceof String) {
+ String encoding = request.getCharacterEncoding();
+ if(encoding == null) {
+ encoding = "UTF-8";
+ }
+ outBytes = ((String) obj).getBytes(encoding);
+ } else if (obj instanceof byte[]) {
+ outBytes = (byte[]) obj;
+ } else if (obj == null) {
+ response.setContentLength(0);
+ response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ logger.debug("Expected a response payload from '" + ListenerTagNames.MEP_REQUEST_RESPONSE + "' service '" + requestWrapper.getService() + "', but received none.");
+ return null;
+ } else {
+ response.setContentLength(0);
+ response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
+ logger.debug("Unsupport HTTP response payload type " + obj.getClass().getName() + " from service '" + requestWrapper.getService() + "'. Only supports java.lang.String or byte[] payloads.");
+ return null;
+ }
+
+ if(outBytes.length > 0) {
+ response.getOutputStream().write(outBytes);
+ }
+ response.setContentLength(outBytes.length);
+
+ if (status != null) {
+ response.setStatus(status);
+ } else {
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+ } catch (IOException e) {
+ throw new MessageDeliverException("Unexpected error when write the message to http response", e);
+ }
+
+ return null;
+ }
+
+ /**
+ * Method for get request information from a servlet request
+ * The result includes the http header and other servlet request information
+ * @param request ServletRequest
+ * @return Request information includes the http header and other information parsed by
+ * servlet container from a servlet request
+ */
+ public Map<String, Object> getRequestInfo(HttpServletRequest request) {
+ Map<String, Object> requestInfoMap = new HashMap<String, Object>();
+
+ requestInfoMap.put("authType", request.getAuthType());
+ requestInfoMap.put("characterEncoding", request.getCharacterEncoding());
+ requestInfoMap.put("contentType", request.getContentType());
+ requestInfoMap.put("contextPath", request.getContextPath());
+ requestInfoMap.put("localAddr", request.getLocalAddr());
+ requestInfoMap.put("localName", request.getLocalName());
+ requestInfoMap.put("method", request.getMethod());
+ requestInfoMap.put("pathInfo", request.getPathInfo());
+ requestInfoMap.put("protocol", request.getProtocol());
+ requestInfoMap.put("queryString", request.getQueryString());
+ requestInfoMap.put("remoteAddr", request.getRemoteAddr());
+ requestInfoMap.put("remoteHost", request.getRemoteHost());
+ requestInfoMap.put("remoteUser", request.getRemoteUser());
+ requestInfoMap.put("contentLength", Integer.toString(request.getContentLength()));
+ requestInfoMap.put("requestSessionId", request.getRequestedSessionId());
+ requestInfoMap.put("requestURI", request.getRequestURI());
+ requestInfoMap.put("scheme", request.getScheme());
+ requestInfoMap.put("serverName", request.getServerName());
+ requestInfoMap.put("requestPath", request.getServletPath());
+ requestInfoMap.put("pathInfo", request.getPathInfo());
+ if(request.getPathInfo() != null) {
+ requestInfoMap.put("pathInfoTokens", request.getPathInfo().split("/"));
+ } else {
+ requestInfoMap.put("pathInfoTokens", new String[0]);
+ }
+
+ //Add http header
+ Enumeration enumeration = request.getHeaderNames();
+ while (enumeration.hasMoreElements()) {
+ String name = (String) enumeration.nextElement();
+ String value = request.getHeader(name);
+ requestInfoMap.put(name, value);
+ }
+
+ return requestInfoMap;
+ }
+}
\ No newline at end of file
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -19,6 +19,8 @@
*/
package org.jboss.soa.esb.listeners.gateway;
+import org.jboss.soa.esb.Service;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
@@ -31,10 +33,13 @@
public class HttpRequestWrapper {
private HttpServletRequest request = null;
private HttpServletResponse response = null;
- public HttpRequestWrapper(HttpServletRequest req, HttpServletResponse res) {
+ private Service service;
+
+ public HttpRequestWrapper(HttpServletRequest req, HttpServletResponse res, Service service) {
request = req;
response = res;
- }
+ this.service = service;
+ }
public HttpServletRequest getRequest() {
return request;
@@ -43,4 +48,8 @@
public HttpServletResponse getResponse() {
return response;
}
+
+ public Service getService() {
+ return service;
+ }
}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/web.xml.ftl (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/web.xml.ftl)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/web.xml.ftl (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/web.xml.ftl 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <#list listeners as listener>
+ <servlet>
+ <servlet-name>${listener.name}</servlet-name>
+ <servlet-class>org.jboss.soa.esb.listeners.gateway.HttpGatewayServlet</servlet-class>
+
+ <#list listener.attributes as kvp>
+ <init-param>
+ <param-name>${kvp.key}</param-name>
+ <param-value>${kvp.value}</param-value>
+ </init-param>
+ </#list>
+
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>${listener.name}</servlet-name>
+ <url-pattern>${listener.urlPattern}</url-pattern>
+ </servlet-mapping>
+ </#list>
+
+
+</web-app>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/DeploymentArchive.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/util/DeploymentArchive.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/DeploymentArchive.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/DeploymentArchive.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.util;
+
+import java.util.zip.ZipOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.jar.JarInputStream;
+import java.io.*;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * Deployment archive.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeploymentArchive {
+
+ private static Logger logger = Logger.getLogger(DeploymentArchive.class);
+ private String archiveName;
+ private LinkedHashMap<String, byte[]> entries = new LinkedHashMap<String, byte[]>();
+
+ /**
+ * Public constructor.
+ * @param archiveName The archive name of the deployment.
+ */
+ public DeploymentArchive(String archiveName) {
+ AssertArgument.isNotNull(archiveName, "archiveName");
+ this.archiveName = archiveName;
+ }
+
+ /**
+ * Get the name of the deployment associated with this archive.
+ * @return The name of the deployment.
+ */
+ public String getArchiveName() {
+ return archiveName;
+ }
+
+ /**
+ * Add the supplied data as an entry in the deployment.
+ *
+ * @param path The target path of the entry when added to the archive.
+ * @param data The data.
+ */
+ public void addEntry(String path, InputStream data) {
+ AssertArgument.isNotNullAndNotEmpty(path, "path");
+ AssertArgument.isNotNull(data, "data");
+
+ try {
+ entries.put(trimLeadingSlash(path.trim()), StreamUtils.readStream(data));
+ } finally {
+ try {
+ data.close();
+ } catch (IOException e) {
+ logger.warn("Unable to close input stream for archive entry '" + path + "'.");
+ }
+ }
+ }
+
+ /**
+ * Add an "empty" entry in the deployment.
+ * <p/>
+ * Equivalent to adding an empty folder.
+ *
+ * @param path The target path of the entry when added to the archive.
+ */
+ public void addEntry(String path) {
+ AssertArgument.isNotNullAndNotEmpty(path, "path");
+
+ path = path.trim();
+ if(path.endsWith("/")) {
+ entries.put(trimLeadingSlash(path), null);
+ } else {
+ entries.put(trimLeadingSlash(path) + "/", null);
+ }
+ }
+
+ /**
+ * Add the specified classpath resource as an entry in the deployment.
+ *
+ * @param path The target path of the entry when added to the archive.
+ * @param resource The classpath resource.
+ * @throws java.io.IOException Failed to read resource from classpath.
+ */
+ public void addEntry(String path, String resource) throws IOException {
+ AssertArgument.isNotNull(path, "path");
+ AssertArgument.isNotNull(resource, "resource");
+
+ InputStream resourceStream = getClass().getResourceAsStream(resource);
+ if(resourceStream == null) {
+ throw new IOException("Classpath resource '" + resource + "' no found.");
+ } else {
+ addEntry(path, resourceStream);
+ }
+ }
+
+ /**
+ * Add the supplied class as an entry in the deployment.
+ * @param clazz The class to be added.
+ * @throws java.io.IOException Failed to read class from classpath.
+ */
+ public void addEntry(Class clazz) throws IOException {
+ AssertArgument.isNotNull(clazz, "clazz");
+ String className = clazz.getName();
+
+ className = className.replace('.', '/') + ".class";
+ addEntry(className, "/" + className);
+ }
+
+ /**
+ * Create an archive of the specified name and containing entries
+ * for the data contained in the streams supplied entries arg.
+ * specifying the entry name and the value is a InputStream containing
+ * the entry data.
+ * @param outputStream The archive output stream.
+ * @throws java.io.IOException Write failure.
+ */
+ public void toOutputStream(OutputStream outputStream) throws IOException {
+ AssertArgument.isNotNull(outputStream, "outputStream");
+ ZipOutputStream archiveStream;
+
+ if(outputStream instanceof ZipOutputStream) {
+ archiveStream = (ZipOutputStream) outputStream;
+ } else {
+ archiveStream = new ZipOutputStream(outputStream);
+ }
+
+ try {
+ writeEntriesToArchive(archiveStream);
+ } finally {
+ try {
+ archiveStream.flush();
+ } finally {
+ try {
+ archiveStream.close();
+ } catch (IOException e) {
+ logger.info("Unable to close archive output stream.");
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a {@link java.util.jar.JarInputStream} for the entries defined in this
+ * archive.
+ * @return The {@link java.util.jar.JarInputStream} for the entries in this archive.
+ * @throws java.io.IOException Failed to create stream.
+ */
+ public JarInputStream toInputStream() throws IOException {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ toOutputStream(outputStream);
+
+ return new JarInputStream(new ByteArrayInputStream(outputStream.toByteArray()));
+ }
+
+ private void writeEntriesToArchive(ZipOutputStream archiveStream) throws IOException {
+ Set<Map.Entry<String, byte[]>> entrySet = entries.entrySet();
+ for (Map.Entry<String, byte[]> entry : entrySet) {
+ try {
+ archiveStream.putNextEntry(new ZipEntry(entry.getKey()));
+ if(entry.getValue() != null) {
+ archiveStream.write(entry.getValue());
+ }
+ archiveStream.closeEntry();
+ } catch (Exception e) {
+ throw (IOException) new IOException("Unable to create archive entry '" + entry.getKey() + "'.").initCause(e);
+ }
+ }
+ }
+
+ private String trimLeadingSlash(String path) {
+ StringBuilder builder = new StringBuilder(path);
+ while(builder.length() > 0) {
+ if(builder.charAt(0) == '/') {
+ builder.deleteCharAt(0);
+ } else {
+ break;
+ }
+ }
+ return builder.toString();
+ }
+}
\ No newline at end of file
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/FreeMarkerTemplate.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/util/FreeMarkerTemplate.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/FreeMarkerTemplate.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/src/org/jboss/soa/esb/util/FreeMarkerTemplate.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,86 @@
+/*
+ * 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.soa.esb.util;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+import java.io.*;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+
+/**
+ * FreeMarker template.
+ * <p/>
+ * Coppied from Smooks Core.
+ *
+ * @author <a href="mailto:tom.fennelly at gmail.com">tom.fennelly at gmail.com</a>
+*/
+public class FreeMarkerTemplate {
+
+ private String templateText;
+ private Template template;
+
+ public FreeMarkerTemplate(String templateText) {
+ AssertArgument.isNotNullAndNotEmpty(templateText, "templateText");
+ Reader templateReader = new StringReader(templateText);
+
+ try {
+ try {
+ template = new Template("free-marker-template", templateReader, new Configuration());
+ } finally {
+ templateReader.close();
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException("Unexpected IOException.", e);
+ }
+ }
+
+ public FreeMarkerTemplate(String templatePath, Class basePath) {
+ AssertArgument.isNotNullAndNotEmpty(templatePath, "templatePath");
+ this.templateText = templatePath;
+
+ try {
+ Configuration configuration = new Configuration();
+
+ if(basePath != null) {
+ configuration.setClassForTemplateLoading(basePath, "");
+ }
+ template = configuration.getTemplate(templatePath);
+ } catch (IOException e) {
+ throw new IllegalStateException("Unexpected IOException.", e);
+ }
+ }
+
+ public String getTemplateText() {
+ return templateText;
+ }
+
+ public String apply(Object contextObject) throws TemplateException {
+ StringWriter outputWriter = new StringWriter();
+ try {
+ template.process(contextObject, outputWriter);
+ } catch (IOException e) {
+ throw new IllegalStateException("Unexpected IOException.", e);
+ }
+ return outputWriter.toString();
+ }
+}
\ No newline at end of file
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" name="Bank-Listener" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" persistent="true" protocol="jms" transacted="false"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" ma!
xThreads="2" my-generic-listener="my-generic-listener#someattribvalue" name="Bank-Listener-Generic" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="OneWay" name="test-ftp-listener" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/><a!
ction action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.Con
tentBasedRouter"/></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="RequestResponse" name="test-sql-listener" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener></jbossesb-listeners>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><listener busIdRef="local-jms" listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" name="Bank-Listener" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" persistent="true" protocol="jms" transacted="false"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener busIdRef="my-generic-bus" listenerClass="org.jboss.soa!
.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" name="Bank-Listener-Generic" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener busIdRef="Ftp-ServerTest" listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="OneWay" name="test-ftp-listener" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffi!
x=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/
><action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener><listener busIdRef="SQL-Test" listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="RequestResponse" name="test-sql-listener" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener></jbossesb-listeners>
\ No newline at end of file
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-gateways parameterReloadSecs="180"><listener acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="com.xyz.provider.XYZConnectionFactory" destination-name="queue/A" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" is-gateway="true" jndi-URL="xyz://server1:9876" jndi-context-factory="com.xyz.provider.NamingContextFactory" jndi-pkg-prefix="com.xyz" maxThreads="1" message-selector="service='Reconciliation'" name="Bank-JMS-Gateway" persistent="true" protocol="jms" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation" transacted="false"/><listener gatewayClass="org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener" is-gateway="true" jbr-serverBindAddress="192.168.1.111" jbr-serverBindPort="8765" jbr-serverProtocol="http" maxThreads="1" name="Bank-HTTP-Gat!
eway" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation"/></jbossesb-gateways>
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-gateways parameterReloadSecs="180"><listener acknowledge-mode="AUTO_ACKNOWLEDGE" busIdRef="server1-jms" connection-factory="com.xyz.provider.XYZConnectionFactory" destination-name="queue/A" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" is-gateway="true" jndi-URL="xyz://server1:9876" jndi-context-factory="com.xyz.provider.NamingContextFactory" jndi-pkg-prefix="com.xyz" maxThreads="1" message-selector="service='Reconciliation'" name="Bank-JMS-Gateway" persistent="true" protocol="jms" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation" transacted="false"/><listener busIdRef="HTTP-1" gatewayClass="org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener" is-gateway="true" jbr-serverBindAddress="192.168.1.111" jbr-serverBindPort="8765" jbr-serverProtocol=!
"http" maxThreads="1" name="Bank-HTTP-Gateway" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation"/></jbossesb-gateways>
\ No newline at end of file
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_esbaware.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_esbaware.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_esbaware.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" name="Bank-Listener" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" persistent="true" protocol="jms" transacted="false"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" ma!
xThreads="2" my-generic-listener="my-generic-listener#someattribvalue" name="Bank-Listener-Generic" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="OneWay" name="test-ftp-listener" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" postRename="true" workSuffix="!
.esbInProcess"/><action action="TestFtpRouteAction" class="org.jboss.s
oa.esb.actions.ContentBasedRouter"/></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="RequestResponse" name="test-sql-listener" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener></jbossesb-listeners>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><listener busIdRef="local-jms" listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" name="Bank-Listener" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" persistent="true" protocol="jms" transacted="false"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener busIdRef="my-generic-bus" listenerClass="org.jboss.soa!
.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" name="Bank-Listener-Generic" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener busIdRef="Ftp-ServerTest" listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="OneWay" name="test-ftp-listener" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffi!
x=".txt" passive="false" postDelete="true" postRename="true" workSuffi
x=".esbInProcess"/><action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener><listener busIdRef="SQL-Test" listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="RequestResponse" name="test-sql-listener" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener></jbossesb-listeners>
\ No newline at end of file
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_gateways.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_gateways.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_110_gateways.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-gateways parameterReloadSecs="180"><listener acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="com.xyz.provider.XYZConnectionFactory" destination-name="queue/A" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" is-gateway="true" jndi-URL="xyz://server1:9876" jndi-context-factory="com.xyz.provider.NamingContextFactory" jndi-pkg-prefix="com.xyz" maxThreads="1" message-selector="service='Reconciliation'" name="Bank-JMS-Gateway" persistent="true" protocol="jms" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation" transacted="false"/><listener gatewayClass="org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener" is-gateway="true" jbr-serverBindAddress="192.168.1.111" jbr-serverBindPort="8765" jbr-serverProtocol="http" maxThreads="1" name="Bank-HTTP-Gat!
eway" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation"/></jbossesb-gateways>
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-gateways parameterReloadSecs="180"><listener acknowledge-mode="AUTO_ACKNOWLEDGE" busIdRef="server1-jms" connection-factory="com.xyz.provider.XYZConnectionFactory" destination-name="queue/A" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" is-gateway="true" jndi-URL="xyz://server1:9876" jndi-context-factory="com.xyz.provider.NamingContextFactory" jndi-pkg-prefix="com.xyz" maxThreads="1" message-selector="service='Reconciliation'" name="Bank-JMS-Gateway" persistent="true" protocol="jms" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation" transacted="false"/><listener busIdRef="HTTP-1" gatewayClass="org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener" is-gateway="true" jbr-serverBindAddress="192.168.1.111" jbr-serverBindPort="8765" jbr-serverProtocol=!
"http" maxThreads="1" name="Bank-HTTP-Gateway" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation"/></jbossesb-gateways>
\ No newline at end of file
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -16,7 +16,7 @@
public void test() throws ConfigurationException, IOException, SAXException {
ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("jboss-esb.xml"));
- assertTrue(configUtil.getListenerConfig("JMS-ESBListener").toString().startsWith("<listener listenerClass=\"org.jboss.soa.esb.listeners.message.MessageAwareListener\" maxThreads=\"1\" name=\"JMS-ESBListener\" service-category=\"ABI_OrderManager\" service-description=\"ABI OrderManager Service\" service-name=\"ABI_OrderManager\">"));
+ assertTrue(configUtil.getListenerConfig("JMS-ESBListener").toString().startsWith("<listener busIdRef=\"OrderManagerService\" listenerClass=\"org.jboss.soa.esb.listeners.message.MessageAwareListener\" maxThreads=\"1\" name=\"JMS-ESBListener\" service-category=\"ABI_OrderManager\" service-description=\"ABI OrderManager Service\" service-name=\"ABI_OrderManager\">"));
assertTrue(configUtil.getGatewayConfig("FileGateway").toString().startsWith("<listener"));
assertTrue(configUtil.getActionConfig("OrderNotificationService", "print-after-transform").toString().startsWith("<action action=\"print-after-transform\""));
}
@@ -25,7 +25,7 @@
public void test110() throws ConfigurationException, IOException, SAXException {
ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("jboss-esb.110.xml"));
- assertTrue(configUtil.getListenerConfig("JMS-ESBListener").toString().startsWith("<listener listenerClass=\"org.jboss.soa.esb.listeners.message.MessageAwareListener\" maxThreads=\"1\" name=\"JMS-ESBListener\" service-category=\"ABI_OrderManager\" service-description=\"ABI OrderManager Service\" service-name=\"ABI_OrderManager\">"));
+ assertTrue(configUtil.getListenerConfig("JMS-ESBListener").toString().startsWith("<listener busIdRef=\"OrderManagerService\" listenerClass=\"org.jboss.soa.esb.listeners.message.MessageAwareListener\" maxThreads=\"1\" name=\"JMS-ESBListener\" service-category=\"ABI_OrderManager\" service-description=\"ABI OrderManager Service\" service-name=\"ABI_OrderManager\">"));
assertTrue(configUtil.getGatewayConfig("FileGateway").toString().startsWith("<listener"));
assertTrue(configUtil.getActionConfig("OrderNotificationService", "print-after-transform").toString().startsWith("<action action=\"print-after-transform\""));
}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/util/DeploymentArchiveUnitTest.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/tests/src/org/jboss/soa/esb/util/DeploymentArchiveUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/util/DeploymentArchiveUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/rosetta/tests/src/org/jboss/soa/esb/util/DeploymentArchiveUnitTest.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,62 @@
+/*
+ * 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.soa.esb.util;
+
+import junit.framework.TestCase;
+
+import java.io.IOException;
+import java.io.ByteArrayInputStream;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.Enumeration;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeploymentArchiveUnitTest extends TestCase {
+
+ public void test() throws IOException {
+ DeploymentArchive archive = new DeploymentArchive("testarchive");
+
+ archive.addEntry("//my/resource.txt", new ByteArrayInputStream("Hello ESB".getBytes()));
+ archive.addEntry("my/folder");
+ archive.addEntry(DeploymentArchive.class);
+
+ JarInputStream jarStream = archive.toInputStream();
+ JarEntry jarEntry;
+
+ // my/resource.txt
+ jarEntry = jarStream.getNextJarEntry();
+ assertEquals("my/resource.txt", jarEntry.getName());
+ assertEquals("Hello ESB", new String(StreamUtils.readStream(jarStream)));
+
+ // my/folder
+ jarEntry = jarStream.getNextJarEntry();
+ assertEquals("my/folder/", jarEntry.getName());
+ assertTrue(jarEntry.isDirectory());
+
+ // DeploymentArchive.class
+ jarEntry = jarStream.getNextJarEntry();
+ assertEquals("org/jboss/soa/esb/util/DeploymentArchive.class", jarEntry.getName());
+ }
+}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway)
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/build.xml 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,12 +0,0 @@
-<project name="Quickstart_http_gateway" default="run" basedir=".">
-
- <description>
- ${ant.project.name}
- ${line.separator}
- </description>
-
- <property name="additional.deploys" value="sales-web.xml" />
-
- <!-- Import the base Ant build script... -->
- <import file="../conf/base-build.xml"/>
-</project>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/build.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/build.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,12 @@
+<project name="Quickstart_http_gateway" default="run" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="sales-web.xml,sales-jboss-web.xml" />
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+</project>
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/deployment.xml 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,2 +0,0 @@
-<jbossesb-deployment>
-</jbossesb-deployment>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/deployment.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/deployment.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,2 @@
+<jbossesb-deployment>
+</jbossesb-deployment>
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jboss-esb.xml 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,47 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd"
- parameterReloadSecs="5">
-
- <providers>
- <http-provider name="http">
- <http-bus busid="ordermgt" />
- <http-bus busid="sales" webXml="/sales-web.xml"/>
- </http-provider>
- </providers>
-
- <services>
-
- <service category="OrderManagement" name="Incoming" description="" invmScope="GLOBAL">
- <listeners>
- <!-- Receives: http://<host>:<port>/ordermgt/in/* and returns some details of the request -->
- <http-listener name="1" busidref="ordermgt" urlPattern="/in/*" is-gateway="true" />
- </listeners>
- <actions mep="RequestResponse">
- <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
- </actions>
- </service>
-
- <service category="OrderManagement" name="Outgoing" description="" invmScope="GLOBAL">
- <listeners>
- <!-- Receives: http://<host>:<port>/ordermgt/out/* and returns an empty response -->
- <http-listener name="2" busidref="ordermgt" urlPattern="/out/*" is-gateway="true" />
- </listeners>
- <actions mep="OneWay">
- <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
- </actions>
- </service>
-
- <service category="Sales" name="List" description="" invmScope="GLOBAL">
- <listeners>
- <!-- Receives: http://<host>:<port>/sales/close/* but will be forced to
- authenticate because the "sales" bus has basic auth configured
- through the "sales-web.xml" -->
- <http-listener name="3" busidref="sales" urlPattern="/close/*" is-gateway="true" />
- </listeners>
- <actions mep="RequestResponse">
- <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
- </actions>
- </service>
- </services>
-
-</jbossesb>
\ No newline at end of file
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jboss-esb.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jboss-esb.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,51 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd"
+ parameterReloadSecs="5">
+
+ <providers>
+ <http-provider name="http">
+ <http-bus busid="ordermgt" />
+ <http-bus busid="sales" webXml="/sales-web.xml" jbossWebXml="/sales-jboss-web.xml"/>
+ </http-provider>
+ </providers>
+
+ <services>
+
+ <service category="OrderManagement" name="Incoming" description="" invmScope="GLOBAL">
+ <listeners>
+ <!-- Receives: http://<host>:<port>/ordermgt/in/* and returns some details of the
+ request as the response (mep="RequestResponse"). -->
+ <http-listener name="1" busidref="ordermgt" urlPattern="/in/*" is-gateway="true" />
+ </listeners>
+ <actions mep="RequestResponse">
+ <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
+ </actions>
+ </service>
+
+ <service category="OrderManagement" name="Outgoing" description="" invmScope="GLOBAL">
+ <listeners>
+ <!-- Receives: http://<host>:<port>/ordermgt/out/* and returns an empty
+ response (mep="OneWay") -->
+ <http-listener name="2" busidref="ordermgt" urlPattern="/out/*" is-gateway="true" />
+ </listeners>
+ <actions mep="OneWay">
+ <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
+ </actions>
+ </service>
+
+ <service category="Sales" name="List" description="" invmScope="GLOBAL">
+ <listeners>
+ <!-- Receives: http://<host>:<port>/sales-portal/close/* but will be forced to
+ authenticate because the "sales" bus has basic auth configured
+ through the "sales-web.xml". Also note that the web context
+ has been modified via the configured jboss-web.xml
+ (jbossWebXml="/sales-jboss-web.xml") -->
+ <http-listener name="3" busidref="sales" urlPattern="/close/*" is-gateway="true" />
+ </listeners>
+ <actions mep="RequestResponse">
+ <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
\ No newline at end of file
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jbossesb-properties.xml 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- JBoss, Home of Professional Open Source
- Copyright 2006, JBoss Inc., and others contributors as indicated
- by the @authors tag. All rights reserved.
- See the copyright.txt in the distribution for a
- full listing of individual contributors.
- This copyrighted material is made available to anyone wishing to use,
- modify, copy, or redistribute it subject to the terms and conditions
- of the GNU Lesser General Public License, v. 2.1.
- This program is distributed in the hope that it will be useful, but WITHOUT A
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License,
- v.2.1 along with this distribution; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
- (C) 2005-2006,
- @author JBoss Inc.
--->
-<!-- $Id: jbossesb-unittest-properties.xml $ -->
-<!--
- These options are described in the JBossESB manual.
- Defaults are provided here for convenience only.
-
- Please read through this file prior to using the system, and consider
- updating the specified entries.
--->
-<esb
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
- <properties name="core">
- <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
- <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
- <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
- <property name="jboss.esb.invm.scope.default" value="NONE"/>
- </properties>
- <properties name="registry">
- <property name="org.jboss.soa.esb.registry.queryManagerURI"
- value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
- <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
- value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
- <property name="org.jboss.soa.esb.registry.implementationClass"
- value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
- <property name="org.jboss.soa.esb.registry.factoryClass"
- value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
- <property name="org.jboss.soa.esb.registry.user"
- value="jbossesb"/>
- <property name="org.jboss.soa.esb.registry.password"
- value="password"/>
- <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
- <property name="org.jboss.soa.esb.scout.proxy.transportClass"
- value="org.apache.ws.scout.transport.RMITransport"/>
- </properties>
- <properties name="transports" depends="core">
- <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
- <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
- <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
- <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
- </properties>
- <properties name="connection">
- <property name="min-pool-size" value="5"/>
- <property name="max-pool=size" value="10"/>
- <property name="blocking-timeout-millis" value="5000"/>
- <property name="abandoned-connection-timeout" value="10000"/>
- <property name="abandoned-connection-time-interval" value="30000"/>
- </properties>
- <properties name="dbstore">
- <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
- <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
- <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
- <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
- <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
- <!--table managed by pool to test for valid connections - created by pool automatically -->
- <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
- <!-- # of milliseconds to timeout waiting for a connection from pool -->
- <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
- <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
- </properties>
- <properties name="messagerouting">
- <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
- </properties>
-</esb>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jbossesb-properties.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jbossesb-properties.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ <property name="jboss.esb.invm.scope.default" value="NONE"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jndi.properties 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,5 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-java.naming.factory.url.pkgs=org.jnp.interfaces
-
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jndi.properties)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/jndi.properties 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/juddi.properties 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,69 +0,0 @@
-# jUDDI Registry Properties (used by RegistryServer)
-# see http://www.juddi.org for more information
-
-# The UDDI Operator Name
-juddi.operatorName = jUDDI.org
-
-# The i18n locale default codes
-juddi.i18n.languageCode = en
-juddi.i18n.countryCode = US
-
-# The UDDI DiscoveryURL Prefix
-juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
-
-# The UDDI Operator Contact Email Address
-juddi.operatorEmailAddress = admin at juddi.org
-
-# The maximum name size and maximum number
-# of name elements allows in several of the
-# FindXxxx and SaveXxxx UDDI functions.
-juddi.maxNameLength=255
-juddi.maxNameElementsAllowed=5
-
-# The maximum number of UDDI artifacts allowed
-# per publisher. A value of '-1' indicates any
-# number of artifacts is valid (These values can be
-# overridden at the individual publisher level).
-juddi.maxBusinessesPerPublisher=25
-juddi.maxServicesPerBusiness=20
-juddi.maxBindingsPerService=10
-juddi.maxTModelsPerPublisher=100
-
-# jUDDI Authentication module to use
-juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
-
-# jUDDI DataStore module currently to use
-juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
-
-# use a dataSource (if set to false a direct
-# jdbc connection will be used.
-juddi.isUseDataSource=false
-juddi.jdbcDriver=com.mysql.jdbc.Driver
-juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
-juddi.jdbcUsername=root
-juddi.jdbcPassword=admin
-# jUDDI DataSource to use
-# juddi.dataSource=java:comp/env/jdbc/MySqlDS
-
-# jUDDI UUIDGen implementation to use
-juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
-
-# jUDDI Cryptor implementation to use
-juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
-
-# jUDDI Validator to use
-juddi.validator=org.apache.juddi.validator.DefaultValidator
-
-# jUDDI Proxy Properties (used by RegistryProxy)
-juddi.proxy.adminURL = http://localhost:8080/juddi/admin
-juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
-juddi.proxy.publishURL = http://localhost:8080/juddi/publish
-juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
-juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
-juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
-
-# JNDI settings (used by RMITransport)
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/juddi.properties)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/juddi.properties 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/lib (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/lib)
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/log4j.xml 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Log4j Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
-
-<!--
- | 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">
- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
- <param name="Target" value="System.out"/>
- <param name="Threshold" value="INFO"/>
-
- <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>
-
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
- <!-- A size based file rolling appender -->
- <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
- <param name="File" value="./listener.log"/>
- <param name="Append" value="false"/>
- <param name="MaxFileSize" value="500KB"/>
- <param name="MaxBackupIndex" value="1"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
- </layout>
- </appender>
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jboss">
- <priority value="WARN"/>
- </category>
- <category name="org.jboss.soa.esb">
- <priority value="ERROR"/>
- </category>
- <category name="org.jboss.internal.soa.esb">
- <priority value="ERROR"/>
- </category>
- <category name="org.apache">
- <priority value="ERROR"/>
- </category>
- <category name="quickstart">
- <priority value="DEBUG"/>
- </category>
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <appender-ref ref="CONSOLE"/>
- <appender-ref ref="FILE"/>
- </root>
-
-</log4j:configuration>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/log4j.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/log4j.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | 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">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+
+ <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>
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A size based file rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="./listener.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="quickstart">
+ <priority value="DEBUG"/>
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/readme.txt 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,25 +0,0 @@
-Overview:
-=========
- The purpose of the http_gateway quickstart sample is to demonstarte how to
- configue a http gateway to pass the http request into ESB service.
-
-
-Running this quickstart:
-========================
- Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
- and a more detailed descripton of the different ways to run the quickstarts.
-
-To Run '.esb' archive mode:
-===========================
- 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
- 2. Open the web brower and send http requests to the following addresses. Be sure to
- check the Server console after executing each request:
- a) http://localhost:8080/ordermgt/in/ - Will be routed to the OrderManagement:Incoming
- service. Will return some details about the request.
- b) http://localhost:8080/ordermgt/out/ - Will be routed to the OrderManagement:Outgoing
- service. Will return an empty response as this service is configured with a
- "OneWay" mep.
- c) http://localhost:8080/sales/close/ - Will be forced to authenticate the request because
- the "sales" bus provider has configured a user web.xml (sales-web.xml), which has BASIC
- Auth configured.
- 3. In this folder ("Window1"), type 'ant undeploy'.
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/readme.txt)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/readme.txt 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,25 @@
+Overview:
+=========
+ The purpose of the http_gateway quickstart sample is to demonstarte how to
+ configue a http gateway to pass the http request into ESB service.
+
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+ and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open the web brower and send http requests to the following addresses. Be sure to
+ check the Server console after executing each request:
+ a) http://localhost:8080/ordermgt/in/ - Will be routed to the OrderManagement:Incoming
+ service. Will return some details about the request.
+ b) http://localhost:8080/ordermgt/out/ - Will be routed to the OrderManagement:Outgoing
+ service. Will return an empty response as this service is configured with a
+ "OneWay" mep.
+ c) http://localhost:8080/sales-portal/close/ - Will be forced to authenticate the request because
+ the "sales" bus provider has configured a user web.xml (sales-web.xml), which has BASIC
+ Auth configured.
+ 3. In this folder ("Window1"), type 'ant undeploy'.
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-jboss-web.xml (from rev 25712, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-jboss-web.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-jboss-web.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-jboss-web.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<jboss-web>
+ <context-root>/sales-portal</context-root>
+</jboss-web>
\ No newline at end of file
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-web.xml 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- version="2.5">
-
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>Secure Content</web-resource-name>
- <url-pattern>/close/*</url-pattern>
- </web-resource-collection>
- <auth-constraint>
- <role-name>JBossAdmin</role-name>
- </auth-constraint>
- <user-data-constraint>
- <transport-guarantee>NONE</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
-
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>Sales Service</realm-name>
- </login-config>
-
- <security-role>
- <description>The role required to access restricted content</description>
- <role-name>JBossAdmin</role-name>
- </security-role>
-
-</web-app>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-web.xml)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/sales-web.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Secure Content</web-resource-name>
+ <url-pattern>/close/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>JBossAdmin</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>Sales Service</realm-name>
+ </login-config>
+
+ <security-role>
+ <description>The role required to access restricted content</description>
+ <role-name>JBossAdmin</role-name>
+ </security-role>
+
+</web-app>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart)
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway)
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java 2009-03-15 12:53:37 UTC (rev 25653)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.httpgateway;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Arrays;
-
-import org.jboss.soa.esb.actions.AbstractActionLifecycle;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.listeners.gateway.HttpMessageComposer;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.Service;
-
-public class MyAction extends AbstractActionPipelineProcessor {
-
- protected ConfigTree _config;
- private Service service;
-
- public MyAction(ConfigTree config) {
- _config = config;
- service = new Service(_config.getParent().getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG), _config.getParent().getAttribute(ListenerTagNames.SERVICE_NAME_TAG));
- }
-
- public Message process(Message message) throws ActionProcessingException {
-
- System.out.println("&&&&&&&&&&&&&&&& MyAction &&&&&&&&&&&&&&&&&&&&&");
- System.out.println("");
- System.out.println("Service: " + service);
- System.out.println("");
- System.out.println("------------Http Request Info-------------------");
- Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
- requestInfo.get("Method");
- Iterator<String> infoIte = requestInfo.keySet().iterator();
- while(infoIte.hasNext()) {
- String key = infoIte.next();
- System.out.println(key + " : " + requestInfo.get(key));
- }
-
-
- System.out.println("------------Http Prameter Map-------------------");
- Map paraMap = (Map) message.getProperties().getProperty(HttpMessageComposer.HTTP_REQUEST_PARAMETER_MAP);
-
- if (paraMap != null) {
- Iterator<String> paraIte = paraMap.keySet().iterator();
- while(paraIte.hasNext()) {
- String key = paraIte.next();
- System.out.println(key + " : " + paraMap.get(key));
- }
- }
-
-
- System.out.println("------------Http Request body -------------------");
- System.out.println(new String((byte[])message.getBody().get()));
-
- System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
-
- StringBuilder response = new StringBuilder();
-
- response.append("Service: " + service + "\n\n");
- response.append("pathInfo: " + requestInfo.get("pathInfo") + "\n");
- String[] pathInfoTokens = (String[]) requestInfo.get("pathInfoTokens");
- if(pathInfoTokens != null) {
- response.append("pathInfoTokens: " + Arrays.asList(requestInfo.get("pathInfoTokens")).toString() + "\n");
- }
- response.append("params: " + paraMap + "\n");
-
- message.getBody().add(response.toString());
-
- return message;
-
- }
-}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.httpgateway;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Arrays;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.listeners.gateway.HttpMessageComposer;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.Service;
+
+public class MyAction extends AbstractActionPipelineProcessor {
+
+ protected ConfigTree _config;
+ private Service service;
+
+ public MyAction(ConfigTree config) {
+ _config = config;
+ service = new Service(_config.getParent().getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG), _config.getParent().getAttribute(ListenerTagNames.SERVICE_NAME_TAG));
+ }
+
+ public Message process(Message message) throws ActionProcessingException {
+
+ System.out.println("&&&&&&&&&&&&&&&& MyAction &&&&&&&&&&&&&&&&&&&&&");
+ System.out.println("");
+ System.out.println("Service: " + service);
+ System.out.println("");
+ System.out.println("------------Http Request Info-------------------");
+ Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
+ requestInfo.get("Method");
+ Iterator<String> infoIte = requestInfo.keySet().iterator();
+ while(infoIte.hasNext()) {
+ String key = infoIte.next();
+ System.out.println(key + " : " + requestInfo.get(key));
+ }
+
+
+ System.out.println("------------Http Prameter Map-------------------");
+ Map paraMap = (Map) message.getProperties().getProperty(HttpMessageComposer.HTTP_REQUEST_PARAMETER_MAP);
+
+ if (paraMap != null) {
+ Iterator<String> paraIte = paraMap.keySet().iterator();
+ while(paraIte.hasNext()) {
+ String key = paraIte.next();
+ System.out.println(key + " : " + paraMap.get(key));
+ }
+ }
+
+
+ System.out.println("------------Http Request body -------------------");
+ System.out.println(new String((byte[])message.getBody().get()));
+
+ System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+
+ StringBuilder response = new StringBuilder();
+
+ response.append("Service: " + service + "\n\n");
+ response.append("pathInfo: " + requestInfo.get("pathInfo") + "\n");
+ String[] pathInfoTokens = (String[]) requestInfo.get("pathInfoTokens");
+ if(pathInfoTokens != null) {
+ response.append("pathInfoTokens: " + Arrays.asList(requestInfo.get("pathInfoTokens")).toString() + "\n");
+ }
+ response.append("params: " + paraMap + "\n");
+
+ message.getBody().add(response.toString());
+
+ return message;
+
+ }
+}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/TestUtils.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/TestUtils.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/TestUtils.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -40,7 +40,7 @@
final File file = new File(fileName) ;
long startTime = System.currentTimeMillis();
- while(System.currentTimeMillis() < startTime + 10000) {
+ while(System.currentTimeMillis() < startTime + 30000) {
if(file.exists()) {
return true;
}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/epr/LogicalEPRUnitTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/epr/LogicalEPRUnitTest.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/epr/LogicalEPRUnitTest.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -26,7 +26,7 @@
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.testutils.FileUtil;
import org.jboss.soa.esb.testutils.JMSUtil;
-import org.jboss.soa.esb.util.DeploymentArchive;
+import org.jboss.soa.esb.util.TestDeploymentArchive;
import org.jboss.test.JBossTestCase;
import java.io.File;
@@ -86,7 +86,7 @@
}
public static Test suite() throws Exception {
- DeploymentArchive deployment = new DeploymentArchive("LogicalEPRUnitTest.esb");
+ TestDeploymentArchive deployment = new TestDeploymentArchive("LogicalEPRUnitTest.esb");
String jmsImpl = System.getProperty("org.jboss.esb.jmsimpl");
if (jmsImpl == null) {
jmsImpl = "jbm";
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/jms/JmsGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/jms/JmsGatewayListenerUnitTest.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/jms/JmsGatewayListenerUnitTest.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -20,7 +20,7 @@
package org.jboss.soa.esb.jms;
import junit.framework.Test;
-import org.jboss.soa.esb.util.DeploymentArchive;
+import org.jboss.soa.esb.util.TestDeploymentArchive;
import org.jboss.soa.esb.testutils.JMSUtil;
import org.jboss.test.JBossTestCase;
@@ -31,7 +31,7 @@
*/
public class JmsGatewayListenerUnitTest extends JBossTestCase {
- DeploymentArchive deployment;
+ TestDeploymentArchive deployment;
public JmsGatewayListenerUnitTest(String name) {
super(name);
@@ -64,7 +64,7 @@
}
private static void createEsbDeployment() {
- DeploymentArchive deployment = new DeploymentArchive("JmsGatewayListenerUnitTest.esb");
+ TestDeploymentArchive deployment = new TestDeploymentArchive("JmsGatewayListenerUnitTest.esb");
deployment.addEntry("META-INF/jboss-esb.xml", JmsGatewayListenerUnitTest.class.getResourceAsStream("jboss-esb.xml"));
deployment.addEntry("META-INF/deployment.xml", JmsGatewayListenerUnitTest.class.getResourceAsStream("deployment.xml"));
Deleted: labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/DeploymentArchive.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/DeploymentArchive.java 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/DeploymentArchive.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,160 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.util;
-
-import junit.framework.TestCase;
-
-import java.util.zip.ZipOutputStream;
-import java.util.zip.ZipEntry;
-import java.util.Map;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.io.*;
-
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.apache.log4j.Logger;
-
-/**
- * Deployment archive creator.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class DeploymentArchive {
-
- private static Logger logger = Logger.getLogger(DeploymentArchive.class);
- private static final String PROP_ORG_JBOSS_ESB_DEPLOY_DIR = "jbosstest.deploy.dir";
-
- private File archiveFile;
- private LinkedHashMap<String, byte[]> entries = new LinkedHashMap<String, byte[]>();
-
- /**
- * Create the named archive in the folder denoted by the "jbosstest.deploy.dir"
- * System property.
- *
- * @param name Archive name.
- */
- public DeploymentArchive(String name) {
- this(getParentFolder(name), name);
- }
-
- /**
- * Create the named archive in the folder specified by the parentFolder arg.
- *
- * @param parentFolder Archive parent folder.
- * @param name Archive name.
- */
- public DeploymentArchive(File parentFolder, String name) {
- AssertArgument.isNotNull(parentFolder, "parentFolder");
- AssertArgument.isNotNullAndNotEmpty(name, "name");
-
- if(!parentFolder.exists()) {
- TestCase.fail("Cannot create archive '" + name + "'. Parent folder '" + parentFolder.getAbsolutePath() + "' does not exist.");
- }
- archiveFile = new File(parentFolder, name);
- }
-
- private static File getParentFolder(String name) {
- String deployTargetFolder = System.getProperty(PROP_ORG_JBOSS_ESB_DEPLOY_DIR);
- if(deployTargetFolder == null) {
- TestCase.fail("Cannot create archive '" + name + "'. Parent folder must be specified in System property '" + PROP_ORG_JBOSS_ESB_DEPLOY_DIR + "'.");
- }
- return new File(deployTargetFolder);
- }
-
- public void addEntry(String path, InputStream data) {
- AssertArgument.isNotNullAndNotEmpty(path, "path");
- AssertArgument.isNotNull(data, "data");
-
- try {
- entries.put(path, StreamUtils.readStream(data));
- } finally {
- try {
- data.close();
- } catch (IOException e) {
- TestCase.fail("Unable to close input stream for archive entry '" + path + "'.");
- }
- }
- }
-
- public void addEntry(String path, String resClasspathLocation) {
- InputStream resource = getClass().getResourceAsStream(resClasspathLocation);
- if(resource == null) {
- TestCase.fail("Unable to close input stream for archive entry '" + path + "'.");
- } else {
- addEntry(path, resource);
- }
- }
-
- public void addEntry(Class clazz) {
- String className = clazz.getName();
-
- className = className.replace('.', '/') + ".class";
- addEntry(className, "/" + className);
- }
-
- /**
- * Create an archive of the specified name and containing entries
- * for the data contained in the streams supplied entries arg.
- * specifying the entry name and the value is a InputStream containing
- * the entry data.
- */
- public void create() {
- ZipOutputStream archiveStream = null;
- try {
- archiveStream = new ZipOutputStream(new FileOutputStream(archiveFile));
- } catch (FileNotFoundException e) {
- TestCase.fail("Unable to open output stream to archive file '" + archiveFile.getAbsolutePath() + "'.");
- }
-
- try {
- writeEntriesToArchive(archiveStream);
- logger.info("Deployment archive '" + archiveFile.getAbsolutePath() + "' created.");
- } finally {
- try {
- archiveStream.close();
- } catch (IOException e) {
- TestCase.fail("Unable to close output stream to archive file '" + archiveFile.getAbsolutePath() + "'.");
- }
- }
- }
-
- /**
- * Remove the archive.
- */
- public void remove() {
- if(archiveFile.exists()) {
- archiveFile.delete();
- }
- }
-
- private void writeEntriesToArchive(ZipOutputStream archiveStream) {
- Set<Map.Entry<String, byte[]>> entrySet = entries.entrySet();
- for (Map.Entry<String, byte[]> entry : entrySet) {
- try {
- archiveStream.putNextEntry(new ZipEntry(entry.getKey()));
- archiveStream.write(entry.getValue());
- archiveStream.closeEntry();
- } catch (IOException e) {
- TestCase.fail("Unable to create archive entry for '" + archiveFile.getAbsolutePath() + "': " + e.getMessage());
- }
- }
- }
-}
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/TestDeploymentArchive.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/qa/junit/src/org/jboss/soa/esb/util/TestDeploymentArchive.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/TestDeploymentArchive.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/junit/src/org/jboss/soa/esb/util/TestDeploymentArchive.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.util;
+
+import junit.framework.TestCase;
+
+import java.util.zip.ZipOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.io.*;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * Deployment archive creator.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class TestDeploymentArchive {
+
+ private static Logger logger = Logger.getLogger(TestDeploymentArchive.class);
+ private static final String PROP_ORG_JBOSS_ESB_DEPLOY_DIR = "jbosstest.deploy.dir";
+
+ private File archiveFile;
+ private LinkedHashMap<String, byte[]> entries = new LinkedHashMap<String, byte[]>();
+
+ /**
+ * Create the named archive in the folder denoted by the "jbosstest.deploy.dir"
+ * System property.
+ *
+ * @param name Archive name.
+ */
+ public TestDeploymentArchive(String name) {
+ this(getParentFolder(name), name);
+ }
+
+ /**
+ * Create the named archive in the folder specified by the parentFolder arg.
+ *
+ * @param parentFolder Archive parent folder.
+ * @param name Archive name.
+ */
+ public TestDeploymentArchive(File parentFolder, String name) {
+ AssertArgument.isNotNull(parentFolder, "parentFolder");
+ AssertArgument.isNotNullAndNotEmpty(name, "name");
+
+ if(!parentFolder.exists()) {
+ TestCase.fail("Cannot create archive '" + name + "'. Parent folder '" + parentFolder.getAbsolutePath() + "' does not exist.");
+ }
+ archiveFile = new File(parentFolder, name);
+ }
+
+ private static File getParentFolder(String name) {
+ String deployTargetFolder = System.getProperty(PROP_ORG_JBOSS_ESB_DEPLOY_DIR);
+ if(deployTargetFolder == null) {
+ TestCase.fail("Cannot create archive '" + name + "'. Parent folder must be specified in System property '" + PROP_ORG_JBOSS_ESB_DEPLOY_DIR + "'.");
+ }
+ return new File(deployTargetFolder);
+ }
+
+ public void addEntry(String path, InputStream data) {
+ AssertArgument.isNotNullAndNotEmpty(path, "path");
+ AssertArgument.isNotNull(data, "data");
+
+ try {
+ entries.put(path, StreamUtils.readStream(data));
+ } finally {
+ try {
+ data.close();
+ } catch (IOException e) {
+ TestCase.fail("Unable to close input stream for archive entry '" + path + "'.");
+ }
+ }
+ }
+
+ public void addEntry(String path, String resClasspathLocation) {
+ InputStream resource = getClass().getResourceAsStream(resClasspathLocation);
+ if(resource == null) {
+ TestCase.fail("Unable to close input stream for archive entry '" + path + "'.");
+ } else {
+ addEntry(path, resource);
+ }
+ }
+
+ public void addEntry(Class clazz) {
+ String className = clazz.getName();
+
+ className = className.replace('.', '/') + ".class";
+ addEntry(className, "/" + className);
+ }
+
+ /**
+ * Create an archive of the specified name and containing entries
+ * for the data contained in the streams supplied entries arg.
+ * specifying the entry name and the value is a InputStream containing
+ * the entry data.
+ */
+ public void create() {
+ ZipOutputStream archiveStream = null;
+ try {
+ archiveStream = new ZipOutputStream(new FileOutputStream(archiveFile));
+ } catch (FileNotFoundException e) {
+ TestCase.fail("Unable to open output stream to archive file '" + archiveFile.getAbsolutePath() + "'.");
+ }
+
+ try {
+ writeEntriesToArchive(archiveStream);
+ logger.info("Deployment archive '" + archiveFile.getAbsolutePath() + "' created.");
+ } finally {
+ try {
+ archiveStream.close();
+ } catch (IOException e) {
+ TestCase.fail("Unable to close output stream to archive file '" + archiveFile.getAbsolutePath() + "'.");
+ }
+ }
+ }
+
+ /**
+ * Remove the archive.
+ */
+ public void remove() {
+ if(archiveFile.exists()) {
+ archiveFile.delete();
+ }
+ }
+
+ private void writeEntriesToArchive(ZipOutputStream archiveStream) {
+ Set<Map.Entry<String, byte[]>> entrySet = entries.entrySet();
+ for (Map.Entry<String, byte[]> entry : entrySet) {
+ try {
+ archiveStream.putNextEntry(new ZipEntry(entry.getKey()));
+ archiveStream.write(entry.getValue());
+ archiveStream.closeEntry();
+ } catch (IOException e) {
+ TestCase.fail("Unable to create archive entry for '" + archiveFile.getAbsolutePath() + "': " + e.getMessage());
+ }
+ }
+ }
+}
Modified: labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/build.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/build.xml 2009-06-11 10:13:28 UTC (rev 26924)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/build.xml 2009-06-11 10:15:18 UTC (rev 26925)
@@ -1,501 +1,507 @@
<?xml version="1.0"?>
<project name="JUnit" default="test" basedir=".">
- <property file="quickstarts.properties"/>
+ <property file="quickstarts.properties"/>
- <property name="product.dir" location="../../product"/>
- <property name="product.build" location="${product.dir}/build"/>
- <property name="org.jboss.esb.test.quickstarts.dir" location="${product.build}/jbossesb/samples/quickstarts"/>
- <property name="coverage" location="${product.build}/tests/coverage"/>
- <property name="qa.dir" location=".."/>
- <property name="qa.build" location="${qa.dir}/build"/>
- <property name="qa.build.reports" location="${qa.build}/reports"/>
- <property name="qa.lib" location="${qa.dir}/lib"/>
- <property name="qa.build.stylesheets" location="${qa.build}/stylesheets"/>
- <property name="qa.source.stylesheets" location="${qa.dir}/stylesheets"/>
- <property name="qa.quickstarts.src" location="src"/>
- <property name="qa.quickstarts.build" location="${qa.build}/quickstarts"/>
- <property name="qa.quickstarts.build.lib" location="${qa.quickstarts.build}/lib"/>
- <property name="qa.quickstarts.classes" location="${qa.quickstarts.build}/classes"/>
- <property name="qa.quickstarts.resources" location="resources"/>
- <property name="qa.quickstarts.report" location="${qa.quickstarts.build}/report"/>
- <property name="qa.quickstarts.memory" value="128m"/>
+ <property name="product.dir" location="../../product"/>
+ <property name="product.build" location="${product.dir}/build"/>
+ <property name="org.jboss.esb.test.quickstarts.dir" location="${product.build}/jbossesb/samples/quickstarts"/>
+ <property name="coverage" location="${product.build}/tests/coverage"/>
+ <property name="qa.dir" location=".."/>
+ <property name="qa.build" location="${qa.dir}/build"/>
+ <property name="qa.build.reports" location="${qa.build}/reports"/>
+ <property name="qa.lib" location="${qa.dir}/lib"/>
+ <property name="qa.build.stylesheets" location="${qa.build}/stylesheets"/>
+ <property name="qa.source.stylesheets" location="${qa.dir}/stylesheets"/>
+ <property name="qa.quickstarts.src" location="src"/>
+ <property name="qa.quickstarts.build" location="${qa.build}/quickstarts"/>
+ <property name="qa.quickstarts.build.lib" location="${qa.quickstarts.build}/lib"/>
+ <property name="qa.quickstarts.classes" location="${qa.quickstarts.build}/classes"/>
+ <property name="qa.quickstarts.resources" location="resources"/>
+ <property name="qa.quickstarts.report" location="${qa.quickstarts.build}/report"/>
+ <property name="qa.quickstarts.memory" value="128m"/>
- <property name="qa.quickstarts.server.home" location="${org.jboss.esb.server.home}"/>
+ <property name="qa.quickstarts.server.home" location="${org.jboss.esb.server.home}"/>
- <property name="org.jboss.soa.esb.paramsRepository.file.root" location="src"/>
+ <property name="org.jboss.soa.esb.paramsRepository.file.root" location="src"/>
- <property name="junit.jar" location="${product.dir}/../testlib/junit-4.1.jar"/>
-
- <import file="../base-cp.xml"/>
-
- <macrodef name="runant">
- <attribute name="target"/>
- <attribute name="failonerror" default="true"/>
- <attribute name="resultproperty" default="product.java.resultproperty"/>
- <sequential>
- <java classname="org.apache.tools.ant.launch.Launcher"
- classpath="${ant.library.dir}/ant-launcher.jar"
- fork="true" failonerror="@{failonerror}"
- resultproperty="@{resultproperty}">
- <sysproperty key="ant.home" value="${ant.home}"/>
- <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
- <sysproperty key="org.jboss.esb.properties" value="${org.jboss.esb.properties}"/>
- <arg value="-cp"/>
- <arg value="${junit.jar}"/>
- <arg value="-f"/>
- <arg value="${ant.file}"/>
- <arg value="@{target}"/>
- </java>
- </sequential>
- </macrodef>
+ <property name="junit.jar" location="${product.dir}/../testlib/junit-4.1.jar"/>
- <path id="qa.quickstarts.cp">
- <fileset dir="${product.dir}/services/jbossesb/build">
- <include name="**/*.jar"/>
- </fileset>
- <fileset dir="${product.dir}/services/jbpm/lib/ext">
- <include name="jbpm-ant.jar"/>
- </fileset>
- <!-- include qs specific jars -->
- <fileset dir="${org.jboss.esb.test.quickstarts.dir}">
- <include name="bpm_orchestration1/lib/**/*.jar"/>
- <include name="dynamic_router/lib/**/*.jar"/>
- <include name="fun_cbr/lib/**/*.jar"/>
- <include name="helloworld/lib/**/*.jar"/>
- <include name="helloworld_action/lib/**/*.jar"/>
- <include name="helloworld_file_action/lib/**/*.jar"/>
- <include name="helloworld_sql_action/lib/**/*.jar"/>
- <include name="recipient_list/lib/**/*.jar"/>
- <include name="scripting_groovy/lib/**/*.jar"/>
- <include name="simple_cbr/lib/**/*.jar"/>
- <include name="spring_aop/lib/**/*.jar"/>
- <include name="spring_helloworld/lib/**/*.jar"/>
- <include name="spring_jpetstore/lib/**/*.jar"/>
- <include name="static_router/lib/**/*.jar"/>
- <include name="transform_CSV2XML/lib/**/*.jar"/>
- <include name="transform_EDI2XML_Groovy_XSLT/lib/**/*.jar"/>
- <include name="transform_XML2POJO/lib/**/*.jar"/>
- <include name="transform_XML2XML_date_manipulation/lib/**/*.jar"/>
- <include name="transform_XML2XML_simple/lib/**/*.jar"/>
- <include name="wiretap/lib/**/*.jar"/>
- </fileset>
+ <import file="../base-cp.xml"/>
- <!-- include qs specific classes -->
- <dirset dir="${org.jboss.esb.test.quickstarts.dir}">
- <include name="bpm_orchestration1/build/classes"/>
- <include name="bpm_orchestration2/build/classes"/>
- <include name="bpm_orchestration3/build/classes"/>
- <include name="business_rules_service/build/classes"/>
- <include name="custom_action/build/classes"/>
- <include name="deadletter/build/classes"/>
- <include name="dynamic_router/build/classes"/>
- <include name="exceptions_faults/build/classes"/>
- <include name="fun_cbr/build/classes"/>
- <include name="groovy_gateway/build/classes"/>
- <include name="helloworld/build/classes"/>
- <include name="helloworld_action/build/classes"/>
- <include name="helloworld_file_action/build/classes"/>
- <include name="helloworld_file_notifier/build/classes"/>
- <include name="helloworld_sql_action/build/classes"/>
- <include name="jms_secured/build/classes"/>
- <include name="jms_topic/build/classes"/>
- <include name="load_generator/build/classes"/>
- <include name="load_generator/load_generator_classes"/>
- <include name="messagefilter/build/classes"/>
- <include name="messagestore/build/classes"/>
- <include name="native_client/build/classes"/>
- <include name="recipient_list/build/classes"/>
- <include name="scheduled_services/build/classes"/>
- <include name="scripting_groovy/build/classes"/>
- <include name="simple_cbr/build/classes"/>
- <include name="spring_aop/build/classes"/>
- <include name="spring_helloworld/build/classes"/>
- <include name="spring_jpetstore/build/classes"/>
- <include name="static_router/build/classes"/>
- <include name="transform_CSV2XML/build/classes"/>
- <include name="transform_EDI2XML_Groovy_XSLT/build/classes"/>
- <include name="transform_XML2POJO/build/classes"/>
- <include name="transform_XML2XML_date_manipulation/build/classes"/>
- <include name="transform_XML2XML_simple/build/classes"/>
- <include name="webservice_consumer1/build/classes"/>
- <include name="webservice_consumer2/build/classes"/>
- <include name="webservice_producer/build/classes"/>
- <include name="wiretap/build/classes"/>
- </dirset>
- <pathelement location="${qa.quickstarts.resources}"/>
- <path refid="base.cp"/>
- </path>
+ <macrodef name="runant">
+ <attribute name="target"/>
+ <attribute name="failonerror" default="true"/>
+ <attribute name="resultproperty" default="product.java.resultproperty"/>
+ <sequential>
+ <java classname="org.apache.tools.ant.launch.Launcher"
+ classpath="${ant.library.dir}/ant-launcher.jar"
+ fork="true" failonerror="@{failonerror}"
+ resultproperty="@{resultproperty}">
+ <sysproperty key="ant.home" value="${ant.home}"/>
+ <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
+ <sysproperty key="org.jboss.esb.properties" value="${org.jboss.esb.properties}"/>
+ <arg value="-cp"/>
+ <arg value="${junit.jar}"/>
+ <arg value="-f"/>
+ <arg value="${ant.file}"/>
+ <arg value="@{target}"/>
+ </java>
+ </sequential>
+ </macrodef>
- <path id="qa.quickstarts.emma.cp">
- <fileset dir="${coverage}/all" includes="jbossesb-instr-all.jar"/>
- <path refid="base.cp"/>
- </path>
-
- <macrodef name="exec-quickstart">
- <attribute name="quickstart"/>
- <attribute name="target"/>
- <sequential>
- <ant antfile="build.xml"
- dir="${org.jboss.esb.test.quickstarts.dir}/@{quickstart}"
- target="@{target}" inheritAll="false">
- <property name="quickstart.jbossesb.ftp.hostname" value="${org.jboss.esb.test.ftp.hostname}"/>
- <property name="quickstart.jbossesb.ftp.username" value="${org.jboss.esb.test.ftp.user}"/>
- <property name="quickstart.jbossesb.ftp.password" value="${org.jboss.esb.test.ftp.pwd}"/>
- <property name="quickstart.jbossesb.ftp.directory" value="${org.jboss.esb.test.ftp.dir}"/>
- <property name="org.jboss.esb.server.home" location="${qa.quickstarts.server.home}"/>
- <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
- </ant>
- </sequential>
- </macrodef>
+ <path id="qa.quickstarts.cp">
+ <fileset dir="${product.dir}/services/jbossesb/build">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="${product.dir}/services/jbpm/lib/ext">
+ <include name="jbpm-ant.jar"/>
+ </fileset>
+ <!-- include qs specific jars -->
+ <fileset dir="${org.jboss.esb.test.quickstarts.dir}">
+ <include name="bpm_orchestration1/lib/**/*.jar"/>
+ <include name="dynamic_router/lib/**/*.jar"/>
+ <include name="fun_cbr/lib/**/*.jar"/>
+ <include name="helloworld/lib/**/*.jar"/>
+ <include name="helloworld_action/lib/**/*.jar"/>
+ <include name="helloworld_file_action/lib/**/*.jar"/>
+ <include name="helloworld_sql_action/lib/**/*.jar"/>
+ <include name="recipient_list/lib/**/*.jar"/>
+ <include name="scripting_groovy/lib/**/*.jar"/>
+ <include name="simple_cbr/lib/**/*.jar"/>
+ <include name="spring_aop/lib/**/*.jar"/>
+ <include name="spring_helloworld/lib/**/*.jar"/>
+ <include name="spring_jpetstore/lib/**/*.jar"/>
+ <include name="static_router/lib/**/*.jar"/>
+ <include name="transform_CSV2XML/lib/**/*.jar"/>
+ <include name="transform_EDI2XML_Groovy_XSLT/lib/**/*.jar"/>
+ <include name="transform_XML2POJO/lib/**/*.jar"/>
+ <include name="transform_XML2XML_date_manipulation/lib/**/*.jar"/>
+ <include name="transform_XML2XML_simple/lib/**/*.jar"/>
+ <include name="wiretap/lib/**/*.jar"/>
+ </fileset>
- <target name="init">
- <available property="quickstarts.exist" type="dir"
- file="${org.jboss.esb.test.quickstarts.dir}"/>
- </target>
+ <!-- include qs specific classes -->
+ <dirset dir="${org.jboss.esb.test.quickstarts.dir}">
+ <include name="bpm_orchestration1/build/classes"/>
+ <include name="bpm_orchestration2/build/classes"/>
+ <include name="bpm_orchestration3/build/classes"/>
+ <include name="business_rules_service/build/classes"/>
+ <include name="custom_action/build/classes"/>
+ <include name="deadletter/build/classes"/>
+ <include name="dynamic_router/build/classes"/>
+ <include name="exceptions_faults/build/classes"/>
+ <include name="fun_cbr/build/classes"/>
+ <include name="groovy_gateway/build/classes"/>
+ <include name="helloworld/build/classes"/>
+ <include name="helloworld_action/build/classes"/>
+ <include name="helloworld_file_action/build/classes"/>
+ <include name="helloworld_file_notifier/build/classes"/>
+ <include name="helloworld_sql_action/build/classes"/>
+ <include name="http_gateway/build/classes"/>
+ <include name="jms_secured/build/classes"/>
+ <include name="jms_topic/build/classes"/>
+ <include name="load_generator/build/classes"/>
+ <include name="load_generator/load_generator_classes"/>
+ <include name="messagefilter/build/classes"/>
+ <include name="messagestore/build/classes"/>
+ <include name="native_client/build/classes"/>
+ <include name="recipient_list/build/classes"/>
+ <include name="scheduled_services/build/classes"/>
+ <include name="scripting_groovy/build/classes"/>
+ <include name="simple_cbr/build/classes"/>
+ <include name="spring_aop/build/classes"/>
+ <include name="spring_helloworld/build/classes"/>
+ <include name="spring_jpetstore/build/classes"/>
+ <include name="static_router/build/classes"/>
+ <include name="transform_CSV2XML/build/classes"/>
+ <include name="transform_EDI2XML_Groovy_XSLT/build/classes"/>
+ <include name="transform_XML2POJO/build/classes"/>
+ <include name="transform_XML2XML_date_manipulation/build/classes"/>
+ <include name="transform_XML2XML_simple/build/classes"/>
+ <include name="webservice_consumer1/build/classes"/>
+ <include name="webservice_consumer2/build/classes"/>
+ <include name="webservice_producer/build/classes"/>
+ <include name="wiretap/build/classes"/>
+ </dirset>
+ <pathelement location="${qa.quickstarts.resources}"/>
+ <path refid="base.cp"/>
+ </path>
- <target name="clean" depends="init, clean-esb"/>
+ <path id="qa.quickstarts.emma.cp">
+ <fileset dir="${coverage}/all" includes="jbossesb-instr-all.jar"/>
+ <path refid="base.cp"/>
+ </path>
- <target name="one-test">
- <runant target="internal-one-test"/>
- </target>
-
- <target name="internal-one-test" depends="compile, prompt, execute"/>
-
- <target name="test">
- <runant target="ci-test"/>
- </target>
-
- <target name="ci-test" depends="compile, execute"/>
+ <macrodef name="exec-quickstart">
+ <attribute name="quickstart"/>
+ <attribute name="target"/>
+ <sequential>
+ <ant antfile="build.xml"
+ dir="${org.jboss.esb.test.quickstarts.dir}/@{quickstart}"
+ target="@{target}" inheritAll="false">
+ <property name="quickstart.jbossesb.ftp.hostname" value="${org.jboss.esb.test.ftp.hostname}"/>
+ <property name="quickstart.jbossesb.ftp.username" value="${org.jboss.esb.test.ftp.user}"/>
+ <property name="quickstart.jbossesb.ftp.password" value="${org.jboss.esb.test.ftp.pwd}"/>
+ <property name="quickstart.jbossesb.ftp.directory" value="${org.jboss.esb.test.ftp.dir}"/>
+ <property name="org.jboss.esb.server.home" location="${qa.quickstarts.server.home}"/>
+ <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
+ </ant>
+ </sequential>
+ </macrodef>
- <target name="ci-clean" depends="init, clean-esb"/>
-
- <target name="compile" depends="clean, compile-esb">
- <echo message="Compiling JUnit based Quickstart tests..."/>
+ <target name="init">
+ <available property="quickstarts.exist" type="dir"
+ file="${org.jboss.esb.test.quickstarts.dir}"/>
+ </target>
+ <target name="clean" depends="init, clean-esb"/>
- <!-- Build the tests... -->
- <mkdir dir="${qa.quickstarts.classes}"/>
- <javac srcdir="${qa.quickstarts.src}" destdir="${qa.quickstarts.classes}" classpathref="qa.quickstarts.cp" debug="on"/>
- <jar jarfile="${qa.quickstarts.build.lib}/QuickstartMessageStoreServer.sar">
- <fileset dir="${qa.quickstarts.classes}">
- <include name="org/jboss/soa/esb/server/*.class"/>
- </fileset>
- <fileset dir="${qa.quickstarts.resources}/server"/>
- </jar>
- </target>
+ <target name="one-test">
+ <runant target="internal-one-test"/>
+ </target>
- <target name="clean-esb" if="quickstarts.exist">
- <exec-quickstart quickstart="bpm_orchestration1" target="clean"/>
- <exec-quickstart quickstart="bpm_orchestration2" target="clean"/>
- <exec-quickstart quickstart="bpm_orchestration3" target="clean"/>
- <exec-quickstart quickstart="business_rules_service" target="clean"/>
- <exec-quickstart quickstart="custom_action" target="clean"/>
- <exec-quickstart quickstart="deadletter" target="clean"/>
- <exec-quickstart quickstart="dynamic_router" target="clean"/>
- <exec-quickstart quickstart="exceptions_faults" target="clean"/>
- <exec-quickstart quickstart="fun_cbr" target="clean"/>
- <exec-quickstart quickstart="groovy_gateway" target="clean"/>
- <exec-quickstart quickstart="helloworld" target="clean"/>
- <exec-quickstart quickstart="helloworld_action" target="clean"/>
- <exec-quickstart quickstart="helloworld_file_action" target="clean"/>
- <exec-quickstart quickstart="helloworld_file_notifier" target="clean"/>
- <exec-quickstart quickstart="helloworld_sql_action" target="clean"/>
- <exec-quickstart quickstart="jms_secured" target="clean"/>
- <exec-quickstart quickstart="jms_topic" target="clean"/>
- <exec-quickstart quickstart="load_generator" target="clean"/>
- <exec-quickstart quickstart="messagefilter" target="clean"/>
- <exec-quickstart quickstart="messagestore" target="clean"/>
- <exec-quickstart quickstart="native_client" target="clean"/>
- <exec-quickstart quickstart="recipient_list" target="clean"/>
- <exec-quickstart quickstart="scheduled_services" target="clean"/>
- <exec-quickstart quickstart="scripting_groovy" target="clean"/>
- <exec-quickstart quickstart="simple_cbr" target="clean"/>
- <exec-quickstart quickstart="spring_aop" target="clean"/>
- <exec-quickstart quickstart="spring_helloworld" target="clean"/>
- <exec-quickstart quickstart="spring_jpetstore" target="clean"/>
- <exec-quickstart quickstart="static_router" target="clean"/>
- <exec-quickstart quickstart="transform_CSV2XML" target="clean"/>
- <exec-quickstart quickstart="transform_EDI2XML_Groovy_XSLT" target="clean"/>
- <exec-quickstart quickstart="transform_XML2POJO" target="clean"/>
- <exec-quickstart quickstart="transform_XML2XML_date_manipulation" target="clean"/>
- <exec-quickstart quickstart="transform_XML2XML_simple" target="clean"/>
- <exec-quickstart quickstart="wiretap" target="clean"/>
- <exec-quickstart quickstart="webservice_consumer1" target="clean"/>
- <exec-quickstart quickstart="webservice_consumer2" target="clean"/>
- <exec-quickstart quickstart="webservice_producer" target="clean"/>
- </target>
+ <target name="internal-one-test" depends="compile, prompt, execute"/>
- <target name="compile-esb">
- <echo>Compile ESB Packages</echo>
- <exec-quickstart quickstart="bpm_orchestration1" target="prepare-deployment"/>
- <exec-quickstart quickstart="bpm_orchestration2" target="prepare-deployment"/>
- <exec-quickstart quickstart="bpm_orchestration3" target="prepare-deployment"/>
- <exec-quickstart quickstart="business_rules_service" target="prepare-deployment"/>
- <exec-quickstart quickstart="custom_action" target="prepare-deployment"/>
- <exec-quickstart quickstart="deadletter" target="prepare-deployment"/>
- <exec-quickstart quickstart="dynamic_router" target="prepare-deployment"/>
- <exec-quickstart quickstart="exceptions_faults" target="prepare-deployment"/>
+ <target name="test">
+ <runant target="ci-test"/>
+ </target>
- <exec-quickstart quickstart="fun_cbr" target="prepare-deployment"/>
- <exec-quickstart quickstart="groovy_gateway" target="prepare-deployment"/>
- <exec-quickstart quickstart="helloworld" target="prepare-deployment"/>
- <exec-quickstart quickstart="helloworld_action" target="prepare-deployment"/>
- <exec-quickstart quickstart="helloworld_file_action" target="prepare-deployment"/>
- <exec-quickstart quickstart="helloworld_file_notifier" target="prepare-deployment"/>
- <exec-quickstart quickstart="helloworld_sql_action" target="prepare-deployment"/>
- <exec-quickstart quickstart="jms_secured" target="prepare-deployment"/>
- <exec-quickstart quickstart="jms_topic" target="prepare-deployment"/>
- <exec-quickstart quickstart="messagefilter" target="prepare-deployment"/>
- <exec-quickstart quickstart="messagestore" target="prepare-deployment"/>
- <exec-quickstart quickstart="native_client" target="prepare-deployment"/>
- <exec-quickstart quickstart="recipient_list" target="prepare-deployment"/>
- <exec-quickstart quickstart="scheduled_services" target="prepare-deployment"/>
- <exec-quickstart quickstart="scripting_groovy" target="prepare-deployment"/>
- <exec-quickstart quickstart="simple_cbr" target="prepare-deployment"/>
- <exec-quickstart quickstart="spring_aop" target="prepare-deployment"/>
- <exec-quickstart quickstart="spring_helloworld" target="prepare-deployment"/>
- <exec-quickstart quickstart="spring_jpetstore" target="prepare-deployment"/>
- <exec-quickstart quickstart="static_router" target="prepare-deployment"/>
- <exec-quickstart quickstart="transform_CSV2XML" target="prepare-deployment"/>
- <exec-quickstart quickstart="transform_EDI2XML_Groovy_XSLT" target="prepare-deployment"/>
- <exec-quickstart quickstart="transform_XML2POJO" target="prepare-deployment"/>
- <exec-quickstart quickstart="transform_XML2XML_date_manipulation" target="prepare-deployment"/>
- <exec-quickstart quickstart="transform_XML2XML_simple" target="prepare-deployment"/>
- <exec-quickstart quickstart="webservice_consumer1" target="prepare-deployment"/>
- <exec-quickstart quickstart="webservice_consumer2" target="prepare-deployment"/>
- <exec-quickstart quickstart="webservice_producer" target="prepare-deployment"/>
- <exec-quickstart quickstart="wiretap" target="prepare-deployment"/>
- <copy todir="${qa.quickstarts.build.lib}" flatten="true">
- <fileset dir="${org.jboss.esb.test.quickstarts.dir}">
- <include name="bpm_orchestration1/build/*.esb"/>
- <include name="bpm_orchestration2/build/*.esb"/>
- <include name="bpm_orchestration3/build/*.esb"/>
- <include name="business_rules_service/build/*.esb"/>
- <include name="custom_action/build/*.esb"/>
- <include name="deadletter/build/*.esb"/>
- <include name="dynamic_router/build/*.esb"/>
- <include name="exceptions_faults/build/*.esb"/>
- <include name="fun_cbr/build/*.esb"/>
- <include name="groovy_gateway/build/*.esb"/>
- <include name="helloworld/build/*.esb"/>
- <include name="helloworld_action/build/*.esb"/>
- <include name="helloworld_file_action/build/*.esb"/>
- <include name="helloworld_file_notifier/build/*.esb"/>
- <include name="helloworld_sql_action/build/*.esb"/>
- <include name="jms_secured/build/*.esb"/>
- <include name="jms_topic/build/*.esb"/>
- <include name="load_generator/build/*.esb"/>
- <include name="messagefilter/build/*.esb"/>
- <include name="messagestore/build/*.esb"/>
- <include name="native_client/build/*.esb"/>
- <include name="recipient_list/build/*.esb"/>
- <include name="scripting_groovy/build/*.esb"/>
- <include name="scheduled_services/build/*.esb"/>
- <include name="simple_cbr/build/*.esb"/>
- <include name="spring_aop/build/*.esb"/>
- <include name="spring_helloworld/build/*.esb"/>
- <include name="spring_jpetstore/build/*.esb"/>
- <include name="static_router/build/*.esb"/>
- <include name="transform_CSV2XML/build/*.esb"/>
- <include name="transform_EDI2XML_Groovy_XSLT/build/*.esb"/>
- <include name="transform_XML2POJO/build/*.esb"/>
- <include name="transform_XML2XML_date_manipulation/build/*.esb"/>
- <include name="transform_XML2XML_simple/build/*.esb"/>
- <include name="webservice_consumer1/build/*.esb"/>
- <include name="webservice_consumer1/build/*.war"/>
- <include name="webservice_consumer2/build/*.esb"/>
- <include name="webservice_producer/build/*.esb"/>
- <include name="wiretap/build/*.esb"/>
- </fileset>
- </copy>
- </target>
+ <target name="ci-test" depends="compile, execute"/>
- <target name="compile-stylesheets">
- <mkdir dir="${qa.build.stylesheets}"/>
- <copy todir="${qa.build.stylesheets}" filtering="yes">
- <fileset dir="${qa.source.stylesheets}">
- <include name="**/*"/>
- </fileset>
- </copy>
- </target>
+ <target name="ci-clean" depends="init, clean-esb"/>
+ <target name="compile" depends="clean, compile-esb">
+ <echo message="Compiling JUnit based Quickstart tests..."/>
- <target name="tests-report-html" depends="compile-stylesheets">
- <mkdir dir="${qa.build.reports}/html"/>
- <junitreport todir="${qa.build.reports}">
- <fileset dir="${qa.build.reports}">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames"
- todir="${qa.build.reports}/html"
- styledir="${qa.build.stylesheets}"
- />
- </junitreport>
- </target>
+ <!-- Build the tests... -->
+ <mkdir dir="${qa.quickstarts.classes}"/>
+ <javac srcdir="${qa.quickstarts.src}" destdir="${qa.quickstarts.classes}" classpathref="qa.quickstarts.cp"
+ debug="on"/>
+ <jar jarfile="${qa.quickstarts.build.lib}/QuickstartMessageStoreServer.sar">
+ <fileset dir="${qa.quickstarts.classes}">
+ <include name="org/jboss/soa/esb/server/*.class"/>
+ </fileset>
+ <fileset dir="${qa.quickstarts.resources}/server"/>
+ </jar>
+ </target>
+ <target name="clean-esb" if="quickstarts.exist">
+ <exec-quickstart quickstart="bpm_orchestration1" target="clean"/>
+ <exec-quickstart quickstart="bpm_orchestration2" target="clean"/>
+ <exec-quickstart quickstart="bpm_orchestration3" target="clean"/>
+ <exec-quickstart quickstart="business_rules_service" target="clean"/>
+ <exec-quickstart quickstart="custom_action" target="clean"/>
+ <exec-quickstart quickstart="deadletter" target="clean"/>
+ <exec-quickstart quickstart="dynamic_router" target="clean"/>
+ <exec-quickstart quickstart="exceptions_faults" target="clean"/>
+ <exec-quickstart quickstart="fun_cbr" target="clean"/>
+ <exec-quickstart quickstart="groovy_gateway" target="clean"/>
+ <exec-quickstart quickstart="helloworld" target="clean"/>
+ <exec-quickstart quickstart="helloworld_action" target="clean"/>
+ <exec-quickstart quickstart="helloworld_file_action" target="clean"/>
+ <exec-quickstart quickstart="helloworld_file_notifier" target="clean"/>
+ <exec-quickstart quickstart="helloworld_sql_action" target="clean"/>
+ <exec-quickstart quickstart="http_gateway" target="clean"/>
+ <exec-quickstart quickstart="jms_secured" target="clean"/>
+ <exec-quickstart quickstart="jms_topic" target="clean"/>
+ <exec-quickstart quickstart="load_generator" target="clean"/>
+ <exec-quickstart quickstart="messagefilter" target="clean"/>
+ <exec-quickstart quickstart="messagestore" target="clean"/>
+ <exec-quickstart quickstart="native_client" target="clean"/>
+ <exec-quickstart quickstart="recipient_list" target="clean"/>
+ <exec-quickstart quickstart="scheduled_services" target="clean"/>
+ <exec-quickstart quickstart="scripting_groovy" target="clean"/>
+ <exec-quickstart quickstart="simple_cbr" target="clean"/>
+ <exec-quickstart quickstart="spring_aop" target="clean"/>
+ <exec-quickstart quickstart="spring_helloworld" target="clean"/>
+ <exec-quickstart quickstart="spring_jpetstore" target="clean"/>
+ <exec-quickstart quickstart="static_router" target="clean"/>
+ <exec-quickstart quickstart="transform_CSV2XML" target="clean"/>
+ <exec-quickstart quickstart="transform_EDI2XML_Groovy_XSLT" target="clean"/>
+ <exec-quickstart quickstart="transform_XML2POJO" target="clean"/>
+ <exec-quickstart quickstart="transform_XML2XML_date_manipulation" target="clean"/>
+ <exec-quickstart quickstart="transform_XML2XML_simple" target="clean"/>
+ <exec-quickstart quickstart="wiretap" target="clean"/>
+ <exec-quickstart quickstart="webservice_consumer1" target="clean"/>
+ <exec-quickstart quickstart="webservice_consumer2" target="clean"/>
+ <exec-quickstart quickstart="webservice_producer" target="clean"/>
+ </target>
- <target name="execute">
- <!-- Run the tests... -->
- <property name="tests.filter" value="*"/>
- <mkdir dir="${qa.quickstarts.report}"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="yes" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${qa.quickstarts.report}">
- <fileset dir="${qa.quickstarts.src}">
- <include name="**/${tests.filter}Test.java"/>
- <exclude name="${tests.exclude}"/>
- <!-- Aggregator QS only runs standalone -->
- <exclude name="**/AggregatorTest.java"/>
- <!-- GroovyGateway QS requires UI interaction -->
- <exclude name="**/GroovyGatewayTest.java"/>
- <!-- SpringJPetStore requires additional configuration
- files and hsqldb. The QS needs some work before
- the CI test can run. -->
- <exclude name="**/SpringJPetStoreTest.java"/>
- <exclude name="**/HelloWorldSQLActionTest.java"/>
- <exclude name="**/BPMOrchestration1Test.java"/>
- <!-- The following quickstart is broken -->
- <exclude name="**/BPMOrchestration3Test.java"/>
- <exclude name="**/HelloWorldFileNotifierTest.java"/>
- <exclude name="**/RecipientlistTest.java"/>
- <exclude name="**/ExceptionsFaultsTest.java"/>
- <exclude name="**/DynamicRouterTest.java"/>
+ <target name="compile-esb">
+ <echo>Compile ESB Packages</echo>
+ <exec-quickstart quickstart="bpm_orchestration1" target="prepare-deployment"/>
+ <exec-quickstart quickstart="bpm_orchestration2" target="prepare-deployment"/>
+ <exec-quickstart quickstart="bpm_orchestration3" target="prepare-deployment"/>
+ <exec-quickstart quickstart="business_rules_service" target="prepare-deployment"/>
+ <exec-quickstart quickstart="custom_action" target="prepare-deployment"/>
+ <exec-quickstart quickstart="deadletter" target="prepare-deployment"/>
+ <exec-quickstart quickstart="dynamic_router" target="prepare-deployment"/>
+ <exec-quickstart quickstart="exceptions_faults" target="prepare-deployment"/>
- <!-- The Groovy Gateway test requires testing UI -->
- <exclude name="**/GroovyGatewayTest.java"/>
- <exclude name="**/LoadGeneratorTest.java"/>
- <exclude name="**/StaticRouterTest.java"/>
- <exclude name="**/HelloWorldDBRegistrationTest.java"/>
- <!-- Requires ActiveBPEL and AS -->
- <exclude name="**/WebserviceBPELTest.java"/>
- <!-- The WebService ws-* quickstarts require AS -->
- <exclude name="**/WebServiceWSAddressingTest.java"/>
- <exclude name="**/WebServiceWSSecurityTest.java"/>
- <!-- The WSConsumer QS requires war deployment -->
- <exclude name="**/WebserviceAdapterTest.java"/>
- <exclude name="**/WebserviceBPELTest.java"/>
- <exclude name="**/WebServiceConsumer1Test.java"/>
- <exclude name="**/WebServiceConsumer2Test.java"/>
- <exclude name="**/WebServiceProducerTest.java"/>
+ <exec-quickstart quickstart="fun_cbr" target="prepare-deployment"/>
+ <exec-quickstart quickstart="groovy_gateway" target="prepare-deployment"/>
+ <exec-quickstart quickstart="helloworld" target="prepare-deployment"/>
+ <exec-quickstart quickstart="helloworld_action" target="prepare-deployment"/>
+ <exec-quickstart quickstart="helloworld_file_action" target="prepare-deployment"/>
+ <exec-quickstart quickstart="helloworld_file_notifier" target="prepare-deployment"/>
+ <exec-quickstart quickstart="helloworld_sql_action" target="prepare-deployment"/>
+ <exec-quickstart quickstart="http_gateway" target="prepare-deployment"/>
+ <exec-quickstart quickstart="jms_secured" target="prepare-deployment"/>
+ <exec-quickstart quickstart="jms_topic" target="prepare-deployment"/>
+ <exec-quickstart quickstart="messagefilter" target="prepare-deployment"/>
+ <exec-quickstart quickstart="messagestore" target="prepare-deployment"/>
+ <exec-quickstart quickstart="native_client" target="prepare-deployment"/>
+ <exec-quickstart quickstart="recipient_list" target="prepare-deployment"/>
+ <exec-quickstart quickstart="scheduled_services" target="prepare-deployment"/>
+ <exec-quickstart quickstart="scripting_groovy" target="prepare-deployment"/>
+ <exec-quickstart quickstart="simple_cbr" target="prepare-deployment"/>
+ <exec-quickstart quickstart="spring_aop" target="prepare-deployment"/>
+ <exec-quickstart quickstart="spring_helloworld" target="prepare-deployment"/>
+ <exec-quickstart quickstart="spring_jpetstore" target="prepare-deployment"/>
+ <exec-quickstart quickstart="static_router" target="prepare-deployment"/>
+ <exec-quickstart quickstart="transform_CSV2XML" target="prepare-deployment"/>
+ <exec-quickstart quickstart="transform_EDI2XML_Groovy_XSLT" target="prepare-deployment"/>
+ <exec-quickstart quickstart="transform_XML2POJO" target="prepare-deployment"/>
+ <exec-quickstart quickstart="transform_XML2XML_date_manipulation" target="prepare-deployment"/>
+ <exec-quickstart quickstart="transform_XML2XML_simple" target="prepare-deployment"/>
+ <exec-quickstart quickstart="webservice_consumer1" target="prepare-deployment"/>
+ <exec-quickstart quickstart="webservice_consumer2" target="prepare-deployment"/>
+ <exec-quickstart quickstart="webservice_producer" target="prepare-deployment"/>
+ <exec-quickstart quickstart="wiretap" target="prepare-deployment"/>
+ <copy todir="${qa.quickstarts.build.lib}" flatten="true">
+ <fileset dir="${org.jboss.esb.test.quickstarts.dir}">
+ <include name="bpm_orchestration1/build/*.esb"/>
+ <include name="bpm_orchestration2/build/*.esb"/>
+ <include name="bpm_orchestration3/build/*.esb"/>
+ <include name="business_rules_service/build/*.esb"/>
+ <include name="custom_action/build/*.esb"/>
+ <include name="deadletter/build/*.esb"/>
+ <include name="dynamic_router/build/*.esb"/>
+ <include name="exceptions_faults/build/*.esb"/>
+ <include name="fun_cbr/build/*.esb"/>
+ <include name="groovy_gateway/build/*.esb"/>
+ <include name="helloworld/build/*.esb"/>
+ <include name="helloworld_action/build/*.esb"/>
+ <include name="helloworld_file_action/build/*.esb"/>
+ <include name="helloworld_file_notifier/build/*.esb"/>
+ <include name="helloworld_sql_action/build/*.esb"/>
+ <include name="http_gateway/build/*.esb"/>
+ <include name="jms_secured/build/*.esb"/>
+ <include name="jms_topic/build/*.esb"/>
+ <include name="load_generator/build/*.esb"/>
+ <include name="messagefilter/build/*.esb"/>
+ <include name="messagestore/build/*.esb"/>
+ <include name="native_client/build/*.esb"/>
+ <include name="recipient_list/build/*.esb"/>
+ <include name="scripting_groovy/build/*.esb"/>
+ <include name="scheduled_services/build/*.esb"/>
+ <include name="simple_cbr/build/*.esb"/>
+ <include name="spring_aop/build/*.esb"/>
+ <include name="spring_helloworld/build/*.esb"/>
+ <include name="spring_jpetstore/build/*.esb"/>
+ <include name="static_router/build/*.esb"/>
+ <include name="transform_CSV2XML/build/*.esb"/>
+ <include name="transform_EDI2XML_Groovy_XSLT/build/*.esb"/>
+ <include name="transform_XML2POJO/build/*.esb"/>
+ <include name="transform_XML2XML_date_manipulation/build/*.esb"/>
+ <include name="transform_XML2XML_simple/build/*.esb"/>
+ <include name="webservice_consumer1/build/*.esb"/>
+ <include name="webservice_consumer1/build/*.war"/>
+ <include name="webservice_consumer2/build/*.esb"/>
+ <include name="webservice_producer/build/*.esb"/>
+ <include name="wiretap/build/*.esb"/>
</fileset>
- </batchtest>
- <classpath>
- <pathelement location="${qa.quickstarts.classes}"/>
- <path refid="qa.quickstarts.cp"/>
- <pathelement location="${qa.quickstarts.src}"/>
- </classpath>
- <jvmarg value="-Xmx${qa.quickstarts.memory}"/>
+ </copy>
+ </target>
- <sysproperty key="jbosstest.deploy.dir" value="${qa.quickstarts.build.lib}"/>
- <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
- <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
- <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>
+ <target name="compile-stylesheets">
+ <mkdir dir="${qa.build.stylesheets}"/>
+ <copy todir="${qa.build.stylesheets}" filtering="yes">
+ <fileset dir="${qa.source.stylesheets}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
-
- <!-- Listener Sys Props... -->
- <sysproperty key="org.jboss.soa.esb.paramsRepository.file.root"
- value="${org.jboss.soa.esb.paramsRepository.file.root}"/>
- <!-- Sys Props from the test.properties file... -->
- <!--
- <sysproperty key="org.jboss.soa.esb.jndi.server.type" value="${org.jboss.soa.esb.jndi.server.type}"/>
- <sysproperty key="org.jboss.soa.esb.jndi.server.url" value="${org.jboss.soa.esb.jndi.server.url}"/>
- -->
+ <target name="tests-report-html" depends="compile-stylesheets">
+ <mkdir dir="${qa.build.reports}/html"/>
- <!-- Sys Props from the deployment.properties file... -->
- <sysproperty key="org.jboss.esb.test.ftp.hostname" value="${org.jboss.esb.test.ftp.hostname}"/>
- <sysproperty key="org.jboss.esb.test.ftp.user" value="${org.jboss.esb.test.ftp.user}"/>
- <sysproperty key="org.jboss.esb.test.ftp.pwd" value="${org.jboss.esb.test.ftp.pwd}"/>
- <sysproperty key="org.jboss.esb.test.ftp.dir" value="${org.jboss.esb.test.ftp.dir}"/>
- <sysproperty key="org.jboss.esb.test.quickstarts.dir" value="${org.jboss.esb.test.quickstarts.dir}"/>
+ <junitreport todir="${qa.build.reports}">
+ <fileset dir="${qa.build.reports}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames"
+ todir="${qa.build.reports}/html"
+ styledir="${qa.build.stylesheets}"
+ />
+ </junitreport>
+ </target>
- </junit>
- <!-- Report on the tests (format results) ... -->
- <junitreport todir="${qa.quickstarts.report}">
- <fileset dir="${qa.quickstarts.report}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${qa.quickstarts.report}"/>
- <report format="noframes" todir="${qa.quickstarts.report}"/>
- </junitreport>
+ <target name="execute">
+ <!-- Run the tests... -->
+ <property name="tests.filter" value="*"/>
+ <mkdir dir="${qa.quickstarts.report}"/>
+ <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="yes" fork="true">
+ <formatter type="plain" usefile="false"/>
+ <formatter type="xml"/>
+ <batchtest todir="${qa.quickstarts.report}">
+ <fileset dir="${qa.quickstarts.src}">
+ <include name="**/${tests.filter}Test.java"/>
+ <exclude name="${tests.exclude}"/>
+ <!-- Aggregator QS only runs standalone -->
+ <exclude name="**/AggregatorTest.java"/>
+ <!-- GroovyGateway QS requires UI interaction -->
+ <exclude name="**/GroovyGatewayTest.java"/>
+ <!-- SpringJPetStore requires additional configuration
+ files and hsqldb. The QS needs some work before
+ the CI test can run. -->
+ <exclude name="**/SpringJPetStoreTest.java"/>
+ <exclude name="**/HelloWorldSQLActionTest.java"/>
+ <exclude name="**/BPMOrchestration1Test.java"/>
+ <!-- The following quickstart is broken -->
+ <exclude name="**/BPMOrchestration3Test.java"/>
+ <exclude name="**/HelloWorldFileNotifierTest.java"/>
+ <exclude name="**/RecipientlistTest.java"/>
+ <exclude name="**/ExceptionsFaultsTest.java"/>
+ <exclude name="**/DynamicRouterTest.java"/>
- </target>
+ <!-- The Groovy Gateway test requires testing UI -->
+ <exclude name="**/GroovyGatewayTest.java"/>
+ <exclude name="**/LoadGeneratorTest.java"/>
+ <exclude name="**/StaticRouterTest.java"/>
+ <exclude name="**/HelloWorldDBRegistrationTest.java"/>
+ <!-- Requires ActiveBPEL and AS -->
+ <exclude name="**/WebserviceBPELTest.java"/>
+ <!-- The WebService ws-* quickstarts require AS -->
+ <exclude name="**/WebServiceWSAddressingTest.java"/>
+ <exclude name="**/WebServiceWSSecurityTest.java"/>
+ <!-- The WSConsumer QS requires war deployment -->
+ <exclude name="**/WebserviceAdapterTest.java"/>
+ <exclude name="**/WebserviceBPELTest.java"/>
+ <exclude name="**/WebServiceConsumer1Test.java"/>
+ <exclude name="**/WebServiceConsumer2Test.java"/>
+ <exclude name="**/WebServiceProducerTest.java"/>
+ </fileset>
+ </batchtest>
+ <classpath>
+ <pathelement location="${qa.quickstarts.classes}"/>
+ <path refid="qa.quickstarts.cp"/>
+ <pathelement location="${qa.quickstarts.src}"/>
+ </classpath>
+ <jvmarg value="-Xmx${qa.quickstarts.memory}"/>
- <target name="test-emma" depends="compile-emma, prompt, execute-emma"/>
- <target name="ci-test-emma" depends="compile-emma, execute-emma"/>
+ <sysproperty key="jbosstest.deploy.dir" value="${qa.quickstarts.build.lib}"/>
+ <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
+ <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
+ <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>
- <target name="compile-emma">
- <echo message="Running JUnit based QA tests (with ema enabled) ..."/>
- <!-- Build the tests... -->
- <mkdir dir="${qa.quickstarts.classes}"/>
- <javac srcdir="${qa.quickstarts.src}" destdir="${qa.quickstarts.classes}" classpathref="qa.quickstarts.emma.cp" debug="on"/>
- </target>
- <target name="prompt">
- <property name="tests.exclude" value="**/*IntegrationTest.java"/>
- <echo message=""/>
- <echo message=""/>
- <input message='Which tests? (Press return to run all tests - Wildcards Supported - already assumes test cases end with the "Test" suffix)'
- addproperty="tests.filter"
- defaultvalue="*"/>
- </target>
+ <!-- Listener Sys Props... -->
+ <sysproperty key="org.jboss.soa.esb.paramsRepository.file.root"
+ value="${org.jboss.soa.esb.paramsRepository.file.root}"/>
- <target name="execute-emma">
- <!-- Run the tests... -->
- <property name="tests.filter" value="*"/>
- <mkdir dir="${qa.quickstarts.report}"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="yes" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${qa.quickstarts.report}">
- <fileset dir="${qa.quickstarts.src}">
- <include name="**/${tests.filter}Test.java"/>
+ <!-- Sys Props from the test.properties file... -->
+ <!--
+ <sysproperty key="org.jboss.soa.esb.jndi.server.type" value="${org.jboss.soa.esb.jndi.server.type}"/>
+ <sysproperty key="org.jboss.soa.esb.jndi.server.url" value="${org.jboss.soa.esb.jndi.server.url}"/>
+ -->
+
+ <!-- Sys Props from the deployment.properties file... -->
+ <sysproperty key="org.jboss.esb.test.ftp.hostname" value="${org.jboss.esb.test.ftp.hostname}"/>
+ <sysproperty key="org.jboss.esb.test.ftp.user" value="${org.jboss.esb.test.ftp.user}"/>
+ <sysproperty key="org.jboss.esb.test.ftp.pwd" value="${org.jboss.esb.test.ftp.pwd}"/>
+ <sysproperty key="org.jboss.esb.test.ftp.dir" value="${org.jboss.esb.test.ftp.dir}"/>
+ <sysproperty key="org.jboss.esb.test.quickstarts.dir" value="${org.jboss.esb.test.quickstarts.dir}"/>
+
+ </junit>
+
+ <!-- Report on the tests (format results) ... -->
+ <junitreport todir="${qa.quickstarts.report}">
+ <fileset dir="${qa.quickstarts.report}">
+ <include name="*.xml"/>
</fileset>
- </batchtest>
- <classpath>
- <pathelement location="${qa.quickstarts.classes}"/>
- <path refid="qa.quickstarts.emma.cp"/>
- <pathelement location="${qa.quickstarts.src}"/>
- </classpath>
+ <report format="frames" todir="${qa.quickstarts.report}"/>
+ <report format="noframes" todir="${qa.quickstarts.report}"/>
+ </junitreport>
- <jvmarg value="-Xmx${qa.quickstarts.memory}"/>
- <!-- emma jvm args -->
- <jvmarg value="-Demma.coverage.out.file=${coverage}/all/coverage.emma"/>
- <jvmarg value="-Demma.coverage.out.merge=true"/>
+ </target>
+ <target name="test-emma" depends="compile-emma, prompt, execute-emma"/>
+ <target name="ci-test-emma" depends="compile-emma, execute-emma"/>
- <sysproperty key="jbosstest.deploy.dir" value="${qa.quickstarts.build.lib}"/>
- <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
- <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
- <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>
-
- <!-- Listener Sys Props... -->
- <sysproperty key="org.jboss.soa.esb.paramsRepository.file.root"
- value="${org.jboss.soa.esb.paramsRepository.file.root}"/>
+ <target name="compile-emma">
+ <echo message="Running JUnit based QA tests (with ema enabled) ..."/>
+ <!-- Build the tests... -->
+ <mkdir dir="${qa.quickstarts.classes}"/>
+ <javac srcdir="${qa.quickstarts.src}" destdir="${qa.quickstarts.classes}" classpathref="qa.quickstarts.emma.cp"
+ debug="on"/>
+ </target>
- <!-- Sys Props from the test.properties file... -->
- <sysproperty key="org.jboss.soa.esb.jndi.server.type" value="${org.jboss.soa.esb.jndi.server.type}"/>
- <sysproperty key="org.jboss.soa.esb.jndi.server.url" value="${org.jboss.soa.esb.jndi.server.url}"/>
+ <target name="prompt">
+ <property name="tests.exclude" value="**/*IntegrationTest.java"/>
+ <echo message=""/>
+ <echo message=""/>
+ <input message='Which tests? (Press return to run all tests - Wildcards Supported - already assumes test cases end with the "Test" suffix)'
+ addproperty="tests.filter"
+ defaultvalue="*"/>
+ </target>
- <!-- Sys Props from the deployment.properties file... -->
- <sysproperty key="org.jboss.esb.test.ftp.hostname" value="${org.jboss.esb.test.ftp.hostname}"/>
- <sysproperty key="org.jboss.esb.test.ftp.user" value="${org.jboss.esb.test.ftp.user}"/>
- <sysproperty key="org.jboss.esb.test.ftp.pwd" value="${org.jboss.esb.test.ftp.pwd}"/>
- <sysproperty key="org.jboss.esb.test.ftp.dir" value="${org.jboss.esb.test.ftp.dir}"/>
- </junit>
+ <target name="execute-emma">
+ <!-- Run the tests... -->
+ <property name="tests.filter" value="*"/>
+ <mkdir dir="${qa.quickstarts.report}"/>
+ <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="yes" fork="true">
+ <formatter type="plain" usefile="false"/>
+ <formatter type="xml"/>
+ <batchtest todir="${qa.quickstarts.report}">
+ <fileset dir="${qa.quickstarts.src}">
+ <include name="**/${tests.filter}Test.java"/>
+ </fileset>
+ </batchtest>
+ <classpath>
+ <pathelement location="${qa.quickstarts.classes}"/>
+ <path refid="qa.quickstarts.emma.cp"/>
+ <pathelement location="${qa.quickstarts.src}"/>
+ </classpath>
- <!-- Report on the tests (format results) ... -->
- <junitreport todir="${qa.quickstarts.report}">
- <fileset dir="${qa.quickstarts.report}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${qa.quickstarts.report}"/>
- <report format="noframes" todir="${qa.quickstarts.report}"/>
- </junitreport>
+ <jvmarg value="-Xmx${qa.quickstarts.memory}"/>
+ <!-- emma jvm args -->
+ <jvmarg value="-Demma.coverage.out.file=${coverage}/all/coverage.emma"/>
+ <jvmarg value="-Demma.coverage.out.merge=true"/>
- </target>
+ <sysproperty key="jbosstest.deploy.dir" value="${qa.quickstarts.build.lib}"/>
+ <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
+ <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
+ <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>
+
+ <!-- Listener Sys Props... -->
+ <sysproperty key="org.jboss.soa.esb.paramsRepository.file.root"
+ value="${org.jboss.soa.esb.paramsRepository.file.root}"/>
+
+ <!-- Sys Props from the test.properties file... -->
+ <sysproperty key="org.jboss.soa.esb.jndi.server.type" value="${org.jboss.soa.esb.jndi.server.type}"/>
+ <sysproperty key="org.jboss.soa.esb.jndi.server.url" value="${org.jboss.soa.esb.jndi.server.url}"/>
+
+ <!-- Sys Props from the deployment.properties file... -->
+ <sysproperty key="org.jboss.esb.test.ftp.hostname" value="${org.jboss.esb.test.ftp.hostname}"/>
+ <sysproperty key="org.jboss.esb.test.ftp.user" value="${org.jboss.esb.test.ftp.user}"/>
+ <sysproperty key="org.jboss.esb.test.ftp.pwd" value="${org.jboss.esb.test.ftp.pwd}"/>
+ <sysproperty key="org.jboss.esb.test.ftp.dir" value="${org.jboss.esb.test.ftp.dir}"/>
+ </junit>
+
+ <!-- Report on the tests (format results) ... -->
+ <junitreport todir="${qa.quickstarts.report}">
+ <fileset dir="${qa.quickstarts.report}">
+ <include name="*.xml"/>
+ </fileset>
+ <report format="frames" todir="${qa.quickstarts.report}"/>
+ <report format="noframes" todir="${qa.quickstarts.report}"/>
+ </junitreport>
+
+ </target>
+
</project>
Copied: labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java (from rev 25653, labs/jbossesb/branches/JBESB_4_4_GA_FP/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpgateway/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java 2009-06-11 10:15:18 UTC (rev 26925)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.quickstart.test;
+
+import junit.framework.Test;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.io.InputStreamReader;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+
+/**
+ * CI test for the http-gateway quickstart.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+
+public class HttpGatewayTest extends AbstractQuickstartTestCase {
+
+ public HttpGatewayTest(String name) {
+ super(name);
+ }
+
+ public void testMessage() throws Exception {
+ clearMessages() ;
+ sendMessage() ;
+ }
+
+ public void sendMessage() throws Exception {
+ URL request = new URL("http://localhost:8080/ordermgt/in/a/b?param1=value1");
+
+ URLConnection connection = request.openConnection();
+ connection.connect();
+ InputStreamReader reader = new InputStreamReader(connection.getInputStream());
+ try {
+ String response = StreamUtils.readReader(reader);
+
+ assertTrue(response.indexOf("Service: OrderManagement:Incoming") != -1);
+ assertTrue(response.indexOf("pathInfo: /a/b") != -1);
+ assertTrue(response.indexOf("params: {param1=") != -1);
+ } finally {
+ reader.close();
+ }
+ }
+
+ public static Test suite() throws Exception {
+ return getDeploySetup(HttpGatewayTest.class,
+ "QuickstartMessageStoreServer.sar, Quickstart_http_gateway.esb");
+ }
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list