@ -93,6 +93,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) )
. thenReturn ( mockRunner ) ;
}
@ -135,6 +136,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
eq ( 25 ) ,
eq ( defaultJsonRpcConfiguration ) ,
eq ( defaultWebSocketConfiguration ) ,
any ( ) ,
any ( ) ) ;
final ArgumentCaptor < MiningParameters > miningArg =
@ -262,6 +264,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
eq ( 42 ) ,
eq ( jsonRpcConfiguration ) ,
eq ( webSocketConfiguration ) ,
any ( ) ,
any ( ) ) ;
final Collection < String > nodes =
@ -315,6 +318,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
eq ( 25 ) ,
eq ( jsonRpcConfiguration ) ,
eq ( webSocketConfiguration ) ,
any ( ) ,
any ( ) ) ;
verify ( mockControllerBuilder ) . build ( any ( ) , any ( ) , any ( ) , eq ( false ) , any ( ) , eq ( false ) ) ;
@ -368,7 +372,17 @@ public class PantheonCommandTest extends CommandTestAbstract {
verify ( mockRunnerBuilder )
. build (
any ( ) , any ( ) , eq ( false ) , any ( ) , anyString ( ) , anyInt ( ) , anyInt ( ) , any ( ) , any ( ) , any ( ) ) ;
any ( ) ,
any ( ) ,
eq ( false ) ,
any ( ) ,
anyString ( ) ,
anyInt ( ) ,
anyInt ( ) ,
any ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( commandOutput . toString ( ) ) . isEmpty ( ) ;
assertThat ( commandErrorOutput . toString ( ) ) . isEmpty ( ) ;
@ -383,6 +397,15 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat ( commandErrorOutput . toString ( ) ) . startsWith ( expectedErrorOutputStart ) ;
}
@Test
public void callingWithBannedNodeidsOptionButNoValueMustDisplayErrorAndUsage ( ) {
parseCommand ( "--banned-nodeids" ) ;
assertThat ( commandOutput . toString ( ) ) . isEmpty ( ) ;
final String expectedErrorOutputStart =
"Missing required parameter for option '--banned-nodeids' at index 0 (<bannedNodeIds>)" ;
assertThat ( commandErrorOutput . toString ( ) ) . startsWith ( expectedErrorOutputStart ) ;
}
@Test
public void bootnodesOptionMustBeUsed ( ) {
final String [ ] nodes = { "enode://001@123:4567" , "enode://002@123:4567" , "enode://003@123:4567" } ;
@ -399,6 +422,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( stringListArgumentCaptor . getValue ( ) . toArray ( ) ) . isEqualTo ( nodes ) ;
@ -407,6 +431,31 @@ public class PantheonCommandTest extends CommandTestAbstract {
assertThat ( commandErrorOutput . toString ( ) ) . isEmpty ( ) ;
}
@Test
public void banNodeIdsOptionMustBeUsed ( ) {
final String [ ] nodes = { "0001" , "0002" , "0003" } ;
parseCommand ( "--banned-nodeids" , String . join ( "," , nodes ) ) ;
verify ( mockRunnerBuilder )
. build (
any ( ) ,
any ( ) ,
anyBoolean ( ) ,
any ( ) ,
anyString ( ) ,
anyInt ( ) ,
anyInt ( ) ,
any ( ) ,
any ( ) ,
any ( ) ,
stringListArgumentCaptor . capture ( ) ) ;
assertThat ( stringListArgumentCaptor . getValue ( ) . toArray ( ) ) . isEqualTo ( nodes ) ;
assertThat ( commandOutput . toString ( ) ) . isEmpty ( ) ;
assertThat ( commandErrorOutput . toString ( ) ) . isEmpty ( ) ;
}
@Test
public void p2pHostAndPortOptionMustBeUsed ( ) {
@ -425,6 +474,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( stringArgumentCaptor . getValue ( ) ) . isEqualTo ( host ) ;
@ -451,6 +501,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
intArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( intArgumentCaptor . getValue ( ) ) . isEqualTo ( maxPeers ) ;
@ -497,6 +548,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . isEnabled ( ) ) . isFalse ( ) ;
@ -520,6 +572,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . isEnabled ( ) ) . isTrue ( ) ;
@ -543,6 +596,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . getRpcApis ( ) )
@ -570,6 +624,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . getHost ( ) ) . isEqualTo ( host ) ;
@ -595,6 +650,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . getCorsAllowedDomains ( ) . toArray ( ) )
@ -620,6 +676,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . getCorsAllowedDomains ( ) . toArray ( ) )
@ -645,6 +702,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . getCorsAllowedDomains ( ) )
@ -670,6 +728,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
jsonRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( jsonRpcConfigArgumentCaptor . getValue ( ) . getCorsAllowedDomains ( ) ) . isEmpty ( ) ;
@ -741,6 +800,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
wsRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( wsRpcConfigArgumentCaptor . getValue ( ) . isEnabled ( ) ) . isFalse ( ) ;
@ -764,6 +824,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
wsRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( wsRpcConfigArgumentCaptor . getValue ( ) . isEnabled ( ) ) . isTrue ( ) ;
@ -787,6 +848,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
wsRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( wsRpcConfigArgumentCaptor . getValue ( ) . getRpcApis ( ) )
@ -813,6 +875,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
anyInt ( ) ,
any ( ) ,
wsRpcConfigArgumentCaptor . capture ( ) ,
any ( ) ,
any ( ) ) ;
assertThat ( wsRpcConfigArgumentCaptor . getValue ( ) . getHost ( ) ) . isEqualTo ( host ) ;