Package-level declarations

Types

Link copied to clipboard

Internal API to enable testing of the network map service and node registration process using the internal driver.

Link copied to clipboard
data class CustomCordapp(val packages: Set<String> = emptySet(), val name: String = "custom-cordapp", val versionId: Int = 1, val targetPlatformVersion: Int = PLATFORM_VERSION, val classes: Set<Class<*>> = emptySet(), val fixups: List<<Error class: unknown class>> = emptyList(), val signingInfo: CustomCordapp.SigningInfo? = null, val config: Map<String, Any> = emptyMap()) : TestCordappInternal

Represents a completely custom CorDapp comprising of resources taken from packages on the existing classpath, even including individual disparate classes. The CorDapp metadata that's present in the MANIFEST can also be tailored.

Link copied to clipboard
class DriverDSLImpl(val portAllocation: PortAllocation, val debugPortAllocation: PortAllocation, val systemProperties: Map<String, String>, val driverDirectory: Path, val useTestClock: Boolean, val isDebug: Boolean, val startNodesInProcess: Boolean, val waitForAllNodesToFinish: Boolean, val extraCordappPackagesToScan: List<String>, val jmxPolicy: JmxPolicy, val notarySpecs: List<NotarySpec>, val compatibilityZone: CompatibilityZoneParams?, val networkParameters: <Error class: unknown class>, val notaryCustomOverrides: Map<String, Any?>, val inMemoryDB: Boolean, val cordappsForAllNodes: Collection<TestCordappInternal>?, val environmentVariables: Map<String, String>, val enableSNI: Boolean = false, val allowHibernateToManageAppSchema: Boolean = true, val premigrateH2Database: Boolean = true, val notaryHandleTimeout: Duration = Duration.ofMinutes(2)) : InternalDriverDSL
Link copied to clipboard
data class DummyClusterSpec(val clusterSize: Int, val compositeServiceIdentity: Boolean = false) : ClusterSpec

Only used for testing the notary communication path. Can be configured to act as a Raft (singular identity), or a BFT (composite key identity) notary service.

Link copied to clipboard
class EnterpriseMockNamedCachedFactory(sizeOverride: Long, metricRegistry: <Error class: unknown class>?, nodeConfiguration: <Error class: unknown class>?)
Link copied to clipboard
data class InMemoryMessage(val topic: String, val data: <Error class: unknown class>, val uniqueMessageId: <Error class: unknown class>, val debugTimestamp: Instant = Instant.now(), val senderUUID: String? = null)

An implementation of Message for in memory messaging by the test MockNodeMessagingService.

Link copied to clipboard
class InProcessNode(configuration: <Error class: unknown class>, versionInfo: <Error class: unknown class>, flowManager: <Error class: unknown class> = NodeFlowManager(configuration.flowOverrides), allowHibernateToManageAppSchema: Boolean = true, val runMigrationScripts: Boolean = true)
Link copied to clipboard
Link copied to clipboard
open class InternalMockNetwork(cordappPackages: List<String> = emptyList(), defaultParameters: MockNetworkParameters = MockNetworkParameters(), val networkSendManuallyPumped: Boolean = defaultParameters.networkSendManuallyPumped, val threadPerNode: Boolean = defaultParameters.threadPerNode, servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy = defaultParameters.servicePeerAllocationStrategy, val notarySpecs: List<MockNetworkNotarySpec> = defaultParameters.notarySpecs, val testDirectory: Path = Paths.get("build") / "mock-network" / getTimestampAsDirectoryName(), val initialNetworkParameters: <Error class: unknown class> = testNetworkParameters(), val defaultFactory: (MockNodeArgs) -> InternalMockNetwork.MockNode = { args -> MockNode(args) }, cordappsForAllNodes: Collection<TestCordappInternal> = emptySet(), val autoVisibleNodes: Boolean = true) : AutoCloseable
Link copied to clipboard
data class InternalMockNodeParameters(val forcedID: Int? = null, val legalName: <Error class: unknown class>? = null, val entropyRoot: BigInteger = BigInteger.valueOf(random63BitValue()), val configOverrides: (<Error class: unknown class>) -> Any? = {}, val version: <Error class: unknown class> = MOCK_VERSION_INFO, val additionalCordapps: Collection<TestCordappInternal> = emptyList(), val flowManager: MockNodeFlowManager = MockNodeFlowManager(), val cryptoServiceFlowRetryCount: Int? = null)
Link copied to clipboard
class ListenProcessDeathException(hostAndPort: <Error class: unknown class>, listenProcess: Process)
Link copied to clipboard
abstract class MessagingServiceSpy
Link copied to clipboard
class MockCryptoService(initialKeyPairs: Map<String, KeyPair>)
Link copied to clipboard
class MockEncryptionService(aesKey: SecretKey = AesEncryption.randomKey())
Link copied to clipboard
class MockKeyManagementService(val identityService: <Error class: unknown class>, initialKeys: KeyPair, val meteringRecorder: <Error class: unknown class> = MeteringRecorderFactory().stubbed())

