ENT-1634 Fix Primary Key generation for node_notary_request_log table - part 2 (#582)

* Fix node_notary_request_log table - update Liquibase xml migration 
* (Unrelated to ENT-1634) Add database SQL setup for several tests to pass database integration tests, update SQL scripts for new  tables
This commit is contained in:
szymonsztuka 2018-03-21 13:49:25 +00:00 committed by GitHub
parent 75b467e340
commit 49146b1cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 64 additions and 17 deletions

View File

@ -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<Unit>() {

View File

@ -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) {

View File

@ -51,7 +51,7 @@
</changeSet>
<changeSet author="R3.Corda" id="1521131680317-17">
<createTable tableName="node_notary_request_log">
<column autoIncrement="true" name="id" type="INT(10)">
<column name="id" type="INT(10)">
<constraints nullable="false"/>
</column>
<column name="consuming_transaction_id" type="NVARCHAR(64)">

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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`() {