Here you can find the source of generateMetricsDataWithAllWrongTypes(String metricPostfix, boolean generateRandomTenant, long collectionTime)
public static List<Map<String, Object>> generateMetricsDataWithAllWrongTypes(String metricPostfix, boolean generateRandomTenant, long collectionTime)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Random; import java.util.TreeMap; public class Main { private static final Random random = new Random(); public static List<Map<String, Object>> generateMetricsDataWithAllWrongTypes(String metricPostfix, boolean generateRandomTenant, long collectionTime) { List<Map<String, Object>> metricsList = new ArrayList<Map<String, Object>>(); // String metric value Map<String, Object> testMetric = new TreeMap<String, Object>(); if (generateRandomTenant) { testMetric.put("tenantId", random.nextInt()); }/*from w w w .j a v a2 s . c o m*/ testMetric.put("metricName", "mzord.string.metric" + metricPostfix); testMetric.put("ttlInSeconds", 1234566); testMetric.put("unit", "milliseconds"); testMetric.put("metricValue", "random_string"); testMetric.put("collectionTime", collectionTime); metricsList.add(testMetric); // String numeric metric value testMetric = new TreeMap<String, Object>(); if (generateRandomTenant) { testMetric.put("tenantId", random.nextInt()); } testMetric.put("metricName", "mzord.string.numeric.metric" + metricPostfix); testMetric.put("ttlInSeconds", 1234566); testMetric.put("unit", "milliseconds"); testMetric.put("metricValue", "666"); testMetric.put("collectionTime", collectionTime); metricsList.add(testMetric); // boolean metric value testMetric = new TreeMap<String, Object>(); if (generateRandomTenant) { testMetric.put("tenantId", random.nextInt()); } testMetric.put("metricName", "mzord.boolean.metric" + metricPostfix); testMetric.put("ttlInSeconds", 1234566); testMetric.put("unit", "milliseconds"); testMetric.put("metricValue", true); testMetric.put("collectionTime", collectionTime); metricsList.add(testMetric); return metricsList; } }