com.aconex.scrutineer.TimestampFormatter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scrutineer Show documentation
Show all versions of scrutineer Show documentation
Compares 2 streams of Ids and Versions to prove that a secondary source is
in sync with a primary source of truth. Designed to verify an elasticsearch
cluster contains correct information from a JDBC source.
package com.aconex.scrutineer;
import com.google.common.base.Function;
import org.elasticsearch.common.joda.time.DateTimeZone;
import org.elasticsearch.common.joda.time.format.DateTimeFormatter;
import org.elasticsearch.common.joda.time.format.ISODateTimeFormat;
public class TimestampFormatter implements Function {
private final DateTimeFormatter dateTimeFormatter;
public TimestampFormatter() {
this(DateTimeZone.getDefault());
}
public TimestampFormatter(DateTimeZone dateTimeZone) {
this.dateTimeFormatter = ISODateTimeFormat.dateTime().withZone(dateTimeZone);
}
@Override
public Object apply(Long timestamp) {
String timestampFormatted = dateTimeFormatter.print(timestamp);
return String.format("%d(%s)", timestamp, timestampFormatted);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy