Search in sources :

Example 41 with DataProvider

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

the class TestClientBuilders method batch.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "batch")
public Object[][] batch() {
    //Sample URIs:
    //"test?ids=1&ids=2&ids=3"
    //"test?ids=List(1,2,3)"
    final Set<String> idSet = new HashSet<String>();
    idSet.add("1");
    idSet.add("2");
    idSet.add("3");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test", idSet, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test", idSet, 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) DataProvider(org.testng.annotations.DataProvider)

Example 42 with DataProvider

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

the class TestClientBuilders method action.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "action")
public Object[][] action() {
    //Sample valid URIs:
    //"test/1?action=action"
    //"test/1?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(), "test/1", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test/1", 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 43 with DataProvider

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

the class TestVersionNegotiation method getProtocolVersionClient.

@DataProvider(name = "data")
public Object[][] getProtocolVersionClient() {
    ProtocolVersion lessThanDefaultVersion = new ProtocolVersion(0, 5, 0);
    ProtocolVersion betweenDefaultAndLatestVersion = new ProtocolVersion(2, 5, 0);
    ProtocolVersion greaterThanLatestVersion = new ProtocolVersion(3, 5, 0);
    ProtocolVersion greaterThanNextVersion = new ProtocolVersion(3, 5, 0);
    return new Object[][] { // baseline protocol "advertised" + graceful option => baseline protocol version
    { _BASELINE_VERSION, ProtocolVersionOption.USE_LATEST_IF_AVAILABLE, _BASELINE_VERSION }, // latest protocol "advertised" + force latest option => latest protocol version
    { _LATEST_VERSION, ProtocolVersionOption.FORCE_USE_LATEST, _LATEST_VERSION }, // baseline protocol "advertised" + force latest option => latest protocol version 
    { _BASELINE_VERSION, ProtocolVersionOption.FORCE_USE_LATEST, _LATEST_VERSION }, // latest protocol "advertised" + graceful option => latest protocol version 
    { _LATEST_VERSION, ProtocolVersionOption.USE_LATEST_IF_AVAILABLE, _LATEST_VERSION }, // use the version "advertised" by the server as it is less than the latest protocol version
    { betweenDefaultAndLatestVersion, ProtocolVersionOption.USE_LATEST_IF_AVAILABLE, betweenDefaultAndLatestVersion }, // servers should support it as well.
    { greaterThanNextVersion, ProtocolVersionOption.USE_LATEST_IF_AVAILABLE, _LATEST_VERSION }, // force latest option => latest protocol version 
    { betweenDefaultAndLatestVersion, ProtocolVersionOption.FORCE_USE_LATEST, _LATEST_VERSION }, // force latest option => latest protocol version 
    { lessThanDefaultVersion, ProtocolVersionOption.FORCE_USE_LATEST, _LATEST_VERSION }, // if servers "advertise" a version that is greater than the latest version we always use the latest version
    { greaterThanLatestVersion, ProtocolVersionOption.FORCE_USE_LATEST, _LATEST_VERSION }, // if servers "advertise" a version that is greater than the latest version we always use the latest version
    { greaterThanLatestVersion, ProtocolVersionOption.USE_LATEST_IF_AVAILABLE, _LATEST_VERSION }, // default version "advertised" + force next => next
    { _BASELINE_VERSION, ProtocolVersionOption.FORCE_USE_NEXT, _NEXT_VERSION }, // latest version "advertised" + force next => next
    { _LATEST_VERSION, ProtocolVersionOption.FORCE_USE_NEXT, _NEXT_VERSION }, // next "advertised" + force next => next
    { _NEXT_VERSION, ProtocolVersionOption.FORCE_USE_NEXT, _NEXT_VERSION }, // version between default and latest "advertised" + force next => next
    { betweenDefaultAndLatestVersion, ProtocolVersionOption.FORCE_USE_NEXT, _NEXT_VERSION }, // version greater than latest "advertised" + force next => next
    { greaterThanLatestVersion, ProtocolVersionOption.FORCE_USE_NEXT, _NEXT_VERSION }, // default version "advertised" + force next => next
    { _BASELINE_VERSION, ProtocolVersionOption.FORCE_USE_PREVIOUS, _PREV_VERSION }, // latest version "advertised" + force next => next
    { _LATEST_VERSION, ProtocolVersionOption.FORCE_USE_PREVIOUS, _PREV_VERSION }, // next "advertised" + force next => next
    { _NEXT_VERSION, ProtocolVersionOption.FORCE_USE_PREVIOUS, _PREV_VERSION }, // version between default and latest "advertised" + force next => next
    { betweenDefaultAndLatestVersion, ProtocolVersionOption.FORCE_USE_PREVIOUS, _PREV_VERSION }, // version greater than latest "advertised" + force next => next
    { greaterThanLatestVersion, ProtocolVersionOption.FORCE_USE_PREVIOUS, _PREV_VERSION } };
}
Also used : ProtocolVersion(com.linkedin.restli.common.ProtocolVersion) DataProvider(org.testng.annotations.DataProvider)

Example 44 with DataProvider

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

the class TestClientBuilders method builderParam.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "builderParam")
public Object[][] builderParam() {
    //Sample URIs:
    //"test/1?arrayKey1=3&arrayKey1=4&arrayKey1=5&arrayKey2=3&arrayKey2=4&arrayKey2=5&simpleKey=2"
    //"test/1?arrayKey1=List(3,4,5)&arrayKey2=List(3,4,5)&simpleKey=2"
    final Map<String, Object> queryParamsMap = new HashMap<String, Object>();
    queryParamsMap.put("simpleKey", "2");
    final DataList arrayKey1List = new DataList();
    arrayKey1List.add("3");
    arrayKey1List.add("4");
    arrayKey1List.add("5");
    final DataList arrayKey2List = new DataList();
    arrayKey2List.add("3");
    arrayKey2List.add("4");
    arrayKey2List.add("5");
    queryParamsMap.put("arrayKey1", arrayKey1List);
    queryParamsMap.put("arrayKey2", arrayKey2List);
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "test/1", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "test/1", null, queryParamsMap, null);
    return new Object[][] { { uriDetails1 }, { uriDetails2 } };
}
Also used : DataList(com.linkedin.data.DataList) URIDetails(com.linkedin.restli.internal.testutils.URIDetails) HashMap(java.util.HashMap) ByteString(com.linkedin.data.ByteString) DataProvider(org.testng.annotations.DataProvider)

Example 45 with DataProvider

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

the class TestClientBuilders method subResourceAction2.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "subResourceAction2")
public Object[][] subResourceAction2() {
    //Sample URIs:
    //"foo/bar/http%3A%2F%2Fexample.com%2Fimages%2F1.png/baz?action=action"
    //"foo/bar/http%3A%2F%2Fexample.com%2Fimages%2F1.png/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/http%3A%2F%2Fexample.com%2Fimages%2F1.png/baz", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "foo/bar/http%3A%2F%2Fexample.com%2Fimages%2F1.png/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)

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