1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.fail;
21
22 import javax.xml.namespace.QName;
23
24 import org.junit.Test;
25 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
26 import org.kuali.rice.ksb.messaging.remotedservices.EchoService;
27 import org.kuali.rice.ksb.test.KSBTestCase;
28
29
30 public class RemoteFailureTest extends KSBTestCase {
31
32 public boolean startClient1() {
33 return true;
34 }
35
36 @Test public void testEchoService() throws Exception {
37 EchoService echoService = (EchoService)GlobalResourceLoader.getService(new QName("TestCl1", "echoService"));
38 assertNotNull(echoService);
39 String echoValue = "echoValue";
40 String result = echoService.echo(echoValue);
41 assertEquals(echoValue, result);
42
43
44 getTestClient1().stop();
45 try {
46 result = echoService.echo(echoValue);
47 fail("Exception should have been thrown");
48 } catch (Exception e) {
49 e.printStackTrace();
50 }
51
52
53 getTestClient1().start();
54 result = echoService.echo(echoValue);
55 assertEquals(echoValue, result);
56 }
57
58 @Test public void testSOAPEchoService() throws Exception {
59 EchoService echoService = (EchoService) GlobalResourceLoader.getService(new QName("TestCl1", "soap-echoService"));
60 assertNotNull(echoService);
61 String echoValue = "echoValue";
62 String result = echoService.echo(echoValue);
63 assertEquals(echoValue, result);
64
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
73 getTestClient1().start();
74 result = echoService.echo(echoValue);
75 assertEquals(echoValue, result);
76 }
77
78 }