Search in sources :

Example 6 with BatchCreateRequest

use of com.linkedin.restli.server.BatchCreateRequest in project rest.li by linkedin.

the class BatchCreateArgumentBuilder method buildArguments.

@Override
public Object[] buildArguments(RestLiRequestData requestData, RoutingResult routingResult) {
    @SuppressWarnings({ "unchecked", "rawtypes" }) BatchCreateRequest batchRequest = new BatchCreateRequest(requestData.getBatchEntities());
    Object[] positionalArguments = { batchRequest };
    return ArgumentBuilder.buildArgs(positionalArguments, routingResult.getResourceMethod(), routingResult.getContext(), null);
}
Also used : BatchCreateRequest(com.linkedin.restli.server.BatchCreateRequest)

Example 7 with BatchCreateRequest

use of com.linkedin.restli.server.BatchCreateRequest in project rest.li by linkedin.

the class TestRestLiMethodInvocation method testCustomCrudParamsCollectionBatchCreate.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "paramCollectionBatchCreate")
public void testCustomCrudParamsCollectionBatchCreate(ProtocolVersion version, String uri, String body) throws Exception {
    ResourceModel model = buildResourceModel(CombinedResources.CollectionWithCustomCrudParams.class);
    ResourceMethodDescriptor methodDescriptor = model.findMethod(ResourceMethod.BATCH_CREATE);
    CombinedResources.CollectionWithCustomCrudParams resource = getMockResource(CombinedResources.CollectionWithCustomCrudParams.class);
    @SuppressWarnings("rawtypes") BatchCreateRequest batchCreateRequest = (BatchCreateRequest) EasyMock.anyObject();
    @SuppressWarnings("unchecked") BatchCreateResult<String, CombinedTestDataModels.Foo> batchCreateResult = resource.myBatchCreate(batchCreateRequest, eq(1), eq("bar"));
    EasyMock.expect(batchCreateResult).andReturn(null).once();
    checkInvocation(resource, methodDescriptor, "POST", version, uri, body, buildBatchPathKeys());
}
Also used : BatchCreateRequest(com.linkedin.restli.server.BatchCreateRequest) CombinedResources(com.linkedin.restli.server.combined.CombinedResources) ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) ResourceModel(com.linkedin.restli.internal.server.model.ResourceModel) RestLiTestHelper.buildResourceModel(com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel) ByteString(com.linkedin.data.ByteString) CustomString(com.linkedin.restli.server.custom.types.CustomString) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

BatchCreateRequest (com.linkedin.restli.server.BatchCreateRequest)7 ResourceMethodDescriptor (com.linkedin.restli.internal.server.model.ResourceMethodDescriptor)6 ResourceModel (com.linkedin.restli.internal.server.model.ResourceModel)6 Test (org.testng.annotations.Test)6 RestLiTestHelper.buildResourceModel (com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel)5 AfterTest (org.testng.annotations.AfterTest)5 BeforeTest (org.testng.annotations.BeforeTest)5 ByteString (com.linkedin.data.ByteString)4 CustomString (com.linkedin.restli.server.custom.types.CustomString)4 BatchCreateResult (com.linkedin.restli.server.BatchCreateResult)3 Callback (com.linkedin.common.callback.Callback)2 RestLiCallback (com.linkedin.restli.internal.server.RestLiCallback)2 FilterChainCallback (com.linkedin.restli.internal.server.filter.FilterChainCallback)2 RequestExecutionCallback (com.linkedin.restli.server.RequestExecutionCallback)2 AsyncDiscoveredItemsResource (com.linkedin.restli.server.twitter.AsyncDiscoveredItemsResource)2 AsyncStatusCollectionResource (com.linkedin.restli.server.twitter.AsyncStatusCollectionResource)2 PromiseDiscoveredItemsResource (com.linkedin.restli.server.twitter.PromiseDiscoveredItemsResource)2 PromiseStatusCollectionResource (com.linkedin.restli.server.twitter.PromiseStatusCollectionResource)2 DiscoveredItemKey (com.linkedin.restli.server.twitter.TwitterTestDataModels.DiscoveredItemKey)2 DiscoveredItemKeyParams (com.linkedin.restli.server.twitter.TwitterTestDataModels.DiscoveredItemKeyParams)2