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

test.junit.fedora.server.journal.readerwriter.multicast.MockMulticastJournalWriter Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!

package fedora.server.journal.readerwriter.multicast;

import java.util.Date;
import java.util.Map;

import fedora.server.journal.JournalException;
import fedora.server.journal.ServerInterface;

public class MockMulticastJournalWriter
        extends MulticastJournalWriter {

    private boolean checkParametersForValidity = true;

    private Date currentDate;

    public MockMulticastJournalWriter(Map parameters,
                                      String role,
                                      ServerInterface server)
            throws JournalException {
        super(parameters, role, server);
    }

    public void setCheckParametersForValidity(boolean checkParametersForValidity) {
        this.checkParametersForValidity = checkParametersForValidity;
    }

    public void setCurrentDate(Date currentDate) {
        this.currentDate = currentDate;
    }

    /**
     * In unit tests, we'll want to know what the "current date" is, so we know
     * what filename to expect.
     */
    @Override
    protected Date getCurrentDate() {
        if (currentDate == null) {
            return super.getCurrentDate();
        } else {
            return currentDate;
        }
    }

    /**
     * We can choose not to check for valid parameters, if we are just running
     * tests on the Size Estimator or on a Transport.
     */
    @Override
    protected void checkTransportParametersForValidity()
            throws JournalException {
        if (checkParametersForValidity) {
            super.checkTransportParametersForValidity();
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy