diff --git a/build.gradle b/build.gradle index 55f5373fd9..2ba86a967b 100644 --- a/build.gradle +++ b/build.gradle @@ -206,6 +206,16 @@ allprojects { mavenCentral() jcenter() maven { url 'https://jitpack.io' } + maven { + // For integrationTest task when running against Oracle database the JDBC driver is in Oracle Maven repository with login access only, + // setup an account on https://login.oracle.com/oaam_server/login.do + // provide credentials to Gradle task by -PmavenOracleUsername=... -PmavenOraclePassword=... + url "https://www.oracle.com/content/secure/maven/content" + credentials { + username = project.findProperty("mavenOracleUsername") ?: "" + password = project.findProperty("mavenOraclePassword") ?: "" + } + } } configurations { diff --git a/client/jfx/src/integration-test/kotlin/net/corda/client/jfx/NodeMonitorModelTest.kt b/client/jfx/src/integration-test/kotlin/net/corda/client/jfx/NodeMonitorModelTest.kt index 14178971a9..47f2c95983 100644 --- a/client/jfx/src/integration-test/kotlin/net/corda/client/jfx/NodeMonitorModelTest.kt +++ b/client/jfx/src/integration-test/kotlin/net/corda/client/jfx/NodeMonitorModelTest.kt @@ -33,7 +33,7 @@ import net.corda.testing.driver.driver import net.corda.testing.node.User import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTestSchemas -import net.corda.testing.internal.toDatabaseSchemaNames +import net.corda.testing.internal.toDatabaseSchemaName import org.junit.ClassRule import org.junit.Test import rx.Observable @@ -57,7 +57,7 @@ class NodeMonitorModelTest : IntegrationTest() { companion object { @ClassRule @JvmField val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, CHARLIE_NAME, DUMMY_NOTARY_NAME) - .map { it.toDatabaseSchemaNames("", "_10000", "_10003") }.flatten().toTypedArray()) + .map { it.toDatabaseSchemaName() }.toTypedArray()) } private fun setup(runTest: () -> Unit) { diff --git a/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/RPCStabilityTests.kt b/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/RPCStabilityTests.kt index 1db6b0d09a..8e3b4ed405 100644 --- a/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/RPCStabilityTests.kt +++ b/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/RPCStabilityTests.kt @@ -12,20 +12,13 @@ import net.corda.core.serialization.serialize import net.corda.core.utilities.* import net.corda.node.services.messaging.RPCServerConfiguration import net.corda.nodeapi.RPCApi -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.SerializationEnvironmentRule -import net.corda.testing.internal.IntegrationTest -import net.corda.testing.internal.IntegrationTestSchemas import net.corda.testing.internal.testThreadFactory -import net.corda.testing.internal.toDatabaseSchemaNames import net.corda.testing.node.internal.* import org.apache.activemq.artemis.api.core.SimpleString import org.junit.After import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue -import org.junit.ClassRule import org.junit.Rule import org.junit.Test import rx.Observable @@ -38,7 +31,7 @@ import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger -class RPCStabilityTests : IntegrationTest() { +class RPCStabilityTests { @Rule @JvmField val testSerialization = SerializationEnvironmentRule(true) @@ -48,12 +41,6 @@ class RPCStabilityTests : IntegrationTest() { pool.shutdown() } - companion object { - @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME) - .map { it.toDatabaseSchemaNames("", "_10000", "_10003", "_10012") }.flatten().toTypedArray()) - } - object DummyOps : RPCOps { override val protocolVersion = 0 } diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index a21571ee88..c8267b2afe 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -191,6 +191,8 @@ R3 Corda 3.0 Developer Preview * Enterprise Corda only: Compatibility with PostgreSQL 9.6 database. +* Enterprise Corda only: Compatibility with Oracle 11g RC2 and 12c database. + * Move to a message based control of peer to peer bridge formation to allow for future out of process bridging components. This removes the legacy Artemis bridges completely, so the ``useAMQPBridges`` configuration property has been removed. diff --git a/docs/source/example-code/src/integration-test/kotlin/net/corda/docs/IntegrationTestingTutorial.kt b/docs/source/example-code/src/integration-test/kotlin/net/corda/docs/IntegrationTestingTutorial.kt index f8799e5129..ea99522584 100644 --- a/docs/source/example-code/src/integration-test/kotlin/net/corda/docs/IntegrationTestingTutorial.kt +++ b/docs/source/example-code/src/integration-test/kotlin/net/corda/docs/IntegrationTestingTutorial.kt @@ -26,7 +26,8 @@ import kotlin.test.assertEquals class IntegrationTestingTutorial : IntegrationTest() { companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_NOTARY_NAME).map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(), + DUMMY_NOTARY_NAME.toDatabaseSchemaName()) } @Test diff --git a/docs/source/node-database.rst b/docs/source/node-database.rst index a6633842cd..1835ad5da0 100644 --- a/docs/source/node-database.rst +++ b/docs/source/node-database.rst @@ -63,6 +63,29 @@ Example node configuration for SQL Azure: } jarDirs = [PATH_TO_JDBC_DRIVER_DIR] +Oracle +```````````````````````` +Corda supports Oracle 11g RC2 and Oracle 12c with ojdbc6.jar driver.. +The minimum transaction isolation level ``database.transactionIsolationLevel`` is 'READ_COMMITTED'. +The property ``database.schema`` is optional. + +Example node configuration for Oracle: + +.. sourcecode:: none + + dataSourceProperties = { + dataSourceClassName = "oracle.jdbc.pool.OracleDataSource" + dataSource.url = "jdbc:oracle:thin:@[IP]:[PORT]:xe" + dataSource.user = [USER] + dataSource.password = [PASSWORD] + } + database = { + transactionIsolationLevel = READ_COMMITTED + schema = [SCHEMA] + } + jarDirs = [PATH_TO_JDBC_DRIVER_DIR] +.. _postgres_ref: + PostgreSQL ```````````````````````` Corda has been tested on PostgreSQL 9.6 database, using PostgreSQL JDBC Driver 42.1.4. diff --git a/finance/src/integration-test/kotlin/net/corda/finance/flows/CashConfigDataFlowTest.kt b/finance/src/integration-test/kotlin/net/corda/finance/flows/CashConfigDataFlowTest.kt index ce66f20fd3..95b436d219 100644 --- a/finance/src/integration-test/kotlin/net/corda/finance/flows/CashConfigDataFlowTest.kt +++ b/finance/src/integration-test/kotlin/net/corda/finance/flows/CashConfigDataFlowTest.kt @@ -10,7 +10,7 @@ import net.corda.testing.core.DUMMY_BANK_A_NAME import net.corda.testing.driver.driver import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTestSchemas -import net.corda.testing.internal.toDatabaseSchemaNames +import net.corda.testing.internal.toDatabaseSchemaName import org.assertj.core.api.Assertions.assertThat import org.junit.ClassRule import org.junit.Test @@ -18,8 +18,8 @@ import org.junit.Test class CashConfigDataFlowTest : IntegrationTest() { companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME) - .map { it.toDatabaseSchemaNames("", "_10000", "_10003") }.flatten().toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(), + DUMMY_BANK_A_NAME.toDatabaseSchemaName()) } @Test fun `issuable currencies are read in from node config`() { diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt new file mode 100644 index 0000000000..f5be748995 --- /dev/null +++ b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt @@ -0,0 +1,82 @@ +package net.corda.finance.contracts.asset.cash.selection + +import net.corda.core.contracts.Amount +import net.corda.core.crypto.toStringShort +import net.corda.core.identity.AbstractParty +import net.corda.core.identity.Party +import net.corda.core.utilities.* +import java.sql.Connection +import java.sql.DatabaseMetaData +import java.sql.ResultSet +import java.util.* + +class CashSelectionOracleImpl : AbstractCashSelection(maxRetries = 16, retrySleep = 1000, retryCap = 5000) { + + companion object { + val JDBC_DRIVER_NAME = "Oracle JDBC driver" + private val log = contextLogger() + } + + override fun isCompatible(metaData: DatabaseMetaData): Boolean { + return metaData.driverName == JDBC_DRIVER_NAME + } + + override fun toString() = "${this::class.java} for $JDBC_DRIVER_NAME" + + override fun executeQuery(connection: Connection, amount: Amount, lockId: UUID, notary: Party?, + onlyFromIssuerParties: Set, withIssuerRefs: Set, withResultSet: (ResultSet) -> Boolean): Boolean { + + val selectJoin = """ + WITH entry(transaction_id, output_index, pennies, total, lock_id) AS + ( + SELECT vs.transaction_id, vs.output_index, ccs.pennies, + SUM(ccs.pennies) OVER (ORDER BY ccs.transaction_id), vs.lock_id + FROM contract_cash_states ccs, vault_states vs + WHERE vs.transaction_id = ccs.transaction_id AND vs.output_index = ccs.output_index + AND vs.state_status = 0 + AND ccs.ccy_code = ? + AND (vs.lock_id = ? OR vs.lock_id is null) + """+ + (if (notary != null) + " AND vs.notary_name = ?" else "") + + (if (onlyFromIssuerParties.isNotEmpty()) + " AND ccs.issuer_key IN (?)" else "") + + (if (withIssuerRefs.isNotEmpty()) + " AND ccs.issuer_ref IN (?)" else "") + + """) + SELECT transaction_id, output_index, pennies, total, lock_id + FROM entry where total <= ? + pennies""" + + // Use prepared statement for protection against SQL Injection (http://www.h2database.com/html/advanced.html#sql_injection) + connection.prepareStatement(selectJoin).use { statement -> + var pIndex = 0 + statement.setString(++pIndex, amount.token.currencyCode) + statement.setString(++pIndex, lockId.toString()) + if (notary != null) + statement.setString(++pIndex, notary.name.toString()) + if (onlyFromIssuerParties.isNotEmpty()) + statement.setObject(++pIndex, onlyFromIssuerParties.map { it.owningKey.toStringShort() as Any }.toTypedArray()) + if (withIssuerRefs.isNotEmpty()) + statement.setObject(++pIndex, withIssuerRefs.map { it.bytes.toHexString() as Any }.toTypedArray()) + statement.setLong(++pIndex, amount.quantity) + + // https://stackoverflow.com/questions/2683214/get-query-from-java-sql-preparedstatement + log.trace { + """$selectJoin + + Prepared statement parameter values: + ccy_code = ${amount.token.currencyCode} + lock_id = $lockId + """ + + (if (notary != null) "notary = ${notary.name}" else "") + + (if (onlyFromIssuerParties.isNotEmpty()) "issuer_key IN ${onlyFromIssuerParties.map { it.owningKey.toStringShort() as Any }.toTypedArray()}" else "") + + (if (withIssuerRefs.isNotEmpty()) "issuer_ref IN ${withIssuerRefs.map { it.bytes.toHexString() as Any }.toTypedArray()}" else "") + + "total <= ${amount.quantity}" + } + + statement.executeQuery().use { rs -> + return withResultSet(rs) + } + } + } +} \ No newline at end of file diff --git a/finance/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection b/finance/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection index c989f7f900..5d0666cd76 100644 --- a/finance/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection +++ b/finance/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection @@ -2,3 +2,4 @@ net.corda.finance.contracts.asset.cash.selection.CashSelectionH2Impl net.corda.finance.contracts.asset.cash.selection.CashSelectionMySQLImpl net.corda.finance.contracts.asset.cash.selection.CashSelectionPostgreSQLImpl net.corda.finance.contracts.asset.cash.selection.CashSelectionSQLServerImpl +net.corda.finance.contracts.asset.cash.selection.CashSelectionOracleImpl diff --git a/network-management/src/integration-test/kotlin/com/r3/corda/networkmanage/doorman/NodeRegistrationTest.kt b/network-management/src/integration-test/kotlin/com/r3/corda/networkmanage/doorman/NodeRegistrationTest.kt index 03da226702..863b41bb3c 100644 --- a/network-management/src/integration-test/kotlin/com/r3/corda/networkmanage/doorman/NodeRegistrationTest.kt +++ b/network-management/src/integration-test/kotlin/com/r3/corda/networkmanage/doorman/NodeRegistrationTest.kt @@ -46,8 +46,7 @@ class NodeRegistrationTest : IntegrationTest() { private val aliceName = CordaX500Name("Alice", "London", "GB") private val genevieveName = CordaX500Name("Genevieve", "London", "GB") - @ClassRule - @JvmField + @ClassRule @JvmField val databaseSchemas = IntegrationTestSchemas(notaryName.organisation, aliceName.organisation, genevieveName.organisation) private val timeoutMillis = 5.seconds.toMillis() diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/HibernateConfiguration.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/HibernateConfiguration.kt index 3861edb4a3..81d314eab3 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/HibernateConfiguration.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/HibernateConfiguration.kt @@ -39,9 +39,9 @@ class HibernateConfiguration( // to avoid OOM when large blobs might get logged. applyBasicType(CordaMaterializedBlobType, CordaMaterializedBlobType.name) applyBasicType(CordaWrapperBinaryType, CordaWrapperBinaryType.name) - // When connecting to SqlServer (and only then) do we need to tell hibernate to use + // When connecting to SqlServer or Oracle, do we need to tell hibernate to use // nationalised (i.e. Unicode) strings by default - val forceUnicodeForSqlServer = jdbcUrl.contains(":sqlserver:", ignoreCase = true) + val forceUnicodeForSqlServer = listOf(":oracle:", ":sqlserver:").any { jdbcUrl.contains(it, ignoreCase = true) } enableGlobalNationalizedCharacterDataSupport(forceUnicodeForSqlServer) return build() } diff --git a/node/build.gradle b/node/build.gradle index 6befdeb25a..8b4ff9c806 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -51,13 +51,6 @@ processTestResources { from file("$rootDir/config/test/jolokia-access.xml") } -// Map DB provider to driver artifact imported as runtime dependency in integration tests. -def jdbcRuntimeDependency = [ - 'integration-sql-server': "com.microsoft.sqlserver:mssql-jdbc:6.2.1.jre8", - 'integration-azure-sql' : "com.microsoft.sqlserver:mssql-jdbc:6.2.1.jre8", - 'integration-postgres' : "org.postgresql:postgresql:${postgresql_version}" -] - // To find potential version conflicts, run "gradle htmlDependencyReport" and then look in // build/reports/project/dependencies/index.html for green highlighted parts of the tree. @@ -196,15 +189,36 @@ dependencies { testCompile "org.glassfish.jersey.containers:jersey-container-servlet-core:${jersey_version}" testCompile "org.glassfish.jersey.containers:jersey-container-jetty-http:${jersey_version}" - // Add runtime-only dependency on the JDBC driver for the specified DB provider + // Add runtime-only dependency on the JDBC driver for the specified DB provider (used in database integration tests) def DB_PROVIDER = System.getProperty("databaseProvider") - if (DB_PROVIDER != null) { - final driverDependency = jdbcRuntimeDependency[DB_PROVIDER] - if (driverDependency != null) { - runtime driverDependency - } else { + switch (DB_PROVIDER) { + case null: //DB provider not provided, use default H2 driver (already in the classpath) + break + case "integration-sql-server" : + runtime "com.microsoft.sqlserver:mssql-jdbc:6.2.1.jre8" + break + case "integration-azure-sql" : + runtime "com.microsoft.sqlserver:mssql-jdbc:6.2.1.jre8" + break + case "integration-oracle" : + runtime ("com.oracle.jdbc:ojdbc8:12.2.0.1") { //exclude unnecessary or conflicting libraries + exclude group: "com.oracle.jdbc", module: "ucp" + exclude group: "com.oracle.jdbc", module: "ons" + exclude group: "com.oracle.jdbc", module: "xmlparserv2" + exclude group: "com.oracle.jdbc", module: "xdb6" + exclude group: "com.oracle.jdbc", module: "oraclepki" + exclude group: "com.oracle.jdbc", module: "osdt_cert" + exclude group: "com.oracle.jdbc", module: "osdt_core" + } + break + case "integration-oracle-11" : + runtime files("lib/ojdbc6.jar") + break + case "integration-postgres" : + runtime "org.postgresql:postgresql:${postgresql_version}" + break + default: throw new GradleException('Unsupported DB provider: ' + DB_PROVIDER) - } } // Jolokia JVM monitoring agent diff --git a/node/lib/ojdbc6.jar b/node/lib/ojdbc6.jar new file mode 100644 index 0000000000..767eba7f8f Binary files /dev/null and b/node/lib/ojdbc6.jar differ diff --git a/node/src/integration-test/kotlin/net/corda/node/BootTests.kt b/node/src/integration-test/kotlin/net/corda/node/BootTests.kt index fc94c70957..5a9ebb8db8 100644 --- a/node/src/integration-test/kotlin/net/corda/node/BootTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/BootTests.kt @@ -17,7 +17,6 @@ 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.internal.toDatabaseSchemaNames import net.corda.testing.node.User import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy @@ -30,9 +29,8 @@ import kotlin.test.assertEquals class BootTests : IntegrationTest() { companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME) - .map { it.toDatabaseSchemaNames("", "_10000", "_10003") }.flatten().toTypedArray() - + DUMMY_NOTARY_NAME.toDatabaseSchemaName()) + val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME, DUMMY_NOTARY_NAME) + .map { it.toDatabaseSchemaName() }.toTypedArray()) } @Test diff --git a/node/src/integration-test/kotlin/net/corda/node/NodeStartupPerformanceTests.kt b/node/src/integration-test/kotlin/net/corda/node/NodeStartupPerformanceTests.kt index 1a88d55f35..f87866ec58 100644 --- a/node/src/integration-test/kotlin/net/corda/node/NodeStartupPerformanceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/NodeStartupPerformanceTests.kt @@ -4,6 +4,7 @@ import com.google.common.base.Stopwatch 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.driver import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTestSchemas @@ -18,7 +19,8 @@ import java.util.concurrent.TimeUnit class NodeStartupPerformanceTests : IntegrationTest() { companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME).map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME, DUMMY_NOTARY_NAME) + .map { it.toDatabaseSchemaName() }.toTypedArray()) } // Measure the startup time of nodes. Note that this includes an RPC roundtrip, which causes e.g. Kryo initialisation. @Test diff --git a/node/src/integration-test/kotlin/net/corda/node/NodeUnloadHandlerTests.kt b/node/src/integration-test/kotlin/net/corda/node/NodeUnloadHandlerTests.kt index ef2cb6f2d4..93017dca96 100644 --- a/node/src/integration-test/kotlin/net/corda/node/NodeUnloadHandlerTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/NodeUnloadHandlerTests.kt @@ -7,14 +7,19 @@ import net.corda.core.utilities.contextLogger import net.corda.core.utilities.getOrThrow import net.corda.testing.core.DUMMY_BANK_A_NAME 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 org.junit.Assert +import org.junit.ClassRule import org.junit.Test import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit -class NodeUnloadHandlerTests { - +class NodeUnloadHandlerTests : IntegrationTest() { companion object { + @ClassRule @JvmField + val databaseSchemas = IntegrationTestSchemas(DUMMY_BANK_A_NAME.toDatabaseSchemaName()) val latch = CountDownLatch(1) } diff --git a/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt b/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt index e29101e305..5d08770459 100644 --- a/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt @@ -13,6 +13,7 @@ import net.corda.core.utilities.getOrThrow import net.corda.core.utilities.unwrap import net.corda.node.services.Permissions.Companion.startFlow import net.corda.testing.core.ALICE_NAME +import net.corda.testing.core.DUMMY_NOTARY_NAME import net.corda.testing.driver.driver import net.corda.testing.internal.IntegrationTest import net.corda.testing.internal.IntegrationTestSchemas @@ -30,7 +31,7 @@ import kotlin.test.fail class SSHServerTest : IntegrationTest() { companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName()) + val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), DUMMY_NOTARY_NAME.toDatabaseSchemaName()) } @Test() diff --git a/node/src/integration-test/kotlin/net/corda/node/services/AttachmentLoadingTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/AttachmentLoadingTests.kt index 5a2a963979..31cefd3121 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/AttachmentLoadingTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/AttachmentLoadingTests.kt @@ -46,8 +46,8 @@ class AttachmentLoadingTests : IntegrationTest() { private companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(DUMMY_BANK_A_NAME, DUMMY_BANK_B_NAME, DUMMY_NOTARY_NAME) - .map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(DUMMY_BANK_A_NAME.toDatabaseSchemaName(), DUMMY_BANK_B_NAME.toDatabaseSchemaName(), + DUMMY_NOTARY_NAME.toDatabaseSchemaName()) private val logger = contextLogger() val isolatedJAR = AttachmentLoadingTests::class.java.getResource("isolated.jar")!! diff --git a/node/src/integration-test/kotlin/net/corda/node/services/DistributedServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/DistributedServiceTests.kt index 97f31e509a..3f5571dfc3 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/DistributedServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/DistributedServiceTests.kt @@ -26,7 +26,6 @@ import net.corda.testing.node.User import net.corda.testing.node.internal.DummyClusterSpec import org.assertj.core.api.Assertions.assertThat import org.junit.ClassRule -import org.junit.Ignore import org.junit.Test import rx.Observable import java.util.* diff --git a/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt index 03e33a71d1..f02519696f 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt @@ -11,7 +11,6 @@ import net.corda.core.internal.concurrent.map import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.getOrThrow import net.corda.node.internal.StartedNode -import net.corda.testing.* import net.corda.testing.core.DUMMY_BANK_A_NAME import net.corda.testing.core.chooseIdentity import net.corda.testing.contracts.DummyContract @@ -25,7 +24,6 @@ import net.corda.testing.node.ClusterSpec import net.corda.testing.node.NotarySpec import net.corda.testing.node.startFlow import org.junit.ClassRule -import org.junit.Ignore import org.junit.Test import java.util.* import kotlin.test.assertEquals diff --git a/node/src/integration-test/kotlin/net/corda/node/services/network/PersistentNetworkMapCacheTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/network/PersistentNetworkMapCacheTest.kt index cf4399a62d..aebec2e4f9 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/network/PersistentNetworkMapCacheTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/network/PersistentNetworkMapCacheTest.kt @@ -7,7 +7,6 @@ import net.corda.core.node.NodeInfo import net.corda.core.utilities.NetworkHostAndPort import net.corda.node.internal.Node import net.corda.node.internal.StartedNode -import net.corda.testing.* import net.corda.testing.internal.IntegrationTestSchemas import net.corda.testing.internal.toDatabaseSchemaName import net.corda.testing.core.* @@ -25,7 +24,8 @@ class PersistentNetworkMapCacheTest : NodeBasedTest() { val DUMMY_REGULATOR = TestIdentity(CordaX500Name("Regulator A", "Paris", "FR"), 100).party @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(DUMMY_REGULATOR.name, ALICE.name, BOB.name).map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(DUMMY_REGULATOR.name.toDatabaseSchemaName(), ALICE.name.toDatabaseSchemaName(), + BOB.name.toDatabaseSchemaName()) } private val partiesList = listOf(DUMMY_REGULATOR, ALICE, BOB) private val addressesMap = HashMap() diff --git a/node/src/integration-test/kotlin/net/corda/node/services/rpc/RpcSslTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/rpc/RpcSslTest.kt index 03387d9a13..8c15d08855 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/rpc/RpcSslTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/rpc/RpcSslTest.kt @@ -5,14 +5,25 @@ import net.corda.core.utilities.getOrThrow import net.corda.node.services.Permissions.Companion.all import net.corda.node.testsupport.withCertificates import net.corda.node.testsupport.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.PortAllocation import net.corda.testing.driver.driver -import net.corda.testing.internal.useSslRpcOverrides +import net.corda.testing.internal.* import net.corda.testing.node.User import org.assertj.core.api.Assertions.assertThat +import org.junit.ClassRule import org.junit.Test -class RpcSslTest { +class RpcSslTest : 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 rpc_client_using_ssl() { val user = User("mark", "dadada", setOf(all())) diff --git a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/FlowVersioningTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/FlowVersioningTest.kt index 74219dc28d..3d47e35b34 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/FlowVersioningTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/FlowVersioningTest.kt @@ -7,7 +7,6 @@ import net.corda.core.flows.InitiatingFlow import net.corda.core.identity.Party import net.corda.core.utilities.getOrThrow import net.corda.core.utilities.unwrap -import net.corda.testing.* import net.corda.testing.internal.IntegrationTestSchemas import net.corda.testing.internal.toDatabaseSchemaName import net.corda.testing.core.chooseIdentity diff --git a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt index eff056da10..7ecbd45bbe 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt @@ -30,7 +30,8 @@ class LargeTransactionsTest : IntegrationTest() { val BOB = TestIdentity(BOB_NAME, 80).party val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_NOTARY_NAME).map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(), + DUMMY_NOTARY_NAME.toDatabaseSchemaName()) } @StartableByRPC diff --git a/node/src/integration-test/kotlin/net/corda/test/node/NodeStartAndStopTest.kt b/node/src/integration-test/kotlin/net/corda/test/node/NodeStartAndStopTest.kt index 310d653926..311a126fee 100644 --- a/node/src/integration-test/kotlin/net/corda/test/node/NodeStartAndStopTest.kt +++ b/node/src/integration-test/kotlin/net/corda/test/node/NodeStartAndStopTest.kt @@ -2,10 +2,17 @@ package net.corda.test.node import net.corda.core.utilities.getOrThrow import net.corda.testing.core.ALICE_NAME +import net.corda.testing.internal.IntegrationTestSchemas +import net.corda.testing.internal.toDatabaseSchemaName import net.corda.testing.node.internal.NodeBasedTest +import org.junit.ClassRule import org.junit.Test class NodeStartAndStopTest : NodeBasedTest() { + companion object { + @ClassRule @JvmField + val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName()) + } @Test fun `start stop start`() { diff --git a/node/src/integration-test/kotlin/net/corda/test/node/NodeStatePersistenceTests.kt b/node/src/integration-test/kotlin/net/corda/test/node/NodeStatePersistenceTests.kt index 422d361203..518a16bbc1 100644 --- a/node/src/integration-test/kotlin/net/corda/test/node/NodeStatePersistenceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/test/node/NodeStatePersistenceTests.kt @@ -25,7 +25,6 @@ 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.internal.toDatabaseSchemaNames import net.corda.testing.node.User import org.junit.Assume.assumeFalse import org.junit.ClassRule @@ -40,9 +39,8 @@ import kotlin.test.assertNotNull class NodeStatePersistenceTests : IntegrationTest() { companion object { @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME) - .map { it.toDatabaseSchemaNames("", "_10000", "_10003", "_10006") }.flatten().toTypedArray(), - DUMMY_NOTARY_NAME.toDatabaseSchemaName()) + val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME, DUMMY_NOTARY_NAME) + .map { it.toDatabaseSchemaName() }.toTypedArray()) } @Test fun `persistent state survives node restart`() { diff --git a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt index 85055a3fab..c58d21b359 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt @@ -9,7 +9,6 @@ import net.corda.core.internal.createDirectories import net.corda.core.internal.div import net.corda.core.internal.exists import net.corda.nodeapi.internal.config.SSLConfiguration -import net.corda.nodeapi.internal.config.toProperties import net.corda.nodeapi.internal.createDevKeyStores import net.corda.nodeapi.internal.crypto.X509KeyStore import net.corda.nodeapi.internal.crypto.loadKeyStore @@ -31,23 +30,12 @@ object ConfigHelper { val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig)) val databaseConfig = ConfigFactory.parseResources(System.getProperty("databaseProvider")+".conf", parseOptions.setAllowMissing(true)) - //typesafe workaround: a system property with placeholder is passed as value (inside quotes), - //undo adding the quotes for a fixed placeholder ${nodeOrganizationName} - //https://github.com/lightbend/config/issues/265 - var systemUnquotedPlaceholders: Config = ConfigFactory.empty() - ConfigFactory.systemProperties().toProperties().forEach { name, value -> - if (value.toString().contains("\${nodeOrganizationName}")) { - var unquotedPlaceholder = "\"" + value.toString().replace("\${nodeOrganizationName}","\"\${nodeOrganizationName}\"") + "\"" - systemUnquotedPlaceholders = systemUnquotedPlaceholders.withFallback(ConfigFactory.parseString(name.toString() + " = " + unquotedPlaceholder)) - } - } val finalConfig = configOverrides // Add substitution values here - .withFallback(systemUnquotedPlaceholders) - .withFallback(configOf("nodeOrganizationName" to baseDirectory.fileName.toString().replace(" ","").replace("-","_"))) - .withFallback(ConfigFactory.systemProperties()) - .withFallback( configOf("baseDirectory" to baseDirectory.toString())) - .withFallback(databaseConfig) + .withFallback(configOf("nodeOrganizationName" to parseToDbSchemaFriendlyName(baseDirectory.fileName.toString()))) //for database integration tests + .withFallback(ConfigFactory.systemProperties()) //for database integration tests + .withFallback(configOf("baseDirectory" to baseDirectory.toString())) + .withFallback(databaseConfig) //for database integration tests .withFallback(appConfig) .withFallback(defaultConfig) .resolve() @@ -88,3 +76,6 @@ fun SSLConfiguration.configureDevKeyAndTrustStores(myLegalName: CordaX500Name) { } } } +/** Parse a value to be database schema name friendly and removes the last part if it matches a port ("_" followed by at least 5 digits) */ +fun parseToDbSchemaFriendlyName(value: String) = + value.replace(" ", "").replace("-", "_").replace(Regex("_\\d{5,}$"),"") diff --git a/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapCache.kt b/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapCache.kt index 0e6d2c2993..56d574a566 100644 --- a/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapCache.kt +++ b/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapCache.kt @@ -274,9 +274,10 @@ open class PersistentNetworkMapCache( private fun queryIdentityByLegalName(session: Session, name: CordaX500Name): PartyAndCertificate? { val query = session.createQuery( // We do the JOIN here to restrict results to those present in the network map - "SELECT DISTINCT l FROM ${NodeInfoSchemaV1.PersistentNodeInfo::class.java.name} n JOIN n.legalIdentitiesAndCerts l WHERE l.name = :name", + "SELECT l FROM ${NodeInfoSchemaV1.PersistentNodeInfo::class.java.name} n JOIN n.legalIdentitiesAndCerts l WHERE l.name = :name", NodeInfoSchemaV1.DBPartyAndCertificate::class.java) query.setParameter("name", name.toString()) + query.maxResults = 1 // instead of DISTINCT in the query, DISTINCT is not supported in Oracle when one of the columns is BLOB val candidates = query.resultList.map { it.toLegalIdentityAndCert() } // The map is restricted to holding a single identity for any X.500 name, so firstOrNull() is correct here. return candidates.firstOrNull() diff --git a/node/src/main/resources/migration/common.changelog-init.xml b/node/src/main/resources/migration/common.changelog-init.xml index e309a4e33a..d555586648 100644 --- a/node/src/main/resources/migration/common.changelog-init.xml +++ b/node/src/main/resources/migration/common.changelog-init.xml @@ -16,5 +16,8 @@ + + + diff --git a/node/src/main/resources/migration/node-core.changelog-init.xml b/node/src/main/resources/migration/node-core.changelog-init.xml index a1f9f1c01f..714467dd2d 100644 --- a/node/src/main/resources/migration/node-core.changelog-init.xml +++ b/node/src/main/resources/migration/node-core.changelog-init.xml @@ -115,8 +115,7 @@ - + @@ -163,6 +162,11 @@ referencedColumnNames="party_name" referencedTableName="node_info_party_cert"/> + + + + + diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt index 2f8721462f..cdf19e3e8a 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt @@ -41,6 +41,7 @@ import java.time.LocalDate import java.time.ZoneOffset import java.time.temporal.ChronoUnit import java.util.* +import kotlin.test.assertTrue open class VaultQueryTests { private companion object { diff --git a/perftestcordapp/src/main/kotlin/com/r3/corda/enterprise/perftestcordapp/schemas/CommercialPaperSchemaV1.kt b/perftestcordapp/src/main/kotlin/com/r3/corda/enterprise/perftestcordapp/schemas/CommercialPaperSchemaV1.kt index 0c3f2257f6..f19c21fe22 100644 --- a/perftestcordapp/src/main/kotlin/com/r3/corda/enterprise/perftestcordapp/schemas/CommercialPaperSchemaV1.kt +++ b/perftestcordapp/src/main/kotlin/com/r3/corda/enterprise/perftestcordapp/schemas/CommercialPaperSchemaV1.kt @@ -36,6 +36,7 @@ object CommercialPaperSchemaV1 : MappedSchema(schemaFamily = CommercialPaperSche var issuancePartyHash: String, @Column(name = "issuance_ref") + @Type(type = "corda-wrapper-binary") var issuanceRef: ByteArray, @Column(name = "owner_key_hash", length = MAX_HASH_HEX_SIZE) diff --git a/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt b/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt index 2af05b4e1a..7967e20a6b 100644 --- a/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt +++ b/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt @@ -45,8 +45,8 @@ class IRSDemoTest : IntegrationTest() { private val log = contextLogger() @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(DUMMY_BANK_A_NAME, DUMMY_BANK_B_NAME, DUMMY_NOTARY_NAME) - .map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(DUMMY_BANK_A_NAME.toDatabaseSchemaName(), DUMMY_BANK_B_NAME.toDatabaseSchemaName(), + DUMMY_NOTARY_NAME.toDatabaseSchemaName()) } private val rpcUsers = listOf(User("user", "password", setOf("ALL"))) diff --git a/testing/node-driver/src/integration-test/kotlin/net/corda/testing/driver/DriverTests.kt b/testing/node-driver/src/integration-test/kotlin/net/corda/testing/driver/DriverTests.kt index 0c4656e2f1..ea02add1b3 100644 --- a/testing/node-driver/src/integration-test/kotlin/net/corda/testing/driver/DriverTests.kt +++ b/testing/node-driver/src/integration-test/kotlin/net/corda/testing/driver/DriverTests.kt @@ -45,8 +45,8 @@ class DriverTests : IntegrationTest() { } @ClassRule @JvmField - val databaseSchemas = IntegrationTestSchemas(*listOf(DUMMY_BANK_A_NAME, DUMMY_NOTARY_NAME, DUMMY_REGULATOR_NAME) - .map { it.toDatabaseSchemaName() }.toTypedArray()) + val databaseSchemas = IntegrationTestSchemas(DUMMY_BANK_A_NAME.toDatabaseSchemaName(), DUMMY_NOTARY_NAME.toDatabaseSchemaName(), + DUMMY_REGULATOR_NAME.toDatabaseSchemaName()) } @Test diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt index c9998f6c9a..46ba85842f 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt @@ -28,6 +28,7 @@ import net.corda.node.services.api.SchemaService import net.corda.node.services.api.VaultServiceInternal import net.corda.node.services.api.WritableTransactionStorage import net.corda.node.services.config.configOf +import net.corda.node.services.config.parseToDbSchemaFriendlyName import net.corda.node.services.identity.InMemoryIdentityService import net.corda.node.services.keys.freshCertificate import net.corda.node.services.keys.getSigner @@ -360,12 +361,11 @@ fun databaseProviderDataSourceConfig(nodeName: String? = null, postfix: String? val fixedOverride = ConfigFactory.parseString("baseDirectory = \"\"") //implied property nodeOrganizationName to fill the potential placeholders in db schema/ db user properties - val standardizedNodeName = nodeName?.replace(" ", "")?.replace("-", "_") - val nodeOrganizationNameConfig = if (standardizedNodeName != null) configOf("nodeOrganizationName" to standardizedNodeName) else ConfigFactory.empty() + val nodeOrganizationNameConfig = if (nodeName != null) configOf("nodeOrganizationName" to parseToDbSchemaFriendlyName(nodeName)) else ConfigFactory.empty() //defaults to H2 //for H2 the same db instance runs for all integration tests, so adding additional variable postfix create a unique database each time - val defaultConfig = inMemoryH2DataSourceConfig(standardizedNodeName, postfix) + val defaultConfig = inMemoryH2DataSourceConfig(nodeName, postfix) return systemConfigOverride.withFallback(databaseConfig) .withFallback(fixedOverride) diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/database/DbScriptRunner.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/database/DbScriptRunner.kt index 06cd06fd39..06c8e5a25d 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/database/DbScriptRunner.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/database/DbScriptRunner.kt @@ -7,7 +7,6 @@ import net.corda.testing.database.DatabaseConstants.DATA_SOURCE_CLASSNAME import net.corda.testing.database.DatabaseConstants.DATA_SOURCE_PASSWORD import net.corda.testing.database.DatabaseConstants.DATA_SOURCE_URL import net.corda.testing.database.DatabaseConstants.DATA_SOURCE_USER -import org.apache.commons.logging.LogFactory import org.springframework.core.io.ClassPathResource import org.springframework.core.io.support.EncodedResource import org.springframework.jdbc.datasource.DriverManagerDataSource @@ -19,7 +18,7 @@ import java.sql.SQLWarning import java.util.* object DbScriptRunner { - private val log = loggerFor() + private val logger = loggerFor() // System properties set in main 'corda-project' build.gradle private const val TEST_DB_ADMIN_USER = "test.db.admin.user" @@ -50,10 +49,10 @@ object DbScriptRunner { val encodedResource = EncodedResource(initSchema) val inputString = encodedResource.inputStream.bufferedReader().use { it.readText().split("\n") } val resolvedScripts = merge(inputString, databaseSchemas) - log.info("Executing DB Script for schemas $databaseSchemas with ${resolvedScripts.size} statements.") + logger.info("Executing DB Script for schemas $databaseSchemas with ${resolvedScripts.size} statements.") DatabasePopulatorUtils.execute(ListPopulator(false, true, resolvedScripts), createDataSource(dbProvider)) - } else log.warn("DB Script missing: $initSchema") + } else logger.warn("DB Script missing: $initSchema") } } @@ -68,15 +67,11 @@ object DbScriptRunner { class ListPopulator(private val continueOnError: Boolean, private val ignoreFailedDrops: Boolean, private val statements: List) : DatabasePopulator { - private val logger = LogFactory.getLog(ScriptUtils::class.java) - + private val logger = loggerFor() override fun populate(connection: Connection) { try { - if (logger.isInfoEnabled) { - logger.info("Executing SQL script " ) - } + logger.info("Executing SQL script") val startTime = System.currentTimeMillis() - val resource = statements.toString().substring(0,30) + " [...]" var stmtNumber = 0 val stmt = connection.createStatement() try { @@ -97,9 +92,14 @@ class ListPopulator(private val continueOnError: Boolean, } } catch (ex: SQLException) { val dropStatement = StringUtils.startsWithIgnoreCase(statement.trim { it <= ' ' }, "drop") - if (continueOnError || dropStatement && ignoreFailedDrops) { - if (logger.isDebugEnabled) { - logger.debug(ex) + if ((continueOnError || dropStatement && ignoreFailedDrops)) { + val dropUserStatement = StringUtils.startsWithIgnoreCase(statement.trim { it <= ' ' }, "drop user ") + if (dropUserStatement) { // log to help spotting a node still logged on database after test has finished (happens on Oracle db) + logger.warn("SQLException for $statement: SQL state '" + ex.sqlState + + "', error code '" + ex.errorCode + + "', message [" + ex.message + "]") + } else { + logger.debug("SQLException for $statement", ex) } } else { throw ex @@ -113,12 +113,9 @@ class ListPopulator(private val continueOnError: Boolean, logger.debug("Could not close JDBC Statement", ex) } } - val elapsedTime = System.currentTimeMillis() - startTime - if (logger.isInfoEnabled) { - logger.info("Executed SQL script from $resource in $elapsedTime ms.") - } - logger.info("Executed SQL script $resource" ) + val resource = if (statements.isNotEmpty()) statements[0] + " [...]" else "" + logger.info("Executed ${statements.size} SQL statements ($resource) in $elapsedTime ms.") } catch (ex: Exception) { if (ex is ScriptException) { throw ex diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/http/HttpUtils.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/http/HttpUtils.kt index 5e87f4e36b..4ade993405 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/http/HttpUtils.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/http/HttpUtils.kt @@ -16,7 +16,7 @@ object HttpUtils { private val client by lazy { OkHttpClient.Builder() .connectTimeout(5, TimeUnit.SECONDS) - .readTimeout(60, TimeUnit.SECONDS).build() + .readTimeout(90, TimeUnit.SECONDS).build() } val defaultMapper: ObjectMapper by lazy { diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/internal/vault/DummyLinearStateSchemaV1.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/internal/vault/DummyLinearStateSchemaV1.kt index f0770d7317..6f7455e1d7 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/internal/vault/DummyLinearStateSchemaV1.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/internal/vault/DummyLinearStateSchemaV1.kt @@ -32,7 +32,7 @@ object DummyLinearStateSchemaV1 : MappedSchema(schemaFamily = DummyLinearStateSc /** X500Name of participant parties **/ @ElementCollection @Column(name = "participants") - @CollectionTable(name = "dummy_linear_state_participants", joinColumns = arrayOf( + @CollectionTable(name = "dummy_linear_state_parts", joinColumns = arrayOf( JoinColumn(name = "output_index", referencedColumnName = "output_index"), JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id"))) var participants: MutableSet, 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 dcbe40676f..bfd9d28209 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; 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 88b4b33df3..1a50f9c050 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; diff --git a/testing/test-utils/src/main/resources/database-scripts/azure-sql/master-user-setup.sql b/testing/test-utils/src/main/resources/database-scripts/azure-sql/master-user-setup.sql index 99ae6d18f6..a259de7838 100644 --- a/testing/test-utils/src/main/resources/database-scripts/azure-sql/master-user-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/azure-sql/master-user-setup.sql @@ -1,37 +1,17 @@ --once off script to run against master database (not a user database) CREATE LOGIN Alice WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN AliceCorp WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN AliceCorp_10000 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN AliceCorp_10003 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN AliceCorp_10006 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN AliceCorp_10012 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN BankA WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BankA_10000 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BankA_10003 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BankA_10006 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BankA_10012 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN BankB WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN BankOfCorda WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN BigCorporation WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN BobPlc WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BobPlc_10000 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BobPlc_10003 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BobPlc_10006 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN BobPlc_10012 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN CharlieLtd WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN CharlieLtd_10000 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN CharlieLtd_10003 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN CharlieLtd_10006 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN DistributedService_0 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN DistributedService_1 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN NetworkMapService WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN Notary WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN NotaryService WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN NotaryService_10000 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN NotaryService_10003 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN NotaryService0 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN NotaryService1 WITH PASSWORD = 'yourStrong(!)Password'; -CREATE LOGIN NotaryService2 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN NotaryService_0 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN NotaryService_1 WITH PASSWORD = 'yourStrong(!)Password'; CREATE LOGIN NotaryService_2 WITH PASSWORD = 'yourStrong(!)Password'; 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 new file mode 100644 index 0000000000..17db443f78 --- /dev/null +++ b/testing/test-utils/src/main/resources/database-scripts/oracle/db-cleanup.sql @@ -0,0 +1,51 @@ +DROP TABLE ${schema}.cash_state_participants CASCADE CONSTRAINTS +DROP TABLE ${schema}.cash_states_v2_participants CASCADE CONSTRAINTS +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_attachments CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_checkpoints CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_transactions CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_message_retry CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_message_ids CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_states CASCADE CONSTRAINTS +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_transaction_mappings CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_fungible_states_parts CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_linear_states_parts CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_fungible_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_linear_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_bft_committed_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_raft_committed_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_transaction_notes CASCADE CONSTRAINTS +DROP TABLE ${schema}.link_nodeinfo_party CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_link_nodeinfo_party CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_info_party_cert CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_info_hosts CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_infos CASCADE CONSTRAINTS +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}.children CASCADE CONSTRAINTS +DROP TABLE ${schema}.parents CASCADE CONSTRAINTS +DROP TABLE ${schema}.contract_cash_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.contract_cash_states_v1 CASCADE CONSTRAINTS +DROP TABLE ${schema}.messages CASCADE CONSTRAINTS +DROP TABLE ${schema}.state_participants CASCADE CONSTRAINTS +DROP TABLE ${schema}.cash_states_v2 CASCADE CONSTRAINTS +DROP TABLE ${schema}.cash_states_v3 CASCADE CONSTRAINTS +DROP TABLE ${schema}.cp_states_v1 CASCADE CONSTRAINTS +DROP TABLE ${schema}.cp_states_v2 CASCADE CONSTRAINTS +DROP TABLE ${schema}.dummy_deal_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.dummy_linear_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.dummy_linear_states_v2 CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_mutual_exclusion CASCADE CONSTRAINTS +DROP TABLE ${schema}.DATABASECHANGELOG CASCADE CONSTRAINTS +DROP TABLE ${schema}.DATABASECHANGELOGLOCK CASCADE CONSTRAINTS +DROP SEQUENCE ${schema}.hibernate_sequence \ No newline at end of file diff --git a/testing/test-utils/src/main/resources/database-scripts/oracle/db-global-cleanup.sql b/testing/test-utils/src/main/resources/database-scripts/oracle/db-global-cleanup.sql new file mode 100644 index 0000000000..ead9872349 --- /dev/null +++ b/testing/test-utils/src/main/resources/database-scripts/oracle/db-global-cleanup.sql @@ -0,0 +1 @@ +DROP USER ${schema} CASCADE \ No newline at end of file diff --git a/testing/test-utils/src/main/resources/database-scripts/oracle/db-global-setup.sql b/testing/test-utils/src/main/resources/database-scripts/oracle/db-global-setup.sql new file mode 100644 index 0000000000..aa3c3b6090 --- /dev/null +++ b/testing/test-utils/src/main/resources/database-scripts/oracle/db-global-setup.sql @@ -0,0 +1,7 @@ +DROP USER ${schema} CASCADE +CREATE USER ${schema} IDENTIFIED BY 1234 +GRANT UNLIMITED TABLESPACE TO ${schema} +GRANT CREATE SESSION TO ${schema} +GRANT CREATE TABLE TO ${schema} +GRANT CREATE SEQUENCE TO ${schema} +GRANT ALL PRIVILEGES TO ${schema} IDENTIFIED BY 1234 \ No newline at end of file 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 new file mode 100644 index 0000000000..17db443f78 --- /dev/null +++ b/testing/test-utils/src/main/resources/database-scripts/oracle/db-setup.sql @@ -0,0 +1,51 @@ +DROP TABLE ${schema}.cash_state_participants CASCADE CONSTRAINTS +DROP TABLE ${schema}.cash_states_v2_participants CASCADE CONSTRAINTS +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_attachments CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_checkpoints CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_transactions CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_message_retry CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_message_ids CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_states CASCADE CONSTRAINTS +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_transaction_mappings CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_fungible_states_parts CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_linear_states_parts CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_fungible_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_linear_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_bft_committed_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_raft_committed_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.vault_transaction_notes CASCADE CONSTRAINTS +DROP TABLE ${schema}.link_nodeinfo_party CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_link_nodeinfo_party CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_info_party_cert CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_info_hosts CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_infos CASCADE CONSTRAINTS +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}.children CASCADE CONSTRAINTS +DROP TABLE ${schema}.parents CASCADE CONSTRAINTS +DROP TABLE ${schema}.contract_cash_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.contract_cash_states_v1 CASCADE CONSTRAINTS +DROP TABLE ${schema}.messages CASCADE CONSTRAINTS +DROP TABLE ${schema}.state_participants CASCADE CONSTRAINTS +DROP TABLE ${schema}.cash_states_v2 CASCADE CONSTRAINTS +DROP TABLE ${schema}.cash_states_v3 CASCADE CONSTRAINTS +DROP TABLE ${schema}.cp_states_v1 CASCADE CONSTRAINTS +DROP TABLE ${schema}.cp_states_v2 CASCADE CONSTRAINTS +DROP TABLE ${schema}.dummy_deal_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.dummy_linear_states CASCADE CONSTRAINTS +DROP TABLE ${schema}.dummy_linear_states_v2 CASCADE CONSTRAINTS +DROP TABLE ${schema}.node_mutual_exclusion CASCADE CONSTRAINTS +DROP TABLE ${schema}.DATABASECHANGELOG CASCADE CONSTRAINTS +DROP TABLE ${schema}.DATABASECHANGELOGLOCK CASCADE CONSTRAINTS +DROP SEQUENCE ${schema}.hibernate_sequence \ No newline at end of file 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 7051c5e8c7..1d09678bfb 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; 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 9a8eb485c1..c932c81a39 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; 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 88b4b33df3..1a50f9c050 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; 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 417102c39c..2ec1694431 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; diff --git a/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-setup.sql b/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-setup.sql index 78f93c3b80..499c7df9ca 100644 --- a/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/sql-server/db-global-setup.sql @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; 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 91d06fe247..b9dddc02fe 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 @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS ${schema}.cash_state_participants; DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants; DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants; -DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants; -DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants; +DROP TABLE IF EXISTS ${schema}.dummy_linear_state_parts; +DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_parts; +DROP TABLE IF EXISTS ${schema}.dummy_deal_states_parts; DROP TABLE IF EXISTS ${schema}.node_attachments; DROP TABLE IF EXISTS ${schema}.node_checkpoints; DROP TABLE IF EXISTS ${schema}.node_transactions; diff --git a/testing/test-utils/src/main/resources/integration-oracle-11.conf b/testing/test-utils/src/main/resources/integration-oracle-11.conf new file mode 100644 index 0000000000..a0d54dbbb3 --- /dev/null +++ b/testing/test-utils/src/main/resources/integration-oracle-11.conf @@ -0,0 +1,10 @@ +dataSourceProperties = { + dataSourceClassName = "oracle.jdbc.pool.OracleDataSource" + dataSource.url = "jdbc:oracle:thin:@[IP]:[PORT]:xe" + dataSource.user = ${nodeOrganizationName} + dataSource.password = 1234 +} +database = { + transactionIsolationLevel = READ_COMMITTED + schema = ${nodeOrganizationName} +} \ No newline at end of file diff --git a/testing/test-utils/src/main/resources/integration-oracle.conf b/testing/test-utils/src/main/resources/integration-oracle.conf new file mode 100644 index 0000000000..a0d54dbbb3 --- /dev/null +++ b/testing/test-utils/src/main/resources/integration-oracle.conf @@ -0,0 +1,10 @@ +dataSourceProperties = { + dataSourceClassName = "oracle.jdbc.pool.OracleDataSource" + dataSource.url = "jdbc:oracle:thin:@[IP]:[PORT]:xe" + dataSource.user = ${nodeOrganizationName} + dataSource.password = 1234 +} +database = { + transactionIsolationLevel = READ_COMMITTED + schema = ${nodeOrganizationName} +} \ No newline at end of file diff --git a/testing/test-utils/src/main/resources/migration/dummy-deal.changelog-init.xml b/testing/test-utils/src/main/resources/migration/dummy-deal.changelog-init.xml index 3a2ccd1b66..ba7e34fb5a 100644 --- a/testing/test-utils/src/main/resources/migration/dummy-deal.changelog-init.xml +++ b/testing/test-utils/src/main/resources/migration/dummy-deal.changelog-init.xml @@ -21,7 +21,7 @@ - + @@ -32,7 +32,7 @@ diff --git a/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml b/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml index 27e2d321d8..806dacee4b 100644 --- a/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml +++ b/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml @@ -23,7 +23,7 @@ - + @@ -34,7 +34,7 @@ diff --git a/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml b/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml index 125b485ac5..cab005ec76 100644 --- a/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml +++ b/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml @@ -24,7 +24,7 @@ - + @@ -35,7 +35,7 @@