BucketsFileSystem implements ManagedStateComponent { void invalidateTimeBucket(long bucketId, long timeBucketId) throws IOException { synchronized (timeBucketsMeta) { timeBucketsMeta.remove(bucketId, timeBucketId); } updateBucketMetaFile(bucketId); }  @Override void setup(@NotNull ManagedStateContext managedStateContext); @Nullable TimeBucketMeta getTimeBucketMeta(long bucketId, long timeBucketId); TreeMap<Long, TimeBucketMeta> getAllTimeBuckets(long bucketId); @Override void teardown();  }
@Test public void testInvalidateTimeBucket() throws IOException { testMeta.bucketsFileSystem.setup(testMeta.managedStateContext); testGetAllTimeBucketMeta(); testMeta.bucketsFileSystem.invalidateTimeBucket(1, 1); BucketsFileSystem.TimeBucketMeta immutableTbm = testMeta.bucketsFileSystem.getTimeBucketMeta(1,1); Assert.assertNull("deleted tbm", immutableTbm); TreeMap<Long, BucketsFileSystem.TimeBucketMeta> timeBucketMetas = testMeta.bucketsFileSystem.getAllTimeBuckets(1); Assert.assertEquals("only 1 tbm", 1, timeBucketMetas.size()); immutableTbm = timeBucketMetas.entrySet().iterator().next().getValue(); Assert.assertEquals("tbm 2", 2, immutableTbm.getTimeBucketId()); testMeta.bucketsFileSystem.teardown(); }