1
2
3
4
5
6
7 package org.mule.test.integration.security;
8
9 import org.mule.api.MuleMessage;
10 import org.mule.client.DefaultLocalMuleClient;
11 import org.mule.tck.junit4.FunctionalTestCase;
12
13 import java.util.HashMap;
14
15 import org.junit.Test;
16
17 import static org.junit.Assert.assertNotNull;
18 import static org.junit.Assert.assertNull;
19
20
21
22
23 public class CustomSecurityFilterTestCase extends FunctionalTestCase
24 {
25
26 @Override
27 protected String getConfigResources()
28 {
29 return "org/mule/test/integration/security/custom-security-filter-test.xml";
30 }
31
32 @Test
33 public void testOutboundAutenticationSend() throws Exception
34 {
35 DefaultLocalMuleClient client = new DefaultLocalMuleClient(muleContext);
36
37 HashMap<String, Object> props = new HashMap<String,Object>();
38 props.put("username", "ross");
39 props.put("pass", "ross");
40 MuleMessage result = client.send("vm://test", "hi", props);
41 assertNull(result.getExceptionPayload());
42
43 props.put("pass", "badpass");
44 result = client.send("vm://test", "hi", props);
45 assertNotNull(result.getExceptionPayload());
46 }
47 }