diff --git a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java index 0422b6e0c38..bc652b99df4 100644 --- a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java +++ b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java @@ -52,8 +52,8 @@ final class ClassPersistInstances { NessiePersistCache nessiePersistCache = PersistExtension.annotationInstance(context, NessiePersistCache.class); cacheBackend = - nessiePersistCache != null - ? PersistCaches.newBackend(nessiePersistCache.capacity(), null) + nessiePersistCache != null && nessiePersistCache.capacityMb() >= 0 + ? PersistCaches.newBackend(nessiePersistCache.capacityMb(), null) : null; backendTestFactory = reusableTestBackend.backendTestFactory(context); diff --git a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java index d95a0de7484..49ca29afbe0 100644 --- a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java +++ b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java @@ -23,12 +23,14 @@ /** * Adds a cache in front of the created {@link - * org.projectnessie.versioned.storage.common.persist.Persist} instances, if the {@link #capacity()} - * is {@code >= 0}. + * org.projectnessie.versioned.storage.common.persist.Persist} instances, if the {@link + * #capacityMb()} is {@code >= 0}. */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface NessiePersistCache { - long capacity() default 1024 * 1024; + + /** The maximum capacity of the cache in MB. Default is 1 MB. */ + long capacityMb() default 1; }