@Test
public void test_addBranchSession() throws Exception {

    GlobalSession globalSession = GlobalSession.createGlobalSession("test",
            "test", "test123", 100);
    String xid = XID.generateXID(globalSession.getTransactionId());
    globalSession.setXid(xid);
    globalSession.setTransactionId(146757978);
    globalSession.setBeginTime(System.currentTimeMillis());
    globalSession.setApplicationData("abc=878s");
    globalSession.setStatus(GlobalStatus.Begin);
    BranchSession branchSession = new BranchSession();
    branchSession.setBranchId(UUIDGenerator.generateUUID());
    branchSession.setXid(xid);
    branchSession.setTransactionId(globalSession.getTransactionId());
    branchSession.setBranchId(1L);
    branchSession.setResourceGroupId("my_test_tx_group");
    branchSession.setResourceId("tb_1");
    branchSession.setLockKey("t_1");
    branchSession.setBranchType(BranchType.AT);
    branchSession.setApplicationData("{\"data\":\"test\"}");
    sessionManager.addBranchSession(globalSession, branchSession);
    String sql = "select * from branch_table where xid= '"+xid+"'";
    String delSql = "delete from branch_table where xid= '"+xid+"'" + ";" + "delete from global_table where xid= '"+xid+"'";
    Connection conn = null;
    try{
        conn = dataSource.getConnection();
        ResultSet rs = conn.createStatement().executeQuery(sql);
        if(rs.next()){
            Assertions.assertTrue(true);
        }else{
            Assertions.assertTrue(false);
        }
        conn.createStatement().execute(delSql);
    }finally {
        if(conn != null){
            conn.close();
        }
    }
}