final String appName = "TestReportFailure";
// Create a dummy shutdown controller to log calls to the shutdown
// method. NOTE: The controller does not actually shutdown the node
DataService dataService = createDataService(serviceProps);
WatchdogServiceImpl watchdogService =
new WatchdogServiceImpl(serviceProps, systemRegistry,
txnProxy, dummyShutdownCtrl);
// Report a failure, which should shutdown the node
watchdogService.reportFailure(dataService.getLocalNodeId(),
appName);
// Node should not be alive since we reported a failure
try {
assertFalse(watchdogService.isLocalNodeAliveNonTransactional());
} catch (Exception e) {
fail("Not expecting an Exception: " + e.getLocalizedMessage());
}
// The shutdown controller should be incremented as a result of the
// failure being reported
assertEquals(1, dummyShutdownCtrl.getShutdownCount());
watchdogService.shutdown();
dataService.shutdown();
}