Package org.mule.api.exception

Examples of org.mule.api.exception.MessagingExceptionHandler


        TestConnector cnn = (TestConnector)muleContext.getRegistry().lookupConnector("customConnector");
        assertNotNull("customConnector should not be null", cnn);
        assertEquals(cnn.getSomeProperty(), "foo");

        //Test exception strategy
        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es instanceof TestExceptionStrategy);
        assertEquals("bar", ((TestExceptionStrategy) es).getTestProperty());
    }
View Full Code Here


                                        + "/services/mycomponent?method=echo", "test", props);
       
        String status = result.getProperty(HttpConnector.HTTP_STATUS_PROPERTY, PropertyScope.INBOUND);
        assertEquals(401, new Integer(status).intValue());
       
        MessagingExceptionHandler exceptionListener =
            muleContext.getRegistry().lookupService("mycomponent").getExceptionListener();
        assertTrue(exceptionListener instanceof UnitTestExceptionStrategy);
       
        UnitTestExceptionStrategy utExStrat = (UnitTestExceptionStrategy)exceptionListener;
        assertEquals(1, utExStrat.getMessagingExceptions().size());
View Full Code Here

        ConfigurationBuilder configurationBuilder = new AutoConfigurationBuilder(
            "org/mule/test/spring/config1/test-xml-mule2-config.xml");
        configurationBuilder.configure(muleContext);

        // Just a few of the asserts from AbstractConfigBuilderTestCase
        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es instanceof TestExceptionStrategy);
    }
View Full Code Here

            });

            if (serviceName != null && !(serviceName.length() == 0))
            {
                muleContext.getRegistry().lookupService(serviceName).setExceptionListener(
                    new MessagingExceptionHandler()
                    {
                        public MuleEvent handleException(Exception e, MuleEvent event, RollbackMethod rollbackMethod)
                        {
                            if (logger.isInfoEnabled()) logger.info("expected exception occurred: " + e, e);
                            exceptionHolder.value = e;
View Full Code Here

                                                    String serviceName)
    {
        // Declare countdown latch and listener
        final CountDownLatch latch = new CountDownLatch(1);
        SystemExceptionHandler listener = null;
        MessagingExceptionHandler messagingListener = null;
        MuleClient muleClient = p.getMuleClient();
        boolean localMuleClient = muleClient == null;
        SystemExceptionHandler currentExceptionListener = null;
        MessagingExceptionHandler currentMessagingListener = null;
        final ValueHolder<Exception> exceptionHolder = new ValueHolder<Exception>();

        try
        {
            // First create a local muleClient instance if not supplied
            if (localMuleClient) muleClient = new MuleClient(muleContext);

            // Next create a listener that listens for exception on the
            // sftp-connector
            listener = new SystemExceptionHandler()
            {
                public void handleException(Exception e, RollbackMethod rollbackMethod)
                {
                    exceptionHolder.value = e;
                    if (logger.isDebugEnabled())
                        logger.debug("Expected exception occurred: " + e.getMessage()
                                     + ", time to countdown the latch");
                    latch.countDown();
                }

                public void handleException(Exception exception)
                {
                    handleException(exception, null);
                }
            };

            messagingListener = new MessagingExceptionHandler()
            {
                public MuleEvent handleException(Exception e, MuleEvent event, RollbackMethod rollbackMethod)
                {
                    exceptionHolder.value = e;
                    if (logger.isDebugEnabled())
View Full Code Here

                        {
                            work.doWork();
                        }
                        catch (MuleException e)
                        {
                            MessagingExceptionHandler exceptionListener = event.getFlowConstruct().getExceptionListener();
                            if (e instanceof MessagingException)
                            {
                                exceptionListener.handleException(e, event);
                            }
                            else
                            {
                                exceptionListener.handleException(new MessagingException(
                                    CoreMessages.eventProcessingFailedFor(getStageDescription()), event, e), event);
                            }

                            // TODO Enable this to ensure Zero Message Loss
                            //      (although it will cause an infinite loop without some kind of redelivery policy)
View Full Code Here

                event = RequestContext.setEvent(event);
                doWork();
            }
            catch (MuleException e)
            {
                MessagingExceptionHandler exceptionListener = event.getFlowConstruct().getExceptionListener();
                if (e instanceof MessagingException)
                {
                    exceptionListener.handleException(e, event);
                }
                else
                {
                    exceptionListener.handleException(new MessagingException(
                        CoreMessages.eventProcessingFailedFor(getStageDescription()), event, e), event);
                }
            }
        }
View Full Code Here

    }


    public void testConnectorConfig() throws Exception
    {
        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es.getClass().getName(), es instanceof TestExceptionStrategy);
    }
View Full Code Here

    @Override
    public void testConnectorConfig() throws Exception
    {
        super.testConnectorConfig();

        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es.getClass().getName(), es instanceof TestExceptionStrategy);
    }
View Full Code Here

                                        + "/services/mycomponent?method=echo", "test", props);

        String status = result.getProperty(HttpConnector.HTTP_STATUS_PROPERTY, PropertyScope.INBOUND);
        assertEquals(401, new Integer(status).intValue());

        MessagingExceptionHandler exceptionListener =
            muleContext.getRegistry().lookupService("mycomponent").getExceptionListener();
        assertTrue(exceptionListener instanceof UnitTestExceptionStrategy);

        UnitTestExceptionStrategy utExStrat = (UnitTestExceptionStrategy)exceptionListener;
        assertEquals(1, utExStrat.getMessagingExceptions().size());
View Full Code Here

TOP

Related Classes of org.mule.api.exception.MessagingExceptionHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.