use of org.apache.servicecomb.registry.consumer.SimpleMicroserviceInstancePing in project java-chassis by ServiceComb.
the class TestSimpleMicroserviceInstancePing method testPing.
@Test
public void testPing() throws IOException {
SimpleMicroserviceInstancePing ping = new SimpleMicroserviceInstancePing();
Assert.assertEquals(ping.getOrder(), 100);
MicroserviceInstance instance = new MicroserviceInstance();
List<String> endpoints = new ArrayList<>();
ServerSocket ss = new ServerSocket(35677);
endpoints.add("http://localhost:35677");
instance.setEndpoints(endpoints);
Assert.assertTrue(ping.ping(instance));
MicroserviceInstance instance2 = new MicroserviceInstance();
Assert.assertFalse(ping.ping(instance2));
ss.close();
Assert.assertFalse(ping.ping(instance));
}
use of org.apache.servicecomb.registry.consumer.SimpleMicroserviceInstancePing in project java-chassis by ServiceComb.
the class TestSimpleMicroserviceInstancePing method testPing_more_endpoin.
@Test
public void testPing_more_endpoin() throws IOException {
SimpleMicroserviceInstancePing ping = new SimpleMicroserviceInstancePing();
MicroserviceInstance instance = new MicroserviceInstance();
List<String> endpoints = new ArrayList<>();
ServerSocket ss = new ServerSocket(35677);
endpoints.add("http://localhost:35676");
endpoints.add("http://localhost:35677");
instance.setEndpoints(endpoints);
Assert.assertTrue(ping.ping(instance));
ss.close();
Assert.assertFalse(ping.ping(instance));
}
use of org.apache.servicecomb.registry.consumer.SimpleMicroserviceInstancePing in project incubator-servicecomb-java-chassis by apache.
the class TestSimpleMicroserviceInstancePing method testPing_more_endpoin.
@Test
public void testPing_more_endpoin() throws IOException {
SimpleMicroserviceInstancePing ping = new SimpleMicroserviceInstancePing();
MicroserviceInstance instance = new MicroserviceInstance();
List<String> endpoints = new ArrayList<>();
ServerSocket ss = new ServerSocket(35677);
endpoints.add("http://localhost:35676");
endpoints.add("http://localhost:35677");
instance.setEndpoints(endpoints);
Assert.assertTrue(ping.ping(instance));
ss.close();
Assert.assertFalse(ping.ping(instance));
}
use of org.apache.servicecomb.registry.consumer.SimpleMicroserviceInstancePing in project incubator-servicecomb-java-chassis by apache.
the class TestSimpleMicroserviceInstancePing method testPing.
@Test
public void testPing() throws IOException {
SimpleMicroserviceInstancePing ping = new SimpleMicroserviceInstancePing();
Assert.assertEquals(ping.getOrder(), 100);
MicroserviceInstance instance = new MicroserviceInstance();
List<String> endpoints = new ArrayList<>();
ServerSocket ss = new ServerSocket(35677);
endpoints.add("http://localhost:35677");
instance.setEndpoints(endpoints);
Assert.assertTrue(ping.ping(instance));
MicroserviceInstance instance2 = new MicroserviceInstance();
Assert.assertFalse(ping.ping(instance2));
ss.close();
Assert.assertFalse(ping.ping(instance));
}
Aggregations