[
https://issues.apache.org/jira/browse/HADOOP-13257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15713157#comment-15713157
]
Mingliang Liu commented on HADOOP-13257:
----------------------------------------
{quote}
6. When generating Parameterized.Parameters, can we use loops? They're clearer
for covering different cases.
Sorry i doubt if i understood the comment, Could you please clarify?
{quote}
For example, when generating parameters in {{TestAdlPermissionLive}},
{code}
63 @Parameterized.Parameters(name = "{0}")
64 public static Collection adlCreateNonRecursiveTestData()
65 throws UnsupportedEncodingException {
66 /*
67 Test Data
68 File/Folder name, User permission, Group permission, Other
Permission,
69 Parent already exist
70 shouldCreateSucceed, expectedExceptionIfFileCreateFails
71 */
72 return Arrays.asList(new Object[][] {
73 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
74 FsAction.ALL)},
75 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
76 FsAction.NONE)},
77 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
78 FsAction.EXECUTE)},
79 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
80 FsAction.READ_EXECUTE)},
81 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
82 FsAction.WRITE_EXECUTE)},
83 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
84 FsAction.WRITE)},
85 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
86 FsAction.READ)},
87 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
88 FsAction.READ_WRITE)},
89
90 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.ALL,
91 FsAction.ALL)},
92 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
93 FsAction.EXECUTE, FsAction.NONE)},
94 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
95 FsAction.READ_EXECUTE, FsAction.NONE)},
96 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
97 FsAction.WRITE_EXECUTE, FsAction.NONE)},
98 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
99 FsAction.WRITE, FsAction.NONE)},
100 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
FsAction.READ,
101 FsAction.NONE)},
102 {new TestData(UUID.randomUUID().toString(), FsAction.ALL,
103 FsAction.READ_WRITE, FsAction.NONE)}});
104 }
{code}
can be some code like (may need to change it):
{code}
public static Collection adlCreateNonRecursiveTestData()
throws UnsupportedEncodingException {
final Collection<TestData> datas = new ArrayList<>();
for (FsAction g : FsAction.values()) {
for (FsAction o : FsAction.values()) {
datas.add(new TestData(UUID.randomUUID().toString(), FsAction.ALL, g,
o));
}
}
return datas;
}
{code}
{quote}
Initially i had the simplified version of the code you proposed. Issue faced,
output was flood with logs since TestAdlSupportedCharsetInPath has 470+ test.
Hence added check to dump the log only when not found.
{quote}
You can still return early.
{code}
private boolean contains(FileStatus[] statuses, String remotePath) {
for (FileStatus status : statuses) {
if (status.getPath().toString().equals(remotePath)) {
return true;
}
}
for (FileStatus status : statuses) {
LOG.debug("Directory Content: {}", status.getPath());
}
return false;
}
{code}
By the way, if you love lambda, you can use following code:
{code}
private boolean contains(FileStatus[] statuses, String remotePath) {
for (FileStatus status : statuses) {
if (status.getPath().toString().equals(remotePath)) {
return true;
}
}
Arrays.stream(statuses).forEach(s -> LOG.info(s.getPath().toString()));
return false;
}
{code}
> Improve Azure Data Lake contract tests.
> ---------------------------------------
>
> Key: HADOOP-13257
> URL: https://issues.apache.org/jira/browse/HADOOP-13257
> Project: Hadoop Common
> Issue Type: Sub-task
> Reporter: Chris Nauroth
> Assignee: Vishwajeet Dusane
> Attachments: HADOOP-13257.001.patch
>
>
> HADOOP-12875 provided the initial implementation of the FileSystem contract
> tests covering Azure Data Lake. This issue tracks subsequent improvements on
> those test suites for improved coverage and matching the specified semantics
> more closely.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]