use of com.emc.storageos.coordinator.exceptions.FatalCoordinatorException in project coprhd-controller by CoprHD.
the class BeaconTest method testRmiFailover.
@Test
public void testRmiFailover() throws Exception {
final String tag = "foo";
final String endpointKey = "bar";
DummyServiceImpl service = new DummyServiceImpl(10100, tag, endpointKey);
service.startRmiServer();
service.start(1000 * 10);
DummyServiceImpl service2 = new DummyServiceImpl(10101, tag, endpointKey);
service2.startRmiServer();
service2.start(1000 * 10);
Service si = service.getServiceInfo();
CoordinatorClient client = connectClient();
DummyService found = client.locateService(DummyService.class, si.getName(), si.getVersion(), tag, endpointKey);
Assert.assertNotNull(found);
found.test();
service.stopRmiServer();
for (int index = 0; index < 100; index++) {
found.test();
}
service2.stopRmiServer();
try {
found.test();
Assert.fail("Expected service lookup to fail");
} catch (FatalCoordinatorException ignore) {
Assert.assertEquals(ServiceCode.COORDINATOR_ERROR, ignore.getServiceCode());
}
service2.startRmiServer();
found.test();
}
Aggregations