use of org.graylog2.inputs.converters.DateConverter in project graylog2-server by Graylog2.
the class DateConverterTest method convertUsesEtcUTCIfTimeZoneSettingIsEmpty.
@Test
public void convertUsesEtcUTCIfTimeZoneSettingIsEmpty() throws Exception {
final Converter c = new DateConverter(config("YYYY-MM-dd HH:mm:ss", "", null));
final DateTime dateTime = (DateTime) c.convert("2014-03-12 10:00:00");
assertThat(dateTime).isEqualTo("2014-03-12T10:00:00.000Z");
}
use of org.graylog2.inputs.converters.DateConverter in project graylog2-server by Graylog2.
the class DateConverterTest method convertUsesEnglishIfLocaleIsNull.
@Test
public void convertUsesEnglishIfLocaleIsNull() throws Exception {
final Converter c = new DateConverter(config("dd/MMM/YYYY HH:mm:ss Z", null, null));
final DateTime dateTime = (DateTime) c.convert("11/May/2017 15:10:48 +0200");
assertThat(dateTime).isEqualTo("2017-05-11T13:10:48.000Z");
}
use of org.graylog2.inputs.converters.DateConverter in project graylog2-server by Graylog2.
the class DateConverterTest method convertUsesEnglishIfLocaleIsInvalid.
@Test
public void convertUsesEnglishIfLocaleIsInvalid() throws Exception {
final Converter c = new DateConverter(config("dd/MMM/YYYY HH:mm:ss Z", null, "Wurstweck"));
final DateTime dateTime = (DateTime) c.convert("11/May/2017 15:10:48 +0200");
assertThat(dateTime).isEqualTo("2017-05-11T13:10:48.000Z");
}
use of org.graylog2.inputs.converters.DateConverter in project graylog2-server by Graylog2.
the class DateConverterTest method convertUsesEtcUTCIfTimeZoneSettingIsBlank.
@Test
public void convertUsesEtcUTCIfTimeZoneSettingIsBlank() throws Exception {
final Converter c = new DateConverter(config("YYYY-MM-dd HH:mm:ss", " ", null));
final DateTime dateTime = (DateTime) c.convert("2014-03-12 10:00:00");
assertThat(dateTime).isEqualTo("2014-03-12T10:00:00.000Z");
}
use of org.graylog2.inputs.converters.DateConverter in project graylog2-server by Graylog2.
the class DateConverterTest method convertObeysTimeZone.
@Test
public void convertObeysTimeZone() throws Exception {
final DateTimeZone timeZone = DateTimeZone.forOffsetHours(12);
final Converter c = new DateConverter(config("YYYY-MM-dd HH:mm:ss", timeZone.toString(), null));
final DateTime dateOnly = (DateTime) c.convert("2014-03-12 10:00:00");
assertThat(dateOnly).isEqualTo("2014-03-12T10:00:00.000+12:00");
final DateTime dateTime = (DateTime) c.convert("2014-03-12 12:34:00");
assertThat(dateTime).isEqualTo("2014-03-12T12:34:00.000+12:00");
}
Aggregations