Search in sources :

Example 41 with URIDetails

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

the class TestClientBuilders method simpleSubResourceAction1.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "simpleSubResourceAction1")
public Object[][] simpleSubResourceAction1() {
    //"foo/1/bar?action=action"
    //"foo/1/bar?action=action"
    final Map<String, String> queryParamsMap = new HashMap<String, String>();
    queryParamsMap.put("action", "action");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "foo/1/bar", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "foo/1/bar", 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 42 with URIDetails

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

the class TestClientBuilders method search1.

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

Example 43 with URIDetails

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

the class TestClientBuilders method subResourceAction1.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "subResourceAction1")
public Object[][] subResourceAction1() {
    //Sample URIs:
    //"foo/bar/1/baz?action=action"
    //"foo/bar/1/baz?action=action"
    final Map<String, String> queryParamsMap = new HashMap<String, String>();
    queryParamsMap.put("action", "action");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "foo/bar/1/baz", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "foo/bar/1/baz", 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 44 with URIDetails

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

the class TestClientBuilders method compoundKey.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "compoundKey")
public Object[][] compoundKey() {
    //Sample URIs:
    //"test/part1=1&part2=2"
    //"test/(part1:1,part2:2)"
    //We can compare the serialized compound key as a part of the path since its always serialized into a sorted order
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test/part1=1&part2=2", null, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test/(part1:1,part2:2)", null, null, null);
    return new Object[][] { { uriDetails1 }, { uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) DataProvider(org.testng.annotations.DataProvider)

Example 45 with URIDetails

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

the class TestClientBuilders method batchComplexKey.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "batchComplexKey")
public Object[][] batchComplexKey() {
    //Sample URIs:
    //"test?ids%5B0%5D.$params.id=2&ids%5B0%5D.$params.message=paramMessage1&ids%5B0%5D.id=1&ids%5B0%5D.message=keyMessage1&ids%5B1%5D.$params.id=4&ids%5B1%5D.$params.message=paramMessage2&ids%5B1%5D.id=3&ids%5B1%5D.message=keyMessage2"
    //"test?ids=List(($params:(id:2,message:paramMessage1),id:1,message:keyMessage1),($params:(id:4,message:paramMessage2),id:3,message:keyMessage2))"
    final Set<DataMap> idList = new HashSet<DataMap>();
    final DataMap idMapOne = new DataMap();
    idMapOne.put("id", "1");
    idMapOne.put("message", "keyMessage1");
    final DataMap paramMapOne = new DataMap();
    paramMapOne.put("id", "2");
    paramMapOne.put("message", "paramMessage1");
    idMapOne.put("$params", paramMapOne);
    idList.add(idMapOne);
    final DataMap idMapTwo = new DataMap();
    idMapTwo.put("id", "3");
    idMapTwo.put("message", "keyMessage2");
    final DataMap paramMapTwo = new DataMap();
    paramMapTwo.put("id", "4");
    paramMapTwo.put("message", "paramMessage2");
    idMapTwo.put("$params", paramMapTwo);
    idList.add(idMapTwo);
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test", idList, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test", idList, 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)

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