diff --git a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/HardRestartTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/HardRestartTest.kt index 0a6bbb16c4..befc83704e 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/HardRestartTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/HardRestartTest.kt @@ -11,20 +11,28 @@ import net.corda.core.messaging.startFlow import net.corda.core.utilities.getOrThrow import net.corda.core.utilities.unwrap import net.corda.node.services.Permissions -import net.corda.testing.core.DUMMY_BANK_A_NAME -import net.corda.testing.core.DUMMY_BANK_B_NAME -import net.corda.testing.core.singleIdentity +import net.corda.testing.core.* import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.OutOfProcess import net.corda.testing.driver.driver +import net.corda.testing.internal.IntegrationTest +import net.corda.testing.internal.IntegrationTestSchemas +import net.corda.testing.internal.toDatabaseSchemaName import net.corda.testing.node.User +import org.junit.ClassRule import org.junit.Test import java.util.* import java.util.concurrent.CountDownLatch import java.util.concurrent.Executors import kotlin.concurrent.thread -class HardRestartTest { +class HardRestartTest : IntegrationTest() { + companion object { + @ClassRule + @JvmField + val databaseSchemas = IntegrationTestSchemas(DUMMY_BANK_A_NAME.toDatabaseSchemaName(), DUMMY_BANK_B_NAME.toDatabaseSchemaName(), + DUMMY_NOTARY_NAME.toDatabaseSchemaName()) + } @StartableByRPC @InitiatingFlow class Ping(val pongParty: Party) : FlowLogic() { diff --git a/node/src/integration-test/kotlin/net/corda/test/node/NodeSuspendAndResumeTest.kt b/node/src/integration-test/kotlin/net/corda/test/node/NodeSuspendAndResumeTest.kt index f637bdd26c..1bf74a8c88 100644 --- a/node/src/integration-test/kotlin/net/corda/test/node/NodeSuspendAndResumeTest.kt +++ b/node/src/integration-test/kotlin/net/corda/test/node/NodeSuspendAndResumeTest.kt @@ -45,8 +45,7 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, DUMMY_NOTARY_NAME) - .map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), DUMMY_NOTARY_NAME.toDatabaseSchemaName()) } private val rpcUser = User("user1", "test", permissions = setOf( @@ -71,6 +70,7 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac } (startedNode.network as P2PMessagingClient).runningFuture.get() } + node.stop() } @Test @@ -92,6 +92,7 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac println("Balance: $currentCashAmount") assertEquals((123 * i).DOLLARS, currentCashAmount) } + node.stop() } @Test @@ -120,6 +121,8 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac currentCashAmount = getCashBalance(node) println("Balance: $currentCashAmount") assertEquals(123.DOLLARS, currentCashAmount) + + node.stop() } @Test @@ -142,6 +145,8 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac val currentCashAmount = getCashBalance(node) println("Balance: $currentCashAmount") assertEquals(123.DOLLARS, currentCashAmount) + + node.stop() } @Test @@ -161,6 +166,8 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac val currentCashAmount = getCashBalance(node) println("Balance: $currentCashAmount") assertEquals(123.DOLLARS, currentCashAmount) + + node.stop() } @Test @@ -182,6 +189,8 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac val currentCashAmount = getCashBalance(node) println("Balance: $currentCashAmount") assertEquals(123.DOLLARS, currentCashAmount) + + node.stop() } @Test @@ -201,6 +210,8 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac val currentCashAmount = getCashBalance(node) println("Balance: $currentCashAmount") assertEquals(123.DOLLARS, currentCashAmount) + + node.stop() } @Test @@ -220,6 +231,8 @@ class NodeSuspendAndResumeTest : NodeBasedTest(listOf("net.corda.finance.contrac Assertions.assertThatExceptionOfType(ActiveMQNotConnectedException::class.java).isThrownBy { issueCash(node, node.generateAndSaveNodeInfo().identityFromX500Name(ALICE_NAME)) } + + node.stop() } private fun issueCash(node: Node, party: Party) { diff --git a/node/src/main/resources/migration/node-notary.changelog-init.xml b/node/src/main/resources/migration/node-notary.changelog-init.xml index e8345d268b..232b7aff70 100644 --- a/node/src/main/resources/migration/node-notary.changelog-init.xml +++ b/node/src/main/resources/migration/node-notary.changelog-init.xml @@ -51,7 +51,7 @@ - + diff --git a/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-cleanup.sql b/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-cleanup.sql index 70cefb78e2..356a1f272c 100644 --- a/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-cleanup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-cleanup.sql @@ -15,7 +15,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-setup.sql b/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-setup.sql index 8fdbeb198b..fda700cefc 100644 --- a/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-setup.sql @@ -15,7 +15,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/testing/test-utils/src/main/resources/database-scripts/oracle/db-cleanup.sql b/testing/test-utils/src/main/resources/database-scripts/oracle/db-cleanup.sql index 17db443f78..10d13b6988 100644 --- a/testing/test-utils/src/main/resources/database-scripts/oracle/db-cleanup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/oracle/db-cleanup.sql @@ -4,6 +4,7 @@ DROP TABLE ${schema}.cp_states_v2_participants CASCADE CONSTRAINTS DROP TABLE ${schema}.dummy_linear_state_parts CASCADE CONSTRAINTS DROP TABLE ${schema}.dummy_linear_states_v2_parts CASCADE CONSTRAINTS DROP TABLE ${schema}.dummy_deal_states_parts CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_attchments_contracts CASCADE CONSTRAINTS DROP TABLE ${schema}.node_attachments CASCADE CONSTRAINTS DROP TABLE ${schema}.node_checkpoints CASCADE CONSTRAINTS DROP TABLE ${schema}.node_transactions CASCADE CONSTRAINTS @@ -14,7 +15,8 @@ DROP TABLE ${schema}.node_our_key_pairs CASCADE CONSTRAINTS DROP TABLE ${schema}.node_scheduled_states CASCADE CONSTRAINTS DROP TABLE ${schema}.node_network_map_nodes CASCADE CONSTRAINTS DROP TABLE ${schema}.node_network_map_subscribers CASCADE CONSTRAINTS -DROP TABLE ${schema}.node_notary_commit_log CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_notary_committed_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_notary_request_log CASCADE CONSTRAINTS DROP TABLE ${schema}.node_transaction_mappings CASCADE CONSTRAINTS DROP TABLE ${schema}.vault_fungible_states_parts CASCADE CONSTRAINTS DROP TABLE ${schema}.vault_linear_states_parts CASCADE CONSTRAINTS @@ -32,6 +34,7 @@ DROP TABLE ${schema}.cp_states CASCADE CONSTRAINTS DROP TABLE ${schema}.node_contract_upgrades CASCADE CONSTRAINTS DROP TABLE ${schema}.node_identities CASCADE CONSTRAINTS DROP TABLE ${schema}.node_named_identities CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_properties CASCADE CONSTRAINTS DROP TABLE ${schema}.children CASCADE CONSTRAINTS DROP TABLE ${schema}.parents CASCADE CONSTRAINTS DROP TABLE ${schema}.contract_cash_states CASCADE CONSTRAINTS diff --git a/testing/test-utils/src/main/resources/database-scripts/oracle/db-setup.sql b/testing/test-utils/src/main/resources/database-scripts/oracle/db-setup.sql index 17db443f78..10d13b6988 100644 --- a/testing/test-utils/src/main/resources/database-scripts/oracle/db-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/oracle/db-setup.sql @@ -4,6 +4,7 @@ DROP TABLE ${schema}.cp_states_v2_participants CASCADE CONSTRAINTS DROP TABLE ${schema}.dummy_linear_state_parts CASCADE CONSTRAINTS DROP TABLE ${schema}.dummy_linear_states_v2_parts CASCADE CONSTRAINTS DROP TABLE ${schema}.dummy_deal_states_parts CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_attchments_contracts CASCADE CONSTRAINTS DROP TABLE ${schema}.node_attachments CASCADE CONSTRAINTS DROP TABLE ${schema}.node_checkpoints CASCADE CONSTRAINTS DROP TABLE ${schema}.node_transactions CASCADE CONSTRAINTS @@ -14,7 +15,8 @@ DROP TABLE ${schema}.node_our_key_pairs CASCADE CONSTRAINTS DROP TABLE ${schema}.node_scheduled_states CASCADE CONSTRAINTS DROP TABLE ${schema}.node_network_map_nodes CASCADE CONSTRAINTS DROP TABLE ${schema}.node_network_map_subscribers CASCADE CONSTRAINTS -DROP TABLE ${schema}.node_notary_commit_log CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_notary_committed_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_notary_request_log CASCADE CONSTRAINTS DROP TABLE ${schema}.node_transaction_mappings CASCADE CONSTRAINTS DROP TABLE ${schema}.vault_fungible_states_parts CASCADE CONSTRAINTS DROP TABLE ${schema}.vault_linear_states_parts CASCADE CONSTRAINTS @@ -32,6 +34,7 @@ DROP TABLE ${schema}.cp_states CASCADE CONSTRAINTS DROP TABLE ${schema}.node_contract_upgrades CASCADE CONSTRAINTS DROP TABLE ${schema}.node_identities CASCADE CONSTRAINTS DROP TABLE ${schema}.node_named_identities CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_properties CASCADE CONSTRAINTS DROP TABLE ${schema}.children CASCADE CONSTRAINTS DROP TABLE ${schema}.parents CASCADE CONSTRAINTS DROP TABLE ${schema}.contract_cash_states CASCADE CONSTRAINTS diff --git a/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-cleanup.sql b/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-cleanup.sql index 1d09678bfb..a9df0bb443 100644 --- a/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-cleanup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-cleanup.sql @@ -14,7 +14,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-setup.sql b/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-setup.sql index c932c81a39..89369cdecc 100644 --- a/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-global-setup.sql @@ -14,7 +14,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-setup.sql b/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-setup.sql index 1a50f9c050..8d6cced78d 100644 --- a/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/sql-server-no-default-schema/db-setup.sql @@ -14,7 +14,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-cleanup.sql b/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-cleanup.sql index 7d517ee0b0..26154c27cf 100644 --- a/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-cleanup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-cleanup.sql @@ -15,7 +15,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/testing/test-utils/src/main/resources/database-scripts/sql-server/db-setup.sql b/testing/test-utils/src/main/resources/database-scripts/sql-server/db-setup.sql index 91f5d005f3..6941234c1e 100644 --- a/testing/test-utils/src/main/resources/database-scripts/sql-server/db-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/sql-server/db-setup.sql @@ -15,7 +15,8 @@ DROP TABLE IF EXISTS ${schema}.node_our_key_pairs; DROP TABLE IF EXISTS ${schema}.node_scheduled_states; DROP TABLE IF EXISTS ${schema}.node_network_map_nodes; DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers; -DROP TABLE IF EXISTS ${schema}.node_notary_commit_log; +DROP TABLE IF EXISTS ${schema}.node_notary_committed_states; +DROP TABLE IF EXISTS ${schema}.node_notary_request_log; DROP TABLE IF EXISTS ${schema}.node_transaction_mappings; DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts; DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts; diff --git a/tools/shell/src/integration-test/kotlin/net/corda/tools/shell/InteractiveShellIntegrationTest.kt b/tools/shell/src/integration-test/kotlin/net/corda/tools/shell/InteractiveShellIntegrationTest.kt index 7f6dd08390..f7ad7b120e 100644 --- a/tools/shell/src/integration-test/kotlin/net/corda/tools/shell/InteractiveShellIntegrationTest.kt +++ b/tools/shell/src/integration-test/kotlin/net/corda/tools/shell/InteractiveShellIntegrationTest.kt @@ -21,9 +21,15 @@ import net.corda.node.services.Permissions.Companion.all import net.corda.testing.common.internal.withCertificates import net.corda.testing.common.internal.withKeyStores import net.corda.testing.core.ALICE_NAME +import net.corda.testing.core.BOB_NAME +import net.corda.testing.core.DUMMY_BANK_A_NAME +import net.corda.testing.core.DUMMY_NOTARY_NAME import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.driver import net.corda.testing.driver.internal.RandomFree +import net.corda.testing.internal.IntegrationTest +import net.corda.testing.internal.IntegrationTestSchemas +import net.corda.testing.internal.toDatabaseSchemaName import net.corda.testing.internal.useSslRpcOverrides import net.corda.testing.node.User import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException @@ -31,11 +37,18 @@ import org.apache.activemq.artemis.api.core.ActiveMQSecurityException import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.bouncycastle.util.io.Streams +import org.junit.ClassRule import org.junit.Ignore import org.junit.Test import kotlin.test.assertTrue -class InteractiveShellIntegrationTest { +class InteractiveShellIntegrationTest : IntegrationTest() { + companion object { + @ClassRule + @JvmField + val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME, DUMMY_NOTARY_NAME) + .map { it.toDatabaseSchemaName() }.toTypedArray()) + } @Test fun `shell should not log in with invalid credentials`() {