use of org.apache.zeppelin.interpreter.InterpreterContext in project zeppelin by apache.
the class AngularObjectTest method testWatcher.
@Test
public void testWatcher() throws InterruptedException {
final AtomicInteger updated = new AtomicInteger(0);
final AtomicInteger onWatch = new AtomicInteger(0);
AngularObject ao = new AngularObject("name", "value", "note1", null, new AngularObjectListener() {
@Override
public void updated(AngularObject updatedObject) {
updated.incrementAndGet();
}
});
ao.addWatcher(new AngularObjectWatcher(null) {
@Override
public void watch(Object oldObject, Object newObject, InterpreterContext context) {
onWatch.incrementAndGet();
}
});
assertEquals(0, onWatch.get());
ao.set("newValue");
Thread.sleep(500);
assertEquals(1, onWatch.get());
}
Aggregations