embulk-output-kintone 0.4.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -6
  3. data/classpath/embulk-output-kintone-1.0.0.jar +0 -0
  4. data/classpath/{shadow-kintone-java-client-0.4.1-all.jar → shadow-kintone-java-client-1.0.0-all.jar} +0 -0
  5. data/src/main/java/org/embulk/output/kintone/KintoneColumnOption.java +1 -2
  6. data/src/main/java/org/embulk/output/kintone/KintoneColumnType.java +368 -0
  7. data/src/main/java/org/embulk/output/kintone/KintoneColumnVisitor.java +195 -135
  8. data/src/main/java/org/embulk/output/kintone/KintoneMode.java +0 -1
  9. data/src/main/java/org/embulk/output/kintone/KintoneOutputPlugin.java +0 -2
  10. data/src/main/java/org/embulk/output/kintone/KintonePageOutput.java +169 -157
  11. data/src/main/java/org/embulk/output/kintone/PluginTask.java +8 -0
  12. data/src/test/java/org/embulk/output/kintone/KintoneColumnOptionBuilder.java +2 -3
  13. data/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorTest.java +563 -40
  14. data/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorVerifier.java +35 -14
  15. data/src/test/java/org/embulk/output/kintone/KintonePageOutputVerifier.java +2 -7
  16. data/src/test/java/org/embulk/output/kintone/TestKintoneOutputPlugin.java +22 -9
  17. data/src/test/java/org/embulk/output/kintone/TestTaskMode.java +12 -0
  18. data/src/test/resources/org/embulk/output/kintone/task/mode/config.yml +104 -0
  19. data/src/test/resources/org/embulk/output/kintone/task/mode/input.csv +7 -7
  20. data/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_ignore_nulls_records.jsonl +6 -0
  21. data/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_prefer_nulls_records.jsonl +6 -0
  22. data/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_records.jsonl +6 -6
  23. data/src/test/resources/org/embulk/output/kintone/task/mode/update_update_ignore_nulls_records.jsonl +3 -0
  24. data/src/test/resources/org/embulk/output/kintone/task/mode/update_update_prefer_nulls_records.jsonl +3 -0
  25. data/src/test/resources/org/embulk/output/kintone/task/mode/update_update_records.jsonl +6 -3
  26. data/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_ignore_nulls_records.jsonl +3 -0
  27. data/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_prefer_nulls_records.jsonl +3 -0
  28. data/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_records.jsonl +2 -2
  29. data/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_ignore_nulls_records.jsonl +3 -0
  30. data/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_prefer_nulls_records.jsonl +3 -0
  31. data/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_records.jsonl +4 -4
  32. data/src/test/resources/org/embulk/output/kintone/task/mode/values_ignore_nulls.json +1 -0
  33. data/src/test/resources/org/embulk/output/kintone/task/mode/values_prefer_nulls.json +1 -0
  34. metadata +15 -4
  35. data/classpath/embulk-output-kintone-0.4.1.jar +0 -0
@@ -3,12 +3,14 @@ package org.embulk.output.kintone;
3
3
  import static org.hamcrest.MatcherAssert.assertThat;
4
4
  import static org.hamcrest.Matchers.is;
5
5
  import static org.hamcrest.Matchers.nullValue;
6
+ import static org.junit.Assert.assertThrows;
6
7
 
7
8
  import com.google.common.collect.ImmutableMap;
9
+ import com.kintone.client.model.record.FieldType;
8
10
  import java.math.BigDecimal;
9
11
  import java.time.Instant;
10
12
  import java.time.LocalDate;
11
- import java.time.ZoneId;
13
+ import java.time.LocalTime;
12
14
  import java.time.ZonedDateTime;
13
15
  import java.util.AbstractMap;
14
16
  import java.util.Arrays;
@@ -25,133 +27,510 @@ import org.msgpack.value.ValueFactory;
25
27
  public class KintoneColumnVisitorTest {
26
28
  @Test
27
29
  public void test() {
28
- Schema schema = build(Schema.builder());
29
- KintoneColumnVisitorVerifier verifier =
30
- new KintoneColumnVisitorVerifier(
31
- schema,
32
- build(ImmutableMap.builder()),
33
- "STRING|SINGLE_LINE_TEXT",
34
- OutputPageBuilder.build(schema, KintoneColumnVisitorTest::build));
30
+ KintoneColumnVisitorVerifier verifier = verifier("STRING|SINGLE_LINE_TEXT");
35
31
  verifier.verify(
36
32
  (record, updateKey) -> {
37
33
  assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("false"));
38
- assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue());
39
- assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is(""));
40
- assertThat(record.getNumberFieldValue("LONG"), nullValue());
34
+ assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("0")));
35
+ assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("0"));
36
+ assertThat(record.getNumberFieldValue("LONG"), is(number("0")));
37
+ assertThat(record.getDateFieldValue("LONG|DATE"), is(date("1970-01-01")));
38
+ assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("1970-01-01")));
39
+ assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1969-12-31")));
40
+ assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("00:00:00")));
41
+ assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("09:00:00")));
42
+ assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("16:00:00")));
43
+ assertThat(
44
+ record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("1970-01-01T00:00:00Z")));
41
45
  assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("0.0"));
42
46
  assertThat(record.getNumberFieldValue("DOUBLE"), is(number("0.0")));
47
+ assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("1970-01-01")));
48
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("1970-01-01")));
49
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1969-12-31")));
50
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("00:00:00")));
51
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("09:00:00")));
52
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("16:00:00")));
53
+ assertThat(
54
+ record.getDateTimeFieldValue("DOUBLE|DATETIME"),
55
+ is(dateTime("1970-01-01T00:00:00Z")));
43
56
  assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is(""));
44
57
  assertThat(record.getMultiLineTextFieldValue("STRING"), is(""));
45
- assertThat(record.getNumberFieldValue("STRING|NUMBER"), nullValue());
46
- assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list("null")));
58
+ assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is(""));
59
+ assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("0")));
60
+ assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list()));
61
+ assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is(""));
62
+ assertThat(record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list()));
47
63
  assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is(""));
64
+ assertThat(record.getDateFieldValue("STRING|DATE"), is(date("1970-01-01")));
65
+ assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("1970-01-01")));
66
+ assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1969-12-31")));
67
+ assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("00:00:00")));
68
+ assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("09:00:00")));
69
+ assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("16:00:00")));
70
+ assertThat(
71
+ record.getDateTimeFieldValue("STRING|DATETIME"),
72
+ is(dateTime("1970-01-01T00:00:00Z")));
48
73
  assertThat(record.getLinkFieldValue("STRING|LINK"), is(""));
