Package org.jboss.soa.esb.helpers

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


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

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


        Map<String, List<String>> entryPointFacts = new HashMap<String, List<String>>();
        entryPointFacts.put("OrderEntryPoint", orderEntryPoints);
        CBRConfigTreeBuilder builder = new CBRConfigTreeBuilder(true).ruleFile("PricingRulesStatefulEntryPoint.drl");
        builder.messagePaths(defaultFacts).entryPoints(entryPointFacts);
        ConfigTree config = builder.stateful(true).build();
        BusinessRulesProcessor processor = new BusinessRulesProcessor(config);

        processor.process( message );

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

    return this;
  }
   
  public ConfigTree build()
  {
        ConfigTree configTree = new ConfigTree("cbr-config");
       
        configTree.setAttribute( ListenerTagNames.RULE_RELOAD_TAG, Boolean.toString( reload ) );
       
        if ( ruleFile != null )
            configTree.setAttribute( ListenerTagNames.RULE_SET_TAG, ruleFile );
        else if ( decisionTable != null )
            configTree.setAttribute( DECISION_TABLE.getName(), decisionTable );
        else if ( ruleAgent != null )
            configTree.setAttribute( RULE_AGENT_PROPERTIES.getName(), ruleAgent );
        else
          throw new IllegalStateException("One of ruleFile, decisionTable or ruleAgent must be set");
       
        if (ruleLanguage != null)
          configTree.setAttribute( ListenerTagNames.RULE_LANGUAGE_TAG, ruleLanguage);
       
           
        if ( messagePathList != null )
        {
          for (String messagePath : messagePathList)
      {
            ConfigTree objectPath = new ConfigTree( ContentBasedWiretap.OBJECT_PATH_TAG, configTree );
            objectPath.setAttribute( ContentBasedWiretap.OBJECT_PATH, messagePath );
      }
        }
       
        if ( entryPointFacts != null )
        {
            Set<Entry<String, List<String>>> entrySet = entryPointFacts.entrySet();
            for (Entry<String, List<String>> entry : entrySet)
            {
                final String entryPointName = entry.getKey();
                List<String> value = entry.getValue();
                for (String path : value)
                {
                ConfigTree objectPath = new ConfigTree( ContentBasedWiretap.OBJECT_PATH_TAG, configTree );
                objectPath.setAttribute( ContentBasedWiretap.OBJECT_PATH, path );
                objectPath.setAttribute( ContentBasedWiretap.ENTRY_POINT, entryPointName );
                }
            }
        }
       
        if ( stateful )
View Full Code Here

    MimeDecoder mimeDecoder = MimeDecoder.Factory.getInstanceByClassName(TextPlainMimeDecoder.class.getName());
    assertTrue(mimeDecoder instanceof TextPlainMimeDecoder);
  }

  public void test_by_configtree_mimetype() throws ConfigurationException {
    ConfigTree config = new ConfigTree("config");
   
    config.setAttribute(MimeDecoder.Factory.MIME_TYPE, "text/plain");
   
    MimeDecoder mimeDecoder = MimeDecoder.Factory.getInstanceByConfigTree(config);
    assertTrue(mimeDecoder instanceof TextPlainMimeDecoder);
  }
View Full Code Here

    MimeDecoder mimeDecoder = MimeDecoder.Factory.getInstanceByConfigTree(config);
    assertTrue(mimeDecoder instanceof TextPlainMimeDecoder);
  }

  public void test_by_configtree_mimetype_unknown() throws ConfigurationException {
    ConfigTree config = new ConfigTree("config");
   
    config.setAttribute(MimeDecoder.Factory.MIME_TYPE, "some/blah");
   
    try {
      MimeDecoder.Factory.getInstanceByConfigTree(config);
      fail("Expected ConfigurationException");
    } catch(ConfigurationException e) {
View Full Code Here

      assertEquals("Failed to find a MimeDecoder implementation for mime type 'some/blah'.  MimeDecoders must be listed in a 'META-INF/org/jboss/soa/esb/listeners/message/mime/decoders.lst' file on the classpath.", e.getMessage());
    }
  }

  public void test_by_configtree_classname() throws ConfigurationException {
    ConfigTree config = new ConfigTree("config");
   
    config.setAttribute(MimeDecoder.Factory.MIME_DECODER, TextPlainMimeDecoder.class.getName());
   
    MimeDecoder mimeDecoder = MimeDecoder.Factory.getInstanceByConfigTree(config);
    assertTrue(mimeDecoder instanceof TextPlainMimeDecoder);
  }
View Full Code Here

    MimeDecoder mimeDecoder = MimeDecoder.Factory.getInstanceByConfigTree(config);
    assertTrue(mimeDecoder instanceof TextPlainMimeDecoder);
  }

  public void test_by_configtree_classname_unknown() throws ConfigurationException {
    ConfigTree config = new ConfigTree("config");
   
    config.setAttribute(MimeDecoder.Factory.MIME_DECODER, "com.XXX");
   
    try {
      MimeDecoder.Factory.getInstanceByConfigTree(config);
      fail("Expected ConfigurationException");
    } catch(ConfigurationException e) {
View Full Code Here

*/
public class TextPlainMimeDecoderUnitTest extends TestCase {
 
  public void test_String() throws ConfigurationException, MimeDecodeException {
    TextPlainMimeDecoder decoder = new TextPlainMimeDecoder();
    ConfigTree config = new ConfigTree("conf");
   
    decoder.setConfiguration(config);
   
    String decodedRes = (String) decoder.decode("Hello W".getBytes());
    assertEquals("Hello W", decodedRes);
View Full Code Here

    public void test_listener_config() throws IOException, SAXException, ConfigurationException {
        ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config-01.xml"));
        String config = configUtil.getListenerConfig("simple-schedule-listener").toString();
        assertNotNull(config);
        try {
            ConfigTree tree = ConfigTree.fromXml(config);
            String maxDeliveries = tree.getFirstChild("action").getAttribute(MessageRedeliverer.MAX_REDELIVER_ATTR);
            assertEquals(maxDeliveries, "9");
        } catch (SAXException e) {
            fail(e.getMessage());
        }
    }
View Full Code Here

    }

    @Before
    public void setup() throws ConfigurationException
    {
        configTree = new ConfigTree("junit");
        bpmProcessor = new BpmProcessor(configTree);
        message = MessageFactory.getInstance().getMessage();
    }
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.