Package org.jboss.soa.esb.helpers

Examples of org.jboss.soa.esb.helpers.ConfigTree


        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner2", "Partner2-Order-XML");
        assertEquals("<x><c>value</c></x>", transRes);
    }

    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();
View Full Code Here


        assertNotNull(message.getBody().get("ObjectMap"));
        assertTrue(message.getBody().get("ObjectMap") instanceof Map);
    }

    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);
View Full Code Here

    }



    private ConfigTree createConfig01(String from, String fromType, String to, String toType) {
        ConfigTree properties = new ConfigTree("name");

        properties.setAttribute(SmooksTransformer.RESOURCE_CONFIG, "classpath:/smooks-conf-01.xml");
        // Set the message properties in order to trigger the appropriate transformations
        // on the message...
        properties.setAttribute(SmooksTransformer.FROM, from);
        properties.setAttribute(SmooksTransformer.FROM_TYPE, fromType);
        properties.setAttribute(SmooksTransformer.TO, to);
        properties.setAttribute(SmooksTransformer.TO_TYPE, toType);
       
        return properties;
    }
View Full Code Here

  {
    Map map = new Hashtable();
    map.put( "test1", "testing" );
    map.put( "test2", new NonSerializableClass() );

        ConfigTree configTree = createConfigTree();
        configTree.setAttribute("mappedContextObjects", "test1,test2");
        SmooksAction action = new SmooksAction( configTree );
   
    Map serializableObjects = action.getSerializableObjectsMap( map );
   
    assertTrue( serializableObjects.containsKey( "test1" ));
View Full Code Here

    return new JUnit4TestAdapter( SmooksActionUnitTest.class );
  }
 
  private ConfigTree createConfigTree()
  {
    ConfigTree config = new ConfigTree( "SmooksActionTest" );
    config.setAttribute( "smooksConfig", "/org/jboss/soa/esb/smooks/smooks-config.xml");
    return config;
  }
View Full Code Here

        initaliseServices();
    }

    private void initaliseServices() throws ConfigurationException, RegistryException, ActionLifecycleException, IOException, SAXException {
        ESBConfigUtil esbConfig = new ESBConfigUtil(getClass().getResourceAsStream("action-configs-02.xml"));
        ConfigTree splitter1Config = esbConfig.getActionConfig("null-listener", "splitter1-action");
        ConfigTree splitter2Config = esbConfig.getActionConfig("null-listener", "splitter2-action");
        ConfigTree service1Config = esbConfig.getActionConfig("null-listener", "service1-config");
        ConfigTree service2Config = esbConfig.getActionConfig("null-listener", "service2-config");
        ConfigTree service3Config = esbConfig.getActionConfig("null-listener", "service3-config");
        ConfigTree aggregator1Config = esbConfig.getActionConfig("null-listener", "aggregator1-config");
        ConfigTree aggregator2Config = esbConfig.getActionConfig("null-listener", "aggregator2-config");
        ConfigTree aggregator3Config = esbConfig.getActionConfig("null-listener", "aggregator3-config");

        splitter1 = new StaticRouter(splitter1Config);
        splitter1.initialise();
        splitter2 = new StaticRouter(splitter2Config);
        splitter2.initialise();
View Full Code Here

  @Test
  public void processDiscount() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
  {
    Message message = createMessageWithOrder( order );
        ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRulesStateful.drl" ).messagePaths(messagePathList).build();
    BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );

    processor.process( message );

        assertEquals( 20.0, order.getDiscount(), 0);
View Full Code Here

  @Test
  public void processDiscountStateful() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
  {
    Message message = createMessageWithOrder( order );
        ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRulesStateful.drl" ).stateful( true ).messagePaths(messagePathList).build();
    BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );

    // process message
    processor.process( message );
        assertEquals( 20.0, order.getDiscount(), 0);
View Full Code Here

    @Test
    public void processStatefulDispose() throws Exception
    {
        Message message = createMessageWithOrder( order );
        ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBStatefulDispose.drl" ).stateful( true ).messagePaths(messagePathList).build();
        BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );

        // process message
        processor.process( message );
        assertEquals( 20.0, order.getDiscount(), 0);
View Full Code Here

    @Test
    public void processStatefulContinuation() throws Exception
    {
        Message message = createMessageWithOrder( order );
        ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBStatefulDispose.drl" ).stateful( true ).messagePaths(messagePathList).build();
        BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );

        // process message
        processor.process( message );
        assertEquals( 20.0, order.getDiscount(), 0);
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.helpers.ConfigTree

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.