|
1 | 1 | package com.wavefront.agent.logsharvesting; |
2 | 2 |
|
3 | | -import static org.easymock.EasyMock.*; |
| 3 | +import static org.easymock.EasyMock.createMock; |
| 4 | +import static org.easymock.EasyMock.expect; |
| 5 | +import static org.easymock.EasyMock.expectLastCall; |
| 6 | +import static org.easymock.EasyMock.replay; |
| 7 | +import static org.easymock.EasyMock.reset; |
| 8 | +import static org.easymock.EasyMock.verify; |
4 | 9 | import static org.hamcrest.MatcherAssert.assertThat; |
5 | | -import static org.hamcrest.Matchers.*; |
6 | 10 | import static org.hamcrest.Matchers.contains; |
| 11 | +import static org.hamcrest.Matchers.containsInAnyOrder; |
| 12 | +import static org.hamcrest.Matchers.emptyIterable; |
| 13 | +import static org.hamcrest.Matchers.equalTo; |
| 14 | +import static org.hamcrest.Matchers.hasSize; |
| 15 | +import static org.hamcrest.Matchers.instanceOf; |
| 16 | +import static org.hamcrest.Matchers.lessThan; |
7 | 17 |
|
8 | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
9 | 19 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; |
| 20 | +import com.fasterxml.jackson.dataformat.yaml.YAMLFactoryBuilder; |
10 | 21 | import com.google.common.collect.ImmutableList; |
11 | 22 | import com.google.common.collect.ImmutableMap; |
12 | 23 | import com.google.common.collect.Lists; |
|
41 | 52 | import org.junit.After; |
42 | 53 | import org.junit.Test; |
43 | 54 | import org.logstash.beats.Message; |
| 55 | +import org.yaml.snakeyaml.LoaderOptions; |
44 | 56 | import wavefront.report.Histogram; |
45 | 57 | import wavefront.report.ReportPoint; |
46 | 58 |
|
47 | 59 | /** @author Mori Bellamy ([email protected]) */ |
48 | 60 | public class LogsIngesterTest { |
| 61 | + private final AtomicLong now; |
| 62 | + private final AtomicLong nanos; |
| 63 | + private final ObjectMapper objectMapper; |
49 | 64 | private LogsIngestionConfig logsIngestionConfig; |
50 | 65 | private LogsIngester logsIngesterUnderTest; |
51 | 66 | private FilebeatIngester filebeatIngesterUnderTest; |
52 | 67 | private RawLogsIngesterPortUnificationHandler rawLogsIngesterUnderTest; |
53 | 68 | private ReportableEntityHandlerFactory mockFactory; |
54 | 69 | private ReportableEntityHandler<ReportPoint, String> mockPointHandler; |
55 | 70 | private ReportableEntityHandler<ReportPoint, String> mockHistogramHandler; |
56 | | - private AtomicLong now = new AtomicLong((System.currentTimeMillis() / 60000) * 60000); |
57 | | - private AtomicLong nanos = new AtomicLong(System.nanoTime()); |
58 | | - private ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); |
| 71 | + |
| 72 | + public LogsIngesterTest() { |
| 73 | + this.now = new AtomicLong((System.currentTimeMillis() / 60000) * 60000); |
| 74 | + this.nanos = new AtomicLong(System.nanoTime()); |
| 75 | + YAMLFactoryBuilder factory = new YAMLFactoryBuilder(new YAMLFactory()); |
| 76 | + this.objectMapper = new ObjectMapper(factory.loaderOptions(new LoaderOptions()).build()); |
| 77 | + } |
59 | 78 |
|
60 | 79 | private LogsIngestionConfig parseConfigFile(String configPath) throws IOException { |
61 | 80 | File configFile = |
|
0 commit comments