@Test public void normalizeBadIsolationValues() { assertEquals("Unexpected result for null", TransactionOperationFinalizer.DEFAULT_ISOLATION_LEVEL, TransactionOperationFinalizer.normalizeIsolation(new Operation())); assertEquals("Unexpected negative value result", TransactionOperationFinalizer.DEFAULT_ISOLATION_LEVEL, TransactionOperationFinalizer.normalizeIsolation(new Operation().put("isolation", (-3777347)))); int maxValue = Integer.MIN_VALUE; for (Integer value : TransactionOperationFinalizer.isolationLevels.keySet()) { if (maxValue < value.intValue()) { maxValue = value.intValue(); } } assertEquals("Unexpected beyond max. value result", TransactionOperationFinalizer.DEFAULT_ISOLATION_LEVEL, TransactionOperationFinalizer.normalizeIsolation(new Operation().put("isolation", maxValue + 1))); }
static String normalizeIsolation(Operation operation) { int isolation = operation.getInt("isolation", (-1)); if (isolation < 0) { return DEFAULT_ISOLATION_LEVEL; } String level = isolationLevels.get(Integer.valueOf(isolation)); if (StringUtil.isEmpty(level)) { return DEFAULT_ISOLATION_LEVEL; } else { return level; } }
TransactionOperationFinalizer implements OperationFinalizer { static String normalizeIsolation(Operation operation) { int isolation = operation.getInt("isolation", (-1)); if (isolation < 0) { return DEFAULT_ISOLATION_LEVEL; } String level = isolationLevels.get(Integer.valueOf(isolation)); if (StringUtil.isEmpty(level)) { return DEFAULT_ISOLATION_LEVEL; } else { return level; } } }
TransactionOperationFinalizer implements OperationFinalizer { static String normalizeIsolation(Operation operation) { int isolation = operation.getInt("isolation", (-1)); if (isolation < 0) { return DEFAULT_ISOLATION_LEVEL; } String level = isolationLevels.get(Integer.valueOf(isolation)); if (StringUtil.isEmpty(level)) { return DEFAULT_ISOLATION_LEVEL; } else { return level; } }  }
TransactionOperationFinalizer implements OperationFinalizer { static String normalizeIsolation(Operation operation) { int isolation = operation.getInt("isolation", (-1)); if (isolation < 0) { return DEFAULT_ISOLATION_LEVEL; } String level = isolationLevels.get(Integer.valueOf(isolation)); if (StringUtil.isEmpty(level)) { return DEFAULT_ISOLATION_LEVEL; } else { return level; } }  static void register(Operation operation); void finalize(Operation operation, Map<String, Object> richObjects); }
TransactionOperationFinalizer implements OperationFinalizer { static String normalizeIsolation(Operation operation) { int isolation = operation.getInt("isolation", (-1)); if (isolation < 0) { return DEFAULT_ISOLATION_LEVEL; } String level = isolationLevels.get(Integer.valueOf(isolation)); if (StringUtil.isEmpty(level)) { return DEFAULT_ISOLATION_LEVEL; } else { return level; } }  static void register(Operation operation); void finalize(Operation operation, Map<String, Object> richObjects);  }