Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksResourceConfiguration


 
  @Before
  public void createSmooksResourceConfiguration()
  {
    final String resource = ServiceDelegator.class.getName();
    resourceConfig = new SmooksResourceConfiguration( SELECTOR, resource );
  }
View Full Code Here


 
  @Before
  public void createSmooksResourceConfiguration()
  {
    final String resource = ServiceDelegator.class.getName();
    resourceConfig = new SmooksResourceConfiguration( "Order", resource );
  }
View Full Code Here

        this.targetProfile = targetProfile;
        return this;
    }

    public List<SmooksResourceConfiguration> toConfig() {
        SmooksResourceConfiguration smooksConfig = new SmooksResourceConfiguration();

        smooksConfig.setSelector(AbstractParser.ORG_XML_SAX_DRIVER);       

        if(readerClass != null) {
            smooksConfig.setResource(readerClass.getName());
        }

        if(targetProfile != null) {
            smooksConfig.setTargetProfile(targetProfile);
        }

        // Add the parameters...
        Set<Map.Entry<Object, Object>> entries = parameters.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            smooksConfig.setParameter((String)entry.getKey(), (String)entry.getValue());
        }

        // Add the "on" features...
        for(String featureOn : featuresOn) {
            smooksConfig.setParameter(AbstractParser.FEATURE_ON, featureOn);
        }

        // Add the "off" features...
        for(String featureOff : featuresOff) {
            smooksConfig.setParameter(AbstractParser.FEATURE_OFF, featureOff);
        }

        List<SmooksResourceConfiguration> configList = new ArrayList<SmooksResourceConfiguration>();
        configList.add(smooksConfig);
View Full Code Here

    @Before
    public void setup()
    {
        smooks = new Smooks();
        smooks.addConfiguration(new SmooksResourceConfiguration( "org.xml.sax.driver", MockReader.class.getName()));
    }
View Full Code Here

    MockExecutionContext executionContext = new MockExecutionContext();

        // Target a resource at the "document fragment" i.e. the root..

        // Don't write xxx but write its child elements
    SmooksResourceConfiguration configuration = new SmooksResourceConfiguration(SmooksResourceConfiguration.DOCUMENT_FRAGMENT_SELECTOR, "deviceX", "....");
    ((MockContentDeliveryConfig)executionContext.deliveryConfig).serializationUnits.addMapping(SmooksResourceConfiguration.DOCUMENT_FRAGMENT_SELECTOR, configuration, Configurator.configure(new AddAttributeSerializer(), configuration));

        // Don't write xxx but write its child elements
    configuration = new SmooksResourceConfiguration("xxx", "deviceX", "....");
    ((MockContentDeliveryConfig)executionContext.deliveryConfig).serializationUnits.addMapping("xxx", configuration, Configurator.configure(new RemoveTestSerializationUnit(), configuration));

    // write yyyy as a badly-formed empty element
    configuration = new SmooksResourceConfiguration("yyyy", "deviceX", "....");
    configuration.setParameter("wellformed", "false");
        ((MockContentDeliveryConfig)executionContext.deliveryConfig).serializationUnits.addMapping("yyyy", configuration, Configurator.configure(new EmptyElTestSerializationUnit(), configuration));

    /// write zzz as a well-formed empty element
    configuration = new SmooksResourceConfiguration("zzz", "deviceX", "....");
        ((MockContentDeliveryConfig)executionContext.deliveryConfig).serializationUnits.addMapping("zzz", configuration, Configurator.configure(new EmptyElTestSerializationUnit(), configuration));

    try {
      Document doc = XmlUtil.parseStream(getClass().getResourceAsStream("testmarkup.xxml"), XmlUtil.VALIDATION_TYPE.NONE, true);
      Serializer serializer = new Serializer(doc, executionContext);
View Full Code Here

        resourceConfig.setParameter("visitBefore", "false");
        assertFalse(VisitorConfigMap.visitBeforeAnnotationsOK(resourceConfig, new MySAXVisitBeforeVisitor1()));
    }

    public void test_sax_visitAfter() {
        SmooksResourceConfiguration resourceConfig;

        resourceConfig = new SmooksResourceConfiguration ();
        resourceConfig.setParameter("visitBefore", "true");
        assertFalse(VisitorConfigMap.visitAfterAnnotationsOK(resourceConfig, new MySAXVisitAfterVisitor1()));

        resourceConfig = new SmooksResourceConfiguration ();
        assertTrue(VisitorConfigMap.visitAfterAnnotationsOK(resourceConfig, new MySAXVisitAfterVisitor1()));

        resourceConfig = new SmooksResourceConfiguration ();
        resourceConfig.setParameter("visitBefore", "false");
        assertTrue(VisitorConfigMap.visitAfterAnnotationsOK(resourceConfig, new MySAXVisitAfterVisitor1()));
    }
View Full Code Here

                    "\t\t\t\t\tdepends-on: Target Profile: [[org.milyn.profile.Profile#default_profile]], Selector: [0], Selector Namespace URI: [null], Resource: [org.milyn.delivery.ordering.testvisitors.TestProducerConsumer], Num Params: [0]").trim(), e.getMessage().trim());
        }
    }

    private void addVisitor(Visitor visitor) {
        ContentHandlerConfigMap<Visitor> listEntry = new ContentHandlerConfigMap<Visitor>(visitor, new SmooksResourceConfiguration("" + sortList.size(), visitor.getClass().getName()));
        sortList.add(listEntry);
        originalList.add(listEntry);
    }
View Full Code Here

    assertTrue("Expected java.util.HashSet to contain value.", paramsHashSet.contains("d"));
    assertFalse("Expected java.util.HashSet to NOT contain value.", paramsHashSet.contains("e"));
  }
 
  public Collection getParameter(String type, String value) {
        SmooksResourceConfiguration decoderConfig;
        TokenizedStringParameterDecoder decoder;
   
        decoderConfig = new SmooksResourceConfiguration(Parameter.PARAM_TYPE_PREFIX + type, "org.milyn.cdr.TokenizedStringParameterDecoder");
        decoderConfig.setParameter(Parameter.PARAM_TYPE_PREFIX, type);
        decoder = Configurator.configure(new TokenizedStringParameterDecoder(), decoderConfig);
       
    return (Collection)decoder.decodeValue(value);
  }
View Full Code Here

   
    public void test() {
        Smooks smooks = new Smooks();
        StringSource source = new StringSource("<a><b><c>c1</c><d>c2</d><e>c3</e></b></a>");

        SmooksUtil.registerResource(new SmooksResourceConfiguration("b", DynamicVisitorLoader.class.getName()), smooks);
        smooks.filterSource(source);

        assertEquals("<b><c>c1</c><d>c2</d><e>c3</e></b>", DynamicVisitorLoader.visitor.stuff.toString());
    }
View Full Code Here

        deliveryConf = execContext.getDeliveryConfig();
        configList = deliveryConf.getSmooksResourceConfigurations("aa");
        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

TOP

Related Classes of org.milyn.cdr.SmooksResourceConfiguration

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.