statusUpdateKey =
keyBuilder.stateTransitionStatus("localhost_12918", "session_0", "TestDB0", "TestDB0_0");
accessor.setProperty(statusUpdateKey, new StatusUpdate(new ZNRecord("statusUpdate")));
errorKey =
keyBuilder.stateTransitionError("localhost_12918", "session_0", "TestDB0", "TestDB0_0");
accessor.setProperty(errorKey, new Error(new ZNRecord("error")));
// add controller status updates and errors (one of each, should not trigger anything)
controllerStatusUpdateKey = keyBuilder.controllerTaskStatus("session_0", "TestDB");
accessor.setProperty(controllerStatusUpdateKey, new StatusUpdate(new ZNRecord(
"controllerStatusUpdate")));
controllerErrorKey = keyBuilder.controllerTaskError("TestDB_error");
accessor.setProperty(controllerErrorKey, new Error(new ZNRecord("controllerError")));
// run dump task, should not remove anything because the threshold is not exceeded
task.run();
Assert.assertTrue(baseAccessor.exists(controllerStatusUpdateKey.getPath(), 0));
Assert.assertTrue(baseAccessor.exists(controllerErrorKey.getPath(), 0));
Assert.assertTrue(baseAccessor.exists(statusUpdateKey.getPath(), 0));
Assert.assertTrue(baseAccessor.exists(errorKey.getPath(), 0));
// add a second set of all status updates and errors
statusUpdateKey =
keyBuilder.stateTransitionStatus("localhost_12918", "session_0", "TestDB0", "TestDB0_1");
accessor.setProperty(statusUpdateKey, new StatusUpdate(new ZNRecord("statusUpdate")));
errorKey =
keyBuilder.stateTransitionError("localhost_12918", "session_0", "TestDB0", "TestDB0_1");
accessor.setProperty(errorKey, new Error(new ZNRecord("error")));
controllerStatusUpdateKey = keyBuilder.controllerTaskStatus("session_0", "TestDB1");
accessor.setProperty(controllerStatusUpdateKey, new StatusUpdate(new ZNRecord(
"controllerStatusUpdate")));
controllerErrorKey = keyBuilder.controllerTaskError("TestDB1_error");
accessor.setProperty(controllerErrorKey, new Error(new ZNRecord("controllerError")));
// run dump task, should remove everything since capacities are exceeded
task.run();
Assert.assertFalse(baseAccessor.exists(controllerStatusUpdateKey.getPath(), 0));
Assert.assertFalse(baseAccessor.exists(controllerErrorKey.getPath(), 0));