diff --git a/README.md b/README.md index d2f6b5d..086336b 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,22 @@ kintone output plugin for Embulk stores app records from kintone. ## Configuration -- **domain**: kintone domain(FQDN) e.g. devfoo.cybozu.com (string, required) +- **domain**: kintone domain (FQDN) e.g. devfoo.cybozu.com (string, required) - **username**: kintone username (string, optional) - **password**: kintone password (string, optional) - **token**: kintone app token. Username and password or token must be configured. If all of them are provided, this plugin uses username and password (string, optional) - **app_id**: kintone app id (integer, required) -- **basic_auth_username**: kintone basic auth username Please see kintone basic auth [here](https://jp.cybozu.help/general/en/admin/list_security/list_ip_basic/basic_auth.html) (string, optional) -- **basic_auth_password**: kintone basic auth password (string, optional) +- **basic_auth_username**: kintone basic auth username Please see kintone basic auth [here](https://jp.cybozu.help/general/en/admin/list_security/list_ip_basic/basic_auth.html) (string, optional) +- **basic_auth_password**: kintone basic auth password (string, optional) - **guest_space_id**: kintone app belongs to guest space, guest space id is required. (integer, optional) - **mode**: kintone mode (string, required) -- **update_key**: column name to set update key (string, required if mode is update or upsert) +- **update_key**: Column name to set update key (string, required if mode is update or upsert) +- **prefer_nulls**: Whether to set fields to null instead of default value of type when column is null (boolean, default is `false`) +- **ignore_nulls**: Whether to completely ignore fields when column is null (boolean, default is `false`) - **column_options** advanced: a key-value pairs where key is a column name and value is options for the column. - **field_code**: field code (string, required) - - **type**: field type (string, required) + - **type**: field type (string, required). See [this page](https://cybozu.dev/ja/kintone/docs/overview/field-types/#field-type-update) for list of available types. However, following types are not yet supported + - `USER_SELECT`, `ORGANIZATION_SELECT`, `GROUP_SELECT`, `FILE`, `SUBTABLE` - **timezone**: timezone to convert into `date` (string, default is `UTC`) - **val_sep**: Used to specify multiple checkbox values (string, default is `,`) @@ -43,7 +46,6 @@ out: date_time: {field_code: "datetime", type: "DATETIME"} ``` - ## Build ``` diff --git a/src/main/java/org/embulk/output/kintone/KintoneColumnOption.java b/src/main/java/org/embulk/output/kintone/KintoneColumnOption.java index 605152c..025f35b 100644 --- a/src/main/java/org/embulk/output/kintone/KintoneColumnOption.java +++ b/src/main/java/org/embulk/output/kintone/KintoneColumnOption.java @@ -1,6 +1,5 @@ package org.embulk.output.kintone; -import java.util.Optional; import org.embulk.config.Config; import org.embulk.config.ConfigDefault; import org.embulk.config.Task; @@ -14,7 +13,7 @@ public interface KintoneColumnOption extends Task { @Config("timezone") @ConfigDefault("\"UTC\"") - Optional getTimezone(); + String getTimezone(); @Config("val_sep") @ConfigDefault("\",\"") diff --git a/src/main/java/org/embulk/output/kintone/KintoneColumnType.java b/src/main/java/org/embulk/output/kintone/KintoneColumnType.java new file mode 100644 index 0000000..fca120f --- /dev/null +++ b/src/main/java/org/embulk/output/kintone/KintoneColumnType.java @@ -0,0 +1,368 @@ +package org.embulk.output.kintone; + +import com.kintone.client.model.record.CheckBoxFieldValue; +import com.kintone.client.model.record.DateFieldValue; +import com.kintone.client.model.record.DateTimeFieldValue; +import com.kintone.client.model.record.DropDownFieldValue; +import com.kintone.client.model.record.FieldValue; +import com.kintone.client.model.record.FileFieldValue; +import com.kintone.client.model.record.GroupSelectFieldValue; +import com.kintone.client.model.record.LinkFieldValue; +import com.kintone.client.model.record.MultiLineTextFieldValue; +import com.kintone.client.model.record.MultiSelectFieldValue; +import com.kintone.client.model.record.NumberFieldValue; +import com.kintone.client.model.record.OrganizationSelectFieldValue; +import com.kintone.client.model.record.RadioButtonFieldValue; +import com.kintone.client.model.record.RichTextFieldValue; +import com.kintone.client.model.record.SingleLineTextFieldValue; +import com.kintone.client.model.record.SubtableFieldValue; +import com.kintone.client.model.record.TimeFieldValue; +import com.kintone.client.model.record.UpdateKey; +import com.kintone.client.model.record.UserSelectFieldValue; +import java.math.BigDecimal; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.embulk.spi.time.Timestamp; +import org.msgpack.value.Value; + +public enum KintoneColumnType { + SINGLE_LINE_TEXT { + @Override + public SingleLineTextFieldValue getFieldValue() { + return new SingleLineTextFieldValue(null); + } + + @Override + public SingleLineTextFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new SingleLineTextFieldValue(value); + } + + @Override + public void setUpdateKey(UpdateKey updateKey, String field) { + updateKey.setField(field); + } + + @Override + public void setUpdateKey(UpdateKey updateKey, String field, FieldValue value) { + updateKey.setField(field).setValue(((SingleLineTextFieldValue) value).getValue()); + } + }, + MULTI_LINE_TEXT { + @Override + public MultiLineTextFieldValue getFieldValue() { + return new MultiLineTextFieldValue(null); + } + + @Override + public MultiLineTextFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new MultiLineTextFieldValue(value); + } + }, + RICH_TEXT { + @Override + public RichTextFieldValue getFieldValue() { + return new RichTextFieldValue(null); + } + + @Override + public RichTextFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new RichTextFieldValue(value); + } + }, + NUMBER { + @Override + public NumberFieldValue getFieldValue() { + return new NumberFieldValue(null); + } + + @Override + public NumberFieldValue getFieldValue(boolean value, KintoneColumnOption option) { + return getFieldValue(value ? "1" : "0", option); + } + + @Override + public NumberFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new NumberFieldValue(new BigDecimal(value.isEmpty() ? "0" : value)); + } + + @Override + public NumberFieldValue getFieldValue(Timestamp value, KintoneColumnOption option) { + return (NumberFieldValue) getFieldValue(value.getEpochSecond(), option); + } + + @Override + public void setUpdateKey(UpdateKey updateKey, String field) { + updateKey.setField(field); + } + + @Override + public void setUpdateKey(UpdateKey updateKey, String field, FieldValue value) { + updateKey.setField(field).setValue(((NumberFieldValue) value).getValue()); + } + }, + CHECK_BOX { + @Override + public CheckBoxFieldValue getFieldValue() { + return new CheckBoxFieldValue(); + } + + @Override + public CheckBoxFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new CheckBoxFieldValue(asList(value, option)); + } + }, + RADIO_BUTTON { + @Override + public RadioButtonFieldValue getFieldValue() { + return new RadioButtonFieldValue(null); + } + + @Override + public RadioButtonFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new RadioButtonFieldValue(value); + } + }, + MULTI_SELECT { + @Override + public MultiSelectFieldValue getFieldValue() { + return new MultiSelectFieldValue(); + } + + @Override + public MultiSelectFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new MultiSelectFieldValue(asList(value, option)); + } + }, + DROP_DOWN { + @Override + public DropDownFieldValue getFieldValue() { + return new DropDownFieldValue(null); + } + + @Override + public DropDownFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new DropDownFieldValue(value); + } + }, + USER_SELECT { + @Override + public UserSelectFieldValue getFieldValue() { + return new UserSelectFieldValue(); + } + + @Override + public UserSelectFieldValue getFieldValue(String value, KintoneColumnOption option) { + throw new UnsupportedOperationException(); + } + }, + ORGANIZATION_SELECT { + @Override + public OrganizationSelectFieldValue getFieldValue() { + return new OrganizationSelectFieldValue(); + } + + @Override + public OrganizationSelectFieldValue getFieldValue(String value, KintoneColumnOption option) { + throw new UnsupportedOperationException(); + } + }, + GROUP_SELECT { + @Override + public GroupSelectFieldValue getFieldValue() { + return new GroupSelectFieldValue(); + } + + @Override + public GroupSelectFieldValue getFieldValue(String value, KintoneColumnOption option) { + throw new UnsupportedOperationException(); + } + }, + DATE { + @Override + public DateFieldValue getFieldValue() { + return new DateFieldValue(null); + } + + @Override + public DateFieldValue getFieldValue(long value, KintoneColumnOption option) { + return getFieldValue(Timestamp.ofEpochSecond(value), option); + } + + @Override + public DateFieldValue getFieldValue(double value, KintoneColumnOption option) { + return getFieldValue(Double.valueOf(value).longValue(), option); + } + + @Override + public DateFieldValue getFieldValue(String value, KintoneColumnOption option) { + return value.isEmpty() + ? getFieldValue(EPOCH, option) + : new DateFieldValue( + LocalDate.parse(value) + .atStartOfDay(ZoneOffset.UTC) + .withZoneSameInstant(getZoneId(option)) + .toLocalDate()); + } + + @Override + public DateFieldValue getFieldValue(Timestamp value, KintoneColumnOption option) { + return new DateFieldValue(value.getInstant().atZone(getZoneId(option)).toLocalDate()); + } + }, + TIME { + @Override + public TimeFieldValue getFieldValue() { + return new TimeFieldValue(null); + } + + @Override + public TimeFieldValue getFieldValue(long value, KintoneColumnOption option) { + return getFieldValue(Timestamp.ofEpochSecond(value), option); + } + + @Override + public TimeFieldValue getFieldValue(double value, KintoneColumnOption option) { + return getFieldValue(Double.valueOf(value).longValue(), option); + } + + @Override + public TimeFieldValue getFieldValue(String value, KintoneColumnOption option) { + return value.isEmpty() + ? getFieldValue(EPOCH, option) + : new TimeFieldValue( + LocalTime.parse(value) + .atOffset(ZoneOffset.UTC) + .withOffsetSameInstant(getZoneOffset(option)) + .toLocalTime()); + } + + @Override + public TimeFieldValue getFieldValue(Timestamp value, KintoneColumnOption option) { + return new TimeFieldValue(value.getInstant().atZone(getZoneId(option)).toLocalTime()); + } + }, + DATETIME { + @Override + public DateTimeFieldValue getFieldValue() { + return new DateTimeFieldValue(null); + } + + @Override + public DateTimeFieldValue getFieldValue(long value, KintoneColumnOption option) { + return getFieldValue(Timestamp.ofEpochSecond(value), option); + } + + @Override + public DateTimeFieldValue getFieldValue(double value, KintoneColumnOption option) { + return getFieldValue(Double.valueOf(value).longValue(), option); + } + + @Override + public DateTimeFieldValue getFieldValue(String value, KintoneColumnOption option) { + return value.isEmpty() + ? getFieldValue(EPOCH, option) + : new DateTimeFieldValue(ZonedDateTime.parse(value)); + } + + @Override + public DateTimeFieldValue getFieldValue(Timestamp value, KintoneColumnOption option) { + return new DateTimeFieldValue(value.getInstant().atZone(ZoneOffset.UTC)); + } + }, + LINK { + @Override + public LinkFieldValue getFieldValue() { + return new LinkFieldValue(null); + } + + @Override + public LinkFieldValue getFieldValue(String value, KintoneColumnOption option) { + return new LinkFieldValue(value); + } + }, + FILE { + @Override + public FileFieldValue getFieldValue() { + return new FileFieldValue(); + } + + @Override + public FileFieldValue getFieldValue(String value, KintoneColumnOption option) { + throw new UnsupportedOperationException(); + } + }, + SUBTABLE { + @Override + public SubtableFieldValue getFieldValue() { + return new SubtableFieldValue(); + } + + @Override + public SubtableFieldValue getFieldValue(String value, KintoneColumnOption option) { + throw new UnsupportedOperationException(); + } + }; + private static final Timestamp EPOCH = Timestamp.ofInstant(Instant.EPOCH); + + public static KintoneColumnType getType( + KintoneColumnOption option, KintoneColumnType defaultType) { + return option != null ? valueOf(option.getType()) : defaultType; + } + + public abstract FieldValue getFieldValue(); + + public FieldValue getFieldValue(boolean value, KintoneColumnOption option) { + return getFieldValue(String.valueOf(value), option); + } + + public FieldValue getFieldValue(long value, KintoneColumnOption option) { + return getFieldValue(String.valueOf(value), option); + } + + public FieldValue getFieldValue(double value, KintoneColumnOption option) { + return getFieldValue(String.valueOf(value), option); + } + + public abstract FieldValue getFieldValue(String value, KintoneColumnOption option); + + public FieldValue getFieldValue(Timestamp value, KintoneColumnOption option) { + return getFieldValue(value.getInstant().toString(), option); + } + + public FieldValue getFieldValue(Value value, KintoneColumnOption option) { + return getFieldValue(value.toJson(), option); + } + + public void setUpdateKey(UpdateKey updateKey, String field) { + throw new UnsupportedOperationException(); + } + + public void setUpdateKey(UpdateKey updateKey, String field, FieldValue value) { + throw new UnsupportedOperationException(); + } + + private static List asList(String value, KintoneColumnOption option) { + return value.isEmpty() + ? Collections.emptyList() + : Arrays.asList(value.split(getValueSeparator(option), 0)); + } + + private static ZoneOffset getZoneOffset(KintoneColumnOption option) { + return getZoneId(option).getRules().getOffset(Instant.EPOCH); + } + + private static ZoneId getZoneId(KintoneColumnOption option) { + return ZoneId.of(option != null ? option.getTimezone() : "UTC"); + } + + private static String getValueSeparator(KintoneColumnOption option) { + return option != null ? option.getValueSeparator() : ","; + } +} diff --git a/src/main/java/org/embulk/output/kintone/KintoneColumnVisitor.java b/src/main/java/org/embulk/output/kintone/KintoneColumnVisitor.java index 51c0a6d..289344f 100644 --- a/src/main/java/org/embulk/output/kintone/KintoneColumnVisitor.java +++ b/src/main/java/org/embulk/output/kintone/KintoneColumnVisitor.java @@ -1,47 +1,44 @@ package org.embulk.output.kintone; -import com.kintone.client.model.record.CheckBoxFieldValue; -import com.kintone.client.model.record.DateFieldValue; -import com.kintone.client.model.record.DateTimeFieldValue; -import com.kintone.client.model.record.DropDownFieldValue; -import com.kintone.client.model.record.FieldType; import com.kintone.client.model.record.FieldValue; -import com.kintone.client.model.record.LinkFieldValue; -import com.kintone.client.model.record.MultiLineTextFieldValue; -import com.kintone.client.model.record.NumberFieldValue; import com.kintone.client.model.record.Record; -import com.kintone.client.model.record.SingleLineTextFieldValue; import com.kintone.client.model.record.UpdateKey; -import java.math.BigDecimal; import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.Arrays; -import java.util.List; import java.util.Map; -import java.util.Objects; import org.embulk.spi.Column; import org.embulk.spi.ColumnVisitor; import org.embulk.spi.PageReader; import org.embulk.spi.time.Timestamp; +import org.msgpack.value.Value; +import org.msgpack.value.ValueFactory; public class KintoneColumnVisitor implements ColumnVisitor { - private final PageReader pageReader; + private final PageReader reader; + private final Map options; + private final boolean preferNulls; + private final boolean ignoreNulls; + private final String updateKeyName; private Record record; private UpdateKey updateKey; - private final Map columnOptions; - private String updateKeyName; public KintoneColumnVisitor( - PageReader pageReader, Map columnOptions) { - this.pageReader = pageReader; - this.columnOptions = columnOptions; + PageReader reader, + Map options, + boolean preferNulls, + boolean ignoreNulls) { + this(reader, options, preferNulls, ignoreNulls, null); } public KintoneColumnVisitor( - PageReader pageReader, Map columnOptions, String updateKeyName) { - this.pageReader = pageReader; - this.columnOptions = columnOptions; + PageReader reader, + Map options, + boolean preferNulls, + boolean ignoreNulls, + String updateKeyName) { + this.reader = reader; + this.options = options; + this.preferNulls = preferNulls; + this.ignoreNulls = ignoreNulls; this.updateKeyName = updateKeyName; } @@ -53,156 +50,219 @@ public void setUpdateKey(UpdateKey updateKey) { this.updateKey = updateKey; } - private void setValue(String fieldCode, Object value, FieldType type, boolean isUpdateKey) { - if (isUpdateKey && updateKey != null) { - updateKey.setField(fieldCode).setValue(Objects.toString(value, "")); - } - String stringValue = Objects.toString(value, ""); - FieldValue fieldValue; - switch (type) { - case NUMBER: - BigDecimal setValue = stringValue.equals("") ? null : new BigDecimal(stringValue); - fieldValue = new NumberFieldValue(setValue); - break; - case MULTI_LINE_TEXT: - fieldValue = new MultiLineTextFieldValue(stringValue); - break; - case DROP_DOWN: - fieldValue = new DropDownFieldValue(stringValue); - break; - case LINK: - fieldValue = new LinkFieldValue(stringValue); - break; - default: - fieldValue = new SingleLineTextFieldValue(stringValue); + @Override + public void booleanColumn(Column column) { + if (isIgnoreNull(column)) { + return; + } + KintoneColumnOption option = getOption(column); + UpdateKey updateKey = getUpdateKey(column); + KintoneColumnType type = KintoneColumnType.getType(option, KintoneColumnType.NUMBER); + String fieldCode = getFieldCode(column); + if (isPreferNull(column)) { + setNull(type, fieldCode, updateKey); + } else if (reader.isNull(column)) { + setBoolean(type, fieldCode, updateKey, false, option); + } else { + setBoolean(type, fieldCode, updateKey, reader.getBoolean(column), option); } - record.putField(fieldCode, fieldValue); } - private void setTimestampValue(String fieldCode, Instant instant, ZoneId zoneId, FieldType type) { - FieldValue fieldValue = null; - ZonedDateTime datetime = instant.atZone(zoneId); - switch (type) { - case DATE: - fieldValue = new DateFieldValue(datetime.toLocalDate()); - break; - case DATETIME: - fieldValue = new DateTimeFieldValue(datetime); + @Override + public void longColumn(Column column) { + if (isIgnoreNull(column)) { + return; + } + KintoneColumnOption option = getOption(column); + UpdateKey updateKey = getUpdateKey(column); + KintoneColumnType type = KintoneColumnType.getType(option, KintoneColumnType.NUMBER); + String fieldCode = getFieldCode(column); + if (isPreferNull(column)) { + setNull(type, fieldCode, updateKey); + } else if (reader.isNull(column)) { + setLong(type, fieldCode, updateKey, 0, option); + } else { + setLong(type, fieldCode, updateKey, reader.getLong(column), option); } - record.putField(fieldCode, fieldValue); } - private void setCheckBoxValue(String fieldCode, Object value, String valueSeparator) { - String str = String.valueOf(value); - CheckBoxFieldValue checkBoxFieldValue = new CheckBoxFieldValue(); - - if (str != null && !str.equals("")) { - List values = Arrays.asList(str.split(valueSeparator, 0)); - checkBoxFieldValue = new CheckBoxFieldValue(values); + @Override + public void doubleColumn(Column column) { + if (isIgnoreNull(column)) { + return; + } + KintoneColumnOption option = getOption(column); + UpdateKey updateKey = getUpdateKey(column); + KintoneColumnType type = KintoneColumnType.getType(option, KintoneColumnType.NUMBER); + String fieldCode = getFieldCode(column); + if (isPreferNull(column)) { + setNull(type, fieldCode, updateKey); + } else if (reader.isNull(column)) { + setDouble(type, fieldCode, updateKey, 0, option); + } else { + setDouble(type, fieldCode, updateKey, reader.getDouble(column), option); } - record.putField(fieldCode, checkBoxFieldValue); } - private FieldType getType(Column column, FieldType defaultType) { - KintoneColumnOption option = columnOptions.get(column.getName()); - if (option == null) { - return defaultType; + @Override + public void stringColumn(Column column) { + if (isIgnoreNull(column)) { + return; + } + KintoneColumnOption option = getOption(column); + UpdateKey updateKey = getUpdateKey(column); + KintoneColumnType defaultType = + updateKey != null ? KintoneColumnType.SINGLE_LINE_TEXT : KintoneColumnType.MULTI_LINE_TEXT; + KintoneColumnType type = KintoneColumnType.getType(option, defaultType); + String fieldCode = getFieldCode(column); + if (isPreferNull(column)) { + setNull(type, fieldCode, updateKey); + } else if (reader.isNull(column)) { + setString(type, fieldCode, updateKey, "", option); } else { - return FieldType.valueOf(option.getType()); + setString(type, fieldCode, updateKey, reader.getString(column), option); } } - private String getFieldCode(Column column) { - KintoneColumnOption option = columnOptions.get(column.getName()); - if (option == null) { - return column.getName(); + @Override + public void timestampColumn(Column column) { + if (isIgnoreNull(column)) { + return; + } + KintoneColumnOption option = getOption(column); + UpdateKey updateKey = getUpdateKey(column); + KintoneColumnType type = KintoneColumnType.getType(option, KintoneColumnType.DATETIME); + String fieldCode = getFieldCode(column); + if (isPreferNull(column)) { + setNull(type, fieldCode, updateKey); + } else if (reader.isNull(column)) { + setTimestamp(type, fieldCode, updateKey, Timestamp.ofInstant(Instant.EPOCH), option); } else { - return option.getFieldCode(); + setTimestamp(type, fieldCode, updateKey, reader.getTimestamp(column), option); } } - private ZoneId getZoneId(Column column) { - KintoneColumnOption option = columnOptions.get(column.getName()); - if (option == null) { - return ZoneId.of("UTC"); + @Override + public void jsonColumn(Column column) { + if (isIgnoreNull(column)) { + return; + } + KintoneColumnOption option = getOption(column); + UpdateKey updateKey = getUpdateKey(column); + KintoneColumnType type = KintoneColumnType.getType(option, KintoneColumnType.MULTI_LINE_TEXT); + String fieldCode = getFieldCode(column); + if (isPreferNull(column)) { + setNull(type, fieldCode, updateKey); + } else if (reader.isNull(column)) { + setJson(type, fieldCode, updateKey, ValueFactory.newString(""), option); + } else { + setJson(type, fieldCode, updateKey, reader.getJson(column), option); } - return ZoneId.of(option.getTimezone().orElse("UTC")); } - private boolean isUpdateKey(Column column) { - if (this.updateKeyName == null) { - return false; + private void setNull(KintoneColumnType type, String fieldCode, UpdateKey updateKey) { + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode); } - - return this.updateKeyName.equals(column.getName()); + record.putField(fieldCode, type.getFieldValue()); } - private String getValueSeparator(Column column) { - KintoneColumnOption option = columnOptions.get(column.getName()); - if (option == null) { - return ","; + private void setBoolean( + KintoneColumnType type, + String fieldCode, + UpdateKey updateKey, + boolean value, + KintoneColumnOption option) { + FieldValue fieldValue = type.getFieldValue(value, option); + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode, fieldValue); } - return option.getValueSeparator(); + record.putField(fieldCode, fieldValue); } - @Override - public void booleanColumn(Column column) { - String fieldCode = getFieldCode(column); - FieldType type = getType(column, FieldType.NUMBER); - setValue(fieldCode, pageReader.getBoolean(column), type, isUpdateKey(column)); + private void setLong( + KintoneColumnType type, + String fieldCode, + UpdateKey updateKey, + long value, + KintoneColumnOption option) { + FieldValue fieldValue = type.getFieldValue(value, option); + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode, fieldValue); + } + record.putField(fieldCode, fieldValue); } - @Override - public void longColumn(Column column) { - String fieldCode = getFieldCode(column); - FieldType type = getType(column, FieldType.NUMBER); - if (pageReader.isNull(column)) { - setValue(fieldCode, null, type, isUpdateKey(column)); - } else { - setValue(fieldCode, pageReader.getLong(column), type, isUpdateKey(column)); + private void setDouble( + KintoneColumnType type, + String fieldCode, + UpdateKey updateKey, + double value, + KintoneColumnOption option) { + FieldValue fieldValue = type.getFieldValue(value, option); + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode, fieldValue); } + record.putField(fieldCode, fieldValue); } - @Override - public void doubleColumn(Column column) { - String fieldCode = getFieldCode(column); - FieldType type = getType(column, FieldType.NUMBER); - setValue(fieldCode, pageReader.getDouble(column), type, isUpdateKey(column)); + private void setString( + KintoneColumnType type, + String fieldCode, + UpdateKey updateKey, + String value, + KintoneColumnOption option) { + FieldValue fieldValue = type.getFieldValue(value, option); + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode, fieldValue); + } + record.putField(fieldCode, fieldValue); } - @Override - public void stringColumn(Column column) { - String fieldCode = getFieldCode(column); - FieldType type = getType(column, FieldType.MULTI_LINE_TEXT); - Object value = pageReader.getString(column); - if (type == FieldType.CHECK_BOX) { - String stringValue = Objects.toString(value, ""); - setCheckBoxValue(fieldCode, value, getValueSeparator(column)); - return; + private void setTimestamp( + KintoneColumnType type, + String fieldCode, + UpdateKey updateKey, + Timestamp value, + KintoneColumnOption option) { + FieldValue fieldValue = type.getFieldValue(value, option); + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode, fieldValue); } - setValue(fieldCode, value, type, isUpdateKey(column)); + record.putField(fieldCode, fieldValue); } - @Override - public void timestampColumn(Column column) { - Timestamp value = pageReader.getTimestamp(column); - if (value == null) { - return; + private void setJson( + KintoneColumnType type, + String fieldCode, + UpdateKey updateKey, + Value value, + KintoneColumnOption option) { + FieldValue fieldValue = type.getFieldValue(value, option); + if (updateKey != null) { + type.setUpdateKey(updateKey, fieldCode, fieldValue); } + record.putField(fieldCode, fieldValue); + } - String fieldCode = getFieldCode(column); - FieldType type = getType(column, FieldType.DATETIME); - ZoneId zoneId = getZoneId(column); - if (type == FieldType.DATETIME) { - zoneId = ZoneId.of("UTC"); - } - setTimestampValue(fieldCode, value.getInstant(), zoneId, type); + private String getFieldCode(Column column) { + KintoneColumnOption option = getOption(column); + return option != null ? option.getFieldCode() : column.getName(); } - @Override - public void jsonColumn(Column column) { - String fieldCode = getFieldCode(column); - FieldType type = getType(column, FieldType.MULTI_LINE_TEXT); - setValue(fieldCode, pageReader.getJson(column), type, isUpdateKey(column)); + private KintoneColumnOption getOption(Column column) { + return options.get(column.getName()); + } + + private UpdateKey getUpdateKey(Column column) { + return updateKeyName != null && updateKeyName.equals(column.getName()) ? updateKey : null; + } + + private boolean isIgnoreNull(Column column) { + return ignoreNulls && reader.isNull(column); + } + + private boolean isPreferNull(Column column) { + return preferNulls && reader.isNull(column); } } diff --git a/src/main/java/org/embulk/output/kintone/KintoneMode.java b/src/main/java/org/embulk/output/kintone/KintoneMode.java index 04410f5..635f001 100644 --- a/src/main/java/org/embulk/output/kintone/KintoneMode.java +++ b/src/main/java/org/embulk/output/kintone/KintoneMode.java @@ -6,7 +6,6 @@ public enum KintoneMode { INSERT("insert"), UPDATE("update"), UPSERT("upsert"); - private final String value; KintoneMode(String value) { diff --git a/src/main/java/org/embulk/output/kintone/KintoneOutputPlugin.java b/src/main/java/org/embulk/output/kintone/KintoneOutputPlugin.java index 54c77f5..0b2d2f0 100644 --- a/src/main/java/org/embulk/output/kintone/KintoneOutputPlugin.java +++ b/src/main/java/org/embulk/output/kintone/KintoneOutputPlugin.java @@ -16,7 +16,6 @@ public class KintoneOutputPlugin implements OutputPlugin { public ConfigDiff transaction( ConfigSource config, Schema schema, int taskCount, OutputPlugin.Control control) { PluginTask task = config.loadConfig(PluginTask.class); - control.run(task.dump()); return Exec.newConfigDiff(); } @@ -34,7 +33,6 @@ public void cleanup( @Override public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int taskIndex) { PluginTask task = taskSource.loadTask(PluginTask.class); - KintoneMode mode = KintoneMode.getKintoneModeByValue(task.getMode()); switch (mode) { case INSERT: diff --git a/src/main/java/org/embulk/output/kintone/KintonePageOutput.java b/src/main/java/org/embulk/output/kintone/KintonePageOutput.java index ad2c35f..b5a7c38 100644 --- a/src/main/java/org/embulk/output/kintone/KintonePageOutput.java +++ b/src/main/java/org/embulk/output/kintone/KintonePageOutput.java @@ -4,24 +4,32 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.Maps; import com.kintone.client.KintoneClient; import com.kintone.client.KintoneClientBuilder; import com.kintone.client.api.record.GetRecordsByCursorResponseBody; import com.kintone.client.exception.KintoneApiRuntimeException; +import com.kintone.client.model.app.field.FieldProperty; import com.kintone.client.model.record.FieldType; import com.kintone.client.model.record.Record; import com.kintone.client.model.record.RecordForUpdate; import com.kintone.client.model.record.UpdateKey; import java.io.IOException; +import java.lang.invoke.MethodHandles; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.TreeMap; +import java.util.function.Function; +import java.util.function.Supplier; import java.util.stream.Collectors; +import org.apache.commons.lang3.tuple.Pair; import org.embulk.config.ConfigException; import org.embulk.config.TaskReport; -import org.embulk.spi.Column; import org.embulk.spi.Exec; import org.embulk.spi.Page; import org.embulk.spi.PageReader; @@ -33,22 +41,25 @@ import org.slf4j.LoggerFactory; public class KintonePageOutput implements TransactionalPageOutput { - public static final int UPSERT_BATCH_SIZE = 10000; - public static final int CHUNK_SIZE = 100; - private static final Logger LOGGER = LoggerFactory.getLogger(KintonePageOutput.class); + private static final Logger LOGGER = + LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final List RETRYABLE_ERROR_CODES = Arrays.asList( - "GAIA_TM12", // 作成できるカーソルの上限に達しているため、カーソ ルを作成できません。不要なカーソルを削除するか、しばらく経ってから再実行してください。 + "GAIA_TM12", // 作成できるカーソルの上限に達しているため、カーソルを作成できません。不要なカーソルを削除するか、しばらく経ってから再実行してください。 "GAIA_RE18", // データベースのロックに失敗したため、変更を保存できませんでした。時間をおいて再度お試しください。 "GAIA_DA02" // データベースのロックに失敗したため、変更を保存できませんでした。時間をおいて再度お試しください。 ); - private final PageReader pageReader; + private static final int UPSERT_BATCH_SIZE = 10000; + private static final int CHUNK_SIZE = 100; + private final Map> wrongTypeFields = new TreeMap<>(); private final PluginTask task; + private final PageReader reader; private KintoneClient client; + private Map formFields; public KintonePageOutput(PluginTask task, Schema schema) { - this.pageReader = new PageReader(schema); this.task = task; + reader = new PageReader(schema); } @Override @@ -76,11 +87,11 @@ public void finish() { @Override public void close() { - if (this.client == null) { - return; + if (client == null) { + return; // Not connected } try { - this.client.close(); + client.close(); } catch (Exception e) { throw new RuntimeException("kintone throw exception", e); } @@ -93,78 +104,73 @@ public void abort() { @Override public TaskReport commit() { + wrongTypeFields.forEach( + (key, value) -> + LOGGER.warn( + String.format( + "Field type of %s is expected %s but actual %s", + key, value.getLeft(), value.getRight()))); return Exec.newTaskReport(); } - public interface Consumer { - void accept(T t); - } - - public void connect(final PluginTask task) { + public void connectIfNeeded() { + if (client != null) { + return; // Already connected + } KintoneClientBuilder builder = KintoneClientBuilder.create("https://" + task.getDomain()); if (task.getGuestSpaceId().isPresent()) { - builder.setGuestSpaceId(task.getGuestSpaceId().orElse(-1)); + builder.setGuestSpaceId(task.getGuestSpaceId().get()); } if (task.getBasicAuthUsername().isPresent() && task.getBasicAuthPassword().isPresent()) { builder.withBasicAuth(task.getBasicAuthUsername().get(), task.getBasicAuthPassword().get()); } - if (task.getUsername().isPresent() && task.getPassword().isPresent()) { - this.client = - builder.authByPassword(task.getUsername().get(), task.getPassword().get()).build(); + builder.authByPassword(task.getUsername().get(), task.getPassword().get()); } else if (task.getToken().isPresent()) { - this.client = builder.authByApiToken(task.getToken().get()).build(); + builder.authByApiToken(task.getToken().get()); + } else { + throw new ConfigException("Username and password or token must be configured."); } + client = builder.build(); + formFields = client.app().getFormFields(task.getAppId()); } - private void update(ArrayList records) { - execute( - client -> { - client.record().updateRecords(task.getAppId(), records); - }); + private void insert(List records) { + executeWithRetry(() -> client.record().addRecords(task.getAppId(), records)); } - private void insert(ArrayList records) { - execute( - client -> { - client.record().addRecords(task.getAppId(), records); - }); + private void update(List records) { + executeWithRetry(() -> client.record().updateRecords(task.getAppId(), records)); } - private void execute(Consumer operation) { - connect(task); - if (this.client == null) { - throw new RuntimeException("Failed to connect to kintone."); - } + private T executeWithRetry(Supplier operation) { + connectIfNeeded(); KintoneRetryOption retryOption = task.getRetryOptions(); try { - retryExecutor() + return retryExecutor() .withRetryLimit(retryOption.getLimit()) .withInitialRetryWait(retryOption.getInitialWaitMillis()) .withMaxRetryWait(retryOption.getMaxWaitMillis()) .runInterruptible( - new Retryable() { - + new Retryable() { @Override - public Void call() throws Exception { - operation.accept(client); - return null; + public T call() throws Exception { + return operation.get(); } @Override - public boolean isRetryableException(Exception e) { - if (!(e instanceof KintoneApiRuntimeException)) { + public boolean isRetryableException(Exception exception) { + if (!(exception instanceof KintoneApiRuntimeException)) { return false; } - try { ObjectMapper mapper = new ObjectMapper(); JsonNode content = - mapper.readTree(((KintoneApiRuntimeException) e).getContent()); + mapper.readTree(((KintoneApiRuntimeException) exception).getContent()); String code = content.get("code").textValue(); return RETRYABLE_ERROR_CODES.contains(code); - } catch (IOException ex) { - throw new RuntimeException(ex); + } catch (IOException e) { + throw new RuntimeException(e); } } @@ -192,143 +198,108 @@ public void onGiveup(Exception firstException, Exception lastException) } } - private void insertPage(final Page page) { - - ArrayList records = new ArrayList<>(); - pageReader.setPage(page); - KintoneColumnVisitor visitor = new KintoneColumnVisitor(pageReader, task.getColumnOptions()); - while (pageReader.nextRecord()) { + private void insertPage(Page page) { + List records = new ArrayList<>(); + reader.setPage(page); + KintoneColumnVisitor visitor = + new KintoneColumnVisitor( + reader, task.getColumnOptions(), task.getPreferNulls(), task.getIgnoreNulls()); + while (reader.nextRecord()) { Record record = new Record(); visitor.setRecord(record); - for (Column column : pageReader.getSchema().getColumns()) { - column.visit(visitor); - } - + reader.getSchema().visitColumns(visitor); + putWrongTypeFields(record); records.add(record); if (records.size() == CHUNK_SIZE) { insert(records); records.clear(); } } - if (records.size() > 0) { + if (!records.isEmpty()) { insert(records); } } - private void updatePage(final Page page) { - ArrayList updateRecords = new ArrayList<>(); - pageReader.setPage(page); - + private void updatePage(Page page) { + List records = new ArrayList<>(); + reader.setPage(page); KintoneColumnVisitor visitor = new KintoneColumnVisitor( - pageReader, + reader, task.getColumnOptions(), + task.getPreferNulls(), + task.getIgnoreNulls(), task.getUpdateKeyName() .orElseThrow(() -> new RuntimeException("unreachable"))); // Already validated - while (pageReader.nextRecord()) { + while (reader.nextRecord()) { Record record = new Record(); UpdateKey updateKey = new UpdateKey(); visitor.setRecord(record); visitor.setUpdateKey(updateKey); - for (Column column : pageReader.getSchema().getColumns()) { - column.visit(visitor); - } - - if (updateKey.getValue() == "") { + reader.getSchema().visitColumns(visitor); + putWrongTypeFields(record); + if (updateKey.getValue() == null || updateKey.getValue().toString().isEmpty()) { + LOGGER.warn("Record skipped because no update key value was specified"); continue; } - - record.removeField(updateKey.getField()); - updateRecords.add(new RecordForUpdate(updateKey, record)); - if (updateRecords.size() == CHUNK_SIZE) { - update(updateRecords); - updateRecords.clear(); + records.add(new RecordForUpdate(updateKey, record.removeField(updateKey.getField()))); + if (records.size() == CHUNK_SIZE) { + update(records); + records.clear(); } } - if (updateRecords.size() > 0) { - update(updateRecords); + if (!records.isEmpty()) { + update(records); } } - private void upsertPage(final Page page) { - execute( - client -> { - ArrayList records = new ArrayList<>(); - ArrayList updateKeys = new ArrayList<>(); - pageReader.setPage(page); - - KintoneColumnVisitor visitor = - new KintoneColumnVisitor( - pageReader, - task.getColumnOptions(), - task.getUpdateKeyName() - .orElseThrow(() -> new RuntimeException("unreachable"))); // Already validated - while (pageReader.nextRecord()) { - Record record = new Record(); - UpdateKey updateKey = new UpdateKey(); - visitor.setRecord(record); - visitor.setUpdateKey(updateKey); - for (Column column : pageReader.getSchema().getColumns()) { - column.visit(visitor); - } - records.add(record); - updateKeys.add(updateKey); - - if (records.size() == UPSERT_BATCH_SIZE) { - upsert(records, updateKeys); - records.clear(); - updateKeys.clear(); - } - } - if (records.size() > 0) { - upsert(records, updateKeys); - } - }); + private void upsertPage(Page page) { + List records = new ArrayList<>(); + List updateKeys = new ArrayList<>(); + reader.setPage(page); + KintoneColumnVisitor visitor = + new KintoneColumnVisitor( + reader, + task.getColumnOptions(), + task.getPreferNulls(), + task.getIgnoreNulls(), + task.getUpdateKeyName() + .orElseThrow(() -> new RuntimeException("unreachable"))); // Already validated + while (reader.nextRecord()) { + Record record = new Record(); + UpdateKey updateKey = new UpdateKey(); + visitor.setRecord(record); + visitor.setUpdateKey(updateKey); + reader.getSchema().visitColumns(visitor); + putWrongTypeFields(record); + records.add(record); + updateKeys.add(updateKey); + if (records.size() == UPSERT_BATCH_SIZE) { + upsert(records, updateKeys); + records.clear(); + updateKeys.clear(); + } + } + if (!records.isEmpty()) { + upsert(records, updateKeys); + } } - private void upsert(ArrayList records, ArrayList updateKeys) { + private void upsert(List records, List updateKeys) { if (records.size() != updateKeys.size()) { throw new RuntimeException("records.size() != updateKeys.size()"); } - FieldType updateKeyFieldType = - client.app().getFormFields(task.getAppId()).get(updateKeys.get(0).getField()).getType(); - if (!Arrays.asList(FieldType.SINGLE_LINE_TEXT, FieldType.NUMBER).contains(updateKeyFieldType)) { - throw new ConfigException("The update_key must be 'SINGLE_LINE_TEXT' or 'NUMBER'."); - } - - List existingRecords = getExistingRecordsByUpdateKey(updateKeys); - String updateField = updateKeys.get(0).getField(); - List existingValues = - existingRecords.stream() - .map( - (r) -> { - switch (updateKeyFieldType) { - case SINGLE_LINE_TEXT: - String s = r.getSingleLineTextFieldValue(updateField); - return s == null ? null : s.toString(); - case NUMBER: - BigDecimal bd = r.getNumberFieldValue(updateField); - return bd == null ? null : bd.toPlainString(); - default: - return null; - } - }) - .filter(v -> v != null) - .collect(Collectors.toList()); - - ArrayList insertRecords = new ArrayList<>(); - ArrayList updateRecords = new ArrayList<>(); + List existingValues = executeWithRetry(() -> getExistingValuesByUpdateKey(updateKeys)); + List insertRecords = new ArrayList<>(); + List updateRecords = new ArrayList<>(); for (int i = 0; i < records.size(); i++) { Record record = records.get(i); UpdateKey updateKey = updateKeys.get(i); - if (existsRecord(existingValues, updateKey)) { - record.removeField(updateKey.getField()); - updateRecords.add(new RecordForUpdate(updateKey, record)); + updateRecords.add(new RecordForUpdate(updateKey, record.removeField(updateKey.getField()))); } else { insertRecords.add(record); } - if (insertRecords.size() == CHUNK_SIZE) { insert(insertRecords); insertRecords.clear(); @@ -337,25 +308,40 @@ private void upsert(ArrayList records, ArrayList updateKeys) updateRecords.clear(); } } - if (insertRecords.size() > 0) { + if (!insertRecords.isEmpty()) { insert(insertRecords); } - if (updateRecords.size() > 0) { + if (!updateRecords.isEmpty()) { update(updateRecords); } } - private List getExistingRecordsByUpdateKey(ArrayList updateKeys) { - String fieldCode = updateKeys.get(0).getField(); + private List getExistingValuesByUpdateKey(List updateKeys) { + String fieldCode = + updateKeys.stream() + .map(UpdateKey::getField) + .filter(Objects::nonNull) + .findFirst() + .orElse(null); + if (fieldCode == null) { + return Collections.emptyList(); + } + Function fieldValueAsString; + FieldType fieldType = getFieldType(fieldCode); + if (fieldType == FieldType.SINGLE_LINE_TEXT) { + fieldValueAsString = record -> record.getSingleLineTextFieldValue(fieldCode); + } else if (fieldType == FieldType.NUMBER) { + fieldValueAsString = record -> toString(record.getNumberFieldValue(fieldCode)); + } else { + throw new ConfigException("The update_key must be 'SINGLE_LINE_TEXT' or 'NUMBER'."); + } List queryValues = updateKeys.stream() - .filter(k -> k.getValue() != "") - .map(k -> "\"" + k.getValue().toString() + "\"") + .filter(k -> k.getValue() != null && !k.getValue().toString().isEmpty()) + .map(k -> "\"" + k.getValue() + "\"") .collect(Collectors.toList()); - - List allRecords = new ArrayList<>(); if (queryValues.isEmpty()) { - return allRecords; + return Collections.emptyList(); } String cursorId = client @@ -364,19 +350,45 @@ private List getExistingRecordsByUpdateKey(ArrayList updateKe task.getAppId(), Collections.singletonList(fieldCode), fieldCode + " in (" + String.join(",", queryValues) + ")"); + List allRecords = new ArrayList<>(); while (true) { GetRecordsByCursorResponseBody resp = client.record().getRecordsByCursor(cursorId); List records = resp.getRecords(); allRecords.addAll(records); - if (!resp.hasNext()) { break; } } - return allRecords; + return allRecords.stream() + .map(fieldValueAsString) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } + + private boolean existsRecord(List existingValues, UpdateKey updateKey) { + String value = toString(updateKey.getValue()); + return value != null && existingValues.stream().anyMatch(v -> v.equals(value)); + } + + private void putWrongTypeFields(Record record) { + record.getFieldCodes(true).stream() + .map( + fieldCode -> + Maps.immutableEntry( + fieldCode, Pair.of(record.getFieldType(fieldCode), getFieldType(fieldCode)))) + .filter(entry -> entry.getValue().getLeft() != entry.getValue().getRight()) + .forEach(entry -> wrongTypeFields.put(entry.getKey(), entry.getValue())); + } + + private FieldType getFieldType(String fieldCode) { + connectIfNeeded(); + FieldProperty field = formFields.get(fieldCode); + return field == null ? null : field.getType(); } - private boolean existsRecord(List distValues, UpdateKey updateKey) { - return distValues.stream().anyMatch(v -> v.equals(updateKey.getValue().toString())); + private static String toString(Object value) { + return value == null + ? null + : value instanceof BigDecimal ? ((BigDecimal) value).toPlainString() : value.toString(); } } diff --git a/src/main/java/org/embulk/output/kintone/PluginTask.java b/src/main/java/org/embulk/output/kintone/PluginTask.java index d5a76b2..fb5fcff 100644 --- a/src/main/java/org/embulk/output/kintone/PluginTask.java +++ b/src/main/java/org/embulk/output/kintone/PluginTask.java @@ -41,6 +41,14 @@ public interface PluginTask extends Task { @ConfigDefault("{}") Map getColumnOptions(); + @Config("prefer_nulls") + @ConfigDefault("\"false\"") + boolean getPreferNulls(); + + @Config("ignore_nulls") + @ConfigDefault("\"false\"") + boolean getIgnoreNulls(); + @Config("mode") @ConfigDefault("\"insert\"") String getMode(); diff --git a/src/test/java/org/embulk/output/kintone/KintoneColumnOptionBuilder.java b/src/test/java/org/embulk/output/kintone/KintoneColumnOptionBuilder.java index cb52105..7e7c1d2 100644 --- a/src/test/java/org/embulk/output/kintone/KintoneColumnOptionBuilder.java +++ b/src/test/java/org/embulk/output/kintone/KintoneColumnOptionBuilder.java @@ -1,6 +1,5 @@ package org.embulk.output.kintone; -import java.util.Optional; import org.embulk.config.TaskSource; public class KintoneColumnOptionBuilder { @@ -42,8 +41,8 @@ public String getFieldCode() { } @Override - public Optional getTimezone() { - return Optional.ofNullable(timezone); + public String getTimezone() { + return timezone; } @Override diff --git a/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorTest.java b/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorTest.java index 0f607d4..9bbb4dc 100644 --- a/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorTest.java +++ b/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorTest.java @@ -3,12 +3,14 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertThrows; import com.google.common.collect.ImmutableMap; +import com.kintone.client.model.record.FieldType; import java.math.BigDecimal; import java.time.Instant; import java.time.LocalDate; -import java.time.ZoneId; +import java.time.LocalTime; import java.time.ZonedDateTime; import java.util.AbstractMap; import java.util.Arrays; @@ -25,133 +27,510 @@ public class KintoneColumnVisitorTest { @Test public void test() { - Schema schema = build(Schema.builder()); - KintoneColumnVisitorVerifier verifier = - new KintoneColumnVisitorVerifier( - schema, - build(ImmutableMap.builder()), - "STRING|SINGLE_LINE_TEXT", - OutputPageBuilder.build(schema, KintoneColumnVisitorTest::build)); + KintoneColumnVisitorVerifier verifier = verifier("STRING|SINGLE_LINE_TEXT"); verifier.verify( (record, updateKey) -> { assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("false")); - assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue()); - assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("")); - assertThat(record.getNumberFieldValue("LONG"), nullValue()); + assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("0"))); + assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("0")); + assertThat(record.getNumberFieldValue("LONG"), is(number("0"))); + assertThat(record.getDateFieldValue("LONG|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("1970-01-01T00:00:00Z"))); assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("0.0")); assertThat(record.getNumberFieldValue("DOUBLE"), is(number("0.0"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("DOUBLE|DATETIME"), + is(dateTime("1970-01-01T00:00:00Z"))); assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is("")); assertThat(record.getMultiLineTextFieldValue("STRING"), is("")); - assertThat(record.getNumberFieldValue("STRING|NUMBER"), nullValue()); - assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list("null"))); + assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is("")); + assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("0"))); + assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list())); + assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is("")); + assertThat(record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list())); assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is("")); + assertThat(record.getDateFieldValue("STRING|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("STRING|DATETIME"), + is(dateTime("1970-01-01T00:00:00Z"))); assertThat(record.getLinkFieldValue("STRING|LINK"), is("")); - assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue()); - assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), nullValue()); - assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), nullValue()); - assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), nullValue()); - assertThat(record.getDateTimeFieldValue("TIMESTAMP"), nullValue()); - assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("")); - assertThat(record.getMultiLineTextFieldValue("JSON"), is("")); + assertThat( + record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), + is("1970-01-01T00:00:00Z")); + assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("0"))); + assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("1970-01-01T00:00:00Z"))); + assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"\"")); + assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"\"")); assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT")); assertThat(updateKey.getValue(), is("")); }); verifier.verify( (record, updateKey) -> { assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("false")); - assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue()); + assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("0"))); assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("0")); assertThat(record.getNumberFieldValue("LONG"), is(number("0"))); + assertThat(record.getDateFieldValue("LONG|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("1970-01-01T00:00:00Z"))); assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("0.0")); assertThat(record.getNumberFieldValue("DOUBLE"), is(number("0.0"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("DOUBLE|DATETIME"), + is(dateTime("1970-01-01T00:00:00Z"))); assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is("")); assertThat(record.getMultiLineTextFieldValue("STRING"), is("")); - assertThat(record.getNumberFieldValue("STRING|NUMBER"), nullValue()); + assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is("")); + assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("0"))); assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list())); + assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is("")); + assertThat(record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list())); assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is("")); + assertThat(record.getDateFieldValue("STRING|DATE"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("1970-01-01"))); + assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("STRING|DATETIME"), + is(dateTime("1970-01-01T00:00:00Z"))); assertThat(record.getLinkFieldValue("STRING|LINK"), is("")); - assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue()); + assertThat( + record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), + is("1970-01-01T00:00:00Z")); + assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("0"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("1970-01-01"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("1970-01-01"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1969-12-31"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("16:00:00"))); assertThat( record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("1970-01-01T00:00:00Z"))); - assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("")); - assertThat(record.getMultiLineTextFieldValue("JSON"), is("")); + assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"\"")); + assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"\"")); assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT")); assertThat(updateKey.getValue(), is("")); }); verifier.verify( (record, updateKey) -> { assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("true")); - assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue()); + assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("1"))); assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("123")); assertThat(record.getNumberFieldValue("LONG"), is(number("123"))); + assertThat(record.getDateFieldValue("LONG|DATE"), is(date("1999-12-31"))); + assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("23:59:59"))); + assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("08:59:59"))); + assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("15:59:59"))); + assertThat( + record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("1999-12-31T23:59:59Z"))); assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("123.0")); assertThat(record.getNumberFieldValue("DOUBLE"), is(number("123.0"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("1999-12-31"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("23:59:59"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("08:59:59"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("15:59:59"))); + assertThat( + record.getDateTimeFieldValue("DOUBLE|DATETIME"), + is(dateTime("1999-12-31T23:59:59Z"))); assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is("abc")); assertThat(record.getMultiLineTextFieldValue("STRING"), is("abc")); + assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is("abc")); assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("123"))); assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list("123", "abc"))); + assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is("abc")); + assertThat( + record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list("123", "abc"))); assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is("abc")); + assertThat(record.getDateFieldValue("STRING|DATE"), is(date("1999-12-31"))); + assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("1999-12-31"))); + assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1999-12-30"))); + assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("23:59:59"))); + assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("08:59:59"))); + assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("15:59:59"))); + assertThat( + record.getDateTimeFieldValue("STRING|DATETIME"), + is(dateTime("1999-12-31T23:59:59Z"))); assertThat(record.getLinkFieldValue("STRING|LINK"), is("abc")); - assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue()); + assertThat( + record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), + is("1999-12-31T23:59:59Z")); + assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("946684799"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("1999-12-31"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("2000-01-01"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("23:59:59"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("08:59:59"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("15:59:59"))); assertThat( record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("1999-12-31T23:59:59Z"))); - assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("abc")); - assertThat(record.getMultiLineTextFieldValue("JSON"), is("abc")); + assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"abc\"")); + assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"abc\"")); assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT")); assertThat(updateKey.getValue(), is("abc")); }); verifier.verify( (record, updateKey) -> { assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), is("false")); - assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue()); + assertThat(record.getNumberFieldValue("BOOLEAN"), is(number("0"))); assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), is("456")); assertThat(record.getNumberFieldValue("LONG"), is(number("456"))); + assertThat(record.getDateFieldValue("LONG|DATE"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|JST"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("LONG|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("LONG|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("LONG|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("LONG|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("LONG|DATETIME"), is(dateTime("2000-01-01T00:00:00Z"))); assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), is("456.0")); assertThat(record.getNumberFieldValue("DOUBLE"), is(number("456.0"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("DOUBLE|DATETIME"), + is(dateTime("2000-01-01T00:00:00Z"))); assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), is("def")); assertThat(record.getMultiLineTextFieldValue("STRING"), is("def")); + assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), is("def")); assertThat(record.getNumberFieldValue("STRING|NUMBER"), is(number("456"))); assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list("456", "def"))); + assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), is("def")); + assertThat( + record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list("456", "def"))); assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), is("def")); + assertThat(record.getDateFieldValue("STRING|DATE"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("STRING|DATE|JST"), is(date("2000-01-01"))); + assertThat(record.getDateFieldValue("STRING|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("STRING|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("STRING|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("STRING|TIME|PST"), is(time("16:00:00"))); + assertThat( + record.getDateTimeFieldValue("STRING|DATETIME"), + is(dateTime("2000-01-01T00:00:00Z"))); assertThat(record.getLinkFieldValue("STRING|LINK"), is("def")); - assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue()); + assertThat( + record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), + is("2000-01-01T00:00:00Z")); + assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), is(number("946684800"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), is(date("2000-01-01"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), is(date("2000-01-01"))); assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), is(date("1999-12-31"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), is(time("00:00:00"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), is(time("09:00:00"))); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), is(time("16:00:00"))); assertThat( record.getDateTimeFieldValue("TIMESTAMP"), is(dateTime("2000-01-01T00:00:00Z"))); - assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("def")); - assertThat(record.getMultiLineTextFieldValue("JSON"), is("def")); + assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), is("\"def\"")); + assertThat(record.getMultiLineTextFieldValue("JSON"), is("\"def\"")); assertThat(updateKey.getField(), is("STRING|SINGLE_LINE_TEXT")); assertThat(updateKey.getValue(), is("def")); }); } + @Test + public void testPreferNulls() { + KintoneColumnVisitorVerifier verifier = verifier("LONG", true, false); + verifier.verify( + (record, updateKey) -> { + assertThat( + record.getFieldType("BOOLEAN|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT)); + assertThat(record.getFieldType("BOOLEAN"), is(FieldType.NUMBER)); + assertThat(record.getFieldType("LONG|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT)); + assertThat(record.getFieldType("LONG"), is(FieldType.NUMBER)); + assertThat(record.getFieldType("LONG|DATE"), is(FieldType.DATE)); + assertThat(record.getFieldType("LONG|DATE|JST"), is(FieldType.DATE)); + assertThat(record.getFieldType("LONG|DATE|PST"), is(FieldType.DATE)); + assertThat(record.getFieldType("LONG|TIME"), is(FieldType.TIME)); + assertThat(record.getFieldType("LONG|TIME|JST"), is(FieldType.TIME)); + assertThat(record.getFieldType("LONG|TIME|PST"), is(FieldType.TIME)); + assertThat(record.getFieldType("LONG|DATETIME"), is(FieldType.DATETIME)); + assertThat( + record.getFieldType("DOUBLE|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT)); + assertThat(record.getFieldType("DOUBLE"), is(FieldType.NUMBER)); + assertThat(record.getFieldType("DOUBLE|DATE"), is(FieldType.DATE)); + assertThat(record.getFieldType("DOUBLE|DATE|JST"), is(FieldType.DATE)); + assertThat(record.getFieldType("DOUBLE|DATE|PST"), is(FieldType.DATE)); + assertThat(record.getFieldType("DOUBLE|TIME"), is(FieldType.TIME)); + assertThat(record.getFieldType("DOUBLE|TIME|JST"), is(FieldType.TIME)); + assertThat(record.getFieldType("DOUBLE|TIME|PST"), is(FieldType.TIME)); + assertThat(record.getFieldType("DOUBLE|DATETIME"), is(FieldType.DATETIME)); + assertThat( + record.getFieldType("STRING|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT)); + assertThat(record.getFieldType("STRING"), is(FieldType.MULTI_LINE_TEXT)); + assertThat(record.getFieldType("STRING|RICH_TEXT"), is(FieldType.RICH_TEXT)); + assertThat(record.getFieldType("STRING|NUMBER"), is(FieldType.NUMBER)); + assertThat(record.getFieldType("STRING|CHECK_BOX"), is(FieldType.CHECK_BOX)); + assertThat(record.getFieldType("STRING|RADIO_BUTTON"), is(FieldType.RADIO_BUTTON)); + assertThat(record.getFieldType("STRING|MULTI_SELECT"), is(FieldType.MULTI_SELECT)); + assertThat(record.getFieldType("STRING|DROP_DOWN"), is(FieldType.DROP_DOWN)); + assertThat(record.getFieldType("STRING|DATE"), is(FieldType.DATE)); + assertThat(record.getFieldType("STRING|DATE|JST"), is(FieldType.DATE)); + assertThat(record.getFieldType("STRING|DATE|PST"), is(FieldType.DATE)); + assertThat(record.getFieldType("STRING|TIME"), is(FieldType.TIME)); + assertThat(record.getFieldType("STRING|TIME|JST"), is(FieldType.TIME)); + assertThat(record.getFieldType("STRING|TIME|PST"), is(FieldType.TIME)); + assertThat(record.getFieldType("STRING|DATETIME"), is(FieldType.DATETIME)); + assertThat(record.getFieldType("STRING|LINK"), is(FieldType.LINK)); + assertThat( + record.getFieldType("TIMESTAMP|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT)); + assertThat(record.getFieldType("TIMESTAMP|NUMBER"), is(FieldType.NUMBER)); + assertThat(record.getFieldType("TIMESTAMP|DATE"), is(FieldType.DATE)); + assertThat(record.getFieldType("TIMESTAMP|DATE|JST"), is(FieldType.DATE)); + assertThat(record.getFieldType("TIMESTAMP|DATE|PST"), is(FieldType.DATE)); + assertThat(record.getFieldType("TIMESTAMP|TIME"), is(FieldType.TIME)); + assertThat(record.getFieldType("TIMESTAMP|TIME|JST"), is(FieldType.TIME)); + assertThat(record.getFieldType("TIMESTAMP|TIME|PST"), is(FieldType.TIME)); + assertThat(record.getFieldType("TIMESTAMP"), is(FieldType.DATETIME)); + assertThat(record.getFieldType("JSON|SINGLE_LINE_TEXT"), is(FieldType.SINGLE_LINE_TEXT)); + assertThat(record.getFieldType("JSON"), is(FieldType.MULTI_LINE_TEXT)); + assertThat(record.getSingleLineTextFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getNumberFieldValue("BOOLEAN"), nullValue()); + assertThat(record.getSingleLineTextFieldValue("LONG|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getNumberFieldValue("LONG"), nullValue()); + assertThat(record.getDateFieldValue("LONG|DATE"), nullValue()); + assertThat(record.getDateFieldValue("LONG|DATE|JST"), nullValue()); + assertThat(record.getDateFieldValue("LONG|DATE|PST"), nullValue()); + assertThat(record.getTimeFieldValue("LONG|TIME"), nullValue()); + assertThat(record.getTimeFieldValue("LONG|TIME|JST"), nullValue()); + assertThat(record.getTimeFieldValue("LONG|TIME|PST"), nullValue()); + assertThat(record.getDateTimeFieldValue("LONG|DATETIME"), nullValue()); + assertThat(record.getSingleLineTextFieldValue("DOUBLE|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getNumberFieldValue("DOUBLE"), nullValue()); + assertThat(record.getDateFieldValue("DOUBLE|DATE"), nullValue()); + assertThat(record.getDateFieldValue("DOUBLE|DATE|JST"), nullValue()); + assertThat(record.getDateFieldValue("DOUBLE|DATE|PST"), nullValue()); + assertThat(record.getTimeFieldValue("DOUBLE|TIME"), nullValue()); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|JST"), nullValue()); + assertThat(record.getTimeFieldValue("DOUBLE|TIME|PST"), nullValue()); + assertThat(record.getDateTimeFieldValue("DOUBLE|DATETIME"), nullValue()); + assertThat(record.getSingleLineTextFieldValue("STRING|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getMultiLineTextFieldValue("STRING"), nullValue()); + assertThat(record.getRichTextFieldValue("STRING|RICH_TEXT"), nullValue()); + assertThat(record.getNumberFieldValue("STRING|NUMBER"), nullValue()); + assertThat(record.getCheckBoxFieldValue("STRING|CHECK_BOX"), is(list())); + assertThat(record.getRadioButtonFieldValue("STRING|RADIO_BUTTON"), nullValue()); + assertThat(record.getMultiSelectFieldValue("STRING|MULTI_SELECT"), is(list())); + assertThat(record.getDropDownFieldValue("STRING|DROP_DOWN"), nullValue()); + assertThat(record.getDateFieldValue("STRING|DATE"), nullValue()); + assertThat(record.getDateFieldValue("STRING|DATE|JST"), nullValue()); + assertThat(record.getDateFieldValue("STRING|DATE|PST"), nullValue()); + assertThat(record.getTimeFieldValue("STRING|TIME"), nullValue()); + assertThat(record.getTimeFieldValue("STRING|TIME|JST"), nullValue()); + assertThat(record.getTimeFieldValue("STRING|TIME|PST"), nullValue()); + assertThat(record.getDateTimeFieldValue("STRING|DATETIME"), nullValue()); + assertThat(record.getLinkFieldValue("STRING|LINK"), nullValue()); + assertThat(record.getSingleLineTextFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getNumberFieldValue("TIMESTAMP|NUMBER"), nullValue()); + assertThat(record.getDateFieldValue("TIMESTAMP|DATE"), nullValue()); + assertThat(record.getDateFieldValue("TIMESTAMP|DATE|JST"), nullValue()); + assertThat(record.getDateFieldValue("TIMESTAMP|DATE|PST"), nullValue()); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME"), nullValue()); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|JST"), nullValue()); + assertThat(record.getTimeFieldValue("TIMESTAMP|TIME|PST"), nullValue()); + assertThat(record.getDateTimeFieldValue("TIMESTAMP"), nullValue()); + assertThat(record.getSingleLineTextFieldValue("JSON|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getMultiLineTextFieldValue("JSON"), nullValue()); + assertThat(updateKey.getField(), is("LONG")); + assertThat(updateKey.getValue(), nullValue()); + }); + } + + @Test + public void testIgnoreNulls() { + KintoneColumnVisitorVerifier verifier = verifier("JSON", false, true); + verifier.verify( + (record, updateKey) -> { + assertThat(record.getFieldValue("BOOLEAN|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getFieldValue("BOOLEAN"), nullValue()); + assertThat(record.getFieldValue("LONG|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getFieldValue("LONG"), nullValue()); + assertThat(record.getFieldValue("LONG|DATE"), nullValue()); + assertThat(record.getFieldValue("LONG|DATE|JST"), nullValue()); + assertThat(record.getFieldValue("LONG|DATE|PST"), nullValue()); + assertThat(record.getFieldValue("LONG|TIME"), nullValue()); + assertThat(record.getFieldValue("LONG|TIME|JST"), nullValue()); + assertThat(record.getFieldValue("LONG|TIME|PST"), nullValue()); + assertThat(record.getFieldValue("LONG|DATETIME"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getFieldValue("DOUBLE"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|DATE"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|DATE|JST"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|DATE|PST"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|TIME"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|TIME|JST"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|TIME|PST"), nullValue()); + assertThat(record.getFieldValue("DOUBLE|DATETIME"), nullValue()); + assertThat(record.getFieldValue("STRING|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getFieldValue("STRING"), nullValue()); + assertThat(record.getFieldValue("STRING|RICH_TEXT"), nullValue()); + assertThat(record.getFieldValue("STRING|NUMBER"), nullValue()); + assertThat(record.getFieldValue("STRING|CHECK_BOX"), nullValue()); + assertThat(record.getFieldValue("STRING|RADIO_BUTTON"), nullValue()); + assertThat(record.getFieldValue("STRING|MULTI_SELECT"), nullValue()); + assertThat(record.getFieldValue("STRING|DROP_DOWN"), nullValue()); + assertThat(record.getFieldValue("STRING|DATE"), nullValue()); + assertThat(record.getFieldValue("STRING|DATE|JST"), nullValue()); + assertThat(record.getFieldValue("STRING|DATE|PST"), nullValue()); + assertThat(record.getFieldValue("STRING|TIME"), nullValue()); + assertThat(record.getFieldValue("STRING|TIME|JST"), nullValue()); + assertThat(record.getFieldValue("STRING|TIME|PST"), nullValue()); + assertThat(record.getFieldValue("STRING|DATETIME"), nullValue()); + assertThat(record.getFieldValue("STRING|LINK"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|NUMBER"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|DATE"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|DATE|JST"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|DATE|PST"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|TIME"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|TIME|JST"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP|TIME|PST"), nullValue()); + assertThat(record.getFieldValue("TIMESTAMP"), nullValue()); + assertThat(record.getFieldValue("JSON|SINGLE_LINE_TEXT"), nullValue()); + assertThat(record.getFieldValue("JSON"), nullValue()); + assertThat(updateKey.getField(), nullValue()); + assertThat(updateKey.getValue(), nullValue()); + }, + true); + } + + @Test + public void testUpdateKey() { + assertThrows(UnsupportedOperationException.class, () -> verifier("TIMESTAMP").verify()); + KintoneColumnVisitorVerifier verifier = verifier("TIMESTAMP|NUMBER"); + verifier.verify( + (record, updateKey) -> { + assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER")); + assertThat(updateKey.getValue(), is(number("0"))); + }); + verifier.verify( + (record, updateKey) -> { + assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER")); + assertThat(updateKey.getValue(), is(number("0"))); + }); + verifier.verify( + (record, updateKey) -> { + assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER")); + assertThat(updateKey.getValue(), is(number("946684799"))); + }); + verifier.verify( + (record, updateKey) -> { + assertThat(updateKey.getField(), is("TIMESTAMP|NUMBER")); + assertThat(updateKey.getValue(), is(number("946684800"))); + }); + } + + private static KintoneColumnVisitorVerifier verifier(String updateKeyName) { + Schema schema = build(Schema.builder()); + return new KintoneColumnVisitorVerifier( + schema, + build(ImmutableMap.builder()), + updateKeyName, + OutputPageBuilder.build(schema, KintoneColumnVisitorTest::build)); + } + + private static KintoneColumnVisitorVerifier verifier( + String updateKeyName, boolean preferNulls, boolean ignoreNulls) { + Schema schema = build(Schema.builder()); + return new KintoneColumnVisitorVerifier( + schema, + build(ImmutableMap.builder()), + preferNulls, + ignoreNulls, + updateKeyName, + OutputPageBuilder.build(schema, KintoneColumnVisitorTest::build)); + } + private static Schema build(Schema.Builder builder) { return builder .add("BOOLEAN|SINGLE_LINE_TEXT", Types.BOOLEAN) - // java.lang.NumberFormatException at java.math.BigDecimal. - // .add("BOOLEAN", Types.BOOLEAN) + .add("BOOLEAN", Types.BOOLEAN) .add("LONG|SINGLE_LINE_TEXT", Types.LONG) .add("LONG", Types.LONG) + .add("LONG|DATE", Types.LONG) + .add("LONG|DATE|JST", Types.LONG) + .add("LONG|DATE|PST", Types.LONG) + .add("LONG|TIME", Types.LONG) + .add("LONG|TIME|JST", Types.LONG) + .add("LONG|TIME|PST", Types.LONG) + .add("LONG|DATETIME", Types.LONG) .add("DOUBLE|SINGLE_LINE_TEXT", Types.DOUBLE) .add("DOUBLE", Types.DOUBLE) + .add("DOUBLE|DATE", Types.DOUBLE) + .add("DOUBLE|DATE|JST", Types.DOUBLE) + .add("DOUBLE|DATE|PST", Types.DOUBLE) + .add("DOUBLE|TIME", Types.DOUBLE) + .add("DOUBLE|TIME|JST", Types.DOUBLE) + .add("DOUBLE|TIME|PST", Types.DOUBLE) + .add("DOUBLE|DATETIME", Types.DOUBLE) .add("STRING|SINGLE_LINE_TEXT", Types.STRING) .add("STRING", Types.STRING) + .add("STRING|RICH_TEXT", Types.STRING) .add("STRING|NUMBER", Types.STRING) .add("STRING|CHECK_BOX", Types.STRING) + .add("STRING|RADIO_BUTTON", Types.STRING) + .add("STRING|MULTI_SELECT", Types.STRING) .add("STRING|DROP_DOWN", Types.STRING) + .add("STRING|DATE", Types.STRING) + .add("STRING|DATE|JST", Types.STRING) + .add("STRING|DATE|PST", Types.STRING) + .add("STRING|TIME", Types.STRING) + .add("STRING|TIME|JST", Types.STRING) + .add("STRING|TIME|PST", Types.STRING) + .add("STRING|DATETIME", Types.STRING) .add("STRING|LINK", Types.STRING) .add("TIMESTAMP|SINGLE_LINE_TEXT", Types.TIMESTAMP) + .add("TIMESTAMP|NUMBER", Types.TIMESTAMP) .add("TIMESTAMP|DATE", Types.TIMESTAMP) .add("TIMESTAMP|DATE|JST", Types.TIMESTAMP) .add("TIMESTAMP|DATE|PST", Types.TIMESTAMP) + .add("TIMESTAMP|TIME", Types.TIMESTAMP) + .add("TIMESTAMP|TIME|JST", Types.TIMESTAMP) + .add("TIMESTAMP|TIME|PST", Types.TIMESTAMP) .add("TIMESTAMP", Types.TIMESTAMP) .add("JSON|SINGLE_LINE_TEXT", Types.JSON) .add("JSON", Types.JSON) @@ -165,18 +544,46 @@ private static Map build( .put(build("BOOLEAN", it -> it.setType("NUMBER"))) .put(build("LONG|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT"))) .put(build("LONG", it -> it.setType("NUMBER"))) + .put(build("LONG|DATE", it -> it.setType("DATE").setTimezone("UTC"))) + .put(build("LONG|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo"))) + .put(build("LONG|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific"))) + .put(build("LONG|TIME", it -> it.setType("TIME").setTimezone("UTC"))) + .put(build("LONG|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo"))) + .put(build("LONG|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific"))) + .put(build("LONG|DATETIME", it -> it.setType("DATETIME"))) .put(build("DOUBLE|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT"))) .put(build("DOUBLE", it -> it.setType("NUMBER"))) + .put(build("DOUBLE|DATE", it -> it.setType("DATE").setTimezone("UTC"))) + .put(build("DOUBLE|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo"))) + .put(build("DOUBLE|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific"))) + .put(build("DOUBLE|TIME", it -> it.setType("TIME").setTimezone("UTC"))) + .put(build("DOUBLE|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo"))) + .put(build("DOUBLE|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific"))) + .put(build("DOUBLE|DATETIME", it -> it.setType("DATETIME"))) .put(build("STRING|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT"))) .put(build("STRING", it -> it.setType("MULTI_LINE_TEXT"))) + .put(build("STRING|RICH_TEXT", it -> it.setType("RICH_TEXT"))) .put(build("STRING|NUMBER", it -> it.setType("NUMBER"))) .put(build("STRING|CHECK_BOX", it -> it.setType("CHECK_BOX").setValueSeparator(","))) + .put(build("STRING|RADIO_BUTTON", it -> it.setType("RADIO_BUTTON"))) + .put(build("STRING|MULTI_SELECT", it -> it.setType("MULTI_SELECT").setValueSeparator(","))) .put(build("STRING|DROP_DOWN", it -> it.setType("DROP_DOWN"))) + .put(build("STRING|DATE", it -> it.setType("DATE").setTimezone("UTC"))) + .put(build("STRING|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo"))) + .put(build("STRING|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific"))) + .put(build("STRING|TIME", it -> it.setType("TIME").setTimezone("UTC"))) + .put(build("STRING|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo"))) + .put(build("STRING|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific"))) + .put(build("STRING|DATETIME", it -> it.setType("DATETIME"))) .put(build("STRING|LINK", it -> it.setType("LINK"))) .put(build("TIMESTAMP|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT"))) + .put(build("TIMESTAMP|NUMBER", it -> it.setType("NUMBER"))) .put(build("TIMESTAMP|DATE", it -> it.setType("DATE").setTimezone("UTC"))) .put(build("TIMESTAMP|DATE|JST", it -> it.setType("DATE").setTimezone("Asia/Tokyo"))) .put(build("TIMESTAMP|DATE|PST", it -> it.setType("DATE").setTimezone("US/Pacific"))) + .put(build("TIMESTAMP|TIME", it -> it.setType("TIME").setTimezone("UTC"))) + .put(build("TIMESTAMP|TIME|JST", it -> it.setType("TIME").setTimezone("Asia/Tokyo"))) + .put(build("TIMESTAMP|TIME|PST", it -> it.setType("TIME").setTimezone("US/Pacific"))) .put(build("TIMESTAMP", it -> it.setType("DATETIME"))) .put(build("JSON|SINGLE_LINE_TEXT", it -> it.setType("SINGLE_LINE_TEXT"))) .put(build("JSON", it -> it.setType("MULTI_LINE_TEXT"))) @@ -192,81 +599,193 @@ private static Map.Entry build( private static Page build(OutputPageBuilder builder) { return builder .setNull("BOOLEAN|SINGLE_LINE_TEXT") - // .setNull("BOOLEAN") + .setNull("BOOLEAN") .setNull("LONG|SINGLE_LINE_TEXT") .setNull("LONG") + .setNull("LONG|DATE") + .setNull("LONG|DATE|JST") + .setNull("LONG|DATE|PST") + .setNull("LONG|TIME") + .setNull("LONG|TIME|JST") + .setNull("LONG|TIME|PST") + .setNull("LONG|DATETIME") .setNull("DOUBLE|SINGLE_LINE_TEXT") .setNull("DOUBLE") + .setNull("DOUBLE|DATE") + .setNull("DOUBLE|DATE|JST") + .setNull("DOUBLE|DATE|PST") + .setNull("DOUBLE|TIME") + .setNull("DOUBLE|TIME|JST") + .setNull("DOUBLE|TIME|PST") + .setNull("DOUBLE|DATETIME") .setNull("STRING|SINGLE_LINE_TEXT") .setNull("STRING") + .setNull("STRING|RICH_TEXT") .setNull("STRING|NUMBER") .setNull("STRING|CHECK_BOX") + .setNull("STRING|RADIO_BUTTON") + .setNull("STRING|MULTI_SELECT") .setNull("STRING|DROP_DOWN") + .setNull("STRING|DATE") + .setNull("STRING|DATE|JST") + .setNull("STRING|DATE|PST") + .setNull("STRING|TIME") + .setNull("STRING|TIME|JST") + .setNull("STRING|TIME|PST") + .setNull("STRING|DATETIME") .setNull("STRING|LINK") .setNull("TIMESTAMP|SINGLE_LINE_TEXT") + .setNull("TIMESTAMP|NUMBER") .setNull("TIMESTAMP|DATE") .setNull("TIMESTAMP|DATE|JST") .setNull("TIMESTAMP|DATE|PST") + .setNull("TIMESTAMP|TIME") + .setNull("TIMESTAMP|TIME|JST") + .setNull("TIMESTAMP|TIME|PST") .setNull("TIMESTAMP") .setNull("JSON|SINGLE_LINE_TEXT") .setNull("JSON") .addRecord() .setBoolean("BOOLEAN|SINGLE_LINE_TEXT", false) - // .setBoolean("BOOLEAN", false) + .setBoolean("BOOLEAN", false) .setLong("LONG|SINGLE_LINE_TEXT", 0) .setLong("LONG", 0) + .setLong("LONG|DATE", 0) + .setLong("LONG|DATE|JST", 0) + .setLong("LONG|DATE|PST", 0) + .setLong("LONG|TIME", 0) + .setLong("LONG|TIME|JST", 0) + .setLong("LONG|TIME|PST", 0) + .setLong("LONG|DATETIME", 0) .setDouble("DOUBLE|SINGLE_LINE_TEXT", 0) .setDouble("DOUBLE", 0) + .setDouble("DOUBLE|DATE", 0) + .setDouble("DOUBLE|DATE|JST", 0) + .setDouble("DOUBLE|DATE|PST", 0) + .setDouble("DOUBLE|TIME", 0) + .setDouble("DOUBLE|TIME|JST", 0) + .setDouble("DOUBLE|TIME|PST", 0) + .setDouble("DOUBLE|DATETIME", 0) .setString("STRING|SINGLE_LINE_TEXT", "") .setString("STRING", "") + .setString("STRING|RICH_TEXT", "") .setString("STRING|NUMBER", "") .setString("STRING|CHECK_BOX", "") + .setString("STRING|RADIO_BUTTON", "") + .setString("STRING|MULTI_SELECT", "") .setString("STRING|DROP_DOWN", "") + .setString("STRING|DATE", "") + .setString("STRING|DATE|JST", "") + .setString("STRING|DATE|PST", "") + .setString("STRING|TIME", "") + .setString("STRING|TIME|JST", "") + .setString("STRING|TIME|PST", "") + .setString("STRING|DATETIME", "") .setString("STRING|LINK", "") .setTimestamp("TIMESTAMP|SINGLE_LINE_TEXT", Timestamp.ofInstant(Instant.EPOCH)) + .setTimestamp("TIMESTAMP|NUMBER", Timestamp.ofInstant(Instant.EPOCH)) .setTimestamp("TIMESTAMP|DATE", Timestamp.ofInstant(Instant.EPOCH)) .setTimestamp("TIMESTAMP|DATE|JST", Timestamp.ofInstant(Instant.EPOCH)) .setTimestamp("TIMESTAMP|DATE|PST", Timestamp.ofInstant(Instant.EPOCH)) + .setTimestamp("TIMESTAMP|TIME", Timestamp.ofInstant(Instant.EPOCH)) + .setTimestamp("TIMESTAMP|TIME|JST", Timestamp.ofInstant(Instant.EPOCH)) + .setTimestamp("TIMESTAMP|TIME|PST", Timestamp.ofInstant(Instant.EPOCH)) .setTimestamp("TIMESTAMP", Timestamp.ofInstant(Instant.EPOCH)) .setJson("JSON|SINGLE_LINE_TEXT", ValueFactory.newString("")) .setJson("JSON", ValueFactory.newString("")) .addRecord() .setBoolean("BOOLEAN|SINGLE_LINE_TEXT", true) - // .setBoolean("BOOLEAN", true) + .setBoolean("BOOLEAN", true) .setLong("LONG|SINGLE_LINE_TEXT", 123) .setLong("LONG", 123) + .setLong("LONG|DATE", 946684799) + .setLong("LONG|DATE|JST", 946684799) + .setLong("LONG|DATE|PST", 946684799) + .setLong("LONG|TIME", 946684799) + .setLong("LONG|TIME|JST", 946684799) + .setLong("LONG|TIME|PST", 946684799) + .setLong("LONG|DATETIME", 946684799) .setDouble("DOUBLE|SINGLE_LINE_TEXT", 123) .setDouble("DOUBLE", 123) + .setDouble("DOUBLE|DATE", 946684799) + .setDouble("DOUBLE|DATE|JST", 946684799) + .setDouble("DOUBLE|DATE|PST", 946684799) + .setDouble("DOUBLE|TIME", 946684799) + .setDouble("DOUBLE|TIME|JST", 946684799) + .setDouble("DOUBLE|TIME|PST", 946684799) + .setDouble("DOUBLE|DATETIME", 946684799) .setString("STRING|SINGLE_LINE_TEXT", "abc") .setString("STRING", "abc") + .setString("STRING|RICH_TEXT", "abc") .setString("STRING|NUMBER", "123") .setString("STRING|CHECK_BOX", "123,abc") + .setString("STRING|RADIO_BUTTON", "abc") + .setString("STRING|MULTI_SELECT", "123,abc") .setString("STRING|DROP_DOWN", "abc") + .setString("STRING|DATE", "1999-12-31") + .setString("STRING|DATE|JST", "1999-12-31") + .setString("STRING|DATE|PST", "1999-12-31") + .setString("STRING|TIME", "23:59:59") + .setString("STRING|TIME|JST", "23:59:59") + .setString("STRING|TIME|PST", "23:59:59") + .setString("STRING|DATETIME", "1999-12-31T23:59:59Z") .setString("STRING|LINK", "abc") .setTimestamp("TIMESTAMP|SINGLE_LINE_TEXT", timestamp("1999-12-31T23:59:59Z")) + .setTimestamp("TIMESTAMP|NUMBER", timestamp("1999-12-31T23:59:59Z")) .setTimestamp("TIMESTAMP|DATE", timestamp("1999-12-31T23:59:59Z")) .setTimestamp("TIMESTAMP|DATE|JST", timestamp("1999-12-31T23:59:59Z")) .setTimestamp("TIMESTAMP|DATE|PST", timestamp("1999-12-31T23:59:59Z")) + .setTimestamp("TIMESTAMP|TIME", timestamp("1999-12-31T23:59:59Z")) + .setTimestamp("TIMESTAMP|TIME|JST", timestamp("1999-12-31T23:59:59Z")) + .setTimestamp("TIMESTAMP|TIME|PST", timestamp("1999-12-31T23:59:59Z")) .setTimestamp("TIMESTAMP", timestamp("1999-12-31T23:59:59Z")) .setJson("JSON|SINGLE_LINE_TEXT", ValueFactory.newString("abc")) .setJson("JSON", ValueFactory.newString("abc")) .addRecord() .setBoolean("BOOLEAN|SINGLE_LINE_TEXT", false) - // .setBoolean("BOOLEAN", false) + .setBoolean("BOOLEAN", false) .setLong("LONG|SINGLE_LINE_TEXT", 456) .setLong("LONG", 456) + .setLong("LONG|DATE", 946684800) + .setLong("LONG|DATE|JST", 946684800) + .setLong("LONG|DATE|PST", 946684800) + .setLong("LONG|TIME", 946684800) + .setLong("LONG|TIME|JST", 946684800) + .setLong("LONG|TIME|PST", 946684800) + .setLong("LONG|DATETIME", 946684800) .setDouble("DOUBLE|SINGLE_LINE_TEXT", 456) .setDouble("DOUBLE", 456) + .setDouble("DOUBLE|DATE", 946684800) + .setDouble("DOUBLE|DATE|JST", 946684800) + .setDouble("DOUBLE|DATE|PST", 946684800) + .setDouble("DOUBLE|TIME", 946684800) + .setDouble("DOUBLE|TIME|JST", 946684800) + .setDouble("DOUBLE|TIME|PST", 946684800) + .setDouble("DOUBLE|DATETIME", 946684800) .setString("STRING|SINGLE_LINE_TEXT", "def") .setString("STRING", "def") + .setString("STRING|RICH_TEXT", "def") .setString("STRING|NUMBER", "456") .setString("STRING|CHECK_BOX", "456,def") + .setString("STRING|RADIO_BUTTON", "def") + .setString("STRING|MULTI_SELECT", "456,def") .setString("STRING|DROP_DOWN", "def") + .setString("STRING|DATE", "2000-01-01") + .setString("STRING|DATE|JST", "2000-01-01") + .setString("STRING|DATE|PST", "2000-01-01") + .setString("STRING|TIME", "00:00:00") + .setString("STRING|TIME|JST", "00:00:00") + .setString("STRING|TIME|PST", "00:00:00") + .setString("STRING|DATETIME", "2000-01-01T00:00:00Z") .setString("STRING|LINK", "def") .setTimestamp("TIMESTAMP|SINGLE_LINE_TEXT", timestamp("2000-01-01T00:00:00Z")) + .setTimestamp("TIMESTAMP|NUMBER", timestamp("2000-01-01T00:00:00Z")) .setTimestamp("TIMESTAMP|DATE", timestamp("2000-01-01T00:00:00Z")) .setTimestamp("TIMESTAMP|DATE|JST", timestamp("2000-01-01T00:00:00Z")) .setTimestamp("TIMESTAMP|DATE|PST", timestamp("2000-01-01T00:00:00Z")) + .setTimestamp("TIMESTAMP|TIME", timestamp("2000-01-01T00:00:00Z")) + .setTimestamp("TIMESTAMP|TIME|JST", timestamp("2000-01-01T00:00:00Z")) + .setTimestamp("TIMESTAMP|TIME|PST", timestamp("2000-01-01T00:00:00Z")) .setTimestamp("TIMESTAMP", timestamp("2000-01-01T00:00:00Z")) .setJson("JSON|SINGLE_LINE_TEXT", ValueFactory.newString("def")) .setJson("JSON", ValueFactory.newString("def")) @@ -287,8 +806,12 @@ private static LocalDate date(CharSequence text) { return LocalDate.parse(text); } + private static LocalTime time(CharSequence text) { + return LocalTime.parse(text); + } + private static ZonedDateTime dateTime(CharSequence text) { - return ZonedDateTime.parse(text).withZoneSameInstant(ZoneId.of("UTC")); + return ZonedDateTime.parse(text); } private static Timestamp timestamp(CharSequence text) { diff --git a/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorVerifier.java b/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorVerifier.java index d9b237b..bbd4b6b 100644 --- a/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorVerifier.java +++ b/src/test/java/org/embulk/output/kintone/KintoneColumnVisitorVerifier.java @@ -5,6 +5,7 @@ import com.kintone.client.model.record.UpdateKey; import java.util.Map; import java.util.function.BiConsumer; +import javax.validation.UnexpectedTypeException; import org.embulk.spi.Column; import org.embulk.spi.Page; import org.embulk.spi.PageReader; @@ -12,24 +13,39 @@ public class KintoneColumnVisitorVerifier { private final Schema schema; - private final Map columnOptions; - private final PageReader pageReader; + private final Map options; + private final PageReader reader; private final KintoneColumnVisitor visitor; + public KintoneColumnVisitorVerifier( + Schema schema, Map options, String updateKeyName, Page page) { + this(schema, options, false, false, updateKeyName, page); + } + public KintoneColumnVisitorVerifier( Schema schema, - Map columnOptions, + Map options, + boolean preferNulls, + boolean ignoreNulls, String updateKeyName, Page page) { this.schema = schema; - this.columnOptions = columnOptions; - pageReader = new PageReader(schema); - pageReader.setPage(page); - visitor = new KintoneColumnVisitor(pageReader, columnOptions, updateKeyName); + this.options = options; + reader = new PageReader(schema); + reader.setPage(page); + visitor = new KintoneColumnVisitor(reader, options, preferNulls, ignoreNulls, updateKeyName); + } + + public void verify() { + verify((record, updateKey) -> {}); } public void verify(BiConsumer consumer) { - if (!pageReader.nextRecord()) { + verify(consumer, false); + } + + public void verify(BiConsumer consumer, boolean nullable) { + if (!reader.nextRecord()) { throw new IllegalStateException(); } Record record = new Record(); @@ -37,16 +53,21 @@ public void verify(BiConsumer consumer) { UpdateKey updateKey = new UpdateKey(); visitor.setUpdateKey(updateKey); schema.visitColumns(visitor); - schema.getColumns().forEach(column -> verify(record, column)); + schema.getColumns().forEach(column -> verify(record, column, nullable)); consumer.accept(record, updateKey); } - private void verify(Record record, Column column) { - FieldType expected = FieldType.valueOf(columnOptions.get(column.getName()).getType()); + private void verify(Record record, Column column, boolean nullable) { + FieldType expected = FieldType.valueOf(options.get(column.getName()).getType()); FieldType actual = record.getFieldType(column.getName()); - if (!expected.equals(actual)) { - System.out.printf( - "%s: Expected type is %s, but actual type is %s%n", column.getName(), expected, actual); + if (actual == null && nullable) { + return; + } + if (expected != actual) { + throw new UnexpectedTypeException( + String.format( + "%s: Expected type is %s, but actual type is %s%n", + column.getName(), expected, actual)); } } } diff --git a/src/test/java/org/embulk/output/kintone/KintonePageOutputVerifier.java b/src/test/java/org/embulk/output/kintone/KintonePageOutputVerifier.java index d066053..e6e2659 100644 --- a/src/test/java/org/embulk/output/kintone/KintonePageOutputVerifier.java +++ b/src/test/java/org/embulk/output/kintone/KintonePageOutputVerifier.java @@ -19,8 +19,6 @@ import com.kintone.client.model.app.field.FieldProperty; import com.kintone.client.model.app.field.NumberFieldProperty; import com.kintone.client.model.app.field.SingleLineTextFieldProperty; -import com.kintone.client.model.record.DateTimeFieldValue; -import com.kintone.client.model.record.FieldType; import com.kintone.client.model.record.FieldValue; import com.kintone.client.model.record.NumberFieldValue; import com.kintone.client.model.record.Record; @@ -28,7 +26,6 @@ import com.kintone.client.model.record.SingleLineTextFieldValue; import com.kintone.client.model.record.UpdateKey; import java.math.BigDecimal; -import java.time.ZoneId; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -191,9 +188,7 @@ private static void assertFieldValue( String domain, int index, String fieldCode, FieldValue actual, FieldValue expected) { String reason = String.format("%s:%d:%s", domain, index, fieldCode); assertThat(reason, actual.getType(), is(expected.getType())); - // spotless:off - assertThat(reason, actual, is(expected.getType().equals(FieldType.DATETIME) ? new DateTimeFieldValue(((DateTimeFieldValue) expected).getValue().withZoneSameInstant(ZoneId.of("UTC"))) : expected)); - // spotless:on + assertThat(reason, actual, is(expected)); } private static void assertRecordForUpdates( @@ -217,7 +212,7 @@ private static void assertUpdateKey( String domain, int index, UpdateKey actual, UpdateKey expected) { String reason = String.format("%s:%d", domain, index); assertThat(reason, actual.getField(), is(expected.getField())); - assertThat(reason, actual.getValue(), is(expected.getValue().toString())); + assertThat(reason, actual.getValue(), is(expected.getValue())); } public interface Runnable { diff --git a/src/test/java/org/embulk/output/kintone/TestKintoneOutputPlugin.java b/src/test/java/org/embulk/output/kintone/TestKintoneOutputPlugin.java index b039cc0..ed7f793 100644 --- a/src/test/java/org/embulk/output/kintone/TestKintoneOutputPlugin.java +++ b/src/test/java/org/embulk/output/kintone/TestKintoneOutputPlugin.java @@ -41,13 +41,15 @@ public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int ta String test = taskSource.get(String.class, "Domain"); String mode = taskSource.get(String.class, "Mode"); String field = taskSource.get(String.class, "UpdateKeyName"); + boolean preferNulls = taskSource.get(boolean.class, "PreferNulls"); + boolean ignoreNulls = taskSource.get(boolean.class, "IgnoreNulls"); return new KintonePageOutputVerifier( super.open(taskSource, schema, taskIndex), test, field, - getValues(test), - getAddRecords(test, mode), - getUpdateRecords(test, mode, field)); + getValues(test, preferNulls, ignoreNulls), + getAddRecords(test, mode, preferNulls, ignoreNulls), + getUpdateRecords(test, mode, preferNulls, ignoreNulls, field)); } protected void runOutput(String configName, String inputName) throws Exception { @@ -89,8 +91,11 @@ protected ConfigSource fromYamlString(String string) { return embulk.configLoader().fromYamlString(string); } - private static List getValues(String test) { - String name = String.format("%s/values.json", test); + private static List getValues(String test, boolean preferNulls, boolean ignoreNulls) { + String name = + String.format( + "%s/values%s.json", + test, ignoreNulls ? "_ignore_nulls" : preferNulls ? "_prefer_nulls" : ""); String json = existsResource(name) ? readResource(name) : null; return json == null || json.isEmpty() ? Collections.emptyList() @@ -99,8 +104,12 @@ private static List getValues(String test) { .collect(Collectors.toList()); } - private static List getAddRecords(String test, String mode) { - String name = String.format("%s/%s_add_records.jsonl", test, mode); + private static List getAddRecords( + String test, String mode, boolean preferNulls, boolean ignoreNulls) { + String name = + String.format( + "%s/%s_add%s_records.jsonl", + test, mode, ignoreNulls ? "_ignore_nulls" : preferNulls ? "_prefer_nulls" : ""); String jsonl = existsResource(name) ? readResource(name) : null; return jsonl == null || jsonl.isEmpty() ? Collections.emptyList() @@ -109,9 +118,13 @@ private static List getAddRecords(String test, String mode) { .collect(Collectors.toList()); } - private static List getUpdateRecords(String test, String mode, String field) { + private static List getUpdateRecords( + String test, String mode, boolean preferNulls, boolean ignoreNulls, String field) { Function key = getKey(field); - String name = String.format("%s/%s_update_records.jsonl", test, mode); + String name = + String.format( + "%s/%s_update%s_records.jsonl", + test, mode, ignoreNulls ? "_ignore_nulls" : preferNulls ? "_prefer_nulls" : ""); String jsonl = existsResource(name) ? readResource(name) : null; return jsonl == null || jsonl.isEmpty() ? Collections.emptyList() diff --git a/src/test/java/org/embulk/output/kintone/TestTaskMode.java b/src/test/java/org/embulk/output/kintone/TestTaskMode.java index 6ec31bb..91b70c6 100644 --- a/src/test/java/org/embulk/output/kintone/TestTaskMode.java +++ b/src/test/java/org/embulk/output/kintone/TestTaskMode.java @@ -15,17 +15,29 @@ public void before() { public void testInsert() throws Exception { merge(config("mode: insert")); runOutput(); + merge(config("prefer_nulls: true")); + runOutput(); + merge(config("ignore_nulls: true")); + runOutput(); } @Test public void testUpdate() throws Exception { merge(config("mode: update", "update_key: string_number")); runOutput(); + merge(config("prefer_nulls: true")); + runOutput(); + merge(config("ignore_nulls: true")); + runOutput(); } @Test public void testUpsert() throws Exception { merge(config("mode: upsert", "update_key: double_single_line_text")); runOutput(); + merge(config("prefer_nulls: true")); + runOutput(); + merge(config("ignore_nulls: true")); + runOutput(); } } diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/config.yml b/src/test/resources/org/embulk/output/kintone/task/mode/config.yml index 543bec0..6ac0d5a 100644 --- a/src/test/resources/org/embulk/output/kintone/task/mode/config.yml +++ b/src/test/resources/org/embulk/output/kintone/task/mode/config.yml @@ -2,36 +2,129 @@ column_options: boolean_single_line_text: field_code: boolean_single_line_text type: SINGLE_LINE_TEXT + boolean: + field_code: boolean + type: NUMBER long_single_line_text: field_code: long_single_line_text type: SINGLE_LINE_TEXT long: field_code: long type: NUMBER + long_date: + field_code: long_date + type: DATE + long_date_jst: + field_code: long_date_jst + type: DATE + timezone: Asia/Tokyo + long_date_pst: + field_code: long_date_pst + type: DATE + timezone: US/Pacific + long_time: + field_code: long_time + type: TIME + long_time_jst: + field_code: long_time_jst + type: TIME + timezone: Asia/Tokyo + long_time_pst: + field_code: long_time_pst + type: TIME + timezone: US/Pacific + long_datetime: + field_code: long_datetime + type: DATETIME double_single_line_text: field_code: double_single_line_text type: SINGLE_LINE_TEXT double: field_code: double type: NUMBER + double_date: + field_code: double_date + type: DATE + double_date_jst: + field_code: double_date_jst + type: DATE + timezone: Asia/Tokyo + double_date_pst: + field_code: double_date_pst + type: DATE + timezone: US/Pacific + double_time: + field_code: double_time + type: TIME + double_time_jst: + field_code: double_time_jst + type: TIME + timezone: Asia/Tokyo + double_time_pst: + field_code: double_time_pst + type: TIME + timezone: US/Pacific + double_datetime: + field_code: double_datetime + type: DATETIME string_single_line_text: field_code: string_single_line_text type: SINGLE_LINE_TEXT string: field_code: string type: MULTI_LINE_TEXT + string_rich_text: + field_code: string_rich_text + type: RICH_TEXT string_number: field_code: string_number type: NUMBER string_check_box: field_code: string_check_box type: CHECK_BOX + string_radio_button: + field_code: string_radio_button + type: RADIO_BUTTON + string_multi_select: + field_code: string_multi_select + type: MULTI_SELECT string_drop_down: field_code: string_drop_down type: DROP_DOWN + string_date: + field_code: string_date + type: DATE + string_date_jst: + field_code: string_date_jst + type: DATE + timezone: Asia/Tokyo + string_date_pst: + field_code: string_date_pst + type: DATE + timezone: US/Pacific + string_time: + field_code: string_time + type: TIME + string_time_jst: + field_code: string_time_jst + type: TIME + timezone: Asia/Tokyo + string_time_pst: + field_code: string_time_pst + type: TIME + timezone: US/Pacific + string_datetime: + field_code: string_datetime + type: DATETIME string_link: field_code: string_link type: LINK + timestamp_single_line_text: + field_code: timestamp_single_line_text + type: SINGLE_LINE_TEXT + timestamp_number: + field_code: timestamp_number + type: NUMBER timestamp_date: field_code: timestamp_date type: DATE @@ -43,6 +136,17 @@ column_options: field_code: timestamp_date_pst type: DATE timezone: US/Pacific + timestamp_time: + field_code: timestamp_time + type: TIME + timestamp_time_jst: + field_code: timestamp_time_jst + type: TIME + timezone: Asia/Tokyo + timestamp_time_pst: + field_code: timestamp_time_pst + type: TIME + timezone: US/Pacific timestamp: field_code: timestamp type: DATETIME diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/input.csv b/src/test/resources/org/embulk/output/kintone/task/mode/input.csv index 6d0fd47..f17619b 100644 --- a/src/test/resources/org/embulk/output/kintone/task/mode/input.csv +++ b/src/test/resources/org/embulk/output/kintone/task/mode/input.csv @@ -1,7 +1,7 @@ -boolean_single_line_text:boolean,long_single_line_text:long,long:long,double_single_line_text:double,double:double,string_single_line_text:string,string:string,string_number:string,string_check_box:string,string_drop_down:string,string_link:string,timestamp_date:timestamp,timestamp_date_jst:timestamp,timestamp_date_pst:timestamp,timestamp:timestamp,json_single_line_text:json,json:json -,,,,,,,,,,,,,,,, -,,,1,,,,,,,,,,,,, -true,123,123,123,123,abc,abc,123,"123,abc",abc,abc,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,"""abc""","""abc""" -,,,,,,,,,,,,,,,, -,,,,,,,1,,,,,,,,, -false,456,456,456,456,def,def,456,"456,def",def,def,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,"""def""","""def""" +boolean_single_line_text:boolean,boolean:boolean,long_single_line_text:long,long:long,long_date:long,long_date_jst:long,long_date_pst:long,long_time:long,long_time_jst:long,long_time_pst:long,long_datetime:long,double_single_line_text:double,double:double,double_date:double,double_date_jst:double,double_date_pst:double,double_time:double,double_time_jst:double,double_time_pst:double,double_datetime:double,string_single_line_text:string,string:string,string_rich_text:string,string_number:string,string_check_box:string,string_radio_button:string,string_multi_select:string,string_drop_down:string,string_date:string,string_date_jst:string,string_date_pst:string,string_time:string,string_time_jst:string,string_time_pst:string,string_datetime:string,string_link:string,timestamp_single_line_text:timestamp,timestamp_number:timestamp,timestamp_date:timestamp,timestamp_date_jst:timestamp,timestamp_date_pst:timestamp,timestamp_time:timestamp,timestamp_time_jst:timestamp,timestamp_time_pst:timestamp,timestamp:timestamp,json_single_line_text:json,json:json +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +true,true,123,123,946684799,946684799,946684799,946684799,946684799,946684799,946684799,123,123,946684799,946684799,946684799,946684799,946684799,946684799,946684799,abc,abc,abc,123,"123,abc",abc,"123,abc",abc,1999-12-31,1999-12-31,1999-12-31,23:59:59,23:59:59,23:59:59,1999-12-31T23:59:59Z,abc,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,1999-12-31 23:59:59.000 +0000,"""abc""","""abc""" +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,, +false,false,456,456,946684800,946684800,946684800,946684800,946684800,946684800,946684800,456,456,946684800,946684800,946684800,946684800,946684800,946684800,946684800,def,def,def,456,"456,def",def,"456,def",def,2000-01-01,2000-01-01,2000-01-01,00:00:00,00:00:00,00:00:00,2000-01-01T00:00:00Z,def,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,2000-01-01 00:00:00.000 +0000,"""def""","""def""" diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_ignore_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_ignore_nulls_records.jsonl new file mode 100644 index 0000000..333e6c0 --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_ignore_nulls_records.jsonl @@ -0,0 +1,6 @@ +{} +{"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{} +{"string_number":{"type":"NUMBER","value":"1"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_prefer_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_prefer_nulls_records.jsonl new file mode 100644 index 0000000..20e2b3f --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_prefer_nulls_records.jsonl @@ -0,0 +1,6 @@ +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_records.jsonl index 00ac5dc..d247616 100644 --- a/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_records.jsonl +++ b/src/test/resources/org/embulk/output/kintone/task/mode/insert_add_records.jsonl @@ -1,6 +1,6 @@ -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_link":{"type":"LINK","value":"abc"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"json":{"type":"MULTI_LINE_TEXT","value":"abc"}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_link":{"type":"LINK","value":"def"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"json":{"type":"MULTI_LINE_TEXT","value":"def"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/update_update_ignore_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/update_update_ignore_nulls_records.jsonl new file mode 100644 index 0000000..c59ce71 --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/update_update_ignore_nulls_records.jsonl @@ -0,0 +1,3 @@ +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"string_number":{"type":"NUMBER","value":"1"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/update_update_prefer_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/update_update_prefer_nulls_records.jsonl new file mode 100644 index 0000000..1d77640 --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/update_update_prefer_nulls_records.jsonl @@ -0,0 +1,3 @@ +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/update_update_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/update_update_records.jsonl index 5f24a6d..d247616 100644 --- a/src/test/resources/org/embulk/output/kintone/task/mode/update_update_records.jsonl +++ b/src/test/resources/org/embulk/output/kintone/task/mode/update_update_records.jsonl @@ -1,3 +1,6 @@ -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_link":{"type":"LINK","value":"abc"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"json":{"type":"MULTI_LINE_TEXT","value":"abc"}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_link":{"type":"LINK","value":"def"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"json":{"type":"MULTI_LINE_TEXT","value":"def"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_ignore_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_ignore_nulls_records.jsonl new file mode 100644 index 0000000..5132dc7 --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_ignore_nulls_records.jsonl @@ -0,0 +1,3 @@ +{} +{} +{"string_number":{"type":"NUMBER","value":"1"}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_prefer_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_prefer_nulls_records.jsonl new file mode 100644 index 0000000..1c700cd --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_prefer_nulls_records.jsonl @@ -0,0 +1,3 @@ +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_records.jsonl index 408fdd3..9fa52b0 100644 --- a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_records.jsonl +++ b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_add_records.jsonl @@ -1,2 +1,2 @@ -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_link":{"type":"LINK","value":"abc"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"json":{"type":"MULTI_LINE_TEXT","value":"abc"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_ignore_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_ignore_nulls_records.jsonl new file mode 100644 index 0000000..115c531 --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_ignore_nulls_records.jsonl @@ -0,0 +1,3 @@ +{"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_prefer_nulls_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_prefer_nulls_records.jsonl new file mode 100644 index 0000000..f03cdd6 --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_prefer_nulls_records.jsonl @@ -0,0 +1,3 @@ +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"boolean":{"type":"NUMBER","value":null},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"long":{"type":"NUMBER","value":null},"long_date":{"type":"DATE","value":null},"long_date_jst":{"type":"DATE","value":null},"long_date_pst":{"type":"DATE","value":null},"long_time":{"type":"TIME","value":null},"long_time_jst":{"type":"TIME","value":null},"long_time_pst":{"type":"TIME","value":null},"long_datetime":{"type":"DATETIME","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1.0"},"double":{"type":"NUMBER","value":null},"double_date":{"type":"DATE","value":null},"double_date_jst":{"type":"DATE","value":null},"double_date_pst":{"type":"DATE","value":null},"double_time":{"type":"TIME","value":null},"double_time_jst":{"type":"TIME","value":null},"double_time_pst":{"type":"TIME","value":null},"double_datetime":{"type":"DATETIME","value":null},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"string":{"type":"MULTI_LINE_TEXT","value":null},"string_rich_text":{"type":"RICH_TEXT","value":null},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":null},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":null},"string_date":{"type":"DATE","value":null},"string_date_jst":{"type":"DATE","value":null},"string_date_pst":{"type":"DATE","value":null},"string_time":{"type":"TIME","value":null},"string_time_jst":{"type":"TIME","value":null},"string_time_pst":{"type":"TIME","value":null},"string_datetime":{"type":"DATETIME","value":null},"string_link":{"type":"LINK","value":null},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"timestamp_number":{"type":"NUMBER","value":null},"timestamp_date":{"type":"DATE","value":null},"timestamp_date_jst":{"type":"DATE","value":null},"timestamp_date_pst":{"type":"DATE","value":null},"timestamp_time":{"type":"TIME","value":null},"timestamp_time_jst":{"type":"TIME","value":null},"timestamp_time_pst":{"type":"TIME","value":null},"timestamp":{"type":"DATETIME","value":null},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":null},"json":{"type":"MULTI_LINE_TEXT","value":null}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"true"},"boolean":{"type":"NUMBER","value":"1"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123"},"long":{"type":"NUMBER","value":"123"},"long_date":{"type":"DATE","value":"1999-12-31"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"23:59:59"},"long_time_jst":{"type":"TIME","value":"08:59:59"},"long_time_pst":{"type":"TIME","value":"15:59:59"},"long_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"123.0"},"double":{"type":"NUMBER","value":"123.0"},"double_date":{"type":"DATE","value":"1999-12-31"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"23:59:59"},"double_time_jst":{"type":"TIME","value":"08:59:59"},"double_time_pst":{"type":"TIME","value":"15:59:59"},"double_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"abc"},"string":{"type":"MULTI_LINE_TEXT","value":"abc"},"string_rich_text":{"type":"RICH_TEXT","value":"abc"},"string_number":{"type":"NUMBER","value":"123"},"string_check_box":{"type":"CHECK_BOX","value":["123","abc"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"abc"},"string_multi_select":{"type":"MULTI_SELECT","value":["123","abc"]},"string_drop_down":{"type":"DROP_DOWN","value":"abc"},"string_date":{"type":"DATE","value":"1999-12-31"},"string_date_jst":{"type":"DATE","value":"1999-12-31"},"string_date_pst":{"type":"DATE","value":"1999-12-30"},"string_time":{"type":"TIME","value":"23:59:59"},"string_time_jst":{"type":"TIME","value":"08:59:59"},"string_time_pst":{"type":"TIME","value":"15:59:59"},"string_datetime":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"string_link":{"type":"LINK","value":"abc"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1999-12-31T23:59:59Z"},"timestamp_number":{"type":"NUMBER","value":"946684799"},"timestamp_date":{"type":"DATE","value":"1999-12-31"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"23:59:59"},"timestamp_time_jst":{"type":"TIME","value":"08:59:59"},"timestamp_time_pst":{"type":"TIME","value":"15:59:59"},"timestamp":{"type":"DATETIME","value":"1999-12-31T23:59:59Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"abc\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"abc\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_records.jsonl b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_records.jsonl index f96d047..4c412cf 100644 --- a/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_records.jsonl +++ b/src/test/resources/org/embulk/output/kintone/task/mode/upsert_update_records.jsonl @@ -1,4 +1,4 @@ -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":null},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"long":{"type":"NUMBER","value":null},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":["null"]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_link":{"type":"LINK","value":""},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"json":{"type":"MULTI_LINE_TEXT","value":""}} -{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_link":{"type":"LINK","value":"def"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"json":{"type":"MULTI_LINE_TEXT","value":"def"}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"0"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0"},"long":{"type":"NUMBER","value":"0"},"long_date":{"type":"DATE","value":"1970-01-01"},"long_date_jst":{"type":"DATE","value":"1970-01-01"},"long_date_pst":{"type":"DATE","value":"1969-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"0.0"},"double":{"type":"NUMBER","value":"0.0"},"double_date":{"type":"DATE","value":"1970-01-01"},"double_date_jst":{"type":"DATE","value":"1970-01-01"},"double_date_pst":{"type":"DATE","value":"1969-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":""},"string":{"type":"MULTI_LINE_TEXT","value":""},"string_rich_text":{"type":"RICH_TEXT","value":""},"string_number":{"type":"NUMBER","value":"1"},"string_check_box":{"type":"CHECK_BOX","value":[]},"string_radio_button":{"type":"RADIO_BUTTON","value":""},"string_multi_select":{"type":"MULTI_SELECT","value":[]},"string_drop_down":{"type":"DROP_DOWN","value":""},"string_date":{"type":"DATE","value":"1970-01-01"},"string_date_jst":{"type":"DATE","value":"1970-01-01"},"string_date_pst":{"type":"DATE","value":"1969-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":""},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"1970-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"0"},"timestamp_date":{"type":"DATE","value":"1970-01-01"},"timestamp_date_jst":{"type":"DATE","value":"1970-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1969-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"1970-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"\""}} +{"boolean_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"false"},"boolean":{"type":"NUMBER","value":"0"},"long_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456"},"long":{"type":"NUMBER","value":"456"},"long_date":{"type":"DATE","value":"2000-01-01"},"long_date_jst":{"type":"DATE","value":"2000-01-01"},"long_date_pst":{"type":"DATE","value":"1999-12-31"},"long_time":{"type":"TIME","value":"00:00:00"},"long_time_jst":{"type":"TIME","value":"09:00:00"},"long_time_pst":{"type":"TIME","value":"16:00:00"},"long_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"double_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"456.0"},"double":{"type":"NUMBER","value":"456.0"},"double_date":{"type":"DATE","value":"2000-01-01"},"double_date_jst":{"type":"DATE","value":"2000-01-01"},"double_date_pst":{"type":"DATE","value":"1999-12-31"},"double_time":{"type":"TIME","value":"00:00:00"},"double_time_jst":{"type":"TIME","value":"09:00:00"},"double_time_pst":{"type":"TIME","value":"16:00:00"},"double_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"def"},"string":{"type":"MULTI_LINE_TEXT","value":"def"},"string_rich_text":{"type":"RICH_TEXT","value":"def"},"string_number":{"type":"NUMBER","value":"456"},"string_check_box":{"type":"CHECK_BOX","value":["456","def"]},"string_radio_button":{"type":"RADIO_BUTTON","value":"def"},"string_multi_select":{"type":"MULTI_SELECT","value":["456","def"]},"string_drop_down":{"type":"DROP_DOWN","value":"def"},"string_date":{"type":"DATE","value":"2000-01-01"},"string_date_jst":{"type":"DATE","value":"2000-01-01"},"string_date_pst":{"type":"DATE","value":"1999-12-31"},"string_time":{"type":"TIME","value":"00:00:00"},"string_time_jst":{"type":"TIME","value":"09:00:00"},"string_time_pst":{"type":"TIME","value":"16:00:00"},"string_datetime":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"string_link":{"type":"LINK","value":"def"},"timestamp_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"2000-01-01T00:00:00Z"},"timestamp_number":{"type":"NUMBER","value":"946684800"},"timestamp_date":{"type":"DATE","value":"2000-01-01"},"timestamp_date_jst":{"type":"DATE","value":"2000-01-01"},"timestamp_date_pst":{"type":"DATE","value":"1999-12-31"},"timestamp_time":{"type":"TIME","value":"00:00:00"},"timestamp_time_jst":{"type":"TIME","value":"09:00:00"},"timestamp_time_pst":{"type":"TIME","value":"16:00:00"},"timestamp":{"type":"DATETIME","value":"2000-01-01T00:00:00Z"},"json_single_line_text":{"type":"SINGLE_LINE_TEXT","value":"\"def\""},"json":{"type":"MULTI_LINE_TEXT","value":"\"def\""}} diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/values_ignore_nulls.json b/src/test/resources/org/embulk/output/kintone/task/mode/values_ignore_nulls.json new file mode 100644 index 0000000..6b5877d --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/values_ignore_nulls.json @@ -0,0 +1 @@ +["1.0","123.0","456.0"] diff --git a/src/test/resources/org/embulk/output/kintone/task/mode/values_prefer_nulls.json b/src/test/resources/org/embulk/output/kintone/task/mode/values_prefer_nulls.json new file mode 100644 index 0000000..6b5877d --- /dev/null +++ b/src/test/resources/org/embulk/output/kintone/task/mode/values_prefer_nulls.json @@ -0,0 +1 @@ +["1.0","123.0","456.0"]