Adds a builder for configuring nodes in the driver for Java interop.

This commit is contained in:
joeldudleyr3
2017-09-01 16:45:00 +01:00
parent 78dd62359a
commit 83d0095142
22 changed files with 105 additions and 67 deletions

View File

@ -41,12 +41,12 @@ class BootTests {
val logConfigFile = projectRootDir / "config" / "dev" / "log4j2.xml"
assertThat(logConfigFile).isRegularFile()
driver(isDebug = true, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())) {
val alice = startNode(ALICE.name).get()
val alice = startNode(providedName = ALICE.name).get()
val logFolder = alice.configuration.baseDirectory / NodeStartup.LOGS_DIRECTORY_NAME
val logFile = logFolder.toFile().listFiles { _, name -> name.endsWith(".log") }.single()
// Start second Alice, should fail
assertThatThrownBy {
startNode(ALICE.name).getOrThrow()
startNode(providedName = ALICE.name).getOrThrow()
}
// We count the number of nodes that wrote into the logfile by counting "Logs can be found in"
val numberOfNodesThatLogged = Files.lines(logFile.toPath()).filter { NodeStartup.LOGS_CAN_BE_FOUND_IN_STRING in it }.count()
@ -58,7 +58,7 @@ class BootTests {
fun `node quits on failure to register with network map`() {
val tooManyAdvertisedServices = (1..100).map { ServiceInfo(ServiceType.regulator.getSubType("$it")) }.toSet()
driver(networkMapStartStrategy = NetworkMapStartStrategy.Nominated(ALICE.name)) {
val future = startNode(ALICE.name, advertisedServices = tooManyAdvertisedServices)
val future = startNode(providedName = ALICE.name, advertisedServices = tooManyAdvertisedServices)
assertFailsWith(ListenProcessDeathException::class) { future.getOrThrow() }
}
}

View File

@ -25,8 +25,8 @@ class CordappScanningDriverTest {
// The driver will automatically pick up the annotated flows below
driver {
val (alice, bob) = listOf(
startNode(ALICE.name, rpcUsers = listOf(user)),
startNode(BOB.name)).transpose().getOrThrow()
startNode(providedName = ALICE.name, rpcUsers = listOf(user)),
startNode(providedName = BOB.name)).transpose().getOrThrow()
val initiatedFlowClass = alice.rpcClientToNode()
.start(user.username, user.password)
.proxy

View File

@ -38,7 +38,7 @@ class DistributedServiceTests : DriverBasedTest() {
startFlowPermission<CashIssueFlow>(),
startFlowPermission<CashPaymentFlow>())
)
val aliceFuture = startNode(ALICE.name, rpcUsers = listOf(testUser))
val aliceFuture = startNode(providedName = ALICE.name, rpcUsers = listOf(testUser))
val notariesFuture = startNotaryCluster(
DUMMY_NOTARY.name,
rpcUsers = listOf(testUser),