Search in sources :

Example 1 with DefaultsConfigurationBuilder

use of org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder in project mule by mulesoft.

the class MuleContextLifecycleTestCase method initialiseOnStarted.

@Test(expected = IllegalStateException.class)
public void initialiseOnStarted() throws Exception {
    ctx.initialise();
    new DefaultsConfigurationBuilder().configure(ctx);
    ctx.start();
    // Attempt to initialise once started should fail!
    ctx.initialise();
}
Also used : DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder) Test(org.junit.Test)

Example 2 with DefaultsConfigurationBuilder

use of org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder in project mule by mulesoft.

the class MuleContextLifecycleTestCase method startOnStarted.

@Test(expected = IllegalStateException.class)
public void startOnStarted() throws Exception {
    ctx.initialise();
    assertTrue("onInitialization never called on listener", callbackListener.wasInitialized);
    new DefaultsConfigurationBuilder().configure(ctx);
    TestNotificationListener notificationListener = new TestNotificationListener();
    notificationListenerRegistry.registerListener(notificationListener);
    ctx.start();
    assertTrue("CONTEXT_STARTING notification never fired", notificationListener.startingNotificationFired);
    assertTrue("CONTEXT_STARTED notification never fired", notificationListener.startedNotificationFired);
    assertTrue("onStart never called on listener", callbackListener.wasStarted);
    // Can't call twice
    ctx.start();
}
Also used : DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder) Test(org.junit.Test)

Example 3 with DefaultsConfigurationBuilder

use of org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder in project mule by mulesoft.

the class MuleContextLifecycleTestCase method initialiseOnStopped.

@Test(expected = IllegalStateException.class)
public void initialiseOnStopped() throws Exception {
    ctx.initialise();
    new DefaultsConfigurationBuilder().configure(ctx);
    ctx.start();
    ctx.stop();
    // Attempt to initialise once stopped should fail!
    ctx.initialise();
}
Also used : DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder) Test(org.junit.Test)

Example 4 with DefaultsConfigurationBuilder

use of org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder in project mule by mulesoft.

the class AbstractBenchmark method createMuleContextWithServices.

protected MuleContext createMuleContextWithServices() throws MuleException {
    MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
    List<ConfigurationBuilder> builderList = new ArrayList<>();
    builderList.add(new BasicRuntimeServicesConfigurationBuilder());
    builderList.add(new DefaultsConfigurationBuilder());
    return muleContextFactory.createMuleContext(builderList.toArray(new ConfigurationBuilder[] {}));
}
Also used : DefaultMuleContextFactory(org.mule.runtime.core.api.context.DefaultMuleContextFactory) DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder) ConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder) MuleContextFactory(org.mule.runtime.core.api.context.MuleContextFactory) DefaultMuleContextFactory(org.mule.runtime.core.api.context.DefaultMuleContextFactory) ArrayList(java.util.ArrayList) DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder)

Example 5 with DefaultsConfigurationBuilder

use of org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder in project mule by mulesoft.

the class TransactionManagerFactoryBeanTestCase method registerTransactionManager.

@Test
public void registerTransactionManager() throws Exception {
    DefaultMuleContext context = (DefaultMuleContext) new DefaultMuleContextFactory().createMuleContext(new TestServicesConfigurationBuilder(), new DefaultsConfigurationBuilder());
    TransactionManagerFactoryBean txMgrFB = new TransactionManagerFactoryBean();
    txMgrFB.setMuleContext(context);
    txMgrFB.setTxManagerFactory(new TestTransactionManagerFactory());
    TransactionManager transactionManager = txMgrFB.getObject();
    assertThat(transactionManager, not(is(IsNull.nullValue())));
}
Also used : DefaultMuleContextFactory(org.mule.runtime.core.api.context.DefaultMuleContextFactory) DefaultMuleContext(org.mule.runtime.core.internal.context.DefaultMuleContext) TransactionManagerFactoryBean(org.mule.runtime.config.internal.factories.TransactionManagerFactoryBean) TransactionManager(javax.transaction.TransactionManager) DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder) TestServicesConfigurationBuilder(org.mule.tck.config.TestServicesConfigurationBuilder) TestTransactionManagerFactory(org.mule.tck.testmodels.mule.TestTransactionManagerFactory) Test(org.junit.Test)

Aggregations

DefaultsConfigurationBuilder (org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder)11 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)2 DefaultMuleContextFactory (org.mule.runtime.core.api.context.DefaultMuleContextFactory)2 TestServicesConfigurationBuilder (org.mule.tck.config.TestServicesConfigurationBuilder)2 Arrays (java.util.Arrays)1 List (java.util.List)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 TransactionManager (javax.transaction.TransactionManager)1 After (org.junit.After)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertSame (org.junit.Assert.assertSame)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Assert.fail (org.junit.Assert.fail)1 Before (org.junit.Before)1 Rule (org.junit.Rule)1 Mockito.mock (org.mockito.Mockito.mock)1