You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/09/10 10:08:28 UTC
svn commit: r574164 - in /incubator/tuscany/java/sca:
itest/callablereferences/
itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/
itest/callablereferences/src/main/resources/_node/
itest/callablereferences/src/main/resour...
Author: slaws
Date: Mon Sep 10 01:08:27 2007
New Revision: 574164
URL: http://svn.apache.org/viewvc?rev=574164&view=rev
Log:
Added a remote callable reference test. The remote case not working yet but this is the framework for the test
Added:
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/META-INF/
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/META-INF/sca-contribution.xml
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/management.composite
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/META-INF/
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/META-INF/sca-contribution.xml
incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/domain.composite
incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
Modified:
incubator/tuscany/java/sca/itest/callablereferences/pom.xml
incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java
incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java
incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
Modified: incubator/tuscany/java/sca/itest/callablereferences/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/pom.xml?rev=574164&r1=574163&r2=574164&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/callablereferences/pom.xml Mon Sep 10 01:08:27 2007
@@ -42,5 +42,33 @@
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distributed-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified: incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java?rev=574164&r1=574163&r2=574164&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java (original)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java Mon Sep 10 01:08:27 2007
@@ -19,7 +19,9 @@
package org.apache.tuscany.sca.itest.callableref;
import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+@Remotable
public interface BComponent {
String foo();
Modified: incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java?rev=574164&r1=574163&r2=574164&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java (original)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java Mon Sep 10 01:08:27 2007
@@ -18,6 +18,9 @@
*/
package org.apache.tuscany.sca.itest.callableref;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
public interface CComponent {
String foo();
Added: incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/META-INF/sca-contribution.xml?rev=574164&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/META-INF/sca-contribution.xml Mon Sep 10 01:08:27 2007
@@ -0,0 +1,24 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://management"
+ xmlns:management="http://management">
+ <deployable composite="management:Management"/>
+</contribution>
\ No newline at end of file
Added: incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/management.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/management.composite?rev=574164&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/management.composite (added)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/_node/management.composite Mon Sep 10 01:08:27 2007
@@ -0,0 +1,57 @@
+<?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"
+ targetNamespace="http://management"
+ xmlns:sample="http://management"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="Management">
+
+ <component name="NodeManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.distributed.node.impl.NodeManagerServiceImpl"/>
+ <service name="NodeManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.distributed.node.NodeManagerInitService"/>
+ </service>
+ <service name="NodeManagerService">
+ <interface.java interface="org.apache.tuscany.sca.distributed.node.NodeManagerService"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8081/NodeManagerComponent/NodeManagerJson"/>
+ </service>
+ <service name="ComponentManagerService">
+ <interface.java interface="org.apache.tuscany.sca.distributed.node.ComponentManagerService"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8081/NodeManagerComponent/ComponentManagerJson"/>
+ </service>
+ </component>
+
+ <component name="DomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.distributed.node.impl.DomainManagerProxyImpl"/>
+ <reference name="domainManager">
+ <interface.java interface="org.apache.tuscany.sca.distributed.domain.DomainManagerService"/>
+ <binding.ws uri="http://localhost:8080/DomainManagerComponent/DomainManager"/>
+ </reference>
+ </component>
+
+ <component name="ServiceDiscoveryComponent">
+ <implementation.java class="org.apache.tuscany.sca.distributed.node.impl.ServiceDiscoveryProxyImpl" />
+ <reference name="serviceDiscovery">
+ <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+ </reference>
+ </component>
+
+
+</composite>
Added: incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/META-INF/sca-contribution.xml?rev=574164&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/META-INF/sca-contribution.xml Mon Sep 10 01:08:27 2007
@@ -0,0 +1,24 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Domain"/>
+</contribution>
\ No newline at end of file
Added: incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/domain.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/domain.composite?rev=574164&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/domain.composite (added)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/main/resources/domain/domain.composite Mon Sep 10 01:08:27 2007
@@ -0,0 +1,43 @@
+<?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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Domain">
+
+ <component name="DomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.distributed.domain.impl.DomainManagerServiceImpl"/>
+ <service name="DomainManagerService">
+ <interface.java interface="org.apache.tuscany.sca.distributed.domain.DomainManagerService"/>
+ <binding.ws uri="http://localhost:8080/DomainManagerComponent/DomainManager"/>
+ </service>
+ <reference name="serviceDiscovery" target="ServiceDiscoveryComponent"/>
+ </component>
+
+ <component name="ServiceDiscoveryComponent">
+ <implementation.java class="org.apache.tuscany.sca.distributed.domain.impl.ServiceDiscoveryServiceImpl" />
+ <service name="ServiceDiscoveryService">
+ <interface.java interface="org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService"/>
+ <binding.sca uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscoverySCA"/>
+ <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+ </service>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java?rev=574164&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java Mon Sep 10 01:08:27 2007
@@ -0,0 +1,127 @@
+/*
+ * 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.itest.callableref;
+
+
+import static junit.framework.Assert.assertEquals;
+
+
+import junit.framework.Assert;
+
+
+import org.apache.tuscany.sca.distributed.node.impl.NodeImpl;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CallableReferenceRemoteTestCase {
+
+ private static String DEFAULT_DOMAIN_NAME = "mydomain";
+
+ private static NodeImpl registry;
+ private static NodeImpl nodeA;
+ private static NodeImpl nodeB;
+
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up distributed registry");
+ registry = new NodeImpl();
+ registry.start();
+ registry.getContributionManager().startContribution(CallableReferenceRemoteTestCase.class.getClassLoader().getResource("domain/"));
+ //registry.getContributionManager().startContribution("file:///C:/simon/tuscany/java-head/sca/modules/distributed-impl/target/tuscany-distributed-impl-1.0-incubating-SNAPSHOT.jar");
+
+ System.out.println("Setting up distributed nodes");
+
+ // create the node that runs the
+ // calculator component
+ nodeA = new NodeImpl(DEFAULT_DOMAIN_NAME, "nodeA");
+ nodeA.start();
+ nodeA.getContributionManager().startContribution(CallableReferenceRemoteTestCase.class.getClassLoader().getResource("nodeA/"));
+
+ // create the node that runs the
+ // add component
+ nodeB = new NodeImpl(DEFAULT_DOMAIN_NAME, "nodeB");
+ nodeB.start();
+ nodeB.getContributionManager().startContribution(CallableReferenceRemoteTestCase.class.getClassLoader().getResource("nodeB/"));
+
+
+ // get a reference to the calculator service from domainA
+ // which will be running this component
+ acomponent = nodeA.getService(AComponent.class, "AComponent");
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ nodeA.stop();
+ nodeB.stop();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+ //@Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().foo(null);
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
Modified: incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java?rev=574164&r1=574163&r2=574164&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java Mon Sep 10 01:08:27 2007
@@ -65,7 +65,7 @@
public void testDReference() {
assertEquals("DAComponent", acomponent.fooD());
}
-
+
@Test
public void testBCReference() {
assertEquals("BCComponent", acomponent.fooBC());
Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java?rev=574164&r1=574163&r2=574164&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java Mon Sep 10 01:08:27 2007
@@ -221,13 +221,16 @@
conversation.setConversationID(parameters.getConversationID());
}
}
- URI uri = URI.create(componentURI + "/");
+
for (Binding binding : reference.getBindings()) {
if (binding instanceof WireableBinding) {
- String targetURI = uri.resolve(binding.getURI()).toString();
+ String targetURI = binding.getURI();
int index = targetURI.lastIndexOf('/');
- String serviceName = targetURI.substring(index + 1);
- targetURI = targetURI.substring(0, index);
+ String serviceName = "";
+ if (index > -1){
+ serviceName = targetURI.substring(index + 1);
+ targetURI = targetURI.substring(0, index);
+ }
Component targetComponet = compositeActivator.resolve(targetURI);
ComponentService targetService = null;
if (targetComponet != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org