use of org.apache.sling.discovery.commons.providers.BaseTopologyView in project sling by apache.
the class TestMinEventDelayHandler method testNormalDelaying.
//TODO test takes env 50sec
@Category(Slow.class)
@Test
public void testNormalDelaying() throws Exception {
final DummyListener listener = new DummyListener();
// first activate
logger.info("testNormalDelaying: calling handleActivated...");
mgr.handleActivated();
// paranoia
assertNoEvents(listener);
// then bind
logger.info("testNormalDelaying: calling bind...");
mgr.bind(listener);
// there was no changing or changed yet
assertNoEvents(listener);
logger.info("testNormalDelaying: calling handleChanging...");
mgr.handleChanging();
assertNoEvents(listener);
final BaseTopologyView view = new DummyTopologyView().addInstance();
logger.info("testNormalDelaying: calling handleNewView...");
mgr.handleNewView(view);
TestHelper.assertEvents(mgr, listener, EventHelper.newInitEvent(view));
for (int i = 0; i < 7; i++) {
logger.info("testNormalDelaying: calling randomEventLoop...");
TestHelper.randomEventLoop(mgr, sds, 4, 1500, defaultRandom, listener);
Thread.sleep(1000);
}
}
use of org.apache.sling.discovery.commons.providers.BaseTopologyView in project sling by apache.
the class TestViewStateManager method testActivateChangingChangedBind.
@Test
public void testActivateChangingChangedBind() throws Exception {
final DummyListener listener = new DummyListener();
// first activate
mgr.handleActivated();
// paranoia
TestHelper.assertNoEvents(listener);
mgr.handleChanging();
// no listener yet
TestHelper.assertNoEvents(listener);
final BaseTopologyView view = new DummyTopologyView().addInstance();
mgr.handleNewView(view);
// no listener yet
TestHelper.assertNoEvents(listener);
// then bind
mgr.bind(listener);
assertEvents(listener, EventHelper.newInitEvent(view));
randomEventLoop(defaultRandom, listener);
}
use of org.apache.sling.discovery.commons.providers.BaseTopologyView in project sling by apache.
the class TestViewStateManager method testBindActivateChangingBindChanged.
@Test
public void testBindActivateChangingBindChanged() throws Exception {
final DummyListener listener1 = new DummyListener();
final DummyListener listener2 = new DummyListener();
mgr.bind(listener1);
TestHelper.assertNoEvents(listener1);
mgr.handleActivated();
TestHelper.assertNoEvents(listener1);
mgr.handleChanging();
TestHelper.assertNoEvents(listener1);
mgr.bind(listener2);
TestHelper.assertNoEvents(listener1);
TestHelper.assertNoEvents(listener2);
final BaseTopologyView view = new DummyTopologyView().addInstance();
mgr.handleNewView(view);
assertEvents(listener1, EventHelper.newInitEvent(view));
assertEvents(listener2, EventHelper.newInitEvent(view));
randomEventLoop(defaultRandom, listener1, listener2);
}
use of org.apache.sling.discovery.commons.providers.BaseTopologyView in project sling by apache.
the class TestViewStateManager method testBindActivateChangingChanged.
@Test
public void testBindActivateChangingChanged() throws Exception {
final DummyListener listener = new DummyListener();
mgr.bind(listener);
TestHelper.assertNoEvents(listener);
mgr.handleActivated();
TestHelper.assertNoEvents(listener);
mgr.handleChanging();
TestHelper.assertNoEvents(listener);
final BaseTopologyView view = new DummyTopologyView().addInstance();
mgr.handleNewView(view);
assertEvents(listener, EventHelper.newInitEvent(view));
randomEventLoop(defaultRandom, listener);
}
use of org.apache.sling.discovery.commons.providers.BaseTopologyView in project sling by apache.
the class TestViewStateManager method testActivateBindChangingChanged.
@Test
public void testActivateBindChangingChanged() throws Exception {
final DummyListener listener = new DummyListener();
// first activate
mgr.handleActivated();
// paranoia
TestHelper.assertNoEvents(listener);
// then bind
mgr.bind(listener);
// there was no changing or changed yet
TestHelper.assertNoEvents(listener);
mgr.handleChanging();
TestHelper.assertNoEvents(listener);
final BaseTopologyView view = new DummyTopologyView().addInstance();
mgr.handleNewView(view);
assertEvents(listener, EventHelper.newInitEvent(view));
randomEventLoop(defaultRandom, listener);
}
Aggregations