49
- assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue());
50
- assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), nullValue());
51
- assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), nullValue());
52
- assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), nullValue());
53
- assertThat(record.getDateTimeFieldValue("TIMESTAMP"), nullValue());
54
- assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is(""));
55
- assertThat(record.getMultiLineTextFieldValue("JSON"), is(""));
74
+ assertThat(
75
+ record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"),
76
+ is("1970-01-01T00:00:00Z"));
77
+ assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("0")));
78
+ assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("1970-01-01")));
79
+ assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("1970-01-01")));
80
+ assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1969-12-31")));
81
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("00:00:00")));
82
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("09:00:00")));
83
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("16:00:00")));
84
+ assertThat(
85
+ record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("1970-01-01T00:00:00Z")));
86
+ assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"\""));
87
+ assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"\""));
56
88
  assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT"));
57
89
  assertThat(updateKey.getValue(), is(""));
58
90
  });
59
91
  verifier.verify(
60
92
  (record, updateKey) -> {
61
93
  assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("false"));
62
- assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue());
94
+ assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("0")));
63
95
  assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("0"));
64
96
  assertThat(record.getNumberFieldValue("LONG"), is(number("0")));
97
+ assertThat(record.getDateFieldValue("LONG|DATE"), is(date("1970-01-01")));
98
+ assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("1970-01-01")));
99
+ assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1969-12-31")));
100
+ assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("00:00:00")));
101
+ assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("09:00:00")));
102
+ assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("16:00:00")));
103
+ assertThat(
104
+ record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("1970-01-01T00:00:00Z")));
65
105
  assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("0.0"));
66
106
  assertThat(record.getNumberFieldValue("DOUBLE"), is(number("0.0")));
107
+ assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("1970-01-01")));
108
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("1970-01-01")));
109
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1969-12-31")));
110
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("00:00:00")));
111
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("09:00:00")));
112
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("16:00:00")));
113
+ assertThat(
114
+ record.getDateTimeFieldValue("DOUBLE|DATETIME"),
115
+ is(dateTime("1970-01-01T00:00:00Z")));
67
116
  assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is(""));
68
117
  assertThat(record.getMultiLineTextFieldValue("STRING"), is(""));
69
- assertThat(record.getNumberFieldValue("STRING|NUMBER"), nullValue());
118
+ assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is(""));
119
+ assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("0")));
70
120
  assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list()));
121
+ assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is(""));
122
+ assertThat(record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list()));
71
123
  assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is(""));
124
+ assertThat(record.getDateFieldValue("STRING|DATE"), is(date("1970-01-01")));
125
+ assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("1970-01-01")));
126
+ assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1969-12-31")));
127
+ assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("00:00:00")));
128
+ assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("09:00:00")));
129
+ assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("16:00:00")));
130
+ assertThat(
131
+ record.getDateTimeFieldValue("STRING|DATETIME"),
132
+ is(dateTime("1970-01-01T00:00:00Z")));
72
133
  assertThat(record.getLinkFieldValue("STRING|LINK"), is(""));
73
- assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue());
134
+ assertThat(
135
+ record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"),
136
+ is("1970-01-01T00:00:00Z"));
137
+ assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("0")));
74
138
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("1970-01-01")));
75
139
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("1970-01-01")));
76
140
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1969-12-31")));
141
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("00:00:00")));
142
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("09:00:00")));
143
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("16:00:00")));
77
144
  assertThat(
78
145
  record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("1970-01-01T00:00:00Z")));
79
- assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is(""));
80
- assertThat(record.getMultiLineTextFieldValue("JSON"), is(""));
146
+ assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"\""));
147
+ assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"\""));
81
148
  assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT"));
82
149
  assertThat(updateKey.getValue(), is(""));
83
150
  });
84
151
  verifier.verify(
85
152
  (record, updateKey) -> {
86
153
  assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("true"));
87
- assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue());
154
+ assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("1")));
88
155
  assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("123"));
89
156
  assertThat(record.getNumberFieldValue("LONG"), is(number("123")));
157
+ assertThat(record.getDateFieldValue("LONG|DATE"), is(date("1999-12-31")));
158
+ assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("2000-01-01")));
159
+ assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1999-12-31")));
160
+ assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("23:59:59")));
161
+ assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("08:59:59")));
162
+ assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("15:59:59")));
163
+ assertThat(
164
+ record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("1999-12-31T23:59:59Z")));
90
165
  assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("123.0"));
91
166
  assertThat(record.getNumberFieldValue("DOUBLE"), is(number("123.0")));
167
+ assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("1999-12-31")));
168
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("2000-01-01")));
169
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1999-12-31")));
170
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("23:59:59")));
171
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("08:59:59")));
172
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("15:59:59")));
173
+ assertThat(
174
+ record.getDateTimeFieldValue("DOUBLE|DATETIME"),
175
+ is(dateTime("1999-12-31T23:59:59Z")));
92
176
  assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is("abc"));
93
177
  assertThat(record.getMultiLineTextFieldValue("STRING"), is("abc"));
178
+ assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is("abc"));
94
179
  assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("123")));
95
180
  assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list("123", "abc")));
181
+ assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is("abc"));
182
+ assertThat(
183
+ record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list("123", "abc")));
96
184
  assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is("abc"));
185
+ assertThat(record.getDateFieldValue("STRING|DATE"), is(date("1999-12-31")));
186
+ assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("1999-12-31")));
187
+ assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1999-12-30")));
188
+ assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("23:59:59")));
189
+ assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("08:59:59")));
190
+ assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("15:59:59")));
191
+ assertThat(
192
+ record.getDateTimeFieldValue("STRING|DATETIME"),
193
+ is(dateTime("1999-12-31T23:59:59Z")));
97
194
  assertThat(record.getLinkFieldValue("STRING|LINK"), is("abc"));
98
- assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue());
195
+ assertThat(
196
+ record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"),
197
+ is("1999-12-31T23:59:59Z"));
198
+ assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("946684799")));
99
199
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("1999-12-31")));
100
200
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("2000-01-01")));
101
201
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1999-12-31")));
202
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("23:59:59")));
203
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("08:59:59")));
204
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("15:59:59")));
102
205
  assertThat(
103
206
  record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("1999-12-31T23:59:59Z")));
104
- assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("abc"));
105
- assertThat(record.getMultiLineTextFieldValue("JSON"), is("abc"));
207
+ assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"abc\""));
208
+ assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"abc\""));
106
209
  assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT"));
