use of org.apache.zookeeper.OpResult.ErrorResult in project zookeeper by apache.
the class MultiTransactionTest method opEquals.
private void opEquals(OpResult expected, OpResult value, OpResult near) {
assertEquals(value, value);
assertFalse(value.equals(new Object()));
assertFalse(value.equals(near));
assertFalse(value.equals(value instanceof CreateResult ? new ErrorResult(1) : new CreateResult("nope2")));
assertTrue(value.equals(expected));
}
use of org.apache.zookeeper.OpResult.ErrorResult in project zookeeper by apache.
the class ZooKeeper method validatePath.
private List<OpResult> validatePath(Iterable<Op> ops) {
List<OpResult> results = new ArrayList<OpResult>();
boolean error = false;
for (Op op : ops) {
try {
op.validate();
} catch (IllegalArgumentException iae) {
LOG.error("IllegalArgumentException: " + iae.getMessage());
ErrorResult err = new ErrorResult(KeeperException.Code.BADARGUMENTS.intValue());
results.add(err);
error = true;
continue;
} catch (KeeperException ke) {
LOG.error("KeeperException: " + ke.getMessage());
ErrorResult err = new ErrorResult(ke.code().intValue());
results.add(err);
error = true;
continue;
}
ErrorResult err = new ErrorResult(KeeperException.Code.RUNTIMEINCONSISTENCY.intValue());
results.add(err);
}
if (false == error) {
results.clear();
}
return results;
}
Aggregations