mirror of
https://github.com/corda/corda.git
synced 2025-03-15 00:36:49 +00:00
Minor changes to bring in-sync with OS (#1390)
This commit is contained in:
parent
9255866f10
commit
725441b39c
@ -286,15 +286,6 @@ class CordaRPCClient private constructor(
|
||||
): CordaRPCClient {
|
||||
return CordaRPCClient(hostAndPort, configuration, sslConfiguration, classLoader)
|
||||
}
|
||||
|
||||
internal fun createWithSslAndClassLoader(
|
||||
haAddressPool: List<NetworkHostAndPort>,
|
||||
configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT,
|
||||
sslConfiguration: ClientRpcSslOptions? = null,
|
||||
classLoader: ClassLoader? = null
|
||||
): CordaRPCClient {
|
||||
return CordaRPCClient(haAddressPool.first(), configuration, sslConfiguration, classLoader, haAddressPool)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
@ -311,7 +302,7 @@ class CordaRPCClient private constructor(
|
||||
|
||||
private fun getRpcClient(): RPCClient<CordaRPCOps> {
|
||||
return when {
|
||||
// Client->RPC broker
|
||||
// Client->RPC broker
|
||||
haAddressPool.isEmpty() -> RPCClient(
|
||||
rpcConnectorTcpTransport(hostAndPort, config = sslConfiguration),
|
||||
configuration,
|
||||
|
@ -16,13 +16,6 @@ fun createCordaRPCClientWithSslAndClassLoader(
|
||||
classLoader: ClassLoader? = null
|
||||
) = CordaRPCClient.createWithSslAndClassLoader(hostAndPort, configuration, sslConfiguration, classLoader)
|
||||
|
||||
fun createCordaRPCClientWithSslAndClassLoader(
|
||||
haAddressPool: List<NetworkHostAndPort>,
|
||||
configuration: CordaRPCClientConfiguration = CordaRPCClientConfiguration.DEFAULT,
|
||||
sslConfiguration: ClientRpcSslOptions? = null,
|
||||
classLoader: ClassLoader? = null
|
||||
) = CordaRPCClient.createWithSslAndClassLoader(haAddressPool, configuration, sslConfiguration, classLoader)
|
||||
|
||||
fun CordaRPCOps.drainAndShutdown(): Observable<Unit> {
|
||||
|
||||
setFlowsDrainingModeEnabled(true)
|
||||
|
@ -480,7 +480,7 @@ class RPCClientProxyHandler(
|
||||
try {
|
||||
Thread.sleep(retryInterval.toMillis())
|
||||
} catch (e: InterruptedException) {}
|
||||
// could not connect, try with next server transport
|
||||
// Could not connect, try with next server transport.
|
||||
reconnectAttempts--
|
||||
retryInterval = minOf(maxRetryInterval, retryInterval.times(rpcConfiguration.connectionRetryIntervalMultiplier.toLong()))
|
||||
continue
|
||||
|
@ -5,7 +5,6 @@ package net.corda.core.crypto.internal
|
||||
import net.corda.core.DeleteForDJVM
|
||||
import net.corda.core.crypto.CORDA_SECURE_RANDOM_ALGORITHM
|
||||
import net.corda.core.crypto.DummySecureRandom
|
||||
import net.corda.core.internal.VisibleForTesting
|
||||
import net.corda.core.utilities.SgxSupport
|
||||
import java.security.SecureRandom
|
||||
|
||||
@ -13,7 +12,6 @@ import java.security.SecureRandom
|
||||
* This has been migrated into a separate class so that it
|
||||
* is easier to delete from the core-deterministic module.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
internal val platformSecureRandom = when {
|
||||
SgxSupport.isInsideEnclave -> DummySecureRandom
|
||||
else -> SecureRandom.getInstance(CORDA_SECURE_RANDOM_ALGORITHM)
|
||||
|
@ -5,9 +5,6 @@ package net.corda.core.internal
|
||||
import net.corda.core.DeleteForDJVM
|
||||
import net.corda.core.KeepForDJVM
|
||||
import net.corda.core.crypto.*
|
||||
import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.node.ServicesForResolution
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import net.corda.core.serialization.*
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.UntrustworthyData
|
||||
|
@ -50,7 +50,6 @@ abstract class TrustedAuthorityNotaryService : NotaryService() {
|
||||
}
|
||||
} else throw e
|
||||
} catch (e: Exception) {
|
||||
if (e is NotaryInternalException) throw e
|
||||
log.error("Internal error", e)
|
||||
throw NotaryInternalException(NotaryError.General(Exception("Service unavailable, please try again later")))
|
||||
}
|
||||
|
@ -98,12 +98,6 @@ data class StateMachineTransactionMapping(val stateMachineRunId: StateMachineRun
|
||||
|
||||
/** RPC operations that the node exposes to clients. */
|
||||
interface CordaRPCOps : RPCOps {
|
||||
/**
|
||||
* Returns the RPC protocol version, which is the same the node's Platform Version. Exists since version 1 so guaranteed
|
||||
* to be present.
|
||||
*/
|
||||
override val protocolVersion: Int get() = nodeInfo().platformVersion
|
||||
|
||||
/** Returns a list of currently in-progress state machine infos. */
|
||||
fun stateMachinesSnapshot(): List<StateMachineInfo>
|
||||
|
||||
|
@ -47,7 +47,7 @@ open class MappedSchema(schemaFamily: Class<*>,
|
||||
val name: String = schemaFamily.name
|
||||
|
||||
/**
|
||||
* Points to a classpath resource containing the database changes for the [mappedTypes]
|
||||
* Optional classpath resource containing the database changes for the [mappedTypes]
|
||||
*/
|
||||
open val migrationResource: String? = null
|
||||
|
||||
|
@ -17,8 +17,6 @@ import net.corda.core.node.services.AttachmentId
|
||||
import net.corda.core.node.services.KeyManagementService
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.serialization.SerializationFactory
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import java.security.PublicKey
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
@ -49,11 +47,6 @@ open class TransactionBuilder @JvmOverloads constructor(
|
||||
protected var privacySalt: PrivacySalt = PrivacySalt(),
|
||||
protected val references: MutableList<StateRef> = arrayListOf()
|
||||
) {
|
||||
|
||||
private companion object {
|
||||
val logger = loggerFor<TransactionBuilder>()
|
||||
}
|
||||
|
||||
private val inputsWithTransactionState = arrayListOf<TransactionState<ContractState>>()
|
||||
private val referencesWithTransactionState = arrayListOf<TransactionState<ContractState>>()
|
||||
|
||||
|
@ -100,18 +100,6 @@ public class FlowsInJavaTest {
|
||||
}
|
||||
}
|
||||
|
||||
@InitiatedBy(PrimitiveReceiveFlow.class)
|
||||
private static class PrimitiveSendFlow extends FlowLogic<Void> {
|
||||
public PrimitiveSendFlow(FlowSession session) {
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
@Override
|
||||
public Void call() throws FlowException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@InitiatingFlow
|
||||
private static class PrimitiveReceiveFlow extends FlowLogic<Void> {
|
||||
private final Party otherParty;
|
||||
|
@ -1,9 +0,0 @@
|
||||
package net.corda.behave.logging
|
||||
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
// TODO Already available in corda core
|
||||
|
||||
inline fun <reified T> getLogger(): Logger =
|
||||
LoggerFactory.getLogger(T::class.java)
|
@ -1,6 +1,6 @@
|
||||
package net.corda.behave.node.configuration
|
||||
|
||||
class NotaryConfiguration(val notaryType: NotaryType = NotaryType.NONE) : ConfigurationTemplate() {
|
||||
class NotaryConfiguration(private val notaryType: NotaryType = NotaryType.NONE) : ConfigurationTemplate() {
|
||||
|
||||
override val config: (Configuration) -> String
|
||||
get() = {
|
||||
|
@ -70,7 +70,9 @@ class CordaRpcWorkerOps(
|
||||
private val flowReplyStateMachineRunIdMap = ConcurrentHashMap<Trace.InvocationId, SettableFuture<StateMachineRunId>>()
|
||||
private val flowReplyResultMap = ConcurrentHashMap<Trace.InvocationId, OpenFuture<Any?>>()
|
||||
|
||||
override val networkParameters: NetworkParameters = services.networkParameters
|
||||
override val protocolVersion: Int get() = services.myInfo.platformVersion
|
||||
|
||||
override val networkParameters: NetworkParameters get() = services.networkParameters
|
||||
|
||||
fun start() {
|
||||
session = artemisClient.start().session
|
||||
|
@ -14,11 +14,8 @@ import net.corda.finance.EUR
|
||||
import net.corda.finance.GBP
|
||||
import net.corda.finance.USD
|
||||
import net.corda.finance.flows.ConfigHolder.Companion.supportedCurrencies
|
||||
import java.io.BufferedReader
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets.UTF_8
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.OpenOption
|
||||
import java.nio.file.Path
|
||||
@ -36,7 +33,6 @@ class ConfigHolder(services: AppServiceHub) : SingletonSerializeAsToken() {
|
||||
private operator fun Path.div(other: String): Path = resolve(other)
|
||||
private operator fun String.div(other: String): Path = Paths.get(this) / other
|
||||
private fun Path.inputStream(vararg options: OpenOption): InputStream = Files.newInputStream(this, *options)
|
||||
private fun Path.reader(charset: Charset = UTF_8): BufferedReader = Files.newBufferedReader(this, charset)
|
||||
private inline fun <R> Path.read(vararg options: OpenOption, block: (InputStream) -> R): R = inputStream(*options).use(block)
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,7 @@ object CashSchema
|
||||
* at the time of writing.
|
||||
*/
|
||||
@CordaSerializable
|
||||
object CashSchemaV1 : MappedSchema(
|
||||
schemaFamily = CashSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCashState::class.java)) {
|
||||
object CashSchemaV1 : MappedSchema(schemaFamily = CashSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCashState::class.java)) {
|
||||
|
||||
override val migrationResource = "cash.changelog-master"
|
||||
|
||||
|
@ -22,8 +22,7 @@ object CommercialPaperSchema
|
||||
* as it stood at the time of writing.
|
||||
*/
|
||||
@CordaSerializable
|
||||
object CommercialPaperSchemaV1 : MappedSchema(
|
||||
schemaFamily = CommercialPaperSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCommercialPaperState::class.java)) {
|
||||
object CommercialPaperSchemaV1 : MappedSchema(schemaFamily = CommercialPaperSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCommercialPaperState::class.java)) {
|
||||
|
||||
override val migrationResource = "commercial-paper.changelog-master"
|
||||
|
||||
|
@ -303,4 +303,4 @@ enum class UnknownConfigKeysPolicy(private val handle: (Set<String>, logger: Log
|
||||
handle.invoke(unknownKeys, logger)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,13 +105,11 @@ class BFTNotaryServiceTests {
|
||||
networkParameters.install(mockNet.baseDirectory(node.id))
|
||||
node.start()
|
||||
}.last()
|
||||
|
||||
return Pair(notaryIdentity, node)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
fun `detect double spend`() {
|
||||
node.run {
|
||||
|
@ -16,8 +16,8 @@ import net.corda.testing.core.DUMMY_BANK_A_NAME
|
||||
import net.corda.testing.core.dummyCommand
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import net.corda.testing.driver.DriverParameters
|
||||
import net.corda.testing.driver.InProcess
|
||||
import net.corda.testing.driver.driver
|
||||
import net.corda.testing.driver.internal.InProcessImpl
|
||||
import net.corda.testing.internal.IntegrationTest
|
||||
import net.corda.testing.internal.IntegrationTestSchemas
|
||||
import net.corda.testing.internal.toDatabaseSchemaName
|
||||
@ -45,7 +45,7 @@ class RaftNotaryServiceTests : IntegrationTest() {
|
||||
extraCordappPackagesToScan = listOf("net.corda.testing.contracts"),
|
||||
notarySpecs = listOf(NotarySpec(notaryName, cluster = ClusterSpec.Raft(clusterSize = 3)))
|
||||
)) {
|
||||
val bankA = startNode(providedName = DUMMY_BANK_A_NAME).map { (it as InProcessImpl) }.getOrThrow()
|
||||
val bankA = startNode(providedName = DUMMY_BANK_A_NAME).map { (it as InProcess) }.getOrThrow()
|
||||
val inputState = issueState(bankA, defaultNotaryIdentity)
|
||||
|
||||
val firstTxBuilder = TransactionBuilder(defaultNotaryIdentity)
|
||||
@ -78,15 +78,16 @@ class RaftNotaryServiceTests : IntegrationTest() {
|
||||
extraCordappPackagesToScan = listOf("net.corda.testing.contracts"),
|
||||
notarySpecs = listOf(NotarySpec(notaryName, cluster = ClusterSpec.Raft(clusterSize = 3)))
|
||||
)) {
|
||||
val bankA = startNode(providedName = DUMMY_BANK_A_NAME).map { (it as InProcessImpl) }.getOrThrow()
|
||||
val bankA = startNode(providedName = DUMMY_BANK_A_NAME).map { (it as InProcess) }.getOrThrow()
|
||||
val builder = DummyContract.generateInitial(Random().nextInt(), defaultNotaryIdentity, bankA.services.myInfo.singleIdentity().ref(0))
|
||||
.setTimeWindow(bankA.services.clock.instant(), 30.seconds)
|
||||
val issueTx = bankA.services.signInitialTransaction(builder)
|
||||
|
||||
bankA.startFlow(NotaryFlow.Client(issueTx)).getOrThrow()
|
||||
}
|
||||
}
|
||||
|
||||
private fun issueState(nodeHandle: InProcessImpl, notary: Party): StateAndRef<*> {
|
||||
private fun issueState(nodeHandle: InProcess, notary: Party): StateAndRef<*> {
|
||||
val builder = DummyContract.generateInitial(Random().nextInt(), notary, nodeHandle.services.myInfo.singleIdentity().ref(0))
|
||||
val stx = nodeHandle.services.signInitialTransaction(builder)
|
||||
nodeHandle.services.recordTransactions(stx)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.corda.node.services.transactions
|
||||
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import io.atomix.catalyst.transport.Address
|
||||
import io.atomix.copycat.client.ConnectionStrategies
|
||||
import io.atomix.copycat.client.CopycatClient
|
||||
@ -24,7 +23,6 @@ import net.corda.testing.core.SerializationEnvironmentRule
|
||||
import net.corda.testing.driver.PortAllocation
|
||||
import net.corda.testing.internal.LogHelper
|
||||
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
||||
import net.corda.testing.node.internal.makeInternalTestDataSourceProperties
|
||||
import org.hamcrest.Matchers.instanceOf
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertThat
|
||||
|
@ -77,11 +77,11 @@ class P2PMessagingTest : IntegrationTest() {
|
||||
}
|
||||
|
||||
private fun InProcess.respondWith(message: Any) {
|
||||
internalServices.networkService.addMessageHandler("test.request") { netMessage, _, handle ->
|
||||
internalServices.networkService.addMessageHandler("test.request") { netMessage, _, handler ->
|
||||
val request = netMessage.data.deserialize<TestRequest>()
|
||||
val response = internalServices.networkService.createMessage("test.response", message.serialize().bytes)
|
||||
internalServices.networkService.send(response, request.replyTo)
|
||||
handle.afterDatabaseTransaction()
|
||||
handler.afterDatabaseTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,12 +103,12 @@ class P2PMessagingTest : IntegrationTest() {
|
||||
*/
|
||||
inline fun MessagingService.runOnNextMessage(topic: String, crossinline callback: (ReceivedMessage) -> Unit) {
|
||||
val consumed = AtomicBoolean()
|
||||
addMessageHandler(topic) { msg, reg, handle ->
|
||||
addMessageHandler(topic) { msg, reg, handler ->
|
||||
removeMessageHandler(reg)
|
||||
check(!consumed.getAndSet(true)) { "Called more than once" }
|
||||
check(msg.topic == topic) { "Topic/session mismatch: ${msg.topic} vs $topic" }
|
||||
callback(msg)
|
||||
handle.afterDatabaseTransaction()
|
||||
handler.afterDatabaseTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ data class VersionInfo(
|
||||
/** The node vendor */
|
||||
val vendor: String) {
|
||||
|
||||
companion object {
|
||||
val UNKNOWN = VersionInfo(1, "Unknown", "Unknown", "Unknown")
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
val UNKNOWN = VersionInfo(1, "Unknown", "Unknown", "Unknown")
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ import net.corda.node.utilities.AffinityExecutor
|
||||
import net.corda.node.utilities.JVMAgentRegistry
|
||||
import net.corda.node.utilities.NamedThreadFactory
|
||||
import net.corda.node.utilities.NodeBuildProperties
|
||||
import net.corda.nodeapi.internal.DevIdentityGenerator
|
||||
import net.corda.nodeapi.internal.NodeInfoAndSigned
|
||||
import net.corda.nodeapi.internal.SignedNodeInfo
|
||||
import net.corda.nodeapi.internal.config.CertificateStore
|
||||
|
@ -132,9 +132,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
|
||||
private val sameVmNodeCounter = AtomicInteger()
|
||||
|
||||
@JvmStatic
|
||||
protected fun makeCordappLoader(configuration: NodeConfiguration, versionInfo: VersionInfo): CordappLoader {
|
||||
|
||||
private fun makeCordappLoader(configuration: NodeConfiguration, versionInfo: VersionInfo): CordappLoader {
|
||||
return JarScanningCordappLoader.fromDirectories(configuration.cordappDirectories, versionInfo)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,8 @@ import kotlin.streams.toList
|
||||
*
|
||||
* @property cordappJarPaths The classpath of cordapp JARs
|
||||
*/
|
||||
class JarScanningCordappLoader private constructor(private val cordappJarPaths: List<RestrictedURL>, versionInfo: VersionInfo = VersionInfo.UNKNOWN) : CordappLoaderTemplate() {
|
||||
class JarScanningCordappLoader private constructor(private val cordappJarPaths: List<RestrictedURL>,
|
||||
versionInfo: VersionInfo = VersionInfo.UNKNOWN) : CordappLoaderTemplate() {
|
||||
|
||||
override val cordapps: List<CordappImpl> by lazy { loadCordapps() + coreCordapp }
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
package net.corda.node.services.identity
|
||||
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.identity.Party
|
||||
|
||||
|
||||
fun partiesFromName(query: String, exactMatch: Boolean, x500name: CordaX500Name, results: LinkedHashSet<Party>, party: Party) {
|
||||
|
||||
val components = listOfNotNull(x500name.commonName, x500name.organisationUnit, x500name.organisation, x500name.locality, x500name.state, x500name.country)
|
||||
components.forEach { component ->
|
||||
if (exactMatch && component == query) {
|
||||
results += party
|
||||
} else if (!exactMatch) {
|
||||
// We can imagine this being a query over a lucene index in future.
|
||||
//
|
||||
// Kostas says: We can easily use the Jaro-Winkler distance metric as it is best suited for short
|
||||
// strings such as entity/company names, and to detect small typos. We can also apply it for city
|
||||
// or any keyword related search in lists of records (not raw text - for raw text we need indexing)
|
||||
// and we can return results in hierarchical order (based on normalised String similarity 0.0-1.0).
|
||||
if (component.contains(query, ignoreCase = true))
|
||||
results += party
|
||||
}
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ class AbstractPartyToX500NameAsStringConverter(private val wellKnownPartyFromX50
|
||||
if (dbData != null) {
|
||||
val party = wellKnownPartyFromX500Name(CordaX500Name.parse(dbData))
|
||||
if (party != null) return party
|
||||
log.warn("Identity service unable to resolve X500name: $dbData")
|
||||
}
|
||||
return null // non resolvable anonymous parties are stored as nulls
|
||||
}
|
||||
|
@ -73,4 +73,4 @@ sealed class SubFlow {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,11 @@ class InMemoryIdentityServiceTests {
|
||||
val issuerKeyPair = generateKeyPair()
|
||||
val issuer = getTestPartyAndCertificate(x500Name, issuerKeyPair.public)
|
||||
val txKeyPair = Crypto.generateKeyPair()
|
||||
val txCert = X509Utilities.createCertificate(CertificateType.CONFIDENTIAL_LEGAL_IDENTITY, issuer.certificate, issuerKeyPair, x500Name.x500Principal,
|
||||
val txCert = X509Utilities.createCertificate(
|
||||
CertificateType.CONFIDENTIAL_LEGAL_IDENTITY,
|
||||
issuer.certificate,
|
||||
issuerKeyPair,
|
||||
x500Name.x500Principal,
|
||||
txKeyPair.public)
|
||||
val txCertPath = X509Utilities.buildCertPath(txCert, issuer.certPath.x509Certificates)
|
||||
return Pair(issuer, PartyAndCertificate(txCertPath))
|
||||
|
@ -7,7 +7,6 @@ import net.corda.testing.core.ALICE_NAME
|
||||
import net.corda.testing.core.BOB_NAME
|
||||
import net.corda.testing.core.getTestPartyAndCertificate
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import net.corda.testing.node.MockNodeParameters
|
||||
import net.corda.testing.node.internal.InternalMockNetwork
|
||||
import net.corda.testing.node.internal.InternalMockNodeParameters
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
|
@ -8,7 +8,6 @@ import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.node.services.Vault
|
||||
import net.corda.core.schemas.CommonSchemaV1
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import net.corda.core.schemas.PersistentState
|
||||
import net.corda.core.schemas.QueryableState
|
||||
|
@ -18,11 +18,11 @@ import net.corda.finance.contracts.Commodity
|
||||
import net.corda.finance.contracts.DealState
|
||||
import net.corda.finance.contracts.asset.Cash
|
||||
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
|
||||
import net.corda.finance.schemas.SampleCashSchemaV2
|
||||
import net.corda.finance.schemas.SampleCashSchemaV3
|
||||
import net.corda.finance.schemas.CashSchemaV1
|
||||
import net.corda.finance.schemas.CashSchemaV1.PersistentCashState
|
||||
import net.corda.finance.schemas.CommercialPaperSchemaV1
|
||||
import net.corda.finance.schemas.SampleCashSchemaV2
|
||||
import net.corda.finance.schemas.SampleCashSchemaV3
|
||||
import net.corda.node.internal.configureDatabase
|
||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
||||
|
@ -25,7 +25,6 @@ class AttachmentDemoTest : IntegrationTest() {
|
||||
}
|
||||
|
||||
// run with a 10,000,000 bytes in-memory zip file. In practice, a slightly bigger file will be used (~10,002,000 bytes).
|
||||
// Force INFO logging to prevent printing 10MB arrays in logfiles
|
||||
@Test
|
||||
fun `attachment demo using a 10MB zip file`() {
|
||||
val numOfExpectedBytes = 10_000_000
|
||||
|
@ -14,7 +14,6 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import java.net.ConnectException
|
||||
import java.net.URL
|
||||
import java.nio.file.Paths
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
fun <A> springDriver(
|
||||
|
@ -1,13 +1,3 @@
|
||||
#
|
||||
# R3 Proprietary and Confidential
|
||||
#
|
||||
# Copyright (c) 2018 R3 Limited. All rights reserved.
|
||||
#
|
||||
# The intellectual and technical concepts contained herein are proprietary to R3 and its suppliers and are protected by trade secret law.
|
||||
#
|
||||
# Distribution of this file or any portion thereof via any medium without the express permission of R3 is strictly prohibited.
|
||||
#
|
||||
|
||||
corda.host=localhost:10006
|
||||
server.port=10007
|
||||
liquibase.enabled=false
|
@ -1,13 +1,3 @@
|
||||
#
|
||||
# R3 Proprietary and Confidential
|
||||
#
|
||||
# Copyright (c) 2018 R3 Limited. All rights reserved.
|
||||
#
|
||||
# The intellectual and technical concepts contained herein are proprietary to R3 and its suppliers and are protected by trade secret law.
|
||||
#
|
||||
# Distribution of this file or any portion thereof via any medium without the express permission of R3 is strictly prohibited.
|
||||
#
|
||||
|
||||
corda.host=localhost:10009
|
||||
server.port=10010
|
||||
liquibase.enabled=false
|
@ -1,13 +1,3 @@
|
||||
#
|
||||
# R3 Proprietary and Confidential
|
||||
#
|
||||
# Copyright (c) 2018 R3 Limited. All rights reserved.
|
||||
#
|
||||
# The intellectual and technical concepts contained herein are proprietary to R3 and its suppliers and are protected by trade secret law.
|
||||
#
|
||||
# Distribution of this file or any portion thereof via any medium without the express permission of R3 is strictly prohibited.
|
||||
#
|
||||
|
||||
corda.host=localhost:10003
|
||||
server.port=10004
|
||||
liquibase.enabled=false
|
@ -1,13 +1,3 @@
|
||||
#
|
||||
# R3 Proprietary and Confidential
|
||||
#
|
||||
# Copyright (c) 2018 R3 Limited. All rights reserved.
|
||||
#
|
||||
# The intellectual and technical concepts contained herein are proprietary to R3 and its suppliers and are protected by trade secret law.
|
||||
#
|
||||
# Distribution of this file or any portion thereof via any medium without the express permission of R3 is strictly prohibited.
|
||||
#
|
||||
|
||||
corda.user=user
|
||||
corda.password=password
|
||||
liquibase.enabled=false
|
@ -5,7 +5,6 @@ package net.corda.serialization.internal
|
||||
import net.corda.core.DeleteForDJVM
|
||||
import net.corda.core.KeepForDJVM
|
||||
import net.corda.core.serialization.*
|
||||
import net.corda.serialization.internal.CordaSerializationEncoding.SNAPPY
|
||||
import net.corda.serialization.internal.amqp.amqpMagic
|
||||
|
||||
val AMQP_P2P_CONTEXT = SerializationContextImpl(
|
||||
|
@ -47,7 +47,7 @@ abstract class AbstractAMQPSerializationScheme(
|
||||
constructor(cordapps: List<Cordapp>) : this(cordapps.customSerializers, AccessOrderLinkedHashMap(128))
|
||||
|
||||
// TODO: This method of initialisation for the Whitelist and plugin serializers will have to change
|
||||
// when we have per-cordapp contexts and dynamic app reloading but for now it's the easiest way
|
||||
// when we have per-cordapp contexts and dynamic app reloading but for now it's the easiest way
|
||||
companion object {
|
||||
const val SCAN_SPEC_PROP_NAME = "amqp.custom.serialization.scanSpec"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
@file:JvmName("AMQPSerializerFactories")
|
||||
|
||||
package net.corda.serialization.internal.amqp
|
||||
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
|
@ -46,7 +46,6 @@ class EvolvabilityTests {
|
||||
// Original version of the class for the serialised version of this class
|
||||
// data class C (val a: Int, val b: Int)
|
||||
// File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(C(A, B)).bytes)
|
||||
// println (path)
|
||||
|
||||
// new version of the class, in this case the order of the parameters has been swapped
|
||||
data class C(val b: Int, val a: Int)
|
||||
@ -69,7 +68,6 @@ class EvolvabilityTests {
|
||||
// Original version of the class as it was serialised
|
||||
// data class C (val a: Int, val b: String)
|
||||
// File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(C(A, B)).bytes)
|
||||
// println (path)
|
||||
|
||||
// new version of the class, in this case the order of the parameters has been swapped
|
||||
data class C(val b: String, val a: Int)
|
||||
@ -90,7 +88,7 @@ class EvolvabilityTests {
|
||||
|
||||
// Original version of the class as it was serialised
|
||||
// data class C(val a: Int)
|
||||
// File(URI("$localPath/$resource")).writeBytes( SerializationOutput(sf).serialize(C(A))
|
||||
// File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(C(A)).bytes)
|
||||
|
||||
data class C(val a: Int, val b: Int?)
|
||||
|
||||
@ -375,6 +373,7 @@ class EvolvabilityTests {
|
||||
val resource1 = "EvolvabilityTests.multiVersion.1"
|
||||
val resource2 = "EvolvabilityTests.multiVersion.2"
|
||||
val resource3 = "EvolvabilityTests.multiVersion.3"
|
||||
|
||||
val a = 100
|
||||
val b = 200
|
||||
val c = 300
|
||||
|
@ -38,7 +38,7 @@ import kotlin.streams.toList
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class DriverTests : IntegrationTest() {
|
||||
companion object {
|
||||
private companion object {
|
||||
val DUMMY_REGULATOR_NAME = CordaX500Name("Regulator A", "Paris", "FR")
|
||||
val executorService: ScheduledExecutorService = Executors.newScheduledThreadPool(2)
|
||||
|
||||
@ -103,7 +103,11 @@ class DriverTests : IntegrationTest() {
|
||||
// Make sure we're using the log4j2 config which writes to the log file
|
||||
val logConfigFile = projectRootDir / "config" / "dev" / "log4j2.xml"
|
||||
assertThat(logConfigFile).isRegularFile()
|
||||
driver(DriverParameters(isDebug = true,notarySpecs = emptyList(), systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString()))) {
|
||||
driver(DriverParameters(
|
||||
isDebug = true,
|
||||
notarySpecs = emptyList(),
|
||||
systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())
|
||||
)) {
|
||||
val baseDirectory = startNode(providedName = DUMMY_BANK_A_NAME).getOrThrow().baseDirectory
|
||||
val logFile = (baseDirectory / NodeStartup.LOGS_DIRECTORY_NAME).list { it.sorted().findFirst().get() }
|
||||
val debugLinesPresent = logFile.readLines { lines -> lines.anyMatch { line -> line.startsWith("[DEBUG]") } }
|
||||
|
@ -28,7 +28,6 @@ import net.corda.node.services.schema.NodeSchemaService
|
||||
import net.corda.node.services.transactions.InMemoryTransactionVerifierService
|
||||
import net.corda.node.services.vault.NodeVaultService
|
||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||
import net.corda.nodeapi.internal.persistence.HibernateConfiguration
|
||||
import net.corda.testing.common.internal.testNetworkParameters
|
||||
import net.corda.testing.core.TestIdentity
|
||||
import net.corda.testing.internal.DEV_ROOT_CA
|
||||
|
@ -21,7 +21,6 @@ import net.corda.node.services.config.ConfigHelper
|
||||
import net.corda.node.services.config.configOf
|
||||
import net.corda.node.services.config.parseToDbSchemaFriendlyName
|
||||
import net.corda.node.services.messaging.Message
|
||||
import net.corda.node.services.messaging.MessagingService
|
||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
||||
import net.corda.nodeapi.internal.persistence.TransactionIsolationLevel
|
||||
import net.corda.testing.database.DatabaseConstants
|
||||
@ -120,10 +119,6 @@ fun StartedNodeServices.newContext(): InvocationContext = testContext(myInfo.cho
|
||||
|
||||
fun InMemoryMessagingNetwork.MessageTransfer.getMessage(): Message = message
|
||||
|
||||
internal interface InternalMockMessagingService : MessagingService {
|
||||
fun pumpReceive(block: Boolean): InMemoryMessagingNetwork.MessageTransfer?
|
||||
}
|
||||
|
||||
/**
|
||||
* Make properties appropriate for creating a DataSource for unit tests.
|
||||
* Defaults configuration of in-memory H2 instance. If 'databaseProvider' system property is set then creates
|
||||
|
@ -115,7 +115,7 @@ fun <A> rpcDriver(
|
||||
notarySpecs: List<NotarySpec> = emptyList(),
|
||||
externalTrace: Trace? = null,
|
||||
jmxPolicy: JmxPolicy = JmxPolicy(),
|
||||
networkParameters: NetworkParameters = testNetworkParameters(notaries = emptyList()),
|
||||
networkParameters: NetworkParameters = testNetworkParameters(),
|
||||
notaryCustomOverrides: Map<String, Any?> = emptyMap(),
|
||||
inMemoryDB: Boolean = true,
|
||||
cordappsForAllNodes: Set<TestCorDapp> = cordappsInCurrentAndAdditionalPackages(),
|
||||
|
@ -11,7 +11,7 @@ import java.nio.file.Paths
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.ConcurrentMap
|
||||
|
||||
object TestCordappDirectories {
|
||||
object TestCordappDirectories {
|
||||
|
||||
private val logger = loggerFor<TestCordappDirectories>()
|
||||
|
||||
@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentMap
|
||||
|
||||
private val cordappsCache: ConcurrentMap<List<String>, Path> = ConcurrentHashMap<List<String>, Path>()
|
||||
|
||||
fun cached(cordapps: Iterable<TestCorDapp>, replaceExistingOnes: Boolean = false, cordappsDirectory: Path = defaultCordappsDirectory): Iterable<Path> {
|
||||
fun cached(cordapps: Iterable<TestCorDapp>, replaceExistingOnes: Boolean = false, cordappsDirectory: Path = defaultCordappsDirectory): Iterable<Path> {
|
||||
|
||||
cordappsDirectory.toFile().deleteOnExit()
|
||||
return cordapps.map { cached(it, replaceExistingOnes, cordappsDirectory) }
|
||||
|
@ -1,16 +1,13 @@
|
||||
package net.corda.testing.node.internal.performance
|
||||
|
||||
|
||||
import com.codahale.metrics.Gauge
|
||||
import com.codahale.metrics.MetricRegistry
|
||||
import com.google.common.base.Stopwatch
|
||||
import net.corda.core.concurrent.CordaFuture
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.testing.internal.performance.Rate
|
||||
import net.corda.testing.node.internal.ShutdownManager
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.time.Duration
|
||||
import java.util.*
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.Semaphore
|
||||
|
@ -24,6 +24,7 @@ import net.corda.core.serialization.serialize
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.nodeapi.internal.PLATFORM_VERSION
|
||||
import net.corda.testing.common.internal.testNetworkParameters
|
||||
import java.io.InputStream
|
||||
import java.net.URL
|
||||
@ -76,6 +77,8 @@ class CordaRPCProxyClient(private val targetHostAndPort: NetworkHostAndPort) : C
|
||||
return doGet(targetHostAndPort, "registered-flows")
|
||||
}
|
||||
|
||||
override val protocolVersion: Int get() = PLATFORM_VERSION
|
||||
|
||||
override val networkParameters: NetworkParameters get() = testNetworkParameters()
|
||||
|
||||
override fun stateMachinesSnapshot(): List<StateMachineInfo> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user