Search in sources :

Example 81 with ObjectMapper

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project pinot by linkedin.

the class ContributorTest method main.

public static void main(String[] args) throws Exception {
    ContributorViewRequest request = new ContributorViewRequest();
    String collection = "thirdeyeAbook";
    DateTime baselineStart = new DateTime(2016, 3, 23, 00, 00);
    List<MetricExpression> metricExpressions = new ArrayList<>();
    metricExpressions.add(new MetricExpression("__COUNT", "__COUNT"));
    request.setCollection(collection);
    request.setBaselineStart(baselineStart);
    request.setBaselineEnd(baselineStart.plusDays(1));
    request.setCurrentStart(baselineStart.plusDays(7));
    request.setCurrentEnd(baselineStart.plusDays(8));
    request.setTimeGranularity(new TimeGranularity(1, TimeUnit.HOURS));
    request.setMetricExpressions(metricExpressions);
    // TODO
    PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
    // make
    // this
    // configurable;
    QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
    ContributorViewHandler handler = new ContributorViewHandler(queryCache);
    ContributorViewResponse response = handler.process(request);
    ObjectMapper mapper = new ObjectMapper();
    String jsonResponse = mapper.writeValueAsString(response);
    System.out.println(jsonResponse);
}
Also used : PinotThirdEyeClient(com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient) ContributorViewResponse(com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewResponse) QueryCache(com.linkedin.thirdeye.client.cache.QueryCache) ContributorViewHandler(com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewHandler) ArrayList(java.util.ArrayList) TimeGranularity(com.linkedin.thirdeye.api.TimeGranularity) ContributorViewRequest(com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewRequest) MetricExpression(com.linkedin.thirdeye.client.MetricExpression) DateTime(org.joda.time.DateTime) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 82 with ObjectMapper

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project pinot by linkedin.

the class HeatMapTest method main.

public static void main(String[] args) throws Exception {
    HeatMapViewRequest request = new HeatMapViewRequest();
    String collection = "thirdeyeAbook";
    DateTime baselineStart = new DateTime(2016, 3, 23, 00, 00);
    List<MetricExpression> metricExpressions = new ArrayList<>();
    metricExpressions.add(new MetricExpression("__COUNT", "__COUNT"));
    request.setCollection(collection);
    request.setBaselineStart(baselineStart);
    request.setBaselineEnd(baselineStart.plusHours(1));
    request.setCurrentStart(baselineStart.plusDays(7));
    request.setCurrentEnd(baselineStart.plusDays(7).plusHours(1));
    request.setTimeGranularity(new TimeGranularity(1, TimeUnit.HOURS));
    request.setMetricExpressions(metricExpressions);
    // TODO
    PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
    // make
    // this
    // configurable;
    QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
    HeatMapViewHandler handler = new HeatMapViewHandler(queryCache);
    HeatMapViewResponse response = handler.process(request);
    ObjectMapper mapper = new ObjectMapper();
    String jsonResponse = mapper.writeValueAsString(response);
    System.out.println(jsonResponse);
}
Also used : PinotThirdEyeClient(com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient) QueryCache(com.linkedin.thirdeye.client.cache.QueryCache) HeatMapViewResponse(com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewResponse) ArrayList(java.util.ArrayList) HeatMapViewRequest(com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewRequest) TimeGranularity(com.linkedin.thirdeye.api.TimeGranularity) HeatMapViewHandler(com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewHandler) MetricExpression(com.linkedin.thirdeye.client.MetricExpression) DateTime(org.joda.time.DateTime) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 83 with ObjectMapper

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project pinot by linkedin.

the class TestAnomalyTaskManager method getTestTaskSpec.

TaskDTO getTestTaskSpec(JobDTO anomalyJobSpec) throws JsonProcessingException {
    TaskDTO jobSpec = new TaskDTO();
    jobSpec.setJobName("Test_Anomaly_Task");
    jobSpec.setStatus(TaskStatus.WAITING);
    jobSpec.setTaskType(TaskType.ANOMALY_DETECTION);
    jobSpec.setStartTime(new DateTime().minusDays(20).getMillis());
    jobSpec.setEndTime(new DateTime().minusDays(10).getMillis());
    jobSpec.setTaskInfo(new ObjectMapper().writeValueAsString(getTestDetectionTaskInfo()));
    jobSpec.setJobId(anomalyJobSpec.getId());
    return jobSpec;
}
Also used : TaskDTO(com.linkedin.thirdeye.datalayer.dto.TaskDTO) DateTime(org.joda.time.DateTime) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 84 with ObjectMapper

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project jersey by jersey.

the class MyObjectMapperProvider method createDefaultMapper.

private static ObjectMapper createDefaultMapper() {
    final ObjectMapper result = new ObjectMapper();
    result.enable(SerializationFeature.INDENT_OUTPUT);
    return result;
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 85 with ObjectMapper

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project jersey by jersey.

the class MyObjectMapperProvider method getContext.

@Override
public ObjectMapper getContext(Class<?> type) {
    if (type == Issue2322Resource.JsonString1.class) {
        ObjectMapper result = new ObjectMapper();
        result.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
        result.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
        return result;
    } else {
        return new ObjectMapper();
    }
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6071 Test (org.junit.Test)2235 IOException (java.io.IOException)1016 JsonNode (com.fasterxml.jackson.databind.JsonNode)930 HashMap (java.util.HashMap)444 Map (java.util.Map)429 ArrayList (java.util.ArrayList)416 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)388 File (java.io.File)319 List (java.util.List)268 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)254 Before (org.junit.Before)246 Test (org.junit.jupiter.api.Test)238 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)202 InputStream (java.io.InputStream)185 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)156 Matchers.containsString (org.hamcrest.Matchers.containsString)136 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)127 TypeReference (com.fasterxml.jackson.core.type.TypeReference)123 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)121