|
|
@ -46,6 +46,9 @@ public class NodeSmartContractPermissioningAcceptanceTest |
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.execute(allowNode(permissionedNode)); |
|
|
|
permissionedNode.execute(allowNode(permissionedNode)); |
|
|
|
permissionedNode.verify(nodeIsAllowed(permissionedNode)); |
|
|
|
permissionedNode.verify(nodeIsAllowed(permissionedNode)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(bootnode)); |
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(allowedNode)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -58,38 +61,18 @@ public class NodeSmartContractPermissioningAcceptanceTest |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void permissionedNodeShouldDisconnectFromNodeNotPermittedAnymore() { |
|
|
|
public void permissionedNodeShouldDisconnectFromNodeNotPermittedAnymore() { |
|
|
|
permissionedNode.verify(admin.addPeer(bootnode)); |
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(allowedNode)); |
|
|
|
|
|
|
|
permissionedNode.verify(net.awaitPeerCount(2)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.execute(forbidNode(allowedNode)); |
|
|
|
permissionedNode.execute(forbidNode(allowedNode)); |
|
|
|
permissionedNode.verify(connectionIsForbidden(permissionedNode, allowedNode)); |
|
|
|
permissionedNode.verify(connectionIsForbidden(permissionedNode, allowedNode)); |
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.verify(net.awaitPeerCount(1)); |
|
|
|
permissionedNode.verify(net.awaitPeerCount(1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void permissionedNodeShouldConnectToNewlyPermittedNode() { |
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(bootnode)); |
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(allowedNode)); |
|
|
|
|
|
|
|
permissionedNode.verify(net.awaitPeerCount(2)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.execute(allowNode(forbiddenNode)); |
|
|
|
|
|
|
|
permissionedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); |
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(forbiddenNode)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.verify(net.awaitPeerCount(3)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void permissioningUpdatesPropagateThroughNetwork() { |
|
|
|
public void permissioningUpdatesPropagateThroughNetwork() { |
|
|
|
permissionedNode.verify(admin.addPeer(bootnode)); |
|
|
|
// connection to newly permitted node is allowed
|
|
|
|
permissionedNode.verify(admin.addPeer(allowedNode)); |
|
|
|
|
|
|
|
permissionedNode.verify(net.awaitPeerCount(2)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// permissioning changes in peer should propagate to permissioned node
|
|
|
|
|
|
|
|
allowedNode.execute(allowNode(forbiddenNode)); |
|
|
|
allowedNode.execute(allowNode(forbiddenNode)); |
|
|
|
allowedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); |
|
|
|
allowedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); |
|
|
|
|
|
|
|
// permissioning changes in peer should propagate to permissioned node
|
|
|
|
permissionedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); |
|
|
|
permissionedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); |
|
|
|
|
|
|
|
|
|
|
|
permissionedNode.verify(admin.addPeer(forbiddenNode)); |
|
|
|
permissionedNode.verify(admin.addPeer(forbiddenNode)); |
|
|
|