Search in sources :

Example 31 with DummyTopologyView

use of org.apache.sling.discovery.commons.providers.DummyTopologyView in project sling by apache.

the class TestViewStateManager method testBindChangedChangingActivate.

@Test
public void testBindChangedChangingActivate() throws Exception {
    final DummyListener listener = new DummyListener();
    mgr.bind(listener);
    TestHelper.assertNoEvents(listener);
    final BaseTopologyView view = new DummyTopologyView().addInstance();
    mgr.handleNewView(view);
    TestHelper.assertNoEvents(listener);
    mgr.handleChanging();
    TestHelper.assertNoEvents(listener);
    mgr.handleActivated();
    TestHelper.assertNoEvents(listener);
    final BaseTopologyView view2 = new DummyTopologyView().addInstance();
    mgr.handleNewView(view2);
    assertEvents(listener, EventHelper.newInitEvent(view2));
    randomEventLoop(defaultRandom, listener);
}
Also used : DummyTopologyView(org.apache.sling.discovery.commons.providers.DummyTopologyView) BaseTopologyView(org.apache.sling.discovery.commons.providers.BaseTopologyView) Test(org.junit.Test)

Aggregations

DummyTopologyView (org.apache.sling.discovery.commons.providers.DummyTopologyView)31 Test (org.junit.Test)29 BaseTopologyView (org.apache.sling.discovery.commons.providers.BaseTopologyView)19 ReentrantLock (java.util.concurrent.locks.ReentrantLock)5 DefaultClusterView (org.apache.sling.discovery.commons.providers.DefaultClusterView)5 DefaultInstanceDescription (org.apache.sling.discovery.commons.providers.DefaultInstanceDescription)4 Category (org.junit.experimental.categories.Category)3 Semaphore (java.util.concurrent.Semaphore)2 Lock (java.util.concurrent.locks.Lock)2 TopologyEvent (org.apache.sling.discovery.TopologyEvent)2 ViewStateManager (org.apache.sling.discovery.commons.providers.ViewStateManager)2 DummyListener (org.apache.sling.discovery.commons.providers.base.DummyListener)2 Field (java.lang.reflect.Field)1 LinkedList (java.util.LinkedList)1 Level (org.apache.log4j.Level)1 ClusterView (org.apache.sling.discovery.ClusterView)1 DiscoveryService (org.apache.sling.discovery.DiscoveryService)1 InstanceDescription (org.apache.sling.discovery.InstanceDescription)1 TopologyView (org.apache.sling.discovery.TopologyView)1 ClusterSyncService (org.apache.sling.discovery.commons.providers.spi.ClusterSyncService)1