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