use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.
the class ManagedServiceAssertionTest method testIsManagementEnabledOff.
public void testIsManagementEnabledOff() throws AssertionCreationException {
final HashMap<QName, String> attributes = new HashMap<QName, String>();
attributes.put(ID_ATTRIBUTE_QNAME, "id1");
attributes.put(MANAGEMENT_ATTRIBUTE_QNAME, "off");
final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
final ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
final boolean result = instance.isManagementEnabled();
assertFalse(result);
}
use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.
the class ManagedServiceAssertionTest method testGetId.
/**
* Test of getId method, of class ManagedServiceAssertion.
*/
public void testGetId() throws AssertionCreationException {
final HashMap<QName, String> attributes = new HashMap<QName, String>();
attributes.put(ID_ATTRIBUTE_QNAME, "id1");
final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
String expResult = "id1";
String result = instance.getId();
assertEquals(expResult, result);
}
use of com.sun.xml.ws.policy.sourcemodel.AssertionData in project metro-jax-ws by eclipse-ee4j.
the class ManagedServiceAssertionTest method testMonitoringAttributeTrue.
public void testMonitoringAttributeTrue() throws AssertionCreationException {
final HashMap<QName, String> attributes = new HashMap<QName, String>();
attributes.put(ID_ATTRIBUTE_QNAME, "id1");
attributes.put(MONITORING_ATTRIBUTE_QNAME, "true");
final AssertionData data = AssertionData.createAssertionData(ManagedServiceAssertion.MANAGED_SERVICE_QNAME, null, attributes, false, false);
final ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
final Setting result = instance.monitoringAttribute();
assertSame(Setting.ON, result);
}
use of com.sun.xml.ws.policy.sourcemodel.AssertionData 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.AssertionData in project metro-jax-ws by eclipse-ee4j.
the class AddressingPolicyMapConfigurator method createWsamAddressingPolicy.
/**
* Create a policy with an WSAM Addressing assertion.
*/
private Policy createWsamAddressingPolicy(final QName bindingName, AddressingFeature af) {
final ArrayList<AssertionSet> assertionSets = new ArrayList<>(1);
final ArrayList<PolicyAssertion> assertions = new ArrayList<>(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)));
}
} catch (NoSuchMethodError e) {
// If JAX-WS 2.2 API is really required, it would been reported in @Addressing or wsam:Addressing processing
// Don't add any nested assertion to mimic the 2.1 behavior
assertions.add(new AddressingAssertion(addressingData, AssertionSet.createAssertionSet(null)));
}
assertionSets.add(AssertionSet.createAssertionSet(assertions));
return Policy.createPolicy(null, bindingName.getLocalPart() + "_WSAM_Addressing_Policy", assertionSets);
}
Aggregations