A class which provides an implementation of KeyManagementService which is used in MockServices

Link copied to clipboard
class MockNetworkParametersStorage(currentParameters: <Error class: unknown class> = testNetworkParameters(modifiedTime = Instant.MIN))
Link copied to clipboard
data class MockNodeArgs(val config: <Error class: unknown class>, val network: InternalMockNetwork, val id: Int, val entropyRoot: BigInteger, val version: <Error class: unknown class> = MOCK_VERSION_INFO, val flowManager: MockNodeFlowManager = MockNodeFlowManager(), val clock: <Error class: unknown class> = TestClock(Clock.systemUTC()))
Link copied to clipboard
Link copied to clipboard
class MockNodeMessagingService(configuration: <Error class: unknown class>, executor: <Error class: unknown class>, stateHelper: <Error class: unknown class> = ServiceStateHelper(log))
Link copied to clipboard

A mock implementation of WritablePublicKeyToOwningIdentityCache that stores all key mappings in memory. Used in testing scenarios that do not require database access.

Link copied to clipboard

A class which provides an implementation of WritableTransactionStorage which is used in MockServices

Link copied to clipboard

Keeps track of how many nodes each node sees and gates nodes from completing their startNode CordaFuture until all current nodes see everyone.

Link copied to clipboard
abstract class NodeBasedTest(cordappPackages: Set<TestCordappInternal> = emptySet(), notaries: List<<Error class: unknown class>> = emptyList()) : IntegrationTest
Link copied to clipboard
class NodeListenProcessDeathException(hostAndPort: <Error class: unknown class>, listenProcess: Process, val causeFromStdError: String)
Link copied to clipboard
Link copied to clipboard

An out-of-process RPC user that connects to an RPC server and issues random RPCs with random arguments.

Link copied to clipboard
data class RpcBrokerHandle(val hostAndPort: <Error class: unknown class>?, val clientTransportConfiguration: <Error class: unknown class>, val serverControl: <Error class: unknown class>, val shutdown: () -> Unit)
Link copied to clipboard
data class RPCDriverDSL(driverDSL: DriverDSLImpl, externalTrace: <Error class: unknown class>?) : InternalDriverDSL
Link copied to clipboard
data class RpcServerHandle<I>(val broker: RpcBrokerHandle, val rpcServer: <Error class: unknown class>)
Link copied to clipboard
data class ScanPackageTestCordapp(val scanPackage: String, val config: Map<String, Any> = emptyMap(), val signed: Boolean = false) : TestCordappInternal

Implementation of the public TestCordapp API.

Link copied to clipboard
class SharedCompatibilityZoneParams(url: URL, pnm: UUID?, val publishNotaries: (List<<Error class: unknown class>>) -> Unit, val rootCert: X509Certificate? = null) : CompatibilityZoneParams

Represent network management services, network map and doorman, running on the same URL

