src/test/java/org/embulk/parser/TestApacheLogParserPlugin.java in embulk-parser-apache-custom-log-0.3.0 vs src/test/java/org/embulk/parser/TestApacheLogParserPlugin.java in embulk-parser-apache-custom-log-0.4.0

- old
+ new

@@ -7,18 +7,19 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.URISyntaxException; +import java.util.Arrays; import java.util.function.Consumer; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; public class TestApacheLogParserPlugin { - private static EmbulkPluginTester tester = new EmbulkPluginTester(ParserPlugin.class, "apache-log", ApacheLogParserPlugin.class); + private static EmbulkPluginTester tester = new EmbulkPluginTester(ParserPlugin.class, "apache-log", ApacheCustomLogParserPlugin.class); @Test public void test_common() throws Exception { tester.run("/yml/test_common.yml"); @@ -40,9 +41,43 @@ String[] expected = new String[]{ "127.0.0.1", "", "frank", "2000-10-10 20:55:36.000000 +0000", + "GET /apache_pb.gif HTTP/1.0", + "200", + "2326" + }; + assertThat(cols, is(expected)); + } + ); + + } + + @Test + public void test_custom_time_format() throws Exception { + tester.run("/yml/test_custom_time_format.yml"); + + assertResult( + "/temp/result_custom_time_format.000.00.tsv", + cols -> { + String[] expected = new String[]{ + "remote-host", + "remote-log-name", + "request-user", + "request-time", + "request-line", + "response-status", + "response-bytes" + }; + assertThat(cols, is(expected)); + }, + cols -> { + String[] expected = new String[]{ + "127.0.0.1", + "", + "frank", + "2015-11-20 13:55:36.000000 +0000", "GET /apache_pb.gif HTTP/1.0", "200", "2326" }; assertThat(cols, is(expected));