* Create a policy with an WSAM Addressing assertion.
*/
private Policy createWsamAddressingPolicy(final QName bindingName, AddressingFeature af) {
final ArrayList<AssertionSet> assertionSets = new ArrayList<AssertionSet>(1);
final ArrayList<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>(1);
final AssertionData addressingData =
AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION);
if (!af.isRequired()) {
addressingData.setOptionalAttribute(true);
}
try {
AddressingFeature.Responses responses = af.getResponses();
if (responses == AddressingFeature.Responses.ANONYMOUS) {
AssertionData nestedAsserData = AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION);
PolicyAssertion nestedAsser = new AddressingAssertion(nestedAsserData, null);
assertions.add(new AddressingAssertion(addressingData, AssertionSet.createAssertionSet(Collections.singleton(nestedAsser))));
} else if (responses == AddressingFeature.Responses.NON_ANONYMOUS) {
final AssertionData nestedAsserData = AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION);
PolicyAssertion nestedAsser = new AddressingAssertion(nestedAsserData, null);
assertions.add(new AddressingAssertion(addressingData, AssertionSet.createAssertionSet(Collections.singleton(nestedAsser))));
} else {
assertions.add(new AddressingAssertion(addressingData, AssertionSet.createAssertionSet(null)));
}