Example usage for org.joda.time DateTimeUtils setCurrentMillisSystem

List of usage examples for org.joda.time DateTimeUtils setCurrentMillisSystem

Introduction

In this page you can find the example usage for org.joda.time DateTimeUtils setCurrentMillisSystem.

Prototype

public static final void setCurrentMillisSystem() throws SecurityException 

Source Link

Document

Resets the current time to return the system time.

Usage

From source file:com.codereligion.cherry.junit.joda.TimeMachine.java

License:Apache License

@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override/*from ww  w . j  a va2  s  .com*/
        public void evaluate() throws Throwable {
            try {
                base.evaluate();
            } finally {
                DateTimeUtils.setCurrentMillisSystem();
            }
        }
    };
}

From source file:com.google.cloud.dataflow.sdk.testing.ResetDateTimeProvider.java

License:Apache License

@Override
protected void after() {
    DateTimeUtils.setCurrentMillisSystem();
}

From source file:divconq.hub.Clock.java

License:Open Source License

/**
 * set framework's time to use the system time
 */
public void resetAppClock() {
    DateTimeUtils.setCurrentMillisSystem();
}

From source file:fi.hsl.parkandride.test.DateTimeTestUtils.java

License:EUPL

public static <V> V withDate(DateTime date, Supplier<V> r) {
    DateTimeUtils.setCurrentMillisFixed(date.getMillis());
    final V v = r.get();
    DateTimeUtils.setCurrentMillisSystem();
    return v;/*from  w ww  . j  a va  2  s .c  o  m*/
}

From source file:gobblin.util.test.RetentionTestDataGenerator.java

License:Apache License

public void cleanup() throws IOException {
    DateTimeUtils.setCurrentMillisSystem();
    if (this.fs.exists(testTempDirPath)) {
        if (!this.fs.delete(testTempDirPath, true)) {
            throw new IOException("Failed to clean up path " + this.testTempDirPath);
        }/*from   w w  w. j  a va  2  s  . c o m*/
    }
}

From source file:mystore.Synchronization.java

public void stopSync() {
    toLog("Stopping synchronization...");
    DateTimeUtils.setCurrentMillisSystem();
    toLog("Current time" + DateTimeUtils.currentTimeMillis());
    this.isDone = true;
}

From source file:net.ripe.rpki.commons.FixedDateRule.java

License:BSD License

@Override
public Statement apply(final Statement base, FrameworkMethod method, Object target) {
    return new Statement() {

        @Override//w  ww . jav  a2s .c o m
        public void evaluate() throws Throwable {
            DateTimeUtils.setCurrentMillisFixed(millis);
            try {
                base.evaluate();
            } finally {
                DateTimeUtils.setCurrentMillisSystem();
            }
        }
    };
}

From source file:net.ripe.rpki.commons.FixedDateRule.java

License:BSD License

public static void restoreSystemTime() {
    DateTimeUtils.setCurrentMillisSystem();
}

From source file:no.digipost.util.FreezedTime.java

License:Apache License

@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override/*from  w  ww .java2  s  . c o m*/
        public void evaluate() throws Throwable {
            DateTimeUtils.setCurrentMillisFixed(freezedTime);
            try {
                base.evaluate();
            } finally {
                DateTimeUtils.setCurrentMillisSystem();
            }
        }
    };
}

From source file:org.apache.maven.surefire.sharedutil.MockTime.java

License:Apache License

public static void setCurrentTime() {
    try {//  w  ww.ja v  a2s  .c o  m
        Properties prop = new Properties();
        InputStream fileInput = MockTime.class.getResourceAsStream("/time.properties");

        File altf = new File(System.getProperty("java.io.tmpdir") + "/time.properties");
        if (altf.exists() && !altf.isDirectory()) {
            fileInput = new FileInputStream(altf);
        }

        prop.load(fileInput);
        fileInput.close();
        String value = prop.getProperty("time");
        DateTimeUtils.setCurrentMillisFixed(Long.parseLong(value));
    } catch (Exception e) {
        DateTimeUtils.setCurrentMillisSystem();
    }
}