Package org.mule.model.seda

Examples of org.mule.model.seda.SedaService


    }

    @Test
    public void testServiceDefaults()
    {
        SedaService service = lookupService("serviceDefault");
        QueueProfile queueProfile = service.getQueueProfile();
        assertEquals(0, queueProfile.getMaxOutstandingMessages());
        assertObjectStoreIsDefaultMemoryObjectStore(queueProfile.getObjectStore());
    }
View Full Code Here


    }
   
    @Test
    public void testServiceOnlyNumberOfOutstandingMessagesConfigured()
    {
        SedaService service = lookupService("serviceNoObjectStore");
        QueueProfile queueProfile = service.getQueueProfile();
        assertEquals(42, queueProfile.getMaxOutstandingMessages());
        assertObjectStoreIsDefaultMemoryObjectStore(queueProfile.getObjectStore());
    }
View Full Code Here

    }
   
    @Test
    public void testServiceExplicitDefaultMemoryObjectStoreConfigured()
    {
        SedaService service = lookupService("serviceExplicitDefaultMemoryObjectStore");
        QueueProfile queueProfile = service.getQueueProfile();
        assertObjectStoreIsDefaultMemoryObjectStore(queueProfile.getObjectStore());
    }
View Full Code Here

    }
   
    @Test
    public void testServiceExplicitDefaultPersistentObjectStoreConfigured()
    {
        SedaService service = lookupService("serviceExplicitDefaultPersistentObjectStore");
        QueueProfile queueProfile = service.getQueueProfile();
        assertObjectStoreIsDefaultPersistentObjectStore(queueProfile.getObjectStore());
    }
View Full Code Here

    }

    @Test
    public void testServiceExplicitObjectStoreConfigured()
    {
        SedaService service = lookupService("serviceExplicitObjectStore");
        QueueProfile queueProfile = service.getQueueProfile();
        assertTrue(queueProfile.getObjectStore() instanceof TestQueueStore);
    }
View Full Code Here

        assertNull(obj[0]);
    }

    public Service initialiseService(byte txBeginAction, EventCallback callback) throws Exception
    {
        Service service = new SedaService(muleContext);
        ((AbstractService) service).setExceptionListener(new DefaultMessagingExceptionStrategy(muleContext));
        service.setName("testComponent");
        service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(JdbcFunctionalTestComponent.class)));

        TransactionFactory tf = getTransactionFactory();
        TransactionConfig txConfig = new MuleTransactionConfig(txBeginAction);
        txConfig.setFactory(tf);
       
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(getInDest(), muleContext);
        endpointBuilder.setName("testIn");
        endpointBuilder.setConnector(connector);
        endpointBuilder.setTransactionConfig(txConfig);
        InboundEndpoint endpoint = muleContext.getEndpointFactory().getInboundEndpoint(
            endpointBuilder);

        EndpointBuilder endpointBuilder2 = new EndpointURIEndpointBuilder(getOutDest(), muleContext);
        endpointBuilder2.setName("testOut");
        endpointBuilder2.setConnector(connector);
        OutboundEndpoint outProvider = muleContext.getEndpointFactory().getOutboundEndpoint(
            endpointBuilder2);
       
        service.setOutboundMessageProcessor(new DefaultOutboundRouterCollection());
        OutboundPassThroughRouter router = new OutboundPassThroughRouter();
        router.addRoute(outProvider);
        ((OutboundRouterCollection) service.getOutboundMessageProcessor()).addRoute(router);
        ((CompositeMessageSource) service.getMessageSource()).addSource(endpoint);

        // these tests no longer work - they need replacing with config driven tests
        // furthemore, nothing is read from service properties any more
        // (except for axis and cxf related hacks)
        // so i am removing the code below since it's a pointless call to a deprecated method
//        HashMap props = new HashMap();
//        props.put("eventCallback", callback);
//        service.setProperties(props);
        service.setModel(model);
        muleContext.getRegistry().registerService(service);
        return service;
    }
View Full Code Here

        InboundEndpoint inboundEndpoint1 = muleContext.getEndpointFactory().getInboundEndpoint(
            "test://test1?connector=customTestConnector");
        InboundEndpoint inboundEndpoint2 = muleContext.getEndpointFactory().getInboundEndpoint(
            "test://test2?connector=customTestConnector");

        service = new SedaService(muleContext);
        service.setName("testService");
        ((CompositeMessageSource) service.getMessageSource()).addSource(inboundEndpoint1);
        ((CompositeMessageSource) service.getMessageSource()).addSource(inboundEndpoint2);
        Model model = new SedaModel();
        model.setMuleContext(muleContext);
View Full Code Here

        assertFiles(inFile, moveToDir, false, false);
    }

    protected Latch configureService(File inFile, boolean streaming, boolean filePayload) throws Exception
    {
        Service service = new SedaService(muleContext);
        service.setName("moveDeleteBridgeService");
        String url = fileToUrl(inFile.getParentFile()) + "?connector=moveDeleteConnector";
        Transformer transformer = null;
        if (streaming)
        {
            if (filePayload)
            {
                fail("Inconsistant test case: streaming and file payload are not compatible");
            }
            else
            {
                transformer = new FileMessageFactoryAssertingTransformer(ReceiverFileInputStream.class);
            }
        }
        else
        {
            if (filePayload)
            {
                transformer = new FileMessageFactoryAssertingTransformer(File.class);
            }
            else
            {
                transformer = new FileMessageFactoryAssertingTransformer(byte[].class);
            }
        }

        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(url, muleContext);
        endpointBuilder.addMessageProcessor(transformer);
        if (filePayload)
        {
            endpointBuilder.addMessageProcessor(new NoActionTransformer());
        }
        InboundEndpoint endpoint =
            muleContext.getEndpointFactory().getInboundEndpoint(endpointBuilder);
        ((CompositeMessageSource) service.getMessageSource()).addSource(endpoint);

        final Latch latch = new Latch();
        FunctionalTestComponent testComponent = new FunctionalTestComponent();
        testComponent.setMuleContext(muleContext);
        testComponent.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(final MuleEventContext context, final Object message) throws Exception
            {
                assertEquals(1, latch.getCount());
                assertEquals(TEST_MESSAGE, context.transformMessageToString());
                latch.countDown();
            }
        });
        testComponent.initialise();

        final DefaultJavaComponent component = new DefaultJavaComponent(new SingletonObjectFactory(testComponent));
        component.setMuleContext(muleContext);
        service.setComponent(component);
        service.setModel(muleContext.getRegistry().lookupSystemModel());
        muleContext.getRegistry().registerService(service);
        return latch;
    }
View Full Code Here

TOP

Related Classes of org.mule.model.seda.SedaService

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.