Package org.apache.cxf.ws.policy

Examples of org.apache.cxf.ws.policy.PolicyAssertion


        Message message = control.createMock(Message.class);
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(null);
        AssertionInfoMap aim = control.createMock(AssertionInfoMap.class);
        Collection<AssertionInfo> ais = new ArrayList<AssertionInfo>();
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim).times(2);
        PolicyAssertion a = control.createMock(PolicyAssertion.class);       
        AssertionInfo ai = new AssertionInfo(a);
        EasyMock.expectLastCall();
        control.replay();
        interceptor.assertReliability(message);
        assertTrue(!ai.isAsserted());
View Full Code Here


        Assertor assertor = control.createMock(Assertor.class);
              
        Policy policy = new Policy();
        ExactlyOne ea = new ExactlyOne();
        All all = new All();
        PolicyAssertion a1 = new TestAssertion();
        all.addAssertion(a1);
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> maxAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        all = new All();
View Full Code Here

        Assertor assertor = control.createMock(Assertor.class);
              
        Policy policy = new Policy();
        ExactlyOne ea = new ExactlyOne();
        All all = new All();
        PolicyAssertion a1 = new TestAssertion();
        all.addAssertion(a1);
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> maxAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        all = new All();
View Full Code Here

        Assertor assertor = control.createMock(Assertor.class);
              
        Policy policy = new Policy();
        ExactlyOne ea = new ExactlyOne();
        All all = new All();
        PolicyAssertion a1 = new TestAssertion();
        all.addAssertion(a1);
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> firstAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        policy.addPolicyComponent(ea);
View Full Code Here

        Message message = control.createMock(Message.class);
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(null);
        AssertionInfoMap aim = control.createMock(AssertionInfoMap.class);
        Collection<AssertionInfo> ais = new ArrayList<AssertionInfo>();
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim).times(2);
        PolicyAssertion a = control.createMock(PolicyAssertion.class);       
        AssertionInfo ai = new AssertionInfo(a);
        EasyMock.expectLastCall();
        control.replay();
        interceptor.assertReliability(message);
        assertTrue(!ai.isAsserted());
View Full Code Here

   
    @Test
    public void testBuildCompatibleNoRegistry() {
        npab.setAssertionBuilderRegistry(null);
        Policy[] policies = NestedPrimitiveAssertionTest.buildTestPolicies();
        PolicyAssertion a =
            (PolicyAssertion)policies[4].getFirstPolicyComponent();  
        assertNull("Should not have been able to build compatible policy.", npab.buildCompatible(a, a));
    }
View Full Code Here

        ab2.setKnownElements(Collections.singleton(TEST_NAME3));
        EasyMock.expect(reg.get(TEST_NAME2)).andReturn(ab1).anyTimes();
        EasyMock.expect(reg.get(TEST_NAME3)).andReturn(ab2).anyTimes();
       
        control.replay();
        PolicyAssertion a =
            (PolicyAssertion)policies[2].getFirstPolicyComponent();         
        PolicyAssertion compatible = npab.buildCompatible(a, a);
        assertNotNull("assertion in policy 2 should be compatible with itself.", compatible);
        control.verify();
    }
View Full Code Here

        EasyMock.expect(reg.get(TEST_NAME2)).andReturn(ab1).anyTimes();
        EasyMock.expect(reg.get(TEST_NAME3)).andReturn(ab2).anyTimes();
       
        control.replay();
        for (int i = 0; i < policies.length; i++) {
            PolicyAssertion a =
                (PolicyAssertion)policies[i].getFirstPolicyComponent();         
            PolicyAssertion compatible = npab.buildCompatible(a, a);
            assertNotNull("assertion in policy " + i + " should be compatible with itself.", compatible);
        }
       
        for (int i = 1; i < 5; i++) {
            PolicyAssertion a =
                (PolicyAssertion)policies[0].getFirstPolicyComponent();
            PolicyAssertion b = (PolicyAssertion)policies[i].getFirstPolicyComponent();
            PolicyAssertion compatible = npab.buildCompatible(a, b);
            assertNotNull("assertion in policy 0 should be compatible with assertion in policy " + i + ".",
                          compatible);
        }
       
        for (int i = 2; i < 5; i++) {
            PolicyAssertion a =
                (PolicyAssertion)policies[1].getFirstPolicyComponent();
            PolicyAssertion b =
                (PolicyAssertion)policies[i].getFirstPolicyComponent();
            PolicyAssertion compatible = npab.buildCompatible(a, b);
            assertNotNull("assertion in policy " + 1 + " should be compatible with assertion in policy i.",
                          compatible);
        }
        control.verify();
       
View Full Code Here

        policies = buildTestPolicies();
    }
   
    @Test
    public void testNoNeedToAssertWithEmptyPolicy() {
        PolicyAssertion a = new NestedPrimitiveAssertion(
                                new QName("abc"), false, null, false);
        AssertionInfoMap aim = new AssertionInfoMap(
                                Collections.singletonList(a));
        assertTrue("No need to assert", a.isAsserted(aim));
        a = new NestedPrimitiveAssertion(new QName("abc"),
                                         false,
                                         null,
                                         false);
        assertTrue("No need to assert", a.isAsserted(aim));
    }
View Full Code Here

    }
   
   
    @Test
    public void testNoNeedToAssertWithNonEmptyPolicy() {
        PolicyAssertion a = new NestedPrimitiveAssertion(
                                new QName("abc"), false, null, false);
        AssertionInfoMap aim = new AssertionInfoMap(
                                Collections.singletonList(a));
        assertTrue("No need to assert", a.isAsserted(aim));
        Policy p = new Policy();
        p.addAssertion(new PrimitiveAssertion(new QName("abc"), false));
        a = new NestedPrimitiveAssertion(new QName("abc"),
                                         false,
                                         p,
                                         false);
        assertFalse("Primitive Assertions need to be asserted",
                    a.isAsserted(aim));
       
        p = new Policy();
        p.addAssertion(new NestedPrimitiveAssertion(new QName("abc"),
                                         false,
                                         null,
                                         false));
        a = new NestedPrimitiveAssertion(new QName("abc"),
                                         false,
                                         p,
                                         false);
        assertTrue("No need to assert", a.isAsserted(aim));
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.policy.PolicyAssertion

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.