@Test public void checkAndSetIsUpdateIfEqualIfExpectedIsNotNull() { CqlQuery query = CassandraTimestampUtils.constructCheckAndSetMultipleQuery( ImmutableMap.of(COLUMN_NAME_1, Pair.create(VALUE_1, VALUE_2))); assertThat(query.toString()).contains("UPDATE").contains("IF " + CassandraTimestampUtils.VALUE_COLUMN + "="); }
public static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest) { ImmutableCqlSinglePartitionBatchQuery.Builder batchQueryBuilder = CqlSinglePartitionBatchQuery.builder(); checkAndSetRequest.forEach((columnName, value) -> batchQueryBuilder.addIndividualQueryStatements( constructCheckAndSetQuery(columnName, value.getLhSide(), value.getRhSide()))); return batchQueryBuilder.build().toCqlQuery(); }
CassandraTimestampUtils { public static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest) { ImmutableCqlSinglePartitionBatchQuery.Builder batchQueryBuilder = CqlSinglePartitionBatchQuery.builder(); checkAndSetRequest.forEach((columnName, value) -> batchQueryBuilder.addIndividualQueryStatements( constructCheckAndSetQuery(columnName, value.getLhSide(), value.getRhSide()))); return batchQueryBuilder.build().toCqlQuery(); } }
CassandraTimestampUtils { public static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest) { ImmutableCqlSinglePartitionBatchQuery.Builder batchQueryBuilder = CqlSinglePartitionBatchQuery.builder(); checkAndSetRequest.forEach((columnName, value) -> batchQueryBuilder.addIndividualQueryStatements( constructCheckAndSetQuery(columnName, value.getLhSide(), value.getRhSide()))); return batchQueryBuilder.build().toCqlQuery(); } private  CassandraTimestampUtils(); }
CassandraTimestampUtils { public static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest) { ImmutableCqlSinglePartitionBatchQuery.Builder batchQueryBuilder = CqlSinglePartitionBatchQuery.builder(); checkAndSetRequest.forEach((columnName, value) -> batchQueryBuilder.addIndividualQueryStatements( constructCheckAndSetQuery(columnName, value.getLhSide(), value.getRhSide()))); return batchQueryBuilder.build().toCqlQuery(); } private  CassandraTimestampUtils(); static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest); static boolean isValidTimestampData(byte[] data); static CqlQuery constructSelectFromTimestampTableQuery(); static Map<String, byte[]> getValuesFromSelectionResult(CqlResult result); static void verifyCompatible(CqlResult casResult, Map<String, Pair<byte[], byte[]>> casMap); }
CassandraTimestampUtils { public static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest) { ImmutableCqlSinglePartitionBatchQuery.Builder batchQueryBuilder = CqlSinglePartitionBatchQuery.builder(); checkAndSetRequest.forEach((columnName, value) -> batchQueryBuilder.addIndividualQueryStatements( constructCheckAndSetQuery(columnName, value.getLhSide(), value.getRhSide()))); return batchQueryBuilder.build().toCqlQuery(); } private  CassandraTimestampUtils(); static CqlQuery constructCheckAndSetMultipleQuery(Map<String, Pair<byte[], byte[]>> checkAndSetRequest); static boolean isValidTimestampData(byte[] data); static CqlQuery constructSelectFromTimestampTableQuery(); static Map<String, byte[]> getValuesFromSelectionResult(CqlResult result); static void verifyCompatible(CqlResult casResult, Map<String, Pair<byte[], byte[]>> casMap); static final String ROW_AND_COLUMN_NAME; static final String BACKUP_COLUMN_NAME; static final ByteString INVALIDATED_VALUE; static final long INITIAL_VALUE; }