Search in sources :

Example 1 with PolicyProvider

use of org.apache.cxf.ws.policy.PolicyProvider in project cxf by apache.

the class PolicyBeansTest method testParse.

@Test
public void testParse() {
    Bus bus = new SpringBusFactory().createBus("org/apache/cxf/ws/policy/spring/beans.xml");
    try {
        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
        assertTrue("Policy engine is not enabled", pe.isEnabled());
        assertTrue("Unknown assertions are not ignored", pe.isIgnoreUnknownAssertions());
        assertEquals(MaximalAlternativeSelector.class.getName(), pe.getAlternativeSelector().getClass().getName());
        PolicyEngineImpl pei = (PolicyEngineImpl) pe;
        Collection<PolicyProvider> providers = pei.getPolicyProviders();
        assertEquals(4, providers.size());
        int n = 0;
        for (PolicyProvider pp : providers) {
            if (pp instanceof ExternalAttachmentProvider) {
                n++;
            }
        }
        assertEquals("Unexpected number of external providers", 2, n);
    } finally {
        bus.shutdown(true);
    }
}
Also used : PolicyEngineImpl(org.apache.cxf.ws.policy.PolicyEngineImpl) Bus(org.apache.cxf.Bus) MaximalAlternativeSelector(org.apache.cxf.ws.policy.selector.MaximalAlternativeSelector) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) PolicyProvider(org.apache.cxf.ws.policy.PolicyProvider) PolicyEngine(org.apache.cxf.ws.policy.PolicyEngine) ExternalAttachmentProvider(org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider) Test(org.junit.Test)

Aggregations

Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 PolicyEngine (org.apache.cxf.ws.policy.PolicyEngine)1 PolicyEngineImpl (org.apache.cxf.ws.policy.PolicyEngineImpl)1 PolicyProvider (org.apache.cxf.ws.policy.PolicyProvider)1 ExternalAttachmentProvider (org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider)1 MaximalAlternativeSelector (org.apache.cxf.ws.policy.selector.MaximalAlternativeSelector)1 Test (org.junit.Test)1