Package org.mule.model.seda

Examples of org.mule.model.seda.SedaService


        assertNull(lifecycleAdapter.componentObject);
    }
   
    public void testServicePropogatedLifecycle() throws InitialisationException
    {
        Service service = new SedaService(muleContext);
        service.setName("service");
        service.setModel(muleContext.getRegistry().lookupSystemModel());
        LifecycleTrackerComponent component = new LifecycleTrackerComponent();
        service.setComponent(component);
       
        service.initialise();
       
        assertTrue(component.getTracker().contains("initialise"));
    }
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

{
    public void testUndeploy() throws Exception
    {
        final String domainOriginal = "TEST_DOMAIN_1";

        final SedaService service = new SedaService(muleContext);
        service.setName("TEST_SERVICE");
        SingletonObjectFactory factory = new SingletonObjectFactory(Object.class);
        final DefaultJavaComponent component = new DefaultJavaComponent(factory);
        component.setMuleContext(muleContext);
        service.setComponent(component);

        service.setThreadingProfile(ThreadingProfile.DEFAULT_THREADING_PROFILE);
        SedaModel model = new SedaModel();
        model.setMuleContext(muleContext);
        service.setModel(model);
        muleContext.getRegistry().registerModel(model);
        muleContext.getRegistry().registerService(service);
        muleContext.start();

        final ServiceService jmxService = new ServiceService("TEST_SERVICE", muleContext);
View Full Code Here

    protected ThreadSafeAccess dummyEvent() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new Object(), (Map) null, muleContext);
        return new DefaultMuleEvent(message,
                MuleTestUtils.getTestInboundEndpoint("test", MessageExchangePattern.ONE_WAY, muleContext, null),
                new DefaultMuleSession(new SedaService(muleContext), muleContext));
    }
View Full Code Here

    }

    protected Service createUninitializedService() throws Exception
    {
        TestComponent component = new TestComponent();
        Service service = new SedaService(muleContext);
        service.setName("name");
        service.setComponent(component);
        service.setModel(muleContext.getRegistry().lookupSystemModel());
        return service;
    }
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()
        {
            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

    protected Service createService() throws MuleException
    {
        SedaModel model = new SedaModel();
        muleContext.getRegistry().registerModel(model);
        Service service = new SedaService(muleContext);
        service.setName("test");
        service.setComponent(new PassThroughComponent());
        service.setModel(model);
        return service;
    }
View Full Code Here

                                                    int eventTimeout,
                                                    MuleContext muleContext) throws MuleException
    {
        try
        {
            Service service = new SedaService(muleContext);
            service.setName(MANAGER_COMPONENT_NAME);
            service.setModel(muleContext.getRegistry().lookupSystemModel());

            Map props = new HashMap();
            props.put("wireFormat", wireFormat);
            props.put("encoding", encoding);
            props.put("synchronousEventTimeout", new Integer(eventTimeout));
            final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(new PrototypeObjectFactory(RemoteDispatcherComponent.class, props));
            component.setMuleContext(muleContext);
            service.setComponent(component);


            if (!(service.getMessageSource() instanceof CompositeMessageSource))
            {
                throw new IllegalStateException("Only 'CompositeMessageSource' is supported with RemoteDispatcherService");
            }

            ((CompositeMessageSource) service.getMessageSource()).addSource(endpoint);

            return service;
        }
        catch (Exception e)
        {
View Full Code Here

    {
        final SedaModel model = new SedaModel();
        model.setMuleContext(context);
        context.getRegistry().applyLifecycle(model);

        final Service service = new SedaService(context);
        service.setName(name);
        final SingletonObjectFactory of = new SingletonObjectFactory(clazz, props);
        of.initialise();
        final JavaComponent component = new DefaultJavaComponent(of);
        ((MuleContextAware) component).setMuleContext(context);
        service.setComponent(component);
        service.setModel(model);
        if (initialize)
        {
            context.getRegistry().registerService(service);
        }
View Full Code Here

                                                    int eventTimeout,
                                                    MuleContext muleContext) throws MuleException
    {
        try
        {
            Service service = new SedaService(muleContext);
            service.setName(MANAGER_COMPONENT_NAME);
            service.setModel(muleContext.getRegistry().lookupSystemModel());

            RemoteDispatcherComponent rdc = new RemoteDispatcherComponent(endpoint, wireFormat, encoding, new Integer(eventTimeout));
           
            final SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(
                new SingletonObjectFactory(rdc));
            component.setMuleContext(muleContext);
            service.setComponent(component);


            if (!(service.getMessageSource() instanceof CompositeMessageSource))
            {
                throw new IllegalStateException("Only 'CompositeMessageSource' is supported with RemoteDispatcherService");
            }

            ((CompositeMessageSource) service.getMessageSource()).addSource(endpoint);

            return service;
        }
        catch (Exception e)
        {
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.