Search in sources :

Example 1 with ModelNode

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

the class PolicyMapUtilTest method testRejectAlternativesComplex.

public void testRejectAlternativesComplex() throws PolicyException {
    PolicySourceModel model = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_5, "id", null);
    ModelNode root = model.getRootNode();
    ModelNode alternatives = root.createChildExactlyOneNode();
    ModelNode alternative1 = alternatives.createChildAllNode();
    ModelNode alternative2 = alternatives.createChildAllNode();
    AssertionData assertion1 = AssertionData.createAssertionData(new QName("test1", "test1"));
    alternative1.createChildAssertionNode(assertion1);
    AssertionData assertion2 = AssertionData.createAssertionData(new QName("test2", "test2"));
    alternative2.createChildAssertionNode(assertion2);
    PolicyModelTranslator translator = PolicyModelTranslator.getTranslator();
    Policy policy = translator.translate(model);
    PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
    PolicyMap map = PolicyMap.createPolicyMap(Arrays.asList(new PolicyMapMutator[] { extender }));
    PolicySubject subject = new PolicySubject("dummy", policy);
    PolicyMapKey key = PolicyMap.createWsdlServiceScopeKey(new QName("1"));
    extender.putServiceSubject(key, subject);
    key = PolicyMap.createWsdlServiceScopeKey(new QName("2"));
    extender.putServiceSubject(key, subject);
    try {
        PolicyMapUtil.rejectAlternatives(map);
        fail("Expected a PolicyException");
    } catch (PolicyException e) {
    }
}
Also used : PolicySourceModel(com.sun.xml.ws.policy.sourcemodel.PolicySourceModel) QName(javax.xml.namespace.QName) PolicyModelTranslator(com.sun.xml.ws.policy.sourcemodel.PolicyModelTranslator) ModelNode(com.sun.xml.ws.policy.sourcemodel.ModelNode) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 2 with ModelNode

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

the class AlternativeSelectorTest method setUp.

@Override
protected void setUp() throws PolicyException {
    final PolicySourceModel model = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_5, "id", null);
    final ModelNode root = model.getRootNode();
    final ModelNode alternatives = root.createChildExactlyOneNode();
    final ModelNode alternative1 = alternatives.createChildAllNode();
    final ModelNode alternative2 = alternatives.createChildAllNode();
    final AssertionData assertion1 = AssertionData.createAssertionData(assertion1Name);
    alternative1.createChildAssertionNode(assertion1);
    final AssertionData assertion2 = AssertionData.createAssertionData(assertion2Name);
    alternative2.createChildAssertionNode(assertion2);
    final ModelTranslator translator = ModelTranslator.getTranslator();
    this.multipleAlternativesPolicy = translator.translate(model);
}
Also used : PolicySourceModel(com.sun.xml.ws.policy.sourcemodel.PolicySourceModel) ModelTranslator(com.sun.xml.ws.api.policy.ModelTranslator) ModelNode(com.sun.xml.ws.policy.sourcemodel.ModelNode) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Example 3 with ModelNode

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

the class EffectiveAlternativeSelectorTest method setUp.

@Override
protected void setUp() throws PolicyException {
    final PolicySourceModel model = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_5, "id", null);
    final ModelNode root = model.getRootNode();
    final ModelNode alternatives = root.createChildExactlyOneNode();
    final ModelNode alternative1 = alternatives.createChildAllNode();
    final ModelNode alternative2 = alternatives.createChildAllNode();
    final AssertionData assertion1 = AssertionData.createAssertionData(assertion1Name);
    alternative1.createChildAssertionNode(assertion1);
    final AssertionData assertion2 = AssertionData.createAssertionData(assertion2Name);
    alternative2.createChildAssertionNode(assertion2);
    final PolicyModelTranslator translator = PolicyModelTranslator.getTranslator();
    this.multipleAlternativesPolicy = translator.translate(model);
}
Also used : PolicySourceModel(com.sun.xml.ws.policy.sourcemodel.PolicySourceModel) PolicyModelTranslator(com.sun.xml.ws.policy.sourcemodel.PolicyModelTranslator) ModelNode(com.sun.xml.ws.policy.sourcemodel.ModelNode) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Aggregations

AssertionData (com.sun.xml.ws.policy.sourcemodel.AssertionData)3 ModelNode (com.sun.xml.ws.policy.sourcemodel.ModelNode)3 PolicySourceModel (com.sun.xml.ws.policy.sourcemodel.PolicySourceModel)3 PolicyModelTranslator (com.sun.xml.ws.policy.sourcemodel.PolicyModelTranslator)2 ModelTranslator (com.sun.xml.ws.api.policy.ModelTranslator)1 QName (javax.xml.namespace.QName)1