107
210
  assertThat(updateKey.getValue(), is("abc"));
108
211
  });
109
212
  verifier.verify(
110
213
  (record, updateKey) -> {
111
214
  assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("false"));
112
- assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue());
215
+ assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("0")));
113
216
  assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("456"));
114
217
  assertThat(record.getNumberFieldValue("LONG"), is(number("456")));
218
+ assertThat(record.getDateFieldValue("LONG|DATE"), is(date("2000-01-01")));
219
+ assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("2000-01-01")));
220
+ assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1999-12-31")));
221
+ assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("00:00:00")));
222
+ assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("09:00:00")));
223
+ assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("16:00:00")));
224
+ assertThat(
225
+ record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("2000-01-01T00:00:00Z")));
115
226
  assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("456.0"));
116
227
  assertThat(record.getNumberFieldValue("DOUBLE"), is(number("456.0")));
228
+ assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("2000-01-01")));
229
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("2000-01-01")));
230
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1999-12-31")));
231
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("00:00:00")));
232
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("09:00:00")));
233
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("16:00:00")));
234
+ assertThat(
235
+ record.getDateTimeFieldValue("DOUBLE|DATETIME"),
236
+ is(dateTime("2000-01-01T00:00:00Z")));
117
237
  assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is("def"));
118
238
  assertThat(record.getMultiLineTextFieldValue("STRING"), is("def"));
239
+ assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is("def"));
119
240
  assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("456")));
120
241
  assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list("456", "def")));
242
+ assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is("def"));
243
+ assertThat(
244
+ record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list("456", "def")));
121
245
  assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is("def"));
246
+ assertThat(record.getDateFieldValue("STRING|DATE"), is(date("2000-01-01")));
247
+ assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("2000-01-01")));
248
+ assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1999-12-31")));
249
+ assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("00:00:00")));
250
+ assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("09:00:00")));
251
+ assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("16:00:00")));
252
+ assertThat(
253
+ record.getDateTimeFieldValue("STRING|DATETIME"),
254
+ is(dateTime("2000-01-01T00:00:00Z")));
122
255
  assertThat(record.getLinkFieldValue("STRING|LINK"), is("def"));
123
- assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue());
256
+ assertThat(
257
+ record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"),
258
+ is("2000-01-01T00:00:00Z"));
259
+ assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("946684800")));
124
260
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("2000-01-01")));
125
261
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("2000-01-01")));
126
262
  assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1999-12-31")));
263
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("00:00:00")));
264
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("09:00:00")));
265
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("16:00:00")));
127
266
  assertThat(
128
267
  record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("2000-01-01T00:00:00Z")));
129
- assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("def"));
130
- assertThat(record.getMultiLineTextFieldValue("JSON"), is("def"));
268
+ assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"def\""));
269
+ assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"def\""));
131
270
  assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT"));
132
271
  assertThat(updateKey.getValue(), is("def"));
133
272
  });
134
273
  }
135
274
 
