Package org.mule.api.registry

Examples of org.mule.api.registry.MuleRegistry


    }

    @Test
    public void resolvesTypeWithOneMatchingTransformer() throws ResolverException, TransformerException
    {
        MuleRegistry muleRegistry = mock(MuleRegistry.class);
        when(muleContext.getRegistry()).thenReturn(muleRegistry);
        Transformer aToBConverter = new MockConverterBuilder().from(dataTypeA).to(dataTypeB).build();

        ArrayList<Transformer> transformers = new ArrayList<Transformer>();
        transformers.add(aToBConverter);
        when(muleRegistry.lookupTransformers(dataTypeA, dataTypeB)).thenReturn(transformers);


        TypeBasedTransformerResolver resolver = new TypeBasedTransformerResolver();
        resolver.setMuleContext(muleContext);
View Full Code Here


    }

    @Test
    public void resolvesTypeWithTwoMatchingTransformer() throws ResolverException, TransformerException
    {
        MuleRegistry muleRegistry = mock(MuleRegistry.class);
        when(muleContext.getRegistry()).thenReturn(muleRegistry);
        Transformer aToBConverter = new MockConverterBuilder().from(dataTypeA).to(dataTypeB).weighting(1).build();
        Transformer betterAToBConverter = new MockConverterBuilder().from(dataTypeA).to(dataTypeB).weighting(2).build();

        ArrayList<Transformer> transformers = new ArrayList<Transformer>();
        transformers.add(aToBConverter);
        transformers.add(betterAToBConverter);
        when(muleRegistry.lookupTransformers(dataTypeA, dataTypeB)).thenReturn(transformers);


        TypeBasedTransformerResolver resolver = new TypeBasedTransformerResolver();
        resolver.setMuleContext(muleContext);
View Full Code Here

public class DefaultsConfigurationBuilder extends AbstractConfigurationBuilder
{
    @Override
    protected void doConfigure(MuleContext muleContext) throws Exception
    {
        MuleRegistry registry = muleContext.getRegistry();

        registry.registerObject(MuleProperties.OBJECT_MULE_SIMPLE_REGISTRY_BOOTSTRAP,
            new SimpleRegistryBootstrap());

        configureQueueManager(muleContext);

        registry.registerObject(MuleProperties.OBJECT_SECURITY_MANAGER, new MuleSecurityManager());

        registry.registerObject(MuleProperties.OBJECT_STORE_DEFAULT_IN_MEMORY_NAME,
            DefaultObjectStoreFactoryBean.createDefaultInMemoryObjectStore());

        registry.registerObject(MuleProperties.OBJECT_STORE_DEFAULT_PERSISTENT_NAME,
            DefaultObjectStoreFactoryBean.createDefaultPersistentObjectStore());

        registerLocalObjectStoreManager(muleContext, registry);

        registry.registerObject(MuleProperties.QUEUE_STORE_DEFAULT_IN_MEMORY_NAME,
            DefaultObjectStoreFactoryBean.createDefaultInMemoryQueueStore());
        registry.registerObject(MuleProperties.QUEUE_STORE_DEFAULT_PERSISTENT_NAME,
            DefaultObjectStoreFactoryBean.createDefaultPersistentQueueStore());
        registry.registerObject(MuleProperties.DEFAULT_USER_OBJECT_STORE_NAME,
            DefaultObjectStoreFactoryBean.createDefaultUserObjectStore());
        registry.registerObject(MuleProperties.DEFAULT_USER_TRANSIENT_OBJECT_STORE_NAME,
            DefaultObjectStoreFactoryBean.createDefaultUserTransientObjectStore());
        registry.registerObject(MuleProperties.OBJECT_STORE_MANAGER, new MuleObjectStoreManager());
        registry.registerObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_PROCESSING_MANAGER,
            new MuleMessageProcessingManager());

        registry.registerObject(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY, new DefaultEndpointFactory());
        registry.registerObject(MuleProperties.OBJECT_MULE_STREAM_CLOSER_SERVICE,
            new DefaultStreamCloserService());

        registry.registerObject(MuleProperties.OBJECT_LOCK_PROVIDER, new SingleServerLockProvider());
        registry.registerObject(MuleProperties.OBJECT_LOCK_FACTORY, new MuleLockFactory());

        registry.registerObject(MuleProperties.OBJECT_PROCESSING_TIME_WATCHER,
            new DefaultProcessingTimeWatcher());

        configureThreadingProfiles(registry);

        registry.registerObject(MuleProperties.OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE,
            new NoRetryPolicyTemplate());
        registry.registerObject(MuleProperties.OBJECT_CONVERTER_RESOLVER,
            new DynamicDataTypeConversionResolver(muleContext));

        configureSystemModel(registry);

        registry.registerObject(MuleProperties.OBJECT_EXPRESSION_LANGUAGE, new MVELExpressionLanguageWrapper(muleContext));
    }
View Full Code Here

        return store;
    }

    private void createRegistryAndBaseStore(MuleContext muleContext, boolean isPersistent)
    {
        MuleRegistry muleRegistry = mock(MuleRegistry.class);
        if (isPersistent)
        {
            PartitionableObjectStore<?> store = createPersistentPartitionableObjectStore(muleContext);
            when(muleRegistry.lookupObject(MuleProperties.OBJECT_STORE_DEFAULT_PERSISTENT_NAME))
                    .thenReturn(store);
        }
        else
        {
            PartitionableObjectStore<?> store = createTransientPartitionableObjectStore();
            when(muleRegistry.lookupObject(MuleProperties.OBJECT_STORE_DEFAULT_IN_MEMORY_NAME))
                    .thenReturn(store);
        }

        when(muleContext.getRegistry()).thenReturn(muleRegistry);
    }
