-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,6 @@ | |
*/ | ||
package io.seata.rm.tcc.interceptor; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import io.seata.core.context.RootContext; | ||
import io.seata.rm.tcc.NormalTccActionImpl; | ||
import io.seata.rm.tcc.TccParam; | ||
|
@@ -32,15 +27,26 @@ | |
import org.apache.seata.core.model.ResourceManager; | ||
import org.apache.seata.integration.tx.api.util.ProxyUtil; | ||
import org.apache.seata.rm.DefaultResourceManager; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
public class ProxyUtilsTccTest { | ||
|
||
private final String DEFAULT_XID = "default_xid"; | ||
|
||
private final AtomicReference<String> branchReference = new AtomicReference<String>(); | ||
|
||
@BeforeEach | ||
public void before() { | ||
RootContext.bind(DEFAULT_XID); | ||
} | ||
|
||
private final ResourceManager resourceManager = new ResourceManager() { | ||
|
||
|
@@ -103,9 +109,6 @@ public GlobalStatus getGlobalStatus(BranchType branchType, String xid) { | |
|
||
@Test | ||
public void testTcc() { | ||
//given | ||
RootContext.bind(DEFAULT_XID); | ||
|
||
TccParam tccParam = new TccParam(1, "[email protected]"); | ||
List<String> listB = Collections.singletonList("b"); | ||
|
||
|
@@ -121,9 +124,6 @@ public void testTcc() { | |
|
||
@Test | ||
public void testTccThrowRawException() { | ||
//given | ||
RootContext.bind(DEFAULT_XID); | ||
|
||
TccParam tccParam = new TccParam(1, "[email protected]"); | ||
List<String> listB = Collections.singletonList("b"); | ||
|
||
|
@@ -139,5 +139,10 @@ public void testTccImplementOtherMethod(){ | |
Assertions.assertTrue(tccActionProxy.otherMethod()); | ||
} | ||
|
||
@AfterEach | ||
public void clear() { | ||
RootContext.unbind(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters