Search in sources :

Example 6 with TransferOwnershipRequest

use of com.linkedin.restli.examples.groups.api.TransferOwnershipRequest in project rest.li by linkedin.

the class TestGreetingsClient method testRecordAction.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testRecordAction(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();
    ResponseFuture<Greeting> responseFuture = getClient().sendRequest(request);
    Assert.assertEquals(responseFuture.getResponse().getStatus(), 200);
    Assert.assertNotNull(responseFuture.getResponse().getEntity());
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) TransferOwnershipRequest(com.linkedin.restli.examples.groups.api.TransferOwnershipRequest) Test(org.testng.annotations.Test)

Example 7 with TransferOwnershipRequest

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);
}
Also used : FieldDef(com.linkedin.data.template.FieldDef) DynamicRecordTemplate(com.linkedin.data.template.DynamicRecordTemplate) HashMap(java.util.HashMap) TransferOwnershipRequest(com.linkedin.restli.examples.groups.api.TransferOwnershipRequest) Test(org.testng.annotations.Test)

Aggregations

TransferOwnershipRequest (com.linkedin.restli.examples.groups.api.TransferOwnershipRequest)7 Test (org.testng.annotations.Test)7 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)5 BooleanArray (com.linkedin.data.template.BooleanArray)1 DynamicRecordTemplate (com.linkedin.data.template.DynamicRecordTemplate)1 FieldDef (com.linkedin.data.template.FieldDef)1 StringMap (com.linkedin.data.template.StringMap)1 EmptyRecord (com.linkedin.restli.common.EmptyRecord)1 HashMap (java.util.HashMap)1