275
+ @Test
276
+ public void testPreferNulls() {
277
+ KintoneColumnVisitorVerifier verifier = verifier("LONG", true, false);
278
+ verifier.verify(
279
+ (record, updateKey) -> {
280
+ assertThat(
281
+ record.getFieldType("BOOLEAN|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT));
282
+ assertThat(record.getFieldType("BOOLEAN"), is(FieldType.NUMBER));
283
+ assertThat(record.getFieldType("LONG|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT));
284
+ assertThat(record.getFieldType("LONG"), is(FieldType.NUMBER));
285
+ assertThat(record.getFieldType("LONG|DATE"), is(FieldType.DATE));
286
+ assertThat(record.getFieldType("LONG|DATE|JST"), is(FieldType.DATE));
287
+ assertThat(record.getFieldType("LONG|DATE|PST"), is(FieldType.DATE));
288
+ assertThat(record.getFieldType("LONG|TIME"), is(FieldType.TIME));
289
+ assertThat(record.getFieldType("LONG|TIME|JST"), is(FieldType.TIME));
290
+ assertThat(record.getFieldType("LONG|TIME|PST"), is(FieldType.TIME));
291
+ assertThat(record.getFieldType("LONG|DATETIME"), is(FieldType.DATETIME));
292
+ assertThat(
293
+ record.getFieldType("DOUBLE|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT));
294
+ assertThat(record.getFieldType("DOUBLE"), is(FieldType.NUMBER));
295
+ assertThat(record.getFieldType("DOUBLE|DATE"), is(FieldType.DATE));
296
+ assertThat(record.getFieldType("DOUBLE|DATE|JST"), is(FieldType.DATE));
297
+ assertThat(record.getFieldType("DOUBLE|DATE|PST"), is(FieldType.DATE));
298
+ assertThat(record.getFieldType("DOUBLE|TIME"), is(FieldType.TIME));
299
+ assertThat(record.getFieldType("DOUBLE|TIME|JST"), is(FieldType.TIME));
300
+ assertThat(record.getFieldType("DOUBLE|TIME|PST"), is(FieldType.TIME));
301
+ assertThat(record.getFieldType("DOUBLE|DATETIME"), is(FieldType.DATETIME));
302
+ assertThat(
303
+ record.getFieldType("STRING|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT));
304
+ assertThat(record.getFieldType("STRING"), is(FieldType.MULTI_LINE_TEXT));
305
+ assertThat(record.getFieldType("STRING|RICH_TEXT"), is(FieldType.RICH_TEXT));
306
+ assertThat(record.getFieldType("STRING|NUMBER"), is(FieldType.NUMBER));
307
+ assertThat(record.getFieldType("STRING|CHECK_BOX"), is(FieldType.CHECK_BOX));
308
+ assertThat(record.getFieldType("STRING|RADIO_BUTTON"), is(FieldType.RADIO_BUTTON));
309
+ assertThat(record.getFieldType("STRING|MULTI_SELECT"), is(FieldType.MULTI_SELECT));
310
+ assertThat(record.getFieldType("STRING|DROP_DOWN"), is(FieldType.DROP_DOWN));
311
+ assertThat(record.getFieldType("STRING|DATE"), is(FieldType.DATE));
312
+ assertThat(record.getFieldType("STRING|DATE|JST"), is(FieldType.DATE));
313
+ assertThat(record.getFieldType("STRING|DATE|PST"), is(FieldType.DATE));
314
+ assertThat(record.getFieldType("STRING|TIME"), is(FieldType.TIME));
315
+ assertThat(record.getFieldType("STRING|TIME|JST"), is(FieldType.TIME));
316
+ assertThat(record.getFieldType("STRING|TIME|PST"), is(FieldType.TIME));
317
+ assertThat(record.getFieldType("STRING|DATETIME"), is(FieldType.DATETIME));
318
+ assertThat(record.getFieldType("STRING|LINK"), is(FieldType.LINK));
319
+ assertThat(
320
+ record.getFieldType("TIMESTAMP|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT));
321
+ assertThat(record.getFieldType("TIMESTAMP|NUMBER"), is(FieldType.NUMBER));
322
+ assertThat(record.getFieldType("TIMESTAMP|DATE"), is(FieldType.DATE));
323
+ assertThat(record.getFieldType("TIMESTAMP|DATE|JST"), is(FieldType.DATE));
324
+ assertThat(record.getFieldType("TIMESTAMP|DATE|PST"), is(FieldType.DATE));
325
+ assertThat(record.getFieldType("TIMESTAMP|TIME"), is(FieldType.TIME));
326
+ assertThat(record.getFieldType("TIMESTAMP|TIME|JST"), is(FieldType.TIME));
327
+ assertThat(record.getFieldType("TIMESTAMP|TIME|PST"), is(FieldType.TIME));
328
+ assertThat(record.getFieldType("TIMESTAMP"), is(FieldType.DATETIME));
329
+ assertThat(record.getFieldType("JSON|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT));
330
+ assertThat(record.getFieldType("JSON"), is(FieldType.MULTI_LINE_TEXT));
331
+ assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), nullValue());
332
+ assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue());
333
+ assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), nullValue());
334
+ assertThat(record.getNumberFieldValue("LONG"), nullValue());
335
+ assertThat(record.getDateFieldValue("LONG|DATE"), nullValue());
336
+ assertThat(record.getDateFieldValue("LONG|DATE|JST"), nullValue());
337
+ assertThat(record.getDateFieldValue("LONG|DATE|PST"), nullValue());
338
+ assertThat(record.getTimeFieldValue("LONG|TIME"), nullValue());
339
+ assertThat(record.getTimeFieldValue("LONG|TIME|JST"), nullValue());
340
+ assertThat(record.getTimeFieldValue("LONG|TIME|PST"), nullValue());
341
+ assertThat(record.getDateTimeFieldValue("LONG|DATETIME"), nullValue());
342
+ assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), nullValue());
343
+ assertThat(record.getNumberFieldValue("DOUBLE"), nullValue());
344
+ assertThat(record.getDateFieldValue("DOUBLE|DATE"), nullValue());
345
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), nullValue());
346
+ assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), nullValue());
347
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME"), nullValue());
348
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), nullValue());
349
+ assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), nullValue());
350
+ assertThat(record.getDateTimeFieldValue("DOUBLE|DATETIME"), nullValue());
351
+ assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), nullValue());
352
+ assertThat(record.getMultiLineTextFieldValue("STRING"), nullValue());
353
+ assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), nullValue());
354
+ assertThat(record.getNumberFieldValue("STRING|NUMBER"), nullValue());
355
+ assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list()));
356
+ assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), nullValue());
357
+ assertThat(record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list()));
358
+ assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), nullValue());
359
+ assertThat(record.getDateFieldValue("STRING|DATE"), nullValue());
360
+ assertThat(record.getDateFieldValue("STRING|DATE|JST"), nullValue());
361
+ assertThat(record.getDateFieldValue("STRING|DATE|PST"), nullValue());
362
+ assertThat(record.getTimeFieldValue("STRING|TIME"), nullValue());
363
+ assertThat(record.getTimeFieldValue("STRING|TIME|JST"), nullValue());
364
+ assertThat(record.getTimeFieldValue("STRING|TIME|PST"), nullValue());
365
+ assertThat(record.getDateTimeFieldValue("STRING|DATETIME"), nullValue());
366
+ assertThat(record.getLinkFieldValue("STRING|LINK"), nullValue());
367
+ assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue());
368
+ assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), nullValue());
369
+ assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), nullValue());
370
+ assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), nullValue());
371
+ assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), nullValue());
372
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), nullValue());
373
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), nullValue());
374
+ assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), nullValue());
375
+ assertThat(record.getDateTimeFieldValue("TIMESTAMP"), nullValue());
376
+ assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), nullValue());
377
+ assertThat(record.getMultiLineTextFieldValue("JSON"), nullValue());
378
+ assertThat(updateKey.getField(), is("LONG"));
379
+ assertThat(updateKey.getValue(), nullValue());
380
+ });
381
+ }
382
+
383
+ @Test
384
+ public void testIgnoreNulls() {
385
+ KintoneColumnVisitorVerifier verifier = verifier("JSON", false, true);
386
+ verifier.verify(
387
+ (record, updateKey) -> {
388
+ assertThat(record.getFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), nullValue());
389
+ assertThat(record.getFieldValue("BOOLEAN"), nullValue());
390
+ assertThat(record.getFieldValue("LONG|SINGLE_LINE_TEXT"), nullValue());
391
+ assertThat(record.getFieldValue("LONG"), nullValue());
392
+ assertThat(record.getFieldValue("LONG|DATE"), nullValue());
393
+ assertThat(record.getFieldValue("LONG|DATE|JST"), nullValue());
394
+ assertThat(record.getFieldValue("LONG|DATE|PST"), nullValue());
395
+ assertThat(record.getFieldValue("LONG|TIME"), nullValue());
396
+ assertThat(record.getFieldValue("LONG|TIME|JST"), nullValue());
397
+ assertThat(record.getFieldValue("LONG|TIME|PST"), nullValue());
398
+ assertThat(record.getFieldValue("LONG|DATETIME"), nullValue());
399
+ assertThat(record.getFieldValue("DOUBLE|SINGLE_LINE_TEXT"), nullValue());
400
+ assertThat(record.getFieldValue("DOUBLE"), nullValue());
401
+ assertThat(record.getFieldValue("DOUBLE|DATE"), nullValue());
402
+ assertThat(record.getFieldValue("DOUBLE|DATE|JST"), nullValue());
403
+ assertThat(record.getFieldValue("DOUBLE|DATE|PST"), nullValue());
404
+ assertThat(record.getFieldValue("DOUBLE|TIME"), nullValue());
405
+ assertThat(record.getFieldValue("DOUBLE|TIME|JST"), nullValue());
406
+ assertThat(record.getFieldValue("DOUBLE|TIME|PST"), nullValue());
407
+ assertThat(record.getFieldValue("DOUBLE|DATETIME"), nullValue());
408
+ assertThat(record.getFieldValue("STRING|SINGLE_LINE_TEXT"), nullValue());
409
+ assertThat(record.getFieldValue("STRING"), nullValue());
410
+ assertThat(record.getFieldValue("STRING|RICH_TEXT"), nullValue());
411
+ assertThat(record.getFieldValue("STRING|NUMBER"), nullValue());
412
+ assertThat(record.getFieldValue("STRING|CHECK_BOX"), nullValue());
413
+ assertThat(record.getFieldValue("STRING|RADIO_BUTTON"), nullValue());
414
+ assertThat(record.getFieldValue("STRING|MULTI_SELECT"), nullValue());
415
+ assertThat(record.getFieldValue("STRING|DROP_DOWN"), nullValue());
416
+ assertThat(record.getFieldValue("STRING|DATE"), nullValue());
417
+ assertThat(record.getFieldValue("STRING|DATE|JST"), nullValue());
418
+ assertThat(record.getFieldValue("STRING|DATE|PST"), nullValue());
419
+ assertThat(record.getFieldValue("STRING|TIME"), nullValue());
420
+ assertThat(record.getFieldValue("STRING|TIME|JST"), nullValue());
421
+ assertThat(record.getFieldValue("STRING|TIME|PST"), nullValue());
422
+ assertThat(record.getFieldValue("STRING|DATETIME"), nullValue());
423
+ assertThat(record.getFieldValue("STRING|LINK"), nullValue());
424
+ assertThat(record.getFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue());
425
+ assertThat(record.getFieldValue("TIMESTAMP|NUMBER"), nullValue());
426
+ assertThat(record.getFieldValue("TIMESTAMP|DATE"), nullValue());
427
+ assertThat(record.getFieldValue("TIMESTAMP|DATE|JST"), nullValue());
428
+ assertThat(record.getFieldValue("TIMESTAMP|DATE|PST"), nullValue());
429
+ assertThat(record.getFieldValue("TIMESTAMP|TIME"), nullValue());
430
+ assertThat(record.getFieldValue("TIMESTAMP|TIME|JST"), nullValue());
431
+ assertThat(record.getFieldValue("TIMESTAMP|TIME|PST"), nullValue());
432
+ assertThat(record.getFieldValue("TIMESTAMP"), nullValue());
433
+ assertThat(record.getFieldValue("JSON|SINGLE_LINE_TEXT"), nullValue());
434
+ assertThat(record.getFieldValue("JSON"), nullValue());
435
+ assertThat(updateKey.getField(), nullValue());
436
+ assertThat(updateKey.getValue(), nullValue());
437
+ },
438
+ true);
439
+ }
440
+
441
+ @Test
442
+ public void testUpdateKey() {
443
+ assertThrows(UnsupportedOperationException.class, () -> verifier("TIMESTAMP").verify());
444
+ KintoneColumnVisitorVerifier verifier = verifier("TIMESTAMP|NUMBER");
445
+ verifier.verify(
446
+ (record, updateKey) -> {
447
+ assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER"));
448
+ assertThat(updateKey.getValue(), is(number("0")));
449
+ });
450
+ verifier.verify(
451
+ (record, updateKey) -> {
452
+ assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER"));
453
+ assertThat(updateKey.getValue(), is(number("0")));
454
+ });
455
+ verifier.verify(
456
+ (record, updateKey) -> {
457
+ assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER"));
458
+ assertThat(updateKey.getValue(), is(number("946684799")));
459
+ });
460
+ verifier.verify(
461
+ (record, updateKey) -> {
462
+ assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER"));
463
+ assertThat(updateKey.getValue(), is(number("946684800")));
464
+ });
465
+ }
466
+
467
+ private static KintoneColumnVisitorVerifier verifier(String updateKeyName) {
468
+ Schema schema = build(Schema.builder());
469
+ return new KintoneColumnVisitorVerifier(
470
+ schema,
471
+ build(ImmutableMap.builder()),
472
+ updateKeyName,
473
+ OutputPageBuilder.build(schema, KintoneColumnVisitorTest::build));
474
+ }
475
+
476
+ private static KintoneColumnVisitorVerifier verifier(
477
+ String updateKeyName, boolean preferNulls, boolean ignoreNulls) {
478
+ Schema schema = build(Schema.builder());
479
+ return new KintoneColumnVisitorVerifier(
480
+ schema,
481
+ build(ImmutableMap.builder()),
482
+ preferNulls,
483
+ ignoreNulls,
484
+ updateKeyName,
485
+ OutputPageBuilder.build(schema, KintoneColumnVisitorTest::build));
486
+ }
487
+
136
488
  private static Schema build(Schema.Builder builder) {
137
489
  return builder
138
490
  .add("BOOLEAN|SINGLE_LINE_TEXT", Types.BOOLEAN)
139
- // java.lang.NumberFormatException at java.math.BigDecimal.<init>
140
- // .add("BOOLEAN", Types.BOOLEAN)
491
+ .add("BOOLEAN", Types.BOOLEAN)
141
492
  .add("LONG|SINGLE_LINE_TEXT", Types.LONG)
142
493
  .add("LONG", Types.LONG)
494
+ .add("LONG|DATE", Types.LONG)
495
+ .add("LONG|DATE|JST", Types.LONG)
496
+ .add("LONG|DATE|PST", Types.LONG)
497
+ .add("LONG|TIME", Types.LONG)
498
+ .add("LONG|TIME|JST", Types.LONG)
499
+ .add("LONG|TIME|PST", Types.LONG)
500
+ .add("LONG|DATETIME", Types.LONG)
143
501
  .add("DOUBLE|SINGLE_LINE_TEXT", Types.DOUBLE)
144
502
  .add("DOUBLE", Types.DOUBLE)
503
+ .add("DOUBLE|DATE", Types.DOUBLE)
504
+ .add("DOUBLE|DATE|JST", Types.DOUBLE)
505
+ .add("DOUBLE|DATE|PST", Types.DOUBLE)
506
+ .add("DOUBLE|TIME", Types.DOUBLE)
507
+ .add("DOUBLE|TIME|JST", Types.DOUBLE)
508
+ .add("DOUBLE|TIME|PST", Types.DOUBLE)
509
+ .add("DOUBLE|DATETIME", Types.DOUBLE)
145
510
  .add("STRING|SINGLE_LINE_TEXT", Types.STRING)
146
511
  .add("STRING", Types.STRING)
512
+ .add("STRING|RICH_TEXT", Types.STRING)
147
513
  .add("STRING|NUMBER", Types.STRING)
148
514
  .add("STRING|CHECK_BOX", Types.STRING)
515
+ .add("STRING|RADIO_BUTTON", Types.STRING)
516
+ .add("STRING|MULTI_SELECT", Types.STRING)
149
517
  .add("STRING|DROP_DOWN", Types.STRING)
518
+ .add("STRING|DATE", Types.STRING)
519
+ .add("STRING|DATE|JST", Types.STRING)
520
+ .add("STRING|DATE|PST", Types.STRING)
521
+ .add("STRING|TIME", Types.STRING)
522
+ .add("STRING|TIME|JST", Types.STRING)
523
+ .add("STRING|TIME|PST", Types.STRING)
524
+ .add("STRING|DATETIME", Types.STRING)
150
525
  .add("STRING|LINK", Types.STRING)
151
526
  .add("TIMESTAMP|SINGLE_LINE_TEXT", Types.TIMESTAMP)
527
+ .add("TIMESTAMP|NUMBER", Types.TIMESTAMP)
152
528
  .add("TIMESTAMP|DATE", Types.TIMESTAMP)
153
529
  .add("TIMESTAMP|DATE|JST", Types.TIMESTAMP)
154
530
  .add("TIMESTAMP|DATE|PST", Types.TIMESTAMP)
531
+ .add("TIMESTAMP|TIME", Types.TIMESTAMP)
532
+ .add("TIMESTAMP|TIME|JST", Types.TIMESTAMP)
533
+ .add("TIMESTAMP|TIME|PST", Types.TIMESTAMP)
155
534
  .add("TIMESTAMP", Types.TIMESTAMP)
156
535
  .add("JSON|SINGLE_LINE_TEXT", Types.JSON)
157
536
  .add("JSON", Types.JSON)
@@ -165,18 +544,46 @@ public class KintoneColumnVisitorTest {
165
544
  .put(build("BOOLEAN", it -> it.setType("NUMBER")))
166
545
  .put(build("LONG|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT")))
167
546
  .put(build("LONG", it -> it.setType("NUMBER")))
547
+ .put(build("LONG|DATE", it -> it.setType("DATE").setTimezone("UTC")))
548
+ .put(build("LONG|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo")))
549
+ .put(build("LONG|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific")))
550
+ .put(build("LONG|TIME", it -> it.setType("TIME").setTimezone("UTC")))
551
+ .put(build("LONG|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo")))
552
+ .put(build("LONG|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific")))
553
+ .put(build("LONG|DATETIME", it -> it.setType("DATETIME")))
168
554
  .put(build("DOUBLE|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT")))