Link copied to clipboard
class ShutdownManager(executorService: ExecutorService)
Link copied to clipboard
class SplitCompatibilityZoneParams(doormanURL: URL, networkMapURL: URL, pnm: UUID?, val publishNotaries: (List<<Error class: unknown class>>) -> Unit, val rootCert: X509Certificate? = null) : CompatibilityZoneParams

Represent network management services, network map and doorman, running on different URLs

Link copied to clipboard

Extends the public TestCordapp API with internal extensions for use within the testing framework and for internal testing of the platform.

Link copied to clipboard
Link copied to clipboard
interface TestStartedNode
Link copied to clipboard
data class UriTestCordapp(val uri: URI, val config: Map<String, Any> = emptyMap(), val signed: Boolean = false) : TestCordappInternal

Properties

Link copied to clipboard

Custom CorDapp containing the contents of the net.corda.testing.contracts package, i.e. the dummy contracts. This is not a real CorDapp in the way that FINANCE_CONTRACTS_CORDAPP and FINANCE_WORKFLOWS_CORDAPP are.

Link copied to clipboard
val fakeNodeLegalName: <Error class: unknown class>
Link copied to clipboard

Reference to the finance-contracts CorDapp in this repo. The metadata is taken directly from finance/contracts/build.gradle, including the fact that the jar is signed. If you need an unsigned jar then use cordappWithPackages("net.corda.finance.contracts").

Link copied to clipboard

Reference to the finance-workflows CorDapp in this repo. The metadata is taken directly from finance/workflows/build.gradle, including the fact that the jar is signed. If you need an unsigned jar then use cordappWithPackages("net.corda.finance.flows").

Link copied to clipboard
val MOCK_VERSION_INFO: <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
inline fun JarOutputStream.addEntry(entry: ZipEntry, write: () -> Unit)

Add a new entry using the entire remaining bytes of input for the entry content. input will be closed at the end.

Link copied to clipboard
fun addressMustBeBound(executorService: ScheduledExecutorService, hostAndPort: <Error class: unknown class>, listenProcess: Process? = null)
Link copied to clipboard
fun addressMustBeBoundFuture(executorService: ScheduledExecutorService, hostAndPort: <Error class: unknown class>, listenProcess: Process? = null): <Error class: unknown class><Unit>
Link copied to clipboard
fun addressMustNotBeBound(executorService: ScheduledExecutorService, hostAndPort: <Error class: unknown class>, timeout: Duration = 40.seconds)
Link copied to clipboard
fun addressMustNotBeBoundFuture(executorService: ScheduledExecutorService, hostAndPort: <Error class: unknown class>): <Error class: unknown class><Unit>
Link copied to clipboard
fun MockNodeConfigOverrides.applyMockNodeOverrides(config: <Error class: unknown class>)
Link copied to clipboard
fun DriverDSL.assertUncompletedCheckpoints(name: <Error class: unknown class>, expected: Long)
Link copied to clipboard
fun cordappForClasses(vararg classes: Class<*>): CustomCordapp

Create a custom CorDapp which contains just the given classes.

Link copied to clipboard
Link copied to clipboard
fun cordappWithFixups(fixups: List<<Error class: unknown class>>): CustomCordapp
Link copied to clipboard
fun cordappWithPackages(vararg packageNames: String): CustomCordapp

Create a custom CorDapp which contains all the classes and resoures located in the given packages. The CorDapp's metadata will be the default values as defined in the CustomCordapp c'tor. Use the copy to change them. This means the metadata will not be the one defined in the original CorDapp(s) that the given packages may represent. If this is not what you want then use findCordapp instead.

Link copied to clipboard
fun createDataSourceConfig(providedNodeName: String? = null, postfix: String? = null, inMemory: Boolean): <Error class: unknown class>

Creates data source configuration for in memory H2 as it would be specified in reference.conf 'datasource' snippet.

Link copied to clipboard
fun databaseProviderDataSourceConfig(nodeName: String? = null, nodeSchemaName: String? = null): <Error class: unknown class>

Reads database and dataSource configuration from a file denoted by 'databaseProvider' system property, overwritten by system properties and defaults to H2 in memory db.

Link copied to clipboard

