Examples of SwitchYardModel


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 testParenthood() throws Exception {
        SwitchYardModel switchyard_1 = _puller.pull(XML, getClass());
        ValidatesModel validates_1 = switchyard_1.getValidates();
        ValidateModel validate = validates_1.getValidates().get(0);
        ValidatesModel validates_2 = validate.getValidates();
        SwitchYardModel switchyard_2 = validates_2.getSwitchYard();
        Assert.assertEquals(validates_1, validates_2);
        Assert.assertEquals(switchyard_1, switchyard_2);
    }
View Full Code Here

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

        Assert.assertEquals(switchyard_1, switchyard_2);
    }

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

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

        // If running this test inside your IDE... you need to set the cwd to be the
        // root of the validate module !!
        urls.add(new File("./target/test-classes").toURI().toURL());

        ScannerInput<SwitchYardModel> input = new ScannerInput<SwitchYardModel>().setURLs(urls);
        SwitchYardModel switchyard = scanner.scan(input).getModel();
        List<ValidateModel> models = switchyard.getValidates().getValidates();

        Assert.assertEquals(9, models.size());
        assertModelInstanceOK((JavaValidateModel) models.get(0));
        assertModelInstanceOK((JavaValidateModel) models.get(1));
        assertModelInstanceOK((JavaValidateModel) models.get(2));
View Full Code Here

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

    @Override
    public DomainModel setProperties(PropertiesModel properties) {
        setChildModel(properties);
        _properties = properties;
        SwitchYardModel switchyard = getSwitchYard();
        if (switchyard != null) {
            switchyard.setDomainPropertyResolver();
        }
        return this;
    }
View Full Code Here

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

    }

    private SwitchYardModel createSwitchYardModel(InputStream configModel, List<Scanner<V1SwitchYardModel>> scanners, boolean validate) {
        Assert.assertNotNull("Test 'configModel' is null.", configModel);

        final SwitchYardModel returnModel;
        try {
            SwitchYardModel model = loadSwitchYardModel(configModel, false);
            ClassLoader classLoader = _testInstance.getClass().getClassLoader();

            if (scanners != null && !scanners.isEmpty() && classLoader instanceof URLClassLoader) {
                String uri = model.getModelRootNamespace();
                SwitchYardNamespace ns = SwitchYardNamespace.fromUri(uri);
                MergeScanner<V1SwitchYardModel> merge_scanner = new MergeScanner<V1SwitchYardModel>(true, scanners);
                List<URL> scanURLs = getScanURLs((URLClassLoader)classLoader);

                ScannerInput<V1SwitchYardModel> scanner_input = new ScannerInput<V1SwitchYardModel>()
                        .setSwitchyardNamespace(ns).setCompositeName(model.getName()).setURLs(scanURLs);
                V1SwitchYardModel scannedModel = merge_scanner.scan(scanner_input).getModel();

                returnModel = Models.merge(scannedModel, model, false);
            } else {
                returnModel = model;
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();
        }

        ValidatesModel validates = switchyardConfig.getValidates();

        ValidateModel validateModel = validates.getValidates().get(0);

        if (validateModel == null) {
            Assert.fail("No validate config.");
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());
        ValidatesModel validatesModel = null;

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

        List<Class<?>> validatorClasses = scanForValidators(input.getURLs());
        for (Class<?> validator : validatorClasses) {
            List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator);

            for (ValidatorTypes supportedValidate : supportedValidators) {
                JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri());

                String bean = CDIUtil.getNamedAnnotationValue(validator);
                if (bean != null) {
                    validateModel.setBean(bean);
                } else {
                    validateModel.setClazz(validator.getName());
                }
                validateModel.setName(supportedValidate.getName());

                if (validatesModel == null) {
                    validatesModel = new V1ValidatesModel(switchyardNamespace.uri());
                    switchyardModel.setValidates(validatesModel);
                }
                validatesModel.addValidate(validateModel);
            }
        }

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.