use of com.sun.xml.ws.policy.PolicyMapMutator in project metro-jax-ws by eclipse-ee4j.
the class PolicyMapBuilder method getNewPolicyMap.
/**
* Iterates all the registered PolicyBuilders and lets them populate
* their changes into PolicyMap. Registers mutators from collection given as a parameter
* with the newly created map.
*/
private PolicyMap getNewPolicyMap(final PolicyMapMutator... externalMutators) throws PolicyException {
final HashSet<PolicyMapMutator> mutators = new HashSet<>();
final PolicyMapExtender myExtender = PolicyMapExtender.createPolicyMapExtender();
mutators.add(myExtender);
if (null != externalMutators) {
mutators.addAll(Arrays.asList(externalMutators));
}
final PolicyMap policyMap = PolicyMap.createPolicyMap(mutators);
for (BuilderHandler builder : policyBuilders) {
builder.populate(myExtender);
}
return policyMap;
}
use of com.sun.xml.ws.policy.PolicyMapMutator 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.");
}
}
use of com.sun.xml.ws.policy.PolicyMapMutator 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.");
}
}
use of com.sun.xml.ws.policy.PolicyMapMutator in project metro-jax-ws by eclipse-ee4j.
the class AlternativeSelectorTest method testDoSelectionAlternativesInput.
/**
* Test of doSelection method, of class AlternativeSelector.
*/
public void testDoSelectionAlternativesInput() 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.putInputMessageSubject(key, subject);
final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
modifier.connect(map);
AlternativeSelector.doSelection(modifier);
final Policy result = map.getInputMessageEffectivePolicy(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.");
}
}
use of com.sun.xml.ws.policy.PolicyMapMutator 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.");
}
}
Aggregations