Return-Path: Delivered-To: apmail-tuscany-commits-archive@www.apache.org Received: (qmail 89271 invoked from network); 18 Nov 2008 16:41:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Nov 2008 16:41:30 -0000 Received: (qmail 46093 invoked by uid 500); 18 Nov 2008 16:41:38 -0000 Delivered-To: apmail-tuscany-commits-archive@tuscany.apache.org Received: (qmail 46072 invoked by uid 500); 18 Nov 2008 16:41:38 -0000 Mailing-List: contact commits-help@tuscany.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tuscany.apache.org Delivered-To: mailing list commits@tuscany.apache.org Received: (qmail 46063 invoked by uid 99); 18 Nov 2008 16:41:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2008 08:41:38 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2008 16:40:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5366C23888AF; Tue, 18 Nov 2008 08:40:30 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r718645 - in /tuscany/branches/sca-java-1.x/itest/jms-topics: ./ 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/tus... Date: Tue, 18 Nov 2008 16:40:29 -0000 To: commits@tuscany.apache.org From: antelder@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081118164030.5366C23888AF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: antelder Date: Tue Nov 18 08:40:28 2008 New Revision: 718645 URL: http://svn.apache.org/viewvc?rev=718645&view=rev Log: Add a jms itest using topics Added: tuscany/branches/sca-java-1.x/itest/jms-topics/ (with props) tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml tuscany/branches/sca-java-1.x/itest/jms-topics/src/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java Propchange: tuscany/branches/sca-java-1.x/itest/jms-topics/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Tue Nov 18 08:40:28 2008 @@ -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/branches/sca-java-1.x/itest/jms-topics/pom.xml URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml Tue Nov 18 08:40:28 2008 @@ -0,0 +1,94 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.4-SNAPSHOT + ../../pom.xml + + itest-jms-topics + Apache Tuscany SCA JMS Tests for topics + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-sca-api + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 1.4-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + org.apache.tuscany.sca + tuscany-node-impl + 1.4-SNAPSHOT + test + + + + + org.apache.activemq + activemq-core + 5.1.0 + test + + + + + + ${artifactId} + + Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java Tue Nov 18 08:40:28 2008 @@ -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); + } + +} Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java Tue Nov 18 08:40:28 2008 @@ -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); +} Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java Tue Nov 18 08:40:28 2008 @@ -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(); + } + } + +} Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties Tue Nov 18 08:40:28 2008 @@ -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. +## --------------------------------------------------------------------------- + +# 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&broker.useJmx=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] + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic +topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite Tue Nov 18 08:40:28 2008 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite Tue Nov 18 08:40:28 2008 @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java?rev=718645&view=auto ============================================================================== --- tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java (added) +++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java Tue Nov 18 08:40:28 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 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 TopicsTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = SCADomain.newInstance("http://localhost", "/", "topics/TopicsClient.composite", "topics/TopicsService.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(); + } + } +}