embulk-parser-apache-custom-log 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e9175fc76d713c5e0cb3d94e76abfd1d5907381
4
- data.tar.gz: b0b200ead1ca5153054ac23656bdef3257ef9ba9
3
+ metadata.gz: a611119f28f26ce8cb808909a503f932618d76e0
4
+ data.tar.gz: 41e5e19f807610e043852f777959f3befaaf9033
5
5
  SHA512:
6
- metadata.gz: 9d31ad44accc1e444a1b27d5d0cb26e62c09d859ae1d25ab0fbcbabf1187810967ee22bc09347f1f0058e5172f4d942d46bf036bf4afdc726e920d30bb26f2a9
7
- data.tar.gz: a8c7663f5b7084dfcc721b9b09ddb25e7a8f6365fe0db77536182dd9c914fe0028dc2efa27b9c36ed07d76aac6a7ec4430b1526807bfde2fc7c561225e24635f
6
+ metadata.gz: 23e9ce19522d43e95712997bd31cefe42c34296d5e7291281e36c147c1b70e01e84fc6ef23feb769789d23be79e423bf04505f6ed8b2eec3151517c129f29ed8
7
+ data.tar.gz: cc7fb0fb0be418b8ac5462f2309471e2646f19d08f1e01a1715f63c51e9872510d4b97d7bffd013459c51f09106a44e93e7de73e0133c089aa216d157190cf60
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ build/
8
8
  .idea
9
9
  /*.gem
10
10
  /*.iml
11
+ /out/
@@ -12,7 +12,7 @@ configurations {
12
12
  provided
13
13
  }
14
14
 
15
- version = "0.4.0"
15
+ version = "0.4.1"
16
16
 
17
17
  dependencies {
18
18
  compile "org.embulk:embulk-core:0.7.4"
@@ -20,6 +20,7 @@ dependencies {
20
20
  // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
21
21
  testCompile "junit:junit:4.+"
22
22
  testCompile "org.embulk:embulk-standards:0.7.4"
23
+ testCompile "org.embulk:embulk-core:0.7.4:tests"
23
24
  }
24
25
 
25
26
  task classpath(type: Copy, dependsOn: ["jar"]) {
@@ -1,5 +1,8 @@
1
1
  package org.embulk.parser.apache.log;
2
2
 
3
+ import org.embulk.config.ConfigSource;
4
+ import org.embulk.config.Task;
5
+ import org.embulk.spi.Exec;
3
6
  import org.embulk.spi.PageBuilder;
4
7
  import org.embulk.spi.time.Timestamp;
5
8
  import org.embulk.spi.time.TimestampParser;
@@ -16,9 +19,19 @@ public class TimestampLogElement extends LogElement<Timestamp> {
16
19
  this(task, name, regex, "%d/%b/%Y:%T %z");
17
20
  }
18
21
 
22
+ private static interface ParserIntlTask extends Task, TimestampParser.Task {}
23
+ private static interface ParserIntlColumnOption extends Task, TimestampParser.TimestampColumnOption {}
24
+
19
25
  public TimestampLogElement(TimestampParser.Task task, String name, String regex, String pattern) {
20
26
  super(name, regex, TIMESTAMP);
21
- this.parser = new TimestampParser(task.getJRuby(), pattern, task.getDefaultTimeZone());
27
+ // TODO: Switch to a newer TimestampParser constructor after a reasonable interval.
28
+ // Traditional constructor is used here for compatibility.
29
+ final ConfigSource configSource = Exec.newConfigSource();
30
+ configSource.set("format", pattern);
31
+ configSource.set("timezone", task.getDefaultTimeZone());
32
+ this.parser = new TimestampParser(
33
+ Exec.newConfigSource().loadConfig(ParserIntlTask.class),
34
+ configSource.loadConfig(ParserIntlColumnOption.class));
22
35
  }
23
36
 
24
37
  @Override
@@ -1,14 +1,20 @@
1
1
  package org.embulk.parser.apache.log;
2
2
 
3
- import junit.framework.TestCase;
3
+ import org.embulk.EmbulkTestRuntime;
4
4
  import org.embulk.spi.time.TimestampParser;
5
5
  import org.joda.time.DateTimeZone;
6
6
  import org.jruby.embed.ScriptingContainer;
7
+ import org.junit.Rule;
8
+ import org.junit.Test;
7
9
 
8
10
  import java.util.regex.Pattern;
9
11
 
10
- public class LogFormatsTest extends TestCase {
12
+ public class LogFormatsTest {
11
13
 
14
+ @Rule
15
+ public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
16
+
17
+ @Test
12
18
  public void testLogFormat2Regexp() throws Exception {
13
19
 
14
20
  String format = "%!100<v %!100,200<v %100,200,300>v %!100,200,300>{hogeHoge}v %v %{X-Forwarded-For}i %t %{%D}t %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O %D";
@@ -36,4 +42,4 @@ public class LogFormatsTest extends TestCase {
36
42
 
37
43
 
38
44
  }
39
- }
45
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-apache-custom-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sato
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-20 00:00:00.000000000 Z
12
+ date: 2017-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +91,7 @@ files:
91
91
  - src/test/resources/yml/test_combined2.yml
92
92
  - src/test/resources/yml/test_common.yml
93
93
  - src/test/resources/yml/test_custom_time_format.yml
94
- - classpath/embulk-parser-apache-custom-log-0.4.0.jar
94
+ - classpath/embulk-parser-apache-custom-log-0.4.1.jar
95
95
  homepage: https://github.com/jami-i/embulk-parser-apache-custom-log
96
96
  licenses:
97
97
  - MIT