Create a custom CorDapp which just contains the enclosed classes of the receiver class.

Link copied to clipboard

Find the single CorDapp jar on the current classpath which contains the given package. This is a convenience method for TestCordapp.findCordapp but returns the internal ScanPackageTestCordapp.

Link copied to clipboard
fun <DI : DriverDSL, D : InternalDriverDSL, A> genericDriver(driverDsl: D, coerce: (D) -> DI, dsl: DI.() -> A): A

This is a helper method to allow extending of the DSL, along the lines of interface SomeOtherExposedDSLInterface : DriverDSL interface SomeOtherInternalDSLInterface : InternalDriverDSL, SomeOtherExposedDSLInterface class SomeOtherDSL(val driverDSL : DriverDSLImpl) : InternalDriverDSL by driverDSL, SomeOtherInternalDSLInterface

Link copied to clipboard
fun getCallerPackage(directCallerClass: KClass<*>): String?
Link copied to clipboard
fun InMemoryMessagingNetwork.MessageTransfer.getMessage(): <Error class: unknown class>
Link copied to clipboard
fun inMemoryH2DataSourceConfig(providedNodeName: String? = null, postfix: String? = null): <Error class: unknown class>

Creates data source configuration for in memory H2 as it would be specified in reference.conf 'datasource' snippet.

Link copied to clipboard
fun <A> internalDriver(isDebug: Boolean = DriverParameters().isDebug, driverDirectory: Path = DriverParameters().driverDirectory, portAllocation: PortAllocation = DriverParameters().portAllocation, debugPortAllocation: PortAllocation = DriverParameters().debugPortAllocation, systemProperties: Map<String, String> = DriverParameters().systemProperties, useTestClock: Boolean = DriverParameters().useTestClock, startNodesInProcess: Boolean = DriverParameters().startNodesInProcess, extraCordappPackagesToScan: List<String> = @Suppress("DEPRECATION") DriverParameters().extraCordappPackagesToScan, waitForAllNodesToFinish: Boolean = DriverParameters().waitForAllNodesToFinish, notarySpecs: List<NotarySpec> = DriverParameters().notarySpecs, jmxPolicy: JmxPolicy = DriverParameters().jmxPolicy, networkParameters: <Error class: unknown class> = DriverParameters().networkParameters, compatibilityZone: CompatibilityZoneParams? = null, notaryCustomOverrides: Map<String, Any?> = DriverParameters().notaryCustomOverrides, inMemoryDB: Boolean = DriverParameters().inMemoryDB, cordappsForAllNodes: Collection<TestCordappInternal>? = null, environmentVariables: Map<String, String> = emptyMap(), enableSNI: Boolean = DriverParameters().enableSNI, allowHibernateToManageAppSchema: Boolean = true, premigrateH2Database: Boolean = true, notaryHandleTimeout: Duration = Duration.ofMinutes(2), dsl: DriverDSLImpl.() -> A): A
Link copied to clipboard
fun makeInternalTestDataSourceProperties(nodeName: String? = SecureHash.randomSHA256().toString(), nodeNameExtension: String? = null, nodeSchemaName: String? = null, mode: String? = null, configSupplier: (String?, String?) -> <Error class: unknown class> = ::databaseProviderDataSourceConfig, fallBackConfigSupplier: (String?, String?, String?) -> <Error class: unknown class> = ::onDiskH2DataSourceConfig): Properties

Make properties appropriate for creating a DataSource for unit tests. Defaults configuration of in-memory H2 instance. If 'databaseProvider' system property is set then creates a config from the relevant config file is present in resources folder (used to parametrize test to run against a remote database). Properties retrieval can be parameterized by configSupplier and/or fallBackConfigSupplier methods which are run with nodeName and nodeNameExtension parameters.

Link copied to clipboard
fun makeTestDatabaseProperties(nodeName: String? = null, nodeSchemaName: String? = null, configSupplier: (String?, String?) -> <Error class: unknown class> = ::databaseProviderDataSourceConfig): <Error class: unknown class>

Make properties appropriate for creating a Database for unit tests.

