Package org.mule.api.service

Examples of org.mule.api.service.Service


    }

    protected void doTest(String service, int exhausted, int initialisation,
                          int active, int idle, long wait)
    {
        Service c = muleContext.getRegistry().lookupService(service);
        assertNotNull(service, c);
        assertTrue(c.getComponent() instanceof PooledJavaComponent);
        PooledJavaComponent pjc = (PooledJavaComponent)c.getComponent();
        PoolingProfile profile = pjc.getPoolingProfile();
        assertNotNull(profile);
        assertEquals("exhausted:", exhausted, profile.getExhaustedAction());
        assertEquals("initialisation:", initialisation, profile.getInitialisationPolicy());
        assertEquals("active:", active, profile.getMaxActive());
View Full Code Here


        return "org/mule/test/integration/exceptions/default-service-exception-strategy-config.xml";
    }

    public void testDefaultExceptionStrategySingleEndpoint() throws MuleException
    {
        Service service = muleContext.getRegistry().lookupService("testService1");
        assertNotNull(service);
        assertNotNull(service.getExceptionListener());
        assertTrue(service.getExceptionListener() instanceof DefaultMessagingExceptionStrategy);
        assertEquals(1, ((DefaultMessagingExceptionStrategy) service.getExceptionListener()).getMessageProcessors().size());

        MuleClient mc = new MuleClient(muleContext);
        mc.dispatch("vm://in1", "test", null);
        assertExceptionMessage(mc.request("vm://out1", RECEIVE_TIMEOUT));
        // request one more time to ensure that only one exception message was sent per exception
View Full Code Here

        assertNull(mc.request("vm://out1", RECEIVE_TIMEOUT));
    }

    public void testDefaultExceptionStrategyMultipleEndpoints() throws MuleException
    {
        Service service = muleContext.getRegistry().lookupService("testService2");
        assertNotNull(service);
        assertNotNull(service.getExceptionListener());
        assertTrue(service.getExceptionListener() instanceof DefaultMessagingExceptionStrategy);
        DefaultMessagingExceptionStrategy exceptionListener =
            (DefaultMessagingExceptionStrategy) service.getExceptionListener();
        MessageProcessor mp = exceptionListener.getMessageProcessors().iterator().next();
        assertTrue(mp.getClass().getName(), mp instanceof MulticastingRouter);
        assertEquals(2, ((MulticastingRouter) mp).getRoutes().size());

        MuleClient mc = new MuleClient(muleContext);
View Full Code Here

        assertEquals("value2", payloadMap.get("key2"));
    }

    public void testStopsServiceOnException() throws MuleException, InterruptedException
    {
        final Service service = muleContext.getRegistry().lookupService("testService5");

        MuleClient mc = new MuleClient(muleContext);
        mc.dispatch("vm://in5", "test", null);

        assertExceptionMessage(mc.request("vm://out5", FunctionalTestCase.RECEIVE_TIMEOUT));

        Prober prober = new PollingProber(5000, 100);
        prober.check(new Probe()
        {
            public boolean isSatisfied()
            {
                return !service.isStarted();
            }

            public String describeFailure()
            {
                return "Service was not stopped after processing the exception";
View Full Code Here

        SimpleContext c = new SimpleContext();
        c.bind("vmConnector", new VMConnector(muleContext));
        c.bind("endpointRef", "vm://my.object");
        c.bind("Log4JAgent", new Log4jAgent());
        c.bind("XmlToObject", new XmlToObject());
        Service d = MuleTestUtils.getTestService("EchoUMO", EchoComponent.class, this.muleContext);
        c.bind("EchoUMO", d);
        return c;
    }
View Full Code Here

        msg.setOutboundProperty("foo", "bar");
        result = client.send("inboundEndpoint", msg);
        assertNotNull(result);
        assertEquals("got it!", result.getPayloadAsString());

        Service async = muleContext.getRegistry().lookupService("In-Out_Out-Only-Async-Service");
        Service external = muleContext.getRegistry().lookupService("ExternalApp");

        assertEquals(2, async.getStatistics().getProcessedEvents());
        assertEquals(1, external.getStatistics().getProcessedEvents());
    }
View Full Code Here

        assertComponent(model, "TheBankGateway");
    }

    protected void assertComponent(SedaModel model, String name)
    {
        Service service = muleContext.getRegistry().lookupService(name);
        assertNotNull(name + " missing", service);
    }
View Full Code Here

        return "org/mule/module/cxf/functional/endpoint-binds-to-correct-wdsl-port.xml";
    }

    public void testThatTheCorrectSoapPortIsChosen() throws Exception
    {
        final Service service = muleContext.getRegistry().lookupService("CXFProxyService");
        ServiceCompositeMessageSource messageSource = (ServiceCompositeMessageSource) service.getMessageSource();

        List<InboundEndpoint> endpoints = messageSource.getEndpoints();
        DefaultInboundEndpoint inboundEndpoint = (DefaultInboundEndpoint) endpoints.get(0);
        List<MessageProcessor> processors = inboundEndpoint.getMessageProcessors();
        FlowConfiguringMessageProcessor wrapper = (FlowConfiguringMessageProcessor) processors.get(0);
View Full Code Here

        assertTrue(c.isStarted());
    }

    public void testEndpoint1Config() throws Exception
    {
        Service service = muleContext.getRegistry().lookupService("testService1");
        assertNotNull(service);

        InboundEndpoint ep = ((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoint("qEP1");
        assertNotNull(ep);
        assertNotNull(ep.getProperty("jobConfig"));
        assertTrue(ep.getProperty("jobConfig") instanceof EventGeneratorJobConfig);
        EventGeneratorJobConfig config = (EventGeneratorJobConfig)ep.getProperty("jobConfig");
        assertEquals("foo", config.getPayload());
View Full Code Here

        assertEquals("foo", config.getPayload());
    }

    public void testEndpoint2Config() throws Exception
    {
        Service service = muleContext.getRegistry().lookupService("testService2");
        assertNotNull(service);

        InboundEndpoint ep = ((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoint("qEP2");
        assertNotNull(ep.getProperty("jobConfig"));
        assertTrue(ep.getProperty("jobConfig") instanceof EventGeneratorJobConfig);
        EventGeneratorJobConfig config = (EventGeneratorJobConfig)ep.getProperty("jobConfig");
        assertEquals("foo bar", config.getPayload());
    }
View Full Code Here

TOP

Related Classes of org.mule.api.service.Service

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.