use of com.linkedin.restli.examples.groups.api.TransferOwnershipRequest in project rest.li by linkedin.
the class TestGreetingsClientAcceptTypes method testAction.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "clientDataDataProvider")
public void testAction(RestClient restClient, String expectedContentType, RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
Request<Greeting> request = builders.<Greeting>action("SomeAction").id(1L).setActionParam("A", 1).setActionParam("B", "").setActionParam("C", new TransferOwnershipRequest()).setActionParam("D", new TransferOwnershipRequest()).setActionParam("E", 3).build();
Response<Greeting> response = restClient.sendRequest(request).getResponse();
Assert.assertEquals(response.getHeader("Content-Type"), expectedContentType);
Greeting greeting = response.getEntity();
Assert.assertEquals(greeting.getMessage(), "This is a newly created greeting");
}
use of com.linkedin.restli.examples.groups.api.TransferOwnershipRequest in project rest.li by linkedin.
the class TestGreetingsClient method testRecordActionVoidReturn.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testRecordActionVoidReturn(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
Request<Void> requestVoid = builders.<Void>action("AnotherAction").setActionParam("bitfield", new BooleanArray()).setActionParam("request", new TransferOwnershipRequest()).setActionParam("someString", new String("")).setActionParam("stringMap", new StringMap()).build();
ResponseFuture<Void> responseFutureVoid = getClient().sendRequest(requestVoid);
Assert.assertEquals(responseFutureVoid.getResponse().getStatus(), 200);
Assert.assertNull(responseFutureVoid.getResponse().getEntity());
}
use of com.linkedin.restli.examples.groups.api.TransferOwnershipRequest in project rest.li by linkedin.
the class TestGreetingClientContentTypes method testAction.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "clientDataDataProvider")
public void testAction(RestClient restClient, RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
Request<Greeting> request = builders.<Greeting>action("SomeAction").id(1L).setActionParam("A", 1).setActionParam("B", "").setActionParam("C", new TransferOwnershipRequest()).setActionParam("D", new TransferOwnershipRequest()).setActionParam("E", 3).build();
Response<Greeting> response = restClient.sendRequest(request).getResponse();
Greeting greeting = response.getEntity();
Assert.assertEquals(greeting.getMessage(), "This is a newly created greeting");
}
use of com.linkedin.restli.examples.groups.api.TransferOwnershipRequest in project rest.li by linkedin.
the class TestGreetingClientContentTypes method testPostsWithCharset.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testPostsWithCharset(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
Request<Greeting> request = builders.<Greeting>action("SomeAction").id(1L).setActionParam("A", 1).setActionParam("B", "").setActionParam("C", new TransferOwnershipRequest()).setActionParam("D", new TransferOwnershipRequest()).setActionParam("E", 3).setHeader("Content-Type", "application/json; charset=UTF-8").build();
Response<Greeting> response = getClient().sendRequest(request).getResponse();
Greeting actionGreeting = response.getEntity();
Assert.assertEquals(actionGreeting.getMessage(), "This is a newly created greeting");
Greeting createGreeting = new Greeting();
createGreeting.setMessage("Hello there!");
createGreeting.setTone(Tone.FRIENDLY);
Request<EmptyRecord> createRequest = builders.create().input(createGreeting).setHeader("Content-Type", "application/json; charset=UTF-8").build();
Response<EmptyRecord> emptyRecordResponse = getClient().sendRequest(createRequest).getResponse();
Assert.assertNull(emptyRecordResponse.getHeader(RestConstants.HEADER_CONTENT_TYPE));
}
use of com.linkedin.restli.examples.groups.api.TransferOwnershipRequest in project rest.li by linkedin.
the class TestGroupsRequestBuilders method testAction.
// Actions tests are covered in TestGroupsClient.java
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestGroupsBuilderDataProviderEntityAction")
public void testAction(RootBuilderWrapper<Integer, Group> builders, URIDetails expectedURIDetails) {
String testEmail = "test@test.com";
TransferOwnershipRequest ownershipRequest = new TransferOwnershipRequest();
ownershipRequest.setNewOwnerContactEmail(testEmail);
int testId = 9999;
ownershipRequest.setNewOwnerMemberID(testId);
Request<Void> request = builders.<Void>action("TransferOwnership").id(1).setActionParam("Request", ownershipRequest).build();
Map<FieldDef<?>, Object> parameters = new HashMap<FieldDef<?>, Object>(1);
parameters.put(new FieldDef<TransferOwnershipRequest>("request", TransferOwnershipRequest.class, DataTemplateUtil.getSchema(TransferOwnershipRequest.class)), ownershipRequest);
DynamicRecordTemplate requestInput = createDynamicRecordTemplate("transferOwnership", parameters);
checkRequestBuilder(request, ResourceMethod.ACTION, ActionResponseDecoder.class, expectedURIDetails, requestInput);
}
Aggregations