You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/10/06 12:53:47 UTC

svn commit: r822214 - in /tuscany/java/sca/itest/jms/properties: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/main/java/org/apache/tuscany/sca/...

Author: antelder
Date: Tue Oct  6 10:53:47 2009
New Revision: 822214

URL: http://svn.apache.org/viewvc?rev=822214&view=rev
Log:
Separate out the jms properties tests from the general tests and bring up on 2.x

Added:
    tuscany/java/sca/itest/jms/properties/   (with props)
    tuscany/java/sca/itest/jms/properties/pom.xml
    tuscany/java/sca/itest/jms/properties/src/
    tuscany/java/sca/itest/jms/properties/src/main/
    tuscany/java/sca/itest/jms/properties/src/main/java/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java
    tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java
    tuscany/java/sca/itest/jms/properties/src/main/resources/
    tuscany/java/sca/itest/jms/properties/src/main/resources/META-INF/
    tuscany/java/sca/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml
    tuscany/java/sca/itest/jms/properties/src/main/resources/jndi.properties
    tuscany/java/sca/itest/jms/properties/src/main/resources/properties/
    tuscany/java/sca/itest/jms/properties/src/main/resources/properties/properties.composite
    tuscany/java/sca/itest/jms/properties/src/test/
    tuscany/java/sca/itest/jms/properties/src/test/java/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/
    tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java

Propchange: tuscany/java/sca/itest/jms/properties/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct  6 10:53:47 2009
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders

Added: tuscany/java/sca/itest/jms/properties/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/pom.xml?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/pom.xml (added)
+++ tuscany/java/sca/itest/jms/properties/pom.xml Tue Oct  6 10:53:47 2009
@@ -0,0 +1,83 @@
+<?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>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>itest-jms-properties</artifactId>
+    <name>Apache Tuscany SCA iTest JMS with Properties</name>
+
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>        
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>        
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jms-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <version>5.2.0</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+           <groupId>org.apache.geronimo.specs</groupId>
+           <artifactId>geronimo-jms_1.1_spec</artifactId>
+           <version>1.1</version>
+           <scope>provided</scope>
+           <exclusions>
+               <exclusion>
+                   <groupId>org.apache.geronimo.specs</groupId>
+                   <artifactId>geronimo-jms_1.1_spec</artifactId>
+               </exclusion>
+           </exclusions>
+        </dependency>         
+                
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+</project>

Added: tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java Tue Oct  6 10:53:47 2009
@@ -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;
+
+
+/**
+ * The client interface
+ */
+public interface JMSClient {
+
+    void aClientMethod();
+}

Added: tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java Tue Oct  6 10:53:47 2009
@@ -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;
+
+
+/**
+ * The client interface
+ */
+public interface MsgClient {
+
+    void aClientMethod();
+    void op2();
+}

Added: tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java Tue Oct  6 10:53:47 2009
@@ -0,0 +1,38 @@
+/*
+ * 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.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(MsgClient.class)
+public class MsgClientImpl implements MsgClient {
+
+    @Reference protected MsgClientService myService;
+
+    public void aClientMethod() {
+        myService.aClientMethod();
+    }
+
+    public void op2() {
+        myService.op2();
+    }
+
+}

Added: tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java Tue Oct  6 10:53:47 2009
@@ -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;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+
+/**
+ * The client interface
+ */
+@Remotable
+public interface MsgClientService {
+
+    void aClientMethod();
+
+    void op2();
+}

Added: tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java Tue Oct  6 10:53:47 2009
@@ -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;
+
+import org.oasisopen.sca.annotation.AllowsPassByReference;
+import org.oasisopen.sca.annotation.Remotable;
+
+
+@Remotable 
+@AllowsPassByReference
+public interface MsgService {
+    
+    void onMessage(javax.jms.Message msg);
+
+}

Added: tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java Tue Oct  6 10:53:47 2009
@@ -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.    
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+import javax.jms.Message;
+
+import org.oasisopen.sca.annotation.Service;
+
+@Service(MsgService.class)
+public class MsgServiceImpl implements MsgService {
+
+    public static Object lock = new Object();
+    public static Message msg;
+    
+    public void onMessage(Message msg) {
+        MsgServiceImpl.msg = msg;
+        synchronized(lock) {
+            lock.notifyAll();
+        }
+    }
+
+}

