Search in sources :

Example 31 with AssertionData

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

the class PolicyIntersectorTest method testIntersectLax.

/**
 * Test of intersect method, of class PolicyIntersector.
 */
public void testIntersectLax() {
    AssertionData data1 = AssertionData.createAssertionData(new QName("testns", "name1"));
    PolicyAssertion assertion1 = new MockAssertion(data1);
    AssertionData data2 = AssertionData.createAssertionData(new QName("testns", "name2"));
    PolicyAssertion assertion2 = new MockAssertion(data2);
    AssertionData data3 = AssertionData.createAssertionData(new QName("testns", "name3"));
    PolicyAssertion assertion3 = new MockAssertion(data3);
    LinkedList<PolicyAssertion> assertions1 = new LinkedList<PolicyAssertion>();
    assertions1.add(assertion1);
    assertions1.add(assertion2);
    assertions1.add(assertion3);
    AssertionSet set1 = AssertionSet.createAssertionSet(assertions1);
    LinkedList<AssertionSet> sets1 = new LinkedList<AssertionSet>();
    sets1.add(set1);
    Policy policy1 = Policy.createPolicy(null, "policy1", sets1);
    LinkedList<PolicyAssertion> assertions2 = new LinkedList<PolicyAssertion>();
    assertions2.add(assertion1);
    assertions2.add(assertion2);
    assertions2.add(assertion3);
    AssertionSet set2 = AssertionSet.createAssertionSet(assertions2);
    LinkedList<AssertionSet> sets2 = new LinkedList<AssertionSet>();
    sets2.add(set2);
    Policy policy2 = Policy.createPolicy(null, "policy2", sets2);
    Policy[] policies = new Policy[] { policy1, policy2 };
    LinkedList<PolicyAssertion> assertions3 = new LinkedList<PolicyAssertion>();
    assertions3.add(assertion1);
    assertions3.add(assertion2);
    assertions3.add(assertion3);
    AssertionSet set3 = AssertionSet.createAssertionSet(assertions3);
    LinkedList<AssertionSet> sets3 = new LinkedList<AssertionSet>();
    sets3.add(set3);
    Policy expResult = Policy.createPolicy(null, "policy3", sets3);
    PolicyIntersector instance = PolicyIntersector.createLaxPolicyIntersector();
    Policy result = instance.intersect(policies);
    assertEquals(expResult, result);
}
Also used : QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData) LinkedList(java.util.LinkedList)

Example 32 with AssertionData

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

the class PolicyMergerTest method testMergeEmptyAndNonEmpty.

/**
 * Test of merge method, of class PolicyMerger.
 */
public void testMergeEmptyAndNonEmpty() {
    final Collection<Policy> policies = new LinkedList<Policy>();
    policies.add(Policy.createEmptyPolicy());
    AssertionData assertionData = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion1"));
    PolicyAssertion assertion = new PolicyAssertion(assertionData, null) {
    };
    Collection<PolicyAssertion> assertions = new LinkedList<PolicyAssertion>();
    assertions.add(assertion);
    AssertionSet assertionSet = AssertionSet.createAssertionSet(assertions);
    Collection<AssertionSet> assertionSets = new LinkedList<AssertionSet>();
    assertionSets.add(assertionSet);
    Policy expResult = Policy.createPolicy(assertionSets);
    policies.add(expResult);
    final PolicyMerger instance = PolicyMerger.getMerger();
    final Policy result = instance.merge(policies);
    assertEquals(expResult, result);
}
Also used : QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData) LinkedList(java.util.LinkedList)

Example 33 with AssertionData

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

the class PolicyMergerTest method testMergeTwo2.

/**
 * Test of merge method, of class PolicyMerger.
 */
public void testMergeTwo2() {
    AssertionData assertionData1 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion1"));
    AssertionData assertionData2 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion2"));
    AssertionData assertionData3 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion3"));
    AssertionData assertionData4 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion4"));
    PolicyAssertion assertion1 = new PolicyAssertion(assertionData1, null) {
    };
    PolicyAssertion assertion2 = new PolicyAssertion(assertionData2, null) {
    };
    PolicyAssertion assertion3 = new PolicyAssertion(assertionData3, null) {
    };
    PolicyAssertion assertion4 = new PolicyAssertion(assertionData4, null) {
    };
    Collection<PolicyAssertion> assertions1 = new LinkedList<PolicyAssertion>();
    assertions1.add(assertion1);
    assertions1.add(assertion2);
    assertions1.add(assertion3);
    assertions1.add(assertion4);
    AssertionSet assertionSet1 = AssertionSet.createAssertionSet(assertions1);
    Collection<AssertionSet> assertionSets1 = new LinkedList<AssertionSet>();
    assertionSets1.add(assertionSet1);
    Policy policy1 = Policy.createPolicy(assertionSets1);
    AssertionData assertionData23 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion3"));
    AssertionData assertionData24 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion4"));
    AssertionData assertionData25 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion5"));
    AssertionData assertionData26 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion6"));
    PolicyAssertion assertion23 = new PolicyAssertion(assertionData23, null) {
    };
    PolicyAssertion assertion24 = new PolicyAssertion(assertionData24, null) {
    };
    PolicyAssertion assertion25 = new PolicyAssertion(assertionData25, null) {
    };
    PolicyAssertion assertion26 = new PolicyAssertion(assertionData26, null) {
    };
    Collection<PolicyAssertion> assertions2 = new LinkedList<PolicyAssertion>();
    assertions2.add(assertion23);
    assertions2.add(assertion24);
    assertions2.add(assertion25);
    assertions2.add(assertion26);
    AssertionSet assertionSet2 = AssertionSet.createAssertionSet(assertions2);
    Collection<AssertionSet> assertionSets2 = new LinkedList<AssertionSet>();
    assertionSets2.add(assertionSet2);
    Policy policy2 = Policy.createPolicy(assertionSets2);
    final Collection<Policy> policies = new LinkedList<Policy>();
    policies.add(policy1);
    policies.add(policy2);
    Collection<PolicyAssertion> assertionsExp = new LinkedList<PolicyAssertion>();
    assertionsExp.add(assertion1);
    assertionsExp.add(assertion2);
    assertionsExp.add(assertion3);
    assertionsExp.add(assertion4);
    assertionsExp.add(assertion25);
    assertionsExp.add(assertion26);
    AssertionSet assertionSetExp = AssertionSet.createAssertionSet(assertionsExp);
    Collection<AssertionSet> assertionSetsExp = new LinkedList<AssertionSet>();
    assertionSetsExp.add(assertionSetExp);
    Policy expResult = Policy.createPolicy(assertionSetsExp);
    final PolicyMerger instance = PolicyMerger.getMerger();
    final Policy result = instance.merge(policies);
    assertEquals(expResult, result);
}
Also used : QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData) LinkedList(java.util.LinkedList)

