Author: antelder
Date: Tue Feb 12 09:49:52 2008
New Revision: 620887
URL: http://svn.apache.org/viewvc?rev=620887&view=rev
Log:
Add messageprocessor testcase
Added:
incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
(with props)
incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite
incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
(with props)
Modified:
incubator/tuscany/java/sca/itest/jms/pom.xml
Modified: incubator/tuscany/java/sca/itest/jms/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/pom.xml?rev=620887&r1=620886&r2=620887&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/jms/pom.xml Tue Feb 12 09:49:52 2008
@@ -61,7 +61,6 @@
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jms</artifactId>
<version>1.2-incubating-SNAPSHOT</version>
- <scope>runtime</scope>
</dependency>
<dependency>
Added:
incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java?rev=620887&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
(added)
+++
incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
Tue Feb 12 09:49:52 2008
@@ -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.JMSMessageProcessorImpl;
+
+public class TestMessageProcessor extends JMSMessageProcessorImpl {
+
+ 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);
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite?rev=620887&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite
(added)
+++
incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite
Tue Feb 12 09:49:52 2008
@@ -0,0 +1,39 @@
+<?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:61619"
messageProcessor="org.apache.tuscany.sca.binding.jms.TestMessageProcessor">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
Added:
incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java?rev=620887&view=auto
==============================================================================
---
incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
(added)
+++
incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
Tue Feb 12 09:49:52 2008
@@ -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();
+ }
+ }
+}
Propchange:
incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]