Examples of MuleContext


Examples of org.mule.api.MuleContext

    /**
     * Test that the same bean from the TransientRegistry will have precedence over the 1st appContext
     */
    public void testTransientRegistryPrecedence() throws Exception
    {
        MuleContext context = new DefaultMuleContextFactory().createMuleContext();
       
        context.getRegistry().registerObject("orange", new Orange(12, 5.5, "Tutti Frutti"));
       
        ApplicationContext appContext = new ClassPathXmlApplicationContext("application-context.xml");
        ConfigurationBuilder builder = new SpringConfigurationBuilder(appContext);
        builder.configure(context);

        context.start();
       
        Object orange = context.getRegistry().lookupObject("orange");
        assertNotNull(orange);
        assertTrue(orange instanceof Orange);
        assertEquals("Tutti Frutti", ((Orange) orange).getBrand());
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    /**
     * Test that an existing appContext can be used as a parent AppContext for Mule
     */
    public void testParentContext() throws Exception
    {
        MuleContext context = new DefaultMuleContextFactory().createMuleContext();

        ApplicationContext appContext = new ClassPathXmlApplicationContext("application-context.xml");

        SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder("mule-config.xml");
        builder.setParentContext(appContext);
        builder.configure(context);

        context.start();

        Object orange = context.getRegistry().lookupObject("orange");
        assertNotNull(orange);
        assertTrue(orange instanceof Orange);
        assertEquals("Pirulo", ((Orange) orange).getBrand());
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    /**
     * Test the most common approach: Create the Spring config + Mule config in a single AppContext.
     */
    public void testAppContextTogetherWithMuleConfig() throws Exception
    {
        MuleContext context = new DefaultMuleContextFactory().createMuleContext();

        SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder("application-context.xml, mule-config.xml");
        builder.configure(context);

        context.start();

        Object orange = context.getRegistry().lookupObject("orange");
        assertNotNull(orange);
        assertTrue(orange instanceof Orange);
        assertEquals("Pirulo", ((Orange) orange).getBrand());
    }
View Full Code Here

Examples of org.mule.api.MuleContext

{

    public void testDisposal() throws MuleException, InterruptedException
    {
        int threadsBeforeStart = Thread.activeCount();
        MuleContext ctx = new DefaultMuleContextFactory().createMuleContext();
        ctx.start();
        assertTrue(Thread.activeCount() > threadsBeforeStart);
        ctx.stop();
        ctx.dispose();
        // Check that workManager ("MuleServer") thread no longer exists.
        assertTrue(Thread.activeCount() == threadsBeforeStart);
        assertTrue(ctx.isDisposed());
        assertFalse(ctx.isInitialised());
        assertFalse(ctx.isStarted());
    }
View Full Code Here

Examples of org.mule.api.MuleContext

     */
    public MuleContext createMuleContext(List<ConfigurationBuilder> configurationBuilders,
        MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException
    {
        // Create MuleContext
        MuleContext muleContext = doCreateMuleContext(muleContextBuilder);

        // Configure
        for (ConfigurationBuilder configBuilder : configurationBuilders)
        {
            configBuilder.configure(muleContext);
View Full Code Here

Examples of org.mule.api.MuleContext

    public MuleContext createMuleContext(ConfigurationBuilder configurationBuilder,
                                         MuleContextBuilder muleContextBuilder)
        throws InitialisationException, ConfigurationException
    {
        // Create MuleContext
        MuleContext muleContext = doCreateMuleContext(muleContextBuilder);

        // Configure
        configurationBuilder.configure(muleContext);

        return muleContext;
View Full Code Here

Examples of org.mule.api.MuleContext

     */
    public MuleContext createMuleContext(String configResources, Properties properties)
        throws InitialisationException, ConfigurationException
    {
        // Create MuleContext
        MuleContext muleContext = doCreateMuleContext(new DefaultMuleContextBuilder());

        // Configure with startup properties
        if (properties != null && !properties.isEmpty())
        {
            new SimpleConfigurationBuilder(properties).configure(muleContext);
View Full Code Here

Examples of org.mule.api.MuleContext

        throws InitialisationException, ConfigurationException
    {
        // Create MuleContext
        DefaultMuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
        contextBuilder.setMuleConfiguration(configuration);
        MuleContext muleContext = doCreateMuleContext(contextBuilder);

        // Configure with startup properties
        if (properties != null && !properties.isEmpty())
        {
            new SimpleConfigurationBuilder(properties).configure(muleContext);
View Full Code Here

Examples of org.mule.api.MuleContext

    protected MuleContext doCreateMuleContext(MuleContextBuilder muleContextBuilder)
        throws InitialisationException
    {
        // Create muleContext instance and set it in MuleServer
        MuleContext muleContext = buildMuleContext(muleContextBuilder);

        // Initialiase MuleContext
        muleContext.initialise();

        return muleContext;
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    // Initialize
    //
    @Test
    public void initaliseSuccessful() throws Exception
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        assertFalse(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertFalse(ctx.isDisposed());
        assertFalse(ctx.isDisposing());

        ctx.initialise();
        assertTrue(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertFalse(ctx.isDisposed());
        assertFalse(ctx.isDisposing());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.