Link copied to clipboard
fun <Error class: unknown class>.newContext(): <Error class: unknown class>
Link copied to clipboard
fun nodeMustBeStartedFuture(executorService: ScheduledExecutorService, logFile: Path, listenProcess: Process, exception: () -> NodeListenProcessDeathException): <Error class: unknown class><Unit>
Link copied to clipboard
fun onDiskH2DataSourceConfig(providedNodeName: String? = null, postfix: String? = null, mode: String? = null): <Error class: unknown class>

Creates data source configuration for on disk H2 as it would be specified in reference.conf 'datasource' snippet.

Link copied to clipboard
fun <A> poll(executorService: ScheduledExecutorService, pollName: String, pollInterval: Duration = 500.millis, warnCount: Int = 180, check: () -> A?): <Error class: unknown class><A>
Link copied to clipboard
fun <A> rpcDriver(isDebug: Boolean = false, driverDirectory: Path = Paths.get("build") / "rpc-driver" / getTimestampAsDirectoryName(), portAllocation: PortAllocation = globalPortAllocation, debugPortAllocation: PortAllocation = globalDebugPortAllocation, systemProperties: Map<String, String> = emptyMap(), useTestClock: Boolean = false, startNodesInProcess: Boolean = false, waitForNodesToFinish: Boolean = false, extraCordappPackagesToScan: List<String> = emptyList(), notarySpecs: List<NotarySpec> = emptyList(), externalTrace: <Error class: unknown class>? = null, jmxPolicy: JmxPolicy = JmxPolicy(), networkParameters: <Error class: unknown class> = testNetworkParameters(), notaryCustomOverrides: Map<String, Any?> = emptyMap(), inMemoryDB: Boolean = true, cordappsForAllNodes: Collection<TestCordappInternal>? = null, environmentVariables: Map<String, String> = emptyMap(), enableSNI: Boolean = true, dsl: RPCDriverDSL.() -> A): A
Link copied to clipboard

Should only be used by Driver and MockNode.

Link copied to clipboard
Link copied to clipboard
fun <T> <Error class: unknown class>.startFlow(logic: <Error class: unknown class><T>): <Error class: unknown class><T>
Link copied to clipboard
fun <T> <Error class: unknown class>.startFlowWithClientId(clientId: String, logic: <Error class: unknown class><T>): <Error class: unknown class><T>
Link copied to clipboard
inline fun <I> RPCDriverDSL.startInVmRpcClient(username: String = rpcTestUser.username, password: String = rpcTestUser.password, configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT): <Error class: unknown class><I>
Link copied to clipboard
fun DriverDSL.startNode(providedName: <Error class: unknown class>, devMode: Boolean, parameters: NodeParameters = NodeParameters()): <Error class: unknown class><NodeHandle>
Link copied to clipboard
inline fun <I> RPCDriverDSL.startRandomRpcClient(hostAndPort: <Error class: unknown class>, username: String = rpcTestUser.username, password: String = rpcTestUser.password): <Error class: unknown class><Process>
Link copied to clipboard
inline fun <I> RPCDriverDSL.startRpcClient(rpcAddress: <Error class: unknown class>, username: String = rpcTestUser.username, password: String = rpcTestUser.password, configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT): <Error class: unknown class>
inline fun <I> RPCDriverDSL.startRpcClient(haAddressPool: List<<Error class: unknown class>>, username: String = rpcTestUser.username, password: String = rpcTestUser.password, configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT): <Error class: unknown class>
Link copied to clipboard
fun MockNetNotaryConfig.toNotaryConfig(): <Error class: unknown class>
Link copied to clipboard
fun <Error class: unknown class>.waitForShutdown(): <Error class: unknown class><Unit>
fun NodeHandle.waitForShutdown(): <Error class: unknown class><Unit>
Link copied to clipboard
fun <T> DriverDSL.withDatabaseConnection(name: <Error class: unknown class>, block: (Connection) -> T): T
Link copied to clipboard
fun writeConfig(path: Path, filename: String, config: <Error class: unknown class>)