use of org.mule.runtime.core.api.config.DefaultMuleConfiguration in project mule by mulesoft.
the class MuleConfigurationConfigurator method doGetObject.
@Override
public Object doGetObject() throws Exception {
MuleConfiguration configuration = muleContext.getConfiguration();
if (configuration instanceof DefaultMuleConfiguration) {
DefaultMuleConfiguration defaultConfig = (DefaultMuleConfiguration) configuration;
defaultConfig.setDefaultResponseTimeout(config.getDefaultResponseTimeout());
defaultConfig.setDefaultTransactionTimeout(config.getDefaultTransactionTimeout());
defaultConfig.setShutdownTimeout(config.getShutdownTimeout());
defaultConfig.setDefaultErrorHandlerName(config.getDefaultErrorHandlerName());
defaultConfig.addExtensions(config.getExtensions());
defaultConfig.setMaxQueueTransactionFilesSize(config.getMaxQueueTransactionFilesSizeInMegabytes());
defaultConfig.setDynamicConfigExpiration(config.getDynamicConfigExpiration());
validateDefaultErrorHandler();
applyDefaultIfNoObjectSerializerSet(defaultConfig);
return configuration;
} else {
throw new ConfigurationException(createStaticMessage("Unable to set properties on read-only MuleConfiguration: " + configuration.getClass()));
}
}
use of org.mule.runtime.core.api.config.DefaultMuleConfiguration in project mule by mulesoft.
the class AbstractMuleContextTestCase method createMuleContext.
protected MuleContext createMuleContext() throws Exception {
// Should we set up the manager for every method?
MuleContext context;
if (isDisposeContextPerClass() && muleContext != null) {
context = muleContext;
} else {
final ClassLoader executionClassLoader = getExecutionClassLoader();
final ClassLoader originalContextClassLoader = currentThread().getContextClassLoader();
try {
currentThread().setContextClassLoader(executionClassLoader);
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
List<ConfigurationBuilder> builders = new ArrayList<>();
builders.add(new SimpleConfigurationBuilder(getStartUpRegistryObjects()));
addBuilders(builders);
builders.add(getBuilder());
MuleContextBuilder contextBuilder = MuleContextBuilder.builder(APP);
DefaultMuleConfiguration muleConfiguration = new DefaultMuleConfiguration();
String workingDirectory = this.workingDirectory.getRoot().getAbsolutePath();
LOGGER.info("Using working directory for test: " + workingDirectory);
muleConfiguration.setWorkingDirectory(workingDirectory);
muleConfiguration.setId(this.getClass().getSimpleName() + "#" + name.getMethodName());
contextBuilder.setMuleConfiguration(muleConfiguration);
contextBuilder.setExecutionClassLoader(executionClassLoader);
contextBuilder.setObjectSerializer(getObjectSerializer());
contextBuilder.setDeploymentProperties(getDeploymentProperties());
configureMuleContext(contextBuilder);
context = muleContextFactory.createMuleContext(builders, contextBuilder);
recordSchedulersOnInit(context);
if (!isGracefulShutdown()) {
// Even though graceful shutdown is disabled allow small amount of time to avoid rejection errors when stream emits
// complete signal
((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(NON_GRACEFUL_SHUTDOWN_TIMEOUT);
}
} finally {
currentThread().setContextClassLoader(originalContextClassLoader);
}
}
return context;
}
use of org.mule.runtime.core.api.config.DefaultMuleConfiguration in project mule by mulesoft.
the class MessagingExceptionTestCase method before.
@Before
public void before() throws MuleException {
originalVerboseExceptions = MuleException.verboseExceptions;
locationProvider.setMuleContext(mockContext);
DefaultMuleConfiguration mockConfiguration = mock(DefaultMuleConfiguration.class);
when(mockConfiguration.getId()).thenReturn("MessagingExceptionTestCase");
when(mockContext.getConfiguration()).thenReturn(mockConfiguration);
when(mockContext.getTransformationService()).thenReturn(transformationService);
testEvent = eventBuilder(muleContext).message(of(TEST_PAYLOAD)).build();
}
use of org.mule.runtime.core.api.config.DefaultMuleConfiguration in project mule by mulesoft.
the class LocalTxQueueTransactionRecovererTestCase method doSetUp.
@Override
protected void doSetUp() throws Exception {
((DefaultMuleConfiguration) muleContext.getConfiguration()).setWorkingDirectory(temporaryFolder.getRoot().getAbsolutePath());
txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
inQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(inQueue));
queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(inQueue));
}
use of org.mule.runtime.core.api.config.DefaultMuleConfiguration in project mule by mulesoft.
the class PolicyMuleContextBuilder method createMuleConfiguration.
@Override
protected DefaultMuleConfiguration createMuleConfiguration() {
final DefaultMuleConfiguration configuration = new DefaultMuleConfiguration(true);
initializeFromProperties(configuration);
configuration.setId(policyName);
final String encoding = defaultEncoding;
if (!isBlank(encoding)) {
configuration.setDefaultEncoding(encoding);
}
return configuration;
}
Aggregations