summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/README111
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.pngbin0 -> 11273 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.svg148
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/pom.xml89
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java84
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/resources/helloworlderlangservice.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java87
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnorableRunner.java139
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnoreTest.java29
11 files changed, 786 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/README b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/README
new file mode 100644
index 0000000000..ed21c91098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/README
@@ -0,0 +1,111 @@
+Hello World Erlang Service Sample
+=================================
+This sample demonstrates an SCA service that uses a Erlang binding
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+In order to run Erlang samples you need to have Erlang/OTP distribution installed -
+epmd binary is required in your system path. See http://erlang.org for downloads.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-erlang-service.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-erlang-service.jar helloworld.HelloWorldServer
+
+Now the server is started you can use the helloworld-erlang-reference sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+Erlang binding.
+
+helloworld-erlang-service/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldImpl.java - component implementation
+ HelloWorldServer.java - starts the SCA Runtime and
+ deploys the helloworlderlangservice
+ .composite and then waits for the
+ service to be called via Erlang
+ resources/
+ helloworlderlangservice.composite - the SCA assembly for this sample
+
+ test/
+ java/
+ helloworld/
+ HelloWorldErlangServerTestCase.java - JUnit test case
+ dynaignore/ - internal Java classes for ignoring test
+ in case of missing Erlang/OTP distribution
+ helloworld-service.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd helloworld-erlang-service
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] EPMD server started
+ [java] 2009-05-26 11:59:07 org.apache.tuscany.sca.node.impl.NodeImpl <init>
+ [java] INFO: Creating node: helloworlderlangservice.composite
+ [java] 2009-05-26 11:59:08 org.apache.tuscany.sca.node.impl.NodeImpl configureNode
+ [java] 2009-05-26 11:59:08 org.apache.tuscany.sca.node.impl.NodeImpl configureNode
+ [java] 2009-05-26 11:59:08 org.apache.tuscany.sca.node.impl.NodeImpl start
+ [java] INFO: Starting node: helloworlderlangservice.composite
+ [java] HelloWorld server started (press enter to shutdown)
+
+
+As this point the SCA service is exposed as a Erlang module via Erlang RPC which is
+started automatically by the SCA runtime. To stop the server just press
+enter.
+
+To exercise the service run up the helloworld-erlang-reference sample. Take a look at
+the README in that sample and you will see you need the following commands
+
+cd helloworld-erlang-reference
+ant run
+
+Building Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd helloworld-erlang-service
+mvn
+
+You should see the following output
+
+...
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 15 seconds
+[INFO] Finished at: Wed Jul 02 12:50:24 BST 2008
+[INFO] Final Memory: 13M/51M
+[INFO] ------------------------------------------------------------------------
+
+
+This shows that the module has compiled successfully.
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.png b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.png
new file mode 100644
index 0000000000..506c258274
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.svg b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.svg
new file mode 100644
index 0000000000..c3a89c6cd2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/helloworld-service.svg
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * 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.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="helloworld-service-erlang"
+ sodipodi:docname="helloworld-service.svg"
+ version="1.0"
+ inkscape:export-filename="helloworld-service.png"
+ inkscape:export-xdpi="70.806541"
+ inkscape:export-ydpi="70.806541"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 372.04724 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="1052.3622 : 372.04724 : 1"
+ inkscape:persp3d-origin="526.18109 : 248.03149 : 1"
+ id="perspective27" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1111"
+ inkscape:window-height="783"
+ inkscape:window-x="169"
+ inkscape:window-y="22"
+ showgrid="false" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworld</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:3.70037222;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="201.81923"
+ height="168.4483"
+ x="387.1951"
+ y="262.30353"
+ rx="12.207596"
+ ry="13.974144" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(168.89697,70.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 353.15921,319.32458 L 420.34042,319.32458 L 432.55517,351.3994 L 418.30463,381.00696 L 353.15921,381.00696 L 368.42768,351.3994 L 353.15921,319.32458 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(88.234846,118.54669)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1904">Service</flowPara><flowPara
+ id="flowPara2181">Erlang</flowPara></flowRoot> </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/pom.xml b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/pom.xml
new file mode 100644
index 0000000000..b7a8174e96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/pom.xml
@@ -0,0 +1,89 @@
+<?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-sca</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-erlang-service</artifactId>
+ <name>Apache Tuscany SCA Sample HelloWorld Erlang Service</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-erlang-runtime</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <mainClass>helloworld.HelloWorldServer</mainClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..4cdcc1fd0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldImpl.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 org.osoa.sca.annotations.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-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..2e632c00fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,84 @@
+/*
+ * 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 java.io.InputStream;
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ private static final String EPMD_COMMAND = "epmd";
+
+ public static void main(String[] args) {
+ try {
+ Process process = null;
+ try {
+ process = Runtime.getRuntime().exec(EPMD_COMMAND);
+ } catch (IOException e) {
+ System.out
+ .println("Cannot proceed - exception while executing "
+ + EPMD_COMMAND
+ + ": "
+ + e.getMessage()
+ + ". Valid and working Erlang/OTP distribution is required.");
+ }
+ if (process != null) {
+ startReaderThread(process.getInputStream());
+ startReaderThread(process.getErrorStream());
+ System.out.println("EPMD server started");
+
+ SCADomain scaDomain = SCADomain
+ .newInstance("helloworlderlangservice.composite");
+ System.out
+ .println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+
+ process.destroy();
+ System.out.println("EPMD server stopped");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void startReaderThread(final InputStream stream) {
+ Thread readerThread = new Thread() {
+ public void run() {
+ try {
+ byte[] buf = new byte[100];
+ while (true) {
+ stream.read(buf);
+ }
+ } catch (Exception e) {
+ return;
+ }
+ }
+ };
+ readerThread.start();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..4b019b21bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.osoa.sca.annotations.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-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/resources/helloworlderlangservice.composite b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/resources/helloworlderlangservice.composite
new file mode 100644
index 0000000000..1e0c57c74d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/main/resources/helloworlderlangservice.composite
@@ -0,0 +1,35 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <tuscany:binding.erlang node="HelloNode" module="HelloModule"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java
new file mode 100644
index 0000000000..a071e153d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java
@@ -0,0 +1,87 @@
+/*
+ * 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 java.io.InputStream;
+import java.io.IOException;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import helloworld.dynaignore.IgnorableRunner;
+import helloworld.dynaignore.IgnoreTest;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests that the helloworld server is available
+ */
+@RunWith(IgnorableRunner.class)
+public class HelloWorldErlangServerTestCase {
+
+ private static final String EPMD_COMMAND = "epmd";
+
+ @Test
+ public void testServiceCall() {
+ Process epmdProcess = null;
+ try {
+ epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
+ } catch (IOException e) {
+ System.out
+ .println("Cannot proceed - exception while executing "
+ + EPMD_COMMAND
+ + ": "
+ + e.getMessage()
+ + ". Valid and working Erlang/OTP distribution is required.");
+ throw new IgnoreTest();
+ }
+ startReaderThread(epmdProcess.getInputStream());
+ startReaderThread(epmdProcess.getErrorStream());
+
+ SCADomain scaDomain = SCADomain
+ .newInstance("helloworlderlangservice.composite");
+ HelloWorldService helloWorldService = scaDomain.getService(
+ HelloWorldService.class,
+ "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ scaDomain.close();
+
+ epmdProcess.destroy();
+ }
+
+ private static void startReaderThread(final InputStream stream) {
+ Thread readerThread = new Thread() {
+ public void run() {
+ try {
+ byte[] buf = new byte[100];
+ while (true) {
+ stream.read(buf);
+ }
+ } catch (Exception e) {
+ return;
+ }
+ }
+ };
+ readerThread.start();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnorableRunner.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnorableRunner.java
new file mode 100644
index 0000000000..6943c1df80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnorableRunner.java
@@ -0,0 +1,139 @@
+/*
+ * 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.dynaignore;
+
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runner.notification.StoppedByUserException;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IgnorableRunner extends Runner {
+
+ private static final class Notifier extends RunNotifier {
+ private final RunNotifier notifier;
+
+ public Notifier(final RunNotifier notifier) {
+ this.notifier = notifier;
+ }
+
+ public void addFirstListener(final RunListener listener) {
+ notifier.addFirstListener(listener);
+ }
+
+ public void addListener(final RunListener listener) {
+ notifier.addListener(listener);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return notifier.equals(obj);
+ }
+
+ @Override
+ public void fireTestFailure(final Failure failure) {
+ if (failure.getException().getClass() == IgnoreTest.class) {
+ notifier.fireTestIgnored(failure.getDescription());
+ } else {
+ notifier.fireTestFailure(failure);
+ }
+ }
+
+ @Override
+ public void fireTestFinished(final Description description) {
+ notifier.fireTestFinished(description);
+ }
+
+ @Override
+ public void fireTestIgnored(final Description description) {
+ notifier.fireTestIgnored(description);
+ }
+
+ @Override
+ public void fireTestRunFinished(final Result result) {
+ notifier.fireTestRunFinished(result);
+ }
+
+ @Override
+ public void fireTestRunStarted(final Description description) {
+ notifier.fireTestRunStarted(description);
+ }
+
+ @Override
+ public void fireTestStarted(final Description description)
+ throws StoppedByUserException {
+ notifier.fireTestStarted(description);
+ }
+
+ @Override
+ public int hashCode() {
+ return notifier.hashCode();
+ }
+
+ @Override
+ public void pleaseStop() {
+ notifier.pleaseStop();
+ }
+
+ @Override
+ public void removeListener(final RunListener listener) {
+ notifier.removeListener(listener);
+ }
+
+ public void testAborted(final Description description,
+ final Throwable cause) {
+ ((Notifier) notifier).testAborted(description, cause);
+ }
+
+ @Override
+ public String toString() {
+ return notifier.toString();
+ }
+
+ }
+
+ Runner runner = null;
+
+ public IgnorableRunner(Class<?> testClass) {
+ try {
+ runner = new BlockJUnit4ClassRunner(testClass);
+ } catch (InitializationError e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public Description getDescription() {
+ return runner.getDescription();
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ runner.run(new Notifier(notifier));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnoreTest.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnoreTest.java
new file mode 100644
index 0000000000..99d961bdea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/helloworld-erlang-service/src/test/java/helloworld/dynaignore/IgnoreTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.dynaignore;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class IgnoreTest extends Error {
+
+ private static final long serialVersionUID = 1L;
+
+}