Package org.switchyard.config.model.composite

Examples of org.switchyard.config.model.composite.ComponentServiceModel


    public Throttling getThrottling() {
        return _throttling;
    }

    private ComponentService getPromotedService(Application application, CompositeServiceModel compositeService) {
        ComponentServiceModel componentServiceModel = compositeService.getComponentService();
        if (componentServiceModel == null) {
            return null;
        }
        return application.getComponentService(componentServiceModel.getQName());
    }
View Full Code Here


        for (ComponentModel component : getConfig().getComposite().getComponents()) {
            // TODO: we need a separate node for components, to support cases
            // where the component implements no services.  Should also consider
            // multiple services per component.
            if (component.getServices().size() > 0) {
                ComponentServiceModel service = component.getServices().get(0);
                if (service.getInterface() == null || EsbInterfaceModel.ESB.equals(service.getInterface().getType())) {
                    _componentServices.put(service.getQName(), new BaseNoopComponentService(service, component, this));
                } else if (InterfaceModel.JAVA.equals(service.getInterface().getType())) {
                    _componentServices.put(service.getQName(), new BaseJavaComponentService(service, component, this));
                } else if (InterfaceModel.WSDL.equals(service.getInterface().getType())) {
                    _componentServices.put(service.getQName(), new BaseWsdlComponentService(service, component, this));
                }
            }
        }
    }
View Full Code Here

                        for (ComponentModel component : composite.getComponents()) {
                            if (componentName.equals(component.getName())) {
                                List<ComponentServiceModel> componentServices = component.getServices();
                                if (namesCount == 1) {
                                    if (componentServices.size() > 0) {
                                        ComponentServiceModel componentService = componentServices.iterator().next();
                                        if (componentService != null) {
                                            return componentService;
                                        }
                                    }
                                } else if (namesCount == 2) {
                                    for (ComponentServiceModel componentService : componentServices) {
                                        if (componentServiceName.equals(componentService.getName())) {
                                            return componentService;
                                        }
                                    }
                                }
                            }
View Full Code Here

    }

    @Test
    public void requiresOnService() throws Exception {
        ComponentModel comp = _model.getComponents().get(0);
        ComponentServiceModel svc = comp.getServices().get(0);
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_FOO));
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_BAR));
    }
View Full Code Here

    }

    @Test
    public void buildPolicyConfig() throws Exception {
        // Test service policy
        ComponentServiceModel svc = new V1ComponentServiceModel(SwitchYardNamespace.DEFAULT.uri());
        svc.addPolicyRequirement(POLICY_FOO);
        svc.addPolicyRequirement(POLICY_BAR);
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_FOO));
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_BAR));

        // Test reference policy
        ComponentReferenceModel ref = new V1ComponentReferenceModel(SwitchYardNamespace.DEFAULT.uri());
        ref.addPolicyRequirement(POLICY_BAR);
        Assert.assertTrue(ref.hasPolicyRequirement(POLICY_BAR));
        Assert.assertFalse(ref.hasPolicyRequirement(POLICY_FOO));
        svc.addPolicyRequirement(POLICY_FOO);
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_FOO));
    }
View Full Code Here

    public void testAddedRequirements() throws Exception {
        _model.getModelConfiguration().setAttribute("xmlns:cstm", CUSTOM_NS);
        // a re-pull is necessary because of how we're setting the attribute above
        _model =  new ModelPuller<CompositeModel>().pull(new StringReader(_model.toString()));
        ComponentModel comp = _model.getComponents().get(0);
        ComponentServiceModel svc = comp.getServices().get(0);
        svc.addPolicyRequirement(POLICY_THINGAMAGIG);
        svc.addPolicyRequirement(POLICY_NONAMESPACE_CLIENT_AUTHENTICATION);
        svc.addPolicyRequirement(POLICY_QUALIFIED_AUTHORIZATION);
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_FOO));
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_BAR));
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_THINGAMAGIG));
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_NONAMESPACE_CLIENT_AUTHENTICATION));
        Assert.assertTrue(svc.hasPolicyRequirement(POLICY_QUALIFIED_AUTHORIZATION));
    }
View Full Code Here

TOP

Related Classes of org.switchyard.config.model.composite.ComponentServiceModel

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.