TimeStampDissector extends Dissector { @SuppressWarnings("UnusedDeclaration") public TimeStampDissector() { this(DEFAULT_APACHE_DATE_TIME_PATTERN); } @SuppressWarnings("UnusedDeclaration")  TimeStampDissector();  TimeStampDissector(String newDateTimePattern);  TimeStampDissector(String inputType, String newDateTimePattern); TimeStampDissector setLocale(Locale newLocale); Locale getLocale(); @Override boolean initializeFromSettingsParameter(String settings); void setDateTimePattern(String nDateTimePattern); @Override String getInputType(); @Override final void setInputType(String nInputType); @Override List<String> getPossibleOutput(); @Override EnumSet<Casts> prepareForDissect(final String inputname, final String outputname); @SuppressWarnings("ConstantConditions") @Override void prepareForRun(); @Override void dissect(final Parsable<?> parsable, final String inputname); static final String DEFAULT_APACHE_DATE_TIME_PATTERN; }
@Test public void testTimeStampDissector() { DissectorTester.create() .withDissector(new TimeStampDissector()) .withInput("31/Dec/2012:23:00:44 -0700") .expect("TIME.EPOCH:epoch", "1357020044000") .expect("TIME.EPOCH:epoch", 1357020044000L) .expect("TIME.YEAR:year", "2012") .expect("TIME.YEAR:year", 2012L) .expect("TIME.MONTH:month", "12") .expect("TIME.MONTH:month", 12L) .expect("TIME.MONTHNAME:monthname", "December") .expect("TIME.DAY:day", "31") .expect("TIME.DAY:day", 31L) .expect("TIME.HOUR:hour", "23") .expect("TIME.HOUR:hour", 23L) .expect("TIME.MINUTE:minute", "0") .expect("TIME.MINUTE:minute", 0L) .expect("TIME.SECOND:second", "44") .expect("TIME.SECOND:second", 44L) .expect("TIME.DATE:date", "2012-12-31") .expect("TIME.TIME:time", "23:00:44") .expect("TIME.ZONE:timezone", "-07:00") .expect("TIME.YEAR:year_utc", "2013") .expect("TIME.YEAR:year_utc", 2013L) .expect("TIME.MONTH:month_utc", "1") .expect("TIME.MONTH:month_utc", 1L) .expect("TIME.MONTHNAME:monthname_utc", "January") .expect("TIME.DAY:day_utc", "1") .expect("TIME.DAY:day_utc", 1L) .expect("TIME.HOUR:hour_utc", "6") .expect("TIME.HOUR:hour_utc", 6L) .expect("TIME.MINUTE:minute_utc", "0") .expect("TIME.MINUTE:minute_utc", 0L) .expect("TIME.SECOND:second_utc", "44") .expect("TIME.SECOND:second_utc", 44L) .expect("TIME.DATE:date_utc", "2013-01-01") .expect("TIME.TIME:time_utc", "06:00:44") .checkExpectations(); }