Search in sources :

Example 1 with PolicyEngineImpl

use of org.apache.cxf.ws.policy.PolicyEngineImpl 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)

Example 2 with PolicyEngineImpl

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

the class AbstractPolicyProvider method setBus.

public final void setBus(Bus b) {
    bus = b;
    if (null != bus) {
        setBuilder(bus.getExtension(PolicyBuilder.class));
        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
        if (pe != null) {
            setRegistry(pe.getRegistry());
            ((PolicyEngineImpl) pe).addPolicyProvider(this);
        }
    }
}
Also used : PolicyEngineImpl(org.apache.cxf.ws.policy.PolicyEngineImpl) PolicyEngine(org.apache.cxf.ws.policy.PolicyEngine) PolicyBuilder(org.apache.cxf.ws.policy.PolicyBuilder)

Example 3 with PolicyEngineImpl

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

the class RMEndpointTest method testSetPoliciesEngineDisabled.

@Test
public void testSetPoliciesEngineDisabled() {
    Message m = new MessageImpl();
    Bus bus = control.createMock(Bus.class);
    EasyMock.expect(manager.getBus()).andReturn(bus);
    PolicyEngineImpl pe = control.createMock(PolicyEngineImpl.class);
    EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(pe);
    EasyMock.expect(pe.isEnabled()).andReturn(false);
    control.replay();
    rme.setPolicies(m);
}
Also used : PolicyEngineImpl(org.apache.cxf.ws.policy.PolicyEngineImpl) Bus(org.apache.cxf.Bus) Message(org.apache.cxf.message.Message) MessageImpl(org.apache.cxf.message.MessageImpl) Test(org.junit.Test)

Aggregations

PolicyEngineImpl (org.apache.cxf.ws.policy.PolicyEngineImpl)3 Bus (org.apache.cxf.Bus)2 PolicyEngine (org.apache.cxf.ws.policy.PolicyEngine)2 Test (org.junit.Test)2 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 Message (org.apache.cxf.message.Message)1 MessageImpl (org.apache.cxf.message.MessageImpl)1 PolicyBuilder (org.apache.cxf.ws.policy.PolicyBuilder)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