Search in sources :

Example 1 with MyCustomString

use of com.linkedin.restli.common.MyCustomString in project rest.li by linkedin.

the class TestResponseUtils method testConvertCustomTyperefKey.

public void testConvertCustomTyperefKey() {
    MyCustomString customStringKey = (MyCustomString) ResponseUtils.convertKey("foo", TypeSpec.forClassMaybeNull(MyCustomStringRef.class), null, null, AllProtocolVersions.BASELINE_PROTOCOL_VERSION);
    Assert.assertEquals(customStringKey, new MyCustomString("foo"));
}
Also used : MyCustomString(com.linkedin.restli.common.MyCustomString)

Example 2 with MyCustomString

use of com.linkedin.restli.common.MyCustomString in project rest.li by linkedin.

the class TestMockBatchCreateIdResponseFactory method provideKeys.

@DataProvider
public Object[][] provideKeys() {
    Greeting g1 = buildGreeting(1L);
    Greeting g2 = buildGreeting(2L);
    Greeting g3 = buildGreeting(3L);
    return new Object[][] { new Object[] { new Long[] { 1L, 2L, 3L } }, new Object[] { new MyCustomString[] { new MyCustomString("1"), new MyCustomString("2"), new MyCustomString("3") } }, new Object[] { new CompoundKey[] { buildCompoundKey("c1", 1), buildCompoundKey("c2", 2), buildCompoundKey("c3", 3) } }, new Object[] { new ComplexResourceKey<?, ?>[] { new ComplexResourceKey<Greeting, Greeting>(g1, g1), new ComplexResourceKey<Greeting, Greeting>(g2, g2), new ComplexResourceKey<Greeting, Greeting>(g3, g3) } } };
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) MyCustomString(com.linkedin.restli.common.MyCustomString) CompoundKey(com.linkedin.restli.common.CompoundKey) ComplexResourceKey(com.linkedin.restli.common.ComplexResourceKey) DataProvider(org.testng.annotations.DataProvider)

Example 3 with MyCustomString

use of com.linkedin.restli.common.MyCustomString in project rest.li by linkedin.

the class TestMockBatchKVResponseFactory method customPrimitiveTyperefKeyData.

@DataProvider(name = "customPrimitiveTyperefKey")
public Object[][] customPrimitiveTyperefKeyData() {
    MyCustomString m1 = new MyCustomString("1");
    MyCustomString m2 = new MyCustomString("2");
    MyCustomString m3 = new MyCustomString("3");
    Map<MyCustomString, Greeting> recordTemplates = new HashMap<MyCustomString, Greeting>();
    Map<MyCustomString, ErrorResponse> errorResponses = new HashMap<MyCustomString, ErrorResponse>();
    recordTemplates.put(m1, buildGreeting(1L));
    recordTemplates.put(m2, buildGreeting(2L));
    errorResponses.put(m3, new ErrorResponse().setMessage("3"));
    Map<MyCustomString, HttpStatus> statuses = new HashMap<MyCustomString, HttpStatus>();
    statuses.put(m1, HttpStatus.S_200_OK);
    statuses.put(m2, HttpStatus.S_200_OK);
    statuses.put(m3, HttpStatus.S_500_INTERNAL_SERVER_ERROR);
    Map<MyCustomString, EntityResponse<Greeting>> expectedResults = new HashMap<MyCustomString, EntityResponse<Greeting>>();
    expectedResults.put(m1, buildEntityResponse(recordTemplates.get(m1), HttpStatus.S_200_OK, null));
    expectedResults.put(m2, buildEntityResponse(recordTemplates.get(m2), HttpStatus.S_200_OK, null));
    expectedResults.put(m3, buildEntityResponse(null, HttpStatus.S_500_INTERNAL_SERVER_ERROR, errorResponses.get(m3)));
    return new Object[][] { { recordTemplates, statuses, errorResponses, expectedResults } };
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) MyCustomString(com.linkedin.restli.common.MyCustomString) HashMap(java.util.HashMap) HttpStatus(com.linkedin.restli.common.HttpStatus) EntityResponse(com.linkedin.restli.common.EntityResponse) ErrorResponse(com.linkedin.restli.common.ErrorResponse) DataProvider(org.testng.annotations.DataProvider)

Aggregations

MyCustomString (com.linkedin.restli.common.MyCustomString)3 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)2 DataProvider (org.testng.annotations.DataProvider)2 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)1 CompoundKey (com.linkedin.restli.common.CompoundKey)1 EntityResponse (com.linkedin.restli.common.EntityResponse)1 ErrorResponse (com.linkedin.restli.common.ErrorResponse)1 HttpStatus (com.linkedin.restli.common.HttpStatus)1 HashMap (java.util.HashMap)1