use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class FilePersistenceTestCase method createQueueManager.
@Override
protected TransactionalQueueManager createQueueManager() throws Exception {
TransactionalQueueManager mgr = new TransactionalQueueManager();
MuleConfiguration mockConfiguration = mock(MuleConfiguration.class);
when(mockConfiguration.getWorkingDirectory()).thenReturn(temporaryFolder.getRoot().getAbsolutePath());
when(mockConfiguration.getMaxQueueTransactionFilesSizeInMegabytes()).thenReturn(100);
((DefaultMuleContext) muleContext).setMuleConfiguration(mockConfiguration);
mgr.setMuleContext(muleContext);
mgr.initialise();
mgr.setDefaultQueueConfiguration(new DefaultQueueConfiguration(0, true));
return mgr;
}
use of org.mule.runtime.core.api.config.MuleConfiguration 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.MuleConfiguration in project mule by mulesoft.
the class AbstractMuleContextTestCase method disposeContext.
@AfterClass
public static void disposeContext() throws MuleException {
try {
if (muleContext != null && !(muleContext.isDisposed() || muleContext.isDisposing())) {
try {
muleContext.dispose();
} catch (IllegalStateException e) {
// Ignore
LOGGER.warn(e + " : " + e.getMessage());
}
verifyAndStopSchedulers();
MuleConfiguration configuration = muleContext.getConfiguration();
if (configuration != null) {
final String workingDir = configuration.getWorkingDirectory();
// do not delete TM recovery object store, everything else is good to
// go
deleteTree(newFile(workingDir), IGNORED_DOT_MULE_DIRS);
}
}
deleteTree(newFile("./ActiveMQ"));
} finally {
muleContext = null;
clearLoggingConfig();
}
}
use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class MessageProcessingFlowTraceManagerTestCase method before.
@Before
public void before() {
manager = new MessageProcessingFlowTraceManager();
MuleContext context = mock(MuleContext.class);
MuleConfiguration config = mock(MuleConfiguration.class);
when(config.getId()).thenReturn(APP_ID);
when(context.getConfiguration()).thenReturn(config);
manager.setMuleContext(context);
rootFlowConstruct = mock(FlowConstruct.class);
ComponentLocation mockComponentLocation = mock(ComponentLocation.class);
when(mockComponentLocation.getFileName()).thenReturn(of(CONFIG_FILE_NAME));
when(mockComponentLocation.getLineInFile()).thenReturn(of(LINE_NUMBER));
when(rootFlowConstruct.getLocation()).thenReturn(mockComponentLocation);
when(rootFlowConstruct.getName()).thenReturn(ROOT_FLOW_NAME);
when(rootFlowConstruct.getMuleContext()).thenReturn(context);
nestedFlowConstruct = mock(FlowConstruct.class);
when(nestedFlowConstruct.getLocation()).thenReturn(mockComponentLocation);
when(nestedFlowConstruct.getName()).thenReturn(NESTED_FLOW_NAME);
when(nestedFlowConstruct.getMuleContext()).thenReturn(context);
messageContext = create(rootFlowConstruct, TEST_CONNECTOR_LOCATION);
}
use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class DomainMuleContextBuilderTestCase method createsContainerConfiguration.
@Test
public void createsContainerConfiguration() throws Exception {
DomainMuleContextBuilder builder = new DomainMuleContextBuilder("test");
MuleConfiguration muleConfiguration = builder.getMuleConfiguration();
assertThat(muleConfiguration.isContainerMode(), is(true));
}
Aggregations