use of org.mule.runtime.core.internal.context.DefaultMuleContext in project mule by mulesoft.
the class ConvertersNotRegisteredTwiceTestCase method addBuilders.
@Override
protected void addBuilders(List<ConfigurationBuilder> builders) {
super.addBuilders(builders);
builders.add(0, new AbstractConfigurationBuilder() {
@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
registryHelper = (MuleRegistryHelper) ((MuleContextWithRegistries) muleContext).getRegistry();
registryHelper = spy(registryHelper);
((DefaultMuleContext) muleContext).setMuleRegistry(registryHelper);
}
});
}
use of org.mule.runtime.core.internal.context.DefaultMuleContext 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.internal.context.DefaultMuleContext in project mule by mulesoft.
the class ClusterExtensionMessageSourceTestCase method before.
@Override
public void before() throws Exception {
super.before();
SchedulerController schedulerController = mock(SchedulerController.class);
when(schedulerController.isPrimarySchedulingInstance()).thenReturn(false);
((DefaultMuleContext) muleContext).setSchedulerController(schedulerController);
}
use of org.mule.runtime.core.internal.context.DefaultMuleContext in project mule by mulesoft.
the class SimpleRegistryBootstrapTestCase method createTestRegistryBootstrap.
private SimpleRegistryBootstrap createTestRegistryBootstrap(ArtifactType artifactType) throws InitialisationException {
final Properties properties = new Properties();
properties.put("1", format("java.lang.String,%s=%s", APPLY_TO_ARTIFACT_TYPE_PARAMETER_KEY, APP.getAsString()));
properties.put("2", format("java.util.Properties,%s=%s", APPLY_TO_ARTIFACT_TYPE_PARAMETER_KEY, DOMAIN.getAsString()));
properties.put("3", format("java.util.HashMap,%s=%s", APPLY_TO_ARTIFACT_TYPE_PARAMETER_KEY, POLICY.getAsString()));
properties.put("4", format("java.util.ArrayList,%s=%s/%s/%s", APPLY_TO_ARTIFACT_TYPE_PARAMETER_KEY, APP.getAsString(), DOMAIN.getAsString(), POLICY.getAsString()));
properties.put("jms.singletx.transaction.resource1", format("%s,optional)", TEST_TRANSACTION_FACTORY_CLASS));
properties.put("test.singletx.transaction.factory1", FakeTransactionFactory.class.getName());
properties.put("test.singletx.transaction.resource1", FakeTransactionResource.class.getName());
final BootstrapServiceDiscoverer bootstrapServiceDiscoverer = new TestBootstrapServiceDiscoverer(properties);
((DefaultMuleContext) muleContext).setBootstrapServiceDiscoverer(bootstrapServiceDiscoverer);
SimpleRegistryBootstrap simpleRegistryBootstrap = new SimpleRegistryBootstrap(artifactType, muleContext);
simpleRegistryBootstrap.initialise();
return simpleRegistryBootstrap;
}
use of org.mule.runtime.core.internal.context.DefaultMuleContext in project mule by mulesoft.
the class ExtensionPluginMetadataGenerator method createExtensionManager.
/**
* Creates a {@link ExtensionManager} needed for generating the metadata for an extension. It would be later discarded due to
* the manager would have references to classes loaded with the launcher class loader instead of the hierarchical class loaders
* created as result of the classification process.
*
* @return an {@link ExtensionManager} that would be used to register the extensions.
*/
private ExtensionManager createExtensionManager() {
DefaultExtensionManager extensionManager = new DefaultExtensionManager();
extensionManager.setMuleContext(new DefaultMuleContext() {
private ErrorTypeRepository errorTypeRepository = createDefaultErrorTypeRepository();
private ErrorTypeLocator errorTypeLocator = createDefaultErrorTypeLocator(errorTypeRepository);
@Override
public MuleRegistry getRegistry() {
return new MuleRegistryHelper(new DefaultRegistryBroker(this, new MuleLifecycleInterceptor()), this);
}
@Override
public ErrorTypeLocator getErrorTypeLocator() {
return errorTypeLocator;
}
@Override
public ErrorTypeRepository getErrorTypeRepository() {
return errorTypeRepository;
}
});
try {
extensionManager.initialise();
} catch (InitialisationException e) {
throw new RuntimeException("Error while initialising the extension manager", e);
}
return extensionManager;
}
Aggregations