Search in sources :

Example 1 with ContainerBalancer

use of io.pravega.controller.fault.ContainerBalancer in project pravega by pravega.

the class SegmentContainerMonitorHealthContributorTest method setup.

@Before
public void setup() {
    HostControllerStore hostStore = mock(HostControllerStore.class);
    CuratorFramework client = mock(CuratorFramework.class);
    ContainerBalancer balancer = mock(ContainerBalancer.class);
    CuratorZookeeperClient curatorZKClientMock = mock(CuratorZookeeperClient.class);
    Listenable listen = mock(Listenable.class);
    doNothing().when(listen).addListener(any(ConnectionStateListener.class));
    doReturn(listen).when(client).getConnectionStateListenable();
    doReturn(curatorZKClientMock).when(client).getZookeeperClient();
    doReturn(true).when(curatorZKClientMock).isConnected();
    monitor = spy(new SegmentContainerMonitor(hostStore, client, balancer, 1));
    contributor = new SegmentContainerMonitorHealthContributor("segmentcontainermonitor", monitor);
    builder = Health.builder().name("monitor");
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ContainerBalancer(io.pravega.controller.fault.ContainerBalancer) HostControllerStore(io.pravega.controller.store.host.HostControllerStore) CuratorZookeeperClient(org.apache.curator.CuratorZookeeperClient) SegmentContainerMonitor(io.pravega.controller.fault.SegmentContainerMonitor) ConnectionStateListener(org.apache.curator.framework.state.ConnectionStateListener) Listenable(org.apache.curator.framework.listen.Listenable) Before(org.junit.Before)

Aggregations

ContainerBalancer (io.pravega.controller.fault.ContainerBalancer)1 SegmentContainerMonitor (io.pravega.controller.fault.SegmentContainerMonitor)1 HostControllerStore (io.pravega.controller.store.host.HostControllerStore)1 CuratorZookeeperClient (org.apache.curator.CuratorZookeeperClient)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 Listenable (org.apache.curator.framework.listen.Listenable)1 ConnectionStateListener (org.apache.curator.framework.state.ConnectionStateListener)1 Before (org.junit.Before)1