summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/README24
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/pom.xml90
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/Helloworld.java28
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/HelloworldSCAClient.java46
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/test/java/sample/HelloworldTestCase.java54
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/README43
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/pom.xml77
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/Helloworld.java28
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/HelloworldImpl.java27
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/helloworld.composite29
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld/src/test/java/sample/HelloworldTestCase.java48
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/pom.xml37
-rw-r--r--sca-java-2.x/trunk/samples/pom.xml1
14 files changed, 557 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/README b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/README
new file mode 100644
index 0000000000..2bbda2cd15
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/README
@@ -0,0 +1,24 @@
+Tuscany - Getting Started - Helloworld SCAClient Sample
+-------------------------------------------------------
+
+This sample demonstrates using the OASIS SCAClient API to invoke a service in a remote SCA domain.
+
+See the README in the top-level samples folder for general information on the Tuscany samples.
+
+This project has a Java class with a main method which uses the SCAClient API to invoke a Helloworld
+service in a remote SCA domain.
+
+Before running this sample you must have a helloworld service running in a SCA domain somewhere,
+for example, you may do using a separate command prompt and running the Tuscany
+"Getting Started - Helloworld Sample" with the command "mvn tuscany:run -DdomainURI=uri:default".
+
+You can then run this SCAClient sample with the Maven command:
+
+ mvn exec:java
+
+You should see the following oputput:
+
+ HelloworldSCAClient, using domainURI uri:default
+ Calling HelloworldComponent.sayHello("world")
+ Hello world
+
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/pom.xml b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/pom.xml
new file mode 100644
index 0000000000..f10cb6d343
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/pom.xml
@@ -0,0 +1,90 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.samples</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <artifactId>helloworld-scaclient</artifactId>
+ <version>2.0-SNAPSHOT</version>
+
+ <name>Apache Tuscany SCA Samples Helloworld SCAClient</name>
+
+ <properties>
+ <tuscany.version>${project.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-hazelcast</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>sample.HelloworldSCAClient</mainClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/Helloworld.java b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/Helloworld.java
new file mode 100644
index 0000000000..1eeb8be9fd
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/Helloworld.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 sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/HelloworldSCAClient.java b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/HelloworldSCAClient.java
new file mode 100644
index 0000000000..9954179e74
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/main/java/sample/HelloworldSCAClient.java
@@ -0,0 +1,46 @@
+/*
+ * 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 sample;
+
+import java.net.URI;
+
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.NoSuchServiceException;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+public class HelloworldSCAClient {
+
+ public static void main(String[] args) throws NoSuchDomainException, NoSuchServiceException {
+
+ String domainURI = System.getProperties().getProperty("domainURI");
+ if (domainURI == null || domainURI.length() < 1) {
+ domainURI = "uri:default";
+ }
+ System.out.println("HelloworldSCAClient, using domainURI " + domainURI);
+
+ String name = args.length < 1 ? "world" : args[0];
+
+ SCAClientFactory factory = SCAClientFactory.newInstance(URI.create(domainURI));
+ Helloworld service = factory.getService(Helloworld.class, "HelloworldComponent");
+
+ System.out.println("Calling HelloworldComponent.sayHello(\"" + name + "\")");
+ System.out.println(service.sayHello(name));
+ }
+
+}
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/test/java/sample/HelloworldTestCase.java b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/test/java/sample/HelloworldTestCase.java
new file mode 100644
index 0000000000..d0ebf5be19
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-scaclient/src/test/java/sample/HelloworldTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * 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 sample;
+
+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.apache.tuscany.sca.runtime.ActivationException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.NoSuchServiceException;
+
+public class HelloworldTestCase {
+
+ static Node node;
+
+ @Test
+ public void testSayHello() throws NoSuchDomainException, NoSuchServiceException {
+ HelloworldSCAClient.main(new String[0]);
+ }
+
+ @BeforeClass
+ public static void start() throws ContributionReadException, ActivationException, ValidationException {
+ node = TuscanyRuntime.newInstance().createNode("uri:default");
+ node.installContribution(null, "../helloworld/target/classes", null, null, true);
+ }
+
+ @AfterClass
+ public static void stop() {
+ if (node != null) {
+ node.stop();
+ }
+ }
+
+}
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/README b/sca-java-2.x/trunk/samples/getting-started/helloworld/README
new file mode 100644
index 0000000000..402edf3930
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/README
@@ -0,0 +1,43 @@
+Tuscany - Getting Started - Helloworld Sample
+---------------------------------------------
+
+This sample demonstrates a simple helloworld style SCA application and how to run that with Tuscany.
+
+See the README in the top-level samples folder for general information on the Tuscany samples.
+
+This project creates an SCA contribution with a deployable composite named helloworld.composite.
+The composite defines an SCA component, HelloworldComponent, which provides a Helloworld service,
+the component is implemented by a Java class.
+
+You can use the contribution by starting the composite in the Tuscany Shell. To do that run the
+following command in the helloworld-contribution folder:
+
+ mvn tuscany:run
+
+Alternatively, the Tuscany Shell can be started with the scripts in the Tuscany binary distribution
+bin folder. To do that run the following command at the root of a Tuscany binary distribution:
+
+ bin\tuscany.bat samples\getting-started\helloworld-contribution
+
+Once the Shell has been started with one of those methods you can use Shell commands to explore
+the SCA domain, for example, use the "installed" command to get the status of installed contributions,
+"services" to see the available component services, and you may test calling the helloworld service by
+using the "invoke" command:
+
+ invoke HelloworldComponent sayHello yourName
+
+---
+
+This sample was created by the Tuscany contribution-jar Maven archetype. You can use that archetype to
+create your own SCA contribution projects by running the following Maven command:
+
+ mvn archetype:generate -DarchetypeCatalog=http://tuscany.apache.org
+
+then at the prompt select 1 to choose the contribution-jar archetype and then answer the questions.
+This project used the following answers:
+
+ Define value for property 'groupId': : org.apache.tuscany.sca.samples
+ Define value for property 'artifactId': : helloworld-contribution
+ Define value for property 'version': 1.0-SNAPSHOT: 2.0-SNAPSHOT
+ Define value for property 'package': org.apache.tuscany.sca.samples: sample
+
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/pom.xml b/sca-java-2.x/trunk/samples/getting-started/helloworld/pom.xml
new file mode 100644
index 0000000000..6f4f92c230
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/pom.xml
@@ -0,0 +1,77 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.samples</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <artifactId>helloworld</artifactId>
+ <version>2.0-SNAPSHOT</version>
+
+ <name>Apache Tuscany SCA Samples Helloworld</name>
+
+ <properties>
+ <tuscany.version>${project.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.maven.plugins</groupId>
+ <artifactId>maven-tuscany-plugin</artifactId>
+ <version>${tuscany.version}</version>
+ </plugin>
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/Helloworld.java b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/Helloworld.java
new file mode 100644
index 0000000000..f4e8c50448
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/Helloworld.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 sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/HelloworldImpl.java b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/HelloworldImpl.java
new file mode 100644
index 0000000000..089b1a4290
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/java/sample/HelloworldImpl.java
@@ -0,0 +1,27 @@
+/*
+ * 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 sample;
+
+public class HelloworldImpl implements Helloworld {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..95c32fb5bf
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,25 @@
+<?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:sample="http://sample">
+
+ <deployable composite="sample:helloworld-contribution" />
+
+</contribution>
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/helloworld.composite b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..e0206cd6e8
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/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://sample"
+ name="helloworld-contribution">
+
+ <component name="HelloworldComponent">
+ <implementation.java class="sample.HelloworldImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld/src/test/java/sample/HelloworldTestCase.java b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/test/java/sample/HelloworldTestCase.java
new file mode 100644
index 0000000000..be27aa68ef
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld/src/test/java/sample/HelloworldTestCase.java
@@ -0,0 +1,48 @@
+/*
+ * 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 sample;
+
+import org.junit.Assert;
+
+import org.apache.tuscany.sca.Node;
+import org.apache.tuscany.sca.TuscanyRuntime;
+import org.junit.Test;
+import org.oasisopen.sca.NoSuchServiceException;
+
+public class HelloworldTestCase {
+
+ @Test
+ public void testSayHello() throws NoSuchServiceException {
+
+ // Run the SCA composite in a Tuscany runtime
+ Node node = TuscanyRuntime.runComposite("helloworld.composite", "target/classes");
+ try {
+
+ // Get the Helloworld service proxy
+ Helloworld helloworld = node.getService(Helloworld.class, "HelloworldComponent");
+
+ // test that it works as expected
+ Assert.assertEquals("Hello Amelia", helloworld.sayHello("Amelia"));
+
+ } finally {
+ // Stop the Tuscany runtime Node
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-2.x/trunk/samples/getting-started/pom.xml b/sca-java-2.x/trunk/samples/getting-started/pom.xml
new file mode 100644
index 0000000000..1f873a172e
--- /dev/null
+++ b/sca-java-2.x/trunk/samples/getting-started/pom.xml
@@ -0,0 +1,37 @@
+<?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.samples</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-samples-getting-started</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Samples Getting Started</name>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+</project>
diff --git a/sca-java-2.x/trunk/samples/pom.xml b/sca-java-2.x/trunk/samples/pom.xml
index 8583c7ce0e..ebb4efb8c0 100644
--- a/sca-java-2.x/trunk/samples/pom.xml
+++ b/sca-java-2.x/trunk/samples/pom.xml
@@ -32,6 +32,7 @@
<name>Apache Tuscany SCA Samples</name>
<modules>
+ <module>getting-started</module>
</modules>
</project>