Package org.mule

Examples of org.mule.DefaultMuleContext


     */
    public MuleContext buildMuleContext()
    {
        logger.debug("Building new DefaultMuleContext instance with MuleContextBuilder: " + this);
        MuleContextLifecycleManager manager = getLifecycleManager();
        DefaultMuleContext muleContext = new DefaultMuleContext(getMuleConfiguration(),
                                                         getWorkManager(),
                                                         getWorkListener(),
                                                         manager,
                                                         getNotificationManager());
        manager.setMuleContext(muleContext);
        muleContext.setExecutionClassLoader(Thread.currentThread().getContextClassLoader());
        return muleContext;
    }
View Full Code Here


     * {@inheritDoc}
     */
    public MuleContext buildMuleContext()
    {
        logger.debug("Building new DefaultMuleContext instance with MuleContextBuilder: " + this);
        DefaultMuleContext muleContext = createDefaultMuleContext();
        muleContext.setMuleConfiguration(injectMuleContextIfRequired(getMuleConfiguration(), muleContext));
        muleContext.setWorkManager(injectMuleContextIfRequired(getWorkManager(), muleContext));
        muleContext.setworkListener(getWorkListener());
        muleContext.setNotificationManager(injectMuleContextIfRequired(getNotificationManager(), muleContext));
        muleContext.setLifecycleManager(injectMuleContextIfRequired(getLifecycleManager(), muleContext));
        muleContext.setExpressionManager(injectMuleContextIfRequired(new DefaultExpressionManager(),muleContext));
        DefaultRegistryBroker registryBroker = new DefaultRegistryBroker(muleContext);
        muleContext.setRegistryBroker(registryBroker);
        muleContext.setMuleRegistry(new MuleRegistryHelper(registryBroker, muleContext));
        muleContext.setLocalMuleClient(new DefaultLocalMuleClient(muleContext));
        muleContext.setExceptionListener(new DefaultSystemExceptionStrategy(muleContext));
        muleContext.setExecutionClassLoader(Thread.currentThread().getContextClassLoader());
        return muleContext;
    }
View Full Code Here

        return muleContext;
    }

    protected DefaultMuleContext createDefaultMuleContext()
    {
        return new DefaultMuleContext();
    }
View Full Code Here

    }

    @Test
    public void getStreamCloserService() throws Exception
    {
        DefaultMuleContext context = (DefaultMuleContext) new DefaultMuleContextFactory().createMuleContext();
        StreamCloserService serviceFromRegistry = context.getRegistry().lookupObject(MuleProperties.OBJECT_MULE_STREAM_CLOSER_SERVICE);
        MuleRegistryHelper registry = spy((MuleRegistryHelper) context.getRegistry());
        context.setMuleRegistry(registry);

        StreamCloserService streamCloserService = context.getStreamCloserService();
        assertNotNull(streamCloserService);

        assertSame(serviceFromRegistry, streamCloserService);

        // test that subsequent invocations consistently returns the same object
        assertSame(streamCloserService, context.getStreamCloserService());

        // verify we're not fetching from registry many times
        verify(registry, times(1)).lookupObject(MuleProperties.OBJECT_MULE_STREAM_CLOSER_SERVICE);
    }
View Full Code Here

TOP

Related Classes of org.mule.DefaultMuleContext

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.