diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.3.3/itest/jms')
38 files changed, 1686 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/pom.xml b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/pom.xml new file mode 100644 index 0000000000..36342b5b7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/pom.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.3.3-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <artifactId>itest-jms</artifactId> + <name>Apache Tuscany SCA JMS Tests</name> + + <repositories> + <repository> + <id>apache.incubator</id> + <url>http://people.apache.org/repo/m2-incubating-repository</url> + </repository> + </repositories> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>1.3.3-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.3.3-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.3.3-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jms</artifactId> + <version>1.3.3-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-core</artifactId> + <version>4.1.1</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java new file mode 100644 index 0000000000..7b1c63d437 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java @@ -0,0 +1,28 @@ +/* + * 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; + +public class CheckedExcpetion extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetion(String s) { + super(s); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java new file mode 100644 index 0000000000..46bf911def --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java @@ -0,0 +1,30 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface ExceptionService { + + public void throwChecked() throws CheckedExcpetion; + + public void throwUnChecked(); +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java new file mode 100644 index 0000000000..cd3c09e17f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java @@ -0,0 +1,45 @@ +/* + * 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; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(ExceptionService.class) +public class ExceptionServiceClient implements ExceptionService { + + private ExceptionService service; + + @Reference + public void setService(ExceptionService service) { + this.service = service; + } + + public void throwChecked() throws CheckedExcpetion { + service.throwChecked(); + } + + public void throwUnChecked() { + service.throwUnChecked(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java new file mode 100644 index 0000000000..ab293a5df1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.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; + +public class ExceptionServiceImpl implements ExceptionService { + + public void throwChecked() throws CheckedExcpetion { + throw new CheckedExcpetion("foo"); + } + + public void throwUnChecked() { + throw new RuntimeException("bla"); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..86d4719646 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldClientImpl implements HelloWorldService { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..abb29aec4c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..21d2de2cf0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java @@ -0,0 +1,30 @@ +/* + * 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; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java new file mode 100644 index 0000000000..218cccf64c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the OneWay service. + */ +@Service(OneWayService.class) +public class OneWayClientImpl implements OneWayService { + + private OneWayService serviceA; + + @Reference + public void setServiceA(OneWayService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java new file mode 100644 index 0000000000..9795089952 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java @@ -0,0 +1,29 @@ +/* + * 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; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface OneWayObjectService { + + @OneWay + void sayHello(Object name); +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java new file mode 100644 index 0000000000..25a89fc5b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.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; + +public class OneWayObjectServiceImpl implements OneWayObjectService { + + public static Object mutex = new Object(); + public static Object name; + + public void sayHello(Object name) { + OneWayObjectServiceImpl.name = name; + synchronized (OneWayObjectServiceImpl.mutex) { + OneWayObjectServiceImpl.mutex.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..f16f853ba7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java @@ -0,0 +1,29 @@ +/* + * 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; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..bff4536fa0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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; + +public class OneWayServiceImpl implements OneWayService { + + public static Object mutex = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.mutex) { + OneWayServiceImpl.mutex.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java new file mode 100644 index 0000000000..cfe7a649d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java @@ -0,0 +1,57 @@ +/* + * 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; + +import javax.jms.Message; +import javax.jms.Session; + +import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; +import org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor; + +public class TestMessageProcessor extends XMLTextMessageProcessor { + + public static boolean insertPayloadIntoJMSMessageCalled; + public static boolean extractPayloadFromJMSMessageCalled; + public static boolean setOperationNameCalled; + + public TestMessageProcessor(JMSBinding jmsBinding) { + super(jmsBinding); + } + public Object extractPayloadFromJMSMessage(Message message) { + extractPayloadFromJMSMessageCalled = true; + return super.extractPayloadFromJMSMessage(message); + } + + public String getOperationName(Message message) { + // is this used? + return super.getOperationName(message); + } + + public Message insertPayloadIntoJMSMessage(Session session, Object payload) { + insertPayloadIntoJMSMessageCalled = true; + return super.insertPayloadIntoJMSMessage(session, payload); + } + + public void setOperationName(String operationName, Message message) { + setOperationNameCalled = true; + super.setOperationName(operationName, message); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/defaults/client.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/defaults/client.composite new file mode 100644 index 0000000000..02c04e6afd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/defaults/client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms uri="jms:HelloWorldService" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/defaults/service.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/defaults/service.composite new file mode 100644 index 0000000000..45c1819e2b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/defaults/service.composite @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/dynamic/client.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/dynamic/client.composite new file mode 100644 index 0000000000..494fe9790f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/dynamic/client.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ <!-- No response destination defined means a temporary queue will be used -->
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/exceptions/client.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/exceptions/client.composite new file mode 100644 index 0000000000..8bb7f86252 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/exceptions/client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ExceptionClientComposite">
+
+ <component name="ExceptionServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ExceptionServiceClient"/>
+ <reference name="service" />
+ </component>
+
+ <reference name="service" promote="ExceptionServiceClient/service">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.ExceptionService" />
+ <binding.jms uri="jms:ExceptionService" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/exceptions/service.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/exceptions/service.composite new file mode 100644 index 0000000000..052ff9d985 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/exceptions/service.composite @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ExceptionServiceComposite">
+
+ <component name="ExceptionService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ExceptionServiceImpl"/>
+ <service name="ExceptionService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/external/client.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/external/client.composite new file mode 100644 index 0000000000..dcea428493 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/external/client.composite @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/external/service.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/external/service.composite new file mode 100644 index 0000000000..44b7b29610 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/external/service.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/jndi.properties new file mode 100644 index 0000000000..9abdff215d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/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/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/nonSCAclient/service.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/nonSCAclient/service.composite new file mode 100644 index 0000000000..584a44dc4b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/nonSCAclient/service.composite @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="DefaultService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61618"
+ messageProcessor="XMLTextMessage">
+ </binding.jms>
+ </service>
+ </component>
+
+ <component name="TextService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61618"
+ messageProcessor="TextMessage"
+ uri="jms:TextDest" />
+ </service>
+ </component>
+
+ <component name="ObjectService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayObjectServiceImpl"/>
+ <service name="OneWayObjectService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61618"
+ messageProcessor="ObjectMessage"
+ uri="jms:ObjectDest" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/oneway/OneWayClient.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/oneway/OneWayClient.composite new file mode 100644 index 0000000000..cd9a62ee6f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/oneway/OneWayClient.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OneWayComposite">
+
+ <component name="OneWayClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="OneWayClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.OneWayService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/oneway/OneWayService.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/oneway/OneWayService.composite new file mode 100644 index 0000000000..3c53881141 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/oneway/OneWayService.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OneWayComposite">
+
+ <component name="OneWayService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms>
+ <destination name="DestQueueA" create="always"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/client.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/client.composite new file mode 100644 index 0000000000..3f5229a30c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/client.composite @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/mpclient.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/mpclient.composite new file mode 100644 index 0000000000..2c8dc463e0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/mpclient.composite @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms messageProcessor="org.apache.tuscany.sca.binding.jms.TestMessageProcessor">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/service.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/service.composite new file mode 100644 index 0000000000..47200f9005 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/service.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms>
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/uriclient.composite b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/uriclient.composite new file mode 100644 index 0000000000..a6c9ee3822 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/main/resources/simple/uriclient.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms uri="jms:DestQueueA" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java new file mode 100644 index 0000000000..dca9386637 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java @@ -0,0 +1,54 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 DefaultsTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/", "defaults/client.composite", "defaults/service.composite"); + // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java new file mode 100644 index 0000000000..41fbf04c0a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java @@ -0,0 +1,53 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 DynamicReplyQTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/dynamic", "dynamic/client.composite", "simple/service.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Beate", helloWorldService.sayHello("Beate")); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java new file mode 100644 index 0000000000..051be93f22 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java @@ -0,0 +1,70 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 ExceptionsTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/", "exceptions/client.composite", "exceptions/service.composite"); + } + + @Test + public void testChecked() { + ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwChecked(); + fail(); + } catch (CheckedExcpetion e) { + assertEquals("foo", e.getMessage()); + } + } + + @Test + public void testUnChecked() { + ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwUnChecked(); + fail(); + } catch (Exception e) { + assertEquals("bla", e.getCause().getCause().getMessage()); + } + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java new file mode 100644 index 0000000000..c34ad07901 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java @@ -0,0 +1,70 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests using the JMS binding with an external JMS broker + */ +public class ExternalBrokerTestCase { + + private static SCADomain scaDomain; + private BrokerService broker; + + @Before + public void init() throws Exception { + startBroker(); + scaDomain = SCADomain.newInstance("http://localhost", "/", "external/client.composite", "external/service.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + stopBroker(); + } + + protected void startBroker() throws Exception { + broker = new BrokerService(); + broker.setPersistent(false); + broker.setUseJmx(false); + broker.addConnector("tcp://localhost:61616"); + broker.start(); + } + protected void stopBroker() throws Exception { + if (broker != null) { + broker.stop(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java new file mode 100644 index 0000000000..9ec77ca440 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java @@ -0,0 +1,58 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 MessageProcessorTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/", "simple/mpclient.composite", "simple/service.composite"); + // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + assertTrue(TestMessageProcessor.extractPayloadFromJMSMessageCalled); + assertTrue(TestMessageProcessor.insertPayloadIntoJMSMessageCalled); + assertTrue(TestMessageProcessor.setOperationNameCalled); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java new file mode 100644 index 0000000000..94581876fd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java @@ -0,0 +1,139 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +import javax.jms.JMSException; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.naming.NamingException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 NonSCAClientTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() throws Exception { + startBroker(); + scaDomain = SCADomain.newInstance("http://localhost", "/", "nonSCAclient/service.composite"); + OneWayServiceImpl.name = null; + } + + @Test + public void testXMLText() throws Exception { + + synchronized (OneWayServiceImpl.mutex) { + + sendTextMessage("dynamicQueues/OneWayService", "<arg0>Petra</arg0>"); + + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @Test + public void testText() throws Exception { + + synchronized (OneWayServiceImpl.mutex) { + + sendTextMessage("dynamicQueues/TextDest", "Petra"); + + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @Test + public void testObject() throws Exception { + + Set<Integer> arg = new HashSet<Integer>(); + arg.add(new Integer(3)); + + synchronized (OneWayObjectServiceImpl.mutex) { + + sendObjectMessage("dynamicQueues/ObjectDest", arg); + + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayObjectServiceImpl.mutex.wait(10000); + } + assertEquals(arg, OneWayObjectServiceImpl.name); + } + + @After + public void end() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + stopBroker(); + } + + private BrokerService broker; + protected void startBroker() throws Exception { + broker = new BrokerService(); + broker.setPersistent(false); + broker.setUseJmx(false); + broker.addConnector("tcp://localhost:61618"); + broker.start(); + } + protected void stopBroker() throws Exception { + if (broker != null) { + broker.stop(); + } + } + + protected static void sendTextMessage(String destName, String payload) throws JMSException, NamingException { + JMSResourceFactory rf = new JMSResourceFactory(null, null, "tcp://localhost:61618"); + Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer p = session.createProducer(rf.lookupDestination(destName)); + rf.getConnection().start(); + session.run(); + p.send(session.createTextMessage(payload)); + rf.closeConnection(); + } + + protected static void sendObjectMessage(String destName, Object payload) throws JMSException, NamingException { + JMSResourceFactory rf = new JMSResourceFactory(null, null, "tcp://localhost:61618"); + Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer p = session.createProducer(rf.lookupDestination(destName)); + rf.getConnection().start(); + session.run(); + p.send(session.createObjectMessage((Serializable)payload)); + rf.closeConnection(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java new file mode 100644 index 0000000000..26dda13cf9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java @@ -0,0 +1,58 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 OneWayTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = SCADomain.newInstance("http://localhost", "/", "oneway/OneWayClient.composite", "oneway/OneWayService.composite"); + } + + @Test + public void testOneWayInvoked() throws Exception { + OneWayService oneWayService = scaDomain.getService(OneWayService.class, "OneWayClient"); + oneWayService.sayHello("Petra"); + synchronized (OneWayServiceImpl.mutex) { + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java new file mode 100644 index 0000000000..c1882a1e26 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java @@ -0,0 +1,54 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 RPCTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/", "simple/client.composite", "simple/service.composite"); + // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java new file mode 100644 index 0000000000..bed5515d7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3.3/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java @@ -0,0 +1,54 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +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 URIRPCTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/", "simple/uriclient.composite", "simple/service.composite"); + // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} |