test_class.file: metrics-influxdb/src/test/java/com/izettle/metrics/influxdb/utils/InfluxDbWriteObjectSerializerTest.java
test_class.identifier: InfluxDbWriteObjectSerializerTest
test_case.body: @Test
      public void groupedLinesShouldFoldValueFields() {
          Map<String, String> tags = new HashMap<String, String>();
          tags.put("tag1Key", "tag1Value");
          Map<String, Object> fields1 = new HashMap<String, Object>();
          fields1.put("value", "111");
          Map<String, Object> fields2 = new HashMap<String, Object>();
          fields2.put("value", "222");
          InfluxDbPoint point1 = new InfluxDbPoint("aa.bb.cc1", tags, 456l, fields1);
          InfluxDbPoint point2 = new InfluxDbPoint("aa.bb.cc2", tags, 456l, fields2);
          Set<InfluxDbPoint> set = new HashSet<InfluxDbPoint>();
          set.add(point1);
          set.add(point2);
          InfluxDbWriteObject influxDbWriteObject = mock(InfluxDbWriteObject.class);
          when(influxDbWriteObject.getPoints()).thenReturn(set);
          when(influxDbWriteObject.getPrecision()).thenReturn(TimeUnit.MICROSECONDS);
          InfluxDbWriteObjectSerializer influxDbWriteObjectSerializer = new InfluxDbWriteObjectSerializer("");
          String lineString = influxDbWriteObjectSerializer.getGroupedLineProtocolString(influxDbWriteObject, "xxx");
          assertThat(lineString).isEqualTo("xxx,tag1Key=tag1Value bb.cc2=\"222\",bb.cc1=\"111\" 456000\n");
      }
