use of org.apache.sling.discovery.commons.providers.DummyTopologyView 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.DummyTopologyView 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);
}
use of org.apache.sling.discovery.commons.providers.DummyTopologyView in project sling by apache.
the class TestViewStateManager method testActivateBindChangingChangedBindDuplicateHandleNewView.
@Test
public void testActivateBindChangingChangedBindDuplicateHandleNewView() throws Exception {
final DummyListener listener1 = new DummyListener();
mgr.handleActivated();
mgr.bind(listener1);
mgr.handleChanging();
final DummyTopologyView view = new DummyTopologyView().addInstance();
mgr.handleNewView(view);
assertEvents(listener1, EventHelper.newInitEvent(view));
final DummyListener listener2 = new DummyListener();
mgr.bind(listener2);
mgr.handleNewView(DummyTopologyView.clone(view));
TestHelper.assertNoEvents(listener1);
assertEvents(listener2, EventHelper.newInitEvent(view));
randomEventLoop(defaultRandom, listener1, listener2);
}
use of org.apache.sling.discovery.commons.providers.DummyTopologyView in project sling by apache.
the class TestViewStateManager method testBindChangingActivateChanged.
@Test
public void testBindChangingActivateChanged() throws Exception {
final DummyListener listener = new DummyListener();
mgr.bind(listener);
TestHelper.assertNoEvents(listener);
mgr.handleChanging();
TestHelper.assertNoEvents(listener);
mgr.handleActivated();
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.DummyTopologyView in project sling by apache.
the class TestViewStateManager method testBindActivateChangedChanged.
@Test
public void testBindActivateChangedChanged() throws Exception {
final DummyListener listener = new DummyListener();
mgr.handleActivated();
TestHelper.assertNoEvents(listener);
mgr.bind(listener);
TestHelper.assertNoEvents(listener);
mgr.handleChanging();
TestHelper.assertNoEvents(listener);
final BaseTopologyView view1 = new DummyTopologyView().addInstance();
mgr.handleNewView(view1);
assertEvents(listener, EventHelper.newInitEvent(view1));
final BaseTopologyView view2 = new DummyTopologyView().addInstance();
mgr.handleNewView(view2);
assertEvents(listener, EventHelper.newChangingEvent(view1), EventHelper.newChangedEvent(view1, view2));
randomEventLoop(defaultRandom, listener);
}
Aggregations