@Test public void lockDescriptorWithOneZeroReturnsCorrectTableAndRemainder() { LockDescriptor descriptor = AtlasRowLockDescriptor.of(TABLE.getQualifiedName(), NO_ZERO_ROW); assertThat(AtlasLockDescriptorUtils.tryParseTableRef(descriptor)) .hasValue(ImmutableTableRefAndRemainder.of(TABLE, ByteString.of(NO_ZERO_ROW))); }
public static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor) { byte[] rawBytes = lockDescriptor.getBytes(); int endOfTableName = Bytes.indexOf(rawBytes, (byte) 0); if (endOfTableName == -1) { return Optional.empty(); } String fullyQualifiedName = new String(rawBytes, 0, endOfTableName); TableReference tableRef = TableReference.createFromFullyQualifiedName(fullyQualifiedName); ByteString remainingBytes = ByteString.of(rawBytes, endOfTableName + 1, rawBytes.length - (endOfTableName + 1)); return Optional.of(ImmutableTableRefAndRemainder.of(tableRef, remainingBytes)); }
AtlasLockDescriptorUtils { public static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor) { byte[] rawBytes = lockDescriptor.getBytes(); int endOfTableName = Bytes.indexOf(rawBytes, (byte) 0); if (endOfTableName == -1) { return Optional.empty(); } String fullyQualifiedName = new String(rawBytes, 0, endOfTableName); TableReference tableRef = TableReference.createFromFullyQualifiedName(fullyQualifiedName); ByteString remainingBytes = ByteString.of(rawBytes, endOfTableName + 1, rawBytes.length - (endOfTableName + 1)); return Optional.of(ImmutableTableRefAndRemainder.of(tableRef, remainingBytes)); } }
AtlasLockDescriptorUtils { public static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor) { byte[] rawBytes = lockDescriptor.getBytes(); int endOfTableName = Bytes.indexOf(rawBytes, (byte) 0); if (endOfTableName == -1) { return Optional.empty(); } String fullyQualifiedName = new String(rawBytes, 0, endOfTableName); TableReference tableRef = TableReference.createFromFullyQualifiedName(fullyQualifiedName); ByteString remainingBytes = ByteString.of(rawBytes, endOfTableName + 1, rawBytes.length - (endOfTableName + 1)); return Optional.of(ImmutableTableRefAndRemainder.of(tableRef, remainingBytes)); } private  AtlasLockDescriptorUtils(); }
AtlasLockDescriptorUtils { public static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor) { byte[] rawBytes = lockDescriptor.getBytes(); int endOfTableName = Bytes.indexOf(rawBytes, (byte) 0); if (endOfTableName == -1) { return Optional.empty(); } String fullyQualifiedName = new String(rawBytes, 0, endOfTableName); TableReference tableRef = TableReference.createFromFullyQualifiedName(fullyQualifiedName); ByteString remainingBytes = ByteString.of(rawBytes, endOfTableName + 1, rawBytes.length - (endOfTableName + 1)); return Optional.of(ImmutableTableRefAndRemainder.of(tableRef, remainingBytes)); } private  AtlasLockDescriptorUtils(); static List<CellReference> candidateCells(LockDescriptor lockDescriptor); static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor); }
AtlasLockDescriptorUtils { public static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor) { byte[] rawBytes = lockDescriptor.getBytes(); int endOfTableName = Bytes.indexOf(rawBytes, (byte) 0); if (endOfTableName == -1) { return Optional.empty(); } String fullyQualifiedName = new String(rawBytes, 0, endOfTableName); TableReference tableRef = TableReference.createFromFullyQualifiedName(fullyQualifiedName); ByteString remainingBytes = ByteString.of(rawBytes, endOfTableName + 1, rawBytes.length - (endOfTableName + 1)); return Optional.of(ImmutableTableRefAndRemainder.of(tableRef, remainingBytes)); } private  AtlasLockDescriptorUtils(); static List<CellReference> candidateCells(LockDescriptor lockDescriptor); static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor);  }