Example 34 with AssertionData

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

the class PolicyMergerTest method testMergeTwo.

/**
 * Test of merge method, of class PolicyMerger.
 */
public void testMergeTwo() {
    AssertionData assertionData1 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion1"));
    PolicyAssertion assertion1 = new PolicyAssertion(assertionData1, null) {
    };
    Collection<PolicyAssertion> assertions1 = new LinkedList<PolicyAssertion>();
    assertions1.add(assertion1);
    AssertionSet assertionSet1 = AssertionSet.createAssertionSet(assertions1);
    Collection<AssertionSet> assertionSets1 = new LinkedList<AssertionSet>();
    assertionSets1.add(assertionSet1);
    Policy policy1 = Policy.createPolicy(assertionSets1);
    AssertionData assertionData2 = AssertionData.createAssertionData(new QName("http://example.test/", "Assertion2"));
    PolicyAssertion assertion2 = new PolicyAssertion(assertionData2, null) {
    };
    Collection<PolicyAssertion> assertions2 = new LinkedList<PolicyAssertion>();
    assertions2.add(assertion2);
    AssertionSet assertionSet2 = AssertionSet.createAssertionSet(assertions2);
    Collection<AssertionSet> assertionSets2 = new LinkedList<AssertionSet>();
    assertionSets2.add(assertionSet2);
    Policy policy2 = Policy.createPolicy(assertionSets2);
    final Collection<Policy> policies = new LinkedList<Policy>();
    policies.add(policy1);
    policies.add(policy2);
    Collection<PolicyAssertion> assertionsExp = new LinkedList<PolicyAssertion>();
    assertionsExp.add(assertion1);
    assertionsExp.add(assertion2);
    AssertionSet assertionSetExp = AssertionSet.createAssertionSet(assertionsExp);
    Collection<AssertionSet> assertionSetsExp = new LinkedList<AssertionSet>();
    assertionSetsExp.add(assertionSetExp);
    Policy expResult = Policy.createPolicy(assertionSetsExp);
    final PolicyMerger instance = PolicyMerger.getMerger();
    final Policy result = instance.merge(policies);
    assertEquals(expResult, result);
}
Also used : QName(javax.xml.namespace.QName) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData) LinkedList(java.util.LinkedList)

Example 35 with AssertionData

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

the class ManagedServiceAssertionTest method testMonitoringAttribute.

public void testMonitoringAttribute() 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);
    final ManagedServiceAssertion instance = new ManagedServiceAssertion(data, null);
    final Setting result = instance.monitoringAttribute();
    assertSame(Setting.NOT_SET, result);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) Setting(com.sun.xml.ws.api.config.management.policy.ManagementAssertion.Setting) AssertionData(com.sun.xml.ws.policy.sourcemodel.AssertionData)

Aggregations

AssertionData (com.sun.xml.ws.policy.sourcemodel.AssertionData)54 QName (javax.xml.namespace.QName)49 HashMap (java.util.HashMap)39 LinkedList (java.util.LinkedList)16 Setting (com.sun.xml.ws.api.config.management.policy.ManagementAssertion.Setting)10 PolicyAssertion (com.sun.xml.ws.policy.PolicyAssertion)9 ImplementationRecord (com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.ImplementationRecord)7 SimpleAssertion (com.sun.xml.ws.policy.SimpleAssertion)7 NestedParameters (com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion.NestedParameters)5 ModelNode (com.sun.xml.ws.policy.sourcemodel.ModelNode)3 PolicySourceModel (com.sun.xml.ws.policy.sourcemodel.PolicySourceModel)3 AssertionSet (com.sun.xml.ws.policy.AssertionSet)2 PolicyModelTranslator (com.sun.xml.ws.policy.sourcemodel.PolicyModelTranslator)2 ModelTranslator (com.sun.xml.ws.api.policy.ModelTranslator)1 Policy (com.sun.xml.ws.policy.Policy)1 AssertionCreationException (com.sun.xml.ws.policy.spi.AssertionCreationException)1 WebServiceException (jakarta.xml.ws.WebServiceException)1 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)1 StringReader (java.io.StringReader)1 URI (java.net.URI)1