Skip to content

Commit e09bdd5

Browse files
committed
HADOOP-19435. Fix CheckStyle.
1 parent a618166 commit e09bdd5

File tree

4 files changed

+49
-54
lines changed

4 files changed

+49
-54
lines changed

hadoop-tools/hadoop-fs2img/src/test/java/org/apache/hadoop/hdfs/server/namenode/ITestProvidedImplementation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ private DatanodeInfo[] getAndCheckBlockLocations(DFSClient client,
578578
private void checkUniqueness(DatanodeInfo[] locations) {
579579
Set<String> set = new HashSet<>();
580580
for (DatanodeInfo info: locations) {
581-
assertFalse(
582-
set.contains(info.getDatanodeUuid()), "All locations should be unique");
581+
assertFalse(set.contains(info.getDatanodeUuid()),
582+
"All locations should be unique");
583583
set.add(info.getDatanodeUuid());
584584
}
585585
}

hadoop-tools/hadoop-fs2img/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSTreeWalk.java

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -84,39 +84,35 @@ public void testImportAcl() throws Exception {
8484
*/
8585
@Test
8686
public void testACLNotSupported() throws Exception {
87-
assertThrows(UnsupportedOperationException.class, () -> {
88-
Configuration conf = new Configuration();
89-
conf.setBoolean(DFSConfigKeys.DFS_PROVIDED_ACLS_IMPORT_ENABLED, true);
90-
FileSystem fs = mock(FileSystem.class);
91-
when(fs.getAclStatus(any())).thenThrow(new UnsupportedOperationException());
92-
Path root = mock(Path.class);
93-
when(root.getFileSystem(conf)).thenReturn(fs);
94-
FileStatus rootFileStatus = new FileStatus(0, true, 0, 0, 1, root);
95-
when(fs.getFileStatus(root)).thenReturn(rootFileStatus);
96-
FSTreeWalk fsTreeWalk = new FSTreeWalk(root, conf);
97-
TreeWalk.TreeIterator iter = fsTreeWalk.iterator();
98-
fail("Unexpected successful creation of iter: " + iter);
99-
});
100-
101-
102-
}
87+
assertThrows(UnsupportedOperationException.class, () -> {
88+
Configuration conf = new Configuration();
89+
conf.setBoolean(DFSConfigKeys.DFS_PROVIDED_ACLS_IMPORT_ENABLED, true);
90+
FileSystem fs = mock(FileSystem.class);
91+
when(fs.getAclStatus(any())).thenThrow(new UnsupportedOperationException());
92+
Path root = mock(Path.class);
93+
when(root.getFileSystem(conf)).thenReturn(fs);
94+
FileStatus rootFileStatus = new FileStatus(0, true, 0, 0, 1, root);
95+
when(fs.getFileStatus(root)).thenReturn(rootFileStatus);
96+
FSTreeWalk fsTreeWalk = new FSTreeWalk(root, conf);
97+
TreeWalk.TreeIterator iter = fsTreeWalk.iterator();
98+
fail("Unexpected successful creation of iter: " + iter);
99+
});
100+
}
103101

104102
/**
105103
* Verify creation of INode for ACL enabled TreePath throws an error.
106104
*/
107105
@Test
108106
public void testToINodeACLNotSupported() throws Exception {
109-
assertThrows(UnsupportedOperationException.class, () -> {
110-
BlockResolver blockResolver = new FixedBlockResolver();
111-
Path root = new Path("/");
112-
FileStatus rootFileStatus = new FileStatus(0, false, 0, 0, 1, root);
113-
AclStatus acls = mock(AclStatus.class);
114-
TreePath treePath = new TreePath(rootFileStatus, 1, null, null, acls);
115-
UGIResolver ugiResolver = mock(UGIResolver.class);
116-
when(ugiResolver.getPermissionsProto(null, acls)).thenReturn(1L);
117-
treePath.toINode(ugiResolver, blockResolver, null);
118-
});
119-
120-
121-
}
107+
assertThrows(UnsupportedOperationException.class, () -> {
108+
BlockResolver blockResolver = new FixedBlockResolver();
109+
Path root = new Path("/");
110+
FileStatus rootFileStatus = new FileStatus(0, false, 0, 0, 1, root);
111+
AclStatus acls = mock(AclStatus.class);
112+
TreePath treePath = new TreePath(rootFileStatus, 1, null, null, acls);
113+
UGIResolver ugiResolver = mock(UGIResolver.class);
114+
when(ugiResolver.getPermissionsProto(null, acls)).thenReturn(1L);
115+
treePath.toINode(ugiResolver, blockResolver, null);
116+
});
117+
}
122118
}

