From fd19338f62236bd70c09047e838c609b03d54465 Mon Sep 17 00:00:00 2001 From: szymonsztuka Date: Sun, 21 Oct 2018 22:05:12 +0100 Subject: [PATCH] Merge OS -> ENT: NodeStartup - added back Enterprise only serialization case for Oracle database in NodeStartup, added deduplicationId to execute method in classes overriding FlowAsyncOperation --- .../core/internal/notary/AsyncCFTNotaryService.kt | 2 +- .../kotlin/net/corda/node/internal/AbstractNode.kt | 1 - .../kotlin/net/corda/node/internal/NodeStartup.kt | 11 +++++++++-- .../migration/vault-schema.changelog-master.xml | 2 +- .../services/statemachine/FlowAsyncOperationTests.kt | 6 +++--- .../net/corda/notary/mysql/MySQLNotaryServiceTests.kt | 2 +- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt b/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt index d8d111d2c2..ea925d1def 100644 --- a/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt +++ b/core/src/main/kotlin/net/corda/core/internal/notary/AsyncCFTNotaryService.kt @@ -69,7 +69,7 @@ abstract class AsyncCFTNotaryService : TrustedAuthorityNotaryService() { val timeWindow: TimeWindow?, val references: List ): FlowAsyncOperation { - override fun execute(): CordaFuture { + override fun execute(deduplicationId: String): CordaFuture { return service.commitAsync(inputs, txId, caller, requestSignature, timeWindow, references) } } diff --git a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt index 2ebaf1c62d..1709f7b4c9 100644 --- a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt @@ -156,7 +156,6 @@ abstract class AbstractNode(val configuration: NodeConfiguration, identityService::wellKnownPartyFromX500Name, identityService::wellKnownPartyFromAnonymous, schemaService, - configuration.dataSourceProperties, cacheFactory) init { diff --git a/node/src/main/kotlin/net/corda/node/internal/NodeStartup.kt b/node/src/main/kotlin/net/corda/node/internal/NodeStartup.kt index b4bcd278f9..42914cbb8e 100644 --- a/node/src/main/kotlin/net/corda/node/internal/NodeStartup.kt +++ b/node/src/main/kotlin/net/corda/node/internal/NodeStartup.kt @@ -7,7 +7,6 @@ import io.netty.channel.unix.Errors import net.corda.cliutils.CordaCliWrapper import net.corda.cliutils.CordaVersionProvider import net.corda.cliutils.ExitCodes -import net.corda.core.cordapp.Cordapp import net.corda.core.crypto.Crypto import net.corda.core.internal.* import net.corda.core.internal.concurrent.thenMatch @@ -417,8 +416,16 @@ open class NodeStartup : CordaCliWrapper("corda", "Runs a Corda Node") { protected open fun loadConfigFile(): Pair> = cmdLineOptions.loadConfig() protected open fun banJavaSerialisation(conf: NodeConfiguration) { + // Enterprise only - Oracle database requires additional serialization + val isOracleDbDriver = conf.dataSourceProperties.getProperty("dataSource.url", "").startsWith("jdbc:oracle:") + val serialFilter = + if (isOracleDbDriver) { + ::oracleJdbcDriverSerialFilter + } else { + ::defaultSerialFilter + } // Note that in dev mode this filter can be overridden by a notary service implementation. - SerialFilter.install(::defaultSerialFilter) + SerialFilter.install(serialFilter) } protected open fun getVersionInfo(): VersionInfo { diff --git a/node/src/main/resources/migration/vault-schema.changelog-master.xml b/node/src/main/resources/migration/vault-schema.changelog-master.xml index 024bf72db1..d1b1cd6f3d 100644 --- a/node/src/main/resources/migration/vault-schema.changelog-master.xml +++ b/node/src/main/resources/migration/vault-schema.changelog-master.xml @@ -10,6 +10,6 @@ - + diff --git a/node/src/test/kotlin/net/corda/node/services/statemachine/FlowAsyncOperationTests.kt b/node/src/test/kotlin/net/corda/node/services/statemachine/FlowAsyncOperationTests.kt index c26f04447e..21765af86b 100644 --- a/node/src/test/kotlin/net/corda/node/services/statemachine/FlowAsyncOperationTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/statemachine/FlowAsyncOperationTests.kt @@ -52,7 +52,7 @@ class FlowAsyncOperationTests { } private class ErroredExecute : FlowAsyncOperation { - override fun execute(): CordaFuture { + override fun execute(deduplicationId: String): CordaFuture { throw Exception() } } @@ -70,7 +70,7 @@ class FlowAsyncOperationTests { } private class ErroredResult : FlowAsyncOperation { - override fun execute(): CordaFuture { + override fun execute(deduplicationId: String): CordaFuture { val future = openFuture() future.setException(Exception()) return future @@ -103,7 +103,7 @@ class FlowAsyncOperationTests { } private class WorkerServiceTask(val completeAllTasks: Boolean, val service: WorkerService) : FlowAsyncOperation { - override fun execute(): CordaFuture { + override fun execute(deduplicationId: String): CordaFuture { return service.performTask(completeAllTasks) } } diff --git a/notary/mysql/src/test/kotlin/net/corda/notary/mysql/MySQLNotaryServiceTests.kt b/notary/mysql/src/test/kotlin/net/corda/notary/mysql/MySQLNotaryServiceTests.kt index 39e2deaade..7a05f3e2d8 100644 --- a/notary/mysql/src/test/kotlin/net/corda/notary/mysql/MySQLNotaryServiceTests.kt +++ b/notary/mysql/src/test/kotlin/net/corda/notary/mysql/MySQLNotaryServiceTests.kt @@ -230,7 +230,7 @@ class MySQLNotaryServiceTests : IntegrationTest() { callerParty, requestSignature, null, - emptyList()).execute() + emptyList()).execute("") } return futures.transpose().get() }