summaryrefslogtreecommitdiffstats
path: root/sandbox/event/modules/runtime-standalone/src
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/event/modules/runtime-standalone/src')
-rw-r--r--sandbox/event/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java78
-rw-r--r--sandbox/event/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java54
-rw-r--r--sandbox/event/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jarbin0 -> 4723 bytes
-rw-r--r--sandbox/event/modules/runtime-standalone/src/test/resources/repo/tuscany.properties5
4 files changed, 137 insertions, 0 deletions
diff --git a/sandbox/event/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java b/sandbox/event/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java
new file mode 100644
index 0000000000..ae05f0bd29
--- /dev/null
+++ b/sandbox/event/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java
@@ -0,0 +1,78 @@
+/*
+ * 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.standalone;
+
+import java.io.File;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+/**
+ * Strawman for a J2SE standalone launcher
+ * Try it with:
+ *
+ * mvn -o
+ * mvn dependency:copy-dependencies -o
+ * java -Djava.ext.dirs=target/dependency -jar target\tuscany-sca.jar C:\MyTuscanyRepository
+ *
+ * where MyTuscanyRepository is a folder containing SCA contribution jars
+ */
+public class StandaloneLauncher {
+
+ private Launcher launcher;
+
+ public StandaloneLauncher(File repository) {
+ this.launcher = new Launcher(repository);
+ launcher.start();
+ }
+
+ public void stop() {
+ launcher.stop();
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ Options options = new Options();
+ options.addOption("domain", true, "the url of the remote domain this node should connect to");
+ CommandLineParser parser = new PosixParser();
+ CommandLine cmd = parser.parse( options, args);
+ if (cmd.getArgs().length != 1) {
+ System.err.println("missing contributions folder parameter");
+ System.exit(1);
+ }
+ File f = new File(cmd.getArgs()[0]);
+ if (!f.exists()) {
+ System.err.println("repository not found: " + cmd.getArgs()[0]);
+ System.exit(1);
+ }
+
+ StandaloneLauncher launcher = new StandaloneLauncher(f);
+
+ System.out.println("Press enter to exit...");
+ System.in.read();
+
+ launcher.stop();
+
+ }
+
+}
diff --git a/sandbox/event/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java b/sandbox/event/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java
new file mode 100644
index 0000000000..d29d4a3851
--- /dev/null
+++ b/sandbox/event/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.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 org.apache.tuscany.sca.runtime.standalone;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+public class LauncherTestCase extends TestCase {
+
+ private File repo;
+ private Launcher launcher;
+
+ public void test1() throws NodeException, URISyntaxException, InterruptedException, DomainException, MalformedURLException {
+ launcher.start();
+ }
+
+ public void setUp() throws URISyntaxException {
+ URL propsURL = getClass().getClassLoader().getResource("repo/tuscany.properties");
+ repo = new File(propsURL.toURI()).getParentFile();
+ launcher = new Launcher(repo);
+ }
+
+ public void tearDown() throws NodeException, URISyntaxException, InterruptedException, DomainException {
+ if (launcher != null) {
+ launcher.stop();
+ }
+ }
+
+}
diff --git a/sandbox/event/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar b/sandbox/event/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar
new file mode 100644
index 0000000000..6978bee727
--- /dev/null
+++ b/sandbox/event/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar
Binary files differ
diff --git a/sandbox/event/modules/runtime-standalone/src/test/resources/repo/tuscany.properties b/sandbox/event/modules/runtime-standalone/src/test/resources/repo/tuscany.properties
new file mode 100644
index 0000000000..2735d130e8
--- /dev/null
+++ b/sandbox/event/modules/runtime-standalone/src/test/resources/repo/tuscany.properties
@@ -0,0 +1,5 @@
+nodeName=http://localhost:8080/myNode/
+#domainName=http://localhost:8777/tuscany/foo/
+#startManager=true
+#hotDeployInterval=10000
+#useHotUpdate=true