use of org.apache.cxf.transport.http.policy.impl.ServerPolicyCalculator in project cxf by apache.
the class AbstractHTTPDestination method assertMessage.
public void assertMessage(Message message) {
PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class);
pde.assertMessage(message, calcServerPolicy(message), new ServerPolicyCalculator());
}
use of org.apache.cxf.transport.http.policy.impl.ServerPolicyCalculator in project cxf by apache.
the class HTTPServerAssertionBuilderTest method testBuildAssertion.
@Test
public void testBuildAssertion() throws Exception {
HTTPServerAssertionBuilder ab = new HTTPServerAssertionBuilder();
Assertion a = ab.buildAssertion();
assertTrue(a instanceof JaxbAssertion);
assertTrue(a instanceof HTTPServerAssertionBuilder.HTTPServerPolicyAssertion);
assertEquals(new ServerPolicyCalculator().getDataClassName(), a.getName());
assertTrue(!a.isOptional());
}
use of org.apache.cxf.transport.http.policy.impl.ServerPolicyCalculator in project cxf by apache.
the class PolicyUtilsTest method testAssertServerPolicy.
void testAssertServerPolicy(boolean outbound) {
Message message = control.createMock(Message.class);
HTTPServerPolicy ep = new HTTPServerPolicy();
HTTPServerPolicy mp = new HTTPServerPolicy();
HTTPServerPolicy cmp = new HTTPServerPolicy();
cmp.setReceiveTimeout(60000L);
HTTPServerPolicy icmp = new HTTPServerPolicy();
icmp.setSuppressClientSendErrors(true);
AssertionInfo eai = getServerPolicyAssertionInfo(ep);
AssertionInfo mai = getServerPolicyAssertionInfo(mp);
AssertionInfo cmai = getServerPolicyAssertionInfo(cmp);
AssertionInfo icmai = getServerPolicyAssertionInfo(icmp);
Collection<AssertionInfo> ais = new ArrayList<>();
ais.add(eai);
ais.add(mai);
ais.add(cmai);
ais.add(icmai);
AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class));
aim.put(new ServerPolicyCalculator().getDataClassName(), ais);
EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim).atLeastOnce();
Exchange ex = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange()).andReturn(ex).atLeastOnce();
EasyMock.expect(ex.getOutMessage()).andReturn(outbound ? message : null).atLeastOnce();
if (!outbound) {
EasyMock.expect(ex.getOutFaultMessage()).andReturn(null).atLeastOnce();
}
control.replay();
new PolicyDataEngineImpl(null).assertMessage(message, ep, new ServerPolicyCalculator());
assertTrue(eai.isAsserted());
assertTrue(mai.isAsserted());
assertTrue(outbound ? cmai.isAsserted() : !cmai.isAsserted());
assertTrue(outbound ? icmai.isAsserted() : !icmai.isAsserted());
control.verify();
}
Aggregations