Search in sources :

Example 1 with ExtendedOsStats

use of io.crate.monitor.ExtendedOsStats in project crate by crate.

the class NodeOsExpressionTest method testOsTimestampNotEvaluatedTwice.

@Test
public void testOsTimestampNotEvaluatedTwice() throws Exception {
    ExtendedOsStats osStats = mock(ExtendedOsStats.class);
    NodeOsExpression nodeOsExpression = new NodeOsExpression(osStats);
    ReferenceImplementation timestampExpr = nodeOsExpression.getChildImplementation("timestamp");
    Long ts1 = (Long) timestampExpr.value();
    Thread.sleep(10L);
    Long ts2 = (Long) timestampExpr.value();
    assertEquals(ts1, ts2);
}
Also used : ExtendedOsStats(io.crate.monitor.ExtendedOsStats) ReferenceImplementation(io.crate.metadata.ReferenceImplementation) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

ReferenceImplementation (io.crate.metadata.ReferenceImplementation)1 ExtendedOsStats (io.crate.monitor.ExtendedOsStats)1 CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 Test (org.junit.Test)1