Bladeren bron

test: Improve test cases in sentinel-apache-dubbo-adapter module

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 4 jaren geleden
bovenliggende
commit
fe23d5c11f
2 gewijzigde bestanden met toevoegingen van 14 en 0 verwijderingen
  1. +2
    -0
      sentinel-adapter/sentinel-apache-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilterTest.java
  2. +12
    -0
      sentinel-adapter/sentinel-apache-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/fallback/DubboFallbackRegistryTest.java

+ 2
- 0
sentinel-adapter/sentinel-apache-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilterTest.java Bestand weergeven

@@ -19,6 +19,7 @@ import com.alibaba.csp.sentinel.BaseTest;
import com.alibaba.csp.sentinel.Entry; import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.EntryType; import com.alibaba.csp.sentinel.EntryType;
import com.alibaba.csp.sentinel.adapter.dubbo.config.DubboConfig; import com.alibaba.csp.sentinel.adapter.dubbo.config.DubboConfig;
import com.alibaba.csp.sentinel.adapter.dubbo.fallback.DefaultDubboFallback;
import com.alibaba.csp.sentinel.adapter.dubbo.fallback.DubboFallback; import com.alibaba.csp.sentinel.adapter.dubbo.fallback.DubboFallback;
import com.alibaba.csp.sentinel.adapter.dubbo.fallback.DubboFallbackRegistry; import com.alibaba.csp.sentinel.adapter.dubbo.fallback.DubboFallbackRegistry;
import com.alibaba.csp.sentinel.adapter.dubbo.provider.DemoService; import com.alibaba.csp.sentinel.adapter.dubbo.provider.DemoService;
@@ -82,6 +83,7 @@ public class SentinelDubboConsumerFilterTest extends BaseTest {
@After @After
public void cleanUp() { public void cleanUp() {
cleanUpAll(); cleanUpAll();
DubboFallbackRegistry.setConsumerFallback(new DefaultDubboFallback());
} }


public void initFlowRule(String resource) { public void initFlowRule(String resource) {


+ 12
- 0
sentinel-adapter/sentinel-apache-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/fallback/DubboFallbackRegistryTest.java Bestand weergeven

@@ -20,7 +20,9 @@ import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowException; import com.alibaba.csp.sentinel.slots.block.flow.FlowException;
import org.apache.dubbo.rpc.AsyncRpcResult; import org.apache.dubbo.rpc.AsyncRpcResult;
import org.apache.dubbo.rpc.Result; import org.apache.dubbo.rpc.Result;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;


/** /**
@@ -28,6 +30,16 @@ import org.junit.Test;
*/ */
public class DubboFallbackRegistryTest { public class DubboFallbackRegistryTest {


@Before
public void setUp() {
DubboFallbackRegistry.setConsumerFallback(new DefaultDubboFallback());
}

@After
public void tearDown() {
DubboFallbackRegistry.setConsumerFallback(new DefaultDubboFallback());
}

@Test(expected = SentinelRpcException.class) @Test(expected = SentinelRpcException.class)
public void testDefaultFallback() { public void testDefaultFallback() {
// Test for default. // Test for default.


Laden…
Annuleren
Opslaan