Merge remote-tracking branch 'open-source/master' into thomas/os-merge-2018-07-11

Conflicts:
	finance/src/integration-test/kotlin/net/corda/finance/flows/CashConfigDataFlowTest.kt
	node/src/integration-test/kotlin/net/corda/node/BootTests.kt
	node/src/integration-test/kotlin/net/corda/node/NodeUnloadHandlerTests.kt
	node/src/integration-test/kotlin/net/corda/node/flows/FlowRetryTest.kt
	tools/shell/src/integration-test/kotlin/net/corda/tools/shell/InteractiveShellIntegrationTest.kt
	tools/shell/src/integration-test/kotlin/net/corda/tools/shell/SSHServerTest.kt
	webserver/src/integration-test/kotlin/net/corda/webserver/WebserverDriverTests.kt
This commit is contained in:
Thomas Schroeter 2018-07-11 14:56:03 +01:00
commit baabf8ceb9
69 changed files with 549 additions and 99 deletions

View File

@ -48,7 +48,7 @@ class BlacklistKotlinClosureTest : IntegrationTest() {
@Test @Test
fun `closure sent via RPC`() { fun `closure sent via RPC`() {
driver(DriverParameters(startNodesInProcess = true)) { driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
val rpc = startNode(providedName = ALICE_NAME).getOrThrow().rpc val rpc = startNode(providedName = ALICE_NAME).getOrThrow().rpc
val packet = Packet { EVIL } val packet = Packet { EVIL }
assertThatExceptionOfType(RPCException::class.java) assertThatExceptionOfType(RPCException::class.java)
@ -56,4 +56,4 @@ class BlacklistKotlinClosureTest : IntegrationTest() {
.withMessageContaining("is not on the whitelist or annotated with @CordaSerializable") .withMessageContaining("is not on the whitelist or annotated with @CordaSerializable")
} }
} }
} }

View File

