Search in sources :

Example 11 with HighLevelRecordWithDefault

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

Example 12 with HighLevelRecordWithDefault

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

the class TestFillInDefaultValue method testGetDataNoFillIn.

@DataProvider(name = "testGetDataNoFillIn")
private Object[][] testGetDataNoFillIn() throws CloneNotSupportedException {
    DataMap data = new DataMap();
    data.put("noDefaultFieldA", 1);
    HighLevelRecordWithDefault expected = new HighLevelRecordWithDefault(data.clone());
    return new Object[][] { { 1L, expected } };
}
Also used : DataMap(com.linkedin.data.DataMap) HighLevelRecordWithDefault(com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault) DataProvider(org.testng.annotations.DataProvider)

Example 13 with HighLevelRecordWithDefault

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

the class TestFillInDefaultValue method testBatchGetData.

@DataProvider(name = "testBatchGetData")
private Object[][] testBatchGetData() throws CloneNotSupportedException {
    HighLevelRecordWithDefault a = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(1);
    HighLevelRecordWithDefault b = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(2);
    HighLevelRecordWithDefault c = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(3);
    return new Object[][] { { new Long[] { 1L, 2L, 3L }, new HighLevelRecordWithDefault[] { a, b, c } } };
}
Also used : HighLevelRecordWithDefault(com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault) DataProvider(org.testng.annotations.DataProvider)

Example 14 with HighLevelRecordWithDefault

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

the class TestFillInDefaultValue method testGetAllDataWithoutRequireDefault.

@DataProvider(name = "testGetAllDataWithoutRequireDefault")
private Object[][] testGetAllDataWithoutRequireDefault() throws CloneNotSupportedException {
    final int count = 3;
    List<HighLevelRecordWithDefault> elements = new ArrayList<>();
    for (int i = 0; i < count; i++) {
        elements.add(new HighLevelRecordWithDefault().setNoDefaultFieldA(i));
    }
    CollectionMetadata collectionMetadata = new CollectionMetadata().setLinks(new LinkArray()).setCount(10).setStart(0).setTotal(3);
    LowLevelRecordWithDefault metadata = new LowLevelRecordWithDefault();
    return new Object[][] { { elements, collectionMetadata, metadata } };
}
Also used : CollectionMetadata(com.linkedin.restli.common.CollectionMetadata) LinkArray(com.linkedin.restli.common.LinkArray) ArrayList(java.util.ArrayList) LowLevelRecordWithDefault(com.linkedin.restli.examples.defaults.api.LowLevelRecordWithDefault) HighLevelRecordWithDefault(com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault) DataProvider(org.testng.annotations.DataProvider)

Example 15 with HighLevelRecordWithDefault

use of com.linkedin.restli.examples.defaults.api.HighLevelRecordWithDefault 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)16 FillInDefaultsRequestBuilders (com.linkedin.restli.examples.defaults.api.FillInDefaultsRequestBuilders)8 Test (org.testng.annotations.Test)8 DataProvider (org.testng.annotations.DataProvider)6 LowLevelRecordWithDefault (com.linkedin.restli.examples.defaults.api.LowLevelRecordWithDefault)5 ArrayList (java.util.ArrayList)4 CollectionMetadata (com.linkedin.restli.common.CollectionMetadata)3 LinkArray (com.linkedin.restli.common.LinkArray)3 DataMap (com.linkedin.data.DataMap)2 FillInDefaultsGetRequestBuilder (com.linkedin.restli.examples.defaults.api.FillInDefaultsGetRequestBuilder)2 RecordCriteria (com.linkedin.restli.examples.defaults.api.RecordCriteria)2 CollectionResult (com.linkedin.restli.server.CollectionResult)2 BatchFinderCriteriaResult (com.linkedin.restli.common.BatchFinderCriteriaResult)1 EntityResponse (com.linkedin.restli.common.EntityResponse)1 BatchFinder (com.linkedin.restli.server.annotations.BatchFinder)1 Finder (com.linkedin.restli.server.annotations.Finder)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1