From 08adcf2e783e4733e0fd646d353db3592c62140d Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 16 Feb 2012 15:43:08 +0000 Subject: Delete old RC tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1245046 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/domain/node/GetServiceTestCase.java | 84 --------- .../domain/node/MultipleNodesPerJVMTestCase.java | 87 ---------- .../tuscany/sca/domain/node/OneNodeTestCase.java | 105 ------------ .../sca/domain/node/StopStartNodesTestCase.java | 82 --------- .../tuscany/sca/runtime/DeployerTestCase.java | 78 --------- .../tuscany/sca/runtime/NodeXMLTestCase.java | 45 ----- .../sca/runtime/TuscanyRuntimeTestCase.java | 188 --------------------- .../tuscany/sca/runtime/TwoNodesTestCase.java | 46 ----- 8 files changed, 715 deletions(-) delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java (limited to 'sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany') diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java deleted file mode 100644 index 0a5d99ae7c..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java +++ /dev/null @@ -1,84 +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 static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; -import itest.nodes.Helloworld; - -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; -import org.oasisopen.sca.ServiceRuntimeException; - -/** - * This shows how to test the Calculator service component. - */ -@Ignore("TUSCANY-3391") -public class GetServiceTestCase{ - - private static DomainNode clientNode; - private static DomainNode serviceNode; - - @Test - public void testTwoNodesSameDomain() throws Exception { - 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); - assertEquals("Hello Petra", service.sayHello("Petra")); - - Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - } - - @Test - public void testTwoNodesDifferentDomains() throws Exception { - 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", new String[] {"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"}); - Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - - try { - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - fail(); - } catch (ServiceRuntimeException e) { - // FIXME: this gives an SCARuntimeException, would be better to be something like ServiceNotFoundException? - // expected - } - } - - @After - public void tearDownAfterClass() throws Exception { - if (clientNode != null) { - clientNode.stop(); - } - if (serviceNode != null) { - serviceNode.stop(); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java deleted file mode 100644 index 617876586b..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java +++ /dev/null @@ -1,87 +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 static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; -import itest.nodes.Helloworld; - -import java.net.URI; - -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; -import org.oasisopen.sca.ServiceRuntimeException; -import org.oasisopen.sca.client.SCAClientFactory; - -/** - * This shows how to test the Calculator service component. - */ -@Ignore("TUSCANY-3391") -public class MultipleNodesPerJVMTestCase{ - - private static DomainNode clientNode; - private static DomainNode serviceNode; - - @Test - public void testTwoNodesSameDomain() throws Exception { - 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 = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldService"); - assertNotNull(service); - assertEquals("Hello Petra", service.sayHello("Petra")); - - Helloworld client = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - } - - @Test - public void testTwoNodesDifferentDomains() throws Exception { - serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"}); - Helloworld service = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldService"); - assertNotNull(service); - assertEquals("Hello Petra", service.sayHello("Petra")); - - clientNode = new DomainNode("vm://barDomain", new String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"}); - Helloworld client = SCAClientFactory.newInstance(URI.create("vm://barDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - - try { - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - fail(); - } catch (ServiceRuntimeException e) { - // FIXME: this gives an SCARuntimeException, would be better to be something like ServiceNotFoundException? - // expected - } - } - - @After - public void tearDownAfterClass() throws Exception { - if (clientNode != null) { - clientNode.stop(); - } - if (serviceNode != null) { - serviceNode.stop(); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java deleted file mode 100644 index 10803cd880..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java +++ /dev/null @@ -1,105 +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 static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; -import itest.nodes.Helloworld; - -import java.net.URI; - -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.oasisopen.sca.NoSuchDomainException; -import org.oasisopen.sca.NoSuchServiceException; -import org.oasisopen.sca.client.SCAClientFactory; - -/** - * This shows how to test the Calculator service component. - */ -@Ignore("TUSCANY-3391") -public class OneNodeTestCase{ - - private static DomainNode domain; - private static String serviceContributionUri; - - @Before - public void setUpBeforeClass() throws Exception { - domain = new DomainNode(); - serviceContributionUri = domain.addContribution("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"); - domain.addContribution("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"); - } - - @Test - public void testService() throws Exception { - Helloworld service = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldService"); - assertNotNull(service); - assertEquals("Hello Petra", service.sayHello("Petra")); - } - - @Test - public void testClient() throws Exception { - Helloworld client = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - } - - @Test - public void testRemovingServiceContribution() throws Exception { - domain.removeContribution(serviceContributionUri); - try { - SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldService"); - // FIXME: should this be NoSuchServiceException or ServiceNotFoundException? - } catch (NoSuchServiceException e) { - // expected - } - - Helloworld client = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - try { - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - fail(); - } catch (Exception e) { - // FIXME: this gives an NPE, would be better to be something like ServiceNotFoundException - // expected - } - } - - @Test - public void testStoppingDomainNode() throws Exception { - domain.stop(); - try { - SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldClient"); - fail(); - } catch (NoSuchDomainException e) { - // expected - } - } - - @After - public void tearDownAfterClass() throws Exception { - if (domain != null) { - domain.stop(); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java deleted file mode 100644 index 4a29822069..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java +++ /dev/null @@ -1,82 +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 static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; -import itest.nodes.Helloworld; - -import java.net.URI; - -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; -import org.oasisopen.sca.client.SCAClientFactory; - -/** - * This shows how to test the Calculator service component. - */ -@Ignore("TUSCANY-3391") -public class StopStartNodesTestCase{ - - private static DomainNode clientNode; - private static DomainNode serviceNode; - - @Test - public void testTwoNodesSameDomain() throws Exception { - 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 = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldService"); - assertNotNull(service); - assertEquals("Hello Petra", service.sayHello("Petra")); - - Helloworld client = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - - serviceNode.stop(); - - client = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - try { - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - fail(); - } catch (Exception e) { - // expected - } - - serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"}); - client = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldClient"); - assertNotNull(client); - assertEquals("Hi Hello Petra", client.sayHello("Petra")); - } - - @After - public void tearDownAfterClass() throws Exception { - if (clientNode != null) { - clientNode.stop(); - } - if (serviceNode != null) { - serviceNode.stop(); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java deleted file mode 100644 index 12204883f8..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java +++ /dev/null @@ -1,78 +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.runtime; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.util.List; - -import javax.xml.stream.XMLStreamException; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.Node; -import org.apache.tuscany.sca.TuscanyRuntime; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.deployment.Deployer; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.ValidationException; -import org.junit.Test; -import org.oasisopen.sca.NoSuchDomainException; -import org.oasisopen.sca.NoSuchServiceException; - -public class DeployerTestCase { - - @Test - public void testInstalledContribution() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException { - TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance(); - Node node = tuscanyRuntime.createNode("myDomain"); - - Deployer deployer = tuscanyRuntime.getDeployer(); - Monitor monitor = deployer.createMonitor(); - Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor); - monitor.analyzeProblems(); - - node.installContribution(contribution, null, true); - List ics = node.getInstalledContributionURIs(); - Assert.assertEquals(1, ics.size()); - Assert.assertEquals("foo", ics.get(0)); - } - - @Test - public void testAddDeploymentComposite() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException, XMLStreamException { - TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance(); - Node node = tuscanyRuntime.createNode("myDomain"); - - node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); - - Deployer deployer = tuscanyRuntime.getDeployer(); - Monitor monitor = deployer.createMonitor(); - Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor); - monitor.analyzeProblems(); - composite.setURI("helloworld2.composite"); - node.start("foo", composite); - List dcs = node.getStartedCompositeURIs("foo"); - Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld2.composite", dcs.get(0)); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java deleted file mode 100644 index d245ea2ec6..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java +++ /dev/null @@ -1,45 +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.runtime; - -import java.util.List; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.Node; -import org.apache.tuscany.sca.TuscanyRuntime; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.monitor.ValidationException; -import org.junit.Test; - -public class NodeXMLTestCase { - - @Test - public void testHelloworldXML() throws ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNodeFromXML("src/test/resources/helloworldNode.xml"); - Assert.assertEquals("helloworld", node.getDomainName()); - List cs = node.getInstalledContributionURIs(); - Assert.assertEquals(1, cs.size()); - Assert.assertEquals("sample-helloworld", cs.get(0)); - List compsoites = node.getStartedCompositeURIs("sample-helloworld"); - Assert.assertEquals(1, compsoites.size()); - Assert.assertEquals("helloworld.composite", compsoites.get(0)); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java deleted file mode 100644 index d588f91d6a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java +++ /dev/null @@ -1,188 +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.runtime; - -import java.net.MalformedURLException; -import java.util.List; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.Node; -import org.apache.tuscany.sca.TuscanyRuntime; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.impl.NodeImpl; -import org.apache.tuscany.sca.monitor.ValidationException; -import org.junit.Ignore; -import org.junit.Test; -import org.oasisopen.sca.NoSuchDomainException; -import org.oasisopen.sca.NoSuchServiceException; - -import sample.Helloworld; - -public class TuscanyRuntimeTestCase { - - @Test - public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true); - - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } - - @Test - public void testStopStart() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true); - String ci = node.getStartedCompositeURIs("helloworld").get(0); - - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - - node.stop("helloworld", ci); - try { - node.getService(Helloworld.class, "HelloworldComponent"); - Assert.fail(); - } catch (NoSuchServiceException e) { - // expected as there is no deployables - } - - node.start("helloworld", ci); - helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } - - @Test - @Ignore("Depdends on itest/T3558 which isn't in the build?") - public void testInstallWithDependent() throws NoSuchServiceException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("store", "../../itest/T3558/src/test/resources/sample-store.jar", null, null, true); - node.installContribution("store-client", "../../itest/T3558/src/test/resources/sample-store-client.jar", null, null, true); - - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } - - @Test - public void testInstallNoDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); - - try { - node.getService(Helloworld.class, "HelloworldComponent"); - Assert.fail(); - } catch (NoSuchServiceException e) { - // expected as there is no deployables - } - - node.start("helloworld", "helloworld.composite"); - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } - - @Test - public void testGetInstalledContributions() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); - List ics = node.getInstalledContributionURIs(); - Assert.assertEquals(1, ics.size()); - Assert.assertEquals("foo", ics.get(0)); - } - - @Test - public void testGetDeployedCompostes() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true); - List dcs = node.getStartedCompositeURIs("foo"); - Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); - } - - @Test - public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true); - node.stop("foo", "helloworld.composite"); - List dcs = node.getStartedCompositeURIs("foo"); - Assert.assertEquals(0, dcs.size()); - } - - @Test - public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException, NoSuchServiceException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - ((NodeImpl)node).installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null, true); - - List dcs = node.getStartedCompositeURIs("helloworld"); - Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); - - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } - - @Test - public void testURI() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("default"); - String uri = node.installContribution("src/test/resources/sample-helloworld.jar"); - Assert.assertEquals("sample-helloworld", uri); - } - - @Test - public void testStaticCreate() { - Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar"); - List cs = node.getInstalledContributionURIs(); - Assert.assertEquals(1, cs.size()); - List dcs = node.getStartedCompositeURIs(cs.get(0)); - Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); - } - - @Test - public void testStaticCreateWithNullComposite() { - Node node = TuscanyRuntime.runComposite(null, "src/test/resources/sample-helloworld.jar"); - List cs = node.getInstalledContributionURIs(); - Assert.assertEquals(1, cs.size()); - List dcs = node.getStartedCompositeURIs(cs.get(0)); - Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); - } - @Test - public void testRunComposite() throws NoSuchServiceException { - Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar"); - try { - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } finally { - node.stop(); - } - } - - @Test - public void testRunCompositeSharedRuntime() throws NoSuchServiceException { - TuscanyRuntime runtime = TuscanyRuntime.newInstance(); - Node node = TuscanyRuntime.runComposite(runtime, "helloworld.composite", "src/test/resources/sample-helloworld.jar"); - try { - Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } finally { - node.stop(); - } - runtime.stop(); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java deleted file mode 100644 index 6205b26a8a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java +++ /dev/null @@ -1,46 +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.runtime; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.Node; -import org.apache.tuscany.sca.TuscanyRuntime; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.monitor.ValidationException; -import org.junit.Test; -import org.oasisopen.sca.NoSuchDomainException; -import org.oasisopen.sca.NoSuchServiceException; - -import sample.Helloworld; - -public class TwoNodesTestCase { - - @Test - public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node1 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44331"); - node1.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true); - - Node node2 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44332&wka=127.0.0.1:44331"); - - Helloworld helloworldService = node2.getService(Helloworld.class, "HelloworldComponent"); - Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } - -} -- cgit v1.2.3