BaseTest.java 656 B

123456789101112131415161718192021222324
  1. package com.alibaba.csp.sentinel;
  2. import com.alibaba.csp.sentinel.slots.clusterbuilder.ClusterBuilderSlot;
  3. import com.alibaba.dubbo.rpc.RpcContext;
  4. /**
  5. * Base test class, provide common methods for subClass
  6. * The package is same as CtSph, to call CtSph.resetChainMap() method for test
  7. *
  8. * Note: Only for test. DO NOT USE IN PRODUCTION!
  9. *
  10. * @author cdfive
  11. */
  12. public class BaseTest {
  13. /**
  14. * Clean up resources for context, clusterNodeMap, processorSlotChainMap
  15. */
  16. protected static void cleanUpAll() {
  17. RpcContext.removeContext();
  18. ClusterBuilderSlot.getClusterNodeMap().clear();
  19. CtSph.resetChainMap();
  20. }
  21. }