Search in sources :

Example 1 with EffectivePolicyModifier

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

the class AlternativeSelectorTest method testDoSelectionNull.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionNull() throws PolicyException {
    final EffectivePolicyModifier modifier = null;
    try {
        AlternativeSelector.doSelection(modifier);
        fail("Expected NullPointerException");
    } catch (NullPointerException e) {
    // expected
    }
}
Also used : EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier)

Example 2 with EffectivePolicyModifier

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

the class AlternativeSelectorTest method testDoSelectionEmpty.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionEmpty() throws PolicyException {
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    final PolicyMap map = PolicyMap.createPolicyMap(null);
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    assertTrue(map.isEmpty());
}
Also used : EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier) PolicyMap(com.sun.xml.ws.policy.PolicyMap)

Example 3 with EffectivePolicyModifier

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

the class AlternativeSelectorTest method testDoSelectionAlternativesFault.

public void testDoSelectionAlternativesFault() 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.createWsdlFaultMessageScopeKey(new QName("service"), new QName("port"), new QName("operation"), new QName("fault"));
    extender.putFaultMessageSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getFaultMessageEffectivePolicy(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 4 with EffectivePolicyModifier

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

the class AlternativeSelectorTest method testDoSelectionUnconnected.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionUnconnected() throws PolicyException {
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    try {
        AlternativeSelector.doSelection(modifier);
        fail("Expected NullPointerException");
    } catch (NullPointerException e) {
    // expected
    }
}
Also used : EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier)

Example 5 with EffectivePolicyModifier

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

the class AlternativeSelectorTest method testDoSelectionAlternativesOperation.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionAlternativesOperation() 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.createWsdlOperationScopeKey(new QName("service"), new QName("port"), new QName("operation"));
    extender.putOperationSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getOperationEffectivePolicy(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

EffectivePolicyModifier (com.sun.xml.ws.policy.EffectivePolicyModifier)10 PolicyMap (com.sun.xml.ws.policy.PolicyMap)7 Policy (com.sun.xml.ws.policy.Policy)6 PolicyMapExtender (com.sun.xml.ws.policy.PolicyMapExtender)6 PolicyMapKey (com.sun.xml.ws.policy.PolicyMapKey)6 PolicyMapMutator (com.sun.xml.ws.policy.PolicyMapMutator)6 PolicySubject (com.sun.xml.ws.policy.PolicySubject)6 QName (javax.xml.namespace.QName)6 PolicyException (com.sun.xml.ws.policy.PolicyException)1 WebServiceException (jakarta.xml.ws.WebServiceException)1