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);
}
}
});
}
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);
}
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));
}
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);
}
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);
}
}
Aggregations