Search in sources :

Example 46 with DataProvider

use of org.testng.annotations.DataProvider in project rest.li by linkedin.

the class TestClientBuilders method getAll3.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "getAll3")
public Object[][] getAll3() {
    //Sample URIs:
    //"test?count=4"
    //"test?count=4"
    final Map<String, String> queryParamsMap = new HashMap<String, String>();
    queryParamsMap.put("count", "4");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test", 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 47 with DataProvider

use of org.testng.annotations.DataProvider 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 48 with DataProvider

use of org.testng.annotations.DataProvider 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 49 with DataProvider

use of org.testng.annotations.DataProvider in project rest.li by linkedin.

the class TestUriParamUtils method encoding.

@DataProvider
public Object[][] encoding() {
    // create objects
    // test internal encoding
    // forbidden characters: '(),:
    DataMap internalEncodingMap = new DataMap();
    DataList internalEncodingList = new DataList();
    internalEncodingList.add("'");
    internalEncodingList.add("(");
    internalEncodingList.add(")");
    internalEncodingList.add(":");
    internalEncodingMap.put(",", internalEncodingList);
    // test external encoding
    DataMap externalEncodingMap = new DataMap();
    DataList externalEncodingList = new DataList();
    externalEncodingList.add("/");
    externalEncodingList.add("=");
    externalEncodingList.add("&");
    externalEncodingMap.put("this is a key", externalEncodingList);
    // test %
    DataMap percentEncodingMap = new DataMap();
    percentEncodingMap.put("%25", "%");
    return new Object[][] { { internalEncodingMap, "(%2C:List(%27,%28,%29,%3A))", "(%2C:List(%27,%28,%29,%3A))", "(%2C:List(%27,%28,%29,%3A))" }, { externalEncodingMap, "(this is a key:List(/,=,&))", "(this%20is%20a%20key:List(%2F,=,&))", "(this%20is%20a%20key:List(/,%3D,%26))" }, { percentEncodingMap, "(%2525:%25)", "(%2525:%25)", "(%2525:%25)" } };
}
Also used : DataList(com.linkedin.data.DataList) DataMap(com.linkedin.data.DataMap) DataProvider(org.testng.annotations.DataProvider)

Example 50 with DataProvider

use of org.testng.annotations.DataProvider in project rest.li by linkedin.

the class TestUriParamUtils method maps.

@DataProvider
private static Object[][] maps() {
    DataMap simpleMap = new DataMap();
    simpleMap.put("a", "b");
    DataMap longerMap = new DataMap();
    longerMap.put("a", "b");
    longerMap.put("c", "d");
    DataMap withEmptyStrings = new DataMap();
    withEmptyStrings.put("", "");
    DataMap nestedMap1 = new DataMap();
    nestedMap1.put("c", simpleMap);
    DataMap nestedMap2 = new DataMap();
    DataList list = new DataList();
    list.add(1);
    list.add(2);
    nestedMap2.put("empty", new DataMap());
    nestedMap2.put("list", list);
    nestedMap2.put("long", longerMap);
    return new Object[][] { { simpleMap, "(a:b)" }, { longerMap, "(a:b,c:d)" }, { new DataMap(), "()" }, { withEmptyStrings, "('':'')" }, { nestedMap1, "(c:(a:b))" }, { nestedMap2, "(empty:(),list:List(1,2),long:(a:b,c:d))" } };
}
Also used : DataList(com.linkedin.data.DataList) DataMap(com.linkedin.data.DataMap) DataProvider(org.testng.annotations.DataProvider)

Aggregations

DataProvider (org.testng.annotations.DataProvider)391 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)99 ArrayList (java.util.ArrayList)93 Test (org.testng.annotations.Test)85 File (java.io.File)74 List (java.util.List)72 Assert (org.testng.Assert)67 URIDetails (com.linkedin.restli.internal.testutils.URIDetails)65 Collectors (java.util.stream.Collectors)61 HashMap (java.util.HashMap)57 IntStream (java.util.stream.IntStream)54 Random (java.util.Random)50 RealMatrix (org.apache.commons.math3.linear.RealMatrix)44 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)41 IOException (java.io.IOException)39 ByteString (com.linkedin.data.ByteString)37 Array2DRowRealMatrix (org.apache.commons.math3.linear.Array2DRowRealMatrix)34 Stream (java.util.stream.Stream)31 DoubleStream (java.util.stream.DoubleStream)29 HashSet (java.util.HashSet)28