test_case.class_method_signature: InfluxDbWriteObjectSerializerTest.groupedLinesShouldFoldValueFields()
test_case.full_signature: @Test public void groupedLinesShouldFoldValueFields()
test_case.identifier: groupedLinesShouldFoldValueFields
test_case.invocations: put put put add add mock thenReturn when getPoints thenReturn when getPrecision getGroupedLineProtocolString isEqualTo assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void groupedLinesShouldFoldValueFields()
focal_class.declarator: COMMA = Pattern.compile(",")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern COMMA = Pattern.compile(",");
focal_class.type: Pattern
focal_class.var_name: COMMA
focal_class.declarator: SPACE = Pattern.compile(" ")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern SPACE = Pattern.compile(" ");
focal_class.type: Pattern
focal_class.var_name: SPACE
focal_class.declarator: EQUAL = Pattern.compile("=")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern EQUAL = Pattern.compile("=");
focal_class.type: Pattern
focal_class.var_name: EQUAL
focal_class.declarator: DOUBLE_QUOTE = Pattern.compile("\"")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern DOUBLE_QUOTE = Pattern.compile("\"");
focal_class.type: Pattern
focal_class.var_name: DOUBLE_QUOTE
focal_class.declarator: FIELD = Pattern.compile("\\.")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern FIELD = Pattern.compile("\\.");
focal_class.type: Pattern
focal_class.var_name: FIELD
focal_class.declarator: measurementPrefix
focal_class.modifier: private final
focal_class.original_string: private final String measurementPrefix;
focal_class.type: String
focal_class.var_name: measurementPrefix
focal_class.file: metrics-influxdb/src/main/java/com/izettle/metrics/influxdb/utils/InfluxDbWriteObjectSerializer.java
focal_class.identifier: InfluxDbWriteObjectSerializer
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.InfluxDbWriteObjectSerializer(String measurementPrefix)
focal_class.full_signature: public  InfluxDbWriteObjectSerializer(String measurementPrefix)
focal_class.identifier: InfluxDbWriteObjectSerializer
focal_class.modifiers: public
focal_class.parameters: (String measurementPrefix)
focal_class.signature:  InfluxDbWriteObjectSerializer(String measurementPrefix)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.getLineProtocolString(InfluxDbWriteObject influxDbWriteObject)
focal_class.full_signature: public String getLineProtocolString(InfluxDbWriteObject influxDbWriteObject)
focal_class.identifier: getLineProtocolString
focal_class.modifiers: public
focal_class.parameters: (InfluxDbWriteObject influxDbWriteObject)
focal_class.return: String
focal_class.signature: String getLineProtocolString(InfluxDbWriteObject influxDbWriteObject)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_class.full_signature: public String getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_class.identifier: getGroupedLineProtocolString
focal_class.modifiers: public
focal_class.parameters: (InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_class.return: String
focal_class.signature: String getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.mergeFields(Map<String, Object> dest, Map<String, Object> src, String measurement)
focal_class.full_signature: private void mergeFields(Map<String, Object> dest, Map<String, Object> src, String measurement)
focal_class.identifier: mergeFields
focal_class.modifiers: private
focal_class.parameters: (Map<String, Object> dest, Map<String, Object> src, String measurement)
focal_class.return: void
focal_class.signature: void mergeFields(Map<String, Object> dest, Map<String, Object> src, String measurement)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.pointLineProtocol(InfluxDbPoint point, TimeUnit precision, StringBuilder stringBuilder)
focal_class.full_signature: private void pointLineProtocol(InfluxDbPoint point, TimeUnit precision, StringBuilder stringBuilder)
focal_class.identifier: pointLineProtocol
focal_class.modifiers: private
focal_class.parameters: (InfluxDbPoint point, TimeUnit precision, StringBuilder stringBuilder)
focal_class.return: void
focal_class.signature: void pointLineProtocol(InfluxDbPoint point, TimeUnit precision, StringBuilder stringBuilder)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.lineProtocol(Map<String, String> tags, Map<String, Object> fields,
              String measurement, Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.full_signature: private void lineProtocol(Map<String, String> tags, Map<String, Object> fields,
              String measurement, Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.identifier: lineProtocol
focal_class.modifiers: private
focal_class.parameters: (Map<String, String> tags, Map<String, Object> fields,
              String measurement, Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.return: void
focal_class.signature: void lineProtocol(Map<String, String> tags, Map<String, Object> fields,
              String measurement, Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.concatenatedTags(Map<String, String> tags, StringBuilder stringBuilder)
focal_class.full_signature: private void concatenatedTags(Map<String, String> tags, StringBuilder stringBuilder)
focal_class.identifier: concatenatedTags
focal_class.modifiers: private
focal_class.parameters: (Map<String, String> tags, StringBuilder stringBuilder)
focal_class.return: void
focal_class.signature: void concatenatedTags(Map<String, String> tags, StringBuilder stringBuilder)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.concatenateFields(Map<String, Object> fields, StringBuilder stringBuilder)
focal_class.full_signature: private void concatenateFields(Map<String, Object> fields, StringBuilder stringBuilder)
focal_class.identifier: concatenateFields
focal_class.modifiers: private
focal_class.parameters: (Map<String, Object> fields, StringBuilder stringBuilder)
focal_class.return: void
focal_class.signature: void concatenateFields(Map<String, Object> fields, StringBuilder stringBuilder)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.formattedTime(Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.full_signature: private void formattedTime(Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.identifier: formattedTime
focal_class.modifiers: private
focal_class.parameters: (Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.return: void
focal_class.signature: void formattedTime(Long time, TimeUnit precision, StringBuilder stringBuilder)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.escapeKey(String key)
focal_class.full_signature: private String escapeKey(String key)
focal_class.identifier: escapeKey
focal_class.modifiers: private
focal_class.parameters: (String key)
focal_class.return: String
focal_class.signature: String escapeKey(String key)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.escapeMeasurement(String key)
focal_class.full_signature: private String escapeMeasurement(String key)
focal_class.identifier: escapeMeasurement
focal_class.modifiers: private
focal_class.parameters: (String key)
focal_class.return: String
focal_class.signature: String escapeMeasurement(String key)
focal_class.class_method_signature: InfluxDbWriteObjectSerializer.escapeField(String field)
focal_class.full_signature: private String escapeField(String field)
focal_class.identifier: escapeField
focal_class.modifiers: private
focal_class.parameters: (String field)
focal_class.return: String
focal_class.signature: String escapeField(String field)
focal_method.body: public String getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement) {
          // First develop a set of timestamps.
          HashSet<Long> times = new HashSet<>();
          for (InfluxDbPoint point : influxDbWriteObject.getPoints()) {
              times.add(point.getTime());
          }
  
          // Write lines, one per timestamp, instead of one per point.  Collect tags from one point
          // as all are presumed the same.
          StringBuilder stringBuilder = new StringBuilder();
          for (Long time : times) {
              Map<String, Object> fields = new HashMap<>();
              Map<String, String> tags = null;
              
              for (InfluxDbPoint point : influxDbWriteObject.getPoints()) {
                  if (point.getTime().equals(time)) {
                      mergeFields(fields, point.getFields(), point.getMeasurement());
                      tags = point.getTags();
                  }
              }
              lineProtocol(tags, fields, realMeasurement, time, influxDbWriteObject.getPrecision(),
                      stringBuilder);
              stringBuilder.append("\n");
          }
  
          return stringBuilder.toString();
      }
focal_method.class_method_signature: InfluxDbWriteObjectSerializer.getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_method.full_signature: public String getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_method.identifier: getGroupedLineProtocolString
focal_method.invocations: getPoints add getTime getPoints equals getTime mergeFields getFields getMeasurement getTags lineProtocol getPrecision append toString
focal_method.modifiers: public
focal_method.parameters: (InfluxDbWriteObject influxDbWriteObject, String realMeasurement)
focal_method.return: String
focal_method.signature: String getGroupedLineProtocolString(InfluxDbWriteObject influxDbWriteObject, String realMeasurement)