From 07fd00e4e80df89e0ea34a41700c021ba0c00650 Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 23 Feb 2010 15:21:10 +0000 Subject: TUSCANY-3473 - where a local call (local interface) is used within a contribution but where the hazelcast registry is in operation I've updated the registry to return the actual endpoint rather than the serialized version so that the endpoint isn't marked as remote and so that the interface contract is intact. This also adds and enables a test case that ensures that this is working. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@915379 13f79535-47bb-0310-9956-ffa450edef68 --- .../trunk/itest/nodes/one-jvm-hazelcast/pom.xml | 5 ++ .../java/itest/OneNodeOneContributionTestCase.java | 64 ++++++++++++++++++++++ sca-java-2.x/trunk/itest/nodes/pom.xml | 1 + .../hazelcast/HazelcastEndpointRegistry.java | 17 ++++-- 4 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/pom.xml b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/pom.xml index 54dca44b84..8c089de515 100644 --- a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/pom.xml +++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/pom.xml @@ -29,6 +29,11 @@ Apache Tuscany SCA iTest Nodes One JVM Using Hazelcast Registry + + org.apache.tuscany.sca + itest-nodes-helloworld-service-and-client + 2.0-SNAPSHOT + org.apache.tuscany.sca itest-nodes-helloworld-iface diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java new file mode 100644 index 0000000000..3755d0b365 --- /dev/null +++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java @@ -0,0 +1,64 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.sac.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeOneContributionTestCase{ + + private static URI domainURI = URI.create("tuscany:OneNodeTestCase"); + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service-and-client/target/classes"); + node.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/trunk/itest/nodes/pom.xml b/sca-java-2.x/trunk/itest/nodes/pom.xml index 055c23e6c1..a347da0ebd 100644 --- a/sca-java-2.x/trunk/itest/nodes/pom.xml +++ b/sca-java-2.x/trunk/itest/nodes/pom.xml @@ -37,6 +37,7 @@ helloworld-iface helloworld-service helloworld-client + helloworld-service-and-client