Search in sources :

Example 11 with ConfigurationBuilder

use of org.mule.runtime.core.api.config.ConfigurationBuilder in project mule by mulesoft.

the class DefaultMuleContextFactoryTestCase method notifiesMuleContextEvents.

@Test
public void notifiesMuleContextEvents() throws InitialisationException, ConfigurationException {
    MuleContextListener listener = mock(MuleContextListener.class);
    ConfigurationBuilder configurationBuilder = mock(ConfigurationBuilder.class);
    context = mockMuleContext();
    context = mockMuleContext();
    doAnswer(invocation -> {
        listener.onInitialization(context, null);
        return null;
    }).when(context).initialise();
    MuleContextBuilder contextBuilder = mock(MuleContextBuilder.class);
    when(contextBuilder.buildMuleContext()).thenReturn(context);
    muleContextFactory.addListener(listener);
    muleContextFactory.createMuleContext(configurationBuilder, contextBuilder);
    InOrder inOrder = inOrder(listener);
    inOrder.verify(listener, times(1)).onCreation(context);
    inOrder.verify(listener, times(1)).onInitialization(eq(context), any(Registry.class));
}
Also used : DefaultsConfigurationBuilder(org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder) ConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder) TestServicesConfigurationBuilder(org.mule.tck.config.TestServicesConfigurationBuilder) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) InOrder(org.mockito.InOrder) MuleContextListener(org.mule.runtime.core.api.context.notification.MuleContextListener) Registry(org.mule.runtime.api.artifact.Registry) DefaultMuleContextBuilder(org.mule.runtime.core.internal.context.DefaultMuleContextBuilder) Test(org.junit.Test)

Aggregations

ConfigurationBuilder (org.mule.runtime.core.api.config.ConfigurationBuilder)11 MuleContext (org.mule.runtime.core.api.MuleContext)7 ArrayList (java.util.ArrayList)6 SimpleConfigurationBuilder (org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder)6 DefaultMuleContextFactory (org.mule.runtime.core.api.context.DefaultMuleContextFactory)5 List (java.util.List)3 Map (java.util.Map)3 ConfigurationException (org.mule.runtime.core.api.config.ConfigurationException)3 HashMap (java.util.HashMap)2 Optional (java.util.Optional)2 Properties (java.util.Properties)2 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)2 SpringXmlConfigurationBuilderFactory.createConfigurationBuilder (org.mule.runtime.config.api.SpringXmlConfigurationBuilderFactory.createConfigurationBuilder)2 DefaultMuleConfiguration (org.mule.runtime.core.api.config.DefaultMuleConfiguration)2 MuleContextFactory (org.mule.runtime.core.api.context.MuleContextFactory)2 MuleContextListener (org.mule.runtime.core.api.context.notification.MuleContextListener)2 DefaultsConfigurationBuilder (org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder)2 TestServicesConfigurationBuilder (org.mule.tck.config.TestServicesConfigurationBuilder)2 File (java.io.File)1 Arrays.asList (java.util.Arrays.asList)1