Package org.mule.api.service

Examples of org.mule.api.service.Service


    }

    public void testMessageProcessor() throws Exception
    {
        MuleSession session = getTestSession(getTestService(), muleContext);
        Service testService = getTestService("test", Apple.class);
        assertNotNull(testService);

        MessageChunkAggregator router = new MessageChunkAggregator();
        router.setMuleContext(muleContext);
        router.setFlowConstruct(testService);   
View Full Code Here


        {
            MuleMessage result = client.send("sendManyEndpoint", TEST_MESSAGE, null);
            assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString());
        }

        Service c = muleContext.getRegistry().lookupService("testComponent2");
        assertTrue("Service should be a TestSedaService", c instanceof TestSedaService);
        Object ftc = getComponent(c);
        assertNotNull("Functional Test Service not found in the model.", ftc);
        assertTrue("Service should be a FunctionalTestComponent", ftc instanceof FunctionalTestComponent);
View Full Code Here

    public void testIdempotentReceiver() throws Exception
    {
        InboundEndpoint endpoint1 = getTestInboundEndpoint("Test1Provider", "test://Test1Provider?exchangePattern=one-way");
        Mock session = MuleTestUtils.getMockSession();
        Service service = getTestService();
        session.matchAndReturn("getFlowConstruct", service);


        IdempotentMessageFilter ir = new IdempotentMessageFilter();
        ir.setIdExpression("#[header:id]");
View Full Code Here

    public void testConnectorListenerSupport() throws Exception
    {
        Connector connector = getConnectorAndAssert();

        Service service = getTestService("anApple", Apple.class);

        InboundEndpoint endpoint =
            muleContext.getEndpointFactory().getInboundEndpoint(getTestEndpointURI());

        try
        {
            connector.registerListener(null, null, service);
            fail("cannot register null");
        }
        catch (Exception e)
        {
            // expected
        }

        try
        {
            connector.registerListener(endpoint, null, service);
            fail("cannot register null");
        }
        catch (Exception e)
        {
            // expected
        }

        try
        {
            connector.registerListener(null, getSensingNullMessageProcessor(), service);
            fail("cannot register null");
        }
        catch (Exception e)
        {
            // expected
        }

        connector.registerListener(endpoint, getSensingNullMessageProcessor(), service);

        // this should work
        connector.unregisterListener(endpoint, service);
        // so should this
        try
        {
            connector.unregisterListener(null, service);
            fail("cannot unregister null");
        }
        catch (Exception e)
        {
            // expected
        }
        try
        {
            connector.unregisterListener(null, service);
            fail("cannot unregister null");
        }
        catch (Exception e)
        {
            // expected
        }

        try
        {
            connector.unregisterListener(null, service);
            fail("cannot unregister null");
        }
        catch (Exception e)
        {
            // expected
        }
        connector.unregisterListener(endpoint, service);
        muleContext.getRegistry().unregisterService(service.getName());
    }
View Full Code Here

     */
    public MuleMessage sendEvent(MuleMessage message) throws MuleException
    {
        if (session.getFlowConstruct() instanceof Service)
        {
            Service service = (Service) session.getFlowConstruct();
            DefaultMuleEvent eventToSend = new DefaultMuleEvent(message, event.getEndpoint(), session);
            MuleEvent event = service.sendEvent(eventToSend);
            return event == null ? null : event.getMessage();
        }
        else
        {
            throw new MessagingException(
View Full Code Here

        return "Hello".getBytes();
    }

    public void testValidListener() throws Exception
    {
        Service service = getTestService("orange", Orange.class);
        Connector connector = getConnector();

        InboundEndpoint endpoint2 =
            muleContext.getEndpointFactory().getInboundEndpoint("ssl://localhost:30303");
View Full Code Here

        setStartContext(true);
    }

    public void testMessageAggregator() throws Exception
    {
        Service testService = getTestService("test", Apple.class);
        MuleSession session = getTestSession(testService, muleContext);

        TestEventAggregator router = new TestEventAggregator(3);
        router.setMuleContext(muleContext);
        router.setFlowConstruct(testService);
View Full Code Here

        connector.setSslHandshakeTimeout(1000);
       
        Mock mockService = new Mock(Service.class);
        mockService.expect("getResponseRouter");
        mockService.expectAndReturn("getInboundRouter", new ServiceCompositeMessageSource());
        Service service = (Service) mockService.proxy();
       
        Map<String, Object> properties = Collections.emptyMap();

        Mock mockEndpoint = new Mock(InboundEndpoint.class);
        mockEndpoint.expectAndReturn("getConnector", connector);
View Full Code Here

     *  Tests that an empty sequence can be routed properly
     */
    public void testEmptySequence() throws Exception
    {
        Object payload = Collections.emptySet();
        Service fc = getTestService();
        MuleSession session = getTestSession(fc, muleContext);
        MuleMessage toSplit = new DefaultMuleMessage(payload, new HashMap<String, Object>(), new HashMap<String, Object>(), null, muleContext);
        CollectionSplitter splitter = new CollectionSplitter();
        splitter.setMuleContext(muleContext);
        DefaultMuleEvent event = new DefaultMuleEvent(toSplit, getTestInboundEndpoint("ep"), session);
View Full Code Here

        assertNull(splitter.process(event));
    }

    private void assertRouted(Object payload, int count, boolean counted) throws Exception, MuleException
    {
        Service fc = getTestService();
        MuleSession session = getTestSession(fc, muleContext);

        Map<String, Object> inboundProps = new HashMap();
        inboundProps.put("inbound1", "1");
        inboundProps.put("inbound2", 2);
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.