1
2
3
4
5
6
7 package org.mule.module.cxf.wssec;
8
9 import org.mule.tck.junit4.FunctionalTestCase;
10 import org.mule.tck.junit4.rule.DynamicPort;
11 import org.mule.util.concurrent.Latch;
12
13 import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
14 import org.junit.Rule;
15 import org.junit.Test;
16
17 import static org.junit.Assert.assertTrue;
18
19 public class UsernameTokenTestCase extends FunctionalTestCase
20 {
21 private Latch greetLatch;
22
23 @Rule
24 public DynamicPort dynamicPort = new DynamicPort("port1");
25
26 @Override
27 protected String getConfigResources()
28 {
29 return "org/mule/module/cxf/wssec/cxf-secure-service.xml, org/mule/module/cxf/wssec/username-token-conf.xml";
30 }
31
32 @Override
33 protected void doSetUp() throws Exception
34 {
35 ClientPasswordCallback.setPassword("secret");
36 super.doSetUp();
37
38 greetLatch = getGreeter().getLatch();
39 }
40
41 @Test
42 public void testUsernameToken() throws Exception
43 {
44 assertTrue(greetLatch.await(60, TimeUnit.SECONDS));
45 }
46
47 protected GreeterWithLatch getGreeter() throws Exception
48 {
49 Object instance = getComponent("greeterService");
50 return (GreeterWithLatch) instance;
51 }
52
53 }
54
55