@Test public void testRollBackOn() { TransactionInfo txInfo = new TransactionInfo(); assertThat(txInfo.rollbackOn(new IllegalArgumentException())).isTrue(); assertThat(txInfo.rollbackOn(new Exception())).isTrue(); assertThat(txInfo.rollbackOn(new IOException())).isTrue(); assertThat(txInfo.rollbackOn(new NullPointerException())).isTrue(); Set<RollbackRule> sets = getRollbackRules(); txInfo.setRollbackRules(sets); assertThat(txInfo.rollbackOn(new IllegalArgumentException())).isTrue(); assertThat(txInfo.rollbackOn(new Exception())).isTrue(); assertThat(txInfo.rollbackOn(new IOException())).isFalse(); assertThat(txInfo.rollbackOn(new NullPointerException())).isFalse(); assertThat(txInfo.rollbackOn(new RuntimeException())).isTrue(); }
public boolean rollbackOn(Throwable ex) { RollbackRule winner = null; int deepest = Integer.MAX_VALUE; if (this.rollbackRules != null) { for (RollbackRule rule : this.rollbackRules) { int depth = rule.getDepth(ex); if (depth >= 0 && depth < deepest) { deepest = depth; winner = rule; } } } return winner == null || !(winner instanceof NoRollbackRule); }
TransactionInfo implements Serializable { public boolean rollbackOn(Throwable ex) { RollbackRule winner = null; int deepest = Integer.MAX_VALUE; if (this.rollbackRules != null) { for (RollbackRule rule : this.rollbackRules) { int depth = rule.getDepth(ex); if (depth >= 0 && depth < deepest) { deepest = depth; winner = rule; } } } return winner == null || !(winner instanceof NoRollbackRule); } }
TransactionInfo implements Serializable { public boolean rollbackOn(Throwable ex) { RollbackRule winner = null; int deepest = Integer.MAX_VALUE; if (this.rollbackRules != null) { for (RollbackRule rule : this.rollbackRules) { int depth = rule.getDepth(ex); if (depth >= 0 && depth < deepest) { deepest = depth; winner = rule; } } } return winner == null || !(winner instanceof NoRollbackRule); }  }
TransactionInfo implements Serializable { public boolean rollbackOn(Throwable ex) { RollbackRule winner = null; int deepest = Integer.MAX_VALUE; if (this.rollbackRules != null) { for (RollbackRule rule : this.rollbackRules) { int depth = rule.getDepth(ex); if (depth >= 0 && depth < deepest) { deepest = depth; winner = rule; } } } return winner == null || !(winner instanceof NoRollbackRule); }  int getTimeOut(); void setTimeOut(int timeOut); String getName(); void setName(String name); Set<RollbackRule> getRollbackRules(); void setRollbackRules(Set<RollbackRule> rollbackRules); boolean rollbackOn(Throwable ex); }
TransactionInfo implements Serializable { public boolean rollbackOn(Throwable ex) { RollbackRule winner = null; int deepest = Integer.MAX_VALUE; if (this.rollbackRules != null) { for (RollbackRule rule : this.rollbackRules) { int depth = rule.getDepth(ex); if (depth >= 0 && depth < deepest) { deepest = depth; winner = rule; } } } return winner == null || !(winner instanceof NoRollbackRule); }  int getTimeOut(); void setTimeOut(int timeOut); String getName(); void setName(String name); Set<RollbackRule> getRollbackRules(); void setRollbackRules(Set<RollbackRule> rollbackRules); boolean rollbackOn(Throwable ex); static final int DEFAULT_TIME_OUT; }