Package org.apache.tuscany.sca.policy

Examples of org.apache.tuscany.sca.policy.BindingType


        //testing to ensure that inclusion of referred policy sets has not happened
        PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
        assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());

        BindingType wsBindingType = bindingTypesTable.get(wsBinding);
        assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        ImplementationType javaImplType = implTypesTable.get(javaImpl);
        assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());

        ModelResolver resolver = new DefaultModelResolver();
        policyDefinitionsProcessor.resolve(definitions, resolver, context);
        //builder.build(scaDefinitions);

        //testing if policy intents have been linked have property been linked up
        assertNotNull(i1.getRequiredIntents().get(0).getDescription());
        // assertNotNull(i2.getQualifiableIntent().getDescription());
        assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
        assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());

        //testing if policysets have been properly linked up with intents
        assertFalse(secureMessagingPolicySet.isUnresolved());
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality_transport)));

        //testing if intent maps have been properly mapped to policies
        assertFalse(securityPolicySet.isUnresolved());
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality_message)));

        //testing for inclusion of referred policysets
        assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertFalse(basicAuthMsgProtSecurityPolicySet.getIntentMaps().get(0).getQualifiers().isEmpty());
        assertTrue(isRealizedBy(basicAuthMsgProtSecurityPolicySet, intentTable.get(confidentiality_transport)));

        assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
    }
