Examples of FlowConstruct


Examples of org.mule.api.construct.FlowConstruct

     * make sure your component is declared as a singleton, otherwise this will not
     * work.
     */
    protected Object getComponent(String serviceName) throws Exception
    {
        final FlowConstruct flowConstruct = muleContext.getRegistry().lookupObject(serviceName);

        if (flowConstruct != null)
        {
            return getComponent(flowConstruct);
        }
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

        }
    }

    protected void stopFlowConstruct(String flowName) throws Exception
    {
        FlowConstruct flowConstruct = getFlowConstruct(flowName);
        if (flowConstruct instanceof Service)
        {
            Service service = (Service) flowConstruct;
            service.stop();
        }
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

    }

    @Test
    public void testLifecycle() throws Exception
    {
        FlowConstruct flowA = getFlowConstruct("flowA");
        FlowConstruct flowB = getFlowConstruct("flowB");
        TemplateMessagingExceptionStrategy flowAExceptionStrategy = (TemplateMessagingExceptionStrategy) flowA.getExceptionListener();
        TemplateMessagingExceptionStrategy flowBExceptionStrategy = (TemplateMessagingExceptionStrategy) flowB.getExceptionListener();
        LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowA = (LifecycleCheckerMessageProcessor) flowAExceptionStrategy.getMessageProcessors().get(0);
        LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowB = (LifecycleCheckerMessageProcessor) flowBExceptionStrategy.getMessageProcessors().get(0);
        assertThat(lifecycleCheckerMessageProcessorFlowA.isInitialized(), is(true));
        assertThat(lifecycleCheckerMessageProcessorFlowB.isInitialized(), is(true));
        assertThat(flowAExceptionStrategy.isInitialised(), is(true));
        assertThat(flowBExceptionStrategy.isInitialised(), is(true));
        ((Lifecycle)flowA).stop();
        assertThat(lifecycleCheckerMessageProcessorFlowA.isStopped(),is(true));
        assertThat(lifecycleCheckerMessageProcessorFlowB.isStopped(),is(false));

        FlowConstruct flowC = getFlowConstruct("flowC");
        FlowConstruct flowD = getFlowConstruct("flowD");
        TemplateMessagingExceptionStrategy flowCExceptionStrategy = (TemplateMessagingExceptionStrategy) flowC.getExceptionListener();
        TemplateMessagingExceptionStrategy flowDExceptionStrategy = (TemplateMessagingExceptionStrategy) flowD.getExceptionListener();
        LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowC = (LifecycleCheckerMessageProcessor) flowCExceptionStrategy.getMessageProcessors().get(0);
        LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowD = (LifecycleCheckerMessageProcessor) flowDExceptionStrategy.getMessageProcessors().get(0);
        assertThat(lifecycleCheckerMessageProcessorFlowC.isInitialized(), is(true));
        assertThat(lifecycleCheckerMessageProcessorFlowD.isInitialized(), is(true));
        assertThat(flowCExceptionStrategy.isInitialised(), is(true));
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

        assertEquals("Convert a String to a Byte Array", getDocDescription(stb));
        EndpointBuilder in = muleContext.getRegistry().lookupEndpointBuilder("in");
        assertNotNull(in);
        assertEquals("inbound vm endpoint", getDocName(in));
        assertEquals("Accepts inbound messages", getDocDescription(in));
        FlowConstruct flow = muleContext.getRegistry().lookupFlowConstruct("Bridge");
        assertNotNull(flow);
        assertEquals("Bridge flow", getDocName(flow));
        assertEquals("Main flow", getDocDescription(flow));
        DefaultJavaComponent echo = muleContext.getRegistry().lookupByType(DefaultJavaComponent.class).values().iterator().next();
        assertEquals("echo", getDocName(echo));
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

        return getChoiceRouter(flow);
    }

    private Flow lookupFlow(String flowConstructName)
    {
        FlowConstruct flow = muleContext.getRegistry().lookupFlowConstruct(flowConstructName);
        assertNotNull(flow);
        assertTrue(flow instanceof Flow);
        return (Flow) flow;
    }
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

     * make sure your component is declared as a singleton, otherwise this will not
     * work.
     */
    protected Object getComponent(String serviceName) throws Exception
    {
        final FlowConstruct flowConstruct = muleContext.getRegistry().lookupObject(serviceName);

        if (flowConstruct != null)
        {
            return getComponent(flowConstruct);
        }
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct


    private void testFlowPaths(String flowName, String... nodes) throws Exception
    {
        String[] expectedPaths = generatePaths(flowName, nodes);
        FlowConstruct flow = getFlowConstruct(unescape(flowName));
        DefaultMessageProcessorPathElement flowElement = new DefaultMessageProcessorPathElement(null, flowName);
        ((Pipeline) flow).addMessageProcessorPathElements(flowElement);
        Map<MessageProcessor, String> messageProcessorPaths = NotificationUtils.buildPaths(flowElement);
        String[] flowPaths = messageProcessorPaths.values().toArray(new String[]{});
        Assert.assertArrayEquals(expectedPaths, flowPaths);
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

    @Test
    public void testFlowWithChildFlowExceptionPropagation() throws MuleException
    {
        MuleClient client = muleContext.getClient();
        FlowConstruct flow = muleContext.getRegistry().lookupFlowConstruct("flowWithChildFlow");
        FlowConstruct childFlow = muleContext.getRegistry().lookupFlowConstruct("childFlow");
        SensingExceptionStrategy parentES = (SensingExceptionStrategy) flow.getExceptionListener();
        SensingExceptionStrategy childFlowES = (SensingExceptionStrategy) childFlow.getExceptionListener();

        client.send("vm://flowWithChildFlow-in", "", null);

        assertFalse(parentES.caught);
        assertTrue(childFlowES.caught);
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

    @Test
    public void testGracefulShutdownTimeout() throws Exception
    {
        final Latch latch = new Latch();

        FlowConstruct service = muleContext.getRegistry().lookupFlowConstruct("TestService");
        FunctionalTestComponent testComponent = (FunctionalTestComponent) getComponent(service);
        testComponent.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
View Full Code Here

Examples of org.mule.api.construct.FlowConstruct

    }

    @Test
    public void testDefaultExceptionStrategySingleEndpoint() throws MuleException
    {
        FlowConstruct service;

        if (variant.equals(ConfigVariant.FLOW))
            service = muleContext.getRegistry().lookupFlowConstruct("testService1");
        else
            service = muleContext.getRegistry().lookupService("testService1");

        assertNotNull(service);
        assertNotNull(service.getExceptionListener());
        assertTrue(service.getExceptionListener() instanceof DefaultMessagingExceptionStrategy);
        assertEquals(1,
            ((DefaultMessagingExceptionStrategy) service.getExceptionListener()).getMessageProcessors()
                .size());

        MuleClient client = muleContext.getClient();
        client.dispatch("vm://in1", "test", null);
        assertExceptionMessage(client.request("vm://out1", RECEIVE_TIMEOUT));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.