use of org.apache.cxf.jaxrs.client.WebClient in project camel by apache.
the class CxfRsSpringConsumerTest method testInvokeCxfRsConsumer.
@Test
public void testInvokeCxfRsConsumer() throws Exception {
String address = "http://localhost:" + port1 + "/CxfRsSpringConsumerInvokeService/customerservice/customers/123";
WebClient wc = WebClient.create(address);
Customer c = wc.accept("application/json").get(Customer.class);
assertEquals(246L, c.getId());
}
use of org.apache.cxf.jaxrs.client.WebClient in project fastjson by alibaba.
the class FastJsonProviderTest method test0.
@Test
public void test0() throws Exception {
JSONObject json = new JSONObject();
json.put("id", 123);
json.put("name", "哈哈哈");
WebClient client = WebClient.create(REST_SERVICE_URL);
Response response = client.path("/fastjson/test1").accept("application/json").type("application/json; charset=UTF-8").post(json.toJSONString());
System.out.println(response.readEntity(String.class));
}
use of org.apache.cxf.jaxrs.client.WebClient in project fastjson by alibaba.
the class FastJsonProviderTest method test2.
@Test
public void test2() throws Exception {
String jsonStr = "[{\"name\":\"p1\",\"sonList\":[{\"name\":\"s1\"}]},{\"name\":\"p2\",\"sonList\":[{\"name\":\"s2\"},{\"name\":\"s3\"}]}]";
WebClient client = WebClient.create(REST_SERVICE_URL);
Response response = client.path("/fastjson/test2").accept("application/json").type("application/json; charset=UTF-8").post(jsonStr);
System.out.println(response.readEntity(String.class));
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestRestServiceProxyAuthentication method test005getUserSelfByProxyHead.
/**
* even though head is a superuser, it is not allowed for service application to switch to this user,
* therefore head is not allowed to read user administrator using inpersonation
*/
@Test
public void test005getUserSelfByProxyHead() {
final String TEST_NAME = "test005getUserSelfByProxyHead";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_HEAD_OID);
client.path("/self");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 403);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertFailedProxyLogin(SchemaConstants.CHANNEL_REST_URI);
}
use of org.apache.cxf.jaxrs.client.WebClient in project midpoint by Evolveum.
the class TestRestServiceProxyAuthentication method test001getUserSelfBySomebody.
@Test
public void test001getUserSelfBySomebody() {
final String TEST_NAME = "test001getUserSelfBySomebody";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_SOMEBODY_OID);
client.path("/self/");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 200);
UserType userType = response.readEntity(UserType.class);
assertNotNull("Returned entity in body must not be null.", userType);
LOGGER.info("Returned entity: {}", userType.asPrismObject().debugDump());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
Aggregations