From 78cb33c9bbcfd8a9994bf5c3b9ba134696259f54 Mon Sep 17 00:00:00 2001 From: ramkumar Date: Thu, 6 Nov 2008 16:42:59 +0000 Subject: Fixes for TUSCANY-2666 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@711901 13f79535-47bb-0310-9956-ffa450edef68 --- .../stockquote/server/StockQuoteServer.java | 14 +++++++-- .../stockquote/StockQuoteServiceTestCase.java | 33 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java (limited to 'java/sca/samples/spring-bigbank-stockquote') diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java b/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java index b9abb53eb4..da96f29b0c 100644 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java +++ b/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java @@ -29,7 +29,11 @@ import org.springframework.context.ApplicationContext; public class StockQuoteServer { 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 StockQuote Service..."); SCANodeFactory factory = SCANodeFactory.newInstance(); @@ -41,8 +45,12 @@ public class StockQuoteServer { if (ctx.containsBean("StockQuoteServiceBean")) System.out.println("StockQuoteServiceBean is now available for use..."); - 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"); diff --git a/java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java b/java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java new file mode 100644 index 0000000000..4b36d0694d --- /dev/null +++ b/java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.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.stockquote; + +import junit.framework.TestCase; +import bigbank.stockquote.server.StockQuoteServer; + +/** + * Tests out the big bank service + * + */ +public class StockQuoteServiceTestCase extends TestCase { + + public void testServer() throws Exception { + StockQuoteServer.main(new String[] {"1000"}); + } +} -- cgit v1.2.3