diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test/java')
5 files changed, 21 insertions, 101 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/ConfigTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/ConfigTestCase.java deleted file mode 100644 index 1d31a5467f..0000000000 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/ConfigTestCase.java +++ /dev/null @@ -1,64 +0,0 @@ -/*
- * 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.domain.node;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.tuscany.sca.domain.node.DomainNode;
-import org.junit.Test;
-
-/**
- * This shows how to test the Calculator service component.
- */
-public class ConfigTestCase{
-
- @Test
- public void testConfig() throws Exception {
- DomainNode domain = new DomainNode("foo://someDomain:1234?p1=x&p2=y");
- assertEquals(4, domain.getConfigAttributes().getAttributes().size());
- assertEquals("someDomain", domain.getDomainName());
- assertEquals("foo", domain.getConfigAttributes().getAttributes().get("domainScheme"));
- assertEquals("someDomain", domain.getConfigAttributes().getAttributes().get("domainName"));
- assertEquals("x", domain.getConfigAttributes().getAttributes().get("p1"));
- assertEquals("y", domain.getConfigAttributes().getAttributes().get("p2"));
- }
-
- @Test
- public void testConfig1() throws Exception {
- DomainNode domain = new DomainNode("foo:someDomain:1234?p1=x&p2=y");
- assertEquals(4, domain.getConfigAttributes().getAttributes().size());
- assertEquals("someDomain", domain.getDomainName());
- assertEquals("foo", domain.getConfigAttributes().getAttributes().get("domainScheme"));
- assertEquals("someDomain", domain.getConfigAttributes().getAttributes().get("domainName"));
- assertEquals("x", domain.getConfigAttributes().getAttributes().get("p1"));
- assertEquals("y", domain.getConfigAttributes().getAttributes().get("p2"));
- }
-
- @Test
- public void testConfig2() throws Exception {
- DomainNode domain = new DomainNode("foo:/someDomain:1234?p1=x&p2=y");
- assertEquals(4, domain.getConfigAttributes().getAttributes().size());
- assertEquals("someDomain", domain.getDomainName());
- assertEquals("foo", domain.getConfigAttributes().getAttributes().get("domainScheme"));
- assertEquals("someDomain", domain.getConfigAttributes().getAttributes().get("domainName"));
- assertEquals("x", domain.getConfigAttributes().getAttributes().get("p1"));
- assertEquals("y", domain.getConfigAttributes().getAttributes().get("p2"));
- }
-}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java index f8399cf9eb..bee9e0b25a 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java @@ -21,14 +21,12 @@ package org.apache.tuscany.sca.domain.node; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import itest.nodes.Helloworld;
import static org.junit.Assert.fail;
+import itest.nodes.Helloworld;
-import org.apache.tuscany.sca.domain.node.DomainNode;
import org.junit.After;
import org.junit.Test;
import org.oasisopen.sca.SCARuntimeException;
-import org.oasisopen.sca.client.SCAClient;
/**
* This shows how to test the Calculator service component.
@@ -40,8 +38,8 @@ public class GetServiceTestCase{ @Test
public void testTwoNodesSameDomain() throws Exception {
- serviceNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
- clientNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+ serviceNode = new DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+ clientNode = new DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
assertNotNull(service);
@@ -50,23 +48,16 @@ public class GetServiceTestCase{ Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
-
- if (clientNode != null && clientNode.isStarted()) {
- clientNode.stop();
- }
- if (serviceNode != null && serviceNode.isStarted()) {
- serviceNode.stop();
- }
}
@Test
public void testTwoNodesDifferentDomains() throws Exception {
- serviceNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+ serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- clientNode = new DomainNode("vm://barDomain", "target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+ clientNode = new DomainNode("vm://barDomain", new String[] {"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
assertNotNull(client);
@@ -81,10 +72,10 @@ public class GetServiceTestCase{ @After
public void tearDownAfterClass() throws Exception {
- if (clientNode != null && clientNode.isStarted()) {
+ if (clientNode != null) {
clientNode.stop();
}
- if (serviceNode != null && serviceNode.isStarted()) {
+ if (serviceNode != null) {
serviceNode.stop();
}
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java index 20d7470a66..d901ba4280 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java @@ -40,33 +40,26 @@ public class MultipleNodesPerJVMTestCase{ @Test
public void testTwoNodesSameDomain() throws Exception {
- serviceNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
- clientNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+ serviceNode = new DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+ clientNode = new DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
- Helloworld service = SCAClient.getService(Helloworld.class, "fooDomain/HelloworldService");
+ Helloworld service = SCAClient.getService(Helloworld.class, "defaultDomain/HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- Helloworld client = SCAClient.getService(Helloworld.class, "fooDomain/HelloworldClient");
+ Helloworld client = SCAClient.getService(Helloworld.class, "defaultDomain/HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
-
- if (clientNode != null && clientNode.isStarted()) {
- clientNode.stop();
- }
- if (serviceNode != null && serviceNode.isStarted()) {
- serviceNode.stop();
- }
}
@Test
public void testTwoNodesDifferentDomains() throws Exception {
- serviceNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+ serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
Helloworld service = SCAClient.getService(Helloworld.class, "fooDomain/HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- clientNode = new DomainNode("vm://barDomain", "target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+ clientNode = new DomainNode("vm://barDomain", new String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
Helloworld client = SCAClient.getService(Helloworld.class, "barDomain/HelloworldClient");
assertNotNull(client);
@@ -81,10 +74,10 @@ public class MultipleNodesPerJVMTestCase{ @After
public void tearDownAfterClass() throws Exception {
- if (clientNode != null && clientNode.isStarted()) {
+ if (clientNode != null) {
clientNode.stop();
}
- if (serviceNode != null && serviceNode.isStarted()) {
+ if (serviceNode != null) {
serviceNode.stop();
}
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java index a5c829b87f..100cbde17a 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java @@ -95,7 +95,7 @@ public class OneNodeTestCase{ @After
public void tearDownAfterClass() throws Exception {
- if (domain != null && domain.isStarted()) {
+ if (domain != null) {
domain.stop();
}
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java index 3ee89b0a04..fdfd3fa0cb 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java @@ -38,8 +38,8 @@ public class StopStartNodesTestCase{ @Test
public void testTwoNodesSameDomain() throws Exception {
- serviceNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
- clientNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+ serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
+ clientNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
Helloworld service = SCAClient.getService(Helloworld.class, "fooDomain/HelloworldService");
assertNotNull(service);
@@ -60,7 +60,7 @@ public class StopStartNodesTestCase{ // expected
}
- serviceNode = new DomainNode("vm://fooDomain", "target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+ serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
client = SCAClient.getService(Helloworld.class, "fooDomain/HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
@@ -68,10 +68,10 @@ public class StopStartNodesTestCase{ @After
public void tearDownAfterClass() throws Exception {
- if (clientNode != null && clientNode.isStarted()) {
+ if (clientNode != null) {
clientNode.stop();
}
- if (serviceNode != null && serviceNode.isStarted()) {
+ if (serviceNode != null) {
serviceNode.stop();
}
}
|