From fae2307824fe6efc64b2ad9f48e3270a2ddbb5cb Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 8 Jun 2009 08:52:50 +0000 Subject: Add an itest for a single node using multiple contributions. This is just lik ethe tow nodes test but just using one node instead of two. Doesn't work yet till the new endpoint changes go in git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@782563 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/itest/nodes/one-node-test/pom.xml | 48 ++++++++++++++ .../src/test/java/itest/OneNodeTestCase.java | 70 +++++++++++++++++++++ .../test-classes/itest/OneNodeTestCase.class | Bin 0 -> 2291 bytes 3 files changed, 118 insertions(+) create mode 100644 java/sca/itest/nodes/one-node-test/pom.xml create mode 100644 java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java create mode 100644 java/sca/itest/nodes/one-node-test/target/test-classes/itest/OneNodeTestCase.class (limited to 'java/sca') diff --git a/java/sca/itest/nodes/one-node-test/pom.xml b/java/sca/itest/nodes/one-node-test/pom.xml new file mode 100644 index 0000000000..057b94effc --- /dev/null +++ b/java/sca/itest/nodes/one-node-test/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-SNAPSHOT + ../pom.xml + + itest-nodes-one-nodes-test + Apache Tuscany SCA iTest Nodes One Nodes Test + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + + + diff --git a/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java b/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..573da860fb --- /dev/null +++ b/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,70 @@ +/* + * 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.Helloworld; + +import org.apache.tuscany.sca.node.Contribution; +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; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeTestCase{ + + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false"); + NodeFactory factory = NodeFactory.newInstance(); + node = factory.createNode( + new Contribution("service", "..\\helloworld-service\\target\\itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"), + new Contribution("client", "..\\helloworld-client\\target\\itest-nodes-helloworld-client-2.0-SNAPSHOT.jar")); + node.start(); + } + + @Test + public void testCalculator() throws Exception { + + // Ideally this would use the SCAClient API but leaving that tillwe have the basics working + + Helloworld service = node.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + 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/java/sca/itest/nodes/one-node-test/target/test-classes/itest/OneNodeTestCase.class b/java/sca/itest/nodes/one-node-test/target/test-classes/itest/OneNodeTestCase.class new file mode 100644 index 0000000000..e9a561a8df Binary files /dev/null and b/java/sca/itest/nodes/one-node-test/target/test-classes/itest/OneNodeTestCase.class differ -- cgit v1.2.3