summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src')
-rw-r--r--sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java37
-rw-r--r--sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java32
-rw-r--r--sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite47
-rw-r--r--sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java90
6 files changed, 262 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..021a653c36
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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 helloworld;
+
+
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+
+ @Reference
+ protected HelloWorldService hwService;
+
+ public String getGreetings(String name) {
+ return "Hello " + hwService.getGreetings(name);
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..636f7699ed
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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 helloworld;
+
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..32c2d0b907
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,33 @@
+/*
+ * 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 helloworld;
+
+import javax.jws.WebService;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..34da25216d
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:hw="http://helloworld">
+ <deployable composite="hw:helloworldws" />
+</contribution>
diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..fae44b642d
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite
@@ -0,0 +1,47 @@
+<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ xmlns:wsdli="http://www.w3.org/ns/wsdl-instance"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ name="helloworldws">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldClientImpl" />
+ <service name="HelloWorldService">
+ <binding.sca/>
+ </service>
+ <reference name="hwService" target="HelloWorldServiceComponent">
+<!--
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
+-->
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <tuscany:binding.rmi uri="rmi://duffuri"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java
new file mode 100644
index 0000000000..028db4cf33
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java
@@ -0,0 +1,90 @@
+/*
+ * 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 helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.tuscany.sca.Node;
+import org.apache.tuscany.sca.TuscanyRuntime;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.oasisopen.sca.NoSuchServiceException;
+
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class DomainNodeTestCase{
+
+ private Node node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = TuscanyRuntime.newInstance().createNode("default");
+ node.installContribution("helloworld", "target/classes", null, null);
+ try {
+ node.startComposite("helloworld", "helloworld.composite");
+ } catch (Exception ex) {
+ System.out.println("Caught exception on composite start : " + ex);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void testWaitForInput() {
+ System.out.println("Press a key to end");
+ try {
+ System.in.read();
+ } catch (Exception ex) {
+ }
+ System.out.println("Shutting down");
+ }
+
+ @Test
+ public void testContributionUninstall() throws IOException, NoSuchServiceException {
+ List<String> installedContributions = node.getInstalledContributionURIs();
+ System.out.println(installedContributions);
+
+ assertEquals(1, installedContributions.size());
+
+ try {
+ node.stopCompositeAndUninstallUnused("helloworld", "helloworld.composite");
+ } catch (Exception ex) {
+ System.out.println("Caught exception on composite stop : " + ex);
+ }
+
+ installedContributions = node.getInstalledContributionURIs();
+ assertEquals(0, installedContributions.size());
+ }
+
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+
+}