@Test public void testGetNullKey() throws Exception { Row row = new Row( TABLE, ImmutableMap.of(ID_COLUMN, new Column(TABLE.getColumns().get(ID_COLUMN), null))); MysqlMutation mutation = new MysqlInsertMutation(MUTATION_METADATA, row); assertEquals("test:users:null", MysqlKeyProvider.INSTANCE.get(mutation)); }
@Override public String get(@NonNull final Mutation<?> mutation) { Preconditions.checkState(mutation instanceof MysqlMutation); final MysqlMutation mysqlMutation = (MysqlMutation) mutation; final Table table = mysqlMutation.getMetadata().getTable(); final Row row = mysqlMutation.getRow(); return String.format( "%s:%s:%s", table.getDatabase(), table.getName(), row.getPrimaryKeyValue()); }
MysqlKeyProvider implements KeyProvider<Mutation<?>, String> { @Override public String get(@NonNull final Mutation<?> mutation) { Preconditions.checkState(mutation instanceof MysqlMutation); final MysqlMutation mysqlMutation = (MysqlMutation) mutation; final Table table = mysqlMutation.getMetadata().getTable(); final Row row = mysqlMutation.getRow(); return String.format( "%s:%s:%s", table.getDatabase(), table.getName(), row.getPrimaryKeyValue()); } }
MysqlKeyProvider implements KeyProvider<Mutation<?>, String> { @Override public String get(@NonNull final Mutation<?> mutation) { Preconditions.checkState(mutation instanceof MysqlMutation); final MysqlMutation mysqlMutation = (MysqlMutation) mutation; final Table table = mysqlMutation.getMetadata().getTable(); final Row row = mysqlMutation.getRow(); return String.format( "%s:%s:%s", table.getDatabase(), table.getName(), row.getPrimaryKeyValue()); }  }
MysqlKeyProvider implements KeyProvider<Mutation<?>, String> { @Override public String get(@NonNull final Mutation<?> mutation) { Preconditions.checkState(mutation instanceof MysqlMutation); final MysqlMutation mysqlMutation = (MysqlMutation) mutation; final Table table = mysqlMutation.getMetadata().getTable(); final Row row = mysqlMutation.getRow(); return String.format( "%s:%s:%s", table.getDatabase(), table.getName(), row.getPrimaryKeyValue()); }  @Override String get(@NonNull final Mutation<?> mutation); }
MysqlKeyProvider implements KeyProvider<Mutation<?>, String> { @Override public String get(@NonNull final Mutation<?> mutation) { Preconditions.checkState(mutation instanceof MysqlMutation); final MysqlMutation mysqlMutation = (MysqlMutation) mutation; final Table table = mysqlMutation.getMetadata().getTable(); final Row row = mysqlMutation.getRow(); return String.format( "%s:%s:%s", table.getDatabase(), table.getName(), row.getPrimaryKeyValue()); }  @Override String get(@NonNull final Mutation<?> mutation); static final MysqlKeyProvider INSTANCE; }