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 --- .../checking/server/CheckingAccountServer.java | 13 +++++++-- .../src/main/resources/definitions.xml | 6 ++-- .../checkaccount/CheckAccountServiceTestCase.java | 33 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java (limited to 'java/sca/samples/spring-bigbank-checkaccount') diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java index 2e367cf32b..562314230a 100644 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java +++ b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java @@ -31,6 +31,11 @@ import org.apache.tuscany.sca.node.SCANodeFactory; public class CheckingAccountServer { public static void main(String[] args) { + long timeout = -1L; + if (args.length > 0) { + timeout = Long.parseLong(args[0]); + } + try { BrokerService jmsBroker; jmsBroker = new BrokerService(); @@ -43,8 +48,12 @@ public class CheckingAccountServer { SCANode node = factory.createSCANodeFromClassLoader("CheckingsAccount.composite", CheckingAccountServer.class.getClassLoader()); node.start(); - System.out.println("CheckingsAccount server started (press enter to shutdown)"); - System.in.read(); + if (timeout < 0) { + System.out.println("CheckingsAccount server started (press enter to shutdown)"); + System.in.read(); + } else { + Thread.sleep(timeout); + } node.stop(); diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml index d57d02297c..0ce1440ddf 100644 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml +++ b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml @@ -27,7 +27,7 @@ + constrains="sca:implementation.spring"> Authorization Intent @@ -36,7 +36,7 @@ + appliesTo="sca:service/sca:binding.jms"> @@ -49,7 +49,7 @@ + appliesTo="sca:implementation.spring"> diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java b/java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java new file mode 100644 index 0000000000..a45630278b --- /dev/null +++ b/java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.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.checkaccount; + +import junit.framework.TestCase; +import bigbank.account.checking.server.CheckingAccountServer; + +/** + * Tests out the big bank service + * + */ +public class CheckAccountServiceTestCase extends TestCase { + + public void testServer() throws Exception { + CheckingAccountServer.main(new String[] {"1000"}); + } +} -- cgit v1.2.3