@Test public void truncateTxName() { assertEquals("", TransactionOperationFinalizer.truncateTxName("", 5)); assertEquals("MyTx", TransactionOperationFinalizer.truncateTxName("MyTx", 5)); assertEquals("MyTra", TransactionOperationFinalizer.truncateTxName("MyTra", 5)); assertEquals("My...", TransactionOperationFinalizer.truncateTxName("MyTrans", 5)); assertEquals(".", TransactionOperationFinalizer.truncateTxName("..", 5)); assertEquals(".", TransactionOperationFinalizer.truncateTxName(".", 5)); assertEquals("Foo.Meth...", TransactionOperationFinalizer.truncateTxName("com.my.Foo.MethodName", 11)); assertEquals("Foo.Meth...", TransactionOperationFinalizer.truncateTxName("Foo.MethodName", 11)); assertEquals("Foo.Meth...", TransactionOperationFinalizer.truncateTxName(".Foo.MethodName", 11)); }
static String truncateTxName(String txName, int maxChars) { int packageIdx = StringUtil.indexOfNthCharFromTail(txName, '.', 2); if (packageIdx == -1) { return StringUtil.chopTailAndEllipsify(txName, maxChars); } String chopped = txName.substring(packageIdx + 1); return StringUtil.chopTailAndEllipsify(chopped, maxChars); }
TransactionOperationFinalizer implements OperationFinalizer { static String truncateTxName(String txName, int maxChars) { int packageIdx = StringUtil.indexOfNthCharFromTail(txName, '.', 2); if (packageIdx == -1) { return StringUtil.chopTailAndEllipsify(txName, maxChars); } String chopped = txName.substring(packageIdx + 1); return StringUtil.chopTailAndEllipsify(chopped, maxChars); } }
TransactionOperationFinalizer implements OperationFinalizer { static String truncateTxName(String txName, int maxChars) { int packageIdx = StringUtil.indexOfNthCharFromTail(txName, '.', 2); if (packageIdx == -1) { return StringUtil.chopTailAndEllipsify(txName, maxChars); } String chopped = txName.substring(packageIdx + 1); return StringUtil.chopTailAndEllipsify(chopped, maxChars); }  }
TransactionOperationFinalizer implements OperationFinalizer { static String truncateTxName(String txName, int maxChars) { int packageIdx = StringUtil.indexOfNthCharFromTail(txName, '.', 2); if (packageIdx == -1) { return StringUtil.chopTailAndEllipsify(txName, maxChars); } String chopped = txName.substring(packageIdx + 1); return StringUtil.chopTailAndEllipsify(chopped, maxChars); }  static void register(Operation operation); void finalize(Operation operation, Map<String, Object> richObjects); }
TransactionOperationFinalizer implements OperationFinalizer { static String truncateTxName(String txName, int maxChars) { int packageIdx = StringUtil.indexOfNthCharFromTail(txName, '.', 2); if (packageIdx == -1) { return StringUtil.chopTailAndEllipsify(txName, maxChars); } String chopped = txName.substring(packageIdx + 1); return StringUtil.chopTailAndEllipsify(chopped, maxChars); }  static void register(Operation operation); void finalize(Operation operation, Map<String, Object> richObjects);  }