use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class DefaultFlowBuilderTestCase method setUp.
@Before
public void setUp() throws Exception {
MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
when(muleConfiguration.getDefaultProcessingStrategyFactory()).thenReturn(defaultProcessingStrategyFactory);
when(defaultProcessingStrategyFactory.create(any(), any())).thenReturn(processingStrategy);
}
use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method doNotRegistersMelWhenCompatibilityPluginIsNotInstalled.
@Test
public void doNotRegistersMelWhenCompatibilityPluginIsNotInstalled() throws Exception {
Registry registry = mock(Registry.class);
when(registry.lookupByType(DefaultExpressionLanguageFactoryService.class)).thenReturn(of(mock(DefaultExpressionLanguageFactoryService.class, RETURNS_DEEP_STUBS)));
when(registry.lookupByName(COMPATIBILITY_PLUGIN_INSTALLED)).thenReturn(empty());
final MuleContextWithRegistries mockMuleContext = MuleContextUtils.mockMuleContext();
MuleConfiguration config = mockMuleContext.getConfiguration();
doReturn(true).when(config).isValidateExpressions();
expressionManager = new DefaultExpressionManager();
((DefaultExpressionManager) expressionManager).setRegistry(registry);
((DefaultExpressionManager) expressionManager).setMuleContext(mockMuleContext);
initialiseIfNeeded(expressionManager, false, mockMuleContext);
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("There is no expression language registered for 'mel'");
expressionManager.isValid("mel:'Hello'");
}
use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class FlowProcessingStrategyTestCase method processingStrategySetBySystemPropertyOverridesDefault.
@Test
public void processingStrategySetBySystemPropertyOverridesDefault() throws Exception {
testWithSystemProperty(ProcessingStrategyFactory.class.getName(), TestProcessingStrategyFactory.class.getName(), () -> {
MuleConfiguration muleConfiguration = new DefaultMuleConfiguration();
when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
createFlow(null);
assertEquals(flow.getProcessingStrategy().getClass(), TestProcessingStrategy.class);
});
}
use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method before.
@Before
public void before() throws MuleException {
nonBlockingProcessorsExecuted.set(0);
muleContext = spy(super.muleContext);
ErrorTypeLocator errorTypeLocator = mock(ErrorTypeLocator.class);
ErrorType errorType = mock(ErrorType.class);
ExceptionContextProvider exceptionContextProvider = mock(ExceptionContextProvider.class);
MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
when(muleConfiguration.isContainerMode()).thenReturn(false);
when(muleConfiguration.getId()).thenReturn(randomNumeric(3));
when(muleConfiguration.getShutdownTimeout()).thenReturn(1000L);
when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
when(((PrivilegedMuleContext) muleContext).getErrorTypeLocator()).thenReturn(errorTypeLocator);
when(muleContext.getExceptionContextProviders()).thenReturn(singletonList(exceptionContextProvider));
when(errorTypeLocator.lookupErrorType((Exception) any())).thenReturn(errorType);
flow = builder("flow", muleContext).processingStrategyFactory(processingStrategyFactory).build();
flow.initialise();
flow.start();
}
use of org.mule.runtime.core.api.config.MuleConfiguration in project mule by mulesoft.
the class MuleObjectStoreManagerTestCase method setup.
@Before
public void setup() {
schedulerService = new SimpleUnitTestSupportSchedulerService();
muleContext = mock(MuleContextWithRegistries.class);
MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
when(muleConfiguration.getWorkingDirectory()).thenReturn(tempWorkDir.getRoot().getAbsolutePath());
when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
Registry registry = mock(Registry.class);
createRegistryAndBaseStore(muleContext, registry);
when(muleContext.getSchedulerBaseConfig()).thenReturn(config().withPrefix(MuleObjectStoreManagerTestCase.class.getName() + "#" + name.getMethodName()));
storeManager = new MuleObjectStoreManager();
storeManager.setSchedulerService(schedulerService);
storeManager.setRegistry(registry);
storeManager.setMuleContext(muleContext);
}
Aggregations