summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-04-21 13:28:05 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-04-21 13:28:05 +0000
commitbebf8c95215474a72e986ebe1a139d13e9022ab0 (patch)
tree4172fb169aafab100a7187401f198758306386bc /sca-java-2.x/trunk
parentafbc2cad2eed7adbf26a4a375f6865b2e553d6e7 (diff)
Add start of a test that uses the tuscany plugin to run the service which the client can call
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1095697 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml71
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldService.java25
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldServiceImpl.java44
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/RemoteHelloworldService.java28
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/Helloworld.composite29
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java45
7 files changed, 265 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml b/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml
new file mode 100644
index 0000000000..4ef38714d9
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml
@@ -0,0 +1,71 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-scaclient-remote</artifactId>
+ <name>Apache Tuscany SCA iTest SCAClient Remote</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-hazelcast</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.maven.plugins</groupId>
+ <artifactId>maven-tuscany-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <configuration>
+ <domainURI>uri:default?bind=127.0.0.1:9876</domainURI>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldService.java b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldService.java
new file mode 100644
index 0000000000..1c7edaefb6
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldService.java
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldServiceImpl.java b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldServiceImpl.java
new file mode 100644
index 0000000000..5af221313e
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/HelloworldServiceImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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 org.oasisopen.sca.annotation.EagerInit;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+
+@EagerInit
+@Scope("COMPOSITE")
+@Service({HelloworldService.class, RemoteHelloworldService.class})
+public class HelloworldServiceImpl implements HelloworldService, RemoteHelloworldService {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+ public String sayHelloRemote(String name) {
+ return "Hello " + name;
+ }
+
+ @Init
+ public void init() {
+ System.out.println(sayHello("world"));
+ }
+
+}
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/RemoteHelloworldService.java b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/RemoteHelloworldService.java
new file mode 100644
index 0000000000..a8640bf484
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/java/itest/RemoteHelloworldService.java
@@ -0,0 +1,28 @@
+/*
+ * 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 org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface RemoteHelloworldService {
+
+ String sayHelloRemote(String name);
+
+}
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/Helloworld.composite b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/Helloworld.composite
new file mode 100644
index 0000000000..2d5ae6a57c
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/Helloworld.composite
@@ -0,0 +1,29 @@
+<?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:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://itest"
+ name="Helloworld">
+
+ <component name="HelloworldComponent">
+ <implementation.java class="itest.HelloworldServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..56e127b539
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/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:itest="http://itest">
+ <deployable composite="itest:Helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java
new file mode 100644
index 0000000000..defd823ad8
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java
@@ -0,0 +1,45 @@
+/*
+ * 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 test.scaclient;
+
+import itest.RemoteHelloworldService;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ * Test SCADomain.newInstance and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAClientTestCase extends TestCase {
+
+ @Test
+ public void testDefault() throws Exception {
+ SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("uri:default?wka=127.0.0.1:9876"));
+ RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/HelloworldService");
+ assertEquals("Hello petra", service.sayHelloRemote("petra"));
+ }
+
+}