Package org.mule.api

Examples of org.mule.api.MuleContext


        final MessageExchangePattern messageExchangePattern = MessageExchangePattern.REQUEST_RESPONSE;
        final int responseTimeout = 5;
        final String initialState = "state1";
        final String endpointEncoding = "enconding1";
        final String endpointBuilderName = "builderName1";
        final MuleContext muleContext = mock(MuleContext.class);
        final RetryPolicyTemplate retryPolicyTemplate = mock(RetryPolicyTemplate.class);
        final AbstractRedeliveryPolicy redeliveryPolicy = mock(IdempotentRedeliveryPolicy.class);
        final EndpointMessageProcessorChainFactory messageProcessorsFactory = mock(EndpointMessageProcessorChainFactory.class);
        final List<MessageProcessor> messageProcessors = new ArrayList<MessageProcessor>();
        final List<MessageProcessor> responseMessageProcessors = new ArrayList<MessageProcessor>();
View Full Code Here


        RegExFilter filter = new RegExFilter("The quick (.*)");
        assertNotNull(filter.getPattern());

        MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
        when(muleConfiguration.isCacheMessageAsBytes()).thenReturn(false);
        MuleContext muleContext= mock(MuleContext.class);
        when(muleContext.getConfiguration()).thenReturn(muleConfiguration);

        MuleMessage message = new DefaultMuleMessage("The quick brown fox", muleContext);
        assertTrue(filter.accept(message));
    }
View Full Code Here

    }

    @Test
    public void setMuleContext()
    {
        MuleContext mockMuleContext = mock(MuleContext.class);
        CompositeConverter compositeConverter = new CompositeConverter(mockConverterA, mockConverterB);

        compositeConverter.setMuleContext(mockMuleContext);

        verify(mockConverterA, atLeastOnce()).setMuleContext(mockMuleContext);
View Full Code Here

    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void twoApplicationCannotUseSamePort() throws Throwable
    {
        MuleContext firstMuleContext = null;
        MuleContext secondMuleContext = null;
        try
        {
            firstMuleContext = buildApp("helloWorld");
            thrown.expect(BindException.class);
            secondMuleContext = buildApp("helloMule");
View Full Code Here

    }

    protected MuleContext createMuleContext() throws Exception
    {
        // Should we set up the manager for every method?
        MuleContext context;
        if (getTestInfo().isDisposeManagerPerSuite() && muleContext != null)
        {
            context = muleContext;
        }
        else
        {
            MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
            List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
            builders.add(new SimpleConfigurationBuilder(getStartUpProperties()));
            //If the annotations module is on the classpath, add the annotations config builder to the list
            //This will enable annotations config for this instance
            if (ClassUtils.isClassOnPath(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, getClass()))
            {
                builders.add((ConfigurationBuilder) ClassUtils.instanciateClass(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER,
                        ClassUtils.NO_ARGS, getClass()));
            }
            builders.add(getBuilder());
            addBuilders(builders);
            MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
            configureMuleContext(contextBuilder);
            context = muleContextFactory.createMuleContext(builders, contextBuilder);
            if (!isGracefulShutdown())
            {
                ((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(0);
            }
        }
        return context;
    }
View Full Code Here

    @Test
    public void testRejectsConsumablePayload() throws Exception
    {

        MuleContext context = mock(MuleContext.class);
        InputStream is = new ByteArrayInputStream("TEST".getBytes());
        MuleMessage message = new DefaultMuleMessage(is, context);
        assertFalse("Should reject consumable payload", filter.accept(message));
    }
View Full Code Here

    }

    @Test
    public void testAcceptsNonConsumablePayload() throws Exception
    {
        MuleContext context = mock(MuleContext.class);
        MuleMessage message = new DefaultMuleMessage("TEST", context);
        assertTrue("Should accept non consumable payload", filter.accept(message));
    }
View Full Code Here

    {
        MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
        List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
        builders.add(new SpringXmlConfigurationBuilder(configuration));
        MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
        MuleContext muleContext = muleContextFactory.createMuleContext(builders, contextBuilder);
        final AtomicReference<Latch> contextStartedLatch = new AtomicReference<Latch>();
        contextStartedLatch.set(new Latch());
        muleContext.registerListener(new MuleContextNotificationListener<MuleContextNotification>()
        {
            @Override
            public void onNotification(MuleContextNotification notification)
            {
                if (notification.getAction() == MuleContextNotification.CONTEXT_STARTED)
                {
                    contextStartedLatch.get().countDown();
                }
            }
        });
        muleContext.start();
        contextStartedLatch.get().await(20, TimeUnit.SECONDS);
    }
View Full Code Here

    @Test
    public void testCreatingTheObjectStoreThrowsMuleRuntimeException()
    {
        MuleRuntimeException muleRuntimeException = new MuleRuntimeException(CoreMessages.createStaticMessage("boom"));

        MuleContext mockContext = mock(MuleContext.class);
        when(mockContext.getConfiguration()).thenThrow(muleRuntimeException);

        QueuePersistenceObjectStore<Serializable> store =
            new QueuePersistenceObjectStore<Serializable>(mockContext);

        try
View Full Code Here

        });
    }

    private ObjectStorePartition<Serializable> createStorePartition(String partitionName, boolean isPersistent) throws InitialisationException
    {
        MuleContext muleContext = mock(MuleContext.class);

        createRegistryAndBaseStore(muleContext, isPersistent);

        storeManager.setMuleContext(muleContext);
        storeManager.initialise();
View Full Code Here

TOP

Related Classes of org.mule.api.MuleContext

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.