LogStoreDataBaseDAO implements LogStore, Initialize { @Override public boolean deleteGlobalTransactionDO(GlobalTransactionDO globalTransactionDO) { String sql = LogStoreSqls.getDeleteGlobalTransactionSQL(globalTable, dbType); Connection conn = null; PreparedStatement ps = null; try { conn = logStoreDataSource.getConnection(); conn.setAutoCommit(true); ps = conn.prepareStatement(sql); ps.setString(1, globalTransactionDO.getXid()); return ps.executeUpdate() > 0; } catch (SQLException e) { throw new StoreException(e); } finally { if (ps != null) { try { ps.close(); } catch (SQLException e) { } } if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } } LogStoreDataBaseDAO();  LogStoreDataBaseDAO(DataSource logStoreDataSource); @Override void init(); @Override GlobalTransactionDO queryGlobalTransactionDO(String xid); @Override GlobalTransactionDO queryGlobalTransactionDO(long transactionId); @Override List<GlobalTransactionDO> queryGlobalTransactionDO(int[] statuses, int limit); @Override boolean insertGlobalTransactionDO(GlobalTransactionDO globalTransactionDO); @Override boolean updateGlobalTransactionDO(GlobalTransactionDO globalTransactionDO); @Override boolean deleteGlobalTransactionDO(GlobalTransactionDO globalTransactionDO); @Override List<BranchTransactionDO> queryBranchTransactionDO(String xid); @Override boolean insertBranchTransactionDO(BranchTransactionDO branchTransactionDO); @Override boolean updateBranchTransactionDO(BranchTransactionDO branchTransactionDO); @Override boolean deleteBranchTransactionDO(BranchTransactionDO branchTransactionDO); void initTransactionNameSize(); void setLogStoreDataSource(DataSource logStoreDataSource); void setGlobalTable(String globalTable); void setBrachTable(String brachTable); void setDbType(String dbType); int getTransactionNameColumnSize();  }
@Test public void deleteGlobalTransactionDO() throws SQLException { GlobalTransactionDO globalTransactionDO = new GlobalTransactionDO(); globalTransactionDO.setXid("abc-123:555"); globalTransactionDO.setApplicationData("abc=5454"); globalTransactionDO.setTransactionServiceGroup("abc"); globalTransactionDO.setTransactionName("test"); globalTransactionDO.setTransactionId(12345); globalTransactionDO.setTimeout(20); globalTransactionDO.setBeginTime(System.currentTimeMillis()); globalTransactionDO.setApplicationId("test"); globalTransactionDO.setStatus(1); boolean ret = logStoreDataBaseDAO.insertGlobalTransactionDO(globalTransactionDO); Assertions.assertTrue(ret); Assertions.assertTrue(logStoreDataBaseDAO.deleteGlobalTransactionDO(globalTransactionDO)); String sql = "select * from global_table where xid= 'abc-123:555'"; Connection conn = null; try{ conn = dataSource.getConnection(); ResultSet rs = conn.createStatement().executeQuery(sql); if(rs.next()){ Assertions.assertTrue(false); }else{ Assertions.assertTrue(true); } rs.close(); }finally { if(conn != null){ conn.close(); } } }