From 4ed0ed906e82c9484b384419fa4ef4c980768731 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 13 Nov 2008 20:02:36 +0000 Subject: Creating Java SCA 1.x branch git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@713805 13f79535-47bb-0310-9956-ffa450edef68 --- branches/sca-java-1.x/itest/jms-format/pom.xml | 97 ++++++++++++++ .../jmsbytes/helloworld/HelloWorldReference.java | 32 +++++ .../helloworld/HelloWorldReferenceImpl.java | 35 ++++++ .../jmsbytes/helloworld/HelloWorldService.java | 33 +++++ .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 33 +++++ .../helloworld/HelloWorldReference.java | 33 +++++ .../helloworld/HelloWorldReferenceImpl.java | 42 +++++++ .../jmsdelimited/helloworld/HelloWorldService.java | 35 ++++++ .../helloworld/HelloWorldServiceImpl.java | 36 ++++++ .../jmsmessage/helloworld/HelloWorldReference.java | 32 +++++ .../helloworld/HelloWorldReferenceImpl.java | 41 ++++++ .../jmsmessage/helloworld/HelloWorldService.java | 34 +++++ .../helloworld/HelloWorldServiceImpl.java | 51 ++++++++ .../helloworld/HelloWorldServiceReferenceSide.java | 37 ++++++ .../jms/format/jmsmessage/helloworld/README | 3 + .../helloworld/HelloWorldReferenceImpl.java | 47 +++++++ .../jmstextxml/helloworld/HelloWorldService.java | 33 +++++ .../helloworld/HelloWorldServiceImpl.java | 35 ++++++ .../jms/format/jmstextxml/helloworld/Person.java | 44 +++++++ .../main/resources/jmsbytes/helloworld.composite | 45 +++++++ .../resources/jmsdelimited/helloworld.composite | 44 +++++++ .../main/resources/jmsdelimited/helloworld.wsdl | 129 +++++++++++++++++++ .../main/resources/jmsmessage/helloworld.composite | 44 +++++++ .../src/main/resources/jmsmessage/helloworld.wsdl | 129 +++++++++++++++++++ .../main/resources/jmstextxml/helloworld.composite | 76 +++++++++++ .../src/main/resources/jmstextxml/helloworld.wsdl | 139 +++++++++++++++++++++ .../src/main/resources/jmstextxml/messages.xml | 19 +++ .../jms-format/src/main/resources/jndi.properties | 39 ++++++ .../binding/jms/format/FormatJMSBytesTestCase.java | 64 ++++++++++ .../jms/format/FormatJMSDelimitedTestCase.java | 66 ++++++++++ .../jms/format/FormatJMSMessageTestCase.java | 64 ++++++++++ .../jms/format/FormatJMSTextXMLTestCase.java | 68 ++++++++++ 32 files changed, 1659 insertions(+) create mode 100644 branches/sca-java-1.x/itest/jms-format/pom.xml create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReference.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReferenceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldServiceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsbytes/helloworld.composite create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.composite create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.wsdl create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.wsdl create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.wsdl create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/messages.xml create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/resources/jndi.properties create mode 100644 branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java create mode 100644 branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java (limited to 'branches/sca-java-1.x/itest/jms-format') diff --git a/branches/sca-java-1.x/itest/jms-format/pom.xml b/branches/sca-java-1.x/itest/jms-format/pom.xml new file mode 100644 index 0000000000..03a7144e3e --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.4-SNAPSHOT + ../../pom.xml + + itest-jms-format + Apache Tuscany SCA JMS Message Format Tests + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-sca-api + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 1.4-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + org.apache.activemq + activemq-core + 4.1.1 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..b1f62c1422 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java @@ -0,0 +1,32 @@ +/* + * 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.jmsbytes.helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..878fdb4fe4 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,35 @@ +/* + * 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.jmsbytes.helloworld; + +import org.osoa.sca.annotations.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + return stringValue; + } +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..82c57dfe75 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * 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.jmsbytes.helloworld; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..f0b7819c3b --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,33 @@ +/* + * 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.jmsbytes.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + +} + 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/jmsdelimited/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..ba563b658f --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReference.java @@ -0,0 +1,33 @@ +/* + * 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.jmsdelimited.helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + 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/jmsdelimited/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..e5677169fe --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,42 @@ +/* + * 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.jmsdelimited.helloworld; + +import org.osoa.sca.annotations.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String firstName, + String lastName){ + helloWorldService1.setGreetings(firstName, lastName); + + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + return HelloWorldServiceImpl.getGreetings(); + } +} + 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/jmsdelimited/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..623fd43871 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldService.java @@ -0,0 +1,35 @@ +/* + * 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.jmsdelimited.helloworld; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + @OneWay + public void setGreetings(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/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..72ae0a330e --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdelimited/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,36 @@ +/* + * 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.jmsdelimited.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + private static String greetings = "not set"; + + public void setGreetings(String firstName, + String lastName){ + + greetings = "Hello " + firstName + " " + lastName; + } + + public static String getGreetings(){ + return greetings; + } +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..948732adb4 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java @@ -0,0 +1,32 @@ +/* + * 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.jmsmessage.helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..ed697f8a38 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,41 @@ +/* + * 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.jmsmessage.helloworld; + +import org.osoa.sca.annotations.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReferenceSide helloWorldService1; + + public String getGreetings(String name){ + helloWorldService1.getGreetings(name); + + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + return HelloWorldServiceImpl.getGreetings(); + } +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..574188d466 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java @@ -0,0 +1,34 @@ +/* + * 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.jmsmessage.helloworld; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + @OneWay + public void onMessage(javax.jms.Message message); + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2956df755b --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,51 @@ +/* + * 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.jmsmessage.helloworld; + +import javax.jms.TextMessage; + +public class HelloWorldServiceImpl implements HelloWorldService { + + private static String greetings = "not set"; + + public void onMessage(javax.jms.Message message){ + + String name = null; + + try { + name = ((TextMessage)message).getText(); + } catch (Exception ex) { + name = "EXCEPTION"; + } + greetings = "Hello " + name; + } + + public static String getGreetings(){ + return greetings; + } + + // javax.jms.BytesMessage + // javax.jms.MapMessage + // javax.jms.ObjectMessage + // javax.jms.StreamMessage + // javax.jms.TextMessage + + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java new file mode 100644 index 0000000000..39af400f6a --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java @@ -0,0 +1,37 @@ +/* + * 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.jmsmessage.helloworld; + +import javax.jws.soap.SOAPBinding; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReferenceSide { + + @OneWay + @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE) + public void getGreetings(String message); + +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README new file mode 100644 index 0000000000..d266735183 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README @@ -0,0 +1,3 @@ +This test uses an SCA composite to fake a scenario where the reference is and SCA reference but the +service is a non-SCA JMS endpoint. This gives us the opportunity to play about with the interface +configuration at the reference to see how the contents of the JMS message can be controlled. \ No newline at end of file diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..7a4f4df2e7 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.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.jmstextxml.helloworld; + +import org.osoa.sca.annotations.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldService { + + @Reference + protected HelloWorldService helloWorldService1; + + @Reference + protected HelloWorldService helloWorldService2; + + @Reference + protected HelloWorldService helloWorldService3; + + public String getGreetings(String name){ + return helloWorldService1.getGreetings(name) + " " + + helloWorldService2.getGreetings(name) + " " + + helloWorldService3.getGreetings(name); + } + + public String getPersonGreetings(Person person){ + return helloWorldService1.getPersonGreetings(person) + " " + + helloWorldService2.getPersonGreetings(person) + " " + + helloWorldService3.getPersonGreetings(person); + } +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bf19e9069b --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * 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.jmstextxml.helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); + + public String getPersonGreetings(Person person); +} + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..e1706dbe6b --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,35 @@ +/* + * 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.jmstextxml.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getGreetings(String name){ + String response = "Hello " + name; + System.out.println("getGreetings: " + response); + return response; + } + + public String getPersonGreetings(Person person){ + String response = "Hello " + person.getFirstName() + " " + person.getLastName(); + System.out.println("getPersonGreetings: " + response); + return response; + } +} + 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 new file mode 100644 index 0000000000..dd15a83453 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java @@ -0,0 +1,44 @@ +/* + * 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.jmstextxml.helloworld; + +import org.osoa.sca.annotations.Remotable; + + +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; + } + +} + 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 new file mode 100644 index 0000000000..ef66c5583c --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsbytes/helloworld.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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/jmsdelimited/helloworld.composite new file mode 100644 index 0000000000..f487996324 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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/jmsdelimited/helloworld.wsdl new file mode 100644 index 0000000000..092c56b31d --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsdelimited/helloworld.wsdl @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite new file mode 100644 index 0000000000..f487996324 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.wsdl b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.wsdl new file mode 100644 index 0000000000..092c56b31d --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.wsdl @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite new file mode 100644 index 0000000000..07507e0ebe --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.wsdl b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.wsdl new file mode 100644 index 0000000000..30372cc02f --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.wsdl @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/messages.xml b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/messages.xml new file mode 100644 index 0000000000..3cd1238c79 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/messages.xml @@ -0,0 +1,19 @@ + + + Fred Bloggs + + + + Hello Fred Bloggs + + + + + Fred + Bloggs + + + + Hello Fred Bloggs + + diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jndi.properties b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jndi.properties new file mode 100644 index 0000000000..9abdff215d --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jndi.properties @@ -0,0 +1,39 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java new file mode 100644 index 0000000000..3d40d4fa85 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.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 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")); + //assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} 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/FormatJMSDelimitedTestCase.java new file mode 100644 index 0000000000..90b74146e5 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.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.jmsdelimited.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 FormatJMSDelimitedTestCase { + + private static SCANode node; + + @Before + public void init() { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("jmsdelimited/helloworld.composite", + new SCAContribution("test", "./target/classes")); + + node.start(); + } + + @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")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java new file mode 100644 index 0000000000..18955df933 --- /dev/null +++ b/branches/sca-java-1.x/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/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java new file mode 100644 index 0000000000..944e8e5905 --- /dev/null +++ b/branches/sca-java-1.x/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.HelloWorldService; +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 { + HelloWorldService helloWorldService = ((SCAClient)node).getService(HelloWorldService.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", helloWorldService.getPersonGreetings(person)); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} -- cgit v1.2.3