hadoop-tools/hadoop-fs2img/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestRandomTreeWalk.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
public class TestRandomTreeWalk {
4141

4242
@RegisterExtension
43-
public TestName name = new TestName();
43+
private TestName name = new TestName();
4444

4545
private Random r = new Random();
4646

hadoop-tools/hadoop-fs2img/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSingleUGIResolver.java

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,35 +129,35 @@ public void testAclResolution() {
129129

130130
@Test
131131
public void testInvalidUid() {
132-
assertThrows(IllegalArgumentException.class, () -> {
133-
Configuration conf = ugi.getConf();
134-
conf.setInt(SingleUGIResolver.UID, (1 << 24) + 1);
135-
ugi.setConf(conf);
136-
ugi.resolve(file(TESTUSER, TESTGROUP, new FsPermission((short)0777)));
137-
});
132+
assertThrows(IllegalArgumentException.class, () -> {
133+
Configuration conf = ugi.getConf();
134+
conf.setInt(SingleUGIResolver.UID, (1 << 24) + 1);
135+
ugi.setConf(conf);
136+
ugi.resolve(file(TESTUSER, TESTGROUP, new FsPermission((short) 0777)));
137+
});
138138
}
139139

140140
@Test
141141
public void testInvalidGid() {
142-
assertThrows(IllegalArgumentException.class, () -> {
143-
Configuration conf = ugi.getConf();
144-
conf.setInt(SingleUGIResolver.GID, (1 << 24) + 1);
145-
ugi.setConf(conf);
146-
ugi.resolve(file(TESTUSER, TESTGROUP, new FsPermission((short)0777)));
147-
});
142+
assertThrows(IllegalArgumentException.class, () -> {
143+
Configuration conf = ugi.getConf();
144+
conf.setInt(SingleUGIResolver.GID, (1 << 24) + 1);
145+
ugi.setConf(conf);
146+
ugi.resolve(file(TESTUSER, TESTGROUP, new FsPermission((short) 0777)));
147+
});
148148
}
149149

150150
@Test
151151
public void testDuplicateIds() {
152-
assertThrows(IllegalStateException.class, () -> {
153-
Configuration conf = new Configuration(false);
154-
conf.setInt(SingleUGIResolver.UID, 4344);
155-
conf.setInt(SingleUGIResolver.GID, 4344);
156-
conf.set(SingleUGIResolver.USER, TESTUSER);
157-
conf.set(SingleUGIResolver.GROUP, TESTGROUP);
158-
ugi.setConf(conf);
159-
ugi.ugiMap();
160-
});
152+
assertThrows(IllegalStateException.class, () -> {
153+
Configuration conf = new Configuration(false);
154+
conf.setInt(SingleUGIResolver.UID, 4344);
155+
conf.setInt(SingleUGIResolver.GID, 4344);
156+
conf.set(SingleUGIResolver.USER, TESTUSER);
157+
conf.set(SingleUGIResolver.GROUP, TESTGROUP);
158+
ugi.setConf(conf);
159+
ugi.ugiMap();
160+
});
161161
}
162162

163163
static void match(long encoded, FsPermission p) {
@@ -184,5 +184,4 @@ static FileStatus file(String user, String group, FsPermission perm) {
184184
group, /* String group, */
185185
p); /* Path path */
186186
}
187-
188187
}

0 commit comments

Comments
 (0)