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);
}
}
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);
}
}
}
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);
}
Aggregations