Java 类org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos 实例源码

项目:hadoop    文件:TestDataTransferProtocol.java   
@Test
public void TestPipeLineAckCompatibility() throws IOException {
  DataTransferProtos.PipelineAckProto proto = DataTransferProtos
      .PipelineAckProto.newBuilder()
      .setSeqno(0)
      .addReply(Status.CHECKSUM_OK)
      .build();

  DataTransferProtos.PipelineAckProto newProto = DataTransferProtos
      .PipelineAckProto.newBuilder().mergeFrom(proto)
      .addFlag(PipelineAck.combineHeader(PipelineAck.ECN.SUPPORTED,
                                         Status.CHECKSUM_OK))
      .build();

  ByteArrayOutputStream oldAckBytes = new ByteArrayOutputStream();
  proto.writeDelimitedTo(oldAckBytes);
  PipelineAck oldAck = new PipelineAck();
  oldAck.readFields(new ByteArrayInputStream(oldAckBytes.toByteArray()));
  assertEquals(
      PipelineAck.combineHeader(PipelineAck.ECN.DISABLED, Status.CHECKSUM_OK),
      oldAck.getHeaderFlag(0));

  PipelineAck newAck = new PipelineAck();
  ByteArrayOutputStream newAckBytes = new ByteArrayOutputStream();
  newProto.writeDelimitedTo(newAckBytes);
  newAck.readFields(new ByteArrayInputStream(newAckBytes.toByteArray()));
  assertEquals(PipelineAck.combineHeader(PipelineAck.ECN.SUPPORTED,
                                         Status.CHECKSUM_OK),
               newAck.getHeaderFlag(0));
}
项目:aliyun-oss-hadoop-fs    文件:TestDataTransferProtocol.java   
@Test
public void TestPipeLineAckCompatibility() throws IOException {
  DataTransferProtos.PipelineAckProto proto = DataTransferProtos
      .PipelineAckProto.newBuilder()
      .setSeqno(0)
      .addReply(Status.CHECKSUM_OK)
      .build();

  DataTransferProtos.PipelineAckProto newProto = DataTransferProtos
      .PipelineAckProto.newBuilder().mergeFrom(proto)
      .addFlag(PipelineAck.combineHeader(PipelineAck.ECN.SUPPORTED,
                                         Status.CHECKSUM_OK))
      .build();

  ByteArrayOutputStream oldAckBytes = new ByteArrayOutputStream();
  proto.writeDelimitedTo(oldAckBytes);
  PipelineAck oldAck = new PipelineAck();
  oldAck.readFields(new ByteArrayInputStream(oldAckBytes.toByteArray()));
  assertEquals(PipelineAck.combineHeader(PipelineAck.ECN.DISABLED, Status
      .CHECKSUM_OK), oldAck.getHeaderFlag(0));

  PipelineAck newAck = new PipelineAck();
  ByteArrayOutputStream newAckBytes = new ByteArrayOutputStream();
  newProto.writeDelimitedTo(newAckBytes);
  newAck.readFields(new ByteArrayInputStream(newAckBytes.toByteArray()));
  assertEquals(PipelineAck.combineHeader(PipelineAck.ECN.SUPPORTED, Status
      .CHECKSUM_OK), newAck.getHeaderFlag(0));
}
项目:big-c    文件:TestDataTransferProtocol.java   
@Test
public void TestPipeLineAckCompatibility() throws IOException {
  DataTransferProtos.PipelineAckProto proto = DataTransferProtos
      .PipelineAckProto.newBuilder()
      .setSeqno(0)
      .addReply(Status.CHECKSUM_OK)
      .build();

  DataTransferProtos.PipelineAckProto newProto = DataTransferProtos
      .PipelineAckProto.newBuilder().mergeFrom(proto)
      .addFlag(PipelineAck.combineHeader(PipelineAck.ECN.SUPPORTED,
                                         Status.CHECKSUM_OK))
      .build();

  ByteArrayOutputStream oldAckBytes = new ByteArrayOutputStream();
  proto.writeDelimitedTo(oldAckBytes);
  PipelineAck oldAck = new PipelineAck();
  oldAck.readFields(new ByteArrayInputStream(oldAckBytes.toByteArray()));
  assertEquals(
      PipelineAck.combineHeader(PipelineAck.ECN.DISABLED, Status.CHECKSUM_OK),
      oldAck.getHeaderFlag(0));

  PipelineAck newAck = new PipelineAck();
  ByteArrayOutputStream newAckBytes = new ByteArrayOutputStream();
  newProto.writeDelimitedTo(newAckBytes);
  newAck.readFields(new ByteArrayInputStream(newAckBytes.toByteArray()));
  assertEquals(PipelineAck.combineHeader(PipelineAck.ECN.SUPPORTED,
                                         Status.CHECKSUM_OK),
               newAck.getHeaderFlag(0));
}
项目:hadoop-plus    文件:PipelineAck.java   
/**
 * Check if this ack contains error status
 * @return true if all statuses are SUCCESS
 */
public boolean isSuccess() {
  for (DataTransferProtos.Status reply : proto.getStatusList()) {
    if (reply != DataTransferProtos.Status.SUCCESS) {
      return false;
    }
  }
  return true;
}
项目:hops    文件:PipelineAck.java   
/**
 * Check if this ack contains error status
 *
 * @return true if all statuses are SUCCESS
 */
public boolean isSuccess() {
  for (DataTransferProtos.Status reply : proto.getStatusList()) {
    if (reply != DataTransferProtos.Status.SUCCESS) {
      return false;
    }
  }
  return true;
}
项目:hadoop-TCP    文件:PipelineAck.java   
/**
 * Check if this ack contains error status
 * @return true if all statuses are SUCCESS
 */
public boolean isSuccess() {
  for (DataTransferProtos.Status reply : proto.getStatusList()) {
    if (reply != DataTransferProtos.Status.SUCCESS) {
      return false;
    }
  }
  return true;
}
项目:hardfs    文件:PipelineAck.java   
/**
 * Check if this ack contains error status
 * @return true if all statuses are SUCCESS
 */
public boolean isSuccess() {
  for (DataTransferProtos.Status reply : proto.getStatusList()) {
    if (reply != DataTransferProtos.Status.SUCCESS) {
      return false;
    }
  }
  return true;
}