use of org.apache.cxf.transport.http.policy.impl.ClientPolicyCalculator in project cxf by apache.
the class ClientPolicyCalculatorTest method testEqualClientPolicies.
@Test
public void testEqualClientPolicies() {
ClientPolicyCalculator calc = new ClientPolicyCalculator();
HTTPClientPolicy p1 = new HTTPClientPolicy();
assertTrue(calc.equals(p1, p1));
HTTPClientPolicy p2 = new HTTPClientPolicy();
assertTrue(calc.equals(p1, p2));
p1.setDecoupledEndpoint("http://localhost:8080/decoupled");
assertFalse(calc.equals(p1, p2));
p2.setDecoupledEndpoint("http://localhost:8080/decoupled");
assertTrue(calc.equals(p1, p2));
p1.setReceiveTimeout(10000L);
assertFalse(calc.equals(p1, p2));
}
use of org.apache.cxf.transport.http.policy.impl.ClientPolicyCalculator in project cxf by apache.
the class ClientPolicyCalculatorTest method testIntersectClientPolicies.
@Test
public void testIntersectClientPolicies() {
ThreadLocalRandom random = ThreadLocalRandom.current();
ClientPolicyCalculator calc = new ClientPolicyCalculator();
HTTPClientPolicy p1 = new HTTPClientPolicy();
HTTPClientPolicy p2 = new HTTPClientPolicy();
p1.setBrowserType("browser");
HTTPClientPolicy p = calc.intersect(p1, p2);
assertEquals("browser", p.getBrowserType());
p1.setBrowserType(null);
long connectionRequestTimeout = random.nextLong(0, 10000);
p1.setConnectionRequestTimeout(connectionRequestTimeout);
p = calc.intersect(p1, p2);
assertEquals(connectionRequestTimeout, p.getConnectionRequestTimeout());
long receiveTimeout = random.nextLong(0, 10000);
p1.setReceiveTimeout(receiveTimeout);
p = calc.intersect(p1, p2);
assertEquals(receiveTimeout, p.getReceiveTimeout());
long connectionTimeout = random.nextLong(0, 10000);
p1.setConnectionTimeout(connectionTimeout);
p = calc.intersect(p1, p2);
assertEquals(connectionTimeout, p.getConnectionTimeout());
p1.setAllowChunking(false);
p2.setAllowChunking(false);
p = calc.intersect(p1, p2);
assertFalse(p.isAllowChunking());
}
use of org.apache.cxf.transport.http.policy.impl.ClientPolicyCalculator 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