Search in sources :

Example 1 with BootstrapServiceDiscoverer

use of org.mule.runtime.core.api.config.bootstrap.BootstrapServiceDiscoverer 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;
}
Also used : DefaultMuleContext(org.mule.runtime.core.internal.context.DefaultMuleContext) BootstrapServiceDiscoverer(org.mule.runtime.core.api.config.bootstrap.BootstrapServiceDiscoverer) Properties(java.util.Properties)

Example 2 with BootstrapServiceDiscoverer

use of org.mule.runtime.core.api.config.bootstrap.BootstrapServiceDiscoverer in project mule by mulesoft.

the class SimpleRegistryBootstrapTransformersTestCase method registeringTransformersWithCustomKey.

@Test
public void registeringTransformersWithCustomKey() throws MuleException {
    Properties properties = new Properties();
    properties.setProperty("core.transformer.1", ExpectedKeyTransformer.class.getName());
    properties.setProperty("custom1", CustomKeyTransformer.class.getName());
    TestTransformerResolver transformerResolver = new TestTransformerResolver();
    ((MuleContextWithRegistries) muleContext).getRegistry().registerObject("testTransformerResolver", transformerResolver);
    final BootstrapServiceDiscoverer bootstrapServiceDiscoverer = new TestBootstrapServiceDiscoverer(properties);
    muleContext.setBootstrapServiceDiscoverer(bootstrapServiceDiscoverer);
    SimpleRegistryBootstrap registryBootstrap = new SimpleRegistryBootstrap(APP, muleContext);
    registryBootstrap.initialise();
    assertEquals(2, transformerResolver.getTransformersCount());
    assertTrue(transformerResolver.contains(ExpectedKeyTransformer.class));
    assertTrue(transformerResolver.contains(CustomKeyTransformer.class));
}
Also used : TestBootstrapServiceDiscoverer(org.mule.runtime.core.internal.config.bootstrap.TestBootstrapServiceDiscoverer) TestBootstrapServiceDiscoverer(org.mule.runtime.core.internal.config.bootstrap.TestBootstrapServiceDiscoverer) BootstrapServiceDiscoverer(org.mule.runtime.core.api.config.bootstrap.BootstrapServiceDiscoverer) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

Properties (java.util.Properties)2 BootstrapServiceDiscoverer (org.mule.runtime.core.api.config.bootstrap.BootstrapServiceDiscoverer)2 Test (org.junit.Test)1 TestBootstrapServiceDiscoverer (org.mule.runtime.core.internal.config.bootstrap.TestBootstrapServiceDiscoverer)1 DefaultMuleContext (org.mule.runtime.core.internal.context.DefaultMuleContext)1