You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/01/08 12:18:36 UTC
svn commit: r609935 - in /incubator/tuscany/branches/sca-java-1.1/samples:
helloworld-ws-reference-jms/
helloworld-ws-reference-jms/src/main/resources/wsdl/
helloworld-ws-reference-jms/src/test/java/helloworld/
helloworld-ws-service-jms/ helloworld-ws-...
Author: slaws
Date: Tue Jan 8 03:18:34 2008
New Revision: 609935
URL: http://svn.apache.org/viewvc?rev=609935&view=rev
Log:
Fix up SOAP/JMS sample to make it work from maven and ant using the new host-jms-activemq module
Removed:
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldServerTestCase.java
Modified:
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/README
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/pom.xml
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/pom.xml
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java
incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/README?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/README (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/README Tue Jan 8 03:18:34 2008
@@ -1,24 +1,25 @@
Hello World Web Service References Sample
=========================================
-This sample demonstrates an SCA reference that uses a web service binding.
+This sample demonstrates an SCA reference that uses a web service binding running
+over a JMS protocl.
The README in the samples directory (the directory above this) provides
general instructions about building and running samples. Take a look there
first.
If you just want to run it to see what happens you need to run the server first
-so open a command prompt, navigate to the helloworld-ws-service sample directory
+so open a command prompt, navigate to the helloworld-ws-service-jms sample directory
and do
ant run
OR if you don't have ant, on Windows do
-java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
and on *nix do
-java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
Once the server is running open a command prompt, navigate to this sample
@@ -28,20 +29,20 @@
OR if you don't have ant, on Windows do
-java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient
and on *nix do
-java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient
Sample Overview
---------------
-The sample provides a single component that is wired to a reference with a
+The sample provides two components that are have a reference with a
web service binding. The binding refers to WSDL that identifies the service
-exposed by the helloworld-ws-service sample.
+exposed by the helloworld-ws-service-jms sample.
-helloworld-ws-reference/
+helloworld-ws-reference-jms/
src/
main/
java/
@@ -49,21 +50,22 @@
HelloWorldService.java - interface description for
HelloWorldServiceComponent
HelloWorldServiceComponent.java - component implementation
- HelloWorldClient.java - starts the SCA Runtime and
- deploys the helloworldwsclient
+ HelloWorldJmsClient.java - starts the SCA Runtime and
+ deploys the helloworldwsjmsclient
.composite. It then calls the
HelloWorldServiceComponent
resources/
wsdl
helloworld.wsdl - the service description that the
SCA reference uses to bind to
- helloworldwsclient.composite - the SCA assembly for this sample
+ helloworldwsjmsclient.composite - the SCA assembly for this sample
+ helloworldwsjms.composite - the SCA assembly for the server
+ that is used by the JUnit tests
logging.properties - log4j configuration file
test/
java/
helloworld/
- HelloWorldClientTestCase.java - JUnit test case
- HelloWorldServerTest.java - starts the Web service
+ HelloWorldJMSClientTestCase.java - JUnit test case
helloworld-ws-reference.png - a pictorial representation of the
sample .composite file
build.xml - the Ant build file
@@ -73,15 +75,15 @@
-----------------------------------------
With the binary distribution the sample can be built and run using Ant. Before
you do this start up the service that the reference will talk to. To do this
-run up the helloworld-ws-service test. Take a look at the README in that sample
+run up the helloworld-ws-service-jms test. Take a look at the README in that sample
and you will see you need the following commands
-cd helloworld-ws-service
+cd helloworld-ws-service-jms
ant run
Once done you can now compile and run this sample using the following commands;
-cd helloworld-ws-reference
+cd helloworld-ws-reference-jms
ant compile
ant run
@@ -99,9 +101,9 @@
-------------------------------------------
With either the binary or source distributions the sample can be built and run
using Maven as follows. When using Maven you don't need to run the helloworld-
-ws-service sample first as Maven does this for you.
+ws-service-jms sample first as the JUnit test does this for you.
-cd helloworld-ws-reference
+cd helloworld-ws-reference-jms
mvn
You should see the following output from the test phase.
@@ -109,45 +111,17 @@
-------------------------------------------------------
T E S T S
-------------------------------------------------------
-Running helloworld.HelloWorldClientTestCase
-log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
-Utils).
-log4j:WARN Please initialize the log4j system properly.
-log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
-Utils).
-log4j:WARN Please initialize the log4j system properly.
-10-May-2007 13:40:34 org.apache.catalina.core.StandardEngine start
-INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
-10-May-2007 13:40:35 org.apache.catalina.startup.ContextConfig defaultWebConfig
-INFO: No default web.xml
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/resources/xml.xsd
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
-0.xsd
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
-d
-10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
-WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client
-_1_1.xsd
-10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol init
-INFO: Initializing Coyote HTTP/1.1 on http-8085
-10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol start
-INFO: Starting Coyote HTTP/1.1 on http-8085
+Running helloworld.HelloWorldJmsClientTestCase
+08-Jan-2008 10:40:15 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu
+eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active
+MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619
Injected helloWorldService
Called getGreetings
-10-May-2007 13:40:36 org.apache.coyote.http11.Http11Protocol destroy
-INFO: Stopping Coyote HTTP/1.1 on http-8085
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.349 sec
-
-Results :
+Injected helloWorldService
+Called getGreetings
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.89 sec
This shows that the Junit test cases have run successfully.
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/pom.xml?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/pom.xml Tue Jan 8 03:18:34 2008
@@ -75,7 +75,14 @@
<artifactId>apache-activemq</artifactId>
<version>4.1.1</version>
<scope>test</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-activemq</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl Tue Jan 8 03:18:34 2008
@@ -85,7 +85,7 @@
<wsdl:service name="HelloWorldService">
<wsdl:port binding="tns:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
- <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
+ <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619"/>
</wsdl:port>
</wsdl:service>
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java Tue Jan 8 03:18:34 2008
@@ -23,6 +23,7 @@
import org.apache.tuscany.sca.host.embedded.SCADomain;
import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.apache.tuscany.sca.host.jms.activemq.ActiveMQModuleActivator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -35,16 +36,18 @@
private HelloWorldService helloWorldService;
private HelloWorldService helloTuscanyService;
- private SCADomain scaDomain;
-
- private SCATestCaseRunner server;
+ private SCADomain scaClientDomain;
+ private SCADomain scaServiceDomain;
+
@Before
public void startClient() throws Exception {
try {
- scaDomain = SCADomain.newInstance("helloworldwsjmsclient.composite");
- helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
- helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+ ActiveMQModuleActivator.startBroker();
+ scaServiceDomain = SCADomain.newInstance("helloworldwsjms.composite");
+ scaClientDomain = SCADomain.newInstance("helloworldwsjmsclient.composite");
+ helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ helloTuscanyService = scaClientDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
} catch (Throwable e) {
e.printStackTrace();
@@ -55,13 +58,17 @@
public void testWSClient() throws Exception {
String msg = helloWorldService.getGreetings("Smith");
Assert.assertEquals("Hello Smith", msg);
+ msg = helloTuscanyService.getGreetings("Green");
+ Assert.assertEquals("Hello Green", msg);
+
+ Thread.sleep(2000);
}
@After
public void stopClient() throws Exception {
- server.after();
- scaDomain.close();
+ scaServiceDomain.close();
+ scaClientDomain.close();
}
}
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/pom.xml?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/pom.xml Tue Jan 8 03:18:34 2008
@@ -38,6 +38,13 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-jms-activemq</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
<scope>compile</scope>
@@ -62,14 +69,7 @@
<artifactId>tuscany-binding-ws-axis2</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
<scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-tomcat</artifactId>
- <version>1.1-incubating-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>junit</groupId>
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java Tue Jan 8 03:18:34 2008
@@ -21,6 +21,7 @@
import java.io.IOException;
import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.jms.activemq.ActiveMQModuleActivator;
/**
* This server program shows how to create an SCA runtime, and start it which
@@ -30,7 +31,8 @@
public static void main(String[] args) {
- SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+ ActiveMQModuleActivator.startBroker();
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
try {
System.out.println("HelloWorld server started (press enter to shutdown)");
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml Tue Jan 8 03:18:34 2008
@@ -57,7 +57,7 @@
<tuscany:wsConfigParam>
<parameter name="TuscanyQueueConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61619</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
</tuscany:wsConfigParam>
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite Tue Jan 8 03:18:34 2008
@@ -27,7 +27,7 @@
<service name="HelloWorldService">
<interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
<binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapJmsBinding)"
- uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
+ uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619"/>
</service>
</component>
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java Tue Jan 8 03:18:34 2008
@@ -24,6 +24,7 @@
import java.io.IOException;
import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.jms.activemq.ActiveMQModuleActivator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -37,6 +38,7 @@
@Before
public void startServer() throws Exception {
+ ActiveMQModuleActivator.startBroker();
scaDomain = SCADomain.newInstance("helloworldwsjmspolicy.composite");
}
Modified: incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java?rev=609935&r1=609934&r2=609935&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.1/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java Tue Jan 8 03:18:34 2008
@@ -24,6 +24,7 @@
import java.io.IOException;
import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.jms.activemq.ActiveMQModuleActivator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -37,6 +38,7 @@
@Before
public void startServer() throws Exception {
+ ActiveMQModuleActivator.startBroker();
scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org