From 45b43f116d894d0fd9e00eba3736c727ebe02b51 Mon Sep 17 00:00:00 2001 From: Ramzi El-Yafi Date: Fri, 17 Apr 2020 16:51:27 +0100 Subject: [PATCH] [EG-503] Test cases for exposed notaryService (#6161) --- node/src/test/kotlin/net/corda/node/internal/NodeTest.kt | 9 +++++++++ .../node/services/transactions/NotaryServiceTests.kt | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/node/src/test/kotlin/net/corda/node/internal/NodeTest.kt b/node/src/test/kotlin/net/corda/node/internal/NodeTest.kt index 3ae5c937a2..da4a5c423c 100644 --- a/node/src/test/kotlin/net/corda/node/internal/NodeTest.kt +++ b/node/src/test/kotlin/net/corda/node/internal/NodeTest.kt @@ -72,6 +72,15 @@ class NodeTest { } } + @Test(timeout=300_000) + fun `check node service availability`() { + val configuration = createConfig(ALICE_NAME) + val info = VersionInfo(789, "3.0", "SNAPSHOT", "R3") + val node = Node(configuration, info, initialiseSerialization = false) + // Regular nodes must not have internal access to the notary service + assertNull(node.services.notaryService) + } + @Test(timeout=300_000) fun `clear network map cache works`() { val configuration = createConfig(ALICE_NAME) diff --git a/node/src/test/kotlin/net/corda/node/services/transactions/NotaryServiceTests.kt b/node/src/test/kotlin/net/corda/node/services/transactions/NotaryServiceTests.kt index 9253d0aa24..2947a880d3 100644 --- a/node/src/test/kotlin/net/corda/node/services/transactions/NotaryServiceTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/transactions/NotaryServiceTests.kt @@ -24,6 +24,7 @@ import org.junit.After import org.junit.Before import org.junit.Test import kotlin.test.assertFailsWith +import kotlin.test.assertNotNull class NotaryServiceTests { private lateinit var mockNet: InternalMockNetwork @@ -55,6 +56,11 @@ class NotaryServiceTests { notariseWithTooManyInputs(aliceNode, alice, notary, mockNet) } + @Test(timeout=300_000) + fun `notary node should have access to its notary service`() { + assertNotNull(mockNet.defaultNotaryNode.notaryService) + } + @Test(timeout=300_000) fun `should reject when network parameters component is not visible`() { val stx = generateTransaction(aliceNode, alice, notary, null, 13)