adoroszlai commented on code in PR #5559:
URL: https://github.com/apache/ozone/pull/5559#discussion_r1386425022
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCreateRequest.java:
##########
@@ -87,21 +84,8 @@ public static Collection<Object[]> data() {
new Object[]{false, false});
}
- public TestOMKeyCreateRequest(boolean setKeyPathLock,
- boolean setFileSystemPaths) {
- // Ignored. Actual init done in initParam().
- // This empty constructor is still required to avoid argument exception.
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean setKeyPathLock,
- boolean setFileSystemPaths) {
- keyPathLockEnabled = setKeyPathLock;
- enableFileSystemPaths = setFileSystemPaths;
- }
-
- private static boolean keyPathLockEnabled;
- private static boolean enableFileSystemPaths;
+ private boolean keyPathLockEnabled;
+ private boolean enableFileSystemPaths;
Review Comment:
`testValidateAndUpdateCacheWithKeyContainsSnapshotReservedWord` in the
subclass should be parameterized. With that, these can be removed, test
methods can use their params directly.
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCreateRequestWithFSO.java:
##########
@@ -78,17 +73,19 @@ public void
testValidateAndUpdateCacheWithKeyContainsSnapshotReservedWord()
OMClientResponse omKeyCreateResponse =
omKeyCreateRequest.validateAndUpdateCache(ozoneManager, 100L,
ozoneManagerDoubleBufferHelper);
- Assert.assertTrue(omKeyCreateResponse.getOMResponse().getSuccess());
- Assert.assertEquals("Incorrect keyName", keyName,
+ Assertions.assertTrue(omKeyCreateResponse.getOMResponse().getSuccess());
+ Assertions.assertEquals(keyName,
omKeyCreateResponse.getOMResponse()
- .getCreateKeyResponse().getKeyInfo().getKeyName());
+ .getCreateKeyResponse().getKeyInfo().getKeyName(),
+ "Incorrect keyName");
}
}
@Test
public void testKeyCreateInheritParentDefaultAcls()
throws Exception {
- super.testKeyCreateInheritParentDefaultAcls();
+ super.testKeyCreateInheritParentDefaultAcls(
+ getKeyPathLockEnabled(), getEnableFileSystemPaths());
}
Review Comment:
I think this test method can be removed, inherited method will be executed
with parameters.
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/upgrade/TestOmVersionManagerRequestFactory.java:
##########
@@ -59,34 +57,7 @@ public void testKeyCreateRequest() throws Exception {
// Try getting v1 of 'CreateKey'.
Class<? extends OMClientRequest> requestType =
omVersionManager.getHandler(CreateKey.name());
- Assert.assertEquals(requestType, OMKeyCreateRequest.class);
- }
-
- @Test
- public void testAllOMRequestClassesHaveGetRequestTypeMethod()
- throws Exception {
- Reflections reflections = new Reflections(
- "org.apache.hadoop.ozone.om.request");
- Set<Class<? extends OMClientRequest>> subTypes =
- reflections.getSubTypesOf(OMClientRequest.class);
- List<Class<? extends OMClientRequest>> collect = subTypes.stream()
- .filter(c -> !Modifier.isAbstract(c.getModifiers()))
- .collect(Collectors.toList());
-
- for (Class<? extends OMClientRequest> c : collect) {
- Method getRequestTypeMethod = null;
- try {
- getRequestTypeMethod = c.getMethod("getRequestType");
- } catch (NoSuchMethodException nsmEx) {
- Assert.fail(String.format(
- "%s does not have the 'getRequestType' method " +
- "which should be defined or inherited for every OM request class.",
- c));
- }
- String type = (String) getRequestTypeMethod.invoke(null);
- Assert.assertNotNull(String.format("Cannot get handler for %s", type),
- omVersionManager.getHandler(type));
- }
Review Comment:
Why is this test case being removed?
--
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]