Package org.switchyard.transform.config.model.v1

Examples of org.switchyard.transform.config.model.v1.V1JSONTransformModel


        final TransformsModel transforms = new V1TransformsModel(TransformNamespace.DEFAULT.uri());
        for (Entry<QName, Set<QName>> entry : getTransformTypes().entrySet()) {
            final QName from = entry.getKey();
            final Set<QName> toTypes = entry.getValue();
            for (QName to : toTypes) {
                final V1JavaTransformModel transform = new V1JavaTransformModel(TransformNamespace.DEFAULT.uri());
                transform.setFrom(from);
                transform.setTo(to);
                transform.setClazz(CamelTransformer.class.getName());
                if (!isTransformRegistred(transform, transformerRegistry)) {
                    transforms.addTransform(transform);
                }
            }
        }
View Full Code Here


        List<Class<?>> transformerClasses = scanForTransformers(input.getURLs());
        for (Class<?> transformer : transformerClasses) {
            List<TransformerTypes> supportedTransforms = TransformerUtil.listTransformations(transformer);

            for (TransformerTypes supportedTransform : supportedTransforms) {
                JavaTransformModel transformModel = new V1JavaTransformModel(transformNamespace.uri());

                String bean = CDIUtil.getNamedAnnotationValue(transformer);
                if (bean != null) {
                    transformModel.setBean(bean);
                } else {
                    transformModel.setClazz(transformer.getName());
                }
                transformModel.setFrom(supportedTransform.getFrom());
                transformModel.setTo(supportedTransform.getTo());

                if (transformsModel == null) {
                    transformsModel = new V1TransformsModel(switchyardNamespace.uri());
                    switchyardModel.setTransforms(transformsModel);
                }
View Full Code Here

    @Test
    public void testCreate() throws Exception {
        SwitchYardModel switchyard = new V1SwitchYardModel(SwitchYardNamespace.V_1_0.uri());
        TransformsModel transforms = new V1TransformsModel(SwitchYardNamespace.V_1_0.uri());
        JavaTransformModel javaTransform = new V1JavaTransformModel(TransformNamespace.V_1_0.uri());
        javaTransform.setFrom(new QName("msgA"));
        javaTransform.setTo(new QName("msgB"));
        javaTransform.setClazz("org.examples.transform.AtoBTransform");
        transforms.addTransform(javaTransform);
        SmooksTransformModel smooksTransform = new V1SmooksTransformModel(TransformNamespace.V_1_0.uri());
        smooksTransform.setFrom(new QName("msgC"));
        smooksTransform.setTo(new QName("msgD"));
        smooksTransform.setTransformType("XML2JAVA");
View Full Code Here

     * @param smooksConfigResPath The Smooks configuration classpath resource path.
     * @param transformerType The Smooks transformer type.
     * @return The Transformer instance.
     */
    public Transformer newTransformer(String smooksConfigResPath, SmooksTransformType transformerType) {
        TransformModel transformModel = new V1SmooksTransformModel(TransformNamespace.DEFAULT.uri())
                                            .setConfig(smooksConfigResPath)
                                            .setTransformType(transformerType)
                                            .setFrom(new QName("from")).setTo(new QName("to"));

        return getTestKit().newTransformer(transformModel);
View Full Code Here

        XMLAssert.assertXMLEqual("<person name='George' age='80' />", xml);
    }

    @Test
    public void test_invalid_xml2java_config() throws IOException, SAXException {
        V1SmooksTransformModel model = (V1SmooksTransformModel)new V1SmooksTransformModel(TransformNamespace.DEFAULT.uri()).setTransformType("XML2JAVA").setFrom(new QName("a")).setTo(new QName("b"));
        model.setConfig("/org/switchyard/transform/internal/smooks/smooks-config-01.xml");
        try {
            new SmooksTransformFactory().newTransformer(null, model);
        } catch (RuntimeException e) {
          boolean exceptionMatch = e.getMessage().contains("SWITCHYARD016812");
            Assert.assertTrue(exceptionMatch);
View Full Code Here

        }
    }

    @Test
    public void test_invalid_java2xml_config() throws IOException, SAXException {
        V1SmooksTransformModel model = (V1SmooksTransformModel)new V1SmooksTransformModel(TransformNamespace.DEFAULT.uri()).setTransformType("JAVA2XML").setFrom(new QName("a")).setTo(new QName("b"));
        model.setConfig("/org/switchyard/transform/internal/smooks/smooks-config-01.xml");
        try {
            new SmooksTransformFactory().newTransformer(null, model);
        } catch (RuntimeException e) {
          boolean exceptionMatch = e.getMessage().contains("SWITCHYARD016812");
          Assert.assertTrue(exceptionMatch);
View Full Code Here

        JavaTransformModel javaTransform = new V1JavaTransformModel(TransformNamespace.V_1_0.uri());
        javaTransform.setFrom(new QName("msgA"));
        javaTransform.setTo(new QName("msgB"));
        javaTransform.setClazz("org.examples.transform.AtoBTransform");
        transforms.addTransform(javaTransform);
        SmooksTransformModel smooksTransform = new V1SmooksTransformModel(TransformNamespace.V_1_0.uri());
        smooksTransform.setFrom(new QName("msgC"));
        smooksTransform.setTo(new QName("msgD"));
        smooksTransform.setTransformType("XML2JAVA");
        smooksTransform.setConfig("/trasnforms/xxx.xml");
        smooksTransform.setReportPath("/tmp/smooksreport.html");
        transforms.addTransform(smooksTransform);
        switchyard.setTransforms(transforms);
        String new_xml = switchyard.toString();
        String old_xml = new ModelPuller<SwitchYardModel>().pull(XML, getClass()).toString();
        XMLUnit.setIgnoreWhitespace(true);
View Full Code Here

        }
    }

    @Test
    public void test_factoryLoad() {
        V1XsltTransformModel model = new V1XsltTransformModel(TransformNamespace.DEFAULT.uri());

        model.setXsltFile("org/switchyard/transform/xslt/internal/topics.xslt");
        model.setFrom(new QName("A"));
        model.setTo(new QName("B"));

        TransformerRegistryLoader trl = new TransformerRegistryLoader(new BaseTransformerRegistry());
        Transformer<?,?> transformer = trl.newTransformer(model);

        Assert.assertTrue(transformer instanceof XsltTransformer);
View Full Code Here

TOP

Related Classes of org.switchyard.transform.config.model.v1.V1JSONTransformModel

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.