Search in sources :

Example 1 with ResourceManagerXA

use of io.seata.rm.datasource.xa.ResourceManagerXA in project seata by seata.

the class XAModeTest2 method initRM.

private void initRM() throws Throwable {
    // init RM
    DefaultResourceManager.get();
    // mock the RM of XA
    DefaultResourceManager.mockResourceManager(BranchType.XA, new ResourceManagerXA() {

        @Override
        public void registerResource(Resource resource) {
            dataSourceCache.put(resource.getResourceId(), resource);
        }

        @Override
        public Long branchRegister(BranchType branchType, String resourceId, String clientId, String xid, String applicationData, String lockKeys) throws TransactionException {
            return mockBranchId;
        }

        @Override
        public void branchReport(BranchType branchType, String xid, long branchId, BranchStatus status, String applicationData) throws TransactionException {
        }
    });
}
Also used : TransactionException(io.seata.core.exception.TransactionException) BranchType(io.seata.core.model.BranchType) ResourceManagerXA(io.seata.rm.datasource.xa.ResourceManagerXA) XAResource(javax.transaction.xa.XAResource) Resource(io.seata.core.model.Resource) BranchStatus(io.seata.core.model.BranchStatus)

Aggregations

TransactionException (io.seata.core.exception.TransactionException)1 BranchStatus (io.seata.core.model.BranchStatus)1 BranchType (io.seata.core.model.BranchType)1 Resource (io.seata.core.model.Resource)1 ResourceManagerXA (io.seata.rm.datasource.xa.ResourceManagerXA)1 XAResource (javax.transaction.xa.XAResource)1