Search in sources :

Example 16 with URIDetails

use of com.linkedin.restli.internal.testutils.URIDetails in project rest.li by linkedin.

the class TestClientBuilders method batchCompoundKey.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "batchCompoundKey")
public Object[][] batchCompoundKey() {
    //Sample URIs:
    //"test?ids=part1%3D1%26part2%3D2&ids=part1%3D11%26part2%3D22",
    //"test?ids=List((part1:1,part2:2),(part1:11,part2:22))");
    //Note that we need two different ID sets, one for V1 and one for V2 since batch operations on compound keys
    //are unique.
    final Set<String> idSetV1 = new HashSet<String>();
    idSetV1.add("part1=1&part2=2");
    idSetV1.add("part1=11&part2=22");
    final Set<DataMap> idSetV2 = new HashSet<DataMap>();
    final DataMap id1 = new DataMap();
    id1.put("part1", "1");
    id1.put("part2", "2");
    final DataMap id2 = new DataMap();
    id2.put("part1", "11");
    id2.put("part2", "22");
    idSetV2.add(id1);
    idSetV2.add(id2);
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test", idSetV1, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test", idSetV2, null, null);
    return new Object[][] { { uriDetails1 }, { uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) ByteString(com.linkedin.data.ByteString) HashSet(java.util.HashSet) DataMap(com.linkedin.data.DataMap) DataProvider(org.testng.annotations.DataProvider)

Example 17 with URIDetails

use of com.linkedin.restli.internal.testutils.URIDetails in project rest.li by linkedin.

the class TestClientBuilders method search3.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "search3")
public Object[][] search3() {
    //Sample URIs:
    //"test/key=a%3Ab?count=4&p=42&q=search"
    //"test/(key:a%3Ab)?count=4&p=42&q=search"
    final Map<String, String> queryParamsMap = new HashMap<String, String>();
    queryParamsMap.put("p", "42");
    queryParamsMap.put("q", "search");
    queryParamsMap.put("count", "4");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test/key=a%3Ab", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test/(key:a%3Ab)", null, queryParamsMap, null);
    return new Object[][] { { uriDetails1 }, { uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) HashMap(java.util.HashMap) ByteString(com.linkedin.data.ByteString) DataProvider(org.testng.annotations.DataProvider)

Example 18 with URIDetails

use of com.linkedin.restli.internal.testutils.URIDetails in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestContactsBatchDataProvider.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestContactsBatchDataProvider")
private static Object[][] requestContactsBatchDataProvider() {
    //Sample URIs:
    //"groups/1/contacts?ids=1&ids=3"
    //"groups/1/contacts?ids=List(1,3)"
    final Set<String> idSet = new HashSet<String>();
    idSet.add("1");
    idSet.add("3");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "groups/1/contacts", idSet, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "groups/1/contacts", idSet, null, null);
    return new Object[][] { { uriDetails1 }, { uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) HashSet(java.util.HashSet) DataProvider(org.testng.annotations.DataProvider)

Example 19 with URIDetails

use of com.linkedin.restli.internal.testutils.URIDetails in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestMembershipsBatchDataProviderBatch.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestMembershipsBatchDataProvider")
private static Object[][] requestMembershipsBatchDataProviderBatch() {
    //Sample URIs:
    //"groupMemberships?ids=groupID%3D1%26memberID%3D1&ids=groupID%3D2%26memberID%3D1&ids=groupID%3D2%26memberID%3D2"
    //"groupMemberships?ids=List((groupID:2,memberID:1),(groupID:2,memberID:2),(groupID:1,memberID:1))"
    //Note that we need two different ID sets, one for V1 and one for V2 since batch operations on compound keys
    //are unique.
    final Set<String> idSetV1 = new HashSet<String>();
    idSetV1.add("groupID=2&memberID=1");
    idSetV1.add("groupID=2&memberID=2");
    idSetV1.add("groupID=1&memberID=1");
    final Set<DataMap> idSetV2 = new HashSet<DataMap>();
    final DataMap id1 = new DataMap();
    id1.put("groupID", "2");
    id1.put("memberID", "1");
    final DataMap id2 = new DataMap();
    id2.put("groupID", "2");
    id2.put("memberID", "2");
    final DataMap id3 = new DataMap();
    id3.put("groupID", "1");
    id3.put("memberID", "1");
    idSetV2.add(id1);
    idSetV2.add(id2);
    idSetV2.add(id3);
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "groupMemberships", idSetV1, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "groupMemberships", idSetV2, null, null);
    return new Object[][] { { uriDetails1 }, { uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) HashSet(java.util.HashSet) DataMap(com.linkedin.data.DataMap) DataProvider(org.testng.annotations.DataProvider)

Example 20 with URIDetails

use of com.linkedin.restli.internal.testutils.URIDetails in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestContactsBuilderDataProviderAction.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestContactsBuilderDataProviderAction")
private static Object[][] requestContactsBuilderDataProviderAction() {
    //Sample URIs:
    //"groups/42/contacts?action=spamContacts"
    //"groups/42/contacts?action=spamContacts"
    final Map<String, String> queryParamsMap = new HashMap<String, String>();
    queryParamsMap.put("action", "spamContacts");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "groups/42/contacts", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "groups/42/contacts", null, queryParamsMap, null);
    return new Object[][] { { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails2 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) HashMap(java.util.HashMap) ContactsRequestBuilders(com.linkedin.restli.examples.groups.client.ContactsRequestBuilders) ContactsBuilders(com.linkedin.restli.examples.groups.client.ContactsBuilders) GroupContact(com.linkedin.restli.examples.groups.api.GroupContact) DataProvider(org.testng.annotations.DataProvider)

Aggregations

URIDetails (com.linkedin.restli.internal.testutils.URIDetails)68 DataProvider (org.testng.annotations.DataProvider)65 HashMap (java.util.HashMap)39 ByteString (com.linkedin.data.ByteString)34 HashSet (java.util.HashSet)20 Group (com.linkedin.restli.examples.groups.api.Group)10 GroupsBuilders (com.linkedin.restli.examples.groups.client.GroupsBuilders)10 GroupsRequestBuilders (com.linkedin.restli.examples.groups.client.GroupsRequestBuilders)10 DataMap (com.linkedin.data.DataMap)7 CompoundKey (com.linkedin.restli.common.CompoundKey)4 GroupContact (com.linkedin.restli.examples.groups.api.GroupContact)4 GroupMembership (com.linkedin.restli.examples.groups.api.GroupMembership)4 ContactsBuilders (com.linkedin.restli.examples.groups.client.ContactsBuilders)4 ContactsRequestBuilders (com.linkedin.restli.examples.groups.client.ContactsRequestBuilders)4 GroupMembershipsBuilders (com.linkedin.restli.examples.groups.client.GroupMembershipsBuilders)4 GroupMembershipsRequestBuilders (com.linkedin.restli.examples.groups.client.GroupMembershipsRequestBuilders)4 CollectionMetadata (com.linkedin.restli.common.CollectionMetadata)3 CollectionResponse (com.linkedin.restli.common.CollectionResponse)3 Test (org.testng.annotations.Test)3 DataComplex (com.linkedin.data.DataComplex)2