@Test public void testEmptyButValidMultiJSON() { String badJson = "[]"; List<AggregatedPayload> bundle = HttpAggregatedMultiIngestionHandler.createBundleList(badJson); }
public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonElement element = parser.parse(json); if (!element.isJsonArray()) { throw new InvalidDataException("Invalid request body"); } JsonArray jArray = element.getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = AggregatedPayload.create(obj); bundleList.add(bundle); } return bundleList; }
HttpAggregatedMultiIngestionHandler implements HttpRequestHandler { public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonElement element = parser.parse(json); if (!element.isJsonArray()) { throw new InvalidDataException("Invalid request body"); } JsonArray jArray = element.getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = AggregatedPayload.create(obj); bundleList.add(bundle); } return bundleList; } }
HttpAggregatedMultiIngestionHandler implements HttpRequestHandler { public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonElement element = parser.parse(json); if (!element.isJsonArray()) { throw new InvalidDataException("Invalid request body"); } JsonArray jArray = element.getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = AggregatedPayload.create(obj); bundleList.add(bundle); } return bundleList; } HttpAggregatedMultiIngestionHandler(HttpMetricsIngestionServer.Processor processor, TimeValue timeout);  HttpAggregatedMultiIngestionHandler(HttpMetricsIngestionServer.Processor processor, TimeValue timeout, boolean enablePerTenantMetrics); }
HttpAggregatedMultiIngestionHandler implements HttpRequestHandler { public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonElement element = parser.parse(json); if (!element.isJsonArray()) { throw new InvalidDataException("Invalid request body"); } JsonArray jArray = element.getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = AggregatedPayload.create(obj); bundleList.add(bundle); } return bundleList; } HttpAggregatedMultiIngestionHandler(HttpMetricsIngestionServer.Processor processor, TimeValue timeout);  HttpAggregatedMultiIngestionHandler(HttpMetricsIngestionServer.Processor processor, TimeValue timeout, boolean enablePerTenantMetrics); @Override void handle(ChannelHandlerContext ctx, FullHttpRequest request); static List<AggregatedPayload> createBundleList(String json); }
HttpAggregatedMultiIngestionHandler implements HttpRequestHandler { public static List<AggregatedPayload> createBundleList(String json) { Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonElement element = parser.parse(json); if (!element.isJsonArray()) { throw new InvalidDataException("Invalid request body"); } JsonArray jArray = element.getAsJsonArray(); ArrayList<AggregatedPayload> bundleList = new ArrayList<AggregatedPayload>(); for(JsonElement obj : jArray ) { AggregatedPayload bundle = AggregatedPayload.create(obj); bundleList.add(bundle); } return bundleList; } HttpAggregatedMultiIngestionHandler(HttpMetricsIngestionServer.Processor processor, TimeValue timeout);  HttpAggregatedMultiIngestionHandler(HttpMetricsIngestionServer.Processor processor, TimeValue timeout, boolean enablePerTenantMetrics); @Override void handle(ChannelHandlerContext ctx, FullHttpRequest request); static List<AggregatedPayload> createBundleList(String json);  }