Java 类org.apache.hadoop.hbase.util.PrettyPrinter 实例源码

项目:hbase    文件:TestColumnFamilyDescriptorBuilder.java   
@Test
public void testMobValuesInHColumnDescriptorShouldReadable() {
  boolean isMob = true;
  long threshold = 1000;
  String policy = "weekly";
  // We unify the format of all values saved in the descriptor.
  // Each value is stored as bytes of string.
  String isMobString = PrettyPrinter.format(String.valueOf(isMob),
          HColumnDescriptor.getUnit(HColumnDescriptor.IS_MOB));
  String thresholdString = PrettyPrinter.format(String.valueOf(threshold),
          HColumnDescriptor.getUnit(HColumnDescriptor.MOB_THRESHOLD));
  String policyString = PrettyPrinter.format(Bytes.toStringBinary(Bytes.toBytes(policy)),
      HColumnDescriptor.getUnit(HColumnDescriptor.MOB_COMPACT_PARTITION_POLICY));
  assertEquals(String.valueOf(isMob), isMobString);
  assertEquals(String.valueOf(threshold), thresholdString);
  assertEquals(String.valueOf(policy), policyString);
}
项目:hbase    文件:TestHColumnDescriptor.java   
@Test
public void testMobValuesInHColumnDescriptorShouldReadable() {
  boolean isMob = true;
  long threshold = 1000;
  String policy = "weekly";
  // We unify the format of all values saved in the descriptor.
  // Each value is stored as bytes of string.
  String isMobString = PrettyPrinter.format(String.valueOf(isMob),
          HColumnDescriptor.getUnit(HColumnDescriptor.IS_MOB));
  String thresholdString = PrettyPrinter.format(String.valueOf(threshold),
          HColumnDescriptor.getUnit(HColumnDescriptor.MOB_THRESHOLD));
  String policyString = PrettyPrinter.format(Bytes.toStringBinary(Bytes.toBytes(policy)),
      HColumnDescriptor.getUnit(HColumnDescriptor.MOB_COMPACT_PARTITION_POLICY));
  assertEquals(String.valueOf(isMob), isMobString);
  assertEquals(String.valueOf(threshold), thresholdString);
  assertEquals(String.valueOf(policy), policyString);
}
项目:hbase    文件:ColumnFamilyDescriptorBuilder.java   
/**
 * @param timeToLive Time-to-live of cell contents, in seconds.
 * @return this (for chained invocation)
 * @throws org.apache.hadoop.hbase.exceptions.HBaseException
 */
public ModifyableColumnFamilyDescriptor setTimeToLive(String timeToLive) throws HBaseException {
  return setTimeToLive(Integer.parseInt(PrettyPrinter.valueOf(timeToLive, Unit.TIME_INTERVAL)));
}