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) {
}
}
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);
}
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);
}
Aggregations