All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aconex.scrutineer.TimestampFormatter Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 7.9.3
Show newest version
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