Search in sources :

Example 6 with PolicyMapExtender

use of com.sun.xml.ws.policy.PolicyMapExtender in project metro-jax-ws by eclipse-ee4j.

the class AlternativeSelectorTest method testDoSelectionAlternativesService.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionAlternativesService() throws PolicyException {
    final PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
    final PolicyMap map = PolicyMap.createPolicyMap(Arrays.asList(new PolicyMapMutator[] { extender }));
    final PolicySubject subject = new PolicySubject("dummy", this.multipleAlternativesPolicy);
    final PolicyMapKey key = PolicyMap.createWsdlServiceScopeKey(new QName("service"));
    extender.putServiceSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getServiceEffectivePolicy(key);
    if (result.contains(this.assertion1Name)) {
        assertFalse(result.contains(this.assertion2Name));
    } else if (result.contains(this.assertion2Name)) {
        assertFalse(result.contains(this.assertion1Name));
    } else {
        fail("Expected exactly one assertion in the resulting policy.");
    }
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicySubject(com.sun.xml.ws.policy.PolicySubject) EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier) PolicyMap(com.sun.xml.ws.policy.PolicyMap) PolicyMapKey(com.sun.xml.ws.policy.PolicyMapKey) QName(javax.xml.namespace.QName) PolicyMapMutator(com.sun.xml.ws.policy.PolicyMapMutator) PolicyMapExtender(com.sun.xml.ws.policy.PolicyMapExtender)

Example 7 with PolicyMapExtender

use of com.sun.xml.ws.policy.PolicyMapExtender in project metro-jax-ws by eclipse-ee4j.

the class AlternativeSelectorTest method testDoSelectionAlternativesEndpoint.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionAlternativesEndpoint() throws PolicyException {
    final PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
    final PolicyMap map = PolicyMap.createPolicyMap(Arrays.asList(new PolicyMapMutator[] { extender }));
    final PolicySubject subject = new PolicySubject("dummy", this.multipleAlternativesPolicy);
    final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(new QName("service"), new QName("port"));
    extender.putEndpointSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getEndpointEffectivePolicy(key);
    if (result.contains(this.assertion1Name)) {
        assertFalse(result.contains(this.assertion2Name));
    } else if (result.contains(this.assertion2Name)) {
        assertFalse(result.contains(this.assertion1Name));
    } else {
        fail("Expected exactly one assertion in the resulting policy.");
    }
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicySubject(com.sun.xml.ws.policy.PolicySubject) EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier) PolicyMap(com.sun.xml.ws.policy.PolicyMap) PolicyMapKey(com.sun.xml.ws.policy.PolicyMapKey) QName(javax.xml.namespace.QName) PolicyMapMutator(com.sun.xml.ws.policy.PolicyMapMutator) PolicyMapExtender(com.sun.xml.ws.policy.PolicyMapExtender)

Example 8 with PolicyMapExtender

use of com.sun.xml.ws.policy.PolicyMapExtender in project metro-jax-ws by eclipse-ee4j.

the class AlternativeSelectorTest method testDoSelectionAlternativesOutput.

public void testDoSelectionAlternativesOutput() throws PolicyException {
    final PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
    final PolicyMap map = PolicyMap.createPolicyMap(Arrays.asList(new PolicyMapMutator[] { extender }));
    final PolicySubject subject = new PolicySubject("dummy", this.multipleAlternativesPolicy);
    final PolicyMapKey key = PolicyMap.createWsdlMessageScopeKey(new QName("service"), new QName("port"), new QName("operation"));
    extender.putOutputMessageSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getOutputMessageEffectivePolicy(key);
    if (result.contains(this.assertion1Name)) {
        assertFalse(result.contains(this.assertion2Name));
    } else if (result.contains(this.assertion2Name)) {
        assertFalse(result.contains(this.assertion1Name));
    } else {
        fail("Expected exactly one assertion in the resulting policy.");
    }
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicySubject(com.sun.xml.ws.policy.PolicySubject) EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier) PolicyMap(com.sun.xml.ws.policy.PolicyMap) PolicyMapKey(com.sun.xml.ws.policy.PolicyMapKey) QName(javax.xml.namespace.QName) PolicyMapMutator(com.sun.xml.ws.policy.PolicyMapMutator) PolicyMapExtender(com.sun.xml.ws.policy.PolicyMapExtender)

Aggregations

PolicyMapExtender (com.sun.xml.ws.policy.PolicyMapExtender)8 PolicyMap (com.sun.xml.ws.policy.PolicyMap)7 PolicyMapMutator (com.sun.xml.ws.policy.PolicyMapMutator)7 PolicySubject (com.sun.xml.ws.policy.PolicySubject)7 EffectivePolicyModifier (com.sun.xml.ws.policy.EffectivePolicyModifier)6 Policy (com.sun.xml.ws.policy.Policy)6 PolicyMapKey (com.sun.xml.ws.policy.PolicyMapKey)6 QName (javax.xml.namespace.QName)6 TypedXmlWriter (com.sun.xml.txw2.TypedXmlWriter)1 AddressingPolicyMapConfigurator (com.sun.xml.ws.addressing.policy.AddressingPolicyMapConfigurator)1 WSBinding (com.sun.xml.ws.api.WSBinding)1 MtomPolicyMapConfigurator (com.sun.xml.ws.encoding.policy.MtomPolicyMapConfigurator)1 PolicyException (com.sun.xml.ws.policy.PolicyException)1 PolicyMapConfigurator (com.sun.xml.ws.policy.jaxws.spi.PolicyMapConfigurator)1 WebServiceException (jakarta.xml.ws.WebServiceException)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1