diff options
author | ramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-06 16:42:59 +0000 |
---|---|---|
committer | ramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-06 16:42:59 +0000 |
commit | 78cb33c9bbcfd8a9994bf5c3b9ba134696259f54 (patch) | |
tree | 517361c9c1a1e3179ef8fbfdcbbe54d07fc0e2c4 /java/sca/samples/spring-bigbank-calculator/src | |
parent | ce178b299f1098c72ef6c5ead574943ae28febf1 (diff) |
Fixes for TUSCANY-2666
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@711901 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/samples/spring-bigbank-calculator/src')
2 files changed, 43 insertions, 4 deletions
diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java index b0737899dc..c6a230fcb4 100644 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java +++ b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java @@ -25,6 +25,10 @@ import org.apache.tuscany.sca.node.SCANodeFactory; public class CalculatorServer { public static void main(String[] args) throws Exception { + long timeout = -1L; + if (args.length > 0) { + timeout = Long.parseLong(args[0]); + } System.out.println("Starting the Sample SCA Calculator..."); @@ -32,13 +36,15 @@ public class CalculatorServer { SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorServer.class.getClassLoader()); node.start(); - System.out.println("Press Enter to Exit..."); - System.in.read(); + if (timeout < 0) { + System.out.println("Press Enter to Exit..."); + System.in.read(); + } else { + Thread.sleep(timeout); + } node.stop(); - System.out.println("Bye"); - System.exit(0); } } diff --git a/java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java b/java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java new file mode 100644 index 0000000000..02a11485cd --- /dev/null +++ b/java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.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 bigbank.calculator;
+
+import junit.framework.TestCase;
+import bigbank.calculator.server.CalculatorServer;
+
+/**
+ * Tests out the big bank service
+ *
+ */
+public class CalculatorServiceTestCase extends TestCase {
+
+ public void testServer() throws Exception {
+ CalculatorServer.main(new String[] {"1000"});
+ }
+}
|