You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/02/14 18:17:10 UTC
svn commit: r507632 - in /incubator/servicemix/trunk/samples/loan-broker:
README.txt build.xml src/main/assembly/src.xml src/main/java/
src/main/java/JMSClient.java
Author: gnodet
Date: Wed Feb 14 09:17:09 2007
New Revision: 507632
URL: http://svn.apache.org/viewvc?view=rev&rev=507632
Log:
SM-828: Add a client for the loan-broker-bpel demo. Patch provided by Gregoire Autric, thx \!
Added:
incubator/servicemix/trunk/samples/loan-broker/build.xml (with props)
incubator/servicemix/trunk/samples/loan-broker/src/main/java/
incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java (with props)
Modified:
incubator/servicemix/trunk/samples/loan-broker/README.txt
incubator/servicemix/trunk/samples/loan-broker/src/main/assembly/src.xml
Modified: incubator/servicemix/trunk/samples/loan-broker/README.txt
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/loan-broker/README.txt?view=diff&rev=507632&r1=507631&r2=507632
==============================================================================
--- incubator/servicemix/trunk/samples/loan-broker/README.txt (original)
+++ incubator/servicemix/trunk/samples/loan-broker/README.txt Wed Feb 14 09:17:09 2007
@@ -30,5 +30,8 @@
To run this sample, launch the following commands:
mvn install jbi:projectDeploy
+To test this sample, launch the following commands:
+ ant run
+
For more information on this example please see
http://incubator.apache.org/servicemix/loan-broker-bpel.html
Added: incubator/servicemix/trunk/samples/loan-broker/build.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/loan-broker/build.xml?view=auto&rev=507632
==============================================================================
--- incubator/servicemix/trunk/samples/loan-broker/build.xml (added)
+++ incubator/servicemix/trunk/samples/loan-broker/build.xml Wed Feb 14 09:17:09 2007
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project name="bpel-bpe" default="run" basedir=".">
+
+ <property name="build.dir" value="build"/>
+ <property name="comp.build.dir" value="${build.dir}/components"/>
+ <property name="client.build.dir" value="${build.dir}/client"/>
+
+ <property name="src.dir" value="src"/>
+ <property name="comp.src.dir" value="${src.dir}/components"/>
+ <property name="client.src.dir" value="${src.dir}/main/java"/>
+ <property name="su.bpe.src.dir" value="${src.dir}/bpe-su"/>
+ <property name="su.lw.src.dir" value="${src.dir}/lw-su"/>
+ <property name="sa.src.dir" value="${src.dir}/sa"/>
+
+ <target name="clean">
+ <delete dir="target" quiet="true"/>
+ <delete dir="${build.dir}" quiet="true"/>
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build.dir}"/>
+ <!--mkdir dir="${comp.build.dir}"/-->
+ <mkdir dir="${client.build.dir}"/>
+
+ <get src="http://repo.mergere.com/maven2/lingo/lingo/1.0/lingo-1.0.jar"
+ dest="../../lib/optional/lingo-1.0.jar"
+ usetimestamp="true" />
+ <get src="http://repo.mergere.com/maven2/commons-pool/commons-pool/1.2/commons-pool-1.2.jar"
+ dest="../../lib/optional/commons-pool-1.2.jar"
+ usetimestamp="true" />
+ <get src="http://repo.mergere.com/maven2/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"
+ dest="../../lib/optional/commons-collections-3.1.jar"
+ usetimestamp="true" />
+ <get src="http://repo.mergere.com/maven2/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"
+ dest="../../lib/optional/concurrent-1.3.4.jar"
+ usetimestamp="true" />
+
+ <path id="javac.classpath">
+ <pathelement path="${comp.build.dir}"/>
+ <pathelement path="${client.build.dir}"/>
+ <pathelement path="../../conf"/>
+ <fileset dir="../../lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="../../lib/optional">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ </target>
+
+ <target name="build-components" depends="init" description="Build components">
+ <javac srcdir="${comp.src.dir}" destdir="${comp.build.dir}" debug="on" source="1.4" target="1.4">
+ <classpath refid="javac.classpath"/>
+ </javac>
+ </target>
+
+ <target name="build-lw-su" depends="build-components" description="Build the engine service unit">
+ <zip destfile="${build.dir}/lw-su.zip">
+ <fileset dir="${comp.build.dir}"/>
+ <fileset dir="${su.lw.src.dir}"/>
+ </zip>
+ </target>
+
+ <target name="build-bpe-su" depends="init" description="Build the bpe service unit">
+ <zip destfile="${build.dir}/bpe-su.zip">
+ <fileset dir="${su.bpe.src.dir}"/>
+ </zip>
+ </target>
+
+ <target name="build-sa" depends="build-bpe-su, build-lw-su" description="Build the service assembly">
+ <zip destfile="${build.dir}/bpe-demo-sa.zip">
+ <fileset dir="${build.dir}" includes="bpe-su.zip"/>
+ <fileset dir="${build.dir}" includes="lw-su.zip"/>
+ <fileset dir="${sa.src.dir}"/>
+ </zip>
+ </target>
+
+ <target name="setup" depends="build-sa" description="Setup servicemix">
+ <mkdir dir="install"/>
+ <mkdir dir="deploy"/>
+ <copy todir="install">
+ <fileset dir="../../components" includes="*bpe*"/>
+ <fileset dir="../../components" includes="*lwcontainer*"/>
+ </copy>
+ <copy file="${build.dir}/bpe-demo-sa.zip" todir="deploy"/>
+ <copy todir="../../lib/optional">
+ <fileset dir="../../components/lib" includes="servicemix-components*.jar"/>
+ </copy>
+ </target>
+
+ <target name="build-client" depends="init" description="Build components">
+ <javac srcdir="${client.src.dir}" destdir="${client.build.dir}" debug="on" source="1.4" target="1.4">
+ <classpath refid="javac.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run" depends="build-client" description="Runs the example client">
+ <echo>Running exsample client</echo>
+ <java classname="JMSClient" fork="yes" maxmemory="100M">
+ <classpath refid="javac.classpath"/>
+ </java>
+ </target>
+
+ <target name="run-loop" depends="build-client" description="Runs the example client">
+ <echo>Running exsample client</echo>
+ <java classname="JMSClient" fork="yes" maxmemory="100M">
+ <classpath refid="javac.classpath"/>
+ <arg value="100000"/>
+ </java>
+ </target>
+
+</project>
Propchange: incubator/servicemix/trunk/samples/loan-broker/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/servicemix/trunk/samples/loan-broker/build.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/servicemix/trunk/samples/loan-broker/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/servicemix/trunk/samples/loan-broker/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/loan-broker/src/main/assembly/src.xml?view=diff&rev=507632&r1=507631&r2=507632
==============================================================================
--- incubator/servicemix/trunk/samples/loan-broker/src/main/assembly/src.xml (original)
+++ incubator/servicemix/trunk/samples/loan-broker/src/main/assembly/src.xml Wed Feb 14 09:17:09 2007
@@ -30,6 +30,7 @@
<include>LICENSE*</include>
<include>NOTICE*</include>
<include>pom.xml</include>
+ <include>build.xml</include>
<include>src/**/*</include>
<include>*/pom.xml</include>
<include>*/src/**/*</include>
Added: incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java?view=auto&rev=507632
==============================================================================
--- incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java (added)
+++ incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java Wed Feb 14 09:17:09 2007
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.logicblaze.lingo.jms.Requestor;
+import org.logicblaze.lingo.jms.impl.MultiplexingRequestor;
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
+import edu.emory.mathcs.backport.java.util.concurrent.Executors;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.TextMessage;
+
+/**
+ * @version $Revision$
+ */
+public class JMSClient implements Runnable {
+
+ private static ConnectionFactory factory;
+ private static CountDownLatch latch;
+ private static Requestor requestor;
+
+ /**
+ * main ...
+ *
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ System.out.println("Connecting to JMS server.");
+ factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
+ Destination inQueue = new ActiveMQQueue("demo.org.servicemix.source");
+ Destination outQueue = new ActiveMQQueue("demo.org.servicemix.output" + (int)(1000*Math.random()));
+ requestor = MultiplexingRequestor.newInstance(factory, inQueue, outQueue);
+
+ if (args.length == 0) {
+ new JMSClient().run();
+ } else {
+ int nb = Integer.parseInt(args[0]);
+ int th = 30;
+ if (args.length > 1) {
+ th = Integer.parseInt(args[1]);
+ }
+ latch = new CountDownLatch(nb);
+ ExecutorService threadPool = Executors.newFixedThreadPool(th);
+ for (int i = 0; i < nb; i++) {
+ threadPool.submit(new JMSClient());
+ }
+ latch.await();
+ }
+ System.out.println("Closing.");
+ requestor.close();
+ }
+
+ public void run() {
+ try {
+ System.out.println("Sending request.");
+ String request =
+"<getLoanQuoteRequest xmlns='urn:logicblaze:soa:loanbroker'>\n" +
+" <ssn>102-24532-53254</ssn>\n" +
+" <amount>" + Math.random() * 100000 + "</amount>\n" +
+" <duration>" + (int) Math.random() * 48 + "</duration>\n" +
+"</getLoanQuoteRequest>";
+ TextMessage out = requestor.getSession().createTextMessage(request);
+ TextMessage in = (TextMessage) requestor.request(null, out);
+ if (in == null) {
+ System.out.println("Response timed out.");
+ }
+ else {
+ System.out.println("Response: " + in.getText());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (latch != null) {
+ latch.countDown();
+ }
+ }
+ }
+}
Propchange: incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/servicemix/trunk/samples/loan-broker/src/main/java/JMSClient.java
------------------------------------------------------------------------------
svn:mime-type = text/plain