Search in sources :

Example 46 with StringMap

use of com.linkedin.data.template.StringMap in project rest.li by linkedin.

the class TestMap method testStringMapMap.

@Test
public void testStringMapMap() {
    TestDataTemplateUtil.FieldInfo fieldInfo = TestDataTemplateUtil.fieldInfo(new MapTest(), "stringMapMap");
    @SuppressWarnings("unchecked") Class<StringMapMap> templateClass = (Class<StringMapMap>) fieldInfo.getFieldClass();
    MapDataSchema schema = (MapDataSchema) fieldInfo.getField().getType();
    Map<String, StringMap> input = new HashMap<>();
    for (int i = 0; i < 5; ++i) {
        String key = "input" + i;
        input.put(key, new StringMap());
        input.get(key).put("subinput" + i, "subinputvalue" + i);
    }
    Map<String, StringMap> adds = new HashMap<>();
    for (int i = 0; i < 5; ++i) {
        String key = "add" + i;
        adds.put(key, new StringMap());
        adds.get(key).put("subadd" + i, "subaddvalue" + i);
    }
    TestMapTemplate.testMap(templateClass, schema, input, adds);
}
Also used : TestDataTemplateUtil(com.linkedin.data.template.TestDataTemplateUtil) StringMap(com.linkedin.data.template.StringMap) StringMapMap(com.linkedin.data.template.StringMapMap) HashMap(java.util.HashMap) MapDataSchema(com.linkedin.data.schema.MapDataSchema) Test(org.testng.annotations.Test)

Example 47 with StringMap

use of com.linkedin.data.template.StringMap in project rest.li by linkedin.

the class TestArray method testStringMapArray.

@Test
public void testStringMapArray() {
    TestDataTemplateUtil.FieldInfo fieldInfo = TestDataTemplateUtil.fieldInfo(new ArrayTest(), "stringMapArray");
    @SuppressWarnings("unchecked") Class<StringMapArray> templateClass = (Class<StringMapArray>) fieldInfo.getFieldClass();
    ArrayDataSchema schema = (ArrayDataSchema) fieldInfo.getField().getType();
    List<StringMap> input = new ArrayList<>();
    for (int i = 0; i < 5; ++i) {
        input.add(new StringMap());
        input.get(i).put("input key " + i, "value " + i);
    }
    List<StringMap> adds = new ArrayList<>();
    for (int i = 0; i < 5; ++i) {
        adds.add(new StringMap());
        input.get(i).put("add key " + i, "value " + i);
    }
    TestArrayTemplate.testArray(templateClass, schema, input, adds);
}
Also used : ArrayDataSchema(com.linkedin.data.schema.ArrayDataSchema) TestDataTemplateUtil(com.linkedin.data.template.TestDataTemplateUtil) StringMap(com.linkedin.data.template.StringMap) StringMapArray(com.linkedin.data.template.StringMapArray) ArrayList(java.util.ArrayList) Test(org.testng.annotations.Test)

Aggregations

StringMap (com.linkedin.data.template.StringMap)47 Test (org.testng.annotations.Test)26 RestLiResponseException (com.linkedin.restli.client.RestLiResponseException)9 FlowConfig (org.apache.gobblin.service.FlowConfig)9 FlowId (org.apache.gobblin.service.FlowId)9 Schedule (org.apache.gobblin.service.Schedule)9 Map (java.util.Map)8 IndividualRequest (com.linkedin.restli.common.multiplexer.IndividualRequest)6 IndividualRequestMap (com.linkedin.restli.common.multiplexer.IndividualRequestMap)5 TaskExecutionInfo (org.apache.gobblin.rest.TaskExecutionInfo)5 ByteString (com.linkedin.data.ByteString)4 DataMap (com.linkedin.data.DataMap)4 Meter (com.codahale.metrics.Meter)3 RestRequest (com.linkedin.r2.message.rest.RestRequest)3 RoutingResult (com.linkedin.restli.internal.server.RoutingResult)3 PreparedStatement (java.sql.PreparedStatement)3 AbstractMap (java.util.AbstractMap)3 JobExecutionInfo (org.apache.gobblin.rest.JobExecutionInfo)3 Metric (org.apache.gobblin.rest.Metric)3 MetricArray (org.apache.gobblin.rest.MetricArray)3