diff --git a/.ci/api-current.txt b/.ci/api-current.txt index 1e13bc2081..9e2af10a34 100644 --- a/.ci/api-current.txt +++ b/.ci/api-current.txt @@ -3684,20 +3684,19 @@ public final class net.corda.testing.driver.DriverParameters extends java.lang.O public final boolean getWaitForAllNodesToFinish() public int hashCode() public final boolean isDebug() - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setDebugPortAllocation(net.corda.testing.driver.PortAllocation) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setDriverDirectory(java.nio.file.Path) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setExtraCordappPackagesToScan(List) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setInitialiseSerialization(boolean) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setIsDebug(boolean) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setJmxPolicy(net.corda.testing.driver.JmxPolicy) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setNetworkParameters(net.corda.core.node.NetworkParameters) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setNotarySpecs(List) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setPortAllocation(net.corda.testing.driver.PortAllocation) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setStartNodesInProcess(boolean) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setSystemProperties(Map) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setUseTestClock(boolean) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters setWaitForAllNodesToFinish(boolean) public String toString() + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withDebugPortAllocation(net.corda.testing.driver.PortAllocation) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withDriverDirectory(java.nio.file.Path) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withExtraCordappPackagesToScan(List) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withIsDebug(boolean) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withJmxPolicy(net.corda.testing.driver.JmxPolicy) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withNetworkParameters(net.corda.core.node.NetworkParameters) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withNotarySpecs(List) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withPortAllocation(net.corda.testing.driver.PortAllocation) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withStartNodesInProcess(boolean) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withSystemProperties(Map) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withUseTestClock(boolean) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.DriverParameters withWaitForAllNodesToFinish(boolean) ## @net.corda.core.DoNotImplement public interface net.corda.testing.driver.InProcess extends net.corda.testing.driver.NodeHandle @org.jetbrains.annotations.NotNull public abstract net.corda.node.services.api.StartedNodeServices getServices() @@ -3742,13 +3741,13 @@ public final class net.corda.testing.driver.NodeParameters extends java.lang.Obj @org.jetbrains.annotations.Nullable public final Boolean getStartInSameProcess() @org.jetbrains.annotations.NotNull public final net.corda.node.services.config.VerifierType getVerifierType() public int hashCode() - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters setCustomerOverrides(Map) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters setMaximumHeapSize(String) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters setProvidedName(net.corda.core.identity.CordaX500Name) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters setRpcUsers(List) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters setStartInSameProcess(Boolean) - @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters setVerifierType(net.corda.node.services.config.VerifierType) public String toString() + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters withCustomerOverrides(Map) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters withMaximumHeapSize(String) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters withProvidedName(net.corda.core.identity.CordaX500Name) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters withRpcUsers(List) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters withStartInSameProcess(Boolean) + @org.jetbrains.annotations.NotNull public final net.corda.testing.driver.NodeParameters withVerifierType(net.corda.node.services.config.VerifierType) ## public final class net.corda.testing.driver.NotaryHandle extends java.lang.Object public (net.corda.core.identity.Party, boolean, net.corda.core.concurrent.CordaFuture) diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt index a74222d496..3e5c97a95f 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt @@ -101,12 +101,12 @@ data class NodeParameters( val startInSameProcess: Boolean? = null, val maximumHeapSize: String = "200m" ) { - fun setProvidedName(providedName: CordaX500Name?): NodeParameters = copy(providedName = providedName) - fun setRpcUsers(rpcUsers: List): NodeParameters = copy(rpcUsers = rpcUsers) - fun setVerifierType(verifierType: VerifierType): NodeParameters = copy(verifierType = verifierType) - fun setCustomerOverrides(customOverrides: Map): NodeParameters = copy(customOverrides = customOverrides) - fun setStartInSameProcess(startInSameProcess: Boolean?): NodeParameters = copy(startInSameProcess = startInSameProcess) - fun setMaximumHeapSize(maximumHeapSize: String): NodeParameters = copy(maximumHeapSize = maximumHeapSize) + fun withProvidedName(providedName: CordaX500Name?): NodeParameters = copy(providedName = providedName) + fun withRpcUsers(rpcUsers: List): NodeParameters = copy(rpcUsers = rpcUsers) + fun withVerifierType(verifierType: VerifierType): NodeParameters = copy(verifierType = verifierType) + fun withCustomerOverrides(customOverrides: Map): NodeParameters = copy(customOverrides = customOverrides) + fun withStartInSameProcess(startInSameProcess: Boolean?): NodeParameters = copy(startInSameProcess = startInSameProcess) + fun withMaximumHeapSize(maximumHeapSize: String): NodeParameters = copy(maximumHeapSize = maximumHeapSize) } /** @@ -160,22 +160,24 @@ fun driver(defaultParameters: DriverParameters = DriverParameters(), dsl: Dr ) } -/** Builder for configuring a [driver] from Java. - * @param isDebug Indicates whether the spawned nodes should start in jdwt debug mode and have debug level logging. - * @param driverDirectory The base directory node directories go into, defaults to "build//". The node +/** + * Builder for configuring a [driver]. + * @property isDebug Indicates whether the spawned nodes should start in jdwt debug mode and have debug level logging. + * @property driverDirectory The base directory node directories go into, defaults to "build//". The node * directories themselves are "//", where legalName defaults to "-" * and may be specified in [DriverDSL.startNode]. - * @param portAllocation The port allocation strategy to use for the messaging and the web server addresses. Defaults to incremental. - * @param debugPortAllocation The port allocation strategy to use for jvm debugging. Defaults to incremental. - * @param systemProperties A Map of extra system properties which will be given to each new node. Defaults to empty. - * @param useTestClock If true the test clock will be used in Node. - * @param startNodesInProcess Provides the default behaviour of whether new nodes should start inside this process or + * @property portAllocation The port allocation strategy to use for the messaging and the web server addresses. Defaults + * to incremental. + * @property debugPortAllocation The port allocation strategy to use for jvm debugging. Defaults to incremental. + * @property systemProperties A Map of extra system properties which will be given to each new node. Defaults to empty. + * @property useTestClock If true the test clock will be used in Node. + * @property startNodesInProcess Provides the default behaviour of whether new nodes should start inside this process or * not. Note that this may be overridden in [DriverDSL.startNode]. - * @param waitForAllNodesToFinish If true, the nodes will not shut down automatically after executing the code in the driver DSL block. - * It will wait for them to be shut down externally instead. - * @param notarySpecs The notaries advertised for this network. These nodes will be started automatically and will be + * @property waitForAllNodesToFinish If true, the nodes will not shut down automatically after executing the code in the + * driver DSL block. It will wait for them to be shut down externally instead. + * @property notarySpecs The notaries advertised for this network. These nodes will be started automatically and will be * available from [DriverDSL.notaryHandles]. Defaults to a simple validating notary. - * @param jmxPolicy Used to specify whether to expose JMX metrics via Jolokia HHTP/JSON. + * @property jmxPolicy Used to specify whether to expose JMX metrics via Jolokia HHTP/JSON. * @property networkParameters The network parameters to be used by all the nodes. [NetworkParameters.notaries] must be * empty as notaries are defined by [notarySpecs]. */ @@ -195,17 +197,17 @@ data class DriverParameters( val jmxPolicy: JmxPolicy = JmxPolicy(), val networkParameters: NetworkParameters = testNetworkParameters() ) { - fun setIsDebug(isDebug: Boolean): DriverParameters = copy(isDebug = isDebug) - fun setDriverDirectory(driverDirectory: Path): DriverParameters = copy(driverDirectory = driverDirectory) - fun setPortAllocation(portAllocation: PortAllocation): DriverParameters = copy(portAllocation = portAllocation) - fun setDebugPortAllocation(debugPortAllocation: PortAllocation): DriverParameters = copy(debugPortAllocation = debugPortAllocation) - fun setSystemProperties(systemProperties: Map): DriverParameters = copy(systemProperties = systemProperties) - fun setUseTestClock(useTestClock: Boolean): DriverParameters = copy(useTestClock = useTestClock) - fun setInitialiseSerialization(initialiseSerialization: Boolean): DriverParameters = copy(initialiseSerialization = initialiseSerialization) - fun setStartNodesInProcess(startNodesInProcess: Boolean): DriverParameters = copy(startNodesInProcess = startNodesInProcess) - fun setWaitForAllNodesToFinish(waitForAllNodesToFinish: Boolean): DriverParameters = copy(waitForAllNodesToFinish = waitForAllNodesToFinish) - fun setNotarySpecs(notarySpecs: List): DriverParameters = copy(notarySpecs = notarySpecs) - fun setExtraCordappPackagesToScan(extraCordappPackagesToScan: List): DriverParameters = copy(extraCordappPackagesToScan = extraCordappPackagesToScan) - fun setJmxPolicy(jmxPolicy: JmxPolicy): DriverParameters = copy(jmxPolicy = jmxPolicy) - fun setNetworkParameters(networkParameters: NetworkParameters): DriverParameters = copy(networkParameters = networkParameters) -} \ No newline at end of file + fun withIsDebug(isDebug: Boolean): DriverParameters = copy(isDebug = isDebug) + fun withDriverDirectory(driverDirectory: Path): DriverParameters = copy(driverDirectory = driverDirectory) + fun withPortAllocation(portAllocation: PortAllocation): DriverParameters = copy(portAllocation = portAllocation) + fun withDebugPortAllocation(debugPortAllocation: PortAllocation): DriverParameters = copy(debugPortAllocation = debugPortAllocation) + fun withSystemProperties(systemProperties: Map): DriverParameters = copy(systemProperties = systemProperties) + fun withUseTestClock(useTestClock: Boolean): DriverParameters = copy(useTestClock = useTestClock) + fun withInitialiseSerialization(initialiseSerialization: Boolean): DriverParameters = copy(initialiseSerialization = initialiseSerialization) + fun withStartNodesInProcess(startNodesInProcess: Boolean): DriverParameters = copy(startNodesInProcess = startNodesInProcess) + fun withWaitForAllNodesToFinish(waitForAllNodesToFinish: Boolean): DriverParameters = copy(waitForAllNodesToFinish = waitForAllNodesToFinish) + fun withNotarySpecs(notarySpecs: List): DriverParameters = copy(notarySpecs = notarySpecs) + fun withExtraCordappPackagesToScan(extraCordappPackagesToScan: List): DriverParameters = copy(extraCordappPackagesToScan = extraCordappPackagesToScan) + fun withJmxPolicy(jmxPolicy: JmxPolicy): DriverParameters = copy(jmxPolicy = jmxPolicy) + fun withNetworkParameters(networkParameters: NetworkParameters): DriverParameters = copy(networkParameters = networkParameters) +} diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNetwork.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNetwork.kt index 233726f21c..bbcbf9f2cc 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNetwork.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNetwork.kt @@ -59,6 +59,8 @@ data class MockNodeParameters( * is used by multiple nodes. You rarely if ever need to change that, it's primarily of interest to people testing * notary code. * @property notarySpecs The notaries to use in the mock network. By default you get one mock notary and that is usually sufficient. + * @property networkParameters The network parameters to be used by all the nodes. [NetworkParameters.notaries] must be + * empty as notaries are defined by [notarySpecs]. */ @Suppress("unused") data class MockNetworkParameters(