Package org.jboss.soa.esb.message

Examples of org.jboss.soa.esb.message.Message


            final InVMTemporaryTransport transport = new InVMTemporaryTransport() ;
            transport.startReaper() ;
            try
            {
                final InVMEpr epr = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr1")) ;
                final Message message = MessageFactory.getInstance().getMessage() ;
               
                Assert.assertEquals("Ordered entry size", 0, transport.getOrderedEntriesSize()) ;
                Assert.assertEquals("Service id size", 0, transport.getServiceIdToEntrySize()) ;
               
                transport.deliver(epr, message) ;
View Full Code Here


            final InVMTemporaryTransport transport = new InVMTemporaryTransport() ;
            transport.startReaper() ;
            try
            {
                final InVMEpr epr = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr1")) ;
                final Message message = MessageFactory.getInstance().getMessage() ;
               
                Assert.assertEquals("Ordered entry size", 0, transport.getOrderedEntriesSize()) ;
                Assert.assertEquals("Service id size", 0, transport.getServiceIdToEntrySize()) ;
               
                transport.deliver(epr, message) ;
View Full Code Here

                final InVMEpr epr1 = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr1")) ;
                final InVMEpr epr2 = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr2")) ;
                final InVMEpr epr3 = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr3")) ;
                final InVMEpr epr4 = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr4")) ;
                final InVMEpr epr5 = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://epr5")) ;
                final Message message = MessageFactory.getInstance().getMessage() ;
               
                Assert.assertEquals("Ordered entry size", 0, transport.getOrderedEntriesSize()) ;
                Assert.assertEquals("Service id size", 0, transport.getServiceIdToEntrySize()) ;
               
                transport.deliver(epr1, message) ;
View Full Code Here

    @Test
    public void correctDestinationName()
    {
        try {
            ContentBasedRouter cbr = new ContentBasedRouter(actions[1]);
            Message returnMessage = cbr.process(message);
            //the cbr should return a null message
            assertNull(returnMessage);
        } catch (Exception e) {
            assertTrue(false);
        }
View Full Code Here

    }

    public void test_javabeans() throws ConfigurationException, ActionLifecycleException, ActionProcessingException {
        ConfigTree properties = new ConfigTree("smooks-config");
        SmooksTransformer transformer;
        Message message;

        properties.setAttribute(SmooksTransformer.RESOURCE_CONFIG, "/org/jboss/soa/esb/actions/converters/smooks-conf.xml");
        properties.setAttribute(SmooksTransformer.JAVA_OUTPUT, "ObjectMap");
        transformer = new SmooksTransformer(properties);
        transformer.initialise();

        // Perform the transformation by setting the payload on the task object...
        message = MessageFactory.getInstance().getMessage();
        message.getBody().add("<x xprop='xval' />");

        assertNull(message.getBody().get("orderHeader"));
        message = transformer.process(message);
        assertNotNull(message.getBody().get("orderHeader"));
        assertTrue(message.getBody().get("orderHeader") instanceof XClass);
        assertNotNull(message.getBody().get("ObjectMap"));
        assertTrue(message.getBody().get("ObjectMap") instanceof Map);
    }
View Full Code Here

 
  @Test
  public void process() throws ConfigurationException, ActionProcessingException
  {
    SmooksAction action = new SmooksAction( config );
    Message message = MessageFactory.getInstance().getMessage();
    message.getBody().add( expectedString );
   
    Message process = action.process( message );
   
    String actualString = (String)process.getBody().get();
    assertEquals( expectedString, actualString );
  }
View Full Code Here

  @Test
  public void processWithPayloadLocation() throws ConfigurationException, ActionProcessingException
  {
    config.setAttribute( MessagePayloadProxy.GET_PAYLOAD_LOCATION, "input" );
    SmooksAction action = new SmooksAction( config );
    Message message = MessageFactory.getInstance().getMessage();
    message.getBody().add( "input", expectedString );
   
    Message process = action.process( message );
   
    String actualString = (String)process.getBody().get();
    assertEquals( expectedString, actualString );
  }
View Full Code Here

    }

    private String transform(String stringMessage, String fromType, String from, String to, String toType) throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
        ConfigTree properties = createConfig01(from, fromType, to, toType);
        SmooksTransformer transformer = new SmooksTransformer(properties);
        Message message;

        transformer.initialise();

        // Perform the transformation by setting the payload on the task object...
        message = MessageFactory.getInstance().getMessage();
        message.getBody().add(stringMessage);
        message = transformer.process(message);
        String resultThroughTaskObj = (String) message.getBody().get();
        assertEquals(resultThroughTaskObj, message.getBody().get());

        // Perform the transformation by setting the payload on the body as bytes...
        message = createNewMessage(fromType, from, to, toType);
        message.getBody().add(stringMessage.getBytes());
        message = transformer.process(message);
        assertEquals(resultThroughTaskObj, message.getBody().get());

        // Perform the transformation by setting/getting the payload on the default body location...
        message = MessageFactory.getInstance().getMessage();
        message.getBody().add(stringMessage);
        message = transformer.process(message);
        assertEquals(resultThroughTaskObj, message.getBody().get());

        // Perform the transformation by setting the payload input and output body locations...
        properties.setAttribute(MessagePayloadProxy.GET_PAYLOAD_LOCATION, "input-loc1");
        properties.setAttribute(MessagePayloadProxy.SET_PAYLOAD_LOCATION, "output-loc1");
        transformer = new SmooksTransformer(properties);
        transformer.initialise();
        message = MessageFactory.getInstance().getMessage();
        message.getBody().add("input-loc1", stringMessage);
        message = transformer.process(message);
        assertEquals(resultThroughTaskObj, message.getBody().get("output-loc1"));

        return resultThroughTaskObj;
    }
