Package org.apache.cxf.ws.policy.builder.primitive

Examples of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion


   
    @Test
    public void testCheckEffectivePolicy() {
        Policy p = new Policy();
        QName aqn = new QName("http://x.y.z", "a");
        PolicyAssertion a = new PrimitiveAssertion(aqn);
        QName bqn = new QName("http://x.y.z", "b");
        PolicyAssertion b = new PrimitiveAssertion(bqn);
        QName cqn = new QName("http://x.y.z", "c");
        PolicyAssertion c = new PrimitiveAssertion(cqn);
        All alt1 = new All();
        alt1.addAssertion(a);
        alt1.addAssertion(b);
        All alt2 = new All();
        alt2.addAssertion(c);
View Full Code Here


    }
   
    @Test
    public void testCheck() throws PolicyException {
        QName aqn = new QName("http://x.y.z", "a");
        PolicyAssertion a = new PrimitiveAssertion(aqn);
        Collection<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>();
        assertions.add(a);
        AssertionInfoMap aim = new AssertionInfoMap(assertions);
        try {
            aim.check();
View Full Code Here

   
    @Test
    public void testAllAssertionsIn() {
       
        Policy nested = new Policy();
        PolicyAssertion nb = new PrimitiveAssertion(
            new QName("http://x.y.z", "b"));
        nested.addAssertion(nb);
       
        Policy p = new Policy();
        PolicyAssertion a1 = new PrimitiveAssertion(
                                new QName("http://x.y.z", "a"));
        PolicyAssertion a2 = new PrimitiveAssertion(
                                 new QName("http://x.y.z", "a"));
        PolicyAssertion b = new PrimitiveAssertion(
                                new QName("http://x.y.z", "b"));
        PolicyAssertion c = new NestedPrimitiveAssertion(
                               new QName("http://x.y.z", "c"), false, nested, true);
       
        All alt1 = new All();
View Full Code Here

    }

    private AssertionInfoMap createTestAssertions() {
        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST,
                                                                   PolicyAssertion.class));
        Assertion a = new PrimitiveAssertion(ONEWAY_QNAME);
        Assertion b = new PrimitiveAssertion(DUPLEX_QNAME);

        AssertionInfo ai = new AssertionInfo(a);
        AssertionInfo bi = new AssertionInfo(b);

        aim.put(ONEWAY_QNAME, Collections.singleton(ai));
View Full Code Here

        String local = "UsingAddressing";
        if ("http://www.w3.org/2005/08/addressing".equals(addressingNamespace)) {
            ns = "http://www.w3.org/2007/02/addressing/metadata";
            local = "Addressing";
        }
        return new PrimitiveAssertion(new QName(ns, local), true);
    }
View Full Code Here

    void setUpAttachment(Object subject, boolean applies, ExternalAttachmentProvider eap) {
        attachments.clear();
        attachment = control.createMock(PolicyAttachment.class);
        attachments.add(attachment);
        policy = new Policy();
        assertion = new PrimitiveAssertion(TEST_ASSERTION_TYPE);
        policy.addAssertion(assertion);
        eap.setAttachments(attachments);
        if (subject instanceof ServiceInfo) {
            EasyMock.expect(attachment.appliesTo((ServiceInfo)subject)).andReturn(applies);
        } else if (subject instanceof EndpointInfo) {
View Full Code Here

        }
        if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn)) {
            PolicyBuilder builder = bus.getExtension(PolicyBuilder.class);
            return new NestedPrimitiveAssertion(elem, builder);
        } else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn)) {
            return new PrimitiveAssertion(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME,
                                          optional);
        } else if (MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME.getLocalPart()
            .equals(localName)) {
            return new PrimitiveAssertion(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME,
                                          optional);
        }
        return null;
    }
View Full Code Here

public class PolicyTest extends Assert {
    @Test
    public void testContains() {
        List<Assertion> alt1 = new ArrayList<Assertion>();
        Assertion a11 = new PrimitiveAssertion(new QName("http://x.y.z", "a1"));
        alt1.add(a11);
        Assertion a12 = new PrimitiveAssertion(new QName("http://x.y.z", "a2"));
        alt1.add(a12);
       
        List<Assertion> alt2 = new ArrayList<Assertion>();
        Assertion a21 = new PrimitiveAssertion(new QName("http://x.y.z", "a1"));
        alt2.add(a21);

        assertTrue("second alternative should be contained in first alternative",
                   PolicyUtils.contains(alt1, alt2));   
    }
View Full Code Here

        Policy p1 = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p1.addPolicyComponent(ea);
        All all = new All();
        ea.addPolicyComponent(all);
        all.addPolicyComponent(new PrimitiveAssertion(new QName(uri1, "a1")));
        all = new All();
        ea.addPolicyComponent(all);
        all.addPolicyComponent(new PrimitiveAssertion(new QName(uri1, "a2")));
       
        String uri2 = "http://a.b.c";
        Policy p2 = new Policy();
        ea = new ExactlyOne();
        p2.addPolicyComponent(ea);
        all = new All();
        ea.addPolicyComponent(all);
        all.addPolicyComponent(new PrimitiveAssertion(new QName(uri2, "x1")));
        all = new All();
        ea.addPolicyComponent(all);
        all.addPolicyComponent(new PrimitiveAssertion(new QName(uri2, "x2")));
       
        System.out.println("p1:");
        PolicyUtils.printPolicyComponent(p1);
        System.out.println();
        System.out.println("p2:");
View Full Code Here

    }
   
    Policy getOneAssertion() {
        String uri = "http://www.w3.org/2007/01/addressing/metadata";
        Policy p = new Policy();
        p.addAssertion(new PrimitiveAssertion(new QName(uri, "AnonymousResponses"), false));
        return p;
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.