Search in sources :

Example 1 with RecordCriteria

use of com.linkedin.restli.examples.defaults.api.RecordCriteria 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);
}
Also used : BatchFinderCriteriaResult(com.linkedin.restli.common.BatchFinderCriteriaResult) RecordCriteria(com.linkedin.restli.examples.defaults.api.RecordCriteria) FillInDefaultsRequestBuilders(com.linkedin.restli.examples.defaults.api.FillInDefaultsRequestBuilders) HighLevelRecordWithDefault(com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 2 with RecordCriteria

use of com.linkedin.restli.examples.defaults.api.RecordCriteria in project rest.li by linkedin.

the class TestFillInDefaultValue method testBatchFinderData.

@DataProvider(name = "testBatchFinderData")
private Object[][] testBatchFinderData() throws CloneNotSupportedException {
    HighLevelRecordWithDefault expected1 = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(1);
    HighLevelRecordWithDefault expected2 = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(2);
    return new Object[][] { { new RecordCriteria[] { new RecordCriteria().setIntWithoutDefault(1), new RecordCriteria().setIntWithoutDefault(2) }, new HighLevelRecordWithDefault[] { expected1, expected2 } } };
}
Also used : RecordCriteria(com.linkedin.restli.examples.defaults.api.RecordCriteria) HighLevelRecordWithDefault(com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault) DataProvider(org.testng.annotations.DataProvider)

Aggregations

HighLevelRecordWithDefault (com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault)2 RecordCriteria (com.linkedin.restli.examples.defaults.api.RecordCriteria)2 BatchFinderCriteriaResult (com.linkedin.restli.common.BatchFinderCriteriaResult)1 FillInDefaultsRequestBuilders (com.linkedin.restli.examples.defaults.api.FillInDefaultsRequestBuilders)1 HashSet (java.util.HashSet)1 DataProvider (org.testng.annotations.DataProvider)1 Test (org.testng.annotations.Test)1