embulk-filter-row 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,34 @@
1
1
  package org.embulk.filter.row;
2
2
 
3
- import org.embulk.filter.row.LongCondition;
4
3
  import org.junit.Test;
5
- import static org.junit.Assert.*;
4
+
5
+ import static org.junit.Assert.assertFalse;
6
+ import static org.junit.Assert.assertTrue;
6
7
 
7
8
  public class TestLongCondition
8
9
  {
9
10
  @Test
10
- public void testIsNull() {
11
+ public void testIsNull()
12
+ {
11
13
  LongCondition condition = new LongCondition("IS NULL", null, false);
12
14
  assertTrue(condition.compare(null));
13
15
  assertFalse(condition.compare(new Long(10)));
14
16
  }
15
17
 
16
18
  @Test
17
- public void testIsNotNull() {
19
+ public void testIsNotNull()
20
+ {
18
21
  LongCondition condition = new LongCondition("IS NOT NULL", null, false);
19
22
  assertFalse(condition.compare(null));
20
23
  assertTrue(condition.compare(new Long(10)));
21
24
  }
22
25
 
23
26
  @Test
24
- public void testEquals() {
25
- LongCondition condition = new LongCondition("==", new Long(10), false);
27
+ public void testEquals()
28
+ {
29
+ LongCondition condition = new LongCondition("==", new Double(10), false);
26
30
  assertFalse(condition.compare(null));
27
- assertTrue( condition.compare(new Long(10)));
31
+ assertTrue(condition.compare(new Long(10)));
28
32
  assertFalse(condition.compare(new Long(11)));
29
33
 
30
34
  // Prohibited by Factory
@@ -32,50 +36,119 @@ public class TestLongCondition
32
36
  }
33
37
 
34
38
  @Test
35
- public void testNotEquals() {
36
- LongCondition condition = new LongCondition("!=", new Long(10), false);
37
- assertTrue( condition.compare(null));
39
+ public void testNotEquals()
40
+ {
41
+ LongCondition condition = new LongCondition("!=", new Double(10), false);
42
+ assertTrue(condition.compare(null));
43
+ assertFalse(condition.compare(new Long(10)));
44
+ assertTrue(condition.compare(new Long(11)));
45
+ }
46
+
47
+ @Test
48
+ public void testGreaterThan()
49
+ {
50
+ LongCondition condition = new LongCondition(">", new Double(10), false);
51
+ assertFalse(condition.compare(null));
52
+ assertFalse(condition.compare(new Long(10)));
53
+ assertTrue(condition.compare(new Long(11)));
54
+ }
55
+
56
+ @Test
57
+ public void testGreaterEqual()
58
+ {
59
+ LongCondition condition = new LongCondition(">=", new Double(11), false);
60
+ assertFalse(condition.compare(null));
61
+ assertFalse(condition.compare(new Long(10)));
62
+ assertTrue(condition.compare(new Long(11)));
63
+ }
64
+
65
+ @Test
66
+ public void testLessThan()
67
+ {
68
+ LongCondition condition = new LongCondition("<", new Double(11), false);
69
+ assertFalse(condition.compare(null));
70
+ assertFalse(condition.compare(new Long(11)));
71
+ assertTrue(condition.compare(new Long(10)));
72
+ }
73
+
74
+ @Test
75
+ public void testLessEqual()
76
+ {
77
+ LongCondition condition = new LongCondition("<=", new Double(11), false);
78
+ assertFalse(condition.compare(null));
79
+ assertFalse(condition.compare(new Long(12)));
80
+ assertTrue(condition.compare(new Long(11)));
81
+ }
82
+
83
+ @Test
84
+ public void testNot()
85
+ {
86
+ LongCondition condition = new LongCondition("<=", new Double(11), true);
87
+ assertTrue(condition.compare(null));
88
+ assertTrue(condition.compare(new Long(12)));
89
+ assertFalse(condition.compare(new Long(11)));
90
+ }
91
+
92
+ @Test
93
+ public void testDoubleOperatorEquals()
94
+ {
95
+ LongCondition condition = new LongCondition("==", new Double(10.5), false);
96
+ assertFalse(condition.compare(null));
38
97
  assertFalse(condition.compare(new Long(10)));
39
- assertTrue( condition.compare(new Long(11)));
98
+ assertFalse(condition.compare(new Long(11)));
99
+ }
100
+
101
+ @Test
102
+ public void testDoubleOperatorNotEquals()
103
+ {
104
+ LongCondition condition = new LongCondition("!=", new Double(10.5), false);
105
+ assertTrue(condition.compare(null));
106
+ assertTrue(condition.compare(new Long(10)));
107
+ assertTrue(condition.compare(new Long(11)));
40
108
  }
41
109
 
42
110
  @Test
43
- public void testGreaterThan() {
44
- LongCondition condition = new LongCondition(">", new Long(10), false);
111
+ public void testDoubleOperatorGreaterThan()
112
+ {
113
+ LongCondition condition = new LongCondition(">", new Double(10.5), false);
45
114
  assertFalse(condition.compare(null));
46
115
  assertFalse(condition.compare(new Long(10)));
47
- assertTrue( condition.compare(new Long(11)));
116
+ assertTrue(condition.compare(new Long(11)));
48
117
  }
49
118
 
50
119
  @Test
51
- public void testGreaterEqual() {
52
- LongCondition condition = new LongCondition(">=", new Long(11), false);
120
+ public void testDoubleOperatorGreaterEqual()
121
+ {
122
+ LongCondition condition = new LongCondition(">=", new Double(10.5), false);
53
123
  assertFalse(condition.compare(null));
54
124
  assertFalse(condition.compare(new Long(10)));
55
- assertTrue( condition.compare(new Long(11)));
125
+ assertTrue(condition.compare(new Long(11)));
56
126
  }
57
127
 
58
128
  @Test
59
- public void testLessThan() {
60
- LongCondition condition = new LongCondition("<", new Long(11), false);
129
+ public void testDoubleOperatorLessThan()
130
+ {
131
+ LongCondition condition = new LongCondition("<", new Double(10.5), false);
61
132
  assertFalse(condition.compare(null));
62
133
  assertFalse(condition.compare(new Long(11)));
63
- assertTrue( condition.compare(new Long(10)));
134
+ assertTrue(condition.compare(new Long(10)));
64
135
  }
65
136
 
66
137
  @Test
67
- public void testLessEqual() {
68
- LongCondition condition = new LongCondition("<=", new Long(11), false);
138
+ public void testDoubleOperatorLessEqual()
139
+ {
140
+ LongCondition condition = new LongCondition("<=", new Double(11.5), false);
69
141
  assertFalse(condition.compare(null));
70
142
  assertFalse(condition.compare(new Long(12)));
71
- assertTrue( condition.compare(new Long(11)));
143
+ assertTrue(condition.compare(new Long(11)));
72
144
  }
73
145
 
74
146
  @Test
75
- public void testNot() {
76
- LongCondition condition = new LongCondition("<=", new Long(11), true);
77
- assertTrue( condition.compare(null));
78
- assertTrue( condition.compare(new Long(12)));
147
+ public void testDoubleOperatorNot()
148
+ {
149
+ LongCondition condition = new LongCondition("<=", new Double(11.5), true);
150
+ assertTrue(condition.compare(null));
151
+ assertTrue(condition.compare(new Long(12)));
79
152
  assertFalse(condition.compare(new Long(11)));
80
153
  }
81
154
  }
@@ -1,30 +1,34 @@
1
1
  package org.embulk.filter.row;
2
2
 
3
- import org.embulk.filter.row.StringCondition;
4
3
  import org.junit.Test;
5
- import static org.junit.Assert.*;
4
+
5
+ import static org.junit.Assert.assertFalse;
6
+ import static org.junit.Assert.assertTrue;
6
7
 
7
8
  public class TestStringCondition
8
9
  {
9
10
  @Test
10
- public void testIsNull() {
11
+ public void testIsNull()
12
+ {
11
13
  StringCondition condition = new StringCondition("IS NULL", null, false);
12
14
  assertTrue(condition.compare(null));
13
15
  assertFalse(condition.compare("foo"));
14
16
  }
15
17
 
16
18
  @Test
17
- public void testIsNotNull() {
19
+ public void testIsNotNull()
20
+ {
18
21
  StringCondition condition = new StringCondition("IS NOT NULL", null, false);
19
22
  assertFalse(condition.compare(null));
20
23
  assertTrue(condition.compare("foo"));
21
24
  }
22
25
 
23
26
  @Test
24
- public void testEquals() {
27
+ public void testEquals()
28
+ {
25
29
  StringCondition condition = new StringCondition("==", "foo", false);
26
30
  assertFalse(condition.compare(null));
27
- assertTrue( condition.compare("foo"));
31
+ assertTrue(condition.compare("foo"));
28
32
  assertFalse(condition.compare("bar"));
29
33
 
30
34
  // Prohibited by Factory
@@ -32,66 +36,74 @@ public class TestStringCondition
32
36
  }
33
37
 
34
38
  @Test
35
- public void testNotEquals() {
39
+ public void testNotEquals()
40
+ {
36
41
  StringCondition condition = new StringCondition("!=", "foo", false);
37
- assertTrue( condition.compare(null));
42
+ assertTrue(condition.compare(null));
38
43
  assertFalse(condition.compare("foo"));
39
- assertTrue( condition.compare("bar"));
44
+ assertTrue(condition.compare("bar"));
40
45
  }
41
46
 
42
47
  @Test
43
- public void testStartWith() {
48
+ public void testStartWith()
49
+ {
44
50
  StringCondition condition = new StringCondition("start_with", "f", false);
45
51
  assertFalse(condition.compare(null));
46
- assertTrue( condition.compare("foo"));
52
+ assertTrue(condition.compare("foo"));
47
53
  assertFalse(condition.compare("bar"));
48
54
  }
49
55
 
50
56
  @Test
51
- public void testStartsWith() {
57
+ public void testStartsWith()
58
+ {
52
59
  StringCondition condition = new StringCondition("startsWith", "f", false);
53
60
  assertFalse(condition.compare(null));
54
- assertTrue( condition.compare("foo"));
61
+ assertTrue(condition.compare("foo"));
55
62
  assertFalse(condition.compare("bar"));
56
63
  }
57
64
 
58
65
  @Test
59
- public void testEndWith() {
66
+ public void testEndWith()
67
+ {
60
68
  StringCondition condition = new StringCondition("end_with", "o", false);
61
69
  assertFalse(condition.compare(null));
62
- assertTrue( condition.compare("foo"));
70
+ assertTrue(condition.compare("foo"));
63
71
  assertFalse(condition.compare("bar"));
64
72
  }
65
73
 
66
74
  @Test
67
- public void testEndsWith() {
75
+ public void testEndsWith()
76
+ {
68
77
  StringCondition condition = new StringCondition("endsWith", "o", false);
69
78
  assertFalse(condition.compare(null));
70
- assertTrue( condition.compare("foo"));
79
+ assertTrue(condition.compare("foo"));
71
80
  assertFalse(condition.compare("bar"));
72
81
  }
73
82
 
74
83
  @Test
75
- public void testInclude() {
84
+ public void testInclude()
85
+ {
76
86
  StringCondition condition = new StringCondition("include", "o", false);
77
87
  assertFalse(condition.compare(null));
78
- assertTrue( condition.compare("foo"));
88
+ assertTrue(condition.compare("foo"));
79
89
  assertFalse(condition.compare("bar"));
80
90
  }
81
91
 
82
92
  @Test
83
- public void testContains() {
93
+ public void testContains()
94
+ {
84
95
  StringCondition condition = new StringCondition("contains", "o", false);
85
96
  assertFalse(condition.compare(null));
86
- assertTrue( condition.compare("foo"));
97
+ assertTrue(condition.compare("foo"));
87
98
  assertFalse(condition.compare("bar"));
88
99
  }
89
100
 
90
101
  @Test
91
- public void testNot() {
102
+ public void testNot()
103
+ {
92
104
  StringCondition condition = new StringCondition("include", "o", true);
93
- assertTrue( condition.compare(null));
105
+ assertTrue(condition.compare(null));
94
106
  assertFalse(condition.compare("foo"));
95
- assertTrue( condition.compare("bar"));
107
+ assertTrue(condition.compare("bar"));
96
108
  }
97
109
  }
@@ -1,32 +1,36 @@
1
1
  package org.embulk.filter.row;
2
2
 
3
- import org.embulk.filter.row.TimestampCondition;
3
+ import org.embulk.spi.time.Timestamp;
4
+
4
5
  import org.junit.Test;
5
- import static org.junit.Assert.*;
6
6
 
7
- import org.embulk.spi.time.Timestamp;
7
+ import static org.junit.Assert.assertFalse;
8
+ import static org.junit.Assert.assertTrue;
8
9
 
9
10
  public class TestTimestampCondition
10
11
  {
11
12
  @Test
12
- public void testIsNull() {
13
+ public void testIsNull()
14
+ {
13
15
  TimestampCondition condition = new TimestampCondition("IS NULL", null, false);
14
16
  assertTrue(condition.compare(null));
15
17
  assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
16
18
  }
17
19
 
18
20
  @Test
19
- public void testIsNotNull() {
21
+ public void testIsNotNull()
22
+ {
20
23
  TimestampCondition condition = new TimestampCondition("IS NOT NULL", null, false);
21
24
  assertFalse(condition.compare(null));
22
25
  assertTrue(condition.compare(Timestamp.ofEpochSecond(10)));
23
26
  }
24
27
 
25
28
  @Test
26
- public void testEquals() {
29
+ public void testEquals()
30
+ {
27
31
  TimestampCondition condition = new TimestampCondition("==", Timestamp.ofEpochSecond(10), false);
28
32
  assertFalse(condition.compare(null));
29
- assertTrue( condition.compare(Timestamp.ofEpochSecond(10)));
33
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(10)));
30
34
  assertFalse(condition.compare(Timestamp.ofEpochSecond(11)));
31
35
 
32
36
  // Prohibited by Factory
@@ -34,50 +38,56 @@ public class TestTimestampCondition
34
38
  }
35
39
 
36
40
  @Test
37
- public void testNotEquals() {
41
+ public void testNotEquals()
42
+ {
38
43
  TimestampCondition condition = new TimestampCondition("!=", Timestamp.ofEpochSecond(10), false);
39
- assertTrue( condition.compare(null));
44
+ assertTrue(condition.compare(null));
40
45
  assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
41
- assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
46
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(11)));
42
47
  }
43
48
 
44
49
  @Test
45
- public void testGreaterThan() {
50
+ public void testGreaterThan()
51
+ {
46
52
  TimestampCondition condition = new TimestampCondition(">", Timestamp.ofEpochSecond(10), false);
47
53
  assertFalse(condition.compare(null));
48
54
  assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
49
- assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
55
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(11)));
50
56
  }
51
57
 
52
58
  @Test
53
- public void testGreaterEqual() {
59
+ public void testGreaterEqual()
60
+ {
54
61
  TimestampCondition condition = new TimestampCondition(">=", Timestamp.ofEpochSecond(11), false);
55
62
  assertFalse(condition.compare(null));
56
63
  assertFalse(condition.compare(Timestamp.ofEpochSecond(10)));
57
- assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
64
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(11)));
58
65
  }
59
66
 
60
67
  @Test
61
- public void testLessThan() {
68
+ public void testLessThan()
69
+ {
62
70
  TimestampCondition condition = new TimestampCondition("<", Timestamp.ofEpochSecond(11), false);
63
71
  assertFalse(condition.compare(null));
64
72
  assertFalse(condition.compare(Timestamp.ofEpochSecond(11)));
65
- assertTrue( condition.compare(Timestamp.ofEpochSecond(10)));
73
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(10)));
66
74
  }
67
75
 
68
76
  @Test
69
- public void testLessEqual() {
77
+ public void testLessEqual()
78
+ {
70
79
  TimestampCondition condition = new TimestampCondition("<=", Timestamp.ofEpochSecond(11), false);
71
80
  assertFalse(condition.compare(null));
72
81
  assertFalse(condition.compare(Timestamp.ofEpochSecond(12)));
73
- assertTrue( condition.compare(Timestamp.ofEpochSecond(11)));
82
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(11)));
74
83
  }
75
84
 
76
85
  @Test
77
- public void testNot() {
86
+ public void testNot()
87
+ {
78
88
  TimestampCondition condition = new TimestampCondition("<=", Timestamp.ofEpochSecond(11), true);
79
- assertTrue( condition.compare(null));
80
- assertTrue( condition.compare(Timestamp.ofEpochSecond(12)));
89
+ assertTrue(condition.compare(null));
90
+ assertTrue(condition.compare(Timestamp.ofEpochSecond(12)));
81
91
  assertFalse(condition.compare(Timestamp.ofEpochSecond(11)));
82
92
  }
83
93
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-row
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-04 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -51,13 +51,16 @@ files:
51
51
  - LICENSE.txt
52
52
  - README.md
53
53
  - build.gradle
54
+ - config/checkstyle/checkstyle.xml
54
55
  - example/and.yml
56
+ - example/example.csv
55
57
  - example/or.yml
56
58
  - gradle/wrapper/gradle-wrapper.jar
57
59
  - gradle/wrapper/gradle-wrapper.properties
58
60
  - gradlew
59
61
  - gradlew.bat
60
62
  - lib/embulk/filter/row.rb
63
+ - settings.gradle
61
64
  - src/main/java/org/embulk/filter/RowFilterPlugin.java
62
65
  - src/main/java/org/embulk/filter/row/BooleanCondition.java
63
66
  - src/main/java/org/embulk/filter/row/Condition.java
@@ -74,7 +77,7 @@ files:
74
77
  - src/test/java/org/embulk/filter/row/TestLongCondition.java
75
78
  - src/test/java/org/embulk/filter/row/TestStringCondition.java
76
79
  - src/test/java/org/embulk/filter/row/TestTimestampCondition.java
77
- - classpath/embulk-filter-row-0.2.0.jar
80
+ - classpath/embulk-filter-row-0.2.1.jar
78
81
  homepage: https://github.com/sonots/embulk-filter-row
79
82
  licenses:
80
83
  - MIT
Binary file