BucketsFileSystem implements ManagedStateComponent { @Nullable public TimeBucketMeta getTimeBucketMeta(long bucketId, long timeBucketId) throws IOException { synchronized (timeBucketsMeta) { MutableTimeBucketMeta tbm = timeBucketMetaHelper(bucketId, timeBucketId); if (tbm != null) { return tbm.getImmutableTimeBucketMeta(); } return null; } }  @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 testGetTimeBucketMeta() throws IOException { testMeta.bucketsFileSystem.setup(testMeta.managedStateContext); BucketsFileSystem.TimeBucketMeta bucketMeta = testMeta.bucketsFileSystem.getTimeBucketMeta(1, 1); Assert.assertNull("bucket meta", bucketMeta); BucketsFileSystem.MutableTimeBucketMeta mutableTimeBucketMeta = new BucketsFileSystem.MutableTimeBucketMeta(1, 1); testMeta.bucketsFileSystem.updateTimeBuckets(mutableTimeBucketMeta); bucketMeta = testMeta.bucketsFileSystem.getTimeBucketMeta(1, 1); Assert.assertNotNull("bucket meta not null", bucketMeta); testMeta.bucketsFileSystem.teardown(); }