@ -54,7 +54,7 @@ class FlowsExecutionModeRpcTest : IntegrationTest() {
assumeFalse(System.getProperty("os.name").toLowerCase().startsWith("win")) assumeFalse(System.getProperty("os.name").toLowerCase().startsWith("win"))
val user = User("mark", "dadada", setOf(invokeRpc("setFlowsDrainingModeEnabled"), invokeRpc("isFlowsDrainingModeEnabled"))) val user = User("mark", "dadada", setOf(invokeRpc("setFlowsDrainingModeEnabled"), invokeRpc("isFlowsDrainingModeEnabled")))
driver(DriverParameters(inMemoryDB = false, startNodesInProcess = true)) { driver(DriverParameters(inMemoryDB = false, startNodesInProcess = true, notarySpecs = emptyList())) {
val nodeName = { val nodeName = {
val nodeHandle = startNode(rpcUsers = listOf(user)).getOrThrow() val nodeHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
val nodeName = nodeHandle.nodeInfo.chooseIdentity().name val nodeName = nodeHandle.nodeInfo.chooseIdentity().name

View File

@ -11,7 +11,7 @@
gradlePluginsVersion=4.0.25 gradlePluginsVersion=4.0.25
kotlinVersion=1.2.51 kotlinVersion=1.2.51
platformVersion=4 platformVersion=4
guavaVersion=21.0 guavaVersion=25.1-jre
proguardVersion=6.0.3 proguardVersion=6.0.3
bouncycastleVersion=1.57 bouncycastleVersion=1.57
typesafeConfigVersion=1.3.1 typesafeConfigVersion=1.3.1

View File

@ -0,0 +1,111 @@
Deploying Corda to Corda Testnet from an AWS Cloud Platform VM
==============================================================
.. contents::
This document explains how to deploy a Corda node to AWS that can connect directly to the Corda Testnet.
A self service download link can be obtained from https://testnet.corda.network. This
document will describe how to set up a virtual machine on the AWS
Cloud Platform to deploy your pre-configured Corda node and automatically connnect
to Testnet.
Pre-requisites
--------------
* Ensure you have a registered Amazon AWS account which can create virtual machines and you are logged on to the AWS console: https://console.aws.amazon.com.
Deploy Corda node
-----------------
Browse to https://console.aws.amazon.com and log in with your AWS account.
**STEP 1: Launch a new virtual machine**
Click on Launch a virtual machine with EC2.
.. image:: resources/aws-launch.png
In the quick start wizard scroll down and select the most recent Ubuntu machine image as the Amazon Machine Image (AMI).
.. image:: resources/aws_select_ubuntu.png
Select the instance type (for example t2.xlarge).
.. image:: resources/aws-instance-type.png
Configure a couple of other settings before we review and launch
Under the storage tab (Step 4) increase the storage to 40GB:
.. image:: resources/aws-storage.png
Configure the security group (Step 6) to open the firewall ports which Corda uses.
.. image:: resources/aws-firewall.png
Add a firewall rule for port range 10002-10003 and allow connection from Anywhere. Add another rule for the webserver on port 8080.
Click on the Review and Launch button then if everything looks ok click Launch.
You will be prompted to set up keys to securely access the VM remotely over ssh. Select "Create a new key pair" from the drop down and enter a name for the key file. Click download to get the keys and keep them safe on your local machine.
.. note:: These keys are just for connecting to your VM and are separate from the keys Corda will use to sign transactions. These keys will be generated as part of the download bundle.
.. image:: resources/aws-keys.png
Click "Launch Instances".
Click on the link to go to the Instances pages in the AWS console where after a few minutes you will be able to see your instance running.
.. image:: resources/aws-instances.png
**STEP 2: Set up static IP address**
On AWS a permanent IP address is called an Elastic IP. Click on the
"Elastic IP" link in the navigation panel on the left hand side of the console and then click on "Allocate new address":
.. image:: resources/aws-elastic.png
Follow the form then once the address is allocated click on "Actions"
then "Associate address":
.. image:: resources/aws-elastic-actions.png
Then select the instance you created for your Corda node to attach the
IP address to.
**STEP 3: Connect to your VM and set up the environment**
In the instances console click on "Connect" and follow the instructions to connect to your instance using ssh.
.. image:: resources/aws-instances-connect.png
.. image:: resources/aws-connect.png
**STEP 4: Download and set up your Corda node**
Now your AWS environment is configured you can switch back to the Testnet
web application and click on the copy to clipboard button to get a one
time installation script.
.. note:: If you have not already set up your account on Testnet then please visit https://testnet.corda.network and sign up.
.. image:: resources/testnet-platform.png
You can generate as many Testnet identites as you like by refreshing
this page to generate a new one time link.
In the terminal of your cloud instance paste the command you just copied to install and run
your unique Corda instance on that instance:
.. code:: bash
sudo ONE_TIME_DOWNLOAD_KEY=YOUR_UNIQUE_DOWNLOAD_KEY_HERE bash -c "$(curl -L https://testnet.corda.network/api/user/node/install.sh)"
.. warning:: This command will execute the install script as ROOT on your cloud instance. You may wish to examine the script prior to executing it on your machine.
You can now navigate to the external web address of the instance and
see any cordapps running on port 8080 (if you have any installed).

View File

@ -0,0 +1,135 @@
Deploying Corda to Corda Testnet from an Azure Cloud Platform VM
================================================================
.. contents::
This document explains how to deploy a Corda node to Azure that can connect directly to the Corda Testnet. A self service download link can be obtained from https://testnet.corda.network. This document will describe how to set up a virtual machine on the Azure Cloud Platform to deploy your pre-configured Corda node and automatically connnect to Testnet.
Pre-requisites
--------------
* Ensure you have a registered Microsoft Azure account which can create virtual machines and you are logged on to the Azure portal: https://portal.azure.com.
Deploy Corda node
-----------------
Browse to https://portal.azure.com and log in with your Microsoft account.
**STEP 1: Create a Resource Group**
Click on the "Resource groups" link in the side nav in the Azure
Portal and then click "Add":
.. image:: resources/azure-rg.png
Fill in the form and click "Create":
.. image:: resources/azure-rg-2.png
**STEP 2: Launch the VM**
At the top of the left sidenav click on the button with the green cross "Create a resource".
In this example we are going to use an Ubuntu server so select the latest Ubuntu Server option.
.. image:: resources/azure-select-ubuntu.png
Fill in the form:
.. image:: resources/azure-vm-form.png
Add a username (to log into the VM) and choose and enter a password.
Choose the resource group we created earlier from the "Use existing" dropdown.
Select a cloud region geographically near to your location to host your VM.
Click on OK.
Choose the "D4S_V3 Standard" option and click "Select":
.. image:: resources/azure-instance-type.png
Click on "Public IP address" to open the settings panel
.. image:: resources/azure-vm-settings.png
Set the IP address to "Static" under Assignment.
.. note:: This is so the IP address for your node does not change rapidly in the global network map.
.. image:: resources/azure-set-static-ip.png
Click OK.
Next click on "Network security group (firewall)":
.. image:: resources/azure-nsg.png
Add inbound rules for ports 8080 (webserver), and
10002-10003 for the P2P and RPC ports used by the Corda node
respectively:
Add 3 rules with the following port, name and priorities:
.. code:: bash
Port range: 10002, Priority: 1041 Name: Port_10002
Port range: 10003, Priority: 1042 Name: Port_10003
Port range: 8080, Priority: 1043 Name: Port_8080
.. note:: The priority has to be unique number in the range 900
(highest) and 4096 (lowest) priority. Make sure each rule
has a unique priority or there will be a validation failure and error message.
.. image:: resources/azure-nsg-2.png
Click OK and OK again on the Settings panel.
.. image:: resources/azure-settings-ok.png
Click "Create" and wait a few minutes for your instance to provision
and start running.
.. image:: resources/azure-create-vm.png
**STEP 3: Connect to your VM and set up the environment**
Once your instance is running click on the "Connect" button and copy the ssh command:
.. image:: resources/azure-ssh.png
Enter the ssh command into your terminal. At the prompt to continue connecting type yes and then enter the password you configured earlier to log into the remote VM:
.. image:: resources/azure-shell.png
**STEP 4: Download and set up your Corda node**
Now your Azure environment is configured you can switch to the Testnet
web application and click on the copy to clipboard button to get a one
time installation script.
.. note:: If you have not already set up your account on Testnet then please visit https://testnet.corda.network and sign up.
.. image:: resources/testnet-platform.png
You can generate as many Testnet identites as you like by refreshing
this page to generate a new one time link.
In the terminal of your cloud instance paste the command you just copied to install and run
your unique Corda node:
.. code:: bash
sudo ONE_TIME_DOWNLOAD_KEY=YOUR_UNIQUE_DOWNLOAD_KEY_HERE bash -c "$(curl -L https://testnet.corda.network/api/user/node/install.sh)"
.. warning:: This command will execute the install script as ROOT on your cloud instance. You may wish to examine the script prior to executing it on your machine.
You can now navigate to the external web address of the instance and
see any cordapps running on port 8080 (if you have any installed).

View File

@ -9,4 +9,8 @@ Networks
permissioning permissioning
network-map network-map
versioning versioning
corda-testnet-intro
azure-vm-explore
aws-vm-explore
gcp-vm
cipher-suites cipher-suites

View File

@ -0,0 +1,75 @@
The Corda Testnet
=================
.. contents::
The Corda Testnet is an open public network of Corda nodes on the internet. It is designed to be a complement to *the* Corda Network where any entity can transact real world value with any other counterparty in the context of any application. The Corda Testnet is designed for "non-production" use in a genuine global context of Corda nodes, including but not limited to CorDapp development, multi-party testing, demonstration and showcasing of applications and services, learning, training and development of the Corda platform technology and specific applications of Corda.
The Corda Testnet is based on exactly the same technology as the main Corda Network, but can be joined on a self-service basis through the automated provisioning system described below.
The Corda Testnet is currently in private beta. Interested parties can request in invitation to join the Corda Testnet by completing a short request form (see below).
Deploying a Corda node to the Corda Testnet
-------------------------------------------
Access to the Corda Testnet is enabled by visiting https://testnet.corda.network.
.. image:: resources/testnet-landing.png
:target: https://testnet.corda.network
Click on "Join the Corda Testnet".
Select whether you want to register a company or as an individual on the Testnet.
This will create you an account with the Testnet onboarding application which will enable you to provision and manage multiple Corda nodes on Testnet. You will log in to this account to view and manage you Corda Testnet identitiy certificates.
.. image:: resources/testnet-account-type.png
Fill in the form with your details. This helps prioritise requests to join the private beta.
.. image:: resources/testnet-form.png
Note we currently only support federated login using either Google email accounts or Github enabled email accounts. Please ensure the email you use to register is either set up as a Google or Github account and that you use this email to log in with the appropriate service.
To enable your email for Google please see https://support.google.com/accounts/answer/176347?hl=en
To set up a Github account please see https://github.com/join
Once you have been approved to join the beta you will receive an email. Follow the link in the email to sign in or click on "I have an invitation" on the https://testnet.corda.network
Sign in using either the Google or Github login services:
.. image:: resources/testnet-signin.png
When prompted approve the Testnet application:
.. image:: resources/testnet-signin-auth.png
At this point you may need to verify your email address is valid. If prompted check your email and click on the link to validate then return to the sign in page and sign in again.
Next agree to the terms of service:
.. image:: resources/testnet-terms.png
You can now choose how to deploy your Corda node to the Corda Testnet. We strongly recommend hosting your Corda node on a public cloud resource.
.. note:: If you host your node on your own machine or a corporate server you must ensure it is reachable from the public internet at a specific IP address. This will typically require port forwarding on your router.
Select the cloud provider you wish to use for documentation on how to specifically configure Corda for that environment.
.. image:: resources/testnet-platform-clean.png
Once your cloud instance is set up you can install and run your Testnet pre-provisioned Corda node by clicking on "Copy" and pasting the one time link into your cloud shell.
The installation script will download the Corda binaries as well as your PKI certificates, private keys and suporting files and will install and run Corda on your fresh cloud VM. Your node will register itself with the Corda Testnet when it first runs and be added to the global network map and be visible to counterparties after approximately 5 minutes.
Hosting a Corda node locally is possible but will require manually configuring firewall and port forwarding on your local router. If you want this option then click on the "Download" button to download a Zip file with a pre-configured Corda node.
A note on identities on Corda Testnet
-------------------------------------
Unlike the main Corda Network, which is designed for verified real world identities, The Corda Testnet automatically assigns a "distinguished name" as your identity on the network. This is to prevent name abuse such as the use of offensive language in the names or name squatting. This allows the provision of a node to be automatic and instantaneous. It also enables the same user to safely generate many nodes without accidental name conflicts. If you require a human readable name then please contact support and a partial organsation name can be approved.

120
docs/source/gcp-vm.rst Normal file
View File

@ -0,0 +1,120 @@
Deploying Corda to Corda Testnet from a Google Cloud Platform VM
================================================================
.. contents::
This document explains how to deploy a Corda node to Google Cloud Platform that can connect directly to the Corda Testnet. A self service download link can be obtained from https://testnet.corda.network. This document will describe how to set up a virtual machine on the Google Cloud Platform (GCP) to deploy your pre-configured Corda node and automatically connnect to Testnet.
Pre-requisites
--------------
* Ensure you have a registered Google Cloud Platform account with
billing enabled (https://cloud.google.com/billing/docs/how-to/manage-billing-account) which can create virtual machines under your subscription(s) and you are logged on to the GCP console: https://console.cloud.google.com.
Deploy Corda node
-----------------
Browse to https://console.cloud.google.com and log in with your
Google credentials.
**STEP 1: Create a GCP Project**
In the project drop down click on the plus icon to create a new
project to house your Corda resources.
.. image:: resources/consolegcp.png
.. image:: resources/console2.png
.. image:: resources/newprojectgcp.png
Enter a project name and click Create.
**STEP 2: Launch the VM**
In the left hand side nav click on Compute Engine.
.. image:: resources/gcpcompute.png
Click on Create Instance.
.. image:: resources/consolegcpcreatevm.png
Fill in the form with the desired VM specs:
Recommended minimum 4vCPU with 15GB memory and 40GB Persistent disk.
Ubuntu 16.04 LTS.
Allow full API access.
Dont worry about firewall settings as you will configure those later.
.. image:: resources/gcpconsolevmsettings.png
Click Create and wait a few sections for your instance to provision
and start running.
**STEP 3: Connect to your VM and set up the environment**
Once your instance is running click on the SSH button to launch a
cloud SSH terminal in a new window.
.. image:: resources/gcpconsolelaunchssh.png
.. image:: resources/gcpshell.png
Run the following to configure the firewall to allow Corda traffic
.. code:: bash
gcloud compute firewall-rules create nodetonode --allow tcp:10002
gcloud compute firewall-rules create nodetorpc --allow tcp:10003
gcloud compute firewall-rules create webserver --allow tcp:8080
Promote the ephemeral IP address associated with this
instance to a static IP address.
First check the region and select the one you are using from the list:
.. code:: bash
gcloud compute regions list
Find your external IP:
.. code:: bash
gcloud compute addresses list
Run this command with the ephemeral IP address as the argument to
the --addresses flag and the region:
.. code:: bash
gcloud compute addresses create corda-node --addresses 35.204.53.61 --region europe-west4
**STEP 4: Download and set up your Corda node**
Now your GCP environment is configured you can switch to the Testnet
web application and click on the copy to clipboard button to get a one
time installation script.
.. note:: If you have not already set up your account on Testnet then please visit https://testnet.corda.network and sign up.
.. image:: resources/testnet-platform.png
You can generate as many Testnet identites as you like by refreshing
this page to generate a new one time link.
In the terminal of your cloud instance paste the command you just copied to install and run
your unique Corda instance:
.. code:: bash
sudo ONE_TIME_DOWNLOAD_KEY=YOUR_UNIQUE_DOWNLOAD_KEY_HERE bash -c "$(curl -L https://testnet.corda.network/api/user/node/install.sh)"
.. warning:: This command will execute the install script as ROOT on your cloud instance. You may wish to examine the script prior to executing it on your machine.
You can now navigate to the external web address of the instance and
see any cordapps running on port 8080 (if you have any installed).

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@ -31,7 +31,7 @@ class CashExceptionSerialisationTest : IntegrationTest() {
@Test @Test
fun `cash exception with a cause can be serialised with AMQP`() { fun `cash exception with a cause can be serialised with AMQP`() {
driver(DriverParameters(startNodesInProcess = true)) { driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
val node = startNode(rpcUsers = listOf(User("mark", "dadada", setOf(all())))).getOrThrow() val node = startNode(rpcUsers = listOf(User("mark", "dadada", setOf(all())))).getOrThrow()
val action = { node.rpc.startFlow(::CashExceptionThrowingFlow).returnValue.getOrThrow() } val action = { node.rpc.startFlow(::CashExceptionThrowingFlow).returnValue.getOrThrow() }
assertThatThrownBy(action).isInstanceOfSatisfying(CashException::class.java) { thrown -> assertThatThrownBy(action).isInstanceOfSatisfying(CashException::class.java) { thrown ->

View File

@ -18,6 +18,7 @@ import net.corda.testing.core.ALICE_NAME
import net.corda.testing.core.BOB_NAME import net.corda.testing.core.BOB_NAME
import net.corda.testing.core.DUMMY_BANK_A_NAME import net.corda.testing.core.DUMMY_BANK_A_NAME
import net.corda.testing.core.DUMMY_NOTARY_NAME import net.corda.testing.core.DUMMY_NOTARY_NAME
import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.driver import net.corda.testing.driver.driver
import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTest
import net.corda.testing.internal.IntegrationTestSchemas import net.corda.testing.internal.IntegrationTestSchemas
@ -35,10 +36,10 @@ class CashConfigDataFlowTest : IntegrationTest() {
} }
@Test @Test
fun `issuable currencies are read in from node config`() { fun `issuable currencies are read in from node config`() {
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(customOverrides = mapOf("custom" to mapOf("issuableCurrencies" to listOf("EUR", "USD")))).getOrThrow() val node = startNode(customOverrides = mapOf("custom" to mapOf("issuableCurrencies" to listOf("EUR", "USD")))).getOrThrow()
val config = node.rpc.startFlow(::CashConfigDataFlow).returnValue.getOrThrow() val config = node.rpc.startFlow(::CashConfigDataFlow).returnValue.getOrThrow()
assertThat(config.issuableCurrencies).containsExactly(EUR, USD) assertThat(config.issuableCurrencies).containsExactly(EUR, USD)
} }
} }
} }

View File

@ -44,30 +44,15 @@ import java.io.ObjectOutputStream
import java.io.Serializable import java.io.Serializable
import kotlin.test.assertEquals import kotlin.test.assertEquals
class BootTests : IntegrationTest() { class BootTests {
companion object {
@ClassRule
@JvmField
val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(), DUMMY_NOTARY_NAME.toDatabaseSchemaName())
}
@Test @Test
fun `java deserialization is disabled`() { fun `java deserialization is disabled`() {
val user = User("u", "p", setOf(startFlow<ObjectInputStreamFlow>())) driver(DriverParameters(notarySpecs = emptyList())) {
val params = NodeParameters(rpcUsers = listOf(user)) val user = User("u", "p", setOf(startFlow<ObjectInputStreamFlow>()))
val future = CordaRPCClient(startNode(rpcUsers = listOf(user)).getOrThrow().rpcAddress).
fun NodeHandle.attemptJavaDeserialization() { start(user.username, user.password).proxy.startFlow(::ObjectInputStreamFlow).returnValue
CordaRPCClient(rpcAddress).use(user.username, user.password) { connection -> assertThatThrownBy { future.getOrThrow() }
connection.proxy .isInstanceOf(CordaRuntimeException::class.java)
rpc.startFlow(::ObjectInputStreamFlow).returnValue.getOrThrow()
}
}
driver {
val devModeNode = startNode(params, BOB_NAME).getOrThrow()
val node = startNode(ALICE_NAME, devMode = false, parameters = params).getOrThrow()
assertThatThrownBy { devModeNode.attemptJavaDeserialization() }.isInstanceOf(CordaRuntimeException::class.java)
assertThatThrownBy { node.attemptJavaDeserialization() }.isInstanceOf(InternalNodeException::class.java)
} }
} }

View File

@ -23,6 +23,7 @@ import net.corda.testing.core.ALICE_NAME
import net.corda.testing.core.BOB_NAME import net.corda.testing.core.BOB_NAME
import net.corda.testing.core.DUMMY_NOTARY_NAME import net.corda.testing.core.DUMMY_NOTARY_NAME
import net.corda.testing.core.singleIdentity import net.corda.testing.core.singleIdentity
import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.driver import net.corda.testing.driver.driver
import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTest
import net.corda.testing.internal.IntegrationTestSchemas import net.corda.testing.internal.IntegrationTestSchemas
@ -44,7 +45,7 @@ class CordappScanningDriverTest : IntegrationTest() {
fun `sub-classed initiated flow pointing to the same initiating flow as its super-class`() { fun `sub-classed initiated flow pointing to the same initiating flow as its super-class`() {
val user = User("u", "p", setOf(startFlow<ReceiveFlow>())) val user = User("u", "p", setOf(startFlow<ReceiveFlow>()))
// The driver will automatically pick up the annotated flows below // The driver will automatically pick up the annotated flows below
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val (alice, bob) = listOf( val (alice, bob) = listOf(
startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)), startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)),
startNode(providedName = BOB_NAME)).transpose().getOrThrow() startNode(providedName = BOB_NAME)).transpose().getOrThrow()

View File

@ -24,6 +24,7 @@ import net.corda.testing.internal.IntegrationTestSchemas
import net.corda.testing.internal.toDatabaseSchemaName import net.corda.testing.internal.toDatabaseSchemaName
import org.junit.Assert import org.junit.Assert
import org.junit.ClassRule import org.junit.ClassRule
import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -38,16 +39,16 @@ class NodeUnloadHandlerTests : IntegrationTest() {
@Test @Test
fun `should be able to register run on stop lambda`() { fun `should be able to register run on stop lambda`() {
driver(DriverParameters(startNodesInProcess = true, extraCordappPackagesToScan = listOf("net.corda.node"))) { driver(DriverParameters(startNodesInProcess = true, extraCordappPackagesToScan = listOf("net.corda.node"), notarySpecs = emptyList())) {
startNode(providedName = DUMMY_BANK_A_NAME).getOrThrow() startNode(providedName = DUMMY_BANK_A_NAME).getOrThrow()
// just want to fall off the end of this for the mo... // just want to fall off the end of this for the mo...
} }
Assert.assertTrue("Timed out waiting for AbstractNode to invoke the test service shutdown callback", latch.await(30, TimeUnit.SECONDS)) assertTrue("Timed out waiting for AbstractNode to invoke the test service shutdown callback", latch.await(30, TimeUnit.SECONDS))
} }
@Suppress("unused")
@CordaService @CordaService
class RunOnStopTestService(serviceHub: ServiceHub) : SingletonSerializeAsToken() { class RunOnStopTestService(serviceHub: ServiceHub) : SingletonSerializeAsToken() {
companion object { companion object {
private val log = contextLogger() private val log = contextLogger()
} }
@ -56,9 +57,9 @@ class NodeUnloadHandlerTests : IntegrationTest() {
serviceHub.registerUnloadHandler(this::shutdown) serviceHub.registerUnloadHandler(this::shutdown)
} }
fun shutdown() { private fun shutdown() {
log.info("shutting down") log.info("shutting down")
latch.countDown() latch.countDown()
} }
} }
} }

View File

@ -46,11 +46,13 @@ class FlowRetryTest : IntegrationTest() {
val numSessions = 2 val numSessions = 2
val numIterations = 10 val numIterations = 10
val user = User("mark", "dadada", setOf(Permissions.startFlow<InitiatorFlow>())) val user = User("mark", "dadada", setOf(Permissions.startFlow<InitiatorFlow>()))
val result: Any? = driver(DriverParameters(startNodesInProcess = isQuasarAgentSpecified(), val result: Any? = driver(DriverParameters(
portAllocation = RandomFree)) { startNodesInProcess = isQuasarAgentSpecified(),
portAllocation = RandomFree,
val nodeAHandle = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)).getOrThrow() notarySpecs = emptyList()
val nodeBHandle = startNode(providedName = BOB_NAME, rpcUsers = listOf(user)).getOrThrow() )) {
val nodeAHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
val nodeBHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
val result = CordaRPCClient(nodeAHandle.rpcAddress).start(user.username, user.password).use { val result = CordaRPCClient(nodeAHandle.rpcAddress).start(user.username, user.password).use {
it.proxy.startFlow(::InitiatorFlow, numSessions, numIterations, nodeBHandle.nodeInfo.singleIdentity()).returnValue.getOrThrow() it.proxy.startFlow(::InitiatorFlow, numSessions, numIterations, nodeBHandle.nodeInfo.singleIdentity()).returnValue.getOrThrow()
@ -165,4 +167,4 @@ data class SessionInfo(val sessionNum: Int, val iterationsCount: Int)
enum class Step { First, BeforeInitiate, AfterInitiate, AfterInitiateSendReceive, BeforeSend, AfterSend, BeforeReceive, AfterReceive } enum class Step { First, BeforeInitiate, AfterInitiate, AfterInitiateSendReceive, BeforeSend, AfterSend, BeforeReceive, AfterReceive }
data class Visited(val sessionNum: Int, val iterationNum: Int, val step: Step) data class Visited(val sessionNum: Int, val iterationNum: Int, val step: Step)

View File

@ -68,9 +68,7 @@ class P2PFlowsDrainingModeTest : IntegrationTest() {
@Test @Test
fun `flows draining mode suspends consumption of initial session messages`() { fun `flows draining mode suspends consumption of initial session messages`() {
driver(DriverParameters(startNodesInProcess = false, portAllocation = portAllocation, notarySpecs = emptyList())) {
driver(DriverParameters(startNodesInProcess = false, portAllocation = portAllocation)) {
val initiatedNode = startNode(providedName = ALICE_NAME).getOrThrow() val initiatedNode = startNode(providedName = ALICE_NAME).getOrThrow()
val initiating = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow().rpc val initiating = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow().rpc
val counterParty = initiatedNode.nodeInfo.singleIdentity() val counterParty = initiatedNode.nodeInfo.singleIdentity()
@ -100,9 +98,7 @@ class P2PFlowsDrainingModeTest : IntegrationTest() {
@Test @Test
fun `clean shutdown by draining`() { fun `clean shutdown by draining`() {
driver(DriverParameters(startNodesInProcess = true, portAllocation = portAllocation, notarySpecs = emptyList())) {
driver(DriverParameters(startNodesInProcess = true, portAllocation = portAllocation)) {
val nodeA = startNode(providedName = ALICE_NAME, rpcUsers = users).getOrThrow() val nodeA = startNode(providedName = ALICE_NAME, rpcUsers = users).getOrThrow()
val nodeB = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow() val nodeB = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow()
var successful = false var successful = false

View File

@ -44,11 +44,8 @@ class RpcFlowsDrainingModeTest : IntegrationTest() {
@Test @Test
fun `flows draining mode rejects start flows commands through rpc`() { fun `flows draining mode rejects start flows commands through rpc`() {
driver(DriverParameters(startNodesInProcess = false, portAllocation = portAllocation, notarySpecs = emptyList())) {
driver(DriverParameters(startNodesInProcess = false, portAllocation = portAllocation)) {
startNode(rpcUsers = users).getOrThrow().rpc.apply { startNode(rpcUsers = users).getOrThrow().rpc.apply {
setFlowsDrainingModeEnabled(true) setFlowsDrainingModeEnabled(true)
val error: Throwable? = catchThrowable { startFlow(RpcFlowsDrainingModeTest::NoOpFlow) } val error: Throwable? = catchThrowable { startFlow(RpcFlowsDrainingModeTest::NoOpFlow) }
@ -61,11 +58,9 @@ class RpcFlowsDrainingModeTest : IntegrationTest() {
@StartableByRPC @StartableByRPC
class NoOpFlow : FlowLogic<Unit>() { class NoOpFlow : FlowLogic<Unit>() {
@Suspendable @Suspendable
override fun call() { override fun call() {
println("NO OP!") println("NO OP!")
} }
} }
} }

View File

@ -123,25 +123,28 @@ class AttachmentLoadingTests : IntegrationTest() {
} }
@Test @Test
fun `test that attachments retrieved over the network are not used for code`() = withoutTestSerialization { fun `test that attachments retrieved over the network are not used for code`() {
driver(DriverParameters(startNodesInProcess = true)) { withoutTestSerialization {
installIsolatedCordappTo(bankAName) driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
val (bankA, bankB) = createTwoNodes() installIsolatedCordappTo(bankAName)
assertFailsWith<CordaRuntimeException>("Party C=CH,L=Zurich,O=BankB rejected session request: Don't know net.corda.finance.contracts.isolated.IsolatedDummyFlow\$Initiator") { val (bankA, bankB) = createTwoNodes()
bankA.rpc.startFlowDynamic(flowInitiatorClass, bankB.nodeInfo.legalIdentities.first()).returnValue.getOrThrow() assertFailsWith<CordaRuntimeException>("Party C=CH,L=Zurich,O=BankB rejected session request: Don't know net.corda.finance.contracts.isolated.IsolatedDummyFlow\$Initiator") {
bankA.rpc.startFlowDynamic(flowInitiatorClass, bankB.nodeInfo.legalIdentities.first()).returnValue.getOrThrow()
}
} }
Unit
} }
Unit
} }
@Test @Test
fun `tests that if the attachment is loaded on both sides already that a flow can run`() = withoutTestSerialization { fun `tests that if the attachment is loaded on both sides already that a flow can run`() {
driver { withoutTestSerialization {
installIsolatedCordappTo(bankAName) driver {
installIsolatedCordappTo(bankBName) installIsolatedCordappTo(bankAName)
val (bankA, bankB) = createTwoNodes() installIsolatedCordappTo(bankBName)
bankA.rpc.startFlowDynamic(flowInitiatorClass, bankB.nodeInfo.legalIdentities.first()).returnValue.getOrThrow() val (bankA, bankB) = createTwoNodes()
bankA.rpc.startFlowDynamic(flowInitiatorClass, bankB.nodeInfo.legalIdentities.first()).returnValue.getOrThrow()
}
} }
Unit
} }
} }

View File

@ -70,7 +70,7 @@ class RpcSslTest : IntegrationTest() {
val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert) val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert)
val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password") val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password")
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
val node = startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow() val node = startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow()
val client = CordaRPCClient.createWithSsl(node.rpcAddress, sslConfiguration = clientSslOptions) val client = CordaRPCClient.createWithSsl(node.rpcAddress, sslConfiguration = clientSslOptions)
val connection = client.start(user.username, user.password) val connection = client.start(user.username, user.password)
@ -108,7 +108,7 @@ class RpcSslTest : IntegrationTest() {
val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert1) val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert1)
val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password") val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password")
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
val node = startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow() val node = startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow()
Assertions.assertThatThrownBy { Assertions.assertThatThrownBy {
val connection = CordaRPCClient.createWithSsl(node.rpcAddress, sslConfiguration = clientSslOptions).start(user.username, user.password) val connection = CordaRPCClient.createWithSsl(node.rpcAddress, sslConfiguration = clientSslOptions).start(user.username, user.password)
@ -128,7 +128,7 @@ class RpcSslTest : IntegrationTest() {
fun `RPC client not using ssl can run commands`() { fun `RPC client not using ssl can run commands`() {
val user = User("mark", "dadada", setOf(all())) val user = User("mark", "dadada", setOf(all()))
var successful = false var successful = false
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
val node = startNode(rpcUsers = listOf(user)).getOrThrow() val node = startNode(rpcUsers = listOf(user)).getOrThrow()
val connection = CordaRPCClient(node.rpcAddress).start(user.username, user.password) val connection = CordaRPCClient(node.rpcAddress).start(user.username, user.password)
connection.proxy.apply { connection.proxy.apply {
@ -148,7 +148,7 @@ class RpcSslTest : IntegrationTest() {
val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert) val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert)
val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password") val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password")
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
val node = startNode(customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow() val node = startNode(customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow()
val client = CordaRPCClient.createWithSsl(node.rpcAddress, sslConfiguration = clientSslOptions) val client = CordaRPCClient.createWithSsl(node.rpcAddress, sslConfiguration = clientSslOptions)

View File

@ -43,7 +43,7 @@ class HardRestartTest : IntegrationTest() {
@StartableByRPC @StartableByRPC
@InitiatingFlow @InitiatingFlow
class Ping(val pongParty: Party, val times: Int) : FlowLogic<Unit>() { class Ping(private val pongParty: Party, val times: Int) : FlowLogic<Unit>() {
@Suspendable @Suspendable
override fun call() { override fun call() {
val pongSession = initiateFlow(pongParty) val pongSession = initiateFlow(pongParty)
@ -56,7 +56,7 @@ class HardRestartTest : IntegrationTest() {
} }
@InitiatedBy(Ping::class) @InitiatedBy(Ping::class)
class Pong(val pingSession: FlowSession) : FlowLogic<Unit>() { class Pong(private val pingSession: FlowSession) : FlowLogic<Unit>() {
@Suspendable @Suspendable
override fun call() { override fun call() {
val times = pingSession.sendAndReceive<Int>(Unit).unwrap { it } val times = pingSession.sendAndReceive<Int>(Unit).unwrap { it }
@ -70,7 +70,12 @@ class HardRestartTest : IntegrationTest() {
@Test @Test
fun restartShortPingPongFlowRandomly() { fun restartShortPingPongFlowRandomly() {
val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all())) val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all()))
driver(DriverParameters(startNodesInProcess = false, inMemoryDB = false, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString()))) { driver(DriverParameters(
startNodesInProcess = false,
inMemoryDB = false,
notarySpecs = emptyList(),
systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())
)) {
val (a, b) = listOf( val (a, b) = listOf(
startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")), startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")),
startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000")) startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000"))
@ -102,7 +107,12 @@ class HardRestartTest : IntegrationTest() {
@Test @Test
fun restartLongPingPongFlowRandomly() { fun restartLongPingPongFlowRandomly() {
val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all())) val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all()))
driver(DriverParameters(startNodesInProcess = false, inMemoryDB = false, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString()))) { driver(DriverParameters(
startNodesInProcess = false,
inMemoryDB = false,
notarySpecs = emptyList(),
systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())
)) {
val (a, b) = listOf( val (a, b) = listOf(
startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")), startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")),
startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000")) startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000"))
@ -134,7 +144,12 @@ class HardRestartTest : IntegrationTest() {
@Test @Test
fun softRestartLongPingPongFlowRandomly() { fun softRestartLongPingPongFlowRandomly() {
val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all())) val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all()))
driver(DriverParameters(startNodesInProcess = false, inMemoryDB = false, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString()))) { driver(DriverParameters(
startNodesInProcess = false,
inMemoryDB = false,
notarySpecs = emptyList(),
systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())
)) {
val (a, b) = listOf( val (a, b) = listOf(
startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")), startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")),
startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000")) startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000"))
@ -197,20 +212,25 @@ class HardRestartTest : IntegrationTest() {
@InitiatingFlow @InitiatingFlow
@InitiatedBy(RecursiveA::class) @InitiatedBy(RecursiveA::class)
class RecursiveB(val otherSession: FlowSession) : FlowLogic<Unit>() { class RecursiveB(private val otherSession: FlowSession) : FlowLogic<Unit>() {
@Suspendable @Suspendable
override fun call() { override fun call() {
val depth = otherSession.receive<Int>().unwrap { it } val depth = otherSession.receive<Int>().unwrap { it }
val newSession = initiateFlow(otherSession.counterparty) val newSession = initiateFlow(otherSession.counterparty)
val string = newSession.sendAndReceive<String>(depth - 1).unwrap { it } val string = newSession.sendAndReceive<String>(depth - 1).unwrap { it }
otherSession.send(string + ":" + depth) otherSession.send("$string:$depth")
} }
} }
@Test @Test
fun restartRecursiveFlowRandomly() { fun restartRecursiveFlowRandomly() {
val demoUser = User("demo", "demo", setOf(Permissions.startFlow<RecursiveA>(), Permissions.all())) val demoUser = User("demo", "demo", setOf(Permissions.startFlow<RecursiveA>(), Permissions.all()))
driver(DriverParameters(startNodesInProcess = false, inMemoryDB = false, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString()))) { driver(DriverParameters(
startNodesInProcess = false,
inMemoryDB = false,
notarySpecs = emptyList(),
systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())
)) {
val (a, b) = listOf( val (a, b) = listOf(
startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")), startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:30000")),
startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000")) startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = listOf(demoUser), customOverrides = mapOf("p2pAddress" to "localhost:40000"))

View File

@ -73,7 +73,7 @@ class DriverTests : IntegrationTest() {
@Test @Test
fun `simple node startup and shutdown`() { fun `simple node startup and shutdown`() {
val handle = driver { val handle = driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = DUMMY_REGULATOR_NAME) val node = startNode(providedName = DUMMY_REGULATOR_NAME)
nodeMustBeUp(node) nodeMustBeUp(node)
} }

View File

@ -62,12 +62,12 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
@JvmField @JvmField
val tempFolder = TemporaryFolder() val tempFolder = TemporaryFolder()
val testName = X500Principal("CN=Test,O=R3 Ltd,L=London,C=GB") private val testName = X500Principal("CN=Test,O=R3 Ltd,L=London,C=GB")
@Test @Test
fun `shell should not log in with invalid credentials`() { fun `shell should not log in with invalid credentials`() {
val user = User("u", "p", setOf()) val user = User("u", "p", setOf())
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
val nodeFuture = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), startInSameProcess = true) val nodeFuture = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), startInSameProcess = true)
val node = nodeFuture.getOrThrow() val node = nodeFuture.getOrThrow()
@ -83,7 +83,7 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
@Test @Test
fun `shell should log in with valid credentials`() { fun `shell should log in with valid credentials`() {
val user = User("u", "p", setOf()) val user = User("u", "p", setOf())
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val nodeFuture = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), startInSameProcess = true) val nodeFuture = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), startInSameProcess = true)
val node = nodeFuture.getOrThrow() val node = nodeFuture.getOrThrow()
@ -108,7 +108,7 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert) val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert)
val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password") val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password")
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow().use { node -> startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow().use { node ->
val conf = ShellConfiguration(commandsDirectory = Files.createTempDir().toPath(), val conf = ShellConfiguration(commandsDirectory = Files.createTempDir().toPath(),
@ -136,7 +136,7 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert1) val trustStorePath = saveToTrustStore(tempFolder.root.toPath() / "truststore.jks", cert1)
val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password") val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password")
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow().use { node -> startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow().use { node ->
val conf = ShellConfiguration(commandsDirectory = Files.createTempDir().toPath(), val conf = ShellConfiguration(commandsDirectory = Files.createTempDir().toPath(),
@ -153,7 +153,7 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
@Test @Test
fun `internal shell user should not be able to connect if node started with devMode=false`() { fun `internal shell user should not be able to connect if node started with devMode=false`() {
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
startNode().getOrThrow().use { node -> startNode().getOrThrow().use { node ->
val conf = (node as NodeHandleInternal).configuration.toShellConfig() val conf = (node as NodeHandleInternal).configuration.toShellConfig()
InteractiveShell.startShellInternal(conf) InteractiveShell.startShellInternal(conf)
@ -168,7 +168,7 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
val user = User("u", "p", setOf(Permissions.startFlow<SSHServerTest.FlowICanRun>(), val user = User("u", "p", setOf(Permissions.startFlow<SSHServerTest.FlowICanRun>(),
Permissions.invokeRpc(CordaRPCOps::registeredFlows), Permissions.invokeRpc(CordaRPCOps::registeredFlows),
Permissions.invokeRpc(CordaRPCOps::nodeInfo))) Permissions.invokeRpc(CordaRPCOps::nodeInfo)))
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val nodeFuture = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), startInSameProcess = true) val nodeFuture = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), startInSameProcess = true)
val node = nodeFuture.getOrThrow() val node = nodeFuture.getOrThrow()
@ -219,7 +219,7 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password") val clientSslOptions = ClientRpcSslOptions(trustStorePath, "password")
var successful = false var successful = false
driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree)) { driver(DriverParameters(startNodesInProcess = true, portAllocation = RandomFree, notarySpecs = emptyList())) {
startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow().use { node -> startNode(rpcUsers = listOf(user), customOverrides = brokerSslOptions.useSslRpcOverrides()).getOrThrow().use { node ->
val conf = ShellConfiguration(commandsDirectory = Files.createTempDir().toPath(), val conf = ShellConfiguration(commandsDirectory = Files.createTempDir().toPath(),
@ -261,4 +261,4 @@ class InteractiveShellIntegrationTest : IntegrationTest() {
} }
} }
} }

View File

@ -37,7 +37,6 @@ import org.bouncycastle.util.io.Streams
import org.junit.ClassRule import org.junit.ClassRule
import org.junit.Ignore import org.junit.Ignore
import org.junit.Test import org.junit.Test
import java.lang.Thread.sleep
import java.net.ConnectException import java.net.ConnectException
import kotlin.test.assertTrue import kotlin.test.assertTrue
import kotlin.test.fail import kotlin.test.fail
@ -53,7 +52,7 @@ class SSHServerTest : IntegrationTest() {
fun `ssh server does not start be default`() { fun `ssh server does not start be default`() {
val user = User("u", "p", setOf()) val user = User("u", "p", setOf())
// The driver will automatically pick up the annotated flows below // The driver will automatically pick up the annotated flows below
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)) val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user))
node.getOrThrow() node.getOrThrow()
@ -64,7 +63,7 @@ class SSHServerTest : IntegrationTest() {
try { try {
session.connect() session.connect()
fail() fail()
} catch (e:JSchException) { } catch (e: JSchException) {
assertTrue(e.cause is ConnectException) assertTrue(e.cause is ConnectException)
} }
} }
@ -74,7 +73,7 @@ class SSHServerTest : IntegrationTest() {
fun `ssh server starts when configured`() { fun `ssh server starts when configured`() {
val user = User("u", "p", setOf()) val user = User("u", "p", setOf())
// The driver will automatically pick up the annotated flows below // The driver will automatically pick up the annotated flows below
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user),
customOverrides = mapOf("sshd" to mapOf("port" to 2222)) /*, startInSameProcess = true */) customOverrides = mapOf("sshd" to mapOf("port" to 2222)) /*, startInSameProcess = true */)
node.getOrThrow() node.getOrThrow()
@ -93,7 +92,7 @@ class SSHServerTest : IntegrationTest() {
fun `ssh server verify credentials`() { fun `ssh server verify credentials`() {
val user = User("u", "p", setOf()) val user = User("u", "p", setOf())
// The driver will automatically pick up the annotated flows below // The driver will automatically pick up the annotated flows below
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user),
customOverrides = mapOf("sshd" to mapOf("port" to 2222))) customOverrides = mapOf("sshd" to mapOf("port" to 2222)))
node.getOrThrow() node.getOrThrow()
@ -117,7 +116,7 @@ class SSHServerTest : IntegrationTest() {
val user = User("u", "p", setOf(startFlow<FlowICanRun>(), val user = User("u", "p", setOf(startFlow<FlowICanRun>(),
invokeRpc(CordaRPCOps::wellKnownPartyFromX500Name))) invokeRpc(CordaRPCOps::wellKnownPartyFromX500Name)))
// The driver will automatically pick up the annotated flows below // The driver will automatically pick up the annotated flows below
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user),
customOverrides = mapOf("sshd" to mapOf("port" to 2222))) customOverrides = mapOf("sshd" to mapOf("port" to 2222)))
node.getOrThrow() node.getOrThrow()
@ -146,7 +145,7 @@ class SSHServerTest : IntegrationTest() {
fun `ssh runs flows`() { fun `ssh runs flows`() {
val user = User("u", "p", setOf(startFlow<FlowICanRun>())) val user = User("u", "p", setOf(startFlow<FlowICanRun>()))
// The driver will automatically pick up the annotated flows below // The driver will automatically pick up the annotated flows below
driver { driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user), val node = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user),
customOverrides = mapOf("sshd" to mapOf("port" to 2222))) customOverrides = mapOf("sshd" to mapOf("port" to 2222)))
node.getOrThrow() node.getOrThrow()
@ -191,9 +190,10 @@ class SSHServerTest : IntegrationTest() {
override val progressTracker: ProgressTracker? = ProgressTracker(HELLO_STEP) override val progressTracker: ProgressTracker? = ProgressTracker(HELLO_STEP)
} }
@Suppress("unused")
@StartableByRPC @StartableByRPC
@InitiatingFlow @InitiatingFlow
class FlowICannotRun(val otherParty: Party) : FlowLogic<String>() { class FlowICannotRun(private val otherParty: Party) : FlowLogic<String>() {
@Suspendable @Suspendable
override fun call(): String = initiateFlow(otherParty).receive<String>().unwrap { it } override fun call(): String = initiateFlow(otherParty).receive<String>().unwrap { it }

View File

@ -18,6 +18,7 @@ import net.corda.testing.core.DUMMY_BANK_A_NAME
import net.corda.testing.core.DUMMY_NOTARY_NAME import net.corda.testing.core.DUMMY_NOTARY_NAME
import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTest
import net.corda.testing.internal.IntegrationTestSchemas import net.corda.testing.internal.IntegrationTestSchemas
import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.WebserverHandle import net.corda.testing.driver.WebserverHandle
import net.corda.testing.driver.driver import net.corda.testing.driver.driver
import net.corda.testing.node.internal.addressMustBeBound import net.corda.testing.node.internal.addressMustBeBound
@ -47,7 +48,7 @@ class WebserverDriverTests : IntegrationTest() {
@Test @Test
fun `starting a node and independent web server works`() { fun `starting a node and independent web server works`() {
val addr = driver { val addr = driver(DriverParameters(notarySpecs = emptyList())) {
val node = startNode(providedName = DUMMY_BANK_A_NAME).getOrThrow() val node = startNode(providedName = DUMMY_BANK_A_NAME).getOrThrow()
val webserverHandle = startWebserver(node).getOrThrow() val webserverHandle = startWebserver(node).getOrThrow()
webserverMustBeUp(webserverHandle) webserverMustBeUp(webserverHandle)