View Full Code Here

    public void initialise() throws InitialisationException
    {
        try
        {
            Agent agent = createRmiAgent();
            final MuleRegistry registry = muleContext.getRegistry();
            if (!isAgentRegistered(agent))
            {
                registry.registerAgent(agent);
            }

            // any existing jmx agent will be modified with remote connector settings
            agent = createJmxAgent();
            // there must be only one jmx agent, so lookup by type instead
            if (registry.lookupObject(AbstractJmxAgent.class) == null)
            {
                registry.registerAgent(agent);
            }

            agent = createJmxNotificationAgent();
            if (!isAgentRegistered(agent))
            {
                registry.registerAgent(agent);
            }

            if (loadJdmkAgent)
            {
                agent = createJdmkAgent();
                if (!isAgentRegistered(agent))
                {
                    registry.registerAgent(agent);
                }
            }

            if (loadMx4jAgent)
            {
                agent = createMx4jAgent();
                if (!isAgentRegistered(agent))
                {
                    registry.registerAgent(agent);
                }
            }

            if (loadProfilerAgent)
            {
                agent = createProfilerAgent();
                if (!isAgentRegistered(agent))
                {
                    registry.registerAgent(agent);
                }
            }

            // remove this agent once it has registered the other agents
            //TODO RM* this currently does nothing!!!
            registry.unregisterAgent(name);
        }
        catch (MuleException e)
        {
            throw new InitialisationException(e, this);
        }
View Full Code Here

        final MuleClient muleClient = new MuleClient("lifecycle-config.xml");

        final MuleContext muleContext = muleClient.getMuleContext();
        muleContext.start();

        final MuleRegistry registry = muleContext.getRegistry();

        final AbstractLifecycleTracker springLT = (AbstractLifecycleTracker) registry.lookupObject("SpringBeanLifecycleTracker");

        muleContext.dispose();
        muleClient.dispose();

        assertEquals("SpringBeanLifecycleTracker",
View Full Code Here

    }

    @Test
    public void testPutInTransientRegistry() throws Exception
    {
        final MuleRegistry registry = muleContext.getRegistry();
        assertNull(registry.lookupObject("bar"));
        registry.registerObject("bar", 123L);
        assertEquals(123L, registry.lookupObject("bar"));
    }
View Full Code Here

    @Before
    public void setup() throws InitialisationException
    {
        expressionManager = new DefaultExpressionManager();
        muleContext = Mockito.mock(MuleContext.class);
        MuleRegistry muleRegistry = Mockito.mock(MuleRegistry.class);
        Mockito.when(muleContext.getConfiguration()).thenReturn(new DefaultMuleConfiguration());
        Mockito.when(muleContext.getRegistry()).thenReturn(muleRegistry);
        Mockito.when(muleRegistry.lookupObjectsForLifecycle(Mockito.any(Class.class))).thenReturn(
            Collections.<Object> emptyList());
        expressionManager.setMuleContext(muleContext);
        expressionManager.initialise();
    }
View Full Code Here

    public void testInvalidInboundEndpoint() throws Exception
    {

        String expectedStartOfErrorMessage = "Error 'No such file' occurred when trying to CDW";

        MuleRegistry registry = muleContext.getRegistry();

        SftpConnector c = (SftpConnector) registry.lookupConnector("sftp");
        assertNotNull(c);

        EndpointBuilder epb = registry.lookupEndpointBuilder("InvalidEndpoint");
        InboundEndpoint ep = epb.buildInboundEndpoint();

        // Verify that failed creations of sftp-clients don't leak resources (e.g.
        // ssh-servers)
        // In v2.2.1-RC2 this tests fails after 132 attempts on a Mac OSX 10.6
View Full Code Here

        assertAppsDir(NONE, new String[] {dummyAppDescriptor.id}, true);
        assertApplicationAnchorFileExists(dummyAppDescriptor.id);

        // just assert no privileged entries were put in the registry
        final Application app = findApp(dummyAppDescriptor.id, 1);
        final MuleRegistry registry = getMuleRegistry(app);

        // mule-app.properties from the zip archive must have loaded properly
        assertEquals("mule-app.properties should have been loaded.", "someValue", registry.get("myCustomProp"));
    }
View Full Code Here

TOP

Related Classes of org.mule.api.registry.MuleRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.