169
555
  .put(build("DOUBLE", it -> it.setType("NUMBER")))
556
+ .put(build("DOUBLE|DATE", it -> it.setType("DATE").setTimezone("UTC")))
557
+ .put(build("DOUBLE|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo")))
558
+ .put(build("DOUBLE|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific")))
559
+ .put(build("DOUBLE|TIME", it -> it.setType("TIME").setTimezone("UTC")))
560
+ .put(build("DOUBLE|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo")))
561
+ .put(build("DOUBLE|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific")))
562
+ .put(build("DOUBLE|DATETIME", it -> it.setType("DATETIME")))
170
563
  .put(build("STRING|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT")))
171
564
  .put(build("STRING", it -> it.setType("MULTI_LINE_TEXT")))
565
+ .put(build("STRING|RICH_TEXT", it -> it.setType("RICH_TEXT")))
172
566
  .put(build("STRING|NUMBER", it -> it.setType("NUMBER")))
173
567
  .put(build("STRING|CHECK_BOX", it -> it.setType("CHECK_BOX").setValueSeparator(",")))
568
+ .put(build("STRING|RADIO_BUTTON", it -> it.setType("RADIO_BUTTON")))
569
+ .put(build("STRING|MULTI_SELECT", it -> it.setType("MULTI_SELECT").setValueSeparator(",")))
174
570
  .put(build("STRING|DROP_DOWN", it -> it.setType("DROP_DOWN")))
