Skip to content

Commit 1702a48

Browse files
committed
Fix UT checkstyle error in TestRMAdminCLI
1 parent 4525c7e commit 1702a48

File tree

1 file changed

+64
-64
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli

1 file changed

+64
-64
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -216,45 +216,45 @@ public void replaceLabelsOnNode(
216216

217217
@Test
218218
public void testRefreshQueues() throws Exception {
219-
String[] args = { "-refreshQueues" };
219+
String[] args = {"-refreshQueues"};
220220
assertEquals(0, rmAdminCLI.run(args));
221221
verify(admin).refreshQueues(any(RefreshQueuesRequest.class));
222222
}
223223

224224
@Test
225225
public void testRefreshUserToGroupsMappings() throws Exception {
226-
String[] args = { "-refreshUserToGroupsMappings" };
226+
String[] args = {"-refreshUserToGroupsMappings"};
227227
assertEquals(0, rmAdminCLI.run(args));
228228
verify(admin).refreshUserToGroupsMappings(
229229
any(RefreshUserToGroupsMappingsRequest.class));
230230
}
231231

232232
@Test
233233
public void testRefreshSuperUserGroupsConfiguration() throws Exception {
234-
String[] args = { "-refreshSuperUserGroupsConfiguration" };
234+
String[] args = {"-refreshSuperUserGroupsConfiguration"};
235235
assertEquals(0, rmAdminCLI.run(args));
236236
verify(admin).refreshSuperUserGroupsConfiguration(
237237
any(RefreshSuperUserGroupsConfigurationRequest.class));
238238
}
239239

240240
@Test
241241
public void testRefreshAdminAcls() throws Exception {
242-
String[] args = { "-refreshAdminAcls" };
242+
String[] args = {"-refreshAdminAcls"};
243243
assertEquals(0, rmAdminCLI.run(args));
244244
verify(admin).refreshAdminAcls(any(RefreshAdminAclsRequest.class));
245245
}
246246

247247
@Test
248248
public void testRefreshClusterMaxPriority() throws Exception {
249-
String[] args = { "-refreshClusterMaxPriority" };
249+
String[] args = {"-refreshClusterMaxPriority"};
250250
assertEquals(0, rmAdminCLI.run(args));
251251
verify(admin).refreshClusterMaxPriority(
252252
any(RefreshClusterMaxPriorityRequest.class));
253253
}
254254

255255
@Test
256256
public void testRefreshServiceAcl() throws Exception {
257-
String[] args = { "-refreshServiceAcl" };
257+
String[] args = {"-refreshServiceAcl"};
258258
assertEquals(0, rmAdminCLI.run(args));
259259
verify(admin).refreshServiceAcls(any(RefreshServiceAclsRequest.class));
260260
}
@@ -264,8 +264,8 @@ public void testUpdateNodeResource() throws Exception {
264264
String nodeIdStr = "0.0.0.0:0";
265265
int memSize = 2048;
266266
int cores = 2;
267-
String[] args = { "-updateNodeResource", nodeIdStr,
268-
Integer.toString(memSize), Integer.toString(cores) };
267+
String[] args = {"-updateNodeResource", nodeIdStr,
268+
Integer.toString(memSize), Integer.toString(cores)};
269269
assertEquals(0, rmAdminCLI.run(args));
270270
ArgumentCaptor<UpdateNodeResourceRequest> argument =
271271
ArgumentCaptor.forClass(UpdateNodeResourceRequest.class);
@@ -468,7 +468,7 @@ public void testUpdateNodeResourceTypesWithInvalidResourceFormat()
468468

469469
@Test
470470
public void testRefreshNodes() throws Exception {
471-
String[] args = { "-refreshNodes" };
471+
String[] args = {"-refreshNodes"};
472472
assertEquals(0, rmAdminCLI.run(args));
473473
verify(admin).refreshNodes(any(RefreshNodesRequest.class));
474474
}
@@ -577,7 +577,7 @@ public void testGetGroups() throws Exception {
577577
PrintStream out = mock(PrintStream.class);
578578
System.setOut(out);
579579
try {
580-
String[] args = { "-getGroups", "admin" };
580+
String[] args = {"-getGroups", "admin"};
581581
assertEquals(0, rmAdminCLI.run(args));
582582
verify(admin).getGroupsForUser(eq("admin"));
583583
verify(out).println(argThat(
@@ -684,7 +684,7 @@ public void testHelp() throws Exception {
684684
System.setOut(new PrintStream(dataOut));
685685
System.setErr(new PrintStream(dataErr));
686686
try {
687-
String[] args = { "-help" };
687+
String[] args = {"-help"};
688688
assertEquals(0, rmAdminCLI.run(args));
689689
oldOutPrintStream.println(dataOut);
690690
assertTrue(dataOut
@@ -749,38 +749,38 @@ public void testHelp() throws Exception {
749749
"-help [cmd]: Displays help for the given command or all " +
750750
"commands if none"));
751751

752-
testError(new String[] { "-help", "-refreshQueues" },
752+
testError(new String[] {"-help", "-refreshQueues"},
753753
"Usage: yarn rmadmin [-refreshQueues]", dataErr, 0);
754-
testError(new String[] { "-help", "-refreshNodes" },
754+
testError(new String[] {"-help", "-refreshNodes"},
755755
"Usage: yarn rmadmin [-refreshNodes [-g|graceful " +
756756
"[timeout in seconds] -client|server]]", dataErr, 0);
757-
testError(new String[] { "-help", "-refreshNodesResources" },
757+
testError(new String[] {"-help", "-refreshNodesResources"},
758758
"Usage: yarn rmadmin [-refreshNodesResources]", dataErr, 0);
759-
testError(new String[] { "-help", "-refreshUserToGroupsMappings" },
759+
testError(new String[] {"-help", "-refreshUserToGroupsMappings"},
760760
"Usage: yarn rmadmin [-refreshUserToGroupsMappings]", dataErr, 0);
761761
testError(
762-
new String[] { "-help", "-refreshSuperUserGroupsConfiguration" },
762+
new String[] {"-help", "-refreshSuperUserGroupsConfiguration"},
763763
"Usage: yarn rmadmin [-refreshSuperUserGroupsConfiguration]",
764764
dataErr, 0);
765-
testError(new String[] { "-help", "-refreshAdminAcls" },
765+
testError(new String[] {"-help", "-refreshAdminAcls"},
766766
"Usage: yarn rmadmin [-refreshAdminAcls]", dataErr, 0);
767-
testError(new String[] { "-help", "-refreshServiceAcl" },
767+
testError(new String[] {"-help", "-refreshServiceAcl"},
768768
"Usage: yarn rmadmin [-refreshServiceAcl]", dataErr, 0);
769-
testError(new String[] { "-help", "-getGroups" },
769+
testError(new String[] {"-help", "-getGroups"},
770770
"Usage: yarn rmadmin [-getGroups [username]]", dataErr, 0);
771-
testError(new String[] { "-help", "-transitionToActive" },
771+
testError(new String[] {"-help", "-transitionToActive"},
772772
"Usage: yarn rmadmin [-transitionToActive [--forceactive]" +
773773
" <serviceId>]", dataErr, 0);
774-
testError(new String[] { "-help", "-transitionToStandby" },
774+
testError(new String[] {"-help", "-transitionToStandby"},
775775
"Usage: yarn rmadmin [-transitionToStandby <serviceId>]", dataErr, 0);
776-
testError(new String[] { "-help", "-getServiceState" },
776+
testError(new String[] {"-help", "-getServiceState"},
777777
"Usage: yarn rmadmin [-getServiceState <serviceId>]", dataErr, 0);
778-
testError(new String[] { "-help", "-checkHealth" },
778+
testError(new String[] {"-help", "-checkHealth"},
779779
"Usage: yarn rmadmin [-checkHealth <serviceId>]", dataErr, 0);
780780

781-
testError(new String[] { "-help", "-badParameter" },
781+
testError(new String[] {"-help", "-badParameter"},
782782
"Usage: yarn rmadmin", dataErr, 0);
783-
testError(new String[] { "-badParameter" },
783+
testError(new String[] {"-badParameter"},
784784
"badParameter: Unknown command", dataErr, -1);
785785

786786
// Test -help when RM HA is enabled
@@ -850,8 +850,8 @@ public void testAccessLocalNodeLabelManager() throws Exception {
850850
// change the sequence of "-directlyAccessNodeLabelStore" and labels,
851851
// should fail
852852
args =
853-
new String[] { "-addToClusterNodeLabels",
854-
"-directlyAccessNodeLabelStore", "x,y" };
853+
new String[] {"-addToClusterNodeLabels",
854+
"-directlyAccessNodeLabelStore", "x,y"};
855855
assertEquals(-1, rmAdminCLI.run(args));
856856

857857
// local node labels manager will be close after running
@@ -861,7 +861,7 @@ public void testAccessLocalNodeLabelManager() throws Exception {
861861
@Test
862862
public void testAccessRemoteNodeLabelManager() throws Exception {
863863
String[] args =
864-
{ "-addToClusterNodeLabels", "x,y" };
864+
{"-addToClusterNodeLabels", "x,y"};
865865
assertEquals(0, rmAdminCLI.run(args));
866866

867867
// localNodeLabelsManager shouldn't accessed
@@ -875,33 +875,33 @@ public void testAccessRemoteNodeLabelManager() throws Exception {
875875
public void testAddToClusterNodeLabels() throws Exception {
876876
// successfully add labels
877877
String[] args =
878-
{ "-addToClusterNodeLabels", "x", "-directlyAccessNodeLabelStore" };
878+
{"-addToClusterNodeLabels", "x", "-directlyAccessNodeLabelStore"};
879879
assertEquals(0, rmAdminCLI.run(args));
880880
assertTrue(dummyNodeLabelsManager.getClusterNodeLabelNames().containsAll(
881881
ImmutableSet.of("x")));
882882

883883
// no labels, should fail
884-
args = new String[] { "-addToClusterNodeLabels" };
884+
args = new String[] {"-addToClusterNodeLabels"};
885885
assertTrue(0 != rmAdminCLI.run(args));
886886

887887
// no labels, should fail
888888
args =
889-
new String[] { "-addToClusterNodeLabels",
890-
"-directlyAccessNodeLabelStore" };
889+
new String[] {"-addToClusterNodeLabels",
890+
"-directlyAccessNodeLabelStore"};
891891
assertTrue(0 != rmAdminCLI.run(args));
892892

893893
// no labels, should fail at client validation
894-
args = new String[] { "-addToClusterNodeLabels", " " };
894+
args = new String[] {"-addToClusterNodeLabels", " "};
895895
assertTrue(0 != rmAdminCLI.run(args));
896896

897897
// no labels, should fail at client validation
898-
args = new String[] { "-addToClusterNodeLabels", " , " };
898+
args = new String[] {"-addToClusterNodeLabels", " , "};
899899
assertTrue(0 != rmAdminCLI.run(args));
900900

901901
// successfully add labels
902902
args =
903-
new String[] { "-addToClusterNodeLabels", ",x,,",
904-
"-directlyAccessNodeLabelStore" };
903+
new String[] {"-addToClusterNodeLabels", ",x,,",
904+
"-directlyAccessNodeLabelStore"};
905905
assertEquals(0, rmAdminCLI.run(args));
906906
assertTrue(dummyNodeLabelsManager.getClusterNodeLabelNames().containsAll(
907907
ImmutableSet.of("x")));
@@ -911,25 +911,25 @@ public void testAddToClusterNodeLabels() throws Exception {
911911
public void testAddToClusterNodeLabelsWithExclusivitySetting()
912912
throws Exception {
913913
// Parenthese not match
914-
String[] args = new String[] { "-addToClusterNodeLabels", "x(" };
914+
String[] args = new String[] {"-addToClusterNodeLabels", "x("};
915915
assertTrue(0 != rmAdminCLI.run(args));
916916

917-
args = new String[] { "-addToClusterNodeLabels", "x)" };
917+
args = new String[] {"-addToClusterNodeLabels", "x)"};
918918
assertTrue(0 != rmAdminCLI.run(args));
919919

920920
// Not expected key=value specifying inner parentese
921-
args = new String[] { "-addToClusterNodeLabels", "x(key=value)" };
921+
args = new String[] {"-addToClusterNodeLabels", "x(key=value)"};
922922
assertTrue(0 != rmAdminCLI.run(args));
923923

924924
// Not key is expected, but value not
925-
args = new String[] { "-addToClusterNodeLabels", "x(exclusive=)" };
925+
args = new String[] {"-addToClusterNodeLabels", "x(exclusive=)"};
926926
assertTrue(0 != rmAdminCLI.run(args));
927927

928928
// key=value both set
929929
args =
930-
new String[] { "-addToClusterNodeLabels",
930+
new String[] {"-addToClusterNodeLabels",
931931
"w,x(exclusive=true), y(exclusive=false),z()",
932-
"-directlyAccessNodeLabelStore" };
932+
"-directlyAccessNodeLabelStore"};
933933
assertTrue(0 == rmAdminCLI.run(args));
934934

935935
assertTrue(dummyNodeLabelsManager.isExclusiveNodeLabel("w"));
@@ -939,9 +939,9 @@ public void testAddToClusterNodeLabelsWithExclusivitySetting()
939939

940940
// key=value both set, and some spaces need to be handled
941941
args =
942-
new String[] { "-addToClusterNodeLabels",
942+
new String[] {"-addToClusterNodeLabels",
943943
"a (exclusive= true) , b( exclusive =false),c ",
944-
"-directlyAccessNodeLabelStore" };
944+
"-directlyAccessNodeLabelStore"};
945945
assertTrue(0 == rmAdminCLI.run(args));
946946

947947
assertTrue(dummyNodeLabelsManager.isExclusiveNodeLabel("a"));
@@ -954,27 +954,27 @@ public void testRemoveFromClusterNodeLabels() throws Exception {
954954
// Successfully remove labels
955955
dummyNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
956956
String[] args =
957-
{ "-removeFromClusterNodeLabels", "x,,y",
958-
"-directlyAccessNodeLabelStore" };
957+
{"-removeFromClusterNodeLabels", "x,,y",
958+
"-directlyAccessNodeLabelStore"};
959959
assertEquals(0, rmAdminCLI.run(args));
960960
assertTrue(dummyNodeLabelsManager.getClusterNodeLabelNames().isEmpty());
961961

962962
// no labels, should fail
963-
args = new String[] { "-removeFromClusterNodeLabels" };
963+
args = new String[] {"-removeFromClusterNodeLabels"};
964964
assertTrue(0 != rmAdminCLI.run(args));
965965

966966
// no labels, should fail
967967
args =
968-
new String[] { "-removeFromClusterNodeLabels",
969-
"-directlyAccessNodeLabelStore" };
968+
new String[] {"-removeFromClusterNodeLabels",
969+
"-directlyAccessNodeLabelStore"};
970970
assertTrue(0 != rmAdminCLI.run(args));
971971

972972
// no labels, should fail at client validation
973-
args = new String[] { "-removeFromClusterNodeLabels", " " };
973+
args = new String[] {"-removeFromClusterNodeLabels", " "};
974974
assertTrue(0 != rmAdminCLI.run(args));
975975

976976
// no labels, should fail at client validation
977-
args = new String[] { "-removeFromClusterNodeLabels", ", " };
977+
args = new String[] {"-removeFromClusterNodeLabels", ", "};
978978
assertTrue(0 != rmAdminCLI.run(args));
979979
}
980980

@@ -984,9 +984,9 @@ public void testReplaceLabelsOnNode() throws Exception {
984984
dummyNodeLabelsManager
985985
.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y", "Y"));
986986
String[] args =
987-
{ "-replaceLabelsOnNode",
987+
{"-replaceLabelsOnNode",
988988
"node1:8000,x node2:8000=y node3,x node4=Y",
989-
"-directlyAccessNodeLabelStore" };
989+
"-directlyAccessNodeLabelStore"};
990990
assertEquals(0, rmAdminCLI.run(args));
991991
assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
992992
NodeId.newInstance("node1", 8000)));
@@ -998,23 +998,23 @@ public void testReplaceLabelsOnNode() throws Exception {
998998
NodeId.newInstance("node4", 0)));
999999

10001000
// no labels, should fail
1001-
args = new String[] { "-replaceLabelsOnNode" };
1001+
args = new String[] {"-replaceLabelsOnNode"};
10021002
assertTrue(0 != rmAdminCLI.run(args));
10031003

10041004
// no labels, should fail
1005-
args = new String[] { "-replaceLabelsOnNode", "-failOnUnknownNodes" };
1005+
args = new String[] {"-replaceLabelsOnNode", "-failOnUnknownNodes"};
10061006
assertTrue(0 != rmAdminCLI.run(args));
10071007

10081008
// no labels, should fail
10091009
args =
1010-
new String[] { "-replaceLabelsOnNode", "-directlyAccessNodeLabelStore" };
1010+
new String[] {"-replaceLabelsOnNode", "-directlyAccessNodeLabelStore"};
10111011
assertTrue(0 != rmAdminCLI.run(args));
10121012

10131013
// no labels, should fail
1014-
args = new String[] { "-replaceLabelsOnNode", " " };
1014+
args = new String[] {"-replaceLabelsOnNode", " "};
10151015
assertTrue(0 != rmAdminCLI.run(args));
10161016

1017-
args = new String[] { "-replaceLabelsOnNode", ", " };
1017+
args = new String[] {"-replaceLabelsOnNode", ", "};
10181018
assertTrue(0 != rmAdminCLI.run(args));
10191019
}
10201020

@@ -1023,8 +1023,8 @@ public void testReplaceMultipleLabelsOnSingleNode() throws Exception {
10231023
// Successfully replace labels
10241024
dummyNodeLabelsManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
10251025
String[] args =
1026-
{ "-replaceLabelsOnNode", "node1,x,y",
1027-
"-directlyAccessNodeLabelStore" };
1026+
{"-replaceLabelsOnNode", "node1,x,y",
1027+
"-directlyAccessNodeLabelStore"};
10281028
assertTrue(0 != rmAdminCLI.run(args));
10291029
}
10301030

@@ -1033,12 +1033,12 @@ public void testRemoveLabelsOnNodes() throws Exception {
10331033
// Successfully replace labels
10341034
dummyNodeLabelsManager
10351035
.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y"));
1036-
String[] args = { "-replaceLabelsOnNode", "node1=x node2=y",
1037-
"-directlyAccessNodeLabelStore" };
1036+
String[] args = {"-replaceLabelsOnNode", "node1=x node2=y",
1037+
"-directlyAccessNodeLabelStore"};
10381038
assertTrue(0 == rmAdminCLI.run(args));
10391039

1040-
args = new String[] { "-replaceLabelsOnNode", "node1= node2=",
1041-
"-directlyAccessNodeLabelStore" };
1040+
args = new String[] {"-replaceLabelsOnNode", "node1= node2=",
1041+
"-directlyAccessNodeLabelStore"};
10421042
assertTrue("Labels should get replaced even '=' is used ",
10431043
0 == rmAdminCLI.run(args));
10441044
}

0 commit comments

Comments
 (0)