public int compare(Object o1, Object o2) { try { return ((UMOEvent) o1).getMessageAsString().compareTo(((UMOEvent) o2).getMessageAsString()); } catch (UMOException e) { throw new IllegalArgumentException(e.getMessage()); } }
/** * Used to log the error passed into this Exception Listener * * @param t the exception thrown */ protected void logException(Throwable t) { UMOException umoe = ExceptionHelper.getRootMuleException(t); if (umoe != null) { logger.error(umoe.getDetailedMessage()); } else { logger.error("Caught exception in Exception Strategy: " + t.getMessage(), t); } }
public void testBadMethodName() throws Exception { UMOImmutableEndpoint ep = new ImmutableMuleEndpoint("jnp://localhost/TestService?method=foo", false); try { ep.send(getTestEvent("hello", ep)); } catch (UMOException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } }
public void testCorrectMethodType() throws Exception { UMOEndpoint ep = new MuleEndpoint("jnp://localhost/TestService?method=reverseString", false); ep.setProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES, String.class.getName()); try { ep.send(getTestEvent("hello", ep)); } catch (UMOException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } }
public void testNoMethodSet() throws Exception { UMOImmutableEndpoint ep = new ImmutableMuleEndpoint("jnp://localhost/TestService", false); try { ep.send(getTestEvent("hello", ep)); } catch (UMOException e) { assertTrue(e instanceof DispatchException); assertTrue( e.getMessage() .startsWith(Messages.get("rmi", RmiConnector.MSG_PARAM_SERVICE_METHOD_NOT_SET))); } }
public final synchronized void dispose() { // TODO lifecycleManager.checkPhase(Disposable.PHASE_NAME); if (isDisposed()) { return; } try { doDispose(); lifecycleManager.firePhase(getManagementContext(), Disposable.PHASE_NAME); if (getParent() != null) { parent.dispose(); } else { // remove this referenceonce there is no one else left to dispose RegistryContext.setRegistry(null); } } catch (UMOException e) { // TO-DO logger.error("Failed to cleanly dispose: " + e.getMessage(), e); } }
/** * Will shut down the server displaying the cause and time of the shutdown * * @param e the exception that caused the shutdown */ void shutdown(Throwable e) { Message msg = new Message(Messages.FATAL_ERROR_WHILE_RUNNING); UMOException muleException = ExceptionHelper.getRootMuleException(e); if (muleException != null) { logger.fatal(muleException.getDetailedMessage()); } else { logger.fatal(msg.toString() + " " + e.getMessage(), e); } List msgs = new ArrayList(); msgs.add(msg.getMessage()); Throwable root = ExceptionHelper.getRootException(e); msgs.add(root.getMessage() + " (" + root.getClass().getName() + ")"); msgs.add(" "); msgs.add(new Message(Messages.FATAL_ERROR_SHUTDOWN)); msgs.add( new Message( Messages.SERVER_STARTED_AT_X, new Date(MuleManager.getInstance().getStartDate()))); msgs.add(new Message(Messages.SERVER_SHUTDOWN_AT_X, new Date().toString())); shutdownMessage = StringMessageHelper.getBoilerPlate(msgs, '*', 80); logger.fatal(shutdownMessage); System.exit(0); }