Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksResourceConfiguration$ContextIndex


        deliveryConf = execContext.getDeliveryConfig();
        configList = deliveryConf.getSmooksResourceConfigurations("j");
        assertNotNull(configList);

        // Make sure the resource has the other default settings...
        SmooksResourceConfiguration config = configList.get(0);
        assertEquals("http://an", config.getSelectorNamespaceURI());
        assertNotNull(config.getConditionEvaluator());
    }
View Full Code Here


        new Smooks(getClass().getResourceAsStream("config_01.xml"));
    }

    public void test_02() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("config_02.xml"));
        SmooksResourceConfiguration readerConfig = AbstractParser.getSAXParserConfiguration(smooks.createExecutionContext("A").getDeliveryConfig());

        assertEquals("com.ZZZZReader", readerConfig.getResource());

        assertEquals("A", readerConfig.getTargetProfile());

        List handlers = readerConfig.getParameters("sax-handler");
        assertEquals("[com.X, com.Y]", handlers.toString());

        List featuresOn = readerConfig.getParameters("feature-on");
        assertEquals("[http://a, http://b]", featuresOn.toString());

        List featuresOff = readerConfig.getParameters("feature-off");
        assertEquals("[http://c, http://d]", featuresOff.toString());

        assertEquals("val1", readerConfig.getStringParameter("param1"));
        assertEquals("val2", readerConfig.getStringParameter("param2"));
    }
