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><Set<AttachmentId>, Set<AttachmentId>>> = 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: NetworkParameters, val notaryCustomOverrides: Map<String, Any?>, val inMemoryDB: Boolean, val cordappsForAllNodes: Collection<TestCordappInternal>?, val environmentVariables: Map<String, String>, val allowHibernateToManageAppSchema: Boolean = true, val premigrateH2Database: Boolean = true, val notaryHandleTimeout: Duration = Duration.ofMinutes(1)) : 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
data class InMemoryMessage(val topic: String, val data: ByteSequence, 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)
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(), initialNetworkParameters: NetworkParameters = 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: CordaX500Name? = 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())
Link copied to clipboard
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

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

Link copied to clipboard
class MockNetworkParametersStorage(currentParameters: NetworkParameters = testNetworkParameters(modifiedTime = Instant.MIN)) : NetworkParametersStorage
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())
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)) : SingletonSerializeAsToken
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
abstract class NodeBasedTest constructor(cordappPackages: Set<TestCordappInternal> = emptySet(), notaries: List<CordaX500Name> = emptyList())
Link copied to clipboard
class NodeListenProcessDeathException(hostAndPort: NetworkHostAndPort, listenProcess: Process, val causeFromStdError: String) : CordaException
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: NetworkHostAndPort?, 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: Trace?) : InternalDriverDSL
Link copied to clipboard
data class RpcServerHandle(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<NotaryInfo>) -> 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<NotaryInfo>) -> 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
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: NetworkHostAndPort, listenProcess: Process? = null)
Link copied to clipboard
fun addressMustBeBoundFuture(executorService: ScheduledExecutorService, hostAndPort: NetworkHostAndPort, listenProcess: Process? = null): CordaFuture<Unit>
Link copied to clipboard
fun addressMustNotBeBound(executorService: ScheduledExecutorService, hostAndPort: NetworkHostAndPort, timeout: Duration = 40.seconds)
Link copied to clipboard
fun MockNodeConfigOverrides.applyMockNodeOverrides(config: <Error class: unknown class>)
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><Set<AttachmentId>, Set<AttachmentId>>>): 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

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 <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: NetworkParameters = DriverParameters().networkParameters, compatibilityZone: CompatibilityZoneParams? = null, notaryCustomOverrides: Map<String, Any?> = DriverParameters().notaryCustomOverrides, inMemoryDB: Boolean = DriverParameters().inMemoryDB, cordappsForAllNodes: Collection<TestCordappInternal>? = null, environmentVariables: Map<String, String> = emptyMap(), allowHibernateToManageAppSchema: Boolean = true, premigrateH2Database: Boolean = true, notaryHandleTimeout: Duration = Duration.ofMinutes(1), dsl: DriverDSLImpl.() -> A): A
Link copied to clipboard
fun <Error class: unknown class>.newContext(): InvocationContext
Link copied to clipboard
fun nodeMustBeStartedFuture(executorService: ScheduledExecutorService, logFile: Path, listenProcess: Process, exception: () -> NodeListenProcessDeathException): CordaFuture<Unit>
Link copied to clipboard
fun <A> poll(executorService: ScheduledExecutorService, pollName: String, pollInterval: Duration = 500.millis, warnCount: Int = 120, check: () -> A?): CordaFuture<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: Trace? = null, jmxPolicy: JmxPolicy = JmxPolicy(), networkParameters: NetworkParameters = testNetworkParameters(), notaryCustomOverrides: Map<String, Any?> = emptyMap(), inMemoryDB: Boolean = true, cordappsForAllNodes: Collection<TestCordappInternal>? = null, environmentVariables: Map<String, String> = emptyMap(), 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: FlowLogic<T>): FlowStateMachineHandle<T>
Link copied to clipboard
fun <T> <Error class: unknown class>.startFlowWithClientId(clientId: String, logic: FlowLogic<T>): FlowStateMachineHandle<T>
Link copied to clipboard
inline fun <I : RPCOps> RPCDriverDSL.startInVmRpcClient(username: String = rpcTestUser.username, password: String = rpcTestUser.password, configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT): <Error class: unknown class>
Link copied to clipboard
fun DriverDSL.startNode(providedName: CordaX500Name, devMode: Boolean, parameters: NodeParameters = NodeParameters()): CordaFuture<NodeHandle>
Link copied to clipboard
inline fun <I : RPCOps> RPCDriverDSL.startRandomRpcClient(hostAndPort: NetworkHostAndPort, username: String = rpcTestUser.username, password: String = rpcTestUser.password): CordaFuture<Process>
Link copied to clipboard
inline fun <I : RPCOps> RPCDriverDSL.startRpcClient(haAddressPool: List<NetworkHostAndPort>, username: String = rpcTestUser.username, password: String = rpcTestUser.password, configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT): <Error class: unknown class>
inline fun <I : RPCOps> RPCDriverDSL.startRpcClient(rpcAddress: NetworkHostAndPort, 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 CordaRPCOps.waitForShutdown(): <Error class: unknown class><Unit>
fun NodeHandle.waitForShutdown(): <Error class: unknown class><Unit>
Link copied to clipboard
fun writeConfig(path: Path, filename: String, config: <Error class: unknown class>)