DefaultCore implements Core { @Override public String begin(String applicationId, String transactionServiceGroup, String name, int timeout) throws TransactionException { GlobalSession session = GlobalSession.createGlobalSession( applicationId, transactionServiceGroup, name, timeout); session.addSessionLifecycleListener(SessionHolder.getRootSessionManager()); session.begin(); eventBus.post(new GlobalTransactionEvent(session.getTransactionId(), GlobalTransactionEvent.ROLE_TC, session.getTransactionName(), session.getBeginTime(), null, session.getStatus())); LOGGER.info("Successfully begin global transaction xid = {}", session.getXid()); return session.getXid(); }  @Override void setResourceManagerInbound(ResourceManagerInbound resourceManagerInbound); @Override Long branchRegister(BranchType branchType, String resourceId, String clientId, String xid,
                               String applicationData, String lockKeys); @Override void branchReport(BranchType branchType, String xid, long branchId, BranchStatus status,
                             String applicationData); @Override boolean lockQuery(BranchType branchType, String resourceId, String xid, String lockKeys); @Override String begin(String applicationId, String transactionServiceGroup, String name, int timeout); @Override GlobalStatus commit(String xid); @Override void doGlobalCommit(GlobalSession globalSession, boolean retrying); @Override GlobalStatus rollback(String xid); @Override void doGlobalRollback(GlobalSession globalSession, boolean retrying); @Override GlobalStatus getStatus(String xid);  }
@Test public void beginTest() throws Exception { String xid = core.begin(applicationId, txServiceGroup, txName, timeout); globalSession = SessionHolder.findGlobalSession(xid); Assertions.assertNotNull(globalSession); }