Package org.mule.api

Examples of org.mule.api.DefaultMuleException


            for (String name : event.getMessage().getInvocationPropertyNames()) {
                invocationProperties.put(name, event.getMessage().getInvocationProperty(name));
            }
            nestedProcessor.process(payload, invocationProperties);
        } catch (Exception e) {
            throw new DefaultMuleException(e);
        }

        return event;
    }
View Full Code Here


    public void endpointThatThrowsException()
    {
        endpointMockerBehavior();

        module().outboundEndpoint(ADDRESS, PAYLOAD,
                                  new DefaultMuleException("exception"), null,
                                  props(entry(INVOCATION_KEY, INVOCATION_VALUE)),
                                  props(entry(INBOUND_KEY, INBOUND_VALUE)),
                                  props(entry(SESSION_KEY, SESSION_VALUE)),
                                  props(entry(OUTBOUND_KEY, OUTBOUND_VALUE)),
                                  createAssertions());
View Full Code Here

    public void endpointWithTransformer()
    {
        endpointMockerBehavior();

        module().outboundEndpoint(ADDRESS, PAYLOAD,
                                  new DefaultMuleException("exception"), muleTransformer,
                                  props(entry(INVOCATION_KEY, INVOCATION_VALUE)),
                                  props(entry(INBOUND_KEY, INBOUND_VALUE)),
                                  props(entry(SESSION_KEY, SESSION_VALUE)),
                                  props(entry(OUTBOUND_KEY, OUTBOUND_VALUE)),
                                  createAssertions());
View Full Code Here

    public void testRunWithError() throws MuleException
    {
        MunitTest test = new MockedTest(buildList(before), testFlow, buildList(after), handler);

        when(processorManager.getCalls()).thenReturn(createTestCalls());
        when(testFlow.process(muleEvent)).thenThrow(new DefaultMuleException("Error"));

        TestResult testResult = test.run();

        verify(testFlow, times(1)).process(muleEvent);
        verify(before, times(1)).process(muleEvent);
View Full Code Here

    @org.junit.Test
    public void whenAnExpectedExceptionIsThrownItShouldSucceed() throws MuleException
    {
        final MunitTest test = new MockedTest(Collections.<MunitFlow>emptyList(), testFlow, Collections.<MunitFlow>emptyList(), handler);
        when(testFlow.process(Matchers.<MuleEvent>anyObject())).thenThrow(new DefaultMuleException(new IllegalArgumentException()));
        when(testFlow.expectException(Matchers.<Exception>anyObject(), Matchers.<MuleEvent>anyObject())).thenReturn(true);

        final TestResult testResult = test.run();

        assertTrue(testResult.hasSucceeded());
View Full Code Here

    @org.junit.Test
    public void whenAnExpetionThatDoesNotMatchIsThrownItShouldFail() throws MuleException
    {
        final MunitTest test = new MockedTest(Collections.<MunitFlow>emptyList(), testFlow, Collections.<MunitFlow>emptyList(), handler);
        when(testFlow.process(Matchers.<MuleEvent>anyObject())).thenThrow(new DefaultMuleException(new IllegalArgumentException()));
        when(testFlow.expectException(Matchers.<Exception>anyObject(), Matchers.<MuleEvent>anyObject())).thenReturn(false);

        final TestResult testResult = test.run();

        assertFalse(testResult.hasSucceeded());
View Full Code Here


    @Test(expected = MuleException.class)
    public void outboundEndpointThrowsException() throws MuleException
    {
        when(endpointManager.getBehaviorFor(ADDRESS)).thenReturn(new OutboundBehavior(new DefaultMuleException(""), buildMessageAssertions()));

        new MockOutboundEndpoint(realEndpoint).process(event);
    }
View Full Code Here

        try
        {
            CommandLine line = parser.parse(options, args, true);
            if (line == null)
            {
                throw new DefaultMuleException("Unknown error parsing the Mule command line");
            }

            return line;
        }
        catch (ParseException p)
        {
            throw new DefaultMuleException("Unable to parse the Mule command line because of: " + p.toString(), p);
        }
    }
View Full Code Here

        //assertTrue(tx.isCommitted());
    }

    public void testRollback() throws Exception
    {
        strategy.handleException(new DefaultMuleException(CoreMessages.agentsRunning()));
        assertTrue(tx.isRolledBack());
        //There is nothing to actually commit the transaction since we are not running in a real tx
        assertFalse(tx.isCommitted());
    }
View Full Code Here

        assertNotNull(summary);
    }

    private Exception getException()
    {
        return new DefaultMuleException(MessageFactory.createStaticMessage("foo"), new DefaultMuleException(
            MessageFactory.createStaticMessage("bar"), new Exception("blah")));
    }
View Full Code Here

TOP

Related Classes of org.mule.api.DefaultMuleException

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.