View Full Code Here


                            i.setName(new QName(namespace, i.getName().getLocalPart()));
                            intentTable.put(i.getName(), i);
                            resolver.addModel(i, context);
                        }
                    } else if (artifact instanceof BindingType) {
                        BindingType bindingType = (BindingType)artifact;
                        bindingTypesTable.put(bindingType.getType(), bindingType);
                    } else if (artifact instanceof ImplementationType) {
                        ImplementationType implType = (ImplementationType)artifact;
                        implTypesTable.put(implType.getType(), implType);
                    } else if ( artifact instanceof ExternalAttachment) {
                      ExternalAttachment attachment = (ExternalAttachment)artifact;
View Full Code Here

        // Failing this the intent is unresolved and the reference and
        // service don't match
       
        // TODO - seems that we should do this loop on a binding by binding basis
        //        rather than each time we do matching
        BindingType bindingType = null;
       
        Definitions systemDefinitions = null;
        if (builderContext != null){
            systemDefinitions = builderContext.getDefinitions();
        } else {
            systemDefinitions = ((RuntimeEndpoint)endpoint).getCompositeContext().getSystemDefinitions();
        }
       
        for (BindingType loopBindingType : systemDefinitions.getBindingTypes()){
            if (loopBindingType.getType().equals(binding.getType())){
                bindingType = loopBindingType;
                break;
            }
        }
       
        // Before we start examining intents, remove any whose constrained
        // types don't include the binding type
        removeConstrainedIntents(endpointReference, bindingType);
       
        List<Intent> eprIntents = new ArrayList<Intent>();
        eprIntents.addAll(endpointReference.getRequiredIntents());
       
        // first check the binding type
        for (Intent intent : endpointReference.getRequiredIntents()){
            if (bindingType != null &&
                bindingType.getAlwaysProvidedIntents().contains(intent)){
                eprIntents.remove(intent);
            } else if (bindingType != null &&
                       bindingType.getMayProvidedIntents().contains(intent)){
                eprIntents.remove(intent);
            } else {
               // TODO - this code also appears in the ComponentPolicyBuilder
               //        so should rationalize
               loop: for (PolicySet policySet : referencePolicySets){
View Full Code Here

    @Override
    protected ExtensionType resolveExtensionType(ExtensionType extnType, ModelResolver resolver, ProcessorContext context)
        throws ContributionResolveException {
        if (extnType instanceof BindingType) {
            BindingType bindingType = (BindingType)extnType;
            return resolver.resolveModel(BindingType.class, bindingType, context);
        } else {
            return extnType;
        }
View Full Code Here

       
     
       
        // TODO - seems that we should do this loop on a binding by binding basis
        //        rather than each time we do matching
        BindingType bindingType = null;
        Definitions systemDefinitions = ((RuntimeEndpoint)endpoint).getCompositeContext().getSystemDefinitions();
        for (BindingType loopBindingType : systemDefinitions.getBindingTypes()){
            if (loopBindingType.getType().equals(binding.getType())){
                bindingType = loopBindingType;
                break;
            }
        }
       
        // Before we start examining intents, remove any whose constrained
        // types don't include the binding type
        removeConstrainedIntents(endpointReference, bindingType);
       
        List<Intent> eprIntents = new ArrayList<Intent>();
        eprIntents.addAll(endpointReference.getRequiredIntents());
       
        // first check the binding type
        for (Intent intent : endpointReference.getRequiredIntents()){
            if (bindingType != null &&
                bindingType.getAlwaysProvidedIntents().contains(intent)){
                eprIntents.remove(intent);
            } else if (bindingType != null &&
                       bindingType.getMayProvidedIntents().contains(intent)){
                eprIntents.remove(intent);
            } else {
               // TODO - this code also appears in the ComponentPolicyBuilder
               //        so should rationalize
               loop: for (PolicySet policySet : referencePolicySets){
View Full Code Here

             
                if (resolvedIntent != null){
                    intents.add(resolvedIntent);
                } else {
                    // look to see if this intent is provided by the binding
                    BindingType bindingType = systemDefinitions.getBindingType(endpoint.getBinding().getType());

                    if (bindingType != null){
                        for (Intent apIntent : bindingType.getAlwaysProvidedIntents()){
                            if (apIntent.getName().equals(intent.getName())){
                                resolvedIntent = apIntent;
                                break;
                            }
                        }
                       
                        if (resolvedIntent == null){
                            for (Intent mpIntent : bindingType.getMayProvidedIntents()){
                                if (mpIntent.getName().equals(intent.getName())){
                                    resolvedIntent = mpIntent;
                                    break;
                                }
                            }
View Full Code Here

        // Failing this the intent is unresolved and the reference and
        // service don't match
       
        // TODO - seems that we should do this loop on a binding by binding basis
        //        rather than each time we do matching
        BindingType bindingType = null;
       
        Definitions systemDefinitions = null;
        if (builderContext != null){
            systemDefinitions = builderContext.getDefinitions();
        } else {
            systemDefinitions = ((RuntimeEndpoint)endpoint).getCompositeContext().getSystemDefinitions();
        }
       
        bindingType = systemDefinitions.getBindingType(binding.getType());
       
        // Before we start examining intents, remove any whose constrained
        // types don't include the binding type
        removeConstrainedIntents(endpointReference, bindingType);
       
        List<Intent> eprIntents = new ArrayList<Intent>();
        List<Intent> eprMayProvideInterationIntents = new ArrayList<Intent>();
        eprIntents.addAll(endpointReference.getRequiredIntents());
       
        // first check the binding type
        for (Intent intent : endpointReference.getRequiredIntents()){
            if (bindingType != null &&
                bindingType.getAlwaysProvidedIntents().contains(intent)){
                eprIntents.remove(intent);
            } else if (bindingType != null &&
                       bindingType.getMayProvidedIntents().contains(intent)){
                eprIntents.remove(intent);
                if (intent.getType().equals(Intent.Type.interaction)){
                    eprMayProvideInterationIntents.add(intent);
                }
            } else {
View Full Code Here

        List<DefaultIntent> defaultIntents = ((DefaultingPolicySubject)binding).getDefaultIntents();
        DefaultIntent defaultIntent = policyFactory.createDefaultIntent();
       
        Definitions systemDefinitions = context.getDefinitions();
        if (systemDefinitions != null){
            BindingType bindingType = systemDefinitions.getBindingType(binding.getType());
            for (Intent mayProvideIntent : bindingType.getMayProvidedIntents()){
                if (mayProvideIntent.getName().getLocalPart().equals("SOAP.v1_1")){
                    defaultIntent.setIntent(mayProvideIntent);
                }
                if (mayProvideIntent.getName().getLocalPart().equals("SOAP.v1_2")){
                    defaultIntent.getMutuallyExclusiveIntents().add(mayProvideIntent);
View Full Code Here

        //testing to ensure that inclusion of referred policy sets has not happened
        PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
        assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());

        BindingType wsBindingType = bindingTypesTable.get(wsBinding);
        assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        ImplementationType javaImplType = implTypesTable.get(javaImpl);
        assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());

        ModelResolver resolver = new DefaultModelResolver();
        policyDefinitionsProcessor.resolve(definitions, resolver, context);
        //builder.build(scaDefinitions);

        //testing if policy intents have been linked have property been linked up
        assertNotNull(i1.getRequiredIntents().get(0).getDescription());
        // assertNotNull(i2.getQualifiableIntent().getDescription());
        assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
        assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());

        //testing if policysets have been properly linked up with intents
        assertFalse(secureMessagingPolicySet.isUnresolved());
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality_transport)));

        //testing if intent maps have been properly mapped to policies
        assertFalse(securityPolicySet.isUnresolved());
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality_message)));

        //testing for inclusion of referred policysets
        assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertFalse(basicAuthMsgProtSecurityPolicySet.getIntentMaps().get(0).getQualifiers().isEmpty());
        assertTrue(isRealizedBy(basicAuthMsgProtSecurityPolicySet, intentTable.get(confidentiality_transport)));

        assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
    }
View Full Code Here

                            i.setName(new QName(namespace, i.getName().getLocalPart()));
                            intentTable.put(i.getName(), i);
                            resolver.addModel(i, context);
                        }
                    } else if (artifact instanceof BindingType) {
                        BindingType bindingType = (BindingType)artifact;
                        bindingTypesTable.put(bindingType.getType(), bindingType);
                    } else if (artifact instanceof ImplementationType) {
                        ImplementationType implType = (ImplementationType)artifact;
                        implTypesTable.put(implType.getType(), implType);
                    } else if ( artifact instanceof ExternalAttachment) {
                      ExternalAttachment attachment = (ExternalAttachment)artifact;
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.policy.BindingType

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.