use of com.linkedin.restli.examples.defaults.api.FillInDefaultsRequestBuilders in project rest.li by linkedin.
the class TestFillInDefaultValue method testFillInDefaultAction.
@Test(dataProvider = "testActionData")
public void testFillInDefaultAction(Long actionParam) throws RemoteInvocationException {
FillInDefaultsRequestBuilders builders = new FillInDefaultsRequestBuilders();
ActionRequest<HighLevelRecordWithDefault> request = builders.actionDefaultFillAction().actionParamParam(actionParam).setParam(RestConstants.FILL_IN_DEFAULTS_PARAM, true).build();
HighLevelRecordWithDefault actual = getClient().sendRequest(request).getResponse().getEntity();
HighLevelRecordWithDefault expect = new HighLevelRecordWithDefault(expectedTestData).setNoDefaultFieldA(Math.toIntExact(actionParam));
Assert.assertEquals(actual, expect);
}
use of com.linkedin.restli.examples.defaults.api.FillInDefaultsRequestBuilders in project rest.li by linkedin.
the class TestFillInDefaultValue method testFillInDefaultBatchFinder.
@Test(dataProvider = "testBatchFinderData")
public void testFillInDefaultBatchFinder(Object[] criteria, HighLevelRecordWithDefault[] expected) throws RemoteInvocationException {
FillInDefaultsRequestBuilders builders = new FillInDefaultsRequestBuilders();
BatchFindRequest<HighLevelRecordWithDefault> request = builders.batchFindBySearchRecords().addCriteriaParam((RecordCriteria) criteria[0]).addCriteriaParam((RecordCriteria) criteria[1]).setParam(RestConstants.FILL_IN_DEFAULTS_PARAM, true).build();
List<BatchFinderCriteriaResult<HighLevelRecordWithDefault>> batchFinderCriteriaResults = getClient().sendRequest(request).getResponse().getEntity().getResults();
Set<HighLevelRecordWithDefault> actualActionResponse = new HashSet<>();
for (BatchFinderCriteriaResult<HighLevelRecordWithDefault> result : batchFinderCriteriaResults) {
actualActionResponse.addAll(result.getElements());
}
Set<HighLevelRecordWithDefault> expectedActionResponse = new HashSet<>(Arrays.asList(expected));
Assert.assertEquals(actualActionResponse, expectedActionResponse);
}
use of com.linkedin.restli.examples.defaults.api.FillInDefaultsRequestBuilders in project rest.li by linkedin.
the class TestFillInDefaultValue method testFillInDefaultGetAllWithoutRequireDefault.
@Test(dataProvider = "testGetAllDataWithoutRequireDefault")
public void testFillInDefaultGetAllWithoutRequireDefault(List<HighLevelRecordWithDefault> expectedElements, CollectionMetadata expectedCollectionMetadata, LowLevelRecordWithDefault expectedMetadata) throws RemoteInvocationException {
FillInDefaultsRequestBuilders builders = new FillInDefaultsRequestBuilders();
GetAllRequest<HighLevelRecordWithDefault> request = builders.getAll().build();
CollectionResponse<HighLevelRecordWithDefault> actual = getClient().sendRequest(request).getResponse().getEntity();
Assert.assertEquals(actual.getElements(), expectedElements);
Assert.assertEquals(actual.getPaging(), expectedCollectionMetadata);
Assert.assertEquals(actual.getMetadataRaw(), expectedMetadata.data());
}
Aggregations