View Full Code Here

     *             |               |--service2--|               |
     *             |-- splitter2 --|            |--aggregator1--|
     *                             |--service3--|
     */
    public void test_nested_split() throws RegistryException, ConfigurationException, ActionProcessingException, MessageDeliverException, IOException, SAXException, ParserConfigurationException {
        Message messageIn = MessageFactory.getInstance().getMessage();

        // Manually deliver the message to the splitter1 service...
        splitter1.process(messageIn);
        AggregationDetails service1Message = Aggregator.getAggregatorDetails(service1Courier.messages.get(0), 0, false);
        assertNotNull(service1Message);

        // Manually deliver the message in service1Courier into service1...
        service1.process(service1Courier.messages.get(0));

        // Manually deliver the message in splitter2Courier into splitter2...
        splitter2.process(splitter2Courier.messages.get(0));
        AggregationDetails service2Message = Aggregator.getAggregatorDetails(service2Courier.messages.get(0), 0, false);
        assertNotNull(service2Message);

        // Manually deliver the message in aggregator2Courier into aggregator2 (this is the message from service1)...
        aggregator2.process(aggregator2Courier.messages.get(0));

        // Manually deliver the message in service2Courier into service2...
        service2.process(service2Courier.messages.get(0));

        // Manually deliver the message in service3Courier into service3...
        service3.process(service3Courier.messages.get(0));

        // aggregator1Courier should have 2 messages in it... one from service2
        // and one from service3...
        assertEquals(2, aggregator1Courier.messages.size());

        // Should be 2 aggrTags before aggregation...
        List<String> aggrTags = Aggregator.getAggregatorTags(aggregator1Courier.messages.get(1), false);
        assertEquals(2, aggrTags.size());

        // Manually deliver the 2 messages to aggregator1...
        aggregator1.process(aggregator1Courier.messages.get(0));
        Message aggregator1Message = aggregator1.process(aggregator1Courier.messages.get(1));
        assertNoAggregationTags(aggregator1Courier.messages.get(0));
        assertNoAggregationTags(aggregator1Courier.messages.get(1));
        aggrTags = Aggregator.getAggregatorTags(aggregator1Message, false);
        assertEquals(1, aggrTags.size());
        AggregationDetails aggregator1MessageAggrDetails = Aggregator.getAggregatorDetails(aggregator1Message, 0, false);
        assertEquals(service1Message.getSeriesUuid(), aggregator1MessageAggrDetails.getSeriesUuid());

        // Manually deliver the aggregator1Message to aggregator2...
        Message aggregator2Message = aggregator2.process(aggregator1Message);
        assertNoAggregationTags(aggregator1Message);
        assertEquals(2, aggregator2Message.getAttachment().getUnnamedCount());
        Message message1 = Util.deserialize((Serializable) aggregator2Message.getAttachment().itemAt(0));
        assertNoAggregationTags(message1);
        Message message2 = Util.deserialize((Serializable) aggregator2Message.getAttachment().itemAt(1));
        assertNoAggregationTags(message2);
    }
View Full Code Here

  @Test
  public void processWithOutLocation() throws ConfigurationException, ActionProcessingException
  {
    config.setAttribute( MessagePayloadProxy.SET_PAYLOAD_LOCATION, "output" );
    SmooksAction action = new SmooksAction( config );
    Message message = MessageFactory.getInstance().getMessage();
    message.getBody().add( expectedString );
   
    Message process = action.process( message );
   
    String actualString = (String)process.getBody().get( "output" );
    assertEquals( expectedString, actualString );
  }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.message.Message

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.