add testcase
This commit is contained in:
parent
d2f26bd4e4
commit
2988dabffd
@ -385,6 +385,7 @@ public class ConfigAPI_ITCase {
|
|||||||
final AtomicInteger count = new AtomicInteger(0);
|
final AtomicInteger count = new AtomicInteger(0);
|
||||||
final String content = "test-abc";
|
final String content = "test-abc";
|
||||||
boolean result = iconfig.publishConfig(dataId, group, content);
|
boolean result = iconfig.publishConfig(dataId, group, content);
|
||||||
|
Thread.sleep(TIME_OUT);
|
||||||
Assert.assertTrue(result);
|
Assert.assertTrue(result);
|
||||||
|
|
||||||
Listener ml = new AbstractListener() {
|
Listener ml = new AbstractListener() {
|
||||||
|
@ -159,7 +159,7 @@ public class DeregisterInstance_ITCase {
|
|||||||
verifyInstanceList(instances, 2, serviceName);
|
verifyInstanceList(instances, 2, serviceName);
|
||||||
|
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
Assert.assertEquals(instances.size(), 2);
|
Assert.assertEquals(2, instances.size());
|
||||||
|
|
||||||
naming.deregisterInstance(serviceName, "127.0.0.1", TEST_PORT, "c1");
|
naming.deregisterInstance(serviceName, "127.0.0.1", TEST_PORT, "c1");
|
||||||
|
|
||||||
@ -167,15 +167,15 @@ public class DeregisterInstance_ITCase {
|
|||||||
|
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
Assert.assertEquals(instances.size(), 1);
|
Assert.assertEquals(1, instances.size());
|
||||||
|
|
||||||
instances = naming.getAllInstances(serviceName, Arrays.asList("c2"));
|
instances = naming.getAllInstances(serviceName, Arrays.asList("c2"));
|
||||||
Assert.assertEquals(instances.size(), 1);
|
Assert.assertEquals(1, instances.size());
|
||||||
|
|
||||||
naming.deregisterInstance(serviceName,"127.0.0.2", TEST_PORT, "c2");
|
naming.deregisterInstance(serviceName,"127.0.0.2", TEST_PORT, "c2");
|
||||||
TimeUnit.SECONDS.sleep(5);
|
TimeUnit.SECONDS.sleep(5);
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
Assert.assertEquals(instances.size(), 0);
|
Assert.assertEquals(0, instances.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyInstanceList(List<Instance> instances, int size, String serviceName) throws Exception {
|
public void verifyInstanceList(List<Instance> instances, int size, String serviceName) throws Exception {
|
||||||
|
@ -56,6 +56,8 @@ public class NamingBase {
|
|||||||
|
|
||||||
public static final int TEST_PORT = 8080;
|
public static final int TEST_PORT = 8080;
|
||||||
|
|
||||||
|
public static final int TIME_OUT = 3000;
|
||||||
|
|
||||||
public static String randomDomainName() {
|
public static String randomDomainName() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("jinhan");
|
sb.append("jinhan");
|
||||||
|
@ -28,6 +28,7 @@ import org.junit.Assert;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.omg.CORBA.TIMEOUT;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
@ -169,7 +170,7 @@ public class Subscribe_ITCase extends RestAPI_ITCase {
|
|||||||
Assert.assertTrue(verifyInstanceList(instances, naming.getAllInstances(serviceName)));
|
Assert.assertTrue(verifyInstanceList(instances, naming.getAllInstances(serviceName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout = 20*TIME_OUT)
|
||||||
public void subscribeEmpty() throws Exception {
|
public void subscribeEmpty() throws Exception {
|
||||||
|
|
||||||
String serviceName = randomDomainName();
|
String serviceName = randomDomainName();
|
||||||
|
Loading…
Reference in New Issue
Block a user