Package org.mule.api.processor

Examples of org.mule.api.processor.MessageProcessor.process()


    @Test
    public void testInterceptingComposite() throws Exception
    {
        MessageProcessor composite = muleContext.getRegistry().lookupObject("composite1");
        assertEquals("0123", composite.process(getTestEvent("0")).getMessageAsString());
    }

    @Test
    public void testInterceptingNestedComposite() throws Exception
    {
View Full Code Here


    @Test
    public void testInterceptingNestedComposite() throws Exception
    {
        MessageProcessor composite = muleContext.getRegistry().lookupObject("composite2");
        assertEquals("01abc2", composite.process(getTestEvent("0")).getMessageAsString());
    }

    @Test
    public void testInterceptingCompositeOnEndpoint() throws Exception
    {
View Full Code Here

        assertEquals(2, endpoint.getMessageProcessors().size());

        MessageProcessor endpointProcessor = endpoint.getMessageProcessorsFactory()
            .createInboundMessageProcessorChain(endpoint, null, new NullMessageProcessor());

        assertEquals("01231abc2", endpointProcessor.process(getTestEvent("0")).getMessageAsString());
    }

}
View Full Code Here

        threadingProfile.setMaxThreadsActive(3);
        threadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        threadingProfile.setMuleContext(muleContext);

        MessageProcessor mockListener = mock(MessageProcessor.class);
        when(mockListener.process((MuleEvent)any())).thenAnswer(new Answer<MuleEvent>()
        {
            public MuleEvent answer(InvocationOnMock invocation) throws Throwable
            {
                Thread.sleep(threadTimeout * 2);
                return (MuleEvent)invocation.getArguments()[0];
View Full Code Here

        ThreadingProfile threadingProfile = new ChainedThreadingProfile(
            muleContext.getDefaultThreadingProfile());
        threadingProfile.setMuleContext(muleContext);

        MessageProcessor mockListener = mock(MessageProcessor.class);
        when(mockListener.process((MuleEvent)any())).thenAnswer(new Answer<MuleEvent>()
        {
            public MuleEvent answer(InvocationOnMock invocation) throws Throwable
            {
                latch.countDown();
                throw new RuntimeException();
View Full Code Here

            muleContext.getDefaultThreadingProfile());
        threadingProfile.setDoThreading(false);
        threadingProfile.setMuleContext(muleContext);

        MessageProcessor mockListener = mock(MessageProcessor.class);
        when(mockListener.process((MuleEvent)any())).thenThrow(new RuntimeException());

        SedaStageInterceptingMessageProcessor sedaStageInterceptingMessageProcessor = new SedaStageInterceptingMessageProcessor(
            "testProcessOneWayNoThreadingWithException", "testProcessOneWayNoThreadingWithException",
            queueProfile, queueTimeout, threadingProfile, queueStatistics, muleContext);
        sedaStageInterceptingMessageProcessor.setListener(mockListener);
View Full Code Here

  public void setUp() {
    try {
      testObjects = (HashMap<String, Object>) context.getBean("listProductLink");

      MessageProcessor createProductFlow = lookupFlowConstruct("create-product");
      MuleEvent res = createProductFlow.process(getTestEvent(testObjects));
      Integer productId = (Integer) res.getMessage().getPayload();
      testObjects.put("productId", productId);
     
      // change the sku for the second product
      testObjects.put("sku", ((String) testObjects.get("sku")) + "abc");
View Full Code Here

      Integer productId = (Integer) res.getMessage().getPayload();
      testObjects.put("productId", productId);
     
      // change the sku for the second product
      testObjects.put("sku", ((String) testObjects.get("sku")) + "abc");
      res = createProductFlow.process(getTestEvent(testObjects));
      Integer linkedProductId = (Integer) res.getMessage().getPayload();
      testObjects.put("linkedProductIdOrSku", linkedProductId);
     
      String linkType = "related";
      testObjects.put("type", linkType);
View Full Code Here

      testObjects.put("linkedProductIdOrSku", linkedProductId);
     
      String linkType = "related";
      testObjects.put("type", linkType);
      MessageProcessor addProductLinkFlow = lookupFlowConstruct("add-product-link");
      addProductLinkFlow.process(getTestEvent(testObjects));
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
View Full Code Here

  @Category({ SmokeTests.class, RegressionTests.class })
  @Test
  public void testListProductLink() {
    try {
      MessageProcessor listProductLinkFlow = lookupFlowConstruct("list-product-link");
      MuleEvent res = listProductLinkFlow.process(getTestEvent(testObjects));
      List<CatalogProductLinkEntity> catalogProductLinkEntities = (List<CatalogProductLinkEntity>) res.getMessage().getPayload();
     
      assertEquals("There should be one linked product", 1, catalogProductLinkEntities.size());
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.