FileDocCategorySizeDatePackage
PolicyMapUtilTest.javaAPI DocExample4263Tue May 29 16:57:42 BST 2007com.sun.xml.ws.policy.util

PolicyMapUtilTest

public class PolicyMapUtilTest extends TestCase
author
fr159072

Fields Summary
Constructors Summary
public PolicyMapUtilTest(String testName)

        super(testName);
    
Methods Summary
protected voidsetUp()

    
protected voidtearDown()

    
public voidtestRejectAlternatives()
Test of rejectAlternatives method, of class com.sun.xml.ws.policy.util.PolicyMapUtil.

        PolicyMap map = null;
        try {
            PolicyMapUtil.rejectAlternatives(map);
            fail("Expected NullPointerException");
        } catch (NullPointerException e) {
        }

        PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
        PolicyMapMutator[] mutators = new PolicyMapMutator[] {extender};
        PolicyMapKey key = map.createWsdlServiceScopeKey(new QName("service"));
        map = PolicyMap.createPolicyMap(Arrays.asList(mutators));
        Policy policy = Policy.createEmptyPolicy();
        PolicySubject subject = new PolicySubject(new Object(), policy);
        extender.putServiceSubject(key, subject);
        PolicyMapUtil.rejectAlternatives(map);
        
        mutators[0].disconnect();
        key = map.createWsdlEndpointScopeKey(new QName("service"), new QName("port"));
        map = PolicyMap.createPolicyMap(Arrays.asList(mutators));
        policy = PolicyResourceLoader.loadPolicy("merge/policy2.xml");
        subject = new PolicySubject(new Object(), policy);
        extender.putServiceSubject(key, subject);
        try {
            PolicyMapUtil.rejectAlternatives(map);
            fail("Expected PolicyException");
        } catch (PolicyException e) {
        }