Search in sources :

Example 1 with ZooKeeperBucketManager

use of io.pravega.controller.server.bucket.ZooKeeperBucketManager in project pravega by pravega.

the class RetentionServiceHealthContributorTest method setup.

@Before
public void setup() {
    BucketStore bucketStore = mock(ZookeeperBucketStore.class);
    doReturn(StoreType.Zookeeper).when(bucketStore).getStoreType();
    String hostId = UUID.randomUUID().toString();
    BucketServiceFactory bucketStoreFactory = spy(new BucketServiceFactory(hostId, bucketStore, 2));
    ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
    PeriodicRetention periodicRetention = mock(PeriodicRetention.class);
    retentionService = spy(bucketStoreFactory.createWatermarkingService(Duration.ofMillis(5), periodicRetention::retention, executor));
    doReturn(CompletableFuture.completedFuture(null)).when((ZooKeeperBucketManager) retentionService).initializeService();
    doNothing().when((ZooKeeperBucketManager) retentionService).startBucketOwnershipListener();
    doReturn(true).when(retentionService).isHealthy();
    contributor = new RetentionServiceHealthContributor("retentionservice", retentionService);
    builder = Health.builder().name("retentionservice");
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) BucketServiceFactory(io.pravega.controller.server.bucket.BucketServiceFactory) PeriodicRetention(io.pravega.controller.server.bucket.PeriodicRetention) BucketStore(io.pravega.controller.store.stream.BucketStore) ZookeeperBucketStore(io.pravega.controller.store.stream.ZookeeperBucketStore) ZooKeeperBucketManager(io.pravega.controller.server.bucket.ZooKeeperBucketManager) Before(org.junit.Before)

Example 2 with ZooKeeperBucketManager

use of io.pravega.controller.server.bucket.ZooKeeperBucketManager in project pravega by pravega.

the class WatermarkingServiceHealthContibutorTest method setup.

@Before
public void setup() {
    ZookeeperBucketStore bucketStore = mock(ZookeeperBucketStore.class);
    doReturn(StoreType.Zookeeper).when(bucketStore).getStoreType();
    String hostId = UUID.randomUUID().toString();
    BucketServiceFactory bucketStoreFactory = new BucketServiceFactory(hostId, bucketStore, 2);
    ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
    PeriodicWatermarking periodicWatermarking = mock(PeriodicWatermarking.class);
    watermarkingService = spy(bucketStoreFactory.createWatermarkingService(Duration.ofMillis(10), periodicWatermarking::watermark, executor));
    doReturn(CompletableFuture.completedFuture(null)).when((ZooKeeperBucketManager) watermarkingService).initializeService();
    doNothing().when((ZooKeeperBucketManager) watermarkingService).startBucketOwnershipListener();
    doReturn(true).when(watermarkingService).isHealthy();
    contributor = new WatermarkingServiceHealthContributor("watermarkingservice", watermarkingService);
    builder = Health.builder().name("watermark");
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) BucketServiceFactory(io.pravega.controller.server.bucket.BucketServiceFactory) PeriodicWatermarking(io.pravega.controller.server.bucket.PeriodicWatermarking) ZooKeeperBucketManager(io.pravega.controller.server.bucket.ZooKeeperBucketManager) ZookeeperBucketStore(io.pravega.controller.store.stream.ZookeeperBucketStore) Before(org.junit.Before)

Aggregations

BucketServiceFactory (io.pravega.controller.server.bucket.BucketServiceFactory)2 ZooKeeperBucketManager (io.pravega.controller.server.bucket.ZooKeeperBucketManager)2 ZookeeperBucketStore (io.pravega.controller.store.stream.ZookeeperBucketStore)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2 Before (org.junit.Before)2 PeriodicRetention (io.pravega.controller.server.bucket.PeriodicRetention)1 PeriodicWatermarking (io.pravega.controller.server.bucket.PeriodicWatermarking)1 BucketStore (io.pravega.controller.store.stream.BucketStore)1