571
+ .put(build("STRING|DATE", it -> it.setType("DATE").setTimezone("UTC")))
572
+ .put(build("STRING|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo")))
573
+ .put(build("STRING|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific")))
574
+ .put(build("STRING|TIME", it -> it.setType("TIME").setTimezone("UTC")))
575
+ .put(build("STRING|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo")))
576
+ .put(build("STRING|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific")))
577
+ .put(build("STRING|DATETIME", it -> it.setType("DATETIME")))
175
578
  .put(build("STRING|LINK", it -> it.setType("LINK")))
176
579
  .put(build("TIMESTAMP|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT")))
580
+ .put(build("TIMESTAMP|NUMBER", it -> it.setType("NUMBER")))
177
581
  .put(build("TIMESTAMP|DATE", it -> it.setType("DATE").setTimezone("UTC")))
178
582
  .put(build("TIMESTAMP|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo")))
179
583
  .put(build("TIMESTAMP|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific")))
584
+ .put(build("TIMESTAMP|TIME", it -> it.setType("TIME").setTimezone("UTC")))
585
+ .put(build("TIMESTAMP|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo")))
586
+ .put(build("TIMESTAMP|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific")))
180
587
  .put(build("TIMESTAMP", it -> it.setType("DATETIME")))
181
588
  .put(build("JSON|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT")))
182
589
  .put(build("JSON", it -> it.setType("MULTI_LINE_TEXT")))
