Package org.apache.aurora.scheduler.testing

Examples of org.apache.aurora.scheduler.testing.FakeScheduledExecutor


  public void testExecution() throws Exception {
    StorageTestUtil storageUtil = new StorageTestUtil(this);
    storageUtil.expectOperations();

    final ScheduledExecutorService executor = createMock(ScheduledExecutorService.class);
    FakeScheduledExecutor executorClock =
        FakeScheduledExecutor.scheduleAtFixedRateExecutor(executor, 2);

    Clock mockClock = createMock(Clock.class);
    expect(mockClock.nowMillis()).andReturn(2L).times(2);

    expect(storageUtil.jobUpdateStore.pruneHistory(1, 1)).andReturn(ImmutableSet.of("id1", "id2"));
    expect(storageUtil.jobUpdateStore.pruneHistory(1, 1)).andReturn(ImmutableSet.<String>of());

    control.replay();

    executorClock.assertEmpty();
    JobUpdateHistoryPruner pruner = new JobUpdateHistoryPruner(
        mockClock,
        executor,
        storageUtil.storage,
        new HistoryPrunerSettings(
            Amount.of(1L, Time.MILLISECONDS),
            Amount.of(1L, Time.MILLISECONDS),
            1));

    pruner.execute();
    executorClock.advance(Amount.of(2L, Time.MILLISECONDS));
    executorClock.advance(Amount.of(1L, Time.MILLISECONDS));
  }
View Full Code Here

TOP

Related Classes of org.apache.aurora.scheduler.testing.FakeScheduledExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.