private MasterTxIdGenerator newGenerator(
      int slaveCount, int replication, SlavePriority slavePriority, boolean... failingSlaves)
      throws Exception {
    slaves = instantiateSlaves(slaveCount, failingSlaves);
    dataSource = new FakeDataSource();

    log = new FakeStringLogger();
    Config config =
        new Config(MapUtil.stringMap(HaSettings.tx_push_factor.name(), "" + replication));
    Neo4jJobScheduler scheduler = new Neo4jJobScheduler();
    MasterTxIdGenerator result =
        new MasterTxIdGenerator(
            MasterTxIdGenerator.from(config, slavePriority),
            log,
            new Slaves() {
              @Override
              public Iterable<Slave> getSlaves() {
                return slaves;
              }
            },
            new CommitPusher(scheduler));
    // Life
    try {
      scheduler.init();
      scheduler.start();

      result.init();
      result.start();
    } catch (Throwable e) {
      throw Exceptions.launderedException(e);
    }
    return result;
  }