Examples of SwitchYardModel


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

        assertThat(implModel.getScriptFile(), is(equalTo("bogusScript.clj")));
        assertThat(implModel.injectExchange(), is(false));
    }
   
    private V1ClojureComponentImplementationModel getImplModel(final String config) throws Exception {
        final SwitchYardModel model = new ModelPuller<SwitchYardModel>().pull(config, getClass());
        final ComponentModel componentModel = model.getComposite().getComponents().get(0);
        final ComponentImplementationModel implementation = componentModel.getImplementation();
        return (V1ClojureComponentImplementationModel) implementation;
    }
View Full Code Here

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

        doTestWrite(REMOTEREST_XML);
    }

    private void doTestWrite(String xml) 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

    public void testValidateRemoteRest() throws Exception {
        doTestValidate(REMOTEREST_XML);
    }

    private void doTestValidate(String xml) throws Exception {
        SwitchYardModel switchyard = _puller.pull(xml, getClass());
        switchyard.assertModelValid();
    }
View Full Code Here

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

        String urlPath = Classes.getResource(resPath).getPath();
        File file = new File(urlPath.substring(0, urlPath.length() - resPath.length()));
        urls.add(file.toURI().toURL());
        input.setURLs(urls);
        ScannerOutput<SwitchYardModel> output = scanner.scan(input);
        SwitchYardModel model = output.getModel();
        CompositeModel composite = model.getComposite();
        Assert.assertEquals(getClass().getSimpleName(), composite.getName());
        doTestModel(model, xml, loader);
    }
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());
        CompositeModel compositeModel = new V1CompositeModel();
        compositeModel.setName(input.getCompositeName());
        ClasspathScanner rulesScanner = new ClasspathScanner(_rulesFilter);
        for (URL url : input.getURLs()) {
            rulesScanner.scan(url);
        }
        List<Class<?>> rulesClasses = _rulesFilter.getMatchedTypes();
        for (Class<?> rulesClass : rulesClasses) {
            compositeModel.addComponent(scan(rulesClass, switchyardNamespace));
        }
        if (!compositeModel.getModelChildren().isEmpty()) {
            switchyardModel.setComposite(compositeModel);
        }
        return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel);
    }
View Full Code Here

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

        _puller = new ModelPuller<SwitchYardModel>();
    }

    @Test
    public void testReadComplete() throws Exception {
        SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
        CompositeModel composite = switchyard.getComposite();
        ComponentModel component = composite.getComponents().get(0);
        ComponentImplementationModel implementation = component.getImplementation();
        Assert.assertTrue(implementation instanceof BeanComponentImplementationModel);
        BeanComponentImplementationModel bci = (BeanComponentImplementationModel)implementation;
        Assert.assertEquals("bean", bci.getType());
View Full Code Here

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

    }

    @Test
    public void testWriteComplete() throws Exception {
        String old_xml = new StringPuller().pull(COMPLETE_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 testValidation() throws Exception {
        SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
        switchyard.assertModelValid();
    }
View Full Code Here

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

    private static final String SWITCHYARD_CONFIG = "switchyard-activator-impl-missing-ref.xml";

    @Test (expected = SwitchYardException.class)
    public void should_throw_if_serviceReference_is_missing() throws Exception {
        final SwitchYardModel model = pullSwitchYardModel();
        final Deployment deployment = new Deployment(model);
        final ServiceDomain domain = new ServiceDomainManager().createDomain(ROOT_DOMAIN, deployment.getConfig());
        final List<Activator> activators = ActivatorLoader.createActivators(domain);
        deployment.init(domain, activators);
        deployment.start();
View Full Code Here

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

public class RouteScanner implements Scanner<SwitchYardModel> {

    @Override
    public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException {
        SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace();
        SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri());
        CompositeModel compositeModel = new V1CompositeModel();
        compositeModel.setName(input.getCompositeName());

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

        List<Class<?>> routeClasses = scanForRoutes(input.getURLs());

        // Create a Camel component model for each class
        for (Class<?> routeClass : routeClasses) {
            // Top-level component definition
            ComponentModel componentModel = new V1ComponentModel();
            componentModel.setName(routeClass.getSimpleName());

            // Component implementation definition
            CamelComponentImplementationModel camelModel = new V1CamelImplementationModel(camelNamespace.uri());
            camelModel.setJavaClass(routeClass.getName());
            componentModel.setImplementation(camelModel);
            compositeModel.addComponent(componentModel);

            // Component service definition
            ComponentServiceModel serviceModel = new V1ComponentServiceModel(switchyardNamespace.uri());
            InterfaceModel csiModel = new V1InterfaceModel(InterfaceModel.JAVA);
            Class<?> serviceInterface = routeClass.getAnnotation(Route.class).value();
            serviceModel.setName(getServiceName(routeClass));
            csiModel.setInterface(serviceInterface.getName());
            serviceModel.setInterface(csiModel);
            componentModel.addService(serviceModel);

            // Component reference definition(s)
            // Need to add these!
        }

        if (!compositeModel.getModelChildren().isEmpty()) {
            switchyardModel.setComposite(compositeModel);
        }

        return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel);
    }
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.