use of org.apache.cxf.policy.PolicyDataEngine in project cxf by apache.
the class PolicyUtilsTest method testAssertClientPolicy.
void testAssertClientPolicy(boolean outbound) {
Message message = control.createMock(Message.class);
HTTPClientPolicy ep = new HTTPClientPolicy();
HTTPClientPolicy cmp = new HTTPClientPolicy();
cmp.setConnectionTimeout(60000L);
HTTPClientPolicy icmp = new HTTPClientPolicy();
icmp.setAllowChunking(false);
AssertionInfo eai = getClientPolicyAssertionInfo(ep);
AssertionInfo cmai = getClientPolicyAssertionInfo(cmp);
AssertionInfo icmai = getClientPolicyAssertionInfo(icmp);
AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class));
Collection<AssertionInfo> ais = new ArrayList<>();
ais.add(eai);
ais.add(cmai);
ais.add(icmai);
aim.put(new ClientPolicyCalculator().getDataClassName(), ais);
EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim);
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();
PolicyDataEngine pde = new PolicyDataEngineImpl(null);
pde.assertMessage(message, ep, new ClientPolicyCalculator());
assertTrue(eai.isAsserted());
assertTrue(cmai.isAsserted());
assertTrue(icmai.isAsserted());
control.verify();
}
use of org.apache.cxf.policy.PolicyDataEngine in project cxf by apache.
the class HTTPConduit method assertMessage.
public void assertMessage(Message message) {
PolicyDataEngine policyDataEngine = bus.getExtension(PolicyDataEngine.class);
policyDataEngine.assertMessage(message, getClient(), new ClientPolicyCalculator());
}
Aggregations