From 074cc3cff2f00457318bd322a6bd58f65686ae5c Mon Sep 17 00:00:00 2001 From: nash Date: Tue, 16 Nov 2010 10:40:14 +0000 Subject: Tag for 1.6.1-RC2 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1035578 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding/jms/format/FormatJMSBytesTestCase.java | 75 ++++++++++++++++++++ .../jms/format/FormatJMSBytesXMLTestCase.java | 64 +++++++++++++++++ .../jms/format/FormatJMSDefaultTestCase.java | 74 ++++++++++++++++++++ .../jms/format/FormatJMSMessageTestCase.java | 64 +++++++++++++++++ .../jms/format/FormatJMSObjectTestCase.java | 80 ++++++++++++++++++++++ .../binding/jms/format/FormatJMSTextTestCase.java | 66 ++++++++++++++++++ .../FormatJMSTextXMLInJMSObjectOutTestCase.java | 69 +++++++++++++++++++ .../jms/format/FormatJMSTextXMLTestCase.java | 68 ++++++++++++++++++ 8 files changed, 560 insertions(+) create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java create mode 100644 sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java (limited to 'sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test') diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java new file mode 100644 index 0000000000..a0429aa59f --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java @@ -0,0 +1,75 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSBytesTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmsbytes/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); +/* TUSCANY-2967 - disable this change while we decide what to do and + * return faults as JMSObject messages to be consistent + * again with other wire formats + assertEquals("Hello Fred Bloggs " + + "org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.CheckedException: foo " + + "org.osoa.sca.ServiceRuntimeException: java.lang.RuntimeException: bla", + helloWorldService.getGreetings("Fred Bloggs")); +*/ + assertEquals("Hello Fred Bloggs " + + "foo " + + "remote service exception, see nested exception" , + helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java new file mode 100644 index 0000000000..ec9a1adeb4 --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java @@ -0,0 +1,64 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSBytesXMLTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmsbytesxml/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); + assertEquals("Hello Fred Bloggs foo remote service exception, see nested exception", helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java new file mode 100644 index 0000000000..dc2cc13679 --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java @@ -0,0 +1,74 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld.HelloWorldServiceImpl; +import org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld.Person; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSDefaultTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmsdefault/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs foo remote service exception, see nested exception foo remote service exception, see nested exception", helloWorldService.getGreetings("Fred Bloggs")); + + Person person = new Person(); + person.setFirstName("Fred"); + person.setLastName("Bloggs"); + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs", helloWorldService.getPersonGreetings(person)); + + // this just makes sure that there are no exceptions thrown for this case + helloWorldService.nullInVoidOut(); + Assert.assertEquals(4, HelloWorldServiceImpl.nullInVoidOutCalled); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java new file mode 100644 index 0000000000..c617a984ef --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java @@ -0,0 +1,64 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSMessageTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmsmessage/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + 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")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java new file mode 100644 index 0000000000..462ebb557e --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java @@ -0,0 +1,80 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +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; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSObjectTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmsobject/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = ((SCAClient) node).getService( + HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs", + helloWorldService.getGreetingsWrapSingle("Fred", "Bloggs")); + + assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs foo java.lang.RuntimeException: bla", + helloWorldService.getGreetingsDontWrapSingle("Fred", "Bloggs")); + + } + + @Ignore + @Test + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java new file mode 100644 index 0000000000..d45e6492ce --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java @@ -0,0 +1,66 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSTextTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmstext/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); + assertEquals("Hello Fred Bloggs " + + "foo remote service exception, see nested exception", + helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java new file mode 100644 index 0000000000..5d3b0ac9e3 --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java @@ -0,0 +1,69 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmstextxmlinjmsobjectout.helloworld.HelloWorldService; +import org.apache.tuscany.sca.binding.jms.format.jmstextxmlinjmsobjectout.helloworld.Person; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSTextXMLInJMSObjectOutTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmstextxmlinjmsobjectout/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = ((SCAClient)node).getService(HelloWorldService.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); + + Person person = new Person(); + person.setFirstName("Fred"); + person.setLastName("Bloggs"); + assertEquals("Hello Fred Bloggs", helloWorldService.getPersonGreetings(person)); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java new file mode 100644 index 0000000000..5650d06a36 --- /dev/null +++ b/sca-java-1.x/tags/1.6.1-RC2/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java @@ -0,0 +1,68 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld.Person; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSTextXMLTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmstextxml/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); + + Person person = new Person(); + person.setFirstName("Fred"); + person.setLastName("Bloggs"); + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs foo remote service exception, see nested exception", helloWorldService.getPersonGreetings(person)); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} -- cgit v1.2.3