Examples of MuleContext


Examples of org.mule.api.MuleContext

    }
    @Test(expected=IllegalStateException.class)
    public void stopOnInitialised() throws Exception
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        ctx.initialise();
       
        // cannot stop if not started
        ctx.stop();
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test
    public void stopOnStarted() throws Exception
    {
        MuleContext ctx = buildStartedMuleContext();
       
        ctx.stop();
        assertTrue(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertFalse(ctx.isDisposed());
        assertFalse(ctx.isDisposing());
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test(expected=IllegalStateException.class)
    public void stopOnStopped() throws Exception
    {
        MuleContext ctx = buildStartedMuleContext();
        ctx.stop();
       
        // Can't call twice
        ctx.stop();
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test(expected=IllegalStateException.class)
    public void stopOnDisposed() throws Exception
    {
        MuleContext ctx = buildStartedMuleContext();
        ctx.stop();
        ctx.dispose();
       
        // Attempt to stop once disposed should fail!
        ctx.stop();
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    // Dispose
    //
    @Test
    public void disposeBeforeInitialised()
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        ctx.dispose();
        assertFalse(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertTrue(ctx.isDisposed());
        assertFalse(ctx.isDisposing());
       
        assertLifecycleManagerDidApplyPhases(Disposable.PHASE_NAME);
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test
    public void disposeOnInitialised() throws Exception
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        ctx.initialise();
        ctx.dispose();
        assertFalse(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertTrue(ctx.isDisposed());
        assertFalse(ctx.isDisposing());
       
        assertLifecycleManagerDidApplyPhases(Initialisable.PHASE_NAME, Disposable.PHASE_NAME);
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test
    public void disposeOnStarted() throws Exception
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        ctx.initialise();
        new DefaultsConfigurationBuilder().configure(ctx);
        final NotificationListener listener = new NotificationListener();
        ctx.registerListener(listener);

        ctx.start();
        ctx.dispose();
        assertFalse(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertTrue(ctx.isDisposed());
        assertFalse(ctx.isDisposing());

        // disposing started must go through stop
        assertLifecycleManagerDidApplyAllPhases();

        assertTrue("CONTEXT_STOPPING notification never fired", listener.stoppingNotificationFired.get());
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test
    public void disposeOnStopped() throws Exception
    {
        MuleContext  ctx = ctxBuilder.buildMuleContext();
        ctx.initialise();
        new DefaultsConfigurationBuilder().configure(ctx);
        ctx.start();
        ctx.stop();
        ctx.dispose();
        assertFalse(ctx.isInitialised());
        assertFalse(ctx.isInitialising());
        assertFalse(ctx.isStarted());
        assertTrue(ctx.isDisposed());
        assertFalse(ctx.isDisposing());
       
        assertLifecycleManagerDidApplyAllPhases();
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }
   
    @Test(expected=IllegalStateException.class)
    public void disposeOnDisposed() throws Exception
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        ctx.initialise();
        ctx.dispose();
       
        // can't call twice
        ctx.dispose();
    }
View Full Code Here

Examples of org.mule.api.MuleContext

    }

    @Test
    public void notificationHasMuleContextRef() throws Exception
    {
        MuleContext ctx = ctxBuilder.buildMuleContext();
        ctx.initialise();
        new DefaultsConfigurationBuilder().configure(ctx);
       
        final AtomicReference<MuleContext> contextFromNotification = new AtomicReference<MuleContext>();
        final AtomicReference<String> resourceId = new AtomicReference<String>();
        MuleContextNotificationListener<MuleContextNotification> listener =
            new MuleContextNotificationListener<MuleContextNotification>()
        {
            public void onNotification(MuleContextNotification notification)
            {
                contextFromNotification.set(notification.getMuleContext());
                resourceId.set(notification.getResourceIdentifier());
            }
        };
        ctx.registerListener(listener);
        ctx.start();

        assertNotNull(contextFromNotification.get());
        assertSame(ctx, contextFromNotification.get());
        assertEquals(ctx.getConfiguration().getId(), resourceId.get());
    }
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.