diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-30 14:23:47 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-30 14:23:47 +0000 |
commit | 7c7403152d1c7098ec225305be8d7efd761ae8d2 (patch) | |
tree | e85886168731363d796ec65bbaaa423ada6f6108 /branches | |
parent | c8f58fe2afa3f2f3bdf86846a48cb5a6dd7d503b (diff) |
Remove delimited test as we don't have an example delimited wire format. Add a JMS Object example
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@721821 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
10 files changed, 101 insertions, 71 deletions
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReference.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java index ba563b658f..89bae83c77 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReference.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.binding.jms.format.jmsdelimited.helloworld; +package org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; import org.osoa.sca.annotations.Remotable; @@ -26,8 +26,7 @@ import org.osoa.sca.annotations.Remotable; @Remotable public interface HelloWorldReference { - public String getGreetings(String firstName, - String lastName); + public String getGreetings(String firstName, String lastName); } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java index e5677169fe..a2cb1b6763 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReferenceImpl.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.binding.jms.format.jmsdelimited.helloworld; +package org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; import org.osoa.sca.annotations.Reference; @@ -24,19 +24,15 @@ import org.osoa.sca.annotations.Reference; public class HelloWorldReferenceImpl implements HelloWorldReference { @Reference - protected HelloWorldService helloWorldService1; + protected HelloWorldService helloWorldService; - public String getGreetings(String firstName, - String lastName){ - helloWorldService1.setGreetings(firstName, lastName); + public String getGreetings(String firstName, String lastName){ + Person person = new Person(); + person.setFirstName(firstName); + person.setLastName(lastName); + Person returnPerson = helloWorldService.getGreetings(person); - try { - Thread.sleep(2000); - } catch (Exception ex) { - // do nothing - } - - return HelloWorldServiceImpl.getGreetings(); + return returnPerson.getFirstName() + " " + returnPerson.getLastName(); } } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java index 623fd43871..485e184f6c 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldService.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java @@ -16,9 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.binding.jms.format.jmsdelimited.helloworld; +package org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; -import org.osoa.sca.annotations.OneWay; import org.osoa.sca.annotations.Remotable; /** @@ -27,9 +26,7 @@ import org.osoa.sca.annotations.Remotable; @Remotable public interface HelloWorldService { - @OneWay - public void setGreetings(String firstName, - String lastName); + public Person getGreetings(Person person); } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java index 72ae0a330e..4747136509 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldServiceImpl.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java @@ -16,21 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.binding.jms.format.jmsdelimited.helloworld; +package org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; public class HelloWorldServiceImpl implements HelloWorldService { - private static String greetings = "not set"; - - public void setGreetings(String firstName, - String lastName){ + public Person getGreetings(Person person){ - greetings = "Hello " + firstName + " " + lastName; - } - - public static String getGreetings(){ - return greetings; + person.setFirstName("Hello " + person.getFirstName()); + person.setLastName("Hello " + person.getLastName()); + + return person; } } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java new file mode 100644 index 0000000000..35c383ace9 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java @@ -0,0 +1,47 @@ +/* + * 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. + */ +package org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +import java.io.Serializable; + +public class Person implements Serializable { + + private static final long serialVersionUID = -6842761353978551779L; + + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java index dd15a83453..8f9c3564f8 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java @@ -18,27 +18,25 @@ */ package org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld; -import org.osoa.sca.annotations.Remotable; +public class Person { + String firstName; + String lastName; + public String getFirstName() { + return firstName; + } -public class Person { - String firstName; - String lastName; - - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsbytes/helloworld.composite b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsbytes/helloworld.composite index ef66c5583c..ea6ed6c464 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsbytes/helloworld.composite +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsbytes/helloworld.composite @@ -19,7 +19,7 @@ --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://helloworld" - xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:hw="http://helloworld" name="helloworld"> @@ -28,7 +28,7 @@ <reference name="helloWorldService1" > <binding.jms> <destination name="HelloWorldService1"/> - <t:wireFormat.jmsBytes/> + <tuscany:wireFormat.jmsBytes/> </binding.jms> </reference> </component> @@ -38,7 +38,7 @@ <service name="HelloWorldService"> <binding.jms> <destination name="HelloWorldService1"/> - <t:wireFormat.jmsBytes/> + <tuscany:wireFormat.jmsBytes/> </binding.jms> </service> </component> diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.composite b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsobject/helloworld.composite index f487996324..1fc5c095f7 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.composite +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsobject/helloworld.composite @@ -20,24 +20,25 @@ <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://helloworld" xmlns:hw="http://helloworld" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" name="helloworld"> <component name="HelloWorldReferenceComponent"> - <implementation.java class="org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld.HelloWorldReferenceImpl" /> - <reference name="helloWorldService1" > - <!--interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/--> - <interface.java interface="org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld.HelloWorldServiceReferenceSide"/> + <implementation.java class="org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld.HelloWorldReferenceImpl" /> + <reference name="helloWorldService" > <binding.jms> <destination name="HelloWorldService1"/> + <tuscany:wireFormat.jmsObject/> </binding.jms> </reference> </component> <component name="HelloWorldServiceComponent1"> - <implementation.java class="org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld.HelloWorldServiceImpl" /> + <implementation.java class="org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld.HelloWorldServiceImpl" /> <service name="HelloWorldService"> <binding.jms> <destination name="HelloWorldService1"/> + <tuscany:wireFormat.jmsObject/> </binding.jms> </service> </component> diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.wsdl b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsobject/helloworld.wsdl index 092c56b31d..092c56b31d 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.wsdl +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsobject/helloworld.wsdl diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java index 9f365ba3c1..5306497a3f 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java +++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java @@ -20,7 +20,7 @@ package org.apache.tuscany.sca.binding.jms.format; import static org.junit.Assert.assertEquals; -import org.apache.tuscany.sca.binding.jms.format.jmsdelimited.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld.HelloWorldReference; import org.apache.tuscany.sca.node.SCAClient; import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode; @@ -34,31 +34,27 @@ import org.junit.Test; /** * This shows how to test the JMS binding using a simple HelloWorld application. */ -public class FormatJMSDelimitedTestCase { +public class FormatJMSObjectTestCase { private static SCANode node; @Before public void init() { SCANodeFactory factory = SCANodeFactory.newInstance(); - node = factory.createSCANode("jmsdelimited/helloworld.composite", - new SCAContribution("test", "./target/classes")); + node = factory.createSCANode("jmsobject/helloworld.composite", + new SCAContribution("test", "./target/classes")); node.start(); } - /** - * The delimited wrie format is not yet implemented - * - */ @Test - @Ignore public void testHelloWorldCreate() throws Exception { - HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); - - System.out.println(helloWorldService.getGreetings("Fred", "Bloggs")); - //assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); - + HelloWorldReference helloWorldService = ((SCAClient) node).getService( + HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Hello Bloggs", + helloWorldService.getGreetings("Fred", "Bloggs")); + } @After |