Added: tuscany/java/sca/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml Tue Oct  6 10:53:47 2009
@@ -0,0 +1,23 @@
+<?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.    
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+              xmlns:itest="http://itest">
+   <deployable composite="itest:PropertiesClientComposite"/>
+</contribution>
\ No newline at end of file

Added: tuscany/java/sca/itest/jms/properties/src/main/resources/jndi.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/resources/jndi.properties?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/resources/jndi.properties (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/resources/jndi.properties Tue Oct  6 10:53:47 2009
@@ -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

Added: tuscany/java/sca/itest/jms/properties/src/main/resources/properties/properties.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/main/resources/properties/properties.composite?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/main/resources/properties/properties.composite (added)
+++ tuscany/java/sca/itest/jms/properties/src/main/resources/properties/properties.composite Tue Oct  6 10:53:47 2009
@@ -0,0 +1,53 @@
+<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
+           targetNamespace="http://itest"
+           name="PropertiesClientComposite">
+
+    <component name="ClientComponent">
+        <implementation.java class="org.apache.tuscany.sca.binding.jms.MsgClientImpl" />
+        <reference name="myService">
+            <binding.jms uri="jms:ServiceQueue">
+               <headers type="myType"
+                        deliveryMode="persistent"
+                        timeToLive="4321"	
+                        priority="7">
+                  <property name="headP1">myHeadP1</property>    
+               </headers>
+               <operationProperties name="op2" nativeOperation="nativeOp2">
+                  <headers type="op2Type"
+                     deliveryMode="nonpersistent"
+                     timeToLive="6"
+                     priority="8">
+                     <property name="op2P2">foo</property>
+                  </headers>
+               </operationProperties>
+            </binding.jms>
+        </reference>
+    </component>
+
+    <component name="ServiceComponent">
+        <implementation.java class="org.apache.tuscany.sca.binding.jms.MsgServiceImpl" />
+        <service name="MsgService">
+            <binding.jms uri="jms:ServiceQueue"/>
+        </service>
+    </component>
+
+</composite>

Added: tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java?rev=822214&view=auto
==============================================================================
--- tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java (added)
+++ tuscany/java/sca/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java Tue Oct  6 10:53:47 2009
@@ -0,0 +1,93 @@
+/*
+ * 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.assertNotNull;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+import javax.jms.DeliveryMode;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ */
+public class PropertiesTestCase {
+
+    private static Node node;
+
+    @Before
+    public void init() {
+        node = NodeFactory.newInstance().createNode().start();
+    }
+
+    @Test
+    public void testProps1() throws Exception {
+        JMSClient client = node.getService(JMSClient.class, "ClientComponent");
+
+        client.aClientMethod();
+
+        // wait for up to 5 seconds but should wake up as soon as done
+        synchronized(MsgServiceImpl.lock) {
+            if (MsgServiceImpl.msg == null) {
+                MsgServiceImpl.lock.wait(5000);
+            }
+        }
+        assertNotNull(MsgServiceImpl.msg);
+
+        assertEquals("myType", MsgServiceImpl.msg.getJMSType());
+        assertEquals(DeliveryMode.PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode());
+        // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ
+        assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+    }
+
+    @Test
+    public void testOp2() throws Exception {
+        MsgClient client = node.getService(MsgClient.class, "ClientComponent");
+
+        client.op2();
+
+        // wait for up to 5 seconds but should wake up as soon as done
+        synchronized(MsgServiceImpl.lock) {
+            if (MsgServiceImpl.msg == null) {
+                MsgServiceImpl.lock.wait(6000);
+            }
+        }
+        assertNotNull(MsgServiceImpl.msg);
+
+        assertEquals("op2Type", MsgServiceImpl.msg.getJMSType());
+        // assertEquals(DeliveryMode.NON_PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); // Doesn't seem to work with ActiveMQ
+        // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ
+        assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+        assertEquals("foo", MsgServiceImpl.msg.getStringProperty("op2P2"));
+        //operation properties are a service side thing
+        //assertEquals("nativeOp2", MsgServiceImpl.msg.getStringProperty("scaOperationName"));
+    }
+
+    @After
+    public void end() {
+        if (node != null) {
+            node.stop();
+        }
+    }
+}