@@ -192,81 +599,193 @@ public class KintoneColumnVisitorTest {
192
599
  private static Page build(OutputPageBuilder builder) {
193
600
  return builder
194
601
  .setNull("BOOLEAN|SINGLE_LINE_TEXT")
195
- // .setNull("BOOLEAN")
602
+ .setNull("BOOLEAN")
196
603
  .setNull("LONG|SINGLE_LINE_TEXT")
197
604
  .setNull("LONG")
605
+ .setNull("LONG|DATE")
606
+ .setNull("LONG|DATE|JST")
607
+ .setNull("LONG|DATE|PST")
608
+ .setNull("LONG|TIME")
609
+ .setNull("LONG|TIME|JST")
610
+ .setNull("LONG|TIME|PST")
611
+ .setNull("LONG|DATETIME")
198
612
  .setNull("DOUBLE|SINGLE_LINE_TEXT")
199
613
  .setNull("DOUBLE")
614
+ .setNull("DOUBLE|DATE")
615
+ .setNull("DOUBLE|DATE|JST")
616
+ .setNull("DOUBLE|DATE|PST")
617
+ .setNull("DOUBLE|TIME")
618
+ .setNull("DOUBLE|TIME|JST")
619
+ .setNull("DOUBLE|TIME|PST")
620
+ .setNull("DOUBLE|DATETIME")
200
621
  .setNull("STRING|SINGLE_LINE_TEXT")
201
622
  .setNull("STRING")
623
+ .setNull("STRING|RICH_TEXT")
202
624
  .setNull("STRING|NUMBER")
203
625
  .setNull("STRING|CHECK_BOX")
626
+ .setNull("STRING|RADIO_BUTTON")
627
+ .setNull("STRING|MULTI_SELECT")
204
628
  .setNull("STRING|DROP_DOWN")
629
+ .setNull("STRING|DATE")
630
+ .setNull("STRING|DATE|JST")
631
+ .setNull("STRING|DATE|PST")
632
+ .setNull("STRING|TIME")
633
+ .setNull("STRING|TIME|JST")
634
+ .setNull("STRING|TIME|PST")
635
+ .setNull("STRING|DATETIME")
205
636
  .setNull("STRING|LINK")
206
637
  .setNull("TIMESTAMP|SINGLE_LINE_TEXT")
638
+ .setNull("TIMESTAMP|NUMBER")
207
639
  .setNull("TIMESTAMP|DATE")
208
640
  .setNull("TIMESTAMP|DATE|JST")
209
641
  .setNull("TIMESTAMP|DATE|PST")
642
+ .setNull("TIMESTAMP|TIME")
643
+ .setNull("TIMESTAMP|TIME|JST")
644
+ .setNull("TIMESTAMP|TIME|PST")
210
645
  .setNull("TIMESTAMP")
211
646
  .setNull("JSON|SINGLE_LINE_TEXT")
212
647
  .setNull("JSON")
213
648
  .addRecord()
214
649
  .setBoolean("BOOLEAN|SINGLE_LINE_TEXT", false)
215
- // .setBoolean("BOOLEAN", false)
650
+ .setBoolean("BOOLEAN", false)
216
651
  .setLong("LONG|SINGLE_LINE_TEXT", 0)
217
652
  .setLong("LONG", 0)
653
+ .setLong("LONG|DATE", 0)
654
+ .setLong("LONG|DATE|JST", 0)
655
+ .setLong("LONG|DATE|PST", 0)
656
+ .setLong("LONG|TIME", 0)
657
+ .setLong("LONG|TIME|JST", 0)
658
+ .setLong("LONG|TIME|PST", 0)
659
+ .setLong("LONG|DATETIME", 0)
218
660
  .setDouble("DOUBLE|SINGLE_LINE_TEXT", 0)
219
661
  .setDouble("DOUBLE", 0)
662
+ .setDouble("DOUBLE|DATE", 0)
663
+ .setDouble("DOUBLE|DATE|JST", 0)
664
+ .setDouble("DOUBLE|DATE|PST", 0)
665
+ .setDouble("DOUBLE|TIME", 0)
666
+ .setDouble("DOUBLE|TIME|JST", 0)
667
+ .setDouble("DOUBLE|TIME|PST", 0)
668
+ .setDouble("DOUBLE|DATETIME", 0)
220
669
  .setString("STRING|SINGLE_LINE_TEXT", "")
221
670
  .setString("STRING", "")
671
+ .setString("STRING|RICH_TEXT", "")
222
672
  .setString("STRING|NUMBER", "")
223
673
  .setString("STRING|CHECK_BOX", "")
674
+ .setString("STRING|RADIO_BUTTON", "")
675
+ .setString("STRING|MULTI_SELECT", "")
224
676
  .setString("STRING|DROP_DOWN", "")
677
+ .setString("STRING|DATE", "")
678
+ .setString("STRING|DATE|JST", "")
679
+ .setString("STRING|DATE|PST", "")
680
+ .setString("STRING|TIME", "")
681
+ .setString("STRING|TIME|JST", "")
682
+ .setString("STRING|TIME|PST", "")
683
+ .setString("STRING|DATETIME", "")
225
684
  .setString("STRING|LINK", "")
226
685
  .setTimestamp("TIMESTAMP|SINGLE_LINE_TEXT", Timestamp.ofInstant(Instant.EPOCH))
686
+ .setTimestamp("TIMESTAMP|NUMBER", Timestamp.ofInstant(Instant.EPOCH))
227
687
  .setTimestamp("TIMESTAMP|DATE", Timestamp.ofInstant(Instant.EPOCH))
228
688
  .setTimestamp("TIMESTAMP|DATE|JST", Timestamp.ofInstant(Instant.EPOCH))
229
689
  .setTimestamp("TIMESTAMP|DATE|PST", Timestamp.ofInstant(Instant.EPOCH))
690
+ .setTimestamp("TIMESTAMP|TIME", Timestamp.ofInstant(Instant.EPOCH))
691
+ .setTimestamp("TIMESTAMP|TIME|JST", Timestamp.ofInstant(Instant.EPOCH))
692
+ .setTimestamp("TIMESTAMP|TIME|PST", Timestamp.ofInstant(Instant.EPOCH))
230
693
  .setTimestamp("TIMESTAMP", Timestamp.ofInstant(Instant.EPOCH))
231
694
  .setJson("JSON|SINGLE_LINE_TEXT", ValueFactory.newString(""))
232
695
  .setJson("JSON", ValueFactory.newString(""))
233
696
  .addRecord()
234
697
  .setBoolean("BOOLEAN|SINGLE_LINE_TEXT", true)
235
- // .setBoolean("BOOLEAN", true)
698
+ .setBoolean("BOOLEAN", true)
236
699
  .setLong("LONG|SINGLE_LINE_TEXT", 123)
237
700
  .setLong("LONG", 123)
701
+ .setLong("LONG|DATE", 946684799)
702
+ .setLong("LONG|DATE|JST", 946684799)
703
+ .setLong("LONG|DATE|PST", 946684799)
704
+ .setLong("LONG|TIME", 946684799)
705
+ .setLong("LONG|TIME|JST", 946684799)
706
+ .setLong("LONG|TIME|PST", 946684799)
707
+ .setLong("LONG|DATETIME", 946684799)
238
708
  .setDouble("DOUBLE|SINGLE_LINE_TEXT", 123)
239
709
  .setDouble("DOUBLE", 123)
710
+ .setDouble("DOUBLE|DATE", 946684799)
711
+ .setDouble("DOUBLE|DATE|JST", 946684799)
712
+ .setDouble("DOUBLE|DATE|PST", 946684799)
713
+ .setDouble("DOUBLE|TIME", 946684799)
714
+ .setDouble("DOUBLE|TIME|JST", 946684799)
715
+ .setDouble("DOUBLE|TIME|PST", 946684799)
716
+ .setDouble("DOUBLE|DATETIME", 946684799)
240
717
  .setString("STRING|SINGLE_LINE_TEXT", "abc")
241
718
  .setString("STRING", "abc")
719
+ .setString("STRING|RICH_TEXT", "abc")
242
720
  .setString("STRING|NUMBER", "123")
243
721
  .setString("STRING|CHECK_BOX", "123,abc")
722
+ .setString("STRING|RADIO_BUTTON", "abc")
723
+ .setString("STRING|MULTI_SELECT", "123,abc")
244
724
  .setString("STRING|DROP_DOWN", "abc")
725
+ .setString("STRING|DATE", "1999-12-31")
726
+ .setString("STRING|DATE|JST", "1999-12-31")
727
+ .setString("STRING|DATE|PST", "1999-12-31")
728
+ .setString("STRING|TIME", "23:59:59")
729
+ .setString("STRING|TIME|JST", "23:59:59")
730
+ .setString("STRING|TIME|PST", "23:59:59")
731
+ .setString("STRING|DATETIME", "1999-12-31T23:59:59Z")
245
732
  .setString("STRING|LINK", "abc")
246
733
  .setTimestamp("TIMESTAMP|SINGLE_LINE_TEXT", timestamp("1999-12-31T23:59:59Z"))
734
+ .setTimestamp("TIMESTAMP|NUMBER", timestamp("1999-12-31T23:59:59Z"))
247
735
  .setTimestamp("TIMESTAMP|DATE", timestamp("1999-12-31T23:59:59Z"))
248
736
  .setTimestamp("TIMESTAMP|DATE|JST", timestamp("1999-12-31T23:59:59Z"))
249
737
  .setTimestamp("TIMESTAMP|DATE|PST", timestamp("1999-12-31T23:59:59Z"))
738
+ .setTimestamp("TIMESTAMP|TIME", timestamp("1999-12-31T23:59:59Z"))
739
+ .setTimestamp("TIMESTAMP|TIME|JST", timestamp("1999-12-31T23:59:59Z"))
740
+ .setTimestamp("TIMESTAMP|TIME|PST", timestamp("1999-12-31T23:59:59Z"))
250
741
  .setTimestamp("TIMESTAMP", timestamp("1999-12-31T23:59:59Z"))
251
742
  .setJson("JSON|SINGLE_LINE_TEXT", ValueFactory.newString("abc"))
252
743
  .setJson("JSON", ValueFactory.newString("abc"))
253
744
  .addRecord()
254
745
  .setBoolean("BOOLEAN|SINGLE_LINE_TEXT", false)
255
- // .setBoolean("BOOLEAN", false)
746
+ .setBoolean("BOOLEAN", false)
256
747
  .setLong("LONG|SINGLE_LINE_TEXT", 456)
257
748
  .setLong("LONG", 456)
749
+ .setLong("LONG|DATE", 946684800)
750
+ .setLong("LONG|DATE|JST", 946684800)
751
+ .setLong("LONG|DATE|PST", 946684800)
752
+ .setLong("LONG|TIME", 946684800)
753
+ .setLong("LONG|TIME|JST", 946684800)
754
+ .setLong("LONG|TIME|PST", 946684800)
755
+ .setLong("LONG|DATETIME", 946684800)
258
756
  .setDouble("DOUBLE|SINGLE_LINE_TEXT", 456)
259
757
  .setDouble("DOUBLE", 456)
758
+ .setDouble("DOUBLE|DATE", 946684800)
759
+ .setDouble("DOUBLE|DATE|JST", 946684800)
760
+ .setDouble("DOUBLE|DATE|PST", 946684800)
761
+ .setDouble("DOUBLE|TIME", 946684800)
762
+ .setDouble("DOUBLE|TIME|JST", 946684800)
763
+ .setDouble("DOUBLE|TIME|PST", 946684800)
764
+ .setDouble("DOUBLE|DATETIME", 946684800)
260
765
  .setString("STRING|SINGLE_LINE_TEXT", "def")
261
766
  .setString("STRING", "def")
767
+ .setString("STRING|RICH_TEXT", "def")
262
768
  .setString("STRING|NUMBER", "456")
263
769
  .setString("STRING|CHECK_BOX", "456,def")
770
+ .setString("STRING|RADIO_BUTTON", "def")
771
+ .setString("STRING|MULTI_SELECT", "456,def")
264
772
  .setString("STRING|DROP_DOWN", "def")
773
+ .setString("STRING|DATE", "2000-01-01")
774
+ .setString("STRING|DATE|JST", "2000-01-01")
775
+ .setString("STRING|DATE|PST", "2000-01-01")
776
+ .setString("STRING|TIME", "00:00:00")
777
+ .setString("STRING|TIME|JST", "00:00:00")
778
+ .setString("STRING|TIME|PST", "00:00:00")
779
+ .setString("STRING|DATETIME", "2000-01-01T00:00:00Z")
265
780
  .setString("STRING|LINK", "def")
266
781
  .setTimestamp("TIMESTAMP|SINGLE_LINE_TEXT", timestamp("2000-01-01T00:00:00Z"))
782
+ .setTimestamp("TIMESTAMP|NUMBER", timestamp("2000-01-01T00:00:00Z"))
267
783
  .setTimestamp("TIMESTAMP|DATE", timestamp("2000-01-01T00:00:00Z"))
268
784
  .setTimestamp("TIMESTAMP|DATE|JST", timestamp("2000-01-01T00:00:00Z"))
269
785
  .setTimestamp("TIMESTAMP|DATE|PST", timestamp("2000-01-01T00:00:00Z"))
786
+ .setTimestamp("TIMESTAMP|TIME", timestamp("2000-01-01T00:00:00Z"))
787
+ .setTimestamp("TIMESTAMP|TIME|JST", timestamp("2000-01-01T00:00:00Z"))
788
+ .setTimestamp("TIMESTAMP|TIME|PST", timestamp("2000-01-01T00:00:00Z"))
270
789
  .setTimestamp("TIMESTAMP", timestamp("2000-01-01T00:00:00Z"))
271
790
  .setJson("JSON|SINGLE_LINE_TEXT", ValueFactory.newString("def"))
272
791
  .setJson("JSON", ValueFactory.newString("def"))
@@ -287,8 +806,12 @@ public class KintoneColumnVisitorTest {
287
806
  return LocalDate.parse(text);
288
807
  }
289
808
 
809
+ private static LocalTime time(CharSequence text) {
810
+ return LocalTime.parse(text);
811
+ }
812
+
290
813
  private static ZonedDateTime dateTime(CharSequence text) {
291
- return ZonedDateTime.parse(text).withZoneSameInstant(ZoneId.of("UTC"));
814
+ return ZonedDateTime.parse(text);
292
815
  }
293
816
 
294
817
  private static Timestamp timestamp(CharSequence text) {