@Test public void testConstraint() { Mutation m1 = new Mutation("r1"); m1.putDelete("f1", "q1"); NoDeleteConstraint ndc = new NoDeleteConstraint(); List<Short> results = ndc.check(null, m1); assertEquals(1, results.size()); assertEquals(1, results.get(0).intValue()); Mutation m2 = new Mutation("r1"); m2.put("f1", "q1", new Value("v1")); results = ndc.check(null, m2); assertNull(results); }
@Override public List<Short> check(Environment env, Mutation mutation) { List<ColumnUpdate> updates = mutation.getUpdates(); for (ColumnUpdate update : updates) { if (update.isDeleted()) { return Collections.singletonList((short) 1); } } return null; }
NoDeleteConstraint implements Constraint { @Override public List<Short> check(Environment env, Mutation mutation) { List<ColumnUpdate> updates = mutation.getUpdates(); for (ColumnUpdate update : updates) { if (update.isDeleted()) { return Collections.singletonList((short) 1); } } return null; } }
NoDeleteConstraint implements Constraint { @Override public List<Short> check(Environment env, Mutation mutation) { List<ColumnUpdate> updates = mutation.getUpdates(); for (ColumnUpdate update : updates) { if (update.isDeleted()) { return Collections.singletonList((short) 1); } } return null; }  }
NoDeleteConstraint implements Constraint { @Override public List<Short> check(Environment env, Mutation mutation) { List<ColumnUpdate> updates = mutation.getUpdates(); for (ColumnUpdate update : updates) { if (update.isDeleted()) { return Collections.singletonList((short) 1); } } return null; }  @Override String getViolationDescription(short violationCode); @Override List<Short> check(Environment env, Mutation mutation); }
NoDeleteConstraint implements Constraint { @Override public List<Short> check(Environment env, Mutation mutation) { List<ColumnUpdate> updates = mutation.getUpdates(); for (ColumnUpdate update : updates) { if (update.isDeleted()) { return Collections.singletonList((short) 1); } } return null; }  @Override String getViolationDescription(short violationCode); @Override List<Short> check(Environment env, Mutation mutation);  }