View Full Code Here

      test_config_file("configured_different_node_names");
    }

  private void test_progammed_config(String testNumber) throws Exception{
    Smooks smooks = new Smooks();
    SmooksResourceConfiguration config;

        config = new SmooksResourceConfiguration("org.xml.sax.driver", "type:Order-List AND from:Acme", JSONReader.class.getName());
    SmooksUtil.registerResource(config, smooks);
    SmooksUtil.registerProfileSet(DefaultProfileSet.create("Order-List-Acme-AcmePartner1", new String[] {"type:Order-List", "from:Acme", "to:AcmePartner1"}), smooks);

    ExecutionContext context = smooks.createExecutionContext("Order-List-Acme-AcmePartner1");
    String result = SmooksUtil.filterAndSerialize(context,  getClass().getResourceAsStream("/test/"+ testNumber +"/input-message.jsn"), smooks);
View Full Code Here

        // Add profile sets...
        SmooksUtil.registerProfileSet(DefaultProfileSet.create("message-target1", new String[]{"profile1", "profile2"}), smooks);
        SmooksUtil.registerProfileSet(DefaultProfileSet.create("message-target2", new String[]{"profile2", "profile3"}), smooks);

        // Create CDU configs and target them at the profiles...
        SmooksResourceConfiguration resourceConfig = new SmooksResourceConfiguration("ccc", "profile1 AND not:profile3", RenameElementTrans.class.getName());
        resourceConfig.setParameter("new-name", "xxx");
        SmooksUtil.registerResource(resourceConfig, smooks);
        resourceConfig = new SmooksResourceConfiguration("aaa", "profile2", RenameElementTrans.class.getName());
        resourceConfig.setParameter("new-name", "zzz");
        SmooksUtil.registerResource(resourceConfig, smooks);

        // Transform the same message for each useragent...
        String message = "<aaa><bbb>888</bbb><ccc>999</ccc></aaa>";
        ExecutionContext context = smooks.createExecutionContext("message-target1");
View Full Code Here

        // Add 2 useragents and configure them with profiles...
        SmooksUtil.registerProfileSet(DefaultProfileSet.create("message-target1", new String[]{"profile1", "profile2"}), smooks);
        SmooksUtil.registerProfileSet(DefaultProfileSet.create("message-target2", new String[]{"profile2", "profile3"}), smooks);

        // Create CDU configs and target them at the profiles...
        SmooksResourceConfiguration resourceConfig = new SmooksResourceConfiguration("ccc", "profile1 AND not:profile3", RenameElementTrans.class.getName());
        resourceConfig.setParameter("new-name", "xxx");
        SmooksUtil.registerResource(resourceConfig, smooks);
        resourceConfig = new SmooksResourceConfiguration("aaa", "profile2", RenameElementTrans.class.getName());
        resourceConfig.setParameter("new-name", "zzz");
        SmooksUtil.registerResource(resourceConfig, smooks);

        // Transform the same message for each useragent...
        String message = "<aaa><bbb>888</bbb><ccc>999</ccc></aaa>";
View Full Code Here

    public List<SmooksResourceConfiguration> expandConfigurations() {

        List<SmooksResourceConfiguration> expansionConfigs = new ArrayList<SmooksResourceConfiguration>();

        expansionConfigs.add(new SmooksResourceConfiguration("a", Assembly1.class.getName()));
        expansionConfigs.add(new SmooksResourceConfiguration("b", Processing1.class.getName()));       
        expansionConfigs.add(new SmooksResourceConfiguration("c", DefaultSerializationUnit.class.getName()));

        return expansionConfigs;
    }
View Full Code Here

* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class VisitIfAndIfNotTest extends TestCase {

    public void test_sax_visitBefore() {
        SmooksResourceConfiguration resourceConfig;

        resourceConfig = new SmooksResourceConfiguration ();
        resourceConfig.setParameter("visitBefore", "true");
        assertTrue(VisitorConfigMap.visitBeforeAnnotationsOK(resourceConfig, new MySAXVisitBeforeVisitor1()));

        resourceConfig = new SmooksResourceConfiguration ();
        assertFalse(VisitorConfigMap.visitBeforeAnnotationsOK(resourceConfig, new MySAXVisitBeforeVisitor1()));

        resourceConfig = new SmooksResourceConfiguration ();
        resourceConfig.setParameter("visitBefore", "false");
        assertFalse(VisitorConfigMap.visitBeforeAnnotationsOK(resourceConfig, new MySAXVisitBeforeVisitor1()));
    }
View Full Code Here

  }

  @BeforeMethod ( groups = "unit" )
  public void init() {

    config = new SmooksResourceConfiguration(selector, Counter.class.getName());
    executionContext = new MockExecutionContext();
    beanContext = executionContext.getBeanContext();
  }
View Full Code Here

        final String beanId = "beanId";
        final TestBean bean = RouterTestHelper.createBean();

        final MockExecutionContext executionContext = RouterTestHelper.createExecutionContext( beanId, bean );

      SmooksResourceConfiguration config = new SmooksResourceConfiguration(selector, JMSRouter.class.getName());
        config.setParameter( "destinationName", queueName );
        config.setParameter( "beanId", beanId );
        config.setParameter( "highWaterMark", "3" );
        config.setParameter( "highWaterMarkTimeout", "3000" );
        config.setParameter( "highWaterMarkPollFrequency", "200" );
        final JMSRouter router = new JMSRouter();
        Configurator.configure( router, config, new MockApplicationContext() );

        router.visitAfter( (SAXElement)null, executionContext );
        router.visitAfter( (SAXElement)null, executionContext );
View Full Code Here

    @Test ( groups = "unit" )
  public void setJndiContextFactory()
  {
    final String contextFactory = MockContextFactory.class.getName();
      SmooksResourceConfiguration config = new SmooksResourceConfiguration(selector, JMSRouter.class.getName());
    setManadatoryProperties( config );
        config.setParameter( "jndiContextFactory", contextFactory );
        final JMSRouter router = new JMSRouter();
        Configurator.configure( router, config, new MockApplicationContext() );

        assertEquals( "ContextFactory did not match the one set on the Router",
            contextFactory, router.getJndiContextFactory() );
View Full Code Here

TOP

Related Classes of org.milyn.cdr.SmooksResourceConfiguration$ContextIndex

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.