Examples of FakeClock


Examples of com.twitter.common.util.testing.FakeClock

  }

  @Test(expected = IllegalArgumentException.class)
  public void testInvalidInput() {
    TestFixture f = new TestFixture(NEW, 1);
    ScheduledTask noEvents = new TaskUtil(new FakeClock())
        .makeTask(OLD, RUNNING).newBuilder().setTaskEvents(ImmutableList.<TaskEvent>of());
    f.updater.evaluate(Optional.of(IScheduledTask.build(noEvents)));
  }
View Full Code Here

Examples of com.twitter.common.util.testing.FakeClock

  private SlaModule module;

  @Before
  public void setUp() throws Exception {
    storageUtil = new StorageTestUtil(this);
    clock = new FakeClock();
    statsProvider = createMock(StatsProvider.class);
    module = new SlaModule(Amount.of(5L, Time.MILLISECONDS));
    injector = Guice.createInjector(
        ImmutableList.<Module>builder()
            .add(module)
View Full Code Here

Examples of com.twitter.common.util.testing.FakeClock

    private final InstanceUpdater updater;
    private final TaskUtil taskUtil;
    private Optional<IScheduledTask> task = Optional.absent();

    TestFixture(Optional<ITaskConfig> newConfig, int maxToleratedFailures) {
      this.clock = new FakeClock();
      this.updater = new InstanceUpdater(
          newConfig,
          maxToleratedFailures,
          MIN_RUNNING_TIME,
          MAX_NON_RUNNING_TIME,
View Full Code Here

Examples of com.twitter.common.util.testing.FakeClock

    snapshotStore = createMock(new Clazz<SnapshotStore<Snapshot>>() { });
    distributedStore = createMock(DistributedSnapshotStore.class);
    primaryStorage = createMock(Storage.class);
    storeProvider = createMock(MutableStoreProvider.class);
    shutDownNow = createMock(Command.class);
    clock = new FakeClock();
    TemporaryStorageFactory factory = new TemporaryStorageFactory();
    storageBackup =
        new StorageBackupImpl(snapshotStore, clock, new BackupConfig(backupDir, 5, INTERVAL));
    recovery = new RecoveryImpl(backupDir, factory, primaryStorage, distributedStore, shutDownNow);
  }
View Full Code Here

Examples of com.twitter.common.util.testing.FakeClock

  private StorageBackupImpl storageBackup;

  @Before
  public void setUp() {
    delegate = createMock(new Clazz<SnapshotStore<Snapshot>>() { });
    clock = new FakeClock();
    final File backupDir = Files.createTempDir();
    addTearDown(new TearDown() {
      @Override
      public void tearDown() throws Exception {
        org.apache.commons.io.FileUtils.deleteDirectory(backupDir);
View Full Code Here

Examples of org.apache.hadoop.mapred.UtilsForTests.FakeClock

    conf.setBoolean("mapred.fairscheduler.assignmultiple", assignMultiple);
    // Manually set locality delay because we aren't using a JobTracker so
    // we can't auto-compute it from the heartbeat interval.
    conf.setLong("mapred.fairscheduler.locality.delay", 10000);
    taskTrackerManager = new FakeTaskTrackerManager(numRacks, numNodesPerRack);
    clock = new FakeClock();
    scheduler = new FairScheduler(clock, true);
    scheduler.waitForMapsBeforeLaunchingReduces = false;
    scheduler.setConf(conf);
    scheduler.setTaskTrackerManager(taskTrackerManager);
    scheduler.start();
View Full Code Here

Examples of org.apache.hadoop.mapred.UtilsForTests.FakeClock

        logRetainHours);
    userLogManager.addLogEvent(jce);
  }

  private void startTT(Configuration conf) throws IOException {
    myClock = new FakeClock(); // clock is reset.
    tt = new TaskTracker();
    tt.setConf(new JobConf(conf));
    localizer = new Localizer(FileSystem.get(conf), conf
        .getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY),
        new DefaultTaskController());
View Full Code Here

Examples of org.apache.hadoop.mapred.UtilsForTests.FakeClock

    fileWriter.close();
    conf = new JobConf();
    conf.set("mapred.fairscheduler.allocation.file", ALLOC_FILE);
    conf.set("mapred.fairscheduler.poolnameproperty", POOL_PROPERTY);
    taskTrackerManager = new FakeTaskTrackerManager();
    clock = new FakeClock();
    scheduler = new FairScheduler(clock, false);
    scheduler.waitForMapsBeforeLaunchingReduces = false;
    scheduler.setConf(conf);
    scheduler.setTaskTrackerManager(taskTrackerManager);
    scheduler.start();
View Full Code Here

Examples of org.apache.hadoop.mapred.UtilsForTests.FakeClock

        logRetainHours);
    userLogManager.addLogEvent(jce);
  }

  private void startTT(JobConf conf) throws IOException, InterruptedException {
    myClock = new FakeClock(); // clock is reset.
    String localdirs = TEST_ROOT_DIR + "/userlogs/local/0," +
              TEST_ROOT_DIR + "/userlogs/local/1";
    conf.set(JobConf.MAPRED_LOCAL_DIR_PROPERTY, localdirs);
    tt = new TaskTracker();
    tt.setConf(new JobConf(conf));
View Full Code Here

Examples of org.apache.hadoop.mapred.UtilsForTests.FakeClock

    conf.setLong("mapred.fairscheduler.locality.delay.node", 5000);
    conf.setLong("mapred.fairscheduler.locality.delay.rack", 10000);
    conf.set("mapred.job.tracker", "localhost:0");
    conf.set("mapred.job.tracker.http.address", "0.0.0.0:0");
    taskTrackerManager = new FakeTaskTrackerManager(numRacks, numNodesPerRack);
    clock = new FakeClock();
    try {
      jobTracker = new JobTracker(conf, clock);
      jobTracker.setSafeModeInternal(JobTracker.SafeModeAction.SAFEMODE_ENTER);
      jobTracker.initializeFilesystem();
      jobTracker.setSafeModeInternal(JobTracker.SafeModeAction.SAFEMODE_LEAVE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.