Java 类org.apache.hadoop.hdfs.qjournal.client.AsyncLogger 实例源码

项目:hadoop    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:hadoop    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:aliyun-oss-hadoop-fs    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:aliyun-oss-hadoop-fs    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:big-c    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:big-c    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hadoop-EAR    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(conf, nsInfo,
      journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f)).when(spy)
      .getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f)).when(spy)
      .newEpoch(Mockito.anyLong());

  return spy;
}
项目:hadoop-EAR    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"),
      FAKE_NSINFO, null, false) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    GetJournalStateResponseProto p = new GetJournalStateResponseProto();
    p.setLastPromisedEpoch(0);
    p.setHttpPort(-1);
    futureReturns(p)
      .when(logger).getJournalState();

    futureReturns(
        new NewEpochResponseProto()
        ).when(logger).newEpoch(Mockito.anyLong());

    StartupOption startOpt = null;
    futureReturns(null).when(logger).transitionJournal(
        Mockito.<NamespaceInfo> any(), Mockito.eq(Transition.FORMAT),
        Mockito.eq(startOpt));
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hadoop-plus    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:hadoop-plus    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:FlexMap    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:FlexMap    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hadoop-TCP    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:hadoop-TCP    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hardfs    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:hardfs    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hadoop-on-lustre2    文件:TestEpochsAreUnique.java   
@Override
public AsyncLogger createLogger(Configuration conf, NamespaceInfo nsInfo,
    String journalId, InetSocketAddress addr) {
  AsyncLogger ch = IPCLoggerChannel.FACTORY.createLogger(
      conf, nsInfo, journalId, addr);
  AsyncLogger spy = Mockito.spy(ch);
  Mockito.doAnswer(new SometimesFaulty<Long>(0.10f))
      .when(spy).getJournalState();
  Mockito.doAnswer(new SometimesFaulty<Void>(0.40f))
      .when(spy).newEpoch(Mockito.anyLong());

  return spy;
}
项目:hadoop-on-lustre2    文件:TestQuorumJournalManagerUnit.java   
@Before
public void setup() throws Exception {
  spyLoggers = ImmutableList.of(
      mockLogger(),
      mockLogger(),
      mockLogger());

  qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
    @Override
    protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
      return spyLoggers;
    }
  };

  for (AsyncLogger logger : spyLoggers) {
    futureReturns(GetJournalStateResponseProto.newBuilder()
        .setLastPromisedEpoch(0)
        .setHttpPort(-1)
        .build())
      .when(logger).getJournalState();

    futureReturns(
        NewEpochResponseProto.newBuilder().build()
        ).when(logger).newEpoch(Mockito.anyLong());

    futureReturns(null).when(logger).format(Mockito.<NamespaceInfo>any());
  }

  qjm.recoverUnfinalizedSegments();
}
项目:hadoop    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:aliyun-oss-hadoop-fs    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:big-c    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:hadoop-EAR    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:hadoop-plus    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:FlexMap    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:hadoop-TCP    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:hardfs    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}
项目:hadoop-on-lustre2    文件:TestQuorumJournalManagerUnit.java   
private AsyncLogger mockLogger() {
  return Mockito.mock(AsyncLogger.class);
}