Search in sources :

Example 6 with MuleConfiguration

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;
}
Also used : MuleConfiguration(org.mule.runtime.core.api.config.MuleConfiguration) DefaultQueueConfiguration(org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration) DefaultMuleContext(org.mule.runtime.core.internal.context.DefaultMuleContext)

Example 7 with MuleConfiguration

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()));
    }
}
Also used : DefaultMuleConfiguration(org.mule.runtime.core.api.config.DefaultMuleConfiguration) MuleConfiguration(org.mule.runtime.core.api.config.MuleConfiguration) DefaultMuleConfiguration(org.mule.runtime.core.api.config.DefaultMuleConfiguration) ConfigurationException(org.mule.runtime.core.api.config.ConfigurationException)

Example 8 with MuleConfiguration

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();
    }
}
Also used : DefaultMuleConfiguration(org.mule.runtime.core.api.config.DefaultMuleConfiguration) MuleConfiguration(org.mule.runtime.core.api.config.MuleConfiguration) AfterClass(org.junit.AfterClass)

Example 9 with MuleConfiguration

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);
}
Also used : MuleContext(org.mule.runtime.core.api.MuleContext) ComponentLocation(org.mule.runtime.api.component.location.ComponentLocation) DefaultMuleConfiguration(org.mule.runtime.core.api.config.DefaultMuleConfiguration) MuleConfiguration(org.mule.runtime.core.api.config.MuleConfiguration) FlowConstruct(org.mule.runtime.core.api.construct.FlowConstruct) Before(org.junit.Before)

Example 10 with MuleConfiguration

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));
}
Also used : MuleConfiguration(org.mule.runtime.core.api.config.MuleConfiguration) DomainMuleContextBuilder(org.mule.runtime.module.deployment.impl.internal.domain.DomainMuleContextBuilder) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

MuleConfiguration (org.mule.runtime.core.api.config.MuleConfiguration)11 Before (org.junit.Before)4 Test (org.junit.Test)4 DefaultMuleConfiguration (org.mule.runtime.core.api.config.DefaultMuleConfiguration)4 SmallTest (org.mule.tck.size.SmallTest)3 Registry (org.mule.runtime.api.artifact.Registry)2 MuleContextWithRegistries (org.mule.runtime.core.internal.context.MuleContextWithRegistries)2 AfterClass (org.junit.AfterClass)1 ComponentLocation (org.mule.runtime.api.component.location.ComponentLocation)1 ErrorType (org.mule.runtime.api.message.ErrorType)1 Message (org.mule.runtime.api.message.Message)1 DataType (org.mule.runtime.api.metadata.DataType)1 MuleContext (org.mule.runtime.core.api.MuleContext)1 ConfigurationException (org.mule.runtime.core.api.config.ConfigurationException)1 FlowConstruct (org.mule.runtime.core.api.construct.FlowConstruct)1 ExceptionContextProvider (org.mule.runtime.core.api.execution.ExceptionContextProvider)1 ProcessingStrategyFactory (org.mule.runtime.core.api.processor.strategy.ProcessingStrategyFactory)1 Transformer (org.mule.runtime.core.api.transformer.Transformer)1 DefaultQueueConfiguration (org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration)1 DefaultMuleContext (org.mule.runtime.core.internal.context.DefaultMuleContext)1