@Test public void testMultipleValuesWithMatchingAttribute() throws Exception { OpenTSDBMessageFormatter formatter = createDefaultFormatter(); when(this.mockResult.getValuePath()). thenReturn(ImmutableList.of("X-ATT-X")); Result mockResult2 = mock(Result.class); mockResult(mockResult2); when(mockResult2.getValue()). thenReturn(210012); when(mockResult2.getValuePath()). thenReturn(ImmutableList.of("XX-ATT-XX")); Iterable<String> strings = formatter.formatResults( ImmutableList.of(this.mockResult, mockResult2), ServerFixtures.dummyServer()); Assert.assertEquals(2, Iterables.size(strings)); Iterator<String> resultStringIterator = strings.iterator(); String resultString1 = resultStringIterator.next(); String resultString2 = resultStringIterator.next(); String xLine; String xxLine; if (resultString1.contains("XX-ATT-XX")) { xxLine = resultString1; xLine = resultString2; } else { xLine = resultString1; xxLine = resultString2; } Assert.assertTrue(xLine.matches("^X-DOMAIN.PKG.CLASS-X\\.X-ATT-X 0 120021.*")); Assert.assertTrue(xLine.matches(".*\\btype=X-ATT-X\\b.*")); Assert.assertTrue(xxLine.matches("^X-DOMAIN.PKG.CLASS-X\\.X-ATT-X 0 210012.*")); Assert.assertTrue(xxLine.matches(".*\\btype=XX-ATT-XX\\b.*")); }
public Iterable<String> formatResults(Iterable<Result> results, final Server server) { return from(results).transformAndConcat(new Function<Result, List<String>>() { @Override public List<String> apply(Result input) { return formatResult(input, server); } }).toList(); }
OpenTSDBMessageFormatter { public Iterable<String> formatResults(Iterable<Result> results, final Server server) { return from(results).transformAndConcat(new Function<Result, List<String>>() { @Override public List<String> apply(Result input) { return formatResult(input, server); } }).toList(); } }
OpenTSDBMessageFormatter { public Iterable<String> formatResults(Iterable<Result> results, final Server server) { return from(results).transformAndConcat(new Function<Result, List<String>>() { @Override public List<String> apply(Result input) { return formatResult(input, server); } }).toList(); } OpenTSDBMessageFormatter(@Nonnull ImmutableList<String> typeNames,
									@Nonnull ImmutableMap<String, String> tags);  OpenTSDBMessageFormatter(@Nonnull ImmutableList<String> typeNames,
									@Nonnull ImmutableMap<String, String> tags,
									@Nonnull String tagName,
									@Nullable String metricNamingExpression,
									boolean mergeTypeNamesTags,
									boolean hostnameTag); }
OpenTSDBMessageFormatter { public Iterable<String> formatResults(Iterable<Result> results, final Server server) { return from(results).transformAndConcat(new Function<Result, List<String>>() { @Override public List<String> apply(Result input) { return formatResult(input, server); } }).toList(); } OpenTSDBMessageFormatter(@Nonnull ImmutableList<String> typeNames,
									@Nonnull ImmutableMap<String, String> tags);  OpenTSDBMessageFormatter(@Nonnull ImmutableList<String> typeNames,
									@Nonnull ImmutableMap<String, String> tags,
									@Nonnull String tagName,
									@Nullable String metricNamingExpression,
									boolean mergeTypeNamesTags,
									boolean hostnameTag); Iterable<String> formatResults(Iterable<Result> results, final Server server); }
OpenTSDBMessageFormatter { public Iterable<String> formatResults(Iterable<Result> results, final Server server) { return from(results).transformAndConcat(new Function<Result, List<String>>() { @Override public List<String> apply(Result input) { return formatResult(input, server); } }).toList(); } OpenTSDBMessageFormatter(@Nonnull ImmutableList<String> typeNames,
									@Nonnull ImmutableMap<String, String> tags);  OpenTSDBMessageFormatter(@Nonnull ImmutableList<String> typeNames,
									@Nonnull ImmutableMap<String, String> tags,
									@Nonnull String tagName,
									@Nullable String metricNamingExpression,
									boolean mergeTypeNamesTags,
									boolean hostnameTag); Iterable<String> formatResults(Iterable<Result> results, final Server server); static final String DEFAULT_TAG_NAME; }