01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package edu.iu.uis.eden.messaging;
17:
18: import javax.xml.namespace.QName;
19:
20: import org.junit.Test;
21: import org.kuali.bus.test.KSBTestCase;
22: import org.kuali.rice.resourceloader.GlobalResourceLoader;
23:
24: import edu.iu.uis.eden.messaging.remotedservices.EchoService;
25:
26: public class RemoteFailureTest extends KSBTestCase {
27:
28: public boolean startClient1() {
29: return true;
30: }
31:
32: @Test
33: public void testEchoService() throws Exception {
34: EchoService echoService = (EchoService) GlobalResourceLoader
35: .getService(new QName("TestCl1", "echoService"));
36: assertNotNull(echoService);
37: String echoValue = "echoValue";
38: String result = echoService.echo(echoValue);
39: assertEquals(echoValue, result);
40:
41: // now shut down the test client and try to access the echo service
42: getTestClient1().stop();
43: try {
44: result = echoService.echo(echoValue);
45: fail("Exception should have been thrown");
46: } catch (Exception e) {
47: e.printStackTrace();
48: }
49:
50: // start it back up and make sure we can use our service again
51: getTestClient1().start();
52: result = echoService.echo(echoValue);
53: assertEquals(echoValue, result);
54: }
55:
56: @Test
57: public void testSOAPEchoService() throws Exception {
58: EchoService echoService = (EchoService) GlobalResourceLoader
59: .getService(new QName("TestCl1", "soap-echoService"));
60: assertNotNull(echoService);
61: String echoValue = "echoValue";
62: String result = echoService.echo(echoValue);
63: assertEquals(echoValue, result);
64: // now shut down the test client and try to access the echo service
65: getTestClient1().stop();
66: try {
67: result = echoService.echo(echoValue);
68: fail("Exception should have been thrown");
69: } catch (Exception e) {
70: e.printStackTrace();
71: }
72: // start it back up and make sure we can use our service again
73: getTestClient1().start();
74: result = echoService.echo(echoValue);
75: assertEquals(echoValue, result);
76: }
77:
78: }
|