Examples of SwitchYardModel


Examples of org.switchyard.config.model.switchyard.SwitchYardModel

        _puller = new ModelPuller<SwitchYardModel>();
    }

    @Test
    public void testRead() throws Exception {
        SwitchYardModel switchyard = _puller.pull(XML, getClass());
        PropertiesModel propsModel = switchyard.getDomain().getProperties();
        Assert.assertEquals(2, propsModel.getProperties().size()); // only includes (child) property models, not loaded properties
        Properties propsProps = propsModel.toProperties();
        Assert.assertEquals(3, propsProps.size()); // combined properties contains all properties
        Map<String, String> propsMap = propsModel.toMap();
        Assert.assertEquals(3, propsMap.size()); // combined map contains all properties
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

    }

    @Test
    public void testWrite() throws Exception {
        String old_xml = new StringPuller().pull(XML, getClass());
        SwitchYardModel switchyard = _puller.pull(new StringReader(old_xml));
        String new_xml = switchyard.toString();
        XMLUnit.setIgnoreWhitespace(true);
        Diff diff = XMLUnit.compareXML(old_xml, new_xml);
        Assert.assertTrue(diff.toString(), diff.identical());
    }
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

        Assert.assertTrue(diff.toString(), diff.identical());
    }

    @Test
    public void testValidate() throws Exception {
        SwitchYardModel switchyard = _puller.pull(XML, getClass());
        switchyard.assertModelValid();
    }
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

    int getTransformPoolSize(XsltTransformModel model) {
        int poolSize = DEFAULT_MAX_POOL_SIZE;
        // attempt to navigate to parent
        Model root = model.getModelRoot();
        if (root instanceof SwitchYardModel) {
            SwitchYardModel syModel = (SwitchYardModel)root;
            if (syModel.getDomain() != null && syModel.getDomain().getProperties() != null) {
                String poolProp = syModel.getDomain().getProperties().getPropertyValue(MAX_POOL_SIZE);
                if (poolProp != null) {
                    poolSize = Integer.parseInt(poolProp);
                }
            }
        }
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

*/
public class ServiceDomainManagerTest {

    @Test
    public void testHandlerRegistration() throws Exception {
        SwitchYardModel switchyard = new ModelPuller<SwitchYardModel>().pull(
                "/switchyard-config-properties-01.xml", getClass());
       
        ServiceDomain domain = new ServiceDomainManager().createDomain(
                new QName("test"), switchyard);
       
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

     * {@inheritDoc}
     */
    @Override
    public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException {
        SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace();
        SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri());
        TransformsModel transformsModel = null;

        TransformNamespace transformNamespace = TransformNamespace.DEFAULT;
        for (TransformNamespace value : TransformNamespace.values()) {
            if (value.versionMatches(switchyardNamespace)) {
                transformNamespace = value;
                break;
            }
        }

        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);
                }
                transformsModel.addTransform(transformModel);
            }
        }

View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

        _puller = new ModelPuller<SwitchYardModel>();
    }

    @Test
    public void transformerClassNotFound() throws Exception {
        SwitchYardModel switchyard = _puller.pull(MISSING_TRANSFORM_XML, getClass());
        TransformerRegistryLoader loader = new TransformerRegistryLoader(new BaseTransformerRegistry());
        try {
            loader.newTransformers(switchyard.getTransforms().getTransforms().get(0));
            // the above should have resulted in an exception
            Assert.fail("missing transformer class should result in SwitchYardException");
        } catch (SwitchYardException syEx) {
            // expected outcome
            return;
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

        if (swConfigStream == null) {
            Assert.fail("null config stream.");
        }

        SwitchYardModel switchyardConfig;
        try {
            switchyardConfig = new ModelPuller<SwitchYardModel>().pull(swConfigStream);
        } finally {
            swConfigStream.close();
        }

        TransformsModel transforms = switchyardConfig.getTransforms();

        TransformModel transformModel = transforms.getTransforms().get(0);

        if (transformModel == null) {
            Assert.fail("No smooks config.");
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

        Assert.assertEquals(new QName(namespace, name), model.getModelConfiguration().getQName());
    }

    @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");
        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);
        Diff diff = XMLUnit.compareXML(old_xml, new_xml);
        Assert.assertTrue(diff.toString(), diff.identical());
    }
View Full Code Here

Examples of org.switchyard.config.model.switchyard.SwitchYardModel

        Assert.assertTrue(diff.toString(), diff.identical());
    }

    @Test
    public void testRead() throws Exception {
        SwitchYardModel switchyard = _puller.pull(XML, getClass());
        TransformsModel transforms = switchyard.getTransforms();
        JavaTransformModel java_transform = (JavaTransformModel)transforms.getTransforms().get(0);
        Assert.assertEquals("msgA", java_transform.getFrom().getLocalPart());
        Assert.assertEquals("msgB", java_transform.getTo().getLocalPart());
        Assert.assertEquals("org.examples.transform.AtoBTransform", java_transform.getClazz());
        SmooksTransformModel smooks_transform = (SmooksTransformModel)transforms.getTransforms().get(1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.