public void testAuthenticationFailureNoContext() throws Exception { MuleClient client = new MuleClient(); UMOMessage m = client.send("vm://my.queue", "foo", null); assertNotNull(m); assertNotNull(m.getExceptionPayload()); assertEquals( ExceptionHelper.getErrorCode(CredentialsNotSetException.class), m.getExceptionPayload().getCode()); }
public void testAuthenticationFailureBadCredentials() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); UMOEncryptionStrategy strategy = MuleManager.getInstance().getSecurityManager().getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anonX", "anonX", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); UMOMessage m = client.send("vm://my.queue", "foo", props); assertNotNull(m); assertNotNull(m.getExceptionPayload()); assertEquals( ExceptionHelper.getErrorCode(UnauthorisedException.class), m.getExceptionPayload().getCode()); }
public void testNoArgsCallWrapper() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://invoke", "test", null); UMOMessage reply = client.receive("vm://out", RECEIVE_TIMEOUT); assertNotNull(reply); assertNull(reply.getExceptionPayload()); assertEquals("Just an apple.", reply.getPayload()); }
public void testWithInjectedDelegate() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://invokeWithInjected", "test", null); UMOMessage reply = client.receive("vm://outWithInjected", RECEIVE_TIMEOUT); assertNotNull(reply); assertNull(reply.getExceptionPayload()); // same as original input assertEquals("test", reply.getPayload()); }