Package org.mule.api.registry

Examples of org.mule.api.registry.MuleRegistry


     */
    public static void registerManager(MuleContext muleContext)
    {
        try
        {
            MuleRegistry registry = muleContext.getRegistry();
            if (registry.lookupObject(MockedMessageProcessorManager.ID) == null)
            {
                registry.registerObject(MockedMessageProcessorManager.ID, new MockedMessageProcessorManager());
            }
        }
        catch (RegistrationException e)
        {
            // Very uncommon scenario.
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());

        SimpleMemoryObjectStore<Serializable> memoryStore = new SimpleMemoryObjectStore<Serializable>();
        registry.registerObject(MuleProperties.OBJECT_STORE_DEFAULT_IN_MEMORY_NAME, memoryStore);
        registry.registerObject(MuleProperties.OBJECT_STORE_DEFAULT_PERSISTENT_NAME, new QueuePersistenceObjectStore<Serializable>());

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

        configureThreadingProfiles(registry);

        registry.registerObject(MuleProperties.OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE, new NoRetryPolicyTemplate());

        configureSystemModel(registry);
    }
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

    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(JmxAgent.class) == null)
            {
                registry.registerAgent(agent);
            }
           
            if (loadLog4jAgent)
            {
                agent = createLog4jAgent();
                if (!isAgentRegistered(agent))
                {
                    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

        assertAppsDir(NONE, new String[] {"dummy-app"}, true);

        // just assert no privileged entries were put in the registry
        final Application app = findApp("dummy-app", 1);
        final MuleRegistry registry = app.getMuleContext().getRegistry();
        final Object obj = registry.lookupObject(PriviledgedMuleApplication.REGISTRY_KEY_DEPLOYMENT_SERVICE);
        assertNull(obj);
        assertFalse(((ApplicationWrapper) app).getDelegate() instanceof PriviledgedMuleApplication);

        // 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

    @Test
    public void resolvesDefaultDbConfig() throws Exception
    {
        DbConfig dbConfig = mock(DbConfig.class);

        MuleRegistry registry = mock(MuleRegistry.class);
        Collection<DbConfig> foundDbConfigs = new ArrayList<DbConfig>();
        foundDbConfigs.add(dbConfig);

        when(registry.lookupObjects(DbConfig.class)).thenReturn(foundDbConfigs);
        DefaultDbConfigResolver dbConfigResolver = new DefaultDbConfigResolver(registry);

        DbConfig resolvedDbConfig = dbConfigResolver.resolve(muleEvent);

        assertThat(dbConfig, sameInstance(resolvedDbConfig));
View Full Code Here

    }

    @Test(expected = UnresolvableDbConfigException.class)
    public void throwsErrorWhenNoDbConfigAvailable() throws Exception
    {
        MuleRegistry registry = mock(MuleRegistry.class);
        Collection<DbConfig> foundDbConfigs = new ArrayList<DbConfig>();

        when(registry.lookupObjects(DbConfig.class)).thenReturn(foundDbConfigs);

        DefaultDbConfigResolver dbConfigResolver = new DefaultDbConfigResolver(registry);

        dbConfigResolver.resolve(muleEvent);
    }
View Full Code Here

        DbConfig dbConfig1 = mock(DbConfig.class);
        when(dbConfig1.getName()).thenReturn("dbConfig1");
        DbConfig dbConfig2 = mock(DbConfig.class);
        when(dbConfig2.getName()).thenReturn("dbConfig2");

        MuleRegistry registry = mock(MuleRegistry.class);
        Collection<DbConfig> foundDbConfigs = new ArrayList<DbConfig>();
        foundDbConfigs.add(dbConfig1);
        foundDbConfigs.add(dbConfig2);

        when(registry.lookupObjects(DbConfig.class)).thenReturn(foundDbConfigs);

        DefaultDbConfigResolver dbConfigResolver = new DefaultDbConfigResolver(registry);

        try
        {
View Full Code Here

        before.setSecurityContext(createTestAuthentication());
        before.setProperty("foo", "bar");

        // Create mock muleContext
        MuleContext muleContext = Mockito.mock(MuleContext.class);
        MuleRegistry registry = Mockito.mock(MuleRegistry.class);
        Mockito.when(muleContext.getRegistry()).thenReturn(registry);
        Mockito.when(muleContext.getExecutionClassLoader()).thenReturn(getClass().getClassLoader());
        Mockito.when(registry.lookupFlowConstruct("flow")).thenReturn(flow);

        // Serialize and then deserialize
        DefaultMuleSession after = (DefaultMuleSession) SerializationUtils.deserialize(
                SerializationUtils.serialize(before), muleContext);
View Full Code Here

    }

    @Test
    public void doesNotFailIfCannotResolveType() throws ResolverException, TransformerException
    {
        MuleRegistry muleRegistry = mock(MuleRegistry.class);
        when(muleContext.getRegistry()).thenReturn(muleRegistry);
        ArrayList<Transformer> transformers = new ArrayList<Transformer>();
        when(muleRegistry.lookupTransformers(dataTypeA, dataTypeB)).thenReturn(transformers);
        TypeBasedTransformerResolver resolver = new TypeBasedTransformerResolver();
        resolver.setMuleContext(muleContext);

        Transformer resolvedTransformer = resolver.resolve(dataTypeA, dataTypeB);
        assertNull(resolvedTransformer);
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.