181920212223242526
public class MessagesTestCase extends AbstractMuleTestCase { public void testMessageLoading() throws Exception { Message message = CoreMessages.authFailedForUser("Fred"); assertEquals("Authentication failed for principal Fred", message.getMessage()); assertEquals(135, message.getCode()); }
404142434445464748
} } public void testGoodBundle() { Message message = TestMessages.testMessage("one", "two", "three"); assertEquals("Testing, Testing, one, two, three", message.getMessage()); assertEquals(1, message.getCode()); }
5455565758596061626364
this.connector = connector; } private static Message generateMessage(Message message, Connector connector) { Message m = CoreMessages.connectorCausedError(connector); if (message != null) { message.setNextMessage(m); } return message;
142143144145146147148149150151152
public void setLifecycleManager(LifecycleManager manager) { if (!(manager instanceof MuleContextLifecycleManager)) { Message msg = MessageFactory.createStaticMessage( "lifecycle manager for MuleContext must be a MuleContextLifecycleManager"); throw new MuleRuntimeException(msg); } lifecycleManager = (MuleContextLifecycleManager) manager;
114115116117118119120121122123124
{ InputStream is = IOUtils.getResourceAsStream(fileName, callingClass, /* tryAsFile */true, /* tryAsUrl */false); if (is == null) { Message error = CoreMessages.cannotLoadFromClasspath(fileName); throw new IOException(error.toString()); } return loadProperties(is); }
125126127128129130131132133134135
public static Properties loadProperties(URL url) throws IOException { if (url == null) { Message error = CoreMessages.objectIsNull("url"); throw new IOException(error.toString()); } return loadProperties(url.openStream()); }
136137138139140141142143144145146147
public static Properties loadProperties(InputStream is) throws IOException { if (is == null) { Message error = CoreMessages.objectIsNull("input stream"); throw new IOException(error.toString()); } try { Properties props = new Properties();
120121122123124125126127128129130
} catch (Exception e) { if (e instanceof UnavailableException) { Message message = JcaMessages.cannotAllocateManagedInstance(); logger.error(message); flowConstruct.getExceptionListener().handleException(new DefaultMuleException(message, e), event); } else if (e instanceof MessagingException) {
6061626364656667686970
return route; } private static Message generateMessage(Message message, MessageProcessor target) { Message m = CoreMessages.failedToRouterViaEndpoint(target); if (message != null) { message.setNextMessage(m); return message; }
6162636465666768697071727374757677
private static Message constructMessage(SecurityContext context, ImmutableEndpoint endpoint, SecurityFilter filter) { Message m; if (context == null) { m = CoreMessages.authSetButNoContext(filter.getClass().getName()); } else { m = CoreMessages.authFailedForUser(context.getAuthentication().getPrincipal()); } m.setNextMessage(CoreMessages.authDeniedOnEndpoint(endpoint.getEndpointURI())); return m; }