adoroszlai commented on code in PR #3414:
URL: https://github.com/apache/ozone/pull/3414#discussion_r874860239
##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/cache/TestTableCache.java:
##########
@@ -20,56 +20,44 @@
package org.apache.hadoop.hdds.utils.db.cache;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
+import java.util.stream.Stream;
import com.google.common.base.Optional;
import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
-import static org.junit.Assert.fail;
/**
* Class tests partial table cache.
*/
-@RunWith(value = Parameterized.class)
public class TestTableCache {
private static final Logger LOG =
- LoggerFactory.getLogger(TestTableCache.class);
+ LoggerFactory.getLogger(TestTableCache.class);
private TableCache<CacheKey<String>, CacheValue<String>> tableCache;
Review Comment:
We can convert this to local variable in each test method.
##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/cache/TestTableCache.java:
##########
@@ -78,10 +66,11 @@ public void create() {
LOG.info("cacheType: {}", cacheType);
Review Comment:
I think log is no longer necessary, since parameterized runs are better
labeled with JUnit5. (Then `LOG` can be removed as well.)
##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/cache/TestTableCache.java:
##########
@@ -20,56 +20,44 @@
package org.apache.hadoop.hdds.utils.db.cache;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
+import java.util.stream.Stream;
import com.google.common.base.Optional;
import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
-import static org.junit.Assert.fail;
/**
* Class tests partial table cache.
*/
-@RunWith(value = Parameterized.class)
public class TestTableCache {
private static final Logger LOG =
- LoggerFactory.getLogger(TestTableCache.class);
+ LoggerFactory.getLogger(TestTableCache.class);
private TableCache<CacheKey<String>, CacheValue<String>> tableCache;
- private final TableCache.CacheType cacheType;
-
-
- @Parameterized.Parameters
- public static Collection<Object[]> policy() {
- Object[][] params = new Object[][] {
- {TableCache.CacheType.FULL_CACHE},
- {TableCache.CacheType.PARTIAL_CACHE}
- };
- return Arrays.asList(params);
+ private static Stream<TableCache.CacheType> policy() {
+ return Stream.of(
+ TableCache.CacheType.FULL_CACHE,
+ TableCache.CacheType.PARTIAL_CACHE
+ );
}
- public TestTableCache(
- TableCache.CacheType cacheType) {
+ @BeforeAll
+ public static void setLogLevel() {
GenericTestUtils.setLogLevel(FullTableCache.LOG, Level.DEBUG);
- this.cacheType = cacheType;
}
-
- @Before
- public void create() {
+ public void createTableCache(TableCache.CacheType cacheType) {
Review Comment:
Can be private?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]