Search in sources :

Example 1 with SimpleConfigurationBuilder

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

the class DefaultMuleContextFactory method createMuleContext.

/**
 * Creates a new MuleContext using the given configurationBuilder and configuration. Properties if provided are used to replace
 * "property placeholder" value in configuration files.
 */
public MuleContext createMuleContext(final List<ConfigurationBuilder> configurationBuilders, final Map<String, Object> properties, MuleConfiguration configuration) throws InitialisationException, ConfigurationException {
    // Create MuleContext
    MuleContextBuilder contextBuilder = MuleContextBuilder.builder(APP);
    contextBuilder.setMuleConfiguration(configuration);
    return doCreateMuleContext(contextBuilder, new ContextConfigurator() {

        @Override
        public void configure(MuleContext muleContext) throws ConfigurationException {
            // Configure with startup properties
            if (properties != null && !properties.isEmpty()) {
                new SimpleConfigurationBuilder(properties).configure(muleContext);
            }
            // Configure with configurationBuilder
            for (ConfigurationBuilder configurationBuilder : configurationBuilders) {
                configurationBuilder.configure(muleContext);
            }
        }
    });
}
Also used : MuleContext(org.mule.runtime.core.api.MuleContext) AutoConfigurationBuilder(org.mule.runtime.core.internal.config.builders.AutoConfigurationBuilder) ConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) ConfigurationException(org.mule.runtime.core.api.config.ConfigurationException) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) DefaultMuleContextBuilder(org.mule.runtime.core.internal.context.DefaultMuleContextBuilder)

Example 2 with SimpleConfigurationBuilder

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

the class DefaultMuleContextFactoryTestCase method testCreateMuleContextMuleContextBuilder.

@Test
public void testCreateMuleContextMuleContextBuilder() throws InitialisationException, ConfigurationException {
    TestMuleContextBuilder muleContextBuilder = new TestMuleContextBuilder();
    context = muleContextFactory.createMuleContext(asList(testServicesConfigurationBuilder, new SimpleConfigurationBuilder(null)), muleContextBuilder);
    assertCustomMuleContext(context);
    assertNoDefaults(context);
}
Also used : SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) Test(org.junit.Test)

Example 3 with SimpleConfigurationBuilder

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

the class DefaultMuleContextFactoryTestCase method before.

@Before
public void before() {
    Map<String, Object> objects = new HashMap<>();
    objects.put(TEST_STRING_KEY, TEST_STRING_VALUE);
    objects.put(TEST_OBJECT_NAME, new Banana());
    testConfigBuilder = new SimpleConfigurationBuilder(objects);
    testConfigBuilder2 = new SimpleConfigurationBuilder(singletonMap(TEST_STRING_KEY2, TEST_STRING_VALUE2));
}
Also used : HashMap(java.util.HashMap) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) Banana(org.mule.tck.testmodels.fruit.Banana) Before(org.junit.Before)

Example 4 with SimpleConfigurationBuilder

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

the class QueueManagerLifecycleOrderTestCase method before.

@Before
public void before() throws InitialisationException, ConfigurationException {
    Map<String, Object> objects = new HashMap<>();
    objects.put(OBJECT_QUEUE_MANAGER, rtqm);
    objects.put(OBJECT_SECURITY_MANAGER, new DefaultMuleSecurityManager());
    objects.put(PROCESSOR_INTERCEPTOR_MANAGER_REGISTRY_KEY, mock(ProcessorInterceptorManager.class));
    muleContext = new DefaultMuleContextFactory().createMuleContext(testServicesConfigurationBuilder, new SimpleConfigurationBuilder(objects));
    testServicesConfigurationBuilder.configure(muleContext);
}
Also used : DefaultMuleContextFactory(org.mule.runtime.core.api.context.DefaultMuleContextFactory) DefaultMuleSecurityManager(org.mule.runtime.core.internal.security.DefaultMuleSecurityManager) HashMap(java.util.HashMap) ProcessorInterceptorManager(org.mule.runtime.core.internal.interception.ProcessorInterceptorManager) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) Before(org.junit.Before)

Example 5 with SimpleConfigurationBuilder

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

the class DomainFunctionalTestCase method setUpMuleContexts.

@Before
public void setUpMuleContexts() throws Exception {
    final DomainContextBuilder domainContextBuilder = new DomainContextBuilder() {

        @Override
        protected void addBuilders(List<ConfigurationBuilder> builders) {
            super.addBuilders(builders);
            builders.add(new SimpleConfigurationBuilder(getDomainStartUpRegistryObjects()));
            if (getBuilder() != null) {
                builders.add(getBuilder());
            }
        }
    }.setDomainConfig(getDomainConfigs());
    domainContext = domainContextBuilder.build();
    domainInfrastructure = new ArtifactInstanceInfrastructure();
    domainContext.getInjector().inject(domainInfrastructure);
    ApplicationConfig[] applicationConfigs = getConfigResources();
    for (ApplicationConfig applicationConfig : applicationConfigs) {
        MuleContext muleContext = createAppMuleContext(applicationConfig.applicationResources);
        muleContexts.put(applicationConfig.applicationName, muleContext);
        ArtifactInstanceInfrastructure appInfrasturcture = new ArtifactInstanceInfrastructure();
        muleContext.getInjector().inject(appInfrasturcture);
        applsInfrastructures.put(applicationConfig.applicationName, appInfrasturcture);
    }
}
Also used : ConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) MuleContext(org.mule.runtime.core.api.MuleContext) SimpleConfigurationBuilder(org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder) Before(org.junit.Before)

Aggregations

SimpleConfigurationBuilder (org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder)7 Before (org.junit.Before)3 MuleContext (org.mule.runtime.core.api.MuleContext)3 ConfigurationBuilder (org.mule.runtime.core.api.config.ConfigurationBuilder)3 HashMap (java.util.HashMap)2 DefaultMuleContextFactory (org.mule.runtime.core.api.context.DefaultMuleContextFactory)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 ConfigurationException (org.mule.runtime.core.api.config.ConfigurationException)1 DefaultMuleConfiguration (org.mule.runtime.core.api.config.DefaultMuleConfiguration)1 MuleContextBuilder (org.mule.runtime.core.api.context.MuleContextBuilder)1 MuleContextFactory (org.mule.runtime.core.api.context.MuleContextFactory)1 AutoConfigurationBuilder (org.mule.runtime.core.internal.config.builders.AutoConfigurationBuilder)1 DefaultsConfigurationBuilder (org.mule.runtime.core.internal.config.builders.DefaultsConfigurationBuilder)1 DefaultMuleContextBuilder (org.mule.runtime.core.internal.context.DefaultMuleContextBuilder)1 ProcessorInterceptorManager (org.mule.runtime.core.internal.interception.ProcessorInterceptorManager)1 DefaultMuleSecurityManager (org.mule.runtime.core.internal.security.DefaultMuleSecurityManager)1 TestServicesConfigurationBuilder (org.mule.tck.config.TestServicesConfigurationBuilder)1 Banana (org.mule.tck.testmodels.fruit.Banana)1