Merge pull request #5940 from corda/release/os/4.4

Merge OS 4.4 -> OS 4.5
This commit is contained in:
Stefano Franz 2020-02-11 11:55:53 +00:00 committed by GitHub
commit 4a54374f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
485 changed files with 5655 additions and 5625 deletions

3
.ci/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM amazoncorretto:8u242
RUN yum install -y shadow-utils
RUN useradd -m buildUser

View File

@ -18,68 +18,68 @@ class AmountTest {
private val yamlMapper: ObjectMapper = ObjectMapper(YAMLFactory()).registerModule(CordaModule()) private val yamlMapper: ObjectMapper = ObjectMapper(YAMLFactory()).registerModule(CordaModule())
} }
@Test @Test(timeout=300_000)
fun `Amount(Currency) JSON deserialization`() { fun `Amount(Currency) JSON deserialization`() {
val str = """{ "quantity": 100, "token": "USD" }""" val str = """{ "quantity": 100, "token": "USD" }"""
val amount = jsonMapper.readValue<Amount<Currency>>(str, object : TypeReference<Amount<Currency>>() {}) val amount = jsonMapper.readValue<Amount<Currency>>(str, object : TypeReference<Amount<Currency>>() {})
assertThat(amount.quantity).isEqualTo(100) assertThat(amount.quantity).isEqualTo(100)
assertThat(amount.token).isEqualTo(Currency.getInstance("USD")) assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
} }
@Test @Test(timeout=300_000)
fun `Amount(Currency) YAML deserialization`() { fun `Amount(Currency) YAML deserialization`() {
val str = """{ quantity: 100, token: USD }""" val str = """{ quantity: 100, token: USD }"""
val amount = yamlMapper.readValue<Amount<Currency>>(str, object : TypeReference<Amount<Currency>>() {}) val amount = yamlMapper.readValue<Amount<Currency>>(str, object : TypeReference<Amount<Currency>>() {})
assertThat(amount.quantity).isEqualTo(100) assertThat(amount.quantity).isEqualTo(100)
assertThat(amount.token).isEqualTo(Currency.getInstance("USD")) assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
} }
@Test @Test(timeout=300_000)
fun `Amount(CarbonCredit) JSON deserialization`() { fun `Amount(CarbonCredit) JSON deserialization`() {
val str = """{ "quantity": 200, "token": { "type": "CO2" } }""" val str = """{ "quantity": 200, "token": { "type": "CO2" } }"""
val amount = jsonMapper.readValue<Amount<CarbonCredit>>(str, object : TypeReference<Amount<CarbonCredit>>() {}) val amount = jsonMapper.readValue<Amount<CarbonCredit>>(str, object : TypeReference<Amount<CarbonCredit>>() {})
assertThat(amount.quantity).isEqualTo(200) assertThat(amount.quantity).isEqualTo(200)
assertThat(amount.token).isEqualTo(CO2) assertThat(amount.token).isEqualTo(CO2)
} }
@Test @Test(timeout=300_000)
fun `Amount(CarbonCredit) YAML deserialization`() { fun `Amount(CarbonCredit) YAML deserialization`() {
val str = """{ quantity: 250, token: { type: CO2 } }""" val str = """{ quantity: 250, token: { type: CO2 } }"""
val amount = yamlMapper.readValue<Amount<CarbonCredit>>(str, object : TypeReference<Amount<CarbonCredit>>() {}) val amount = yamlMapper.readValue<Amount<CarbonCredit>>(str, object : TypeReference<Amount<CarbonCredit>>() {})
assertThat(amount.quantity).isEqualTo(250) assertThat(amount.quantity).isEqualTo(250)
assertThat(amount.token).isEqualTo(CO2) assertThat(amount.token).isEqualTo(CO2)
} }
@Test @Test(timeout=300_000)
fun `Amount(Unknown) JSON deserialization`() { fun `Amount(Unknown) JSON deserialization`() {
val str = """{ "quantity": 100, "token": "USD" }""" val str = """{ "quantity": 100, "token": "USD" }"""
val amount = jsonMapper.readValue<Amount<*>>(str, object : TypeReference<Amount<*>>() {}) val amount = jsonMapper.readValue<Amount<*>>(str, object : TypeReference<Amount<*>>() {})
assertThat(amount.quantity).isEqualTo(100) assertThat(amount.quantity).isEqualTo(100)
assertThat(amount.token).isEqualTo(Currency.getInstance("USD")) assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
} }
@Test @Test(timeout=300_000)
fun `Amount(Unknown) YAML deserialization`() { fun `Amount(Unknown) YAML deserialization`() {
val str = """{ quantity: 100, token: USD }""" val str = """{ quantity: 100, token: USD }"""
val amount = yamlMapper.readValue<Amount<*>>(str, object : TypeReference<Amount<*>>() {}) val amount = yamlMapper.readValue<Amount<*>>(str, object : TypeReference<Amount<*>>() {})
assertThat(amount.quantity).isEqualTo(100) assertThat(amount.quantity).isEqualTo(100)
assertThat(amount.token).isEqualTo(Currency.getInstance("USD")) assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
} }
@Test @Test(timeout=300_000)
fun `Amount(Currency) YAML serialization`() { fun `Amount(Currency) YAML serialization`() {
assertThat(yamlMapper.valueToTree<TextNode>(Amount.parseCurrency("£25000000"))).isEqualTo(TextNode("25000000.00 GBP")) assertThat(yamlMapper.valueToTree<TextNode>(Amount.parseCurrency("£25000000"))).isEqualTo(TextNode("25000000.00 GBP"))
assertThat(yamlMapper.valueToTree<TextNode>(Amount.parseCurrency("$250000"))).isEqualTo(TextNode("250000.00 USD")) assertThat(yamlMapper.valueToTree<TextNode>(Amount.parseCurrency("$250000"))).isEqualTo(TextNode("250000.00 USD"))
} }
@Test @Test(timeout=300_000)
fun `Amount(CarbonCredit) JSON serialization`() { fun `Amount(CarbonCredit) JSON serialization`() {
assertThat(jsonMapper.writeValueAsString(Amount(123456, CO2)).trim()) assertThat(jsonMapper.writeValueAsString(Amount(123456, CO2)).trim())
.isEqualTo(""""123456 CarbonCredit(type=CO2)"""") .isEqualTo(""""123456 CarbonCredit(type=CO2)"""")
} }
@Test @Test(timeout=300_000)
fun `Amount(CarbonCredit) YAML serialization`() { fun `Amount(CarbonCredit) YAML serialization`() {
assertThat(yamlMapper.writeValueAsString(Amount(123456, CO2)).trim()) assertThat(yamlMapper.writeValueAsString(Amount(123456, CO2)).trim())
.isEqualTo("""--- "123456 CarbonCredit(type=CO2)"""") .isEqualTo("""--- "123456 CarbonCredit(type=CO2)"""")
} }

View File

@ -107,14 +107,14 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
doReturn(attachments).whenever(services).attachments doReturn(attachments).whenever(services).attachments
} }
@Test @Test(timeout=300_000)
fun `Amount(Currency) serialization`() { fun `Amount(Currency) serialization`() {
assertThat(mapper.valueToTree<TextNode>(Amount.parseCurrency("£25000000")).textValue()).isEqualTo("25000000.00 GBP") assertThat(mapper.valueToTree<TextNode>(Amount.parseCurrency("£25000000")).textValue()).isEqualTo("25000000.00 GBP")
assertThat(mapper.valueToTree<TextNode>(Amount.parseCurrency("$250000")).textValue()).isEqualTo("250000.00 USD") assertThat(mapper.valueToTree<TextNode>(Amount.parseCurrency("$250000")).textValue()).isEqualTo("250000.00 USD")
} }
@Test @Test(timeout=300_000)
fun `Amount(Currency) deserialization`() { fun `Amount(Currency) deserialization`() {
val old = mapOf( val old = mapOf(
"quantity" to 2500000000, "quantity" to 2500000000,
"token" to "USD" "token" to "USD"
@ -122,13 +122,13 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<Amount<Currency>>(old)).isEqualTo(Amount(2_500_000_000, USD)) assertThat(mapper.convertValue<Amount<Currency>>(old)).isEqualTo(Amount(2_500_000_000, USD))
} }
@Test @Test(timeout=300_000)
fun `Amount(Currency) Text deserialization`() { fun `Amount(Currency) Text deserialization`() {
assertThat(mapper.convertValue<Amount<Currency>>(TextNode("$25000000"))).isEqualTo(Amount(2_500_000_000, USD)) assertThat(mapper.convertValue<Amount<Currency>>(TextNode("$25000000"))).isEqualTo(Amount(2_500_000_000, USD))
} }
@Test @Test(timeout=300_000)
fun ByteSequence() { fun ByteSequence() {
val byteSequence: ByteSequence = OpaqueBytes.of(1, 2, 3, 4).subSequence(0, 2) val byteSequence: ByteSequence = OpaqueBytes.of(1, 2, 3, 4).subSequence(0, 2)
val json = mapper.valueToTree<BinaryNode>(byteSequence) val json = mapper.valueToTree<BinaryNode>(byteSequence)
assertThat(json.binaryValue()).containsExactly(1, 2) assertThat(json.binaryValue()).containsExactly(1, 2)
@ -136,22 +136,22 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<ByteSequence>(json)).isEqualTo(byteSequence) assertThat(mapper.convertValue<ByteSequence>(json)).isEqualTo(byteSequence)
} }
@Test @Test(timeout=300_000)
fun `OpaqueBytes serialization`() { fun `OpaqueBytes serialization`() {
val opaqueBytes = OpaqueBytes(secureRandomBytes(128)) val opaqueBytes = OpaqueBytes(secureRandomBytes(128))
val json = mapper.valueToTree<BinaryNode>(opaqueBytes) val json = mapper.valueToTree<BinaryNode>(opaqueBytes)
assertThat(json.binaryValue()).isEqualTo(opaqueBytes.bytes) assertThat(json.binaryValue()).isEqualTo(opaqueBytes.bytes)
assertThat(json.asText()).isEqualTo(opaqueBytes.bytes.toBase64()) assertThat(json.asText()).isEqualTo(opaqueBytes.bytes.toBase64())
} }
@Test @Test(timeout=300_000)
fun `OpaqueBytes deserialization`() { fun `OpaqueBytes deserialization`() {
assertThat(mapper.convertValue<OpaqueBytes>(TextNode("1234"))).isEqualTo(OpaqueBytes("1234".toByteArray(UTF_8))) assertThat(mapper.convertValue<OpaqueBytes>(TextNode("1234"))).isEqualTo(OpaqueBytes("1234".toByteArray(UTF_8)))
assertThat(mapper.convertValue<OpaqueBytes>(BinaryNode(byteArrayOf(1, 2, 3, 4)))).isEqualTo(OpaqueBytes.of(1, 2, 3, 4)) assertThat(mapper.convertValue<OpaqueBytes>(BinaryNode(byteArrayOf(1, 2, 3, 4)))).isEqualTo(OpaqueBytes.of(1, 2, 3, 4))
} }
@Test @Test(timeout=300_000)
fun SerializedBytes() { fun SerializedBytes() {
val data = TestData(BOB_NAME, "Summary", SubTestData(1234)) val data = TestData(BOB_NAME, "Summary", SubTestData(1234))
val serializedBytes = data.serialize() val serializedBytes = data.serialize()
val json = mapper.valueToTree<ObjectNode>(serializedBytes) val json = mapper.valueToTree<ObjectNode>(serializedBytes)
@ -168,8 +168,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
// @CordaSerializable // @CordaSerializable
// data class ClassNotOnClasspath(val name: CordaX500Name, val value: Int) // data class ClassNotOnClasspath(val name: CordaX500Name, val value: Int)
@Test @Test(timeout=300_000)
fun `SerializedBytes of class not on classpath`() { fun `SerializedBytes of class not on classpath`() {
// The contents of the file were written out as follows: // The contents of the file were written out as follows:
// ClassNotOnClasspath(BOB_NAME, 54321).serialize().open().copyTo("build" / "class-not-on-classpath-data") // ClassNotOnClasspath(BOB_NAME, 54321).serialize().open().copyTo("build" / "class-not-on-classpath-data")
@ -184,8 +184,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<SerializedBytes<*>>(BinaryNode(serializedBytes.bytes))).isEqualTo(serializedBytes) assertThat(mapper.convertValue<SerializedBytes<*>>(BinaryNode(serializedBytes.bytes))).isEqualTo(serializedBytes)
} }
@Test @Test(timeout=300_000)
fun DigitalSignature() { fun DigitalSignature() {
val digitalSignature = DigitalSignature(secureRandomBytes(128)) val digitalSignature = DigitalSignature(secureRandomBytes(128))
val json = mapper.valueToTree<BinaryNode>(digitalSignature) val json = mapper.valueToTree<BinaryNode>(digitalSignature)
assertThat(json.binaryValue()).isEqualTo(digitalSignature.bytes) assertThat(json.binaryValue()).isEqualTo(digitalSignature.bytes)
@ -193,8 +193,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<DigitalSignature>(json)).isEqualTo(digitalSignature) assertThat(mapper.convertValue<DigitalSignature>(json)).isEqualTo(digitalSignature)
} }
@Test @Test(timeout=300_000)
fun `DigitalSignature WithKey`() { fun `DigitalSignature WithKey`() {
val digitalSignature = DigitalSignature.WithKey(BOB_PUBKEY, secureRandomBytes(128)) val digitalSignature = DigitalSignature.WithKey(BOB_PUBKEY, secureRandomBytes(128))
val json = mapper.valueToTree<ObjectNode>(digitalSignature) val json = mapper.valueToTree<ObjectNode>(digitalSignature)
val (by, bytes) = json.assertHasOnlyFields("by", "bytes") val (by, bytes) = json.assertHasOnlyFields("by", "bytes")
@ -203,8 +203,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<DigitalSignature.WithKey>(json)).isEqualTo(digitalSignature) assertThat(mapper.convertValue<DigitalSignature.WithKey>(json)).isEqualTo(digitalSignature)
} }
@Test @Test(timeout=300_000)
fun DigitalSignatureWithCert() { fun DigitalSignatureWithCert() {
val digitalSignature = DigitalSignatureWithCert(MINI_CORP.identity.certificate, secureRandomBytes(128)) val digitalSignature = DigitalSignatureWithCert(MINI_CORP.identity.certificate, secureRandomBytes(128))
val json = mapper.valueToTree<ObjectNode>(digitalSignature) val json = mapper.valueToTree<ObjectNode>(digitalSignature)
val (by, bytes) = json.assertHasOnlyFields("by", "bytes", "parentCertsChain") val (by, bytes) = json.assertHasOnlyFields("by", "bytes", "parentCertsChain")
@ -213,8 +213,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<DigitalSignatureWithCert>(json)).isEqualTo(digitalSignature) assertThat(mapper.convertValue<DigitalSignatureWithCert>(json)).isEqualTo(digitalSignature)
} }
@Test @Test(timeout=300_000)
fun TransactionSignature() { fun TransactionSignature() {
val signatureMetadata = SignatureMetadata(1, 1) val signatureMetadata = SignatureMetadata(1, 1)
val partialMerkleTree = PartialMerkleTree(PartialTree.Node( val partialMerkleTree = PartialMerkleTree(PartialTree.Node(
left = PartialTree.Leaf(SecureHash.randomSHA256()), left = PartialTree.Leaf(SecureHash.randomSHA256()),
@ -235,8 +235,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<TransactionSignature>(json)).isEqualTo(transactionSignature) assertThat(mapper.convertValue<TransactionSignature>(json)).isEqualTo(transactionSignature)
} }
@Test @Test(timeout=300_000)
fun `SignedTransaction (WireTransaction)`() { fun `SignedTransaction (WireTransaction)`() {
val attachmentId = SecureHash.randomSHA256() val attachmentId = SecureHash.randomSHA256()
doReturn(attachmentId).whenever(cordappProvider).getContractAttachmentID(DummyContract.PROGRAM_ID) doReturn(attachmentId).whenever(cordappProvider).getContractAttachmentID(DummyContract.PROGRAM_ID)
val attachmentStorage = rigorousMock<AttachmentStorage>() val attachmentStorage = rigorousMock<AttachmentStorage>()
@ -279,8 +279,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<SignedTransaction>(json)).isEqualTo(stx) assertThat(mapper.convertValue<SignedTransaction>(json)).isEqualTo(stx)
} }
@Test @Test(timeout=300_000)
fun TransactionState() { fun TransactionState() {
val txState = createTransactionState() val txState = createTransactionState()
val json = mapper.valueToTree<ObjectNode>(txState) val json = mapper.valueToTree<ObjectNode>(txState)
println(mapper.writeValueAsString(json)) println(mapper.writeValueAsString(json))
@ -288,44 +288,44 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<TransactionState<*>>(json)).isEqualTo(txState) assertThat(mapper.convertValue<TransactionState<*>>(json)).isEqualTo(txState)
} }
@Test @Test(timeout=300_000)
fun Command() { fun Command() {
val command = Command(DummyCommandData, listOf(BOB_PUBKEY)) val command = Command(DummyCommandData, listOf(BOB_PUBKEY))
val json = mapper.valueToTree<ObjectNode>(command) val json = mapper.valueToTree<ObjectNode>(command)
assertThat(mapper.convertValue<Command<*>>(json)).isEqualTo(command) assertThat(mapper.convertValue<Command<*>>(json)).isEqualTo(command)
} }
@Test @Test(timeout=300_000)
fun `TimeWindow - fromOnly`() { fun `TimeWindow - fromOnly`() {
val fromOnly = TimeWindow.fromOnly(Instant.now()) val fromOnly = TimeWindow.fromOnly(Instant.now())
val json = mapper.valueToTree<ObjectNode>(fromOnly) val json = mapper.valueToTree<ObjectNode>(fromOnly)
assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(fromOnly) assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(fromOnly)
} }
@Test @Test(timeout=300_000)
fun `TimeWindow - untilOnly`() { fun `TimeWindow - untilOnly`() {
val untilOnly = TimeWindow.untilOnly(Instant.now()) val untilOnly = TimeWindow.untilOnly(Instant.now())
val json = mapper.valueToTree<ObjectNode>(untilOnly) val json = mapper.valueToTree<ObjectNode>(untilOnly)
assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(untilOnly) assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(untilOnly)
} }
@Test @Test(timeout=300_000)
fun `TimeWindow - between`() { fun `TimeWindow - between`() {
val between = TimeWindow.between(Instant.now(), Instant.now() + 1.days) val between = TimeWindow.between(Instant.now(), Instant.now() + 1.days)
val json = mapper.valueToTree<ObjectNode>(between) val json = mapper.valueToTree<ObjectNode>(between)
assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(between) assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(between)
} }
@Test @Test(timeout=300_000)
fun PrivacySalt() { fun PrivacySalt() {
val privacySalt = net.corda.core.contracts.PrivacySalt() val privacySalt = net.corda.core.contracts.PrivacySalt()
val json = mapper.valueToTree<TextNode>(privacySalt) val json = mapper.valueToTree<TextNode>(privacySalt)
assertThat(json.textValue()).isEqualTo(privacySalt.bytes.toHexString()) assertThat(json.textValue()).isEqualTo(privacySalt.bytes.toHexString())
assertThat(mapper.convertValue<PrivacySalt>(json)).isEqualTo(privacySalt) assertThat(mapper.convertValue<PrivacySalt>(json)).isEqualTo(privacySalt)
} }
@Test @Test(timeout=300_000)
fun SignatureMetadata() { fun SignatureMetadata() {
val signatureMetadata = SignatureMetadata(2, Crypto.ECDSA_SECP256R1_SHA256.schemeNumberID) val signatureMetadata = SignatureMetadata(2, Crypto.ECDSA_SECP256R1_SHA256.schemeNumberID)
val json = mapper.valueToTree<ObjectNode>(signatureMetadata) val json = mapper.valueToTree<ObjectNode>(signatureMetadata)
val (platformVersion, scheme) = json.assertHasOnlyFields("platformVersion", "scheme") val (platformVersion, scheme) = json.assertHasOnlyFields("platformVersion", "scheme")
@ -334,44 +334,44 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<SignatureMetadata>(json)).isEqualTo(signatureMetadata) assertThat(mapper.convertValue<SignatureMetadata>(json)).isEqualTo(signatureMetadata)
} }
@Test @Test(timeout=300_000)
fun `SignatureMetadata on unknown schemeNumberID`() { fun `SignatureMetadata on unknown schemeNumberID`() {
val signatureMetadata = SignatureMetadata(2, Int.MAX_VALUE) val signatureMetadata = SignatureMetadata(2, Int.MAX_VALUE)
val json = mapper.valueToTree<ObjectNode>(signatureMetadata) val json = mapper.valueToTree<ObjectNode>(signatureMetadata)
assertThat(json["scheme"].intValue()).isEqualTo(Int.MAX_VALUE) assertThat(json["scheme"].intValue()).isEqualTo(Int.MAX_VALUE)
assertThat(mapper.convertValue<SignatureMetadata>(json)).isEqualTo(signatureMetadata) assertThat(mapper.convertValue<SignatureMetadata>(json)).isEqualTo(signatureMetadata)
} }
@Test @Test(timeout=300_000)
fun `SignatureScheme serialization`() { fun `SignatureScheme serialization`() {
val json = mapper.valueToTree<TextNode>(Crypto.ECDSA_SECP256R1_SHA256) val json = mapper.valueToTree<TextNode>(Crypto.ECDSA_SECP256R1_SHA256)
assertThat(json.textValue()).isEqualTo("ECDSA_SECP256R1_SHA256") assertThat(json.textValue()).isEqualTo("ECDSA_SECP256R1_SHA256")
} }
@Test @Test(timeout=300_000)
fun `SignatureScheme deserialization`() { fun `SignatureScheme deserialization`() {
assertThat(mapper.convertValue<SignatureScheme>(TextNode("EDDSA_ED25519_SHA512"))).isSameAs(Crypto.EDDSA_ED25519_SHA512) assertThat(mapper.convertValue<SignatureScheme>(TextNode("EDDSA_ED25519_SHA512"))).isSameAs(Crypto.EDDSA_ED25519_SHA512)
assertThat(mapper.convertValue<SignatureScheme>(IntNode(4))).isSameAs(Crypto.EDDSA_ED25519_SHA512) assertThat(mapper.convertValue<SignatureScheme>(IntNode(4))).isSameAs(Crypto.EDDSA_ED25519_SHA512)
} }
@Test @Test(timeout=300_000)
fun `PartialTree IncludedLeaf`() { fun `PartialTree IncludedLeaf`() {
val includedLeaf = PartialTree.IncludedLeaf(SecureHash.randomSHA256()) val includedLeaf = PartialTree.IncludedLeaf(SecureHash.randomSHA256())
val json = mapper.valueToTree<ObjectNode>(includedLeaf) val json = mapper.valueToTree<ObjectNode>(includedLeaf)
assertThat(json.assertHasOnlyFields("includedLeaf")[0].textValue()).isEqualTo(includedLeaf.hash.toString()) assertThat(json.assertHasOnlyFields("includedLeaf")[0].textValue()).isEqualTo(includedLeaf.hash.toString())
assertThat(mapper.convertValue<PartialTree.IncludedLeaf>(json)).isEqualTo(includedLeaf) assertThat(mapper.convertValue<PartialTree.IncludedLeaf>(json)).isEqualTo(includedLeaf)
} }
@Test @Test(timeout=300_000)
fun `PartialTree Leaf`() { fun `PartialTree Leaf`() {
val leaf = PartialTree.Leaf(SecureHash.randomSHA256()) val leaf = PartialTree.Leaf(SecureHash.randomSHA256())
val json = mapper.valueToTree<ObjectNode>(leaf) val json = mapper.valueToTree<ObjectNode>(leaf)
assertThat(json.assertHasOnlyFields("leaf")[0].textValue()).isEqualTo(leaf.hash.toString()) assertThat(json.assertHasOnlyFields("leaf")[0].textValue()).isEqualTo(leaf.hash.toString())
assertThat(mapper.convertValue<PartialTree.Leaf>(json)).isEqualTo(leaf) assertThat(mapper.convertValue<PartialTree.Leaf>(json)).isEqualTo(leaf)
} }
@Test @Test(timeout=300_000)
fun `simple PartialTree Node`() { fun `simple PartialTree Node`() {
val node = PartialTree.Node( val node = PartialTree.Node(
left = PartialTree.Leaf(SecureHash.randomSHA256()), left = PartialTree.Leaf(SecureHash.randomSHA256()),
right = PartialTree.IncludedLeaf(SecureHash.randomSHA256()) right = PartialTree.IncludedLeaf(SecureHash.randomSHA256())
@ -384,8 +384,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<PartialTree.Node>(json)).isEqualTo(node) assertThat(mapper.convertValue<PartialTree.Node>(json)).isEqualTo(node)
} }
@Test @Test(timeout=300_000)
fun `complex PartialTree Node`() { fun `complex PartialTree Node`() {
val node = PartialTree.Node( val node = PartialTree.Node(
left = PartialTree.IncludedLeaf(SecureHash.randomSHA256()), left = PartialTree.IncludedLeaf(SecureHash.randomSHA256()),
right = PartialTree.Node( right = PartialTree.Node(
@ -401,8 +401,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
// TODO Issued // TODO Issued
// TODO PartyAndReference // TODO PartyAndReference
@Test @Test(timeout=300_000)
fun CordaX500Name() { fun CordaX500Name() {
testToStringSerialisation(CordaX500Name( testToStringSerialisation(CordaX500Name(
commonName = "COMMON", commonName = "COMMON",
organisationUnit = "ORG UNIT", organisationUnit = "ORG UNIT",
@ -413,42 +413,42 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
)) ))
} }
@Test @Test(timeout=300_000)
fun `SecureHash SHA256`() { fun `SecureHash SHA256`() {
testToStringSerialisation(SecureHash.randomSHA256()) testToStringSerialisation(SecureHash.randomSHA256())
} }
@Test @Test(timeout=300_000)
fun NetworkHostAndPort() { fun NetworkHostAndPort() {
testToStringSerialisation(NetworkHostAndPort("localhost", 9090)) testToStringSerialisation(NetworkHostAndPort("localhost", 9090))
} }
@Test @Test(timeout=300_000)
fun UUID() { fun UUID() {
testToStringSerialisation(UUID.randomUUID()) testToStringSerialisation(UUID.randomUUID())
} }
@Test @Test(timeout=300_000)
fun Instant() { fun Instant() {
testToStringSerialisation(Instant.now()) testToStringSerialisation(Instant.now())
} }
@Test @Test(timeout=300_000)
fun `Date is treated as Instant`() { fun `Date is treated as Instant`() {
val date = Date() val date = Date()
val json = mapper.valueToTree<TextNode>(date) val json = mapper.valueToTree<TextNode>(date)
assertThat(json.textValue()).isEqualTo(date.toInstant().toString()) assertThat(json.textValue()).isEqualTo(date.toInstant().toString())
assertThat(mapper.convertValue<Date>(json)).isEqualTo(date) assertThat(mapper.convertValue<Date>(json)).isEqualTo(date)
} }
@Test @Test(timeout=300_000)
fun `Party serialization`() { fun `Party serialization`() {
val json = mapper.valueToTree<TextNode>(MINI_CORP.party) val json = mapper.valueToTree<TextNode>(MINI_CORP.party)
assertThat(json.textValue()).isEqualTo(MINI_CORP.name.toString()) assertThat(json.textValue()).isEqualTo(MINI_CORP.name.toString())
} }
@Test @Test(timeout=300_000)
fun `Party serialization with isFullParty = true`() { fun `Party serialization with isFullParty = true`() {
partyObjectMapper.isFullParties = true partyObjectMapper.isFullParties = true
val json = mapper.valueToTree<ObjectNode>(MINI_CORP.party) val json = mapper.valueToTree<ObjectNode>(MINI_CORP.party)
val (name, owningKey) = json.assertHasOnlyFields("name", "owningKey") val (name, owningKey) = json.assertHasOnlyFields("name", "owningKey")
@ -456,8 +456,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(owningKey.valueAs<PublicKey>(mapper)).isEqualTo(MINI_CORP.publicKey) assertThat(owningKey.valueAs<PublicKey>(mapper)).isEqualTo(MINI_CORP.publicKey)
} }
@Test @Test(timeout=300_000)
fun `Party deserialization on full name`() { fun `Party deserialization on full name`() {
fun convertToParty() = mapper.convertValue<Party>(TextNode(MINI_CORP.name.toString())) fun convertToParty() = mapper.convertValue<Party>(TextNode(MINI_CORP.name.toString()))
// Check that it fails if it can't find the party // Check that it fails if it can't find the party
@ -467,8 +467,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(convertToParty()).isEqualTo(MINI_CORP.party) assertThat(convertToParty()).isEqualTo(MINI_CORP.party)
} }
@Test @Test(timeout=300_000)
fun `Party deserialization on part of name`() { fun `Party deserialization on part of name`() {
fun convertToParty() = mapper.convertValue<Party>(TextNode(MINI_CORP.name.organisation)) fun convertToParty() = mapper.convertValue<Party>(TextNode(MINI_CORP.name.organisation))
// Check that it fails if it can't find the party // Check that it fails if it can't find the party
@ -478,8 +478,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(convertToParty()).isEqualTo(MINI_CORP.party) assertThat(convertToParty()).isEqualTo(MINI_CORP.party)
} }
@Test @Test(timeout=300_000)
fun `Party deserialization on public key`() { fun `Party deserialization on public key`() {
fun convertToParty() = mapper.convertValue<Party>(TextNode(MINI_CORP.publicKey.toBase58String())) fun convertToParty() = mapper.convertValue<Party>(TextNode(MINI_CORP.publicKey.toBase58String()))
// Check that it fails if it can't find the party // Check that it fails if it can't find the party
@ -489,8 +489,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(convertToParty()).isEqualTo(MINI_CORP.party) assertThat(convertToParty()).isEqualTo(MINI_CORP.party)
} }
@Test @Test(timeout=300_000)
fun `Party deserialization on name and key`() { fun `Party deserialization on name and key`() {
val party = mapper.convertValue<Party>(mapOf( val party = mapper.convertValue<Party>(mapOf(
"name" to MINI_CORP.name, "name" to MINI_CORP.name,
"owningKey" to MINI_CORP.publicKey "owningKey" to MINI_CORP.publicKey
@ -500,23 +500,23 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(party.owningKey).isEqualTo(MINI_CORP.publicKey) assertThat(party.owningKey).isEqualTo(MINI_CORP.publicKey)
} }
@Test @Test(timeout=300_000)
fun PublicKey() { fun PublicKey() {
val json = mapper.valueToTree<TextNode>(MINI_CORP.publicKey) val json = mapper.valueToTree<TextNode>(MINI_CORP.publicKey)
assertThat(json.textValue()).isEqualTo(MINI_CORP.publicKey.toBase58String()) assertThat(json.textValue()).isEqualTo(MINI_CORP.publicKey.toBase58String())
assertThat(mapper.convertValue<PublicKey>(json)).isEqualTo(MINI_CORP.publicKey) assertThat(mapper.convertValue<PublicKey>(json)).isEqualTo(MINI_CORP.publicKey)
} }
@Test @Test(timeout=300_000)
fun `EdDSA public key`() { fun `EdDSA public key`() {
val publicKey = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, SEED).public val publicKey = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, SEED).public
val json = mapper.valueToTree<TextNode>(publicKey) val json = mapper.valueToTree<TextNode>(publicKey)
assertThat(json.textValue()).isEqualTo(publicKey.toBase58String()) assertThat(json.textValue()).isEqualTo(publicKey.toBase58String())
assertThat(mapper.convertValue<PublicKey>(json)).isEqualTo(publicKey) assertThat(mapper.convertValue<PublicKey>(json)).isEqualTo(publicKey)
} }
@Test @Test(timeout=300_000)
fun CompositeKey() { fun CompositeKey() {
val innerKeys = (1..3).map { i -> val innerKeys = (1..3).map { i ->
Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, SEED + i.toBigInteger()).public Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, SEED + i.toBigInteger()).public
} }
@ -530,22 +530,22 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<CompositeKey>(json)).isEqualTo(publicKey) assertThat(mapper.convertValue<CompositeKey>(json)).isEqualTo(publicKey)
} }
@Test @Test(timeout=300_000)
fun AnonymousParty() { fun AnonymousParty() {
val anonymousParty = AnonymousParty(ALICE_PUBKEY) val anonymousParty = AnonymousParty(ALICE_PUBKEY)
val json = mapper.valueToTree<TextNode>(anonymousParty) val json = mapper.valueToTree<TextNode>(anonymousParty)
assertThat(json.textValue()).isEqualTo(ALICE_PUBKEY.toBase58String()) assertThat(json.textValue()).isEqualTo(ALICE_PUBKEY.toBase58String())
assertThat(mapper.convertValue<AnonymousParty>(json)).isEqualTo(anonymousParty) assertThat(mapper.convertValue<AnonymousParty>(json)).isEqualTo(anonymousParty)
} }
@Test @Test(timeout=300_000)
fun `PartyAndCertificate serialization`() { fun `PartyAndCertificate serialization`() {
val json = mapper.valueToTree<TextNode>(MINI_CORP.identity) val json = mapper.valueToTree<TextNode>(MINI_CORP.identity)
assertThat(json.textValue()).isEqualTo(MINI_CORP.name.toString()) assertThat(json.textValue()).isEqualTo(MINI_CORP.name.toString())
} }
@Test @Test(timeout=300_000)
fun `PartyAndCertificate serialization with isFullParty = true`() { fun `PartyAndCertificate serialization with isFullParty = true`() {
partyObjectMapper.isFullParties = true partyObjectMapper.isFullParties = true
val json = mapper.valueToTree<ObjectNode>(MINI_CORP.identity) val json = mapper.valueToTree<ObjectNode>(MINI_CORP.identity)
println(mapper.writeValueAsString(json)) println(mapper.writeValueAsString(json))
@ -554,16 +554,16 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(certPath.valueAs<CertPath>(mapper)).isEqualTo(MINI_CORP.identity.certPath) assertThat(certPath.valueAs<CertPath>(mapper)).isEqualTo(MINI_CORP.identity.certPath)
} }
@Test @Test(timeout=300_000)
fun `PartyAndCertificate deserialization on cert path`() { fun `PartyAndCertificate deserialization on cert path`() {
val certPathJson = mapper.valueToTree<JsonNode>(MINI_CORP.identity.certPath) val certPathJson = mapper.valueToTree<JsonNode>(MINI_CORP.identity.certPath)
val partyAndCert = mapper.convertValue<PartyAndCertificate>(mapOf("certPath" to certPathJson)) val partyAndCert = mapper.convertValue<PartyAndCertificate>(mapOf("certPath" to certPathJson))
// PartyAndCertificate.equals is defined on the Party so we must check the certPath directly // PartyAndCertificate.equals is defined on the Party so we must check the certPath directly
assertThat(partyAndCert.certPath).isEqualTo(MINI_CORP.identity.certPath) assertThat(partyAndCert.certPath).isEqualTo(MINI_CORP.identity.certPath)
} }
@Test @Test(timeout=300_000)
fun `NodeInfo serialization`() { fun `NodeInfo serialization`() {
val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME) val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME)
val json = mapper.valueToTree<ObjectNode>(nodeInfo) val json = mapper.valueToTree<ObjectNode>(nodeInfo)
val (addresses, legalIdentitiesAndCerts, platformVersion, serial) = json.assertHasOnlyFields( val (addresses, legalIdentitiesAndCerts, platformVersion, serial) = json.assertHasOnlyFields(
@ -584,8 +584,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(serial.longValue()).isEqualTo(nodeInfo.serial) assertThat(serial.longValue()).isEqualTo(nodeInfo.serial)
} }
@Test @Test(timeout=300_000)
fun `NodeInfo deserialization on name`() { fun `NodeInfo deserialization on name`() {
val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME) val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME)
fun convertToNodeInfo() = mapper.convertValue<NodeInfo>(TextNode(ALICE_NAME.toString())) fun convertToNodeInfo() = mapper.convertValue<NodeInfo>(TextNode(ALICE_NAME.toString()))
@ -597,8 +597,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(convertToNodeInfo()).isEqualTo(nodeInfo) assertThat(convertToNodeInfo()).isEqualTo(nodeInfo)
} }
@Test @Test(timeout=300_000)
fun `NodeInfo deserialization on public key`() { fun `NodeInfo deserialization on public key`() {
val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME) val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME)
fun convertToNodeInfo() = mapper.convertValue<NodeInfo>(TextNode(nodeInfo.legalIdentities[0].owningKey.toBase58String())) fun convertToNodeInfo() = mapper.convertValue<NodeInfo>(TextNode(nodeInfo.legalIdentities[0].owningKey.toBase58String()))
@ -610,8 +610,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(convertToNodeInfo()).isEqualTo(nodeInfo) assertThat(convertToNodeInfo()).isEqualTo(nodeInfo)
} }
@Test @Test(timeout=300_000)
fun CertPath() { fun CertPath() {
val certPath = MINI_CORP.identity.certPath val certPath = MINI_CORP.identity.certPath
val json = mapper.valueToTree<ObjectNode>(certPath) val json = mapper.valueToTree<ObjectNode>(certPath)
println(mapper.writeValueAsString(json)) println(mapper.writeValueAsString(json))
@ -624,8 +624,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<CertPath>(json).encoded).isEqualTo(certPath.encoded) assertThat(mapper.convertValue<CertPath>(json).encoded).isEqualTo(certPath.encoded)
} }
@Test @Test(timeout=300_000)
fun `X509Certificate serialization`() { fun `X509Certificate serialization`() {
val cert: X509Certificate = MINI_CORP.identity.certificate val cert: X509Certificate = MINI_CORP.identity.certificate
val json = mapper.valueToTree<ObjectNode>(cert) val json = mapper.valueToTree<ObjectNode>(cert)
println(mapper.writeValueAsString(json)) println(mapper.writeValueAsString(json))
@ -639,28 +639,28 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(json["encoded"].binaryValue()).isEqualTo(cert.encoded) assertThat(json["encoded"].binaryValue()).isEqualTo(cert.encoded)
} }
@Test @Test(timeout=300_000)
fun `X509Certificate serialization when extendedKeyUsage is null`() { fun `X509Certificate serialization when extendedKeyUsage is null`() {
val cert: X509Certificate = spy(MINI_CORP.identity.certificate) val cert: X509Certificate = spy(MINI_CORP.identity.certificate)
whenever(cert.extendedKeyUsage).thenReturn(null) whenever(cert.extendedKeyUsage).thenReturn(null)
// should work even if extendedKeyUsage is null // should work even if extendedKeyUsage is null
mapper.valueToTree<ObjectNode>(cert) mapper.valueToTree<ObjectNode>(cert)
} }
@Test @Test(timeout=300_000)
fun `X509Certificate deserialization`() { fun `X509Certificate deserialization`() {
val cert: X509Certificate = MINI_CORP.identity.certificate val cert: X509Certificate = MINI_CORP.identity.certificate
assertThat(mapper.convertValue<X509Certificate>(mapOf("encoded" to cert.encoded))).isEqualTo(cert) assertThat(mapper.convertValue<X509Certificate>(mapOf("encoded" to cert.encoded))).isEqualTo(cert)
assertThat(mapper.convertValue<X509Certificate>(BinaryNode(cert.encoded))).isEqualTo(cert) assertThat(mapper.convertValue<X509Certificate>(BinaryNode(cert.encoded))).isEqualTo(cert)
} }
@Test @Test(timeout=300_000)
fun X500Principal() { fun X500Principal() {
testToStringSerialisation(X500Principal("CN=Common,L=London,O=Org,C=UK")) testToStringSerialisation(X500Principal("CN=Common,L=London,O=Org,C=UK"))
} }
@Test @Test(timeout=300_000)
fun `@CordaSerializable class which has non-c'tor properties`() { fun `@CordaSerializable class which has non-c'tor properties`() {
val data = NonCtorPropertiesData(4434) val data = NonCtorPropertiesData(4434)
val json = mapper.valueToTree<ObjectNode>(data) val json = mapper.valueToTree<ObjectNode>(data)
val (value) = json.assertHasOnlyFields("value") val (value) = json.assertHasOnlyFields("value")
@ -668,8 +668,8 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<NonCtorPropertiesData>(json)).isEqualTo(data) assertThat(mapper.convertValue<NonCtorPropertiesData>(json)).isEqualTo(data)
} }
@Test @Test(timeout=300_000)
fun `LinearState where the linearId property does not match the backing field`() { fun `LinearState where the linearId property does not match the backing field`() {
val funkyLinearState = FunkyLinearState(UniqueIdentifier()) val funkyLinearState = FunkyLinearState(UniqueIdentifier())
// As a sanity check, show that this is a valid CordaSerializable class // As a sanity check, show that this is a valid CordaSerializable class
assertThat(funkyLinearState.serialize().deserialize()).isEqualTo(funkyLinearState) assertThat(funkyLinearState.serialize().deserialize()).isEqualTo(funkyLinearState)
@ -677,14 +677,14 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
assertThat(mapper.convertValue<FunkyLinearState>(json)).isEqualTo(funkyLinearState) assertThat(mapper.convertValue<FunkyLinearState>(json)).isEqualTo(funkyLinearState)
} }
@Test @Test(timeout=300_000)
fun `kotlin object`() { fun `kotlin object`() {
val json = mapper.valueToTree<ObjectNode>(KotlinObject) val json = mapper.valueToTree<ObjectNode>(KotlinObject)
assertThat(mapper.convertValue<KotlinObject>(json)).isSameAs(KotlinObject) assertThat(mapper.convertValue<KotlinObject>(json)).isSameAs(KotlinObject)
} }
@Test @Test(timeout=300_000)
fun `@CordaSerializable kotlin object`() { fun `@CordaSerializable kotlin object`() {
val json = mapper.valueToTree<ObjectNode>(CordaSerializableKotlinObject) val json = mapper.valueToTree<ObjectNode>(CordaSerializableKotlinObject)
assertThat(mapper.convertValue<CordaSerializableKotlinObject>(json)).isSameAs(CordaSerializableKotlinObject) assertThat(mapper.convertValue<CordaSerializableKotlinObject>(json)).isSameAs(CordaSerializableKotlinObject)
} }

View File

@ -13,15 +13,15 @@ class StateMachineRunIdTest {
private val jsonMapper: ObjectMapper = ObjectMapper().registerModule(CordaModule()) private val jsonMapper: ObjectMapper = ObjectMapper().registerModule(CordaModule())
} }
@Test @Test(timeout=300_000)
fun `state machine run ID deserialise`() { fun `state machine run ID deserialise`() {
val str = """"$ID"""" val str = """"$ID""""
val runID = jsonMapper.readValue(str, StateMachineRunId::class.java) val runID = jsonMapper.readValue(str, StateMachineRunId::class.java)
assertEquals(StateMachineRunId(UUID.fromString(ID)), runID) assertEquals(StateMachineRunId(UUID.fromString(ID)), runID)
} }
@Test @Test(timeout=300_000)
fun `state machine run ID serialise`() { fun `state machine run ID serialise`() {
val runId = StateMachineRunId(UUID.fromString(ID)) val runId = StateMachineRunId(UUID.fromString(ID))
val str = jsonMapper.writeValueAsString(runId) val str = jsonMapper.writeValueAsString(runId)
assertEquals(""""$ID"""", str) assertEquals(""""$ID"""", str)

View File

@ -32,8 +32,8 @@ class StringToMethodCallParserTest {
"overload a: A, b: B" to "AB" "overload a: A, b: B" to "AB"
) )
@Test @Test(timeout=300_000)
fun calls() { fun calls() {
val parser = StringToMethodCallParser(Target::class) val parser = StringToMethodCallParser(Target::class)
val target = Target() val target = Target()
for ((input, output) in tests) { for ((input, output) in tests) {
@ -45,8 +45,8 @@ class StringToMethodCallParserTest {
* It would be unreasonable to expect "[ A, B, C ]" to deserialise as "Deque<Char>" by default. * It would be unreasonable to expect "[ A, B, C ]" to deserialise as "Deque<Char>" by default.
* Deque is chosen as we still expect it to preserve the order of its elements. * Deque is chosen as we still expect it to preserve the order of its elements.
*/ */
@Test @Test(timeout=300_000)
fun complexNestedGenericMethod() { fun complexNestedGenericMethod() {
val parser = StringToMethodCallParser(Target::class) val parser = StringToMethodCallParser(Target::class)
val result = parser.parse(Target(), "complexNestedObject pairs: { first: 101, second: [ A, B, C ] }").invoke() val result = parser.parse(Target(), "complexNestedObject pairs: { first: 101, second: [ A, B, C ] }").invoke()
@ -66,8 +66,8 @@ class StringToMethodCallParserTest {
constructor(numbers: List<Long>) : this(numbers.map(Long::toString).joinToString("+"), numbers.size) constructor(numbers: List<Long>) : this(numbers.map(Long::toString).joinToString("+"), numbers.size)
} }
@Test @Test(timeout=300_000)
fun ctor1() { fun ctor1() {
val clazz = ConstructorTarget::class.java val clazz = ConstructorTarget::class.java
val parser = StringToMethodCallParser(clazz) val parser = StringToMethodCallParser(clazz)
val ctor = clazz.getDeclaredConstructor(String::class.java, Int::class.java) val ctor = clazz.getDeclaredConstructor(String::class.java, Int::class.java)
@ -77,8 +77,8 @@ class StringToMethodCallParserTest {
assertArrayEquals(arrayOf("Blah blah blah", 12), args) assertArrayEquals(arrayOf("Blah blah blah", 12), args)
} }
@Test @Test(timeout=300_000)
fun ctor2() { fun ctor2() {
val clazz = ConstructorTarget::class.java val clazz = ConstructorTarget::class.java
val parser = StringToMethodCallParser(clazz) val parser = StringToMethodCallParser(clazz)
val ctor = clazz.getDeclaredConstructor(String::class.java) val ctor = clazz.getDeclaredConstructor(String::class.java)
@ -88,8 +88,8 @@ class StringToMethodCallParserTest {
assertArrayEquals(arrayOf("Foo bar!"), args) assertArrayEquals(arrayOf("Foo bar!"), args)
} }
@Test @Test(timeout=300_000)
fun constructorWithGenericArgs() { fun constructorWithGenericArgs() {
val clazz = ConstructorTarget::class.java val clazz = ConstructorTarget::class.java
val ctor = clazz.getDeclaredConstructor(List::class.java) val ctor = clazz.getDeclaredConstructor(List::class.java)
StringToMethodCallParser(clazz).apply { StringToMethodCallParser(clazz).apply {

View File

@ -23,8 +23,8 @@ class ExchangeRateModelTest {
} }
} }
@Test @Test(timeout=300_000)
fun `perform fx testing`() { fun `perform fx testing`() {
val tenSwissies = Amount(10, BigDecimal.ONE, CHF) val tenSwissies = Amount(10, BigDecimal.ONE, CHF)
assertEquals(instance.exchangeAmount(tenSwissies, CHF), tenSwissies) assertEquals(instance.exchangeAmount(tenSwissies, CHF), tenSwissies)

View File

@ -20,8 +20,8 @@ class AggregatedListTest {
replayedList = ReplayedList(aggregatedList) replayedList = ReplayedList(aggregatedList)
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
assertEquals(replayedList.size, 0) assertEquals(replayedList.size, 0)
sourceList.add(9) sourceList.add(9)
@ -43,8 +43,8 @@ class AggregatedListTest {
} }
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
sourceList.addAll(0, 1, 2, 3, 4) sourceList.addAll(0, 1, 2, 3, 4)
assertEquals(replayedList.size, 3) assertEquals(replayedList.size, 3)
@ -82,8 +82,8 @@ class AggregatedListTest {
assertEquals(replayedList.size, 0) assertEquals(replayedList.size, 0)
} }
@Test @Test(timeout=300_000)
fun multipleElementsWithSameHashWorks() { fun multipleElementsWithSameHashWorks() {
sourceList.addAll(0, 0) sourceList.addAll(0, 0)
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
replayedList.forEach { replayedList.forEach {

View File

@ -20,8 +20,8 @@ class AssociatedListTest {
replayedMap = ReplayedMap(associatedList) replayedMap = ReplayedMap(associatedList)
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
assertEquals(replayedMap.size, 1) assertEquals(replayedMap.size, 1)
assertEquals(replayedMap[0], 0) assertEquals(replayedMap[0], 0)
@ -37,8 +37,8 @@ class AssociatedListTest {
assertEquals(replayedMap[1], 4) assertEquals(replayedMap[1], 4)
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
sourceList.addAll(2, 4) sourceList.addAll(2, 4)
assertEquals(replayedMap.size, 3) assertEquals(replayedMap.size, 3)
@ -57,8 +57,8 @@ class AssociatedListTest {
assertEquals(replayedMap.size, 0) assertEquals(replayedMap.size, 0)
} }
@Test @Test(timeout=300_000)
fun updateWorks() { fun updateWorks() {
sourceList.addAll(2, 4) sourceList.addAll(2, 4)
assertEquals(replayedMap.size, 3) assertEquals(replayedMap.size, 3)

View File

@ -42,8 +42,8 @@ class ConcatenatedListTest {
} }
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
concatenatedList.checkInvariants() concatenatedList.checkInvariants()
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
assertEquals(replayedList[0], "hello") assertEquals(replayedList[0], "hello")
@ -85,8 +85,8 @@ class ConcatenatedListTest {
assertEquals(replayedList[6], "b") assertEquals(replayedList[6], "b")
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
sourceList.add(FXCollections.observableArrayList("a", "b")) sourceList.add(FXCollections.observableArrayList("a", "b"))
sourceList.add(1, FXCollections.observableArrayList("c")) sourceList.add(1, FXCollections.observableArrayList("c"))
sourceList[0].addAll("d", "e") sourceList[0].addAll("d", "e")
@ -113,8 +113,8 @@ class ConcatenatedListTest {
assertEquals(replayedList[0], "b") assertEquals(replayedList[0], "b")
} }
@Test @Test(timeout=300_000)
fun permutationWorks() { fun permutationWorks() {
sourceList.addAll(FXCollections.observableArrayList("a", "b"), FXCollections.observableArrayList("c")) sourceList.addAll(FXCollections.observableArrayList("a", "b"), FXCollections.observableArrayList("c"))
concatenatedList.checkInvariants() concatenatedList.checkInvariants()
assertEquals(replayedList.size, 4) assertEquals(replayedList.size, 4)

View File

@ -21,8 +21,8 @@ class FlattenedListTest {
replayedList = ReplayedList(flattenedList) replayedList = ReplayedList(flattenedList)
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
assertEquals(replayedList[0], 1234) assertEquals(replayedList[0], 1234)
@ -54,8 +54,8 @@ class FlattenedListTest {
assertEquals(replayedList[5], 34) assertEquals(replayedList[5], 34)
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
val firstRemoved = sourceList.removeAt(0) val firstRemoved = sourceList.removeAt(0)
assertEquals(firstRemoved.get(), 1234) assertEquals(firstRemoved.get(), 1234)
assertEquals(replayedList.size, 0) assertEquals(replayedList.size, 0)
@ -76,8 +76,8 @@ class FlattenedListTest {
assertEquals(replayedList.size, 0) assertEquals(replayedList.size, 0)
} }
@Test @Test(timeout=300_000)
fun updatingObservableWorks() { fun updatingObservableWorks() {
assertEquals(replayedList[0], 1234) assertEquals(replayedList[0], 1234)
sourceList[0].set(4321) sourceList[0].set(4321)
assertEquals(replayedList[0], 4321) assertEquals(replayedList[0], 4321)
@ -92,8 +92,8 @@ class FlattenedListTest {
assertEquals(replayedList[1], 8765) assertEquals(replayedList[1], 8765)
} }
@Test @Test(timeout=300_000)
fun reusingObservableWorks() { fun reusingObservableWorks() {
val observable = SimpleObjectProperty(12) val observable = SimpleObjectProperty(12)
sourceList.add(observable) sourceList.add(observable)
sourceList.add(observable) sourceList.add(observable)

View File

@ -26,8 +26,8 @@ class LeftOuterJoinedMapTest {
} }
// TODO perhaps these are too brittle because they test indices that are not stable. Use Expect dsl? // TODO perhaps these are too brittle because they test indices that are not stable. Use Expect dsl?
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
assertEquals(replayedList[0].first.name, "Alice") assertEquals(replayedList[0].first.name, "Alice")
assertEquals(replayedList[0].second.size, 0) assertEquals(replayedList[0].second.size, 0)
@ -73,8 +73,8 @@ class LeftOuterJoinedMapTest {
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
dogs.add(Dog("Scooby", owner = "Alice")) dogs.add(Dog("Scooby", owner = "Alice"))
people.add(Person("Bob", 34)) people.add(Person("Bob", 34))
dogs.add(Dog("Bella", owner = "Bob")) dogs.add(Dog("Bella", owner = "Bob"))

View File

@ -19,8 +19,8 @@ class MappedListTest {
replayedList = ReplayedList(mappedList) replayedList = ReplayedList(mappedList)
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
assertEquals(replayedList[0], 5) assertEquals(replayedList[0], 5)
@ -36,8 +36,8 @@ class MappedListTest {
assertEquals(replayedList[2], 3) assertEquals(replayedList[2], 3)
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
sourceList.add("Bob") sourceList.add("Bob")
sourceList.add(0, "Charlie") sourceList.add(0, "Charlie")
assertEquals(replayedList.size, 3) assertEquals(replayedList.size, 3)
@ -48,8 +48,8 @@ class MappedListTest {
assertEquals(replayedList[1], 3) assertEquals(replayedList[1], 3)
} }
@Test @Test(timeout=300_000)
fun permuteWorks() { fun permuteWorks() {
sourceList.add("Bob") sourceList.add("Bob")
sourceList.add(0, "Charlie") sourceList.add(0, "Charlie")

View File

@ -17,8 +17,8 @@ class ReplayedListTest {
replayedList = ReplayedList(sourceList) replayedList = ReplayedList(sourceList)
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
assertEquals(replayedList[0], 1234) assertEquals(replayedList[0], 1234)
@ -50,8 +50,8 @@ class ReplayedListTest {
assertEquals(replayedList[5], 34) assertEquals(replayedList[5], 34)
} }
@Test @Test(timeout=300_000)
fun removeWorks() { fun removeWorks() {
val firstRemoved = sourceList.removeAt(0) val firstRemoved = sourceList.removeAt(0)
assertEquals(firstRemoved, 1234) assertEquals(firstRemoved, 1234)
assertEquals(replayedList.size, 0) assertEquals(replayedList.size, 0)
@ -70,8 +70,8 @@ class ReplayedListTest {
assertEquals(replayedList.size, 0) assertEquals(replayedList.size, 0)
} }
@Test @Test(timeout=300_000)
fun updateWorks() { fun updateWorks() {
assertEquals(replayedList[0], 1234) assertEquals(replayedList[0], 1234)
sourceList[0] = 4321 sourceList[0] = 4321
assertEquals(replayedList[0], 4321) assertEquals(replayedList[0], 4321)

View File

@ -28,8 +28,8 @@ class BlacklistKotlinClosureTest {
@CordaSerializable @CordaSerializable
data class Packet(val x: () -> Long) data class Packet(val x: () -> Long)
@Test @Test(timeout=300_000)
fun `closure sent via RPC`() { fun `closure sent via RPC`() {
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList(), cordappsForAllNodes = listOf(enclosedCordapp()))) { driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList(), cordappsForAllNodes = listOf(enclosedCordapp()))) {
val rpc = startNode(providedName = ALICE_NAME).getOrThrow().rpc val rpc = startNode(providedName = ALICE_NAME).getOrThrow().rpc
val packet = Packet { EVIL } val packet = Packet { EVIL }

View File

@ -73,27 +73,27 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
connection?.close() connection?.close()
} }
@Test @Test(timeout=300_000)
fun `log in with valid username and password`() { fun `log in with valid username and password`() {
login(rpcUser.username, rpcUser.password) login(rpcUser.username, rpcUser.password)
} }
@Test @Test(timeout=300_000)
fun `log in with unknown user`() { fun `log in with unknown user`() {
assertThatExceptionOfType(ActiveMQSecurityException::class.java).isThrownBy { assertThatExceptionOfType(ActiveMQSecurityException::class.java).isThrownBy {
login(random63BitValue().toString(), rpcUser.password) login(random63BitValue().toString(), rpcUser.password)
} }
} }
@Test @Test(timeout=300_000)
fun `log in with incorrect password`() { fun `log in with incorrect password`() {
assertThatExceptionOfType(ActiveMQSecurityException::class.java).isThrownBy { assertThatExceptionOfType(ActiveMQSecurityException::class.java).isThrownBy {
login(rpcUser.username, random63BitValue().toString()) login(rpcUser.username, random63BitValue().toString())
} }
} }
@Test @Test(timeout=300_000)
fun `shutdown command stops the node`() { fun `shutdown command stops the node`() {
val nodeIsShut: PublishSubject<Unit> = PublishSubject.create() val nodeIsShut: PublishSubject<Unit> = PublishSubject.create()
val latch = CountDownLatch(1) val latch = CountDownLatch(1)
var successful = false var successful = false
@ -149,8 +149,8 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
} }
} }
@Test @Test(timeout=300_000)
fun `close-send deadlock and premature shutdown on empty observable`() { fun `close-send deadlock and premature shutdown on empty observable`() {
println("Starting client") println("Starting client")
login(rpcUser.username, rpcUser.password) login(rpcUser.username, rpcUser.password)
println("Creating proxy") println("Creating proxy")
@ -165,16 +165,16 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
println("Result: ${flowHandle.returnValue.getOrThrow()}") println("Result: ${flowHandle.returnValue.getOrThrow()}")
} }
@Test @Test(timeout=300_000)
fun `check basic flow has no progress`() { fun `check basic flow has no progress`() {
login(rpcUser.username, rpcUser.password) login(rpcUser.username, rpcUser.password)
connection!!.proxy.startFlow(::CashPaymentFlow, 100.DOLLARS, identity).use { connection!!.proxy.startFlow(::CashPaymentFlow, 100.DOLLARS, identity).use {
assertFalse(it is FlowProgressHandle<*>) assertFalse(it is FlowProgressHandle<*>)
} }
} }
@Test @Test(timeout=300_000)
fun `get cash balances`() { fun `get cash balances`() {
login(rpcUser.username, rpcUser.password) login(rpcUser.username, rpcUser.password)
val proxy = connection!!.proxy val proxy = connection!!.proxy
val startCash = proxy.getCashBalances() val startCash = proxy.getCashBalances()
@ -191,8 +191,8 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
assertEquals(123.DOLLARS, cashDollars) assertEquals(123.DOLLARS, cashDollars)
} }
@Test @Test(timeout=300_000)
fun `flow initiator via RPC`() { fun `flow initiator via RPC`() {
val externalTrace = Trace.newInstance() val externalTrace = Trace.newInstance()
val impersonatedActor = Actor(Actor.Id("Mark Dadada"), AuthServiceId("Test"), owningLegalIdentity = BOB_NAME) val impersonatedActor = Actor(Actor.Id("Mark Dadada"), AuthServiceId("Test"), owningLegalIdentity = BOB_NAME)
login(rpcUser.username, rpcUser.password, externalTrace, impersonatedActor) login(rpcUser.username, rpcUser.password, externalTrace, impersonatedActor)
@ -230,8 +230,8 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
// We run the client in a separate process, without the finance module on its system classpath to ensure that the // We run the client in a separate process, without the finance module on its system classpath to ensure that the
// additional class loader that we give it is used. Cash.State objects are used as they can't be synthesised fully // additional class loader that we give it is used. Cash.State objects are used as they can't be synthesised fully
// by the carpenter, and thus avoiding any false-positive results. // by the carpenter, and thus avoiding any false-positive results.
@Test @Test(timeout=300_000)
fun `additional class loader used by WireTransaction when it deserialises its components`() { fun `additional class loader used by WireTransaction when it deserialises its components`() {
val financeLocation = Cash::class.java.location.toPath().toString() val financeLocation = Cash::class.java.location.toPath().toString()
val classPathWithoutFinance = ProcessUtilities.defaultClassPath.filter { financeLocation !in it } val classPathWithoutFinance = ProcessUtilities.defaultClassPath.filter { financeLocation !in it }

View File

@ -27,8 +27,8 @@ class FlowsExecutionModeTests : NodeBasedTest(emptyList()) {
client = CordaRPCClient(node.node.configuration.rpcOptions.address) client = CordaRPCClient(node.node.configuration.rpcOptions.address)
} }
@Test @Test(timeout=300_000)
fun `flows draining mode can be enabled and queried`() { fun `flows draining mode can be enabled and queried`() {
asALoggerUser { rpcOps -> asALoggerUser { rpcOps ->
val newValue = true val newValue = true
rpcOps.setFlowsDrainingModeEnabled(true) rpcOps.setFlowsDrainingModeEnabled(true)
@ -39,8 +39,8 @@ class FlowsExecutionModeTests : NodeBasedTest(emptyList()) {
} }
} }
@Test @Test(timeout=300_000)
fun `flows draining mode can be disabled and queried`() { fun `flows draining mode can be disabled and queried`() {
asALoggerUser { rpcOps -> asALoggerUser { rpcOps ->
rpcOps.setFlowsDrainingModeEnabled(true) rpcOps.setFlowsDrainingModeEnabled(true)
val newValue = false val newValue = false
@ -52,8 +52,8 @@ class FlowsExecutionModeTests : NodeBasedTest(emptyList()) {
} }
} }
@Test @Test(timeout=300_000)
fun `node starts with flows draining mode disabled`() { fun `node starts with flows draining mode disabled`() {
asALoggerUser { rpcOps -> asALoggerUser { rpcOps ->
val defaultStartingMode = rpcOps.isFlowsDrainingModeEnabled() val defaultStartingMode = rpcOps.isFlowsDrainingModeEnabled()

View File

@ -64,8 +64,8 @@ class RPCMultipleInterfacesTests {
interface ImaginaryFriend : RPCOps interface ImaginaryFriend : RPCOps
@Test @Test(timeout=300_000)
fun `can talk multiple interfaces`() { fun `can talk multiple interfaces`() {
rpcDriver { rpcDriver {
val server = startRpcServer(listOps = listOf(IntRPCOpsImpl(), StringRPCOpsImpl, MyCordaRpcOpsImpl)).get() val server = startRpcServer(listOps = listOf(IntRPCOpsImpl(), StringRPCOpsImpl, MyCordaRpcOpsImpl)).get()

View File

@ -83,8 +83,8 @@ class RPCStabilityTests {
}.get() }.get()
} }
@Test @Test(timeout=300_000)
fun `client and server dont leak threads`() { fun `client and server dont leak threads`() {
fun startAndStop() { fun startAndStop() {
rpcDriver { rpcDriver {
val server = startRpcServer<RPCOps>(ops = DummyOps).get() val server = startRpcServer<RPCOps>(ops = DummyOps).get()
@ -115,8 +115,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `client doesnt leak threads when it fails to start`() { fun `client doesnt leak threads when it fails to start`() {
fun startAndStop() { fun startAndStop() {
rpcDriver { rpcDriver {
Try.on { startRpcClient<RPCOps>(NetworkHostAndPort("localhost", 9999)).get() } Try.on { startRpcClient<RPCOps>(NetworkHostAndPort("localhost", 9999)).get() }
@ -142,8 +142,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `rpc server close doesnt leak broker resources`() { fun `rpc server close doesnt leak broker resources`() {
rpcDriver { rpcDriver {
fun startAndCloseServer(broker: RpcBrokerHandle) { fun startAndCloseServer(broker: RpcBrokerHandle) {
startRpcServerWithBrokerRunning( startRpcServerWithBrokerRunning(
@ -165,8 +165,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `rpc client close doesnt leak broker resources`() { fun `rpc client close doesnt leak broker resources`() {
rpcDriver { rpcDriver {
val server = startRpcServer(configuration = RPCServerConfiguration.DEFAULT, ops = DummyOps).get() val server = startRpcServer(configuration = RPCServerConfiguration.DEFAULT, ops = DummyOps).get()
RPCClient<RPCOps>(server.broker.hostAndPort!!).start(RPCOps::class.java, rpcTestUser.username, rpcTestUser.password).close() RPCClient<RPCOps>(server.broker.hostAndPort!!).start(RPCOps::class.java, rpcTestUser.username, rpcTestUser.password).close()
@ -181,8 +181,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `rpc server close is idempotent`() { fun `rpc server close is idempotent`() {
rpcDriver { rpcDriver {
val server = startRpcServer(ops = DummyOps).get() val server = startRpcServer(ops = DummyOps).get()
repeat(10) { repeat(10) {
@ -191,8 +191,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `rpc client close is idempotent`() { fun `rpc client close is idempotent`() {
rpcDriver { rpcDriver {
val serverShutdown = shutdownManager.follower() val serverShutdown = shutdownManager.follower()
val server = startRpcServer(ops = DummyOps).get() val server = startRpcServer(ops = DummyOps).get()
@ -215,8 +215,8 @@ class RPCStabilityTests {
fun leakObservable(): Observable<Nothing> fun leakObservable(): Observable<Nothing>
} }
@Test @Test(timeout=300_000)
fun `client cleans up leaked observables`() { fun `client cleans up leaked observables`() {
rpcDriver { rpcDriver {
val leakObservableOpsImpl = object : LeakObservableOps { val leakObservableOpsImpl = object : LeakObservableOps {
val leakedUnsubscribedCount = AtomicInteger(0) val leakedUnsubscribedCount = AtomicInteger(0)
@ -247,8 +247,8 @@ class RPCStabilityTests {
fun ping(): String fun ping(): String
} }
@Test @Test(timeout=300_000)
fun `client reconnects to rebooted server`() { fun `client reconnects to rebooted server`() {
rpcDriver { rpcDriver {
val ops = object : ReconnectOps { val ops = object : ReconnectOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -274,8 +274,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `connection failover fails, rpc calls throw`() { fun `connection failover fails, rpc calls throw`() {
rpcDriver { rpcDriver {
val ops = object : ReconnectOps { val ops = object : ReconnectOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -301,8 +301,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `connection exits when bad config means the exception is unrecoverable`() { fun `connection exits when bad config means the exception is unrecoverable`() {
rpcDriver { rpcDriver {
val ops = object : ReconnectOps { val ops = object : ReconnectOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -330,8 +330,8 @@ class RPCStabilityTests {
fun subscribe(): Observable<Nothing> fun subscribe(): Observable<Nothing>
} }
@Test @Test(timeout=300_000)
fun `observables error when connection breaks`() { fun `observables error when connection breaks`() {
rpcDriver { rpcDriver {
val ops = object : NoOps { val ops = object : NoOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -371,8 +371,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `client throws RPCException after initial connection attempt fails`() { fun `client throws RPCException after initial connection attempt fails`() {
val client = CordaRPCClient(portAllocation.nextHostAndPort()) val client = CordaRPCClient(portAllocation.nextHostAndPort())
var exceptionMessage: String? = null var exceptionMessage: String? = null
try { try {
@ -390,8 +390,8 @@ class RPCStabilityTests {
fun serverId(): String fun serverId(): String
} }
@Test @Test(timeout=300_000)
fun `client connects to first available server`() { fun `client connects to first available server`() {
rpcDriver { rpcDriver {
val ops = object : ServerOps { val ops = object : ServerOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -411,8 +411,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `3 server failover`() { fun `3 server failover`() {
rpcDriver { rpcDriver {
val ops1 = object : ServerOps { val ops1 = object : ServerOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -483,8 +483,8 @@ class RPCStabilityTests {
/** /**
* In this test we create a number of out of process RPC clients that call [TrackSubscriberOps.subscribe] in a loop. * In this test we create a number of out of process RPC clients that call [TrackSubscriberOps.subscribe] in a loop.
*/ */
@Test @Test(timeout=300_000)
fun `server cleans up queues after disconnected clients`() { fun `server cleans up queues after disconnected clients`() {
rpcDriver { rpcDriver {
val trackSubscriberOpsImpl = object : TrackSubscriberOps { val trackSubscriberOpsImpl = object : TrackSubscriberOps {
override val protocolVersion = 1000 override val protocolVersion = 1000
@ -538,8 +538,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
@Ignore // TODO: This is ignored because Artemis slow consumers are broken. I'm not deleting it in case we can get the feature fixed. @Ignore // TODO: This is ignored because Artemis slow consumers are broken. I'm not deleting it in case we can get the feature fixed.
fun `slow consumers are kicked`() { fun `slow consumers are kicked`() {
rpcDriver { rpcDriver {
val server = startRpcServer(maxBufferedBytesPerClient = 10 * 1024 * 1024, ops = SlowConsumerRPCOpsImpl()).get() val server = startRpcServer(maxBufferedBytesPerClient = 10 * 1024 * 1024, ops = SlowConsumerRPCOpsImpl()).get()
@ -576,8 +576,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `deduplication in the server`() { fun `deduplication in the server`() {
rpcDriver { rpcDriver {
val server = startRpcServer(ops = SlowConsumerRPCOpsImpl()).getOrThrow() val server = startRpcServer(ops = SlowConsumerRPCOpsImpl()).getOrThrow()
@ -617,8 +617,8 @@ class RPCStabilityTests {
} }
} }
@Test @Test(timeout=300_000)
fun `deduplication in the client`() { fun `deduplication in the client`() {
rpcDriver { rpcDriver {
val broker = startRpcBroker().getOrThrow() val broker = startRpcBroker().getOrThrow()

View File

@ -28,8 +28,8 @@ import java.io.NotSerializableException
class RpcCustomSerializersTest { class RpcCustomSerializersTest {
@Test @Test(timeout=300_000)
fun `when custom serializers are not provided, the classpath is scanned to identify any existing ones`() { fun `when custom serializers are not provided, the classpath is scanned to identify any existing ones`() {
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = listOf(enclosedCordapp()))) { driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = listOf(enclosedCordapp()))) {
val server = startNode(providedName = ALICE_NAME).get() val server = startNode(providedName = ALICE_NAME).get()
@ -43,8 +43,8 @@ class RpcCustomSerializersTest {
} }
} }
@Test @Test(timeout=300_000)
fun `when an empty set of custom serializers is provided, no scanning is performed and this empty set is used instead`() { fun `when an empty set of custom serializers is provided, no scanning is performed and this empty set is used instead`() {
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = listOf(enclosedCordapp()))) { driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = listOf(enclosedCordapp()))) {
val server = startNode(providedName = ALICE_NAME).get() val server = startNode(providedName = ALICE_NAME).get()
@ -57,8 +57,8 @@ class RpcCustomSerializersTest {
} }
} }
@Test @Test(timeout=300_000)
fun `when a set of custom serializers is explicitly provided, these are used instead of scanning the classpath`() { fun `when a set of custom serializers is explicitly provided, these are used instead of scanning the classpath`() {
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptyList())) { driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptyList())) {
val server = startNode(providedName = ALICE_NAME).get() val server = startNode(providedName = ALICE_NAME).get()

View File

@ -48,7 +48,7 @@ class CordaRPCClientReconnectionTest {
val rpcUser = User("user1", "test", permissions = setOf(Permissions.all())) val rpcUser = User("user1", "test", permissions = setOf(Permissions.all()))
} }
@Test @Test(timeout=300_000)
fun `rpc client calls and returned observables continue working when the server crashes and restarts`() { fun `rpc client calls and returned observables continue working when the server crashes and restarts`() {
driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) { driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) {
val latch = CountDownLatch(2) val latch = CountDownLatch(2)
@ -86,7 +86,7 @@ class CordaRPCClientReconnectionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `a client can successfully unsubscribe a reconnecting observable`() { fun `a client can successfully unsubscribe a reconnecting observable`() {
driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) { driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) {
val latch = CountDownLatch(2) val latch = CountDownLatch(2)
@ -124,7 +124,7 @@ class CordaRPCClientReconnectionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `rpc client calls and returned observables continue working when there is failover between servers`() { fun `rpc client calls and returned observables continue working when there is failover between servers`() {
driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) { driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) {
val latch = CountDownLatch(2) val latch = CountDownLatch(2)
@ -163,7 +163,7 @@ class CordaRPCClientReconnectionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `an RPC call fails, when the maximum number of attempts is exceeded`() { fun `an RPC call fails, when the maximum number of attempts is exceeded`() {
driver(DriverParameters(cordappsForAllNodes = emptyList())) { driver(DriverParameters(cordappsForAllNodes = emptyList())) {
val address = NetworkHostAndPort("localhost", portAllocator.nextPort()) val address = NetworkHostAndPort("localhost", portAllocator.nextPort())
@ -191,7 +191,7 @@ class CordaRPCClientReconnectionTest {
} }
} }
@Test(timeout = 60_000) @Test(timeout=300_000)
fun `establishing an RPC connection fails if there is no node listening to the specified address`() { fun `establishing an RPC connection fails if there is no node listening to the specified address`() {
rpcDriver { rpcDriver {
assertThatThrownBy { assertThatThrownBy {
@ -202,7 +202,7 @@ class CordaRPCClientReconnectionTest {
} }
} }
@Test(timeout = 120_000) @Test(timeout=300_000)
fun `RPC connection can be shut down after being disconnected from the node`() { fun `RPC connection can be shut down after being disconnected from the node`() {
driver(DriverParameters(cordappsForAllNodes = emptyList())) { driver(DriverParameters(cordappsForAllNodes = emptyList())) {
val address = NetworkHostAndPort("localhost", portAllocator.nextPort()) val address = NetworkHostAndPort("localhost", portAllocator.nextPort())
@ -232,7 +232,7 @@ class CordaRPCClientReconnectionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `RPC connection stops reconnecting after config number of retries`() { fun `RPC connection stops reconnecting after config number of retries`() {
driver(DriverParameters(cordappsForAllNodes = emptyList())) { driver(DriverParameters(cordappsForAllNodes = emptyList())) {
val address = NetworkHostAndPort("localhost", portAllocator.nextPort()) val address = NetworkHostAndPort("localhost", portAllocator.nextPort())

View File

@ -92,8 +92,8 @@ class StandaloneCordaRPClientTest {
} }
@Test @Test(timeout=300_000)
fun `test attachments`() { fun `test attachments`() {
val attachment = InputStreamAndHash.createInMemoryTestZip(attachmentSize, 1) val attachment = InputStreamAndHash.createInMemoryTestZip(attachmentSize, 1)
assertFalse(rpcProxy.attachmentExists(attachment.sha256)) assertFalse(rpcProxy.attachmentExists(attachment.sha256))
val id = attachment.inputStream.use { rpcProxy.uploadAttachment(it) } val id = attachment.inputStream.use { rpcProxy.uploadAttachment(it) }
@ -107,8 +107,8 @@ class StandaloneCordaRPClientTest {
} }
@Ignore("CORDA-1520 - After switching from Kryo to AMQP this test won't work") @Ignore("CORDA-1520 - After switching from Kryo to AMQP this test won't work")
@Test @Test(timeout=300_000)
fun `test wrapped attachments`() { fun `test wrapped attachments`() {
val attachment = InputStreamAndHash.createInMemoryTestZip(attachmentSize, 1) val attachment = InputStreamAndHash.createInMemoryTestZip(attachmentSize, 1)
assertFalse(rpcProxy.attachmentExists(attachment.sha256)) assertFalse(rpcProxy.attachmentExists(attachment.sha256))
val id = WrapperStream(attachment.inputStream).use { rpcProxy.uploadAttachment(it) } val id = WrapperStream(attachment.inputStream).use { rpcProxy.uploadAttachment(it) }
@ -121,14 +121,14 @@ class StandaloneCordaRPClientTest {
assertEquals(attachment.sha256, hash) assertEquals(attachment.sha256, hash)
} }
@Test @Test(timeout=300_000)
fun `test starting flow`() { fun `test starting flow`() {
rpcProxy.startFlow(::CashIssueFlow, 127.POUNDS, OpaqueBytes.of(0), notaryNodeIdentity) rpcProxy.startFlow(::CashIssueFlow, 127.POUNDS, OpaqueBytes.of(0), notaryNodeIdentity)
.returnValue.getOrThrow(timeout) .returnValue.getOrThrow(timeout)
} }
@Test @Test(timeout=300_000)
fun `test starting tracked flow`() { fun `test starting tracked flow`() {
var trackCount = 0 var trackCount = 0
val handle = rpcProxy.startTrackedFlow( val handle = rpcProxy.startTrackedFlow(
::CashIssueFlow, 429.DOLLARS, OpaqueBytes.of(0), notaryNodeIdentity ::CashIssueFlow, 429.DOLLARS, OpaqueBytes.of(0), notaryNodeIdentity
@ -144,13 +144,13 @@ class StandaloneCordaRPClientTest {
assertNotEquals(0, trackCount) assertNotEquals(0, trackCount)
} }
@Test @Test(timeout=300_000)
fun `test network map`() { fun `test network map`() {
assertEquals(notaryConfig.legalName, notaryNodeIdentity.name) assertEquals(notaryConfig.legalName, notaryNodeIdentity.name)
} }
@Test @Test(timeout=300_000)
fun `test state machines`() { fun `test state machines`() {
val (stateMachines, updates) = rpcProxy.stateMachinesFeed() val (stateMachines, updates) = rpcProxy.stateMachinesFeed()
assertEquals(0, stateMachines.size) assertEquals(0, stateMachines.size)
@ -171,8 +171,8 @@ class StandaloneCordaRPClientTest {
assertEquals(1, updateCount.get()) assertEquals(1, updateCount.get())
} }
@Test @Test(timeout=300_000)
fun `test vault track by`() { fun `test vault track by`() {
val (vault, vaultUpdates) = rpcProxy.vaultTrackBy<Cash.State>(paging = PageSpecification(DEFAULT_PAGE_NUM)) val (vault, vaultUpdates) = rpcProxy.vaultTrackBy<Cash.State>(paging = PageSpecification(DEFAULT_PAGE_NUM))
assertEquals(0, vault.totalStatesAvailable) assertEquals(0, vault.totalStatesAvailable)
@ -194,8 +194,8 @@ class StandaloneCordaRPClientTest {
assertEquals(629.POUNDS, cashBalance[Currency.getInstance("GBP")]) assertEquals(629.POUNDS, cashBalance[Currency.getInstance("GBP")])
} }
@Test @Test(timeout=300_000)
fun `test vault query by`() { fun `test vault query by`() {
// Now issue some cash // Now issue some cash
rpcProxy.startFlow(::CashIssueFlow, 629.POUNDS, OpaqueBytes.of(0), notaryNodeIdentity) rpcProxy.startFlow(::CashIssueFlow, 629.POUNDS, OpaqueBytes.of(0), notaryNodeIdentity)
.returnValue.getOrThrow(timeout) .returnValue.getOrThrow(timeout)
@ -220,8 +220,8 @@ class StandaloneCordaRPClientTest {
assertEquals(629.POUNDS, cashBalances[Currency.getInstance("GBP")]) assertEquals(629.POUNDS, cashBalances[Currency.getInstance("GBP")])
} }
@Test @Test(timeout=300_000)
fun `test cash balances`() { fun `test cash balances`() {
val startCash = rpcProxy.getCashBalances() val startCash = rpcProxy.getCashBalances()
println(startCash) println(startCash)
assertTrue(startCash.isEmpty(), "Should not start with any cash") assertTrue(startCash.isEmpty(), "Should not start with any cash")
@ -235,8 +235,8 @@ class StandaloneCordaRPClientTest {
assertEquals(629.DOLLARS, balance) assertEquals(629.DOLLARS, balance)
} }
@Test @Test(timeout=300_000)
fun `test kill flow without killFlow permission`() { fun `test kill flow without killFlow permission`() {
exception.expect(PermissionException::class.java) exception.expect(PermissionException::class.java)
exception.expectMessage("User not authorized to perform RPC call killFlow") exception.expectMessage("User not authorized to perform RPC call killFlow")
@ -247,8 +247,8 @@ class StandaloneCordaRPClientTest {
} }
} }
@Test @Test(timeout=300_000)
fun `test kill flow with killFlow permission`() { fun `test kill flow with killFlow permission`() {
val flowHandle = rpcProxy.startFlow(::CashIssueFlow, 83.DOLLARS, OpaqueBytes.of(0), notaryNodeIdentity) val flowHandle = rpcProxy.startFlow(::CashIssueFlow, 83.DOLLARS, OpaqueBytes.of(0), notaryNodeIdentity)
notary.connect(rpcUser).use { connection -> notary.connect(rpcUser).use { connection ->
val rpcProxy = connection.proxy val rpcProxy = connection.proxy

View File

@ -72,8 +72,8 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
override fun captureUser(): String = rpcContext().invocation.principal().name override fun captureUser(): String = rpcContext().invocation.principal().name
} }
@Test @Test(timeout=300_000)
fun `simple RPCs`() { fun `simple RPCs`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
// Does nothing, doesn't throw. // Does nothing, doesn't throw.
@ -88,8 +88,8 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `simple observable`() { fun `simple observable`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
// This tests that the observations are transmitted correctly, also completion is transmitted. // This tests that the observations are transmitted correctly, also completion is transmitted.
@ -98,8 +98,8 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `complex observables`() { fun `complex observables`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
// This checks that we can return an object graph with complex usage of observables, like an observable // This checks that we can return an object graph with complex usage of observables, like an observable
@ -143,8 +143,8 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `simple ListenableFuture`() { fun `simple ListenableFuture`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
val value = proxy.makeListenableFuture().getOrThrow() val value = proxy.makeListenableFuture().getOrThrow()
@ -152,8 +152,8 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `complex ListenableFuture`() { fun `complex ListenableFuture`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
val serverQuote = openFuture<Pair<String, CordaFuture<String>>>() val serverQuote = openFuture<Pair<String, CordaFuture<String>>>()
@ -180,16 +180,16 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun versioning() { fun versioning() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
assertFailsWith<UnsupportedOperationException> { proxy.addedLater() } assertFailsWith<UnsupportedOperationException> { proxy.addedLater() }
} }
} }
@Test @Test(timeout=300_000)
fun `authenticated user is available to RPC`() { fun `authenticated user is available to RPC`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
assertThat(proxy.captureUser()).isEqualTo(rpcTestUser.username) assertThat(proxy.captureUser()).isEqualTo(rpcTestUser.username)

View File

@ -104,8 +104,8 @@ class RPCConcurrencyTests : AbstractRPCTest() {
pool.shutdown() pool.shutdown()
} }
@Test @Test(timeout=300_000)
fun `call multiple RPCs in parallel`() { fun `call multiple RPCs in parallel`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
val numberOfBlockedCalls = 2 val numberOfBlockedCalls = 2
@ -140,8 +140,8 @@ class RPCConcurrencyTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `nested immediate observables sequence correctly`() { fun `nested immediate observables sequence correctly`() {
rpcDriver { rpcDriver {
// We construct a rose tree of immediate Observables and check that parent observations arrive before children. // We construct a rose tree of immediate Observables and check that parent observations arrive before children.
val proxy = testProxy() val proxy = testProxy()
@ -164,8 +164,8 @@ class RPCConcurrencyTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `parallel nested observables`() { fun `parallel nested observables`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
val treeDepth = 2 val treeDepth = 2

View File

@ -46,28 +46,28 @@ class RPCFailureTests {
proc(startRpcClient<Ops>(server.broker.hostAndPort!!).getOrThrow()) proc(startRpcClient<Ops>(server.broker.hostAndPort!!).getOrThrow())
} }
@Test @Test(timeout=300_000)
fun `kotlin NPE`() = rpc { fun `kotlin NPE`() = rpc {
assertThatThrownBy { it.kotlinNPE() }.isInstanceOf(CordaRuntimeException::class.java) assertThatThrownBy { it.kotlinNPE() }.isInstanceOf(CordaRuntimeException::class.java)
.hasMessageContaining("kotlin.KotlinNullPointerException") .hasMessageContaining("kotlin.KotlinNullPointerException")
} }
@Test @Test(timeout=300_000)
fun `kotlin NPE async`() = rpc { fun `kotlin NPE async`() = rpc {
val future = it.kotlinNPEAsync() val future = it.kotlinNPEAsync()
assertThatThrownBy { future.getOrThrow() }.isInstanceOf(CordaRuntimeException::class.java) assertThatThrownBy { future.getOrThrow() }.isInstanceOf(CordaRuntimeException::class.java)
.hasMessageContaining("kotlin.KotlinNullPointerException") .hasMessageContaining("kotlin.KotlinNullPointerException")
} }
@Test @Test(timeout=300_000)
fun unserializable() = rpc { fun unserializable() = rpc {
assertThatThrownBy { it.getUnserializable() }.isInstanceOf(CordaRuntimeException::class.java) assertThatThrownBy { it.getUnserializable() }.isInstanceOf(CordaRuntimeException::class.java)
.hasMessageContaining("java.io.NotSerializableException:") .hasMessageContaining("java.io.NotSerializableException:")
.hasMessageContaining("Unserializable\" is not on the whitelist or annotated with @CordaSerializable.") .hasMessageContaining("Unserializable\" is not on the whitelist or annotated with @CordaSerializable.")
} }
@Test @Test(timeout=300_000)
fun `unserializable async`() = rpc { fun `unserializable async`() = rpc {
val future = it.getUnserializableAsync() val future = it.getUnserializableAsync()
assertThatThrownBy { future.getOrThrow() }.isInstanceOf(CordaRuntimeException::class.java) assertThatThrownBy { future.getOrThrow() }.isInstanceOf(CordaRuntimeException::class.java)
.hasMessageContaining("java.io.NotSerializableException:") .hasMessageContaining("java.io.NotSerializableException:")

View File

@ -29,8 +29,8 @@ class RPCHighThroughputObservableTests : AbstractRPCTest() {
override fun makeObservable(): Observable<Int> = Observable.interval(0, TimeUnit.MICROSECONDS).map { it.toInt() + 1 } override fun makeObservable(): Observable<Int> = Observable.interval(0, TimeUnit.MICROSECONDS).map { it.toInt() + 1 }
} }
@Test @Test(timeout=300_000)
fun `simple observable`() { fun `simple observable`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
// This tests that the observations are transmitted correctly, also check that server side doesn't try to serialize the whole lot // This tests that the observations are transmitted correctly, also check that server side doesn't try to serialize the whole lot

View File

@ -76,8 +76,8 @@ class RPCPerformanceTests : AbstractRPCTest() {
val Mbps: Double val Mbps: Double
) )
@Test @Test(timeout=300_000)
fun `measure Megabytes per second for simple RPCs`() { fun `measure Megabytes per second for simple RPCs`() {
warmup() warmup()
val inputOutputSizes = listOf(1024, 4096, 100 * 1024) val inputOutputSizes = listOf(1024, 4096, 100 * 1024)
val overallTraffic = 512 * 1024 * 1024L val overallTraffic = 512 * 1024 * 1024L
@ -118,8 +118,8 @@ class RPCPerformanceTests : AbstractRPCTest() {
/** /**
* Runs 20k RPCs per second for two minutes and publishes relevant stats to JMX. * Runs 20k RPCs per second for two minutes and publishes relevant stats to JMX.
*/ */
@Test @Test(timeout=300_000)
fun `consumption rate`() { fun `consumption rate`() {
rpcDriver { rpcDriver {
val metricRegistry = startReporter(shutdownManager) val metricRegistry = startReporter(shutdownManager)
val proxy = testProxy( val proxy = testProxy(
@ -148,8 +148,8 @@ class RPCPerformanceTests : AbstractRPCTest() {
val Mbps: Double val Mbps: Double
) )
@Test @Test(timeout=300_000)
fun `big messages`() { fun `big messages`() {
warmup() warmup()
measure(listOf(1)) { clientParallelism -> measure(listOf(1)) { clientParallelism ->
// TODO this hangs with more parallelism // TODO this hangs with more parallelism

View File

@ -46,8 +46,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
private fun userOf(name: String, permissions: Set<String>) = User(name, "password", permissions) private fun userOf(name: String, permissions: Set<String>) = User(name, "password", permissions)
@Test @Test(timeout=300_000)
fun `empty user cannot use any flows`() { fun `empty user cannot use any flows`() {
rpcDriver { rpcDriver {
val emptyUser = userOf("empty", emptySet()) val emptyUser = userOf("empty", emptySet())
val proxy = testProxyFor(emptyUser) val proxy = testProxyFor(emptyUser)
@ -57,8 +57,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `admin user can use any flow`() { fun `admin user can use any flow`() {
rpcDriver { rpcDriver {
val adminUser = userOf("admin", setOf(ALL_ALLOWED)) val adminUser = userOf("admin", setOf(ALL_ALLOWED))
val proxy = testProxyFor(adminUser) val proxy = testProxyFor(adminUser)
@ -67,8 +67,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `joe user is allowed to use DummyFlow`() { fun `joe user is allowed to use DummyFlow`() {
rpcDriver { rpcDriver {
val joeUser = userOf("joe", setOf(DUMMY_FLOW)) val joeUser = userOf("joe", setOf(DUMMY_FLOW))
val proxy = testProxyFor(joeUser) val proxy = testProxyFor(joeUser)
@ -77,8 +77,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `joe user is not allowed to use OtherFlow`() { fun `joe user is not allowed to use OtherFlow`() {
rpcDriver { rpcDriver {
val joeUser = userOf("joe", setOf(DUMMY_FLOW)) val joeUser = userOf("joe", setOf(DUMMY_FLOW))
val proxy = testProxyFor(joeUser) val proxy = testProxyFor(joeUser)
@ -91,8 +91,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `joe user is not allowed to call other RPC methods`() { fun `joe user is not allowed to call other RPC methods`() {
rpcDriver { rpcDriver {
val joeUser = userOf("joe", setOf(DUMMY_FLOW)) val joeUser = userOf("joe", setOf(DUMMY_FLOW))
val proxy = testProxyFor(joeUser) val proxy = testProxyFor(joeUser)
@ -105,8 +105,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `joe user can call different methods matching to a wildcard`() { fun `joe user can call different methods matching to a wildcard`() {
rpcDriver { rpcDriver {
val joeUser = userOf("joe", setOf(WILDCARD_FLOW)) val joeUser = userOf("joe", setOf(WILDCARD_FLOW))
val proxy = testProxyFor(joeUser) val proxy = testProxyFor(joeUser)
@ -128,8 +128,8 @@ class RPCPermissionsTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `checking invokeRpc permissions entitlements`() { fun `checking invokeRpc permissions entitlements`() {
rpcDriver { rpcDriver {
val joeUser = userOf("joe", setOf("InvokeRpc.networkMapFeed")) val joeUser = userOf("joe", setOf("InvokeRpc.networkMapFeed"))
val proxy = testProxyFor(joeUser) val proxy = testProxyFor(joeUser)

View File

@ -8,8 +8,8 @@ import java.util.concurrent.atomic.AtomicLong
class PropertyTest { class PropertyTest {
@Test @Test(timeout=300_000)
fun present_value_with_correct_type() { fun present_value_with_correct_type() {
val key = "a.b.c" val key = "a.b.c"
val value = 1L val value = 1L
@ -25,8 +25,8 @@ class PropertyTest {
assertThat(configuration[property]).isEqualTo(value) assertThat(configuration[property]).isEqualTo(value)
} }
@Test @Test(timeout=300_000)
fun present_value_with_wrong_type() { fun present_value_with_wrong_type() {
val key = "a.b.c" val key = "a.b.c"
val value = 1 val value = 1
@ -41,8 +41,8 @@ class PropertyTest {
assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.WrongType::class.java) assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.WrongType::class.java)
} }
@Test @Test(timeout=300_000)
fun present_value_of_list_type() { fun present_value_of_list_type() {
val key = "a.b.c" val key = "a.b.c"
val value = listOf(1L, 2L, 3L) val value = listOf(1L, 2L, 3L)
@ -57,8 +57,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(value) assertThat(property.valueIn(configuration)).isEqualTo(value)
} }
@Test @Test(timeout=300_000)
fun present_value_of_list_type_with_whole_list_mapping() { fun present_value_of_list_type_with_whole_list_mapping() {
val key = "a.b.c" val key = "a.b.c"
val value = listOf(1L, 3L, 2L) val value = listOf(1L, 3L, 2L)
@ -73,8 +73,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(value.max()) assertThat(property.valueIn(configuration)).isEqualTo(value.max())
} }
@Test @Test(timeout=300_000)
fun absent_value_of_list_type_with_whole_list_mapping() { fun absent_value_of_list_type_with_whole_list_mapping() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject().toConfig() val configuration = configObject().toConfig()
@ -88,8 +88,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(null) assertThat(property.valueIn(configuration)).isEqualTo(null)
} }
@Test @Test(timeout=300_000)
fun present_value_of_list_type_with_single_element_and_whole_list_mapping() { fun present_value_of_list_type_with_single_element_and_whole_list_mapping() {
val key = "a.b.c" val key = "a.b.c"
val value = listOf(1L, 3L, 2L) val value = listOf(1L, 3L, 2L)
@ -104,8 +104,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(value.max()) assertThat(property.valueIn(configuration)).isEqualTo(value.max())
} }
@Test @Test(timeout=300_000)
fun absent_value_of_list_type_with_single_element_and_whole_list_mapping() { fun absent_value_of_list_type_with_single_element_and_whole_list_mapping() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject().toConfig() val configuration = configObject().toConfig()
@ -119,8 +119,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(null) assertThat(property.valueIn(configuration)).isEqualTo(null)
} }
@Test @Test(timeout=300_000)
fun optional_present_value_of_list_type() { fun optional_present_value_of_list_type() {
val key = "a.b.c" val key = "a.b.c"
val value = listOf(1L, 2L, 3L) val value = listOf(1L, 2L, 3L)
@ -135,8 +135,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(value) assertThat(property.valueIn(configuration)).isEqualTo(value)
} }
@Test @Test(timeout=300_000)
fun optional_absent_value_of_list_type() { fun optional_absent_value_of_list_type() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()
@ -151,8 +151,8 @@ class PropertyTest {
} }
@Test @Test(timeout=300_000)
fun optional_absent_value_of_list_type_with_default_value() { fun optional_absent_value_of_list_type_with_default_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()
@ -167,8 +167,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(defaultValue) assertThat(property.valueIn(configuration)).isEqualTo(defaultValue)
} }
@Test @Test(timeout=300_000)
fun absent_value() { fun absent_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()
@ -182,8 +182,8 @@ class PropertyTest {
assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.Missing::class.java) assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.Missing::class.java)
} }
@Test @Test(timeout=300_000)
fun optional_present_value_with_correct_type() { fun optional_present_value_with_correct_type() {
val key = "a.b.c" val key = "a.b.c"
val value = 1L val value = 1L
@ -198,8 +198,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isEqualTo(value) assertThat(property.valueIn(configuration)).isEqualTo(value)
} }
@Test @Test(timeout=300_000)
fun optional_present_value_with_wrong_type() { fun optional_present_value_with_wrong_type() {
val key = "a.b.c" val key = "a.b.c"
val value = 1 val value = 1
@ -214,8 +214,8 @@ class PropertyTest {
assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.WrongType::class.java) assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.WrongType::class.java)
} }
@Test @Test(timeout=300_000)
fun optional_absent_value() { fun optional_absent_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()
@ -229,8 +229,8 @@ class PropertyTest {
assertThat(property.valueIn(configuration)).isNull() assertThat(property.valueIn(configuration)).isNull()
} }
@Test @Test(timeout=300_000)
fun optional_absent_with_default_value() { fun optional_absent_with_default_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()

View File

@ -7,8 +7,8 @@ import org.junit.Test
class PropertyValidationTest { class PropertyValidationTest {
@Test @Test(timeout=300_000)
fun absent_value() { fun absent_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject().toConfig() val configuration = configObject().toConfig()
@ -26,8 +26,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun missing_value() { fun missing_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()
@ -45,8 +45,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun absent_list_value() { fun absent_list_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject().toConfig() val configuration = configObject().toConfig()
@ -64,8 +64,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun missing_list_value() { fun missing_list_value() {
val key = "a.b.c" val key = "a.b.c"
val configuration = configObject(key to null).toConfig() val configuration = configObject(key to null).toConfig()
@ -83,8 +83,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun whole_list_validation_valid_value() { fun whole_list_validation_valid_value() {
val key = "a.b.c" val key = "a.b.c"
val value = listOf(1L, 2L, 3L) val value = listOf(1L, 2L, 3L)
@ -97,8 +97,8 @@ class PropertyValidationTest {
assertThat(property.validate(configuration).errors).isEmpty() assertThat(property.validate(configuration).errors).isEmpty()
} }
@Test @Test(timeout=300_000)
fun whole_list_validation_invalid_value() { fun whole_list_validation_invalid_value() {
val key = "a.b.c" val key = "a.b.c"
val value = listOf(1L, 2L, 3L) val value = listOf(1L, 2L, 3L)
@ -125,8 +125,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun wrong_type() { fun wrong_type() {
val key = "a.b.c" val key = "a.b.c"
@ -145,8 +145,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun wrong_floating_numeric_type_when_integer_expected() { fun wrong_floating_numeric_type_when_integer_expected() {
val key = "a.b.c" val key = "a.b.c"
@ -165,8 +165,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun integer_numeric_type_when_floating_expected_works() { fun integer_numeric_type_when_floating_expected_works() {
val key = "a.b.c" val key = "a.b.c"
@ -177,8 +177,8 @@ class PropertyValidationTest {
assertThat(property.validate(configuration).isValid).isTrue() assertThat(property.validate(configuration).isValid).isTrue()
} }
@Test @Test(timeout=300_000)
fun wrong_element_type_for_list() { fun wrong_element_type_for_list() {
val key = "a.b.c" val key = "a.b.c"
@ -197,8 +197,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun list_type_when_declared_single() { fun list_type_when_declared_single() {
val key = "a.b.c" val key = "a.b.c"
@ -217,8 +217,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun single_type_when_declared_list() { fun single_type_when_declared_list() {
val key = "a.b.c" val key = "a.b.c"
@ -237,8 +237,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun wrong_type_in_nested_property() { fun wrong_type_in_nested_property() {
val key = "a.b.c" val key = "a.b.c"
@ -260,8 +260,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun absent_value_in_nested_property() { fun absent_value_in_nested_property() {
val key = "a.b.c" val key = "a.b.c"
@ -283,8 +283,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun missing_value_in_nested_property() { fun missing_value_in_nested_property() {
val key = "a.b.c" val key = "a.b.c"
@ -306,8 +306,8 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun nested_property_without_schema_does_not_validate() { fun nested_property_without_schema_does_not_validate() {
val key = "a.b.c" val key = "a.b.c"
@ -320,8 +320,8 @@ class PropertyValidationTest {
assertThat(property.validate(configuration).isValid).isTrue() assertThat(property.validate(configuration).isValid).isTrue()
} }
@Test @Test(timeout=300_000)
fun valid_mapped_property() { fun valid_mapped_property() {
val key = "a" val key = "a"
@ -336,8 +336,8 @@ class PropertyValidationTest {
assertThat(property.validate(configuration).isValid).isTrue() assertThat(property.validate(configuration).isValid).isTrue()
} }
@Test @Test(timeout=300_000)
fun invalid_mapped_property() { fun invalid_mapped_property() {
val key = "a.b.c" val key = "a.b.c"

View File

@ -7,8 +7,8 @@ import org.junit.Test
class SchemaTest { class SchemaTest {
@Test @Test(timeout=300_000)
fun validation_with_nested_properties() { fun validation_with_nested_properties() {
val prop1 = "prop1" val prop1 = "prop1"
val prop1Value = "value1" val prop1Value = "value1"
@ -35,8 +35,8 @@ class SchemaTest {
assertThat(result.isValid).isTrue() assertThat(result.isValid).isTrue()
} }
@Test @Test(timeout=300_000)
fun validation_with_unknown_properties() { fun validation_with_unknown_properties() {
val prop1 = "prop1" val prop1 = "prop1"
val prop1Value = "value1" val prop1Value = "value1"
@ -74,8 +74,8 @@ class SchemaTest {
assertThat(errorsWithDefaultOptions).isEmpty() assertThat(errorsWithDefaultOptions).isEmpty()
} }
@Test @Test(timeout=300_000)
fun validation_with_unknown_properties_non_strict() { fun validation_with_unknown_properties_non_strict() {
val prop1 = "prop1" val prop1 = "prop1"
val prop1Value = "value1" val prop1Value = "value1"
@ -103,8 +103,8 @@ class SchemaTest {
assertThat(result.isValid).isTrue() assertThat(result.isValid).isTrue()
} }
@Test @Test(timeout=300_000)
fun validation_with_wrong_nested_properties() { fun validation_with_wrong_nested_properties() {
val prop1 = "prop1" val prop1 = "prop1"
val prop1Value = "value1" val prop1Value = "value1"
@ -133,8 +133,8 @@ class SchemaTest {
assertThat(errors).hasSize(2) assertThat(errors).hasSize(2)
} }
@Test @Test(timeout=300_000)
fun describe_with_nested_properties_does_not_show_sensitive_values() { fun describe_with_nested_properties_does_not_show_sensitive_values() {
val prop1 = "prop1" val prop1 = "prop1"
val prop1Value = "value1" val prop1Value = "value1"
@ -164,8 +164,8 @@ class SchemaTest {
assertThat(description).doesNotContain(prop5Value) assertThat(description).doesNotContain(prop5Value)
} }
@Test @Test(timeout=300_000)
fun describe_with_nested_properties_list_does_not_show_sensitive_values() { fun describe_with_nested_properties_list_does_not_show_sensitive_values() {
val prop1 = "prop1" val prop1 = "prop1"
val prop1Value = "value1" val prop1Value = "value1"

View File

@ -30,8 +30,8 @@ class SpecificationTest {
override fun parseValid(configuration: Config) = valid<RpcSettings>(RpcSettingsImpl(configuration[addresses], configuration[useSsl])) override fun parseValid(configuration: Config) = valid<RpcSettings>(RpcSettingsImpl(configuration[addresses], configuration[useSsl]))
} }
@Test @Test(timeout=300_000)
fun parse() { fun parse() {
val useSslValue = true val useSslValue = true
val principalAddressValue = Address("localhost", 8080) val principalAddressValue = Address("localhost", 8080)
@ -53,8 +53,8 @@ class SpecificationTest {
} }
} }
@Test @Test(timeout=300_000)
fun parse_list_aggregation() { fun parse_list_aggregation() {
val spec = object : Configuration.Specification<AtomicLong>("AtomicLong") { val spec = object : Configuration.Specification<AtomicLong>("AtomicLong") {
@ -75,8 +75,8 @@ class SpecificationTest {
assertThat(result.value().get()).isEqualTo(elements.max()) assertThat(result.value().get()).isEqualTo(elements.max())
} }
@Test @Test(timeout=300_000)
fun validate() { fun validate() {
val principalAddressValue = Address("localhost", 8080) val principalAddressValue = Address("localhost", 8080)
val adminAddressValue = Address("127.0.0.1", 8081) val adminAddressValue = Address("127.0.0.1", 8081)
@ -93,8 +93,8 @@ class SpecificationTest {
} }
} }
@Test @Test(timeout=300_000)
fun validate_list_aggregation() { fun validate_list_aggregation() {
fun parseMax(elements: List<Long>): Valid<Long> { fun parseMax(elements: List<Long>): Valid<Long> {
@ -130,8 +130,8 @@ class SpecificationTest {
} }
} }
@Test @Test(timeout=300_000)
fun validate_with_domain_specific_errors() { fun validate_with_domain_specific_errors() {
val useSslValue = true val useSslValue = true
val principalAddressValue = Address("localhost", 8080) val principalAddressValue = Address("localhost", 8080)
@ -151,8 +151,8 @@ class SpecificationTest {
} }
} }
@Test @Test(timeout=300_000)
fun chained_delegated_properties_are_not_added_multiple_times() { fun chained_delegated_properties_are_not_added_multiple_times() {
val spec = object : Configuration.Specification<List<String>?>("Test") { val spec = object : Configuration.Specification<List<String>?>("Test") {

View File

@ -6,8 +6,8 @@ import org.junit.Test
class UtilsTest { class UtilsTest {
@Test @Test(timeout=300_000)
fun serialize_deserialize_configuration() { fun serialize_deserialize_configuration() {
var rawConfiguration = ConfigFactory.empty() var rawConfiguration = ConfigFactory.empty()

View File

@ -12,8 +12,8 @@ class VersionExtractorTest {
private val versionExtractor = Configuration.Version.Extractor.fromPath("configuration.metadata.version") private val versionExtractor = Configuration.Version.Extractor.fromPath("configuration.metadata.version")
private val extractVersion: (Config) -> Valid<Int> = { config -> versionExtractor.parse(config) } private val extractVersion: (Config) -> Valid<Int> = { config -> versionExtractor.parse(config) }
@Test @Test(timeout=300_000)
fun version_header_extraction_present() { fun version_header_extraction_present() {
val versionValue = Configuration.Version.Extractor.DEFAULT_VERSION_VALUE + 1 val versionValue = Configuration.Version.Extractor.DEFAULT_VERSION_VALUE + 1
val rawConfiguration = configObject("configuration" to configObject("metadata" to configObject("version" to versionValue), "node" to configObject("p2pAddress" to "localhost:8080"))).toConfig() val rawConfiguration = configObject("configuration" to configObject("metadata" to configObject("version" to versionValue), "node" to configObject("p2pAddress" to "localhost:8080"))).toConfig()
@ -22,8 +22,8 @@ class VersionExtractorTest {
assertThat(version).isEqualTo(versionValue) assertThat(version).isEqualTo(versionValue)
} }
@Test @Test(timeout=300_000)
fun version_header_extraction_no_metadata() { fun version_header_extraction_no_metadata() {
val rawConfiguration = configObject("configuration" to configObject("node" to configObject("p2pAddress" to "localhost:8080"))).toConfig() val rawConfiguration = configObject("configuration" to configObject("node" to configObject("p2pAddress" to "localhost:8080"))).toConfig()
@ -31,8 +31,8 @@ class VersionExtractorTest {
assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE) assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE)
} }
@Test @Test(timeout=300_000)
fun version_header_extraction_no_key() { fun version_header_extraction_no_key() {
val rawConfiguration = configObject("configuration" to configObject("metadata" to configObject(), "node" to configObject("p2pAddress" to "localhost:8080"))).toConfig() val rawConfiguration = configObject("configuration" to configObject("metadata" to configObject(), "node" to configObject("p2pAddress" to "localhost:8080"))).toConfig()
@ -41,8 +41,8 @@ class VersionExtractorTest {
assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE) assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE)
} }
@Test @Test(timeout=300_000)
fun version_header_extraction_no_value() { fun version_header_extraction_no_value() {
val rawConfiguration = configObject("configuration" to configObject("metadata" to configObject("version" to null), "node" to configObject("p2pAddress" to "localhost:8080"))).toConfig() val rawConfiguration = configObject("configuration" to configObject("metadata" to configObject("version" to null), "node" to configObject("p2pAddress" to "localhost:8080"))).toConfig()
@ -51,8 +51,8 @@ class VersionExtractorTest {
assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE) assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE)
} }
@Test @Test(timeout=300_000)
fun version_header_extraction_no_configuration() { fun version_header_extraction_no_configuration() {
val rawConfiguration = configObject().toConfig() val rawConfiguration = configObject().toConfig()

View File

@ -9,8 +9,8 @@ import org.junit.Test
class VersionedParsingExampleTest { class VersionedParsingExampleTest {
@Test @Test(timeout=300_000)
fun correct_parsing_function_is_used_for_present_version() { fun correct_parsing_function_is_used_for_present_version() {
val versionParser = Configuration.Version.Extractor.fromPath("configuration.metadata.version") val versionParser = Configuration.Version.Extractor.fromPath("configuration.metadata.version")
val extractVersion: (Config) -> Valid<Int> = { config -> versionParser.parseRequired(config) } val extractVersion: (Config) -> Valid<Int> = { config -> versionParser.parseRequired(config) }
@ -31,8 +31,8 @@ class VersionedParsingExampleTest {
assertResult(rpcSettingsFromVersion2Conf, principalAddressValue, adminAddressValue) assertResult(rpcSettingsFromVersion2Conf, principalAddressValue, adminAddressValue)
} }
@Test @Test(timeout=300_000)
fun default_value_is_used_for_absent_version() { fun default_value_is_used_for_absent_version() {
val defaultVersion = 2 val defaultVersion = 2
val versionParser = Configuration.Version.Extractor.fromPath("configuration.metadata.version", defaultVersion) val versionParser = Configuration.Version.Extractor.fromPath("configuration.metadata.version", defaultVersion)

View File

@ -46,8 +46,8 @@ class IdentitySyncFlowTests {
mockNet.stopNodes() mockNet.stopNodes()
} }
@Test @Test(timeout=300_000)
fun `sync confidential identities`() { fun `sync confidential identities`() {
// Set up values we'll need // Set up values we'll need
val aliceNode = mockNet.createPartyNode(ALICE_NAME) val aliceNode = mockNet.createPartyNode(ALICE_NAME)
val bobNode = mockNet.createPartyNode(BOB_NAME) val bobNode = mockNet.createPartyNode(BOB_NAME)
@ -74,8 +74,8 @@ class IdentitySyncFlowTests {
assertEquals(expected, actual) assertEquals(expected, actual)
} }
@Test @Test(timeout=300_000)
fun `don't offer other's identities confidential identities`() { fun `don't offer other's identities confidential identities`() {
// Set up values we'll need // Set up values we'll need
val aliceNode = mockNet.createPartyNode(ALICE_NAME) val aliceNode = mockNet.createPartyNode(ALICE_NAME)
val bobNode = mockNet.createPartyNode(BOB_NAME) val bobNode = mockNet.createPartyNode(BOB_NAME)

View File

@ -46,8 +46,8 @@ class SwapIdentitiesFlowTests {
private val alice = aliceNode.info.singleIdentity() private val alice = aliceNode.info.singleIdentity()
private val bob = bobNode.info.singleIdentity() private val bob = bobNode.info.singleIdentity()
@Test @Test(timeout=300_000)
fun `issue key`() { fun `issue key`() {
assertThat( assertThat(
aliceNode.services.startFlow(SwapIdentitiesInitiator(bob)), aliceNode.services.startFlow(SwapIdentitiesInitiator(bob)),
willReturn( willReturn(
@ -72,8 +72,8 @@ class SwapIdentitiesFlowTests {
/** /**
* Check that flow is actually validating the name on the certificate presented by the counterparty. * Check that flow is actually validating the name on the certificate presented by the counterparty.
*/ */
@Test @Test(timeout=300_000)
fun `verifies identity name`() { fun `verifies identity name`() {
val notBob = charlieNode.issueFreshKeyAndCert() val notBob = charlieNode.issueFreshKeyAndCert()
val signature = charlieNode.signSwapIdentitiesFlowData(notBob, notBob.owningKey) val signature = charlieNode.signSwapIdentitiesFlowData(notBob, notBob.owningKey)
assertThatThrownBy { aliceNode.validateSwapIdentitiesFlow(bob, notBob, signature) } assertThatThrownBy { aliceNode.validateSwapIdentitiesFlow(bob, notBob, signature) }
@ -84,8 +84,8 @@ class SwapIdentitiesFlowTests {
/** /**
* Check that flow is actually validating its the signature presented by the counterparty. * Check that flow is actually validating its the signature presented by the counterparty.
*/ */
@Test @Test(timeout=300_000)
fun `verification rejects signature if name is right but key is wrong`() { fun `verification rejects signature if name is right but key is wrong`() {
val evilBobNode = mockNet.createPartyNode(bobNode.info.singleIdentity().name) val evilBobNode = mockNet.createPartyNode(bobNode.info.singleIdentity().name)
val evilBob = evilBobNode.info.singleIdentityAndCert() val evilBob = evilBobNode.info.singleIdentityAndCert()
val anonymousEvilBob = evilBobNode.issueFreshKeyAndCert() val anonymousEvilBob = evilBobNode.issueFreshKeyAndCert()
@ -96,8 +96,8 @@ class SwapIdentitiesFlowTests {
.hasMessage("Signature does not match the expected identity ownership assertion.") .hasMessage("Signature does not match the expected identity ownership assertion.")
} }
@Test @Test(timeout=300_000)
fun `verification rejects signature if key is right but name is wrong`() { fun `verification rejects signature if key is right but name is wrong`() {
val anonymousAlice = aliceNode.issueFreshKeyAndCert() val anonymousAlice = aliceNode.issueFreshKeyAndCert()
val anonymousBob = bobNode.issueFreshKeyAndCert() val anonymousBob = bobNode.issueFreshKeyAndCert()
val signature = bobNode.signSwapIdentitiesFlowData(anonymousAlice, anonymousBob.owningKey) val signature = bobNode.signSwapIdentitiesFlowData(anonymousAlice, anonymousBob.owningKey)

View File

@ -72,7 +72,7 @@ class GenerateData {
} }
@Test @Test
fun verifyTransactions() { fun verifyTransactions() {
URLClassLoader(arrayOf(TEST_DATA.toUri().toURL())).use { cl -> URLClassLoader(arrayOf(TEST_DATA.toUri().toURL())).use { cl ->
cl.loadResource("txverify/tx-success.bin") cl.loadResource("txverify/tx-success.bin")
.deserialize<TransactionVerificationRequest>() .deserialize<TransactionVerificationRequest>()

View File

@ -35,33 +35,33 @@ class CordaExceptionTest {
val BOB = Party(BOB_NAME, BOB_KEY) val BOB = Party(BOB_NAME, BOB_KEY)
} }
@Test @Test(timeout=300_000)
fun testCordaException() { fun testCordaException() {
val ex = assertFailsWith<CordaException> { throw CordaException("BAD THING") } val ex = assertFailsWith<CordaException> { throw CordaException("BAD THING") }
assertEquals("BAD THING", ex.message) assertEquals("BAD THING", ex.message)
} }
@Test @Test(timeout=300_000)
fun testAttachmentResolutionException() { fun testAttachmentResolutionException() {
val ex = assertFailsWith<AttachmentResolutionException> { throw AttachmentResolutionException(TEST_HASH) } val ex = assertFailsWith<AttachmentResolutionException> { throw AttachmentResolutionException(TEST_HASH) }
assertEquals(TEST_HASH, ex.hash) assertEquals(TEST_HASH, ex.hash)
} }
@Test @Test(timeout=300_000)
fun testTransactionResolutionException() { fun testTransactionResolutionException() {
val ex = assertFailsWith<TransactionResolutionException> { throw TransactionResolutionException(TEST_HASH) } val ex = assertFailsWith<TransactionResolutionException> { throw TransactionResolutionException(TEST_HASH) }
assertEquals(TEST_HASH, ex.hash) assertEquals(TEST_HASH, ex.hash)
} }
@Test @Test(timeout=300_000)
fun testConflictingAttachmentsRejection() { fun testConflictingAttachmentsRejection() {
val ex = assertFailsWith<ConflictingAttachmentsRejection> { throw ConflictingAttachmentsRejection(TX_ID, CONTRACT_CLASS) } val ex = assertFailsWith<ConflictingAttachmentsRejection> { throw ConflictingAttachmentsRejection(TX_ID, CONTRACT_CLASS) }
assertEquals(TX_ID, ex.txId) assertEquals(TX_ID, ex.txId)
assertEquals(CONTRACT_CLASS, ex.contractClass) assertEquals(CONTRACT_CLASS, ex.contractClass)
} }
@Test @Test(timeout=300_000)
fun testNotaryChangeInWrongTransactionType() { fun testNotaryChangeInWrongTransactionType() {
val ex = assertFailsWith<NotaryChangeInWrongTransactionType> { throw NotaryChangeInWrongTransactionType(TX_ID, ALICE, BOB) } val ex = assertFailsWith<NotaryChangeInWrongTransactionType> { throw NotaryChangeInWrongTransactionType(TX_ID, ALICE, BOB) }
assertEquals(TX_ID, ex.txId) assertEquals(TX_ID, ex.txId)
assertEquals(ALICE, ex.txNotary) assertEquals(ALICE, ex.txNotary)

View File

@ -55,8 +55,8 @@ class AttachmentTest {
} }
} }
@Test @Test(timeout=300_000)
fun testAttachmentJar() { fun testAttachmentJar() {
attachment.openAsJAR().use { jar -> attachment.openAsJAR().use { jar ->
val entry = jar.nextJarEntry ?: return@use val entry = jar.nextJarEntry ?: return@use
assertEquals("data.bin", entry.name) assertEquals("data.bin", entry.name)
@ -68,8 +68,8 @@ class AttachmentTest {
} }
} }
@Test @Test(timeout=300_000)
fun testExtractFromAttachment() { fun testExtractFromAttachment() {
val resultData = ByteArrayOutputStream().use { val resultData = ByteArrayOutputStream().use {
attachment.extractFile("data.bin", it) attachment.extractFile("data.bin", it)
it.toByteArray() it.toByteArray()

View File

@ -9,25 +9,25 @@ class PrivacySaltTest {
private const val SALT_SIZE = 32 private const val SALT_SIZE = 32
} }
@Test @Test(timeout=300_000)
fun testValidSalt() { fun testValidSalt() {
PrivacySalt(ByteArray(SALT_SIZE) { 0x14 }) PrivacySalt(ByteArray(SALT_SIZE) { 0x14 })
} }
@Test @Test(timeout=300_000)
fun testInvalidSaltWithAllZeros() { fun testInvalidSaltWithAllZeros() {
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE)) } val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE)) }
assertEquals("Privacy salt should not be all zeros.", ex.message) assertEquals("Privacy salt should not be all zeros.", ex.message)
} }
@Test @Test(timeout=300_000)
fun testTooShortPrivacySalt() { fun testTooShortPrivacySalt() {
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE - 1) { 0x7f }) } val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE - 1) { 0x7f }) }
assertEquals("Privacy salt should be 32 bytes.", ex.message) assertEquals("Privacy salt should be 32 bytes.", ex.message)
} }
@Test @Test(timeout=300_000)
fun testTooLongPrivacySalt() { fun testTooLongPrivacySalt() {
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE + 1) { 0x7f }) } val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE + 1) { 0x7f }) }
assertEquals("Privacy salt should be 32 bytes.", ex.message) assertEquals("Privacy salt should be 32 bytes.", ex.message)
} }

View File

@ -14,22 +14,22 @@ class UniqueIdentifierTest {
private val TEST_UUID: UUID = UUID.fromString("00000000-1111-2222-3333-444444444444") private val TEST_UUID: UUID = UUID.fromString("00000000-1111-2222-3333-444444444444")
} }
@Test @Test(timeout=300_000)
fun testNewInstance() { fun testNewInstance() {
val id = UniqueIdentifier(NAME, TEST_UUID) val id = UniqueIdentifier(NAME, TEST_UUID)
assertEquals("${NAME}_$TEST_UUID", id.toString()) assertEquals("${NAME}_$TEST_UUID", id.toString())
assertEquals(NAME, id.externalId) assertEquals(NAME, id.externalId)
assertEquals(TEST_UUID, id.id) assertEquals(TEST_UUID, id.id)
} }
@Test @Test(timeout=300_000)
fun testPrimaryConstructor() { fun testPrimaryConstructor() {
val primary = UniqueIdentifier::class.primaryConstructor ?: throw AssertionError("primary constructor missing") val primary = UniqueIdentifier::class.primaryConstructor ?: throw AssertionError("primary constructor missing")
assertThat(primary.call(NAME, TEST_UUID)).isEqualTo(UniqueIdentifier(NAME, TEST_UUID)) assertThat(primary.call(NAME, TEST_UUID)).isEqualTo(UniqueIdentifier(NAME, TEST_UUID))
} }
@Test @Test(timeout=300_000)
fun testConstructors() { fun testConstructors() {
assertEquals(1, UniqueIdentifier::class.constructors.size) assertEquals(1, UniqueIdentifier::class.constructors.size)
val ex = assertFailsWith<IllegalArgumentException> { UniqueIdentifier::class.constructors.first().call() } val ex = assertFailsWith<IllegalArgumentException> { UniqueIdentifier::class.constructors.first().call() }
assertThat(ex).hasMessage("Callable expects 2 arguments, but 0 were provided.") assertThat(ex).hasMessage("Callable expects 2 arguments, but 0 were provided.")

View File

@ -6,8 +6,8 @@ import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
class MerkleTreeTest { class MerkleTreeTest {
@Test @Test(timeout=300_000)
fun testCreate() { fun testCreate() {
val merkle = MerkleTree.getMerkleTree(listOf(SecureHash.allOnesHash, SecureHash.zeroHash)) val merkle = MerkleTree.getMerkleTree(listOf(SecureHash.allOnesHash, SecureHash.zeroHash))
assertEquals(SecureHash.parse("A5DE9B714ACCD8AFAAABF1CBD6E1014C9D07FF95C2AE154D91EC68485B31E7B5"), merkle.hash) assertEquals(SecureHash.parse("A5DE9B714ACCD8AFAAABF1CBD6E1014C9D07FF95C2AE154D91EC68485B31E7B5"), merkle.hash)
} }

View File

@ -7,31 +7,31 @@ import org.junit.Test
import java.security.MessageDigest import java.security.MessageDigest
class SecureHashTest { class SecureHashTest {
@Test @Test(timeout=300_000)
fun testSHA256() { fun testSHA256() {
val hash = SecureHash.sha256(byteArrayOf(0x64, -0x13, 0x42, 0x3a)) val hash = SecureHash.sha256(byteArrayOf(0x64, -0x13, 0x42, 0x3a))
assertEquals(SecureHash.parse("6D1687C143DF792A011A1E80670A4E4E0C25D0D87A39514409B1ABFC2043581F"), hash) assertEquals(SecureHash.parse("6D1687C143DF792A011A1E80670A4E4E0C25D0D87A39514409B1ABFC2043581F"), hash)
assertEquals("6D1687C143DF792A011A1E80670A4E4E0C25D0D87A39514409B1ABFC2043581F", hash.toString()) assertEquals("6D1687C143DF792A011A1E80670A4E4E0C25D0D87A39514409B1ABFC2043581F", hash.toString())
} }
@Test @Test(timeout=300_000)
fun testPrefix() { fun testPrefix() {
val data = byteArrayOf(0x7d, 0x03, -0x21, 0x32, 0x56, 0x47) val data = byteArrayOf(0x7d, 0x03, -0x21, 0x32, 0x56, 0x47)
val digest = data.digestFor("SHA-256") val digest = data.digestFor("SHA-256")
val prefix = SecureHash.sha256(data).prefixChars(8) val prefix = SecureHash.sha256(data).prefixChars(8)
assertEquals(Hex.toHexString(digest).substring(0, 8).toUpperCase(), prefix) assertEquals(Hex.toHexString(digest).substring(0, 8).toUpperCase(), prefix)
} }
@Test @Test(timeout=300_000)
fun testConcat() { fun testConcat() {
val hash1 = SecureHash.sha256(byteArrayOf(0x7d, 0x03, -0x21, 0x32, 0x56, 0x47)) val hash1 = SecureHash.sha256(byteArrayOf(0x7d, 0x03, -0x21, 0x32, 0x56, 0x47))
val hash2 = SecureHash.sha256(byteArrayOf(0x63, 0x01, 0x7f, -0x29, 0x1e, 0x3c)) val hash2 = SecureHash.sha256(byteArrayOf(0x63, 0x01, 0x7f, -0x29, 0x1e, 0x3c))
val combined = hash1.hashConcat(hash2) val combined = hash1.hashConcat(hash2)
assertArrayEquals((hash1.bytes + hash2.bytes).digestFor("SHA-256"), combined.bytes) assertArrayEquals((hash1.bytes + hash2.bytes).digestFor("SHA-256"), combined.bytes)
} }
@Test @Test(timeout=300_000)
fun testConstants() { fun testConstants() {
assertArrayEquals(SecureHash.zeroHash.bytes, ByteArray(32)) assertArrayEquals(SecureHash.zeroHash.bytes, ByteArray(32))
assertArrayEquals(SecureHash.allOnesHash.bytes, ByteArray(32) { 0xFF.toByte() }) assertArrayEquals(SecureHash.allOnesHash.bytes, ByteArray(32) { 0xFF.toByte() })
} }

View File

@ -14,8 +14,8 @@ class SecureRandomTest {
} }
} }
@Test @Test(timeout=300_000)
fun testNoCordaPRNG() { fun testNoCordaPRNG() {
val error = assertFailsWith<NoSuchAlgorithmException> { SecureRandom.getInstance("CordaPRNG") } val error = assertFailsWith<NoSuchAlgorithmException> { SecureRandom.getInstance("CordaPRNG") }
assertThat(error).hasMessage("CordaPRNG SecureRandom not available") assertThat(error).hasMessage("CordaPRNG SecureRandom not available")
} }

View File

@ -30,8 +30,8 @@ class TransactionSignatureTest {
} }
/** Valid sign and verify. */ /** Valid sign and verify. */
@Test @Test(timeout=300_000)
fun `Signature metadata full sign and verify`() { fun `Signature metadata full sign and verify`() {
// Create a SignableData object. // Create a SignableData object.
val signableData = SignableData(testBytes.sha256(), SignatureMetadata(1, Crypto.findSignatureScheme(keyPair.public).schemeNumberID)) val signableData = SignableData(testBytes.sha256(), SignatureMetadata(1, Crypto.findSignatureScheme(keyPair.public).schemeNumberID))
@ -57,8 +57,8 @@ class TransactionSignatureTest {
Crypto.doVerify((testBytes + testBytes).sha256(), transactionSignature) Crypto.doVerify((testBytes + testBytes).sha256(), transactionSignature)
} }
@Test @Test(timeout=300_000)
fun `Verify multi-tx signature`() { fun `Verify multi-tx signature`() {
// Deterministically create 5 txIds. // Deterministically create 5 txIds.
val txIds: List<SecureHash> = IntRange(0, 4).map { byteArrayOf(it.toByte()).sha256() } val txIds: List<SecureHash> = IntRange(0, 4).map { byteArrayOf(it.toByte()).sha256() }
// Multi-tx signature. // Multi-tx signature.
@ -103,8 +103,8 @@ class TransactionSignatureTest {
} }
} }
@Test @Test(timeout=300_000)
fun `Verify one-tx signature`() { fun `Verify one-tx signature`() {
val txId = "aTransaction".toByteArray().sha256() val txId = "aTransaction".toByteArray().sha256()
// One-tx signature. // One-tx signature.
val txSignature = try { val txSignature = try {

View File

@ -7,8 +7,8 @@ import org.junit.Test
import java.security.PublicKey import java.security.PublicKey
class TransactionWithSignaturesTest { class TransactionWithSignaturesTest {
@Test @Test(timeout=300_000)
fun txWithSigs() { fun txWithSigs() {
val tx = object : TransactionWithSignatures { val tx = object : TransactionWithSignatures {
override val id: SecureHash override val id: SecureHash
get() = SecureHash.zeroHash get() = SecureHash.zeroHash

View File

@ -16,13 +16,13 @@ class VerifyTransactionTest {
val serialization = LocalSerializationRule(VerifyTransactionTest::class) val serialization = LocalSerializationRule(VerifyTransactionTest::class)
} }
@Test @Test(timeout=300_000)
fun success() { fun success() {
verifyTransaction(bytesOfResource("txverify/tx-success.bin")) verifyTransaction(bytesOfResource("txverify/tx-success.bin"))
} }
@Test @Test(timeout=300_000)
fun failure() { fun failure() {
val e = assertFailsWith<Exception> { verifyTransaction(bytesOfResource("txverify/tx-failure.bin")) } val e = assertFailsWith<Exception> { verifyTransaction(bytesOfResource("txverify/tx-failure.bin")) }
assertThat(e).hasMessageContaining("Required ${Move::class.java.canonicalName} command") assertThat(e).hasMessageContaining("Required ${Move::class.java.canonicalName} command")
} }

View File

@ -5,7 +5,7 @@ import net.corda.core.serialization.SerializationContext.UseCase.P2P
import net.corda.core.serialization.SerializationCustomSerializer import net.corda.core.serialization.SerializationCustomSerializer
import net.corda.core.serialization.SerializationWhitelist import net.corda.core.serialization.SerializationWhitelist
import net.corda.core.serialization.internal.SerializationEnvironment import net.corda.core.serialization.internal.SerializationEnvironment
import net.corda.core.serialization.internal._contextSerializationEnv import net.corda.core.serialization.internal._driverSerializationEnv
import net.corda.serialization.internal.* import net.corda.serialization.internal.*
import net.corda.serialization.internal.amqp.* import net.corda.serialization.internal.amqp.*
import org.junit.rules.TestRule import org.junit.rules.TestRule
@ -48,11 +48,11 @@ class LocalSerializationRule(private val label: String) : TestRule {
} }
private fun init() { private fun init() {
_contextSerializationEnv.set(createTestSerializationEnv()) _driverSerializationEnv.set(createTestSerializationEnv())
} }
private fun clear() { private fun clear() {
_contextSerializationEnv.set(null) _driverSerializationEnv.set(null)
} }
private fun createTestSerializationEnv(): SerializationEnvironment { private fun createTestSerializationEnv(): SerializationEnvironment {

View File

@ -57,14 +57,14 @@ class NodeVersioningTest {
notary.close() notary.close()
} }
@Test @Test(timeout=300_000)
fun `platform version in manifest file`() { fun `platform version in manifest file`() {
val manifest = JarFile(factory.cordaJar.toFile()).manifest val manifest = JarFile(factory.cordaJar.toFile()).manifest
assertThat(manifest.mainAttributes.getValue("Corda-Platform-Version").toInt()).isEqualTo(PLATFORM_VERSION) assertThat(manifest.mainAttributes.getValue("Corda-Platform-Version").toInt()).isEqualTo(PLATFORM_VERSION)
} }
@Test @Test(timeout=300_000)
fun `platform version from RPC`() { fun `platform version from RPC`() {
val cordappsDir = (factory.baseDirectory(aliceConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories() val cordappsDir = (factory.baseDirectory(aliceConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories()
// Find the jar file for the smoke tests of this module // Find the jar file for the smoke tests of this module
val selfCordapp = Paths.get("build", "libs").list { val selfCordapp = Paths.get("build", "libs").list {

View File

@ -74,8 +74,8 @@ class CordappSmokeTest {
notary.close() notary.close()
} }
@Test @Test(timeout=300_000)
fun `FlowContent appName returns the filename of the CorDapp jar`() { fun `FlowContent appName returns the filename of the CorDapp jar`() {
val baseDir = factory.baseDirectory(aliceConfig) val baseDir = factory.baseDirectory(aliceConfig)
val cordappsDir = (baseDir / CORDAPPS_DIR_NAME).createDirectories() val cordappsDir = (baseDir / CORDAPPS_DIR_NAME).createDirectories()
// Find the jar file for the smoke tests of this module // Find the jar file for the smoke tests of this module
@ -103,8 +103,8 @@ class CordappSmokeTest {
} }
} }
@Test @Test(timeout=300_000)
fun `empty cordapps directory`() { fun `empty cordapps directory`() {
(factory.baseDirectory(aliceConfig) / CORDAPPS_DIR_NAME).createDirectories() (factory.baseDirectory(aliceConfig) / CORDAPPS_DIR_NAME).createDirectories()
factory.create(aliceConfig).close() factory.create(aliceConfig).close()
} }

View File

@ -19,14 +19,14 @@ import kotlin.test.assertTrue
* Tests of the [Amount] class. * Tests of the [Amount] class.
*/ */
class AmountTests { class AmountTests {
@Test @Test(timeout=300_000)
fun `make sure Amount has decimal places`() { fun `make sure Amount has decimal places`() {
val x = Amount(1, Currency.getInstance("USD")) val x = Amount(1, Currency.getInstance("USD"))
assertTrue("0.01" in x.toString()) assertTrue("0.01" in x.toString())
} }
@Test @Test(timeout=300_000)
fun `decimal conversion`() { fun `decimal conversion`() {
val quantity = 1234L val quantity = 1234L
val amountGBP = Amount(quantity, GBP) val amountGBP = Amount(quantity, GBP)
val expectedGBP = BigDecimal("12.34") val expectedGBP = BigDecimal("12.34")
@ -48,8 +48,8 @@ class AmountTests {
override fun toString(): String = name override fun toString(): String = name
} }
@Test @Test(timeout=300_000)
fun split() { fun split() {
for (baseQuantity in 0..1000) { for (baseQuantity in 0..1000) {
val baseAmount = Amount(baseQuantity.toLong(), GBP) val baseAmount = Amount(baseQuantity.toLong(), GBP)
for (partitionCount in 1..100) { for (partitionCount in 1..100) {
@ -63,8 +63,8 @@ class AmountTests {
} }
} }
@Test @Test(timeout=300_000)
fun `amount transfers equality`() { fun `amount transfers equality`() {
val partyA = "A" val partyA = "A"
val partyB = "B" val partyB = "B"
val partyC = "C" val partyC = "C"
@ -88,8 +88,8 @@ class AmountTests {
assertNotEquals(transferE.hashCode(), transferA.hashCode()) assertNotEquals(transferE.hashCode(), transferA.hashCode())
} }
@Test @Test(timeout=300_000)
fun `amount transfer aggregation`() { fun `amount transfer aggregation`() {
val partyA = "A" val partyA = "A"
val partyB = "B" val partyB = "B"
val partyC = "C" val partyC = "C"
@ -119,8 +119,8 @@ class AmountTests {
assertEquals(negativeTransfer, sumUntilNegative) assertEquals(negativeTransfer, sumUntilNegative)
} }
@Test @Test(timeout=300_000)
fun `amount transfer apply`() { fun `amount transfer apply`() {
val partyA = "A" val partyA = "A"
val partyB = "B" val partyB = "B"
val partyC = "C" val partyC = "C"
@ -167,8 +167,8 @@ class AmountTests {
assertEquals(originalTotals[Pair(partyB, GBP)], newTotals3[Pair(partyB, GBP)]) assertEquals(originalTotals[Pair(partyB, GBP)], newTotals3[Pair(partyB, GBP)])
} }
@Test @Test(timeout=300_000)
fun testGbpParse() { fun testGbpParse() {
assertEquals(POUNDS(10), Amount.parseCurrency("10 GBP")) assertEquals(POUNDS(10), Amount.parseCurrency("10 GBP"))
assertEquals(POUNDS(11), Amount.parseCurrency("£11")) assertEquals(POUNDS(11), Amount.parseCurrency("£11"))
} }

View File

@ -96,8 +96,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Happy path with the HashConstraint`() { fun `Happy path with the HashConstraint`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash)
@ -115,8 +115,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
@Ignore // TODO(mike): rework @Ignore // TODO(mike): rework
fun `Happy path for Hash to Signature Constraint migration`() { fun `Happy path for Hash to Signature Constraint migration`() {
val cordapps = (ledgerServices.cordappProvider as MockCordappProvider).cordapps val cordapps = (ledgerServices.cordappProvider as MockCordappProvider).cordapps
val cordappAttachmentIds = val cordappAttachmentIds =
@ -156,8 +156,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Fail early in the TransactionBuilder when attempting to change the hash of the HashConstraint on the spending transaction`() { fun `Fail early in the TransactionBuilder when attempting to change the hash of the HashConstraint on the spending transaction`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
attachment(Cash.PROGRAM_ID, SecureHash.zeroHash) attachment(Cash.PROGRAM_ID, SecureHash.zeroHash)
@ -177,8 +177,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Transaction validation fails, when constraints do not propagate correctly`() { fun `Transaction validation fails, when constraints do not propagate correctly`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.zeroHash) attachment(Cash.PROGRAM_ID, SecureHash.zeroHash)
@ -210,8 +210,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `When the constraint of the output state is a valid transition from the input state, transaction validation works`() { fun `When the constraint of the output state is a valid transition from the input state, transaction validation works`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.zeroHash) attachment(Cash.PROGRAM_ID, SecureHash.zeroHash)
@ -229,8 +229,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Switching from the WhitelistConstraint to the Signature Constraint is possible if the attachment satisfies both constraints, and the signature constraint inherits all jar signatures`() { fun `Switching from the WhitelistConstraint to the Signature Constraint is possible if the attachment satisfies both constraints, and the signature constraint inherits all jar signatures`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
@ -251,8 +251,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Switching from the WhitelistConstraint to the Signature Constraint fails if the signature constraint does not inherit all jar signatures`() { fun `Switching from the WhitelistConstraint to the Signature Constraint fails if the signature constraint does not inherit all jar signatures`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.zeroHash) attachment(Cash.PROGRAM_ID, SecureHash.zeroHash)
@ -272,8 +272,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `On contract annotated with NoConstraintPropagation there is no platform check for propagation, but the transaction builder can't use the AutomaticPlaceholderConstraint`() { fun `On contract annotated with NoConstraintPropagation there is no platform check for propagation, but the transaction builder can't use the AutomaticPlaceholderConstraint`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(noPropagationContractClassName, SecureHash.zeroHash) attachment(noPropagationContractClassName, SecureHash.zeroHash)
@ -300,8 +300,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Signature Constraints canBeTransitionedFrom Hash Constraints behaves as expected`() { fun `Signature Constraints canBeTransitionedFrom Hash Constraints behaves as expected`() {
// unsigned attachment (for hash constraint) // unsigned attachment (for hash constraint)
val attachmentUnsigned = mock<ContractAttachment>() val attachmentUnsigned = mock<ContractAttachment>()
@ -326,8 +326,8 @@ class ConstraintsPropagationTests {
assertFalse(SignatureAttachmentConstraint(ALICE_PUBKEY).canBeTransitionedFrom(HashAttachmentConstraint(allOnesHash), attachmentSigned)) assertFalse(SignatureAttachmentConstraint(ALICE_PUBKEY).canBeTransitionedFrom(HashAttachmentConstraint(allOnesHash), attachmentSigned))
} }
@Test @Test(timeout=300_000)
fun `Attachment canBeTransitionedFrom behaves as expected`() { fun `Attachment canBeTransitionedFrom behaves as expected`() {
// signed attachment (for signature constraint) // signed attachment (for signature constraint)
val attachment = mock<ContractAttachment>() val attachment = mock<ContractAttachment>()
@ -378,8 +378,8 @@ class ConstraintsPropagationTests {
recordTransactions(SignedTransaction(wireTransaction, sigs)) recordTransactions(SignedTransaction(wireTransaction, sigs))
} }
@Test @Test(timeout=300_000)
fun `Input state contract version may be incompatible with lower version`() { fun `Input state contract version may be incompatible with lower version`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "2")) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "2"))
@ -397,8 +397,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Input state contract version is compatible with the same version`() { fun `Input state contract version is compatible with the same version`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "3")) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "3"))
@ -416,8 +416,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Input state contract version is compatible with higher version`() { fun `Input state contract version is compatible with higher version`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "1")) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "1"))
@ -435,8 +435,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Input states contract version may be lower that current contract version`() { fun `Input states contract version may be lower that current contract version`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "1")) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "1"))
@ -460,8 +460,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Input state with contract version can be downgraded to no version`() { fun `Input state with contract version can be downgraded to no version`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "2")) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), mapOf(Attributes.Name.IMPLEMENTATION_VERSION.toString() to "2"))
@ -479,8 +479,8 @@ class ConstraintsPropagationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Input state without contract version is compatible with any version`() { fun `Input state without contract version is compatible with any version`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
ledgerServices.recordTransaction(transaction { ledgerServices.recordTransaction(transaction {
attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), emptyMap()) attachment(Cash.PROGRAM_ID, SecureHash.allOnesHash, listOf(hashToSignatureConstraintsKey), emptyMap())

View File

@ -34,8 +34,8 @@ class ContractHierarchyTest {
mockNet.stopNodes() mockNet.stopNodes()
} }
@Test @Test(timeout=300_000)
fun `hierarchical contracts work with mock network`() { fun `hierarchical contracts work with mock network`() {
// Set up values we'll need // Set up values we'll need
val aliceNode = mockNet.createPartyNode(ALICE_NAME) val aliceNode = mockNet.createPartyNode(ALICE_NAME)
val bobNode = mockNet.createPartyNode(BOB_NAME) val bobNode = mockNet.createPartyNode(BOB_NAME)

View File

@ -40,8 +40,8 @@ class RequireSingleCommandTests(private val testFunction: (Collection<CommandWit
) )
} }
@Test @Test(timeout=300_000)
fun `check function returns one value`() { fun `check function returns one value`() {
val commands = listOf(validCommandOne, invalidCommand) val commands = listOf(validCommandOne, invalidCommand)
val returnedCommand = testFunction(commands) val returnedCommand = testFunction(commands)
assertEquals(returnedCommand, validCommandOne, "they should be the same") assertEquals(returnedCommand, validCommandOne, "they should be the same")
@ -53,8 +53,8 @@ class RequireSingleCommandTests(private val testFunction: (Collection<CommandWit
testFunction(commands) testFunction(commands)
} }
@Test @Test(timeout=300_000)
fun `check error is thrown when command is of wrong type`() { fun `check error is thrown when command is of wrong type`() {
val commands = listOf(invalidCommand) val commands = listOf(invalidCommand)
Assertions.assertThatThrownBy { testFunction(commands) } Assertions.assertThatThrownBy { testFunction(commands) }
.isInstanceOf(IllegalStateException::class.java) .isInstanceOf(IllegalStateException::class.java)
@ -74,8 +74,8 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
) )
} }
@Test @Test(timeout=300_000)
fun `check that function returns all values`() { fun `check that function returns all values`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
testFunction(commands, null, null) testFunction(commands, null, null)
assertEquals(2, commands.size) assertEquals(2, commands.size)
@ -83,8 +83,8 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
assertTrue(commands.contains(validCommandTwo)) assertTrue(commands.contains(validCommandTwo))
} }
@Test @Test(timeout=300_000)
fun `check that function does not return invalid command types`() { fun `check that function does not return invalid command types`() {
val commands = listOf(validCommandOne, invalidCommand) val commands = listOf(validCommandOne, invalidCommand)
val filteredCommands = testFunction(commands, null, null).toList() val filteredCommands = testFunction(commands, null, null).toList()
assertEquals(1, filteredCommands.size) assertEquals(1, filteredCommands.size)
@ -92,8 +92,8 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
assertFalse(filteredCommands.contains(invalidCommand)) assertFalse(filteredCommands.contains(invalidCommand))
} }
@Test @Test(timeout=300_000)
fun `check that function returns commands from valid signers`() { fun `check that function returns commands from valid signers`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
val filteredCommands = testFunction(commands, miniCorp.publicKey, null).toList() val filteredCommands = testFunction(commands, miniCorp.publicKey, null).toList()
assertEquals(1, filteredCommands.size) assertEquals(1, filteredCommands.size)
@ -101,8 +101,8 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
assertFalse(filteredCommands.contains(validCommandTwo)) assertFalse(filteredCommands.contains(validCommandTwo))
} }
@Test @Test(timeout=300_000)
fun `check that function returns commands from valid parties`() { fun `check that function returns commands from valid parties`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
val filteredCommands = testFunction(commands, null, miniCorp.party).toList() val filteredCommands = testFunction(commands, null, miniCorp.party).toList()
assertEquals(1, filteredCommands.size) assertEquals(1, filteredCommands.size)
@ -123,8 +123,8 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
) )
} }
@Test @Test(timeout=300_000)
fun `check that function returns all values`() { fun `check that function returns all values`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
testFunction(commands, null, null) testFunction(commands, null, null)
assertEquals(2, commands.size) assertEquals(2, commands.size)
@ -132,8 +132,8 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
assertTrue(commands.contains(validCommandTwo)) assertTrue(commands.contains(validCommandTwo))
} }
@Test @Test(timeout=300_000)
fun `check that function does not return invalid command types`() { fun `check that function does not return invalid command types`() {
val commands = listOf(validCommandOne, invalidCommand) val commands = listOf(validCommandOne, invalidCommand)
val filteredCommands = testFunction(commands, null, null).toList() val filteredCommands = testFunction(commands, null, null).toList()
assertEquals(1, filteredCommands.size) assertEquals(1, filteredCommands.size)
@ -141,8 +141,8 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
assertFalse(filteredCommands.contains(invalidCommand)) assertFalse(filteredCommands.contains(invalidCommand))
} }
@Test @Test(timeout=300_000)
fun `check that function returns commands from valid signers`() { fun `check that function returns commands from valid signers`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
val filteredCommands = testFunction(commands, listOf(megaCorp.publicKey), null).toList() val filteredCommands = testFunction(commands, listOf(megaCorp.publicKey), null).toList()
assertEquals(2, filteredCommands.size) assertEquals(2, filteredCommands.size)
@ -150,8 +150,8 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
assertTrue(filteredCommands.contains(validCommandTwo)) assertTrue(filteredCommands.contains(validCommandTwo))
} }
@Test @Test(timeout=300_000)
fun `check that function returns commands from all valid signers`() { fun `check that function returns commands from all valid signers`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
val filteredCommands = testFunction(commands, listOf(miniCorp.publicKey, megaCorp.publicKey), null).toList() val filteredCommands = testFunction(commands, listOf(miniCorp.publicKey, megaCorp.publicKey), null).toList()
assertEquals(1, filteredCommands.size) assertEquals(1, filteredCommands.size)
@ -159,8 +159,8 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
assertFalse(filteredCommands.contains(validCommandTwo)) assertFalse(filteredCommands.contains(validCommandTwo))
} }
@Test @Test(timeout=300_000)
fun `check that function returns commands from valid parties`() { fun `check that function returns commands from valid parties`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
val filteredCommands = testFunction(commands, null, listOf(megaCorp.party)).toList() val filteredCommands = testFunction(commands, null, listOf(megaCorp.party)).toList()
assertEquals(2, filteredCommands.size) assertEquals(2, filteredCommands.size)
@ -168,8 +168,8 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
assertTrue(filteredCommands.contains(validCommandTwo)) assertTrue(filteredCommands.contains(validCommandTwo))
} }
@Test @Test(timeout=300_000)
fun `check that function returns commands from all valid parties`() { fun `check that function returns commands from all valid parties`() {
val commands = listOf(validCommandOne, validCommandTwo) val commands = listOf(validCommandOne, validCommandTwo)
val filteredCommands = testFunction(commands, null, listOf(miniCorp.party, megaCorp.party)).toList() val filteredCommands = testFunction(commands, null, listOf(miniCorp.party, megaCorp.party)).toList()
assertEquals(1, filteredCommands.size) assertEquals(1, filteredCommands.size)

View File

@ -54,8 +54,8 @@ class PackageOwnershipVerificationTests {
) )
) )
@Test @Test(timeout=300_000)
fun `Happy path - Transaction validates when package signed by owner`() { fun `Happy path - Transaction validates when package signed by owner`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
attachment(DUMMY_CONTRACT, SecureHash.allOnesHash, listOf(OWNER_KEY_PAIR.public)) attachment(DUMMY_CONTRACT, SecureHash.allOnesHash, listOf(OWNER_KEY_PAIR.public))
@ -66,8 +66,8 @@ class PackageOwnershipVerificationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Transaction validation fails when the selected attachment is not signed by the owner`() { fun `Transaction validation fails when the selected attachment is not signed by the owner`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
attachment(DUMMY_CONTRACT, SecureHash.allOnesHash, listOf(ALICE_PUBKEY)) attachment(DUMMY_CONTRACT, SecureHash.allOnesHash, listOf(ALICE_PUBKEY))
@ -78,8 +78,8 @@ class PackageOwnershipVerificationTests {
} }
} }
@Test @Test(timeout=300_000)
fun `packages that do not have contracts in are still ownable`() { fun `packages that do not have contracts in are still ownable`() {
// The first version of this feature was incorrectly concerned with contract classes and only contract // The first version of this feature was incorrectly concerned with contract classes and only contract
// classes, but for the feature to work it must apply to any package. This tests that by using a package // classes, but for the feature to work it must apply to any package. This tests that by using a package
// in isolated.jar that doesn't include any contracts. // in isolated.jar that doesn't include any contracts.

View File

@ -15,8 +15,8 @@ import java.time.ZoneOffset.UTC
class TimeWindowTest { class TimeWindowTest {
private val now = Instant.now() private val now = Instant.now()
@Test @Test(timeout=300_000)
fun fromOnly() { fun fromOnly() {
val timeWindow = TimeWindow.fromOnly(now) val timeWindow = TimeWindow.fromOnly(now)
assertThat(timeWindow.fromTime).isEqualTo(now) assertThat(timeWindow.fromTime).isEqualTo(now)
assertThat(timeWindow.untilTime).isNull() assertThat(timeWindow.untilTime).isNull()
@ -27,8 +27,8 @@ class TimeWindowTest {
assertThat(timeWindow.contains(now + 1.millis)).isTrue() assertThat(timeWindow.contains(now + 1.millis)).isTrue()
} }
@Test @Test(timeout=300_000)
fun untilOnly() { fun untilOnly() {
val timeWindow = TimeWindow.untilOnly(now) val timeWindow = TimeWindow.untilOnly(now)
assertThat(timeWindow.fromTime).isNull() assertThat(timeWindow.fromTime).isNull()
assertThat(timeWindow.untilTime).isEqualTo(now) assertThat(timeWindow.untilTime).isEqualTo(now)
@ -39,8 +39,8 @@ class TimeWindowTest {
assertThat(timeWindow.contains(now + 1.millis)).isFalse() assertThat(timeWindow.contains(now + 1.millis)).isFalse()
} }
@Test @Test(timeout=300_000)
fun between() { fun between() {
val today = LocalDate.now() val today = LocalDate.now()
val fromTime = today.atTime(12, 0).toInstant(UTC) val fromTime = today.atTime(12, 0).toInstant(UTC)
val untilTime = today.atTime(12, 30).toInstant(UTC) val untilTime = today.atTime(12, 30).toInstant(UTC)
@ -56,8 +56,8 @@ class TimeWindowTest {
assertThat(timeWindow.contains(untilTime + 1.millis)).isFalse() assertThat(timeWindow.contains(untilTime + 1.millis)).isFalse()
} }
@Test @Test(timeout=300_000)
fun fromStartAndDuration() { fun fromStartAndDuration() {
val duration = 10.minutes val duration = 10.minutes
val timeWindow = TimeWindow.fromStartAndDuration(now, duration) val timeWindow = TimeWindow.fromStartAndDuration(now, duration)
assertThat(timeWindow.fromTime).isEqualTo(now) assertThat(timeWindow.fromTime).isEqualTo(now)
@ -66,8 +66,8 @@ class TimeWindowTest {
assertThat(timeWindow.length).isEqualTo(duration) assertThat(timeWindow.length).isEqualTo(duration)
} }
@Test @Test(timeout=300_000)
fun withTolerance() { fun withTolerance() {
val tolerance = 10.minutes val tolerance = 10.minutes
val timeWindow = TimeWindow.withTolerance(now, tolerance) val timeWindow = TimeWindow.withTolerance(now, tolerance)
assertThat(timeWindow.fromTime).isEqualTo(now - tolerance) assertThat(timeWindow.fromTime).isEqualTo(now - tolerance)

View File

@ -41,8 +41,8 @@ class TransactionVerificationExceptionSerialisationTests {
private val attachmentHash = SecureHash.allOnesHash private val attachmentHash = SecureHash.allOnesHash
private val factory = defaultFactory() private val factory = defaultFactory()
@Test @Test(timeout=300_000)
fun contractConstraintRejectionTest() { fun contractConstraintRejectionTest() {
val excp = TransactionVerificationException.ContractConstraintRejection(txid, "This is only a test") val excp = TransactionVerificationException.ContractConstraintRejection(txid, "This is only a test")
val excp2 = DeserializationInput(factory).deserialize( val excp2 = DeserializationInput(factory).deserialize(
SerializationOutput(factory).serialize(excp, context), SerializationOutput(factory).serialize(excp, context),
@ -53,8 +53,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(excp.txId, excp2.txId) assertEquals(excp.txId, excp2.txId)
} }
@Test @Test(timeout=300_000)
fun contractRejectionTest() { fun contractRejectionTest() {
class TestContract(val thing: Int) : Contract { class TestContract(val thing: Int) : Contract {
override fun verify(tx: LedgerTransaction) = Unit override fun verify(tx: LedgerTransaction) = Unit
} }
@ -72,8 +72,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun missingAttachmentRejectionTest() { fun missingAttachmentRejectionTest() {
val exception = TransactionVerificationException.MissingAttachmentRejection(txid, "Some contract class") val exception = TransactionVerificationException.MissingAttachmentRejection(txid, "Some contract class")
val exception2 = DeserializationInput(factory).deserialize( val exception2 = DeserializationInput(factory).deserialize(
SerializationOutput(factory).serialize(exception, context), SerializationOutput(factory).serialize(exception, context),
@ -84,8 +84,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun conflictingAttachmentsRejectionTest() { fun conflictingAttachmentsRejectionTest() {
val exception = TransactionVerificationException.ContractConstraintRejection(txid, "Some contract class") val exception = TransactionVerificationException.ContractConstraintRejection(txid, "Some contract class")
val exception2 = DeserializationInput(factory).deserialize( val exception2 = DeserializationInput(factory).deserialize(
SerializationOutput(factory).serialize(exception, context), SerializationOutput(factory).serialize(exception, context),
@ -96,8 +96,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun invalidConstraintRejectionError() { fun invalidConstraintRejectionError() {
val exception = TransactionVerificationException.InvalidConstraintRejection(txid, "Some contract class", "for being too funny") val exception = TransactionVerificationException.InvalidConstraintRejection(txid, "Some contract class", "for being too funny")
val exceptionAfterSerialisation = DeserializationInput(factory).deserialize( val exceptionAfterSerialisation = DeserializationInput(factory).deserialize(
SerializationOutput(factory).serialize(exception, context), SerializationOutput(factory).serialize(exception, context),
@ -110,8 +110,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.reason, exceptionAfterSerialisation.reason) assertEquals(exception.reason, exceptionAfterSerialisation.reason)
} }
@Test @Test(timeout=300_000)
fun contractCreationErrorTest() { fun contractCreationErrorTest() {
val cause = Throwable("wibble") val cause = Throwable("wibble")
val exception = createContractCreationError(txid, "Some contract class", cause) val exception = createContractCreationError(txid, "Some contract class", cause)
val exception2 = DeserializationInput(factory).deserialize( val exception2 = DeserializationInput(factory).deserialize(
@ -123,8 +123,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun transactionMissingEncumbranceTest() { fun transactionMissingEncumbranceTest() {
val exception = TransactionVerificationException.TransactionMissingEncumbranceException( val exception = TransactionVerificationException.TransactionMissingEncumbranceException(
txid, 12, TransactionVerificationException.Direction.INPUT) txid, 12, TransactionVerificationException.Direction.INPUT)
val exception2 = DeserializationInput(factory).deserialize( val exception2 = DeserializationInput(factory).deserialize(
@ -136,8 +136,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun notaryChangeInWrongTransactionTypeTest() { fun notaryChangeInWrongTransactionTypeTest() {
val dummyBankA = TestIdentity(DUMMY_BANK_A_NAME, 40).party val dummyBankA = TestIdentity(DUMMY_BANK_A_NAME, 40).party
val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20).party val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20).party
@ -153,8 +153,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun overlappingAttachmentsExceptionTest() { fun overlappingAttachmentsExceptionTest() {
val exc = TransactionVerificationException.OverlappingAttachmentsException(txid, "foo/bar/baz") val exc = TransactionVerificationException.OverlappingAttachmentsException(txid, "foo/bar/baz")
val exc2 = DeserializationInput(factory).deserialize( val exc2 = DeserializationInput(factory).deserialize(
SerializationOutput(factory).serialize(exc, context), SerializationOutput(factory).serialize(exc, context),
@ -163,8 +163,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exc.message, exc2.message) assertEquals(exc.message, exc2.message)
} }
@Test @Test(timeout=300_000)
fun packageOwnershipExceptionTest() { fun packageOwnershipExceptionTest() {
val exc = TransactionVerificationException.PackageOwnershipException( val exc = TransactionVerificationException.PackageOwnershipException(
txid, txid,
attachmentHash, attachmentHash,
@ -178,8 +178,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exc.message, exc2.message) assertEquals(exc.message, exc2.message)
} }
@Test @Test(timeout=300_000)
fun invalidAttachmentExceptionTest() { fun invalidAttachmentExceptionTest() {
val exc = TransactionVerificationException.InvalidAttachmentException( val exc = TransactionVerificationException.InvalidAttachmentException(
txid, txid,
attachmentHash) attachmentHash)
@ -191,8 +191,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exc.message, exc2.message) assertEquals(exc.message, exc2.message)
} }
@Test @Test(timeout=300_000)
fun untrustedAttachmentsExceptionTest() { fun untrustedAttachmentsExceptionTest() {
val exc = TransactionVerificationException.UntrustedAttachmentsException( val exc = TransactionVerificationException.UntrustedAttachmentsException(
txid, txid,
listOf(attachmentHash)) listOf(attachmentHash))
@ -204,8 +204,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exc.message, exc2.message) assertEquals(exc.message, exc2.message)
} }
@Test @Test(timeout=300_000)
fun transactionNetworkParameterOrderingExceptionTest() { fun transactionNetworkParameterOrderingExceptionTest() {
val exception = TransactionVerificationException.TransactionNetworkParameterOrderingException( val exception = TransactionVerificationException.TransactionNetworkParameterOrderingException(
txid, txid,
StateRef(SecureHash.zeroHash, 1), StateRef(SecureHash.zeroHash, 1),
@ -222,8 +222,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun missingNetworkParametersExceptionTest() { fun missingNetworkParametersExceptionTest() {
val exception = TransactionVerificationException.MissingNetworkParametersException(txid, SecureHash.zeroHash) val exception = TransactionVerificationException.MissingNetworkParametersException(txid, SecureHash.zeroHash)
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)
.deserialize( .deserialize(
@ -236,8 +236,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun constraintPropagationRejectionTest() { fun constraintPropagationRejectionTest() {
val exception = TransactionVerificationException.ConstraintPropagationRejection(txid, "com.test.Contract", val exception = TransactionVerificationException.ConstraintPropagationRejection(txid, "com.test.Contract",
AlwaysAcceptAttachmentConstraint, AlwaysAcceptAttachmentConstraint) AlwaysAcceptAttachmentConstraint, AlwaysAcceptAttachmentConstraint)
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)
@ -252,8 +252,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals("com.test.Contract", exception2.contractClass) assertEquals("com.test.Contract", exception2.contractClass)
} }
@Test @Test(timeout=300_000)
fun transactionDuplicateEncumbranceExceptionTest() { fun transactionDuplicateEncumbranceExceptionTest() {
val exception = TransactionVerificationException.TransactionDuplicateEncumbranceException(txid, 1) val exception = TransactionVerificationException.TransactionDuplicateEncumbranceException(txid, 1)
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)
.deserialize( .deserialize(
@ -266,8 +266,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun transactionNonMatchingEncumbranceExceptionTest() { fun transactionNonMatchingEncumbranceExceptionTest() {
val exception = TransactionVerificationException.TransactionNonMatchingEncumbranceException(txid, listOf(1, 2, 3)) val exception = TransactionVerificationException.TransactionNonMatchingEncumbranceException(txid, listOf(1, 2, 3))
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)
.deserialize( .deserialize(
@ -280,8 +280,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun transactionNotaryMismatchEncumbranceExceptionTest() { fun transactionNotaryMismatchEncumbranceExceptionTest() {
val exception = TransactionVerificationException.TransactionNotaryMismatchEncumbranceException( val exception = TransactionVerificationException.TransactionNotaryMismatchEncumbranceException(
txid, 1, 2, Party(ALICE_NAME, generateKeyPair().public), Party(BOB_NAME, generateKeyPair().public)) txid, 1, 2, Party(ALICE_NAME, generateKeyPair().public), Party(BOB_NAME, generateKeyPair().public))
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)
@ -295,8 +295,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun transactionContractConflictExceptionTest() { fun transactionContractConflictExceptionTest() {
val exception = TransactionVerificationException.TransactionContractConflictException( val exception = TransactionVerificationException.TransactionContractConflictException(
txid, TransactionState(DummyContractState(), notary = Party(BOB_NAME, generateKeyPair().public)), "aa") txid, TransactionState(DummyContractState(), notary = Party(BOB_NAME, generateKeyPair().public)), "aa")
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)
@ -310,8 +310,8 @@ class TransactionVerificationExceptionSerialisationTests {
assertEquals(exception.txId, exception2.txId) assertEquals(exception.txId, exception2.txId)
} }
@Test @Test(timeout=300_000)
fun transactionRequiredContractUnspecifiedExceptionTest() { fun transactionRequiredContractUnspecifiedExceptionTest() {
val exception = TransactionVerificationException.TransactionRequiredContractUnspecifiedException( val exception = TransactionVerificationException.TransactionRequiredContractUnspecifiedException(
txid, TransactionState(DummyContractState(), notary = Party(BOB_NAME, generateKeyPair().public))) txid, TransactionState(DummyContractState(), notary = Party(BOB_NAME, generateKeyPair().public)))
val exception2 = DeserializationInput(factory) val exception2 = DeserializationInput(factory)

View File

@ -49,14 +49,14 @@ class CompositeKeyTests {
private val bobSignature by lazy { bobKey.sign(SignableData(secureHash, SignatureMetadata(1, Crypto.findSignatureScheme(bobPublicKey).schemeNumberID))) } private val bobSignature by lazy { bobKey.sign(SignableData(secureHash, SignatureMetadata(1, Crypto.findSignatureScheme(bobPublicKey).schemeNumberID))) }
private val charlieSignature by lazy { charlieKey.sign(SignableData(secureHash, SignatureMetadata(1, Crypto.findSignatureScheme(charliePublicKey).schemeNumberID))) } private val charlieSignature by lazy { charlieKey.sign(SignableData(secureHash, SignatureMetadata(1, Crypto.findSignatureScheme(charliePublicKey).schemeNumberID))) }
@Test @Test(timeout=300_000)
fun `(Alice) fulfilled by Alice signature`() { fun `(Alice) fulfilled by Alice signature`() {
assertTrue { alicePublicKey.isFulfilledBy(aliceSignature.by) } assertTrue { alicePublicKey.isFulfilledBy(aliceSignature.by) }
assertFalse { alicePublicKey.isFulfilledBy(charlieSignature.by) } assertFalse { alicePublicKey.isFulfilledBy(charlieSignature.by) }
} }
@Test @Test(timeout=300_000)
fun `(Alice or Bob) fulfilled by either signature`() { fun `(Alice or Bob) fulfilled by either signature`() {
val aliceOrBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(threshold = 1) val aliceOrBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(threshold = 1)
assertTrue { aliceOrBob.isFulfilledBy(aliceSignature.by) } assertTrue { aliceOrBob.isFulfilledBy(aliceSignature.by) }
assertTrue { aliceOrBob.isFulfilledBy(bobSignature.by) } assertTrue { aliceOrBob.isFulfilledBy(bobSignature.by) }
@ -64,23 +64,23 @@ class CompositeKeyTests {
assertFalse { aliceOrBob.isFulfilledBy(charlieSignature.by) } assertFalse { aliceOrBob.isFulfilledBy(charlieSignature.by) }
} }
@Test @Test(timeout=300_000)
fun `(Alice and Bob) fulfilled by Alice, Bob signatures`() { fun `(Alice and Bob) fulfilled by Alice, Bob signatures`() {
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build() val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
val signatures = listOf(aliceSignature, bobSignature) val signatures = listOf(aliceSignature, bobSignature)
assertTrue { aliceAndBob.isFulfilledBy(signatures.byKeys()) } assertTrue { aliceAndBob.isFulfilledBy(signatures.byKeys()) }
} }
@Test @Test(timeout=300_000)
fun `(Alice and Bob) requires both signatures to fulfil`() { fun `(Alice and Bob) requires both signatures to fulfil`() {
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build() val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
assertFalse { aliceAndBob.isFulfilledBy(listOf(aliceSignature).byKeys()) } assertFalse { aliceAndBob.isFulfilledBy(listOf(aliceSignature).byKeys()) }
assertFalse { aliceAndBob.isFulfilledBy(listOf(bobSignature).byKeys()) } assertFalse { aliceAndBob.isFulfilledBy(listOf(bobSignature).byKeys()) }
assertTrue { aliceAndBob.isFulfilledBy(listOf(aliceSignature, bobSignature).byKeys()) } assertTrue { aliceAndBob.isFulfilledBy(listOf(aliceSignature, bobSignature).byKeys()) }
} }
@Test @Test(timeout=300_000)
fun `((Alice and Bob) or Charlie) signature verifies`() { fun `((Alice and Bob) or Charlie) signature verifies`() {
// TODO: Look into a DSL for building multi-level composite keys if that becomes a common use case // TODO: Look into a DSL for building multi-level composite keys if that becomes a common use case
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build() val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1) val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1)
@ -90,8 +90,8 @@ class CompositeKeyTests {
assertTrue { aliceAndBobOrCharlie.isFulfilledBy(signatures.byKeys()) } assertTrue { aliceAndBobOrCharlie.isFulfilledBy(signatures.byKeys()) }
} }
@Test @Test(timeout=300_000)
fun `encoded tree decodes correctly`() { fun `encoded tree decodes correctly`() {
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build() val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1) val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1)
@ -101,8 +101,8 @@ class CompositeKeyTests {
assertEquals(decoded, aliceAndBobOrCharlie) assertEquals(decoded, aliceAndBobOrCharlie)
} }
@Test @Test(timeout=300_000)
fun `der encoded tree decodes correctly`() { fun `der encoded tree decodes correctly`() {
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build() val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1) val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1)
@ -112,8 +112,8 @@ class CompositeKeyTests {
assertEquals(decoded, aliceAndBobOrCharlie) assertEquals(decoded, aliceAndBobOrCharlie)
} }
@Test @Test(timeout=300_000)
fun `der encoded tree decodes correctly with weighting`() { fun `der encoded tree decodes correctly with weighting`() {
val aliceAndBob = CompositeKey.Builder() val aliceAndBob = CompositeKey.Builder()
.addKey(alicePublicKey, 2) .addKey(alicePublicKey, 2)
.addKey(bobPublicKey, 1) .addKey(bobPublicKey, 1)
@ -130,8 +130,8 @@ class CompositeKeyTests {
assertEquals(decoded, aliceAndBobOrCharlie) assertEquals(decoded, aliceAndBobOrCharlie)
} }
@Test @Test(timeout=300_000)
fun `tree canonical form`() { fun `tree canonical form`() {
assertEquals(CompositeKey.Builder().addKeys(alicePublicKey).build(), alicePublicKey) assertEquals(CompositeKey.Builder().addKeys(alicePublicKey).build(), alicePublicKey)
val node1 = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(1) // threshold = 1 val node1 = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(1) // threshold = 1
val node2 = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(2) // threshold = 2 val node2 = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(2) // threshold = 2
@ -160,8 +160,8 @@ class CompositeKeyTests {
/** /**
* Check that verifying a composite signature using the [CompositeSignature] engine works. * Check that verifying a composite signature using the [CompositeSignature] engine works.
*/ */
@Test @Test(timeout=300_000)
fun `composite TransactionSignature verification `() { fun `composite TransactionSignature verification `() {
val twoOfThree = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey, charliePublicKey).build(threshold = 2) val twoOfThree = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey, charliePublicKey).build(threshold = 2)
val engine = CompositeSignature() val engine = CompositeSignature()
@ -289,8 +289,8 @@ class CompositeKeyTests {
key1.checkValidity() key1.checkValidity()
} }
@Test @Test(timeout=300_000)
fun `CompositeKey from multiple signature schemes and signature verification`() { fun `CompositeKey from multiple signature schemes and signature verification`() {
val keyPairRSA = Crypto.generateKeyPair(Crypto.RSA_SHA256) val keyPairRSA = Crypto.generateKeyPair(Crypto.RSA_SHA256)
val keyPairK1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256) val keyPairK1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256)
val keyPairR1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256R1_SHA256) val keyPairR1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256R1_SHA256)
@ -313,8 +313,8 @@ class CompositeKeyTests {
assertFalse { compositeKey.isFulfilledBy(signaturesWithoutRSA.byKeys()) } assertFalse { compositeKey.isFulfilledBy(signaturesWithoutRSA.byKeys()) }
} }
@Test @Test(timeout=300_000)
fun `Test save to keystore`() { fun `Test save to keystore`() {
// From test case [CompositeKey from multiple signature schemes and signature verification] // From test case [CompositeKey from multiple signature schemes and signature verification]
val keyPairRSA = Crypto.generateKeyPair(Crypto.RSA_SHA256) val keyPairRSA = Crypto.generateKeyPair(Crypto.RSA_SHA256)
val keyPairK1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256) val keyPairK1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256)
@ -367,8 +367,8 @@ class CompositeKeyTests {
assertEquals(compositeKey, compositeKey2) assertEquals(compositeKey, compositeKey2)
} }
@Test @Test(timeout=300_000)
fun `CompositeKey deterministic children sorting`() { fun `CompositeKey deterministic children sorting`() {
val (_, pub1) = Crypto.generateKeyPair(Crypto.EDDSA_ED25519_SHA512) val (_, pub1) = Crypto.generateKeyPair(Crypto.EDDSA_ED25519_SHA512)
val (_, pub2) = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256) val (_, pub2) = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256)
val (_, pub3) = Crypto.generateKeyPair(Crypto.RSA_SHA256) val (_, pub3) = Crypto.generateKeyPair(Crypto.RSA_SHA256)

View File

@ -100,25 +100,25 @@ class PartialMerkleTreeTest {
} }
// Building full Merkle Tree tests. // Building full Merkle Tree tests.
@Test @Test(timeout=300_000)
fun `building Merkle tree with 6 nodes - no rightmost nodes`() { fun `building Merkle tree with 6 nodes - no rightmost nodes`() {
assertEquals(expectedRoot, merkleTree.hash) assertEquals(expectedRoot, merkleTree.hash)
} }
@Test @Test(timeout=300_000)
fun `building Merkle tree - no hashes`() { fun `building Merkle tree - no hashes`() {
assertFailsWith<MerkleTreeException> { MerkleTree.getMerkleTree(emptyList()) } assertFailsWith<MerkleTreeException> { MerkleTree.getMerkleTree(emptyList()) }
} }
@Test @Test(timeout=300_000)
fun `building Merkle tree one node`() { fun `building Merkle tree one node`() {
val node = 'a'.serialize().sha256() val node = 'a'.serialize().sha256()
val mt = MerkleTree.getMerkleTree(listOf(node)) val mt = MerkleTree.getMerkleTree(listOf(node))
assertEquals(node, mt.hash) assertEquals(node, mt.hash)
} }
@Test @Test(timeout=300_000)
fun `building Merkle tree odd number of nodes`() { fun `building Merkle tree odd number of nodes`() {
val odd = hashed.subList(0, 3) val odd = hashed.subList(0, 3)
val h1 = hashed[0].hashConcat(hashed[1]) val h1 = hashed[0].hashConcat(hashed[1])
val h2 = hashed[2].hashConcat(zeroHash) val h2 = hashed[2].hashConcat(zeroHash)
@ -127,8 +127,8 @@ class PartialMerkleTreeTest {
assertEquals(mt.hash, expected) assertEquals(mt.hash, expected)
} }
@Test @Test(timeout=300_000)
fun `check full tree`() { fun `check full tree`() {
val h = SecureHash.randomSHA256() val h = SecureHash.randomSHA256()
val left = MerkleTree.Node(h, MerkleTree.Node(h, MerkleTree.Leaf(h), MerkleTree.Leaf(h)), val left = MerkleTree.Node(h, MerkleTree.Node(h, MerkleTree.Leaf(h), MerkleTree.Leaf(h)),
MerkleTree.Node(h, MerkleTree.Leaf(h), MerkleTree.Leaf(h))) MerkleTree.Node(h, MerkleTree.Leaf(h), MerkleTree.Leaf(h)))
@ -139,8 +139,8 @@ class PartialMerkleTreeTest {
PartialMerkleTree.build(MerkleTree.Leaf(h), listOf(h)) // Just a leaf. PartialMerkleTree.build(MerkleTree.Leaf(h), listOf(h)) // Just a leaf.
} }
@Test @Test(timeout=300_000)
fun `building Merkle tree for a tx and nonce test`() { fun `building Merkle tree for a tx and nonce test`() {
fun filtering(elem: Any): Boolean { fun filtering(elem: Any): Boolean {
return when (elem) { return when (elem) {
is StateRef -> true is StateRef -> true
@ -171,8 +171,8 @@ class PartialMerkleTreeTest {
ftx.verify() ftx.verify()
} }
@Test @Test(timeout=300_000)
fun `same transactions with different notaries have different ids`() { fun `same transactions with different notaries have different ids`() {
// We even use the same privacySalt, and thus the only difference between the two transactions is the notary party. // We even use the same privacySalt, and thus the only difference between the two transactions is the notary party.
val privacySalt = PrivacySalt() val privacySalt = PrivacySalt()
val wtx1 = makeSimpleCashWtx(DUMMY_NOTARY, privacySalt) val wtx1 = makeSimpleCashWtx(DUMMY_NOTARY, privacySalt)
@ -181,8 +181,8 @@ class PartialMerkleTreeTest {
assertNotEquals(wtx1.id, wtx2.id) assertNotEquals(wtx1.id, wtx2.id)
} }
@Test @Test(timeout=300_000)
fun `nothing filtered`() { fun `nothing filtered`() {
val ftxNothing = testTx.buildFilteredTransaction(Predicate { false }) val ftxNothing = testTx.buildFilteredTransaction(Predicate { false })
assertTrue(ftxNothing.componentGroups.isEmpty()) assertTrue(ftxNothing.componentGroups.isEmpty())
assertTrue(ftxNothing.attachments.isEmpty()) assertTrue(ftxNothing.attachments.isEmpty())
@ -197,57 +197,57 @@ class PartialMerkleTreeTest {
} }
// Partial Merkle Tree building tests. // Partial Merkle Tree building tests.
@Test @Test(timeout=300_000)
fun `build Partial Merkle Tree, only left nodes branch`() { fun `build Partial Merkle Tree, only left nodes branch`() {
val inclHashes = listOf(hashed[3], hashed[5]) val inclHashes = listOf(hashed[3], hashed[5])
val pmt = PartialMerkleTree.build(merkleTree, inclHashes) val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
assertTrue(pmt.verify(merkleTree.hash, inclHashes)) assertTrue(pmt.verify(merkleTree.hash, inclHashes))
} }
@Test @Test(timeout=300_000)
fun `build Partial Merkle Tree, include zero leaves`() { fun `build Partial Merkle Tree, include zero leaves`() {
val pmt = PartialMerkleTree.build(merkleTree, emptyList()) val pmt = PartialMerkleTree.build(merkleTree, emptyList())
assertTrue(pmt.verify(merkleTree.hash, emptyList())) assertTrue(pmt.verify(merkleTree.hash, emptyList()))
} }
@Test @Test(timeout=300_000)
fun `build Partial Merkle Tree, include all leaves`() { fun `build Partial Merkle Tree, include all leaves`() {
val pmt = PartialMerkleTree.build(merkleTree, hashed) val pmt = PartialMerkleTree.build(merkleTree, hashed)
assertTrue(pmt.verify(merkleTree.hash, hashed)) assertTrue(pmt.verify(merkleTree.hash, hashed))
} }
@Test @Test(timeout=300_000)
fun `build Partial Merkle Tree - duplicate leaves failure`() { fun `build Partial Merkle Tree - duplicate leaves failure`() {
val inclHashes = arrayListOf(hashed[3], hashed[5], hashed[3], hashed[5]) val inclHashes = arrayListOf(hashed[3], hashed[5], hashed[3], hashed[5])
assertFailsWith<MerkleTreeException> { PartialMerkleTree.build(merkleTree, inclHashes) } assertFailsWith<MerkleTreeException> { PartialMerkleTree.build(merkleTree, inclHashes) }
} }
@Test @Test(timeout=300_000)
fun `build Partial Merkle Tree - only duplicate leaves, less included failure`() { fun `build Partial Merkle Tree - only duplicate leaves, less included failure`() {
val leaves = "aaa" val leaves = "aaa"
val hashes = leaves.map { it.serialize().hash } val hashes = leaves.map { it.serialize().hash }
val mt = MerkleTree.getMerkleTree(hashes) val mt = MerkleTree.getMerkleTree(hashes)
assertFailsWith<MerkleTreeException> { PartialMerkleTree.build(mt, hashes.subList(0, 1)) } assertFailsWith<MerkleTreeException> { PartialMerkleTree.build(mt, hashes.subList(0, 1)) }
} }
@Test @Test(timeout=300_000)
fun `verify Partial Merkle Tree - too many leaves failure`() { fun `verify Partial Merkle Tree - too many leaves failure`() {
val inclHashes = arrayListOf(hashed[3], hashed[5]) val inclHashes = arrayListOf(hashed[3], hashed[5])
val pmt = PartialMerkleTree.build(merkleTree, inclHashes) val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
inclHashes.add(hashed[0]) inclHashes.add(hashed[0])
assertFalse(pmt.verify(merkleTree.hash, inclHashes)) assertFalse(pmt.verify(merkleTree.hash, inclHashes))
} }
@Test @Test(timeout=300_000)
fun `verify Partial Merkle Tree - too little leaves failure`() { fun `verify Partial Merkle Tree - too little leaves failure`() {
val inclHashes = arrayListOf(hashed[3], hashed[5], hashed[0]) val inclHashes = arrayListOf(hashed[3], hashed[5], hashed[0])
val pmt = PartialMerkleTree.build(merkleTree, inclHashes) val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
inclHashes.remove(hashed[0]) inclHashes.remove(hashed[0])
assertFalse(pmt.verify(merkleTree.hash, inclHashes)) assertFalse(pmt.verify(merkleTree.hash, inclHashes))
} }
@Test @Test(timeout=300_000)
fun `verify Partial Merkle Tree - duplicate leaves failure`() { fun `verify Partial Merkle Tree - duplicate leaves failure`() {
val mt = MerkleTree.getMerkleTree(hashed.subList(0, 5)) // Odd number of leaves. Last one is duplicated. val mt = MerkleTree.getMerkleTree(hashed.subList(0, 5)) // Odd number of leaves. Last one is duplicated.
val inclHashes = arrayListOf(hashed[3], hashed[4]) val inclHashes = arrayListOf(hashed[3], hashed[4])
val pmt = PartialMerkleTree.build(mt, inclHashes) val pmt = PartialMerkleTree.build(mt, inclHashes)
@ -255,15 +255,15 @@ class PartialMerkleTreeTest {
assertFalse(pmt.verify(mt.hash, inclHashes)) assertFalse(pmt.verify(mt.hash, inclHashes))
} }
@Test @Test(timeout=300_000)
fun `verify Partial Merkle Tree - different leaves failure`() { fun `verify Partial Merkle Tree - different leaves failure`() {
val inclHashes = arrayListOf(hashed[3], hashed[5]) val inclHashes = arrayListOf(hashed[3], hashed[5])
val pmt = PartialMerkleTree.build(merkleTree, inclHashes) val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
assertFalse(pmt.verify(merkleTree.hash, listOf(hashed[2], hashed[4]))) assertFalse(pmt.verify(merkleTree.hash, listOf(hashed[2], hashed[4])))
} }
@Test @Test(timeout=300_000)
fun `verify Partial Merkle Tree - wrong root`() { fun `verify Partial Merkle Tree - wrong root`() {
val inclHashes = listOf(hashed[3], hashed[5]) val inclHashes = listOf(hashed[3], hashed[5])
val pmt = PartialMerkleTree.build(merkleTree, inclHashes) val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
val wrongRoot = hashed[3].hashConcat(hashed[5]) val wrongRoot = hashed[3].hashConcat(hashed[5])
@ -293,8 +293,8 @@ class PartialMerkleTreeTest {
) )
} }
@Test @Test(timeout=300_000)
fun `Find leaf index`() { fun `Find leaf index`() {
// A Merkle tree with 20 leaves. // A Merkle tree with 20 leaves.
val sampleLeaves = IntStream.rangeClosed(0, 19).toList().map { SecureHash.sha256(it.toString()) } val sampleLeaves = IntStream.rangeClosed(0, 19).toList().map { SecureHash.sha256(it.toString()) }
val merkleTree = MerkleTree.getMerkleTree(sampleLeaves) val merkleTree = MerkleTree.getMerkleTree(sampleLeaves)
@ -339,8 +339,8 @@ class PartialMerkleTreeTest {
assertFailsWith<MerkleTreeException> { pmtAllIncluded.leafIndex(SecureHash.sha256("30")) } assertFailsWith<MerkleTreeException> { pmtAllIncluded.leafIndex(SecureHash.sha256("30")) }
} }
@Test @Test(timeout=300_000)
fun `building Merkle for reference states only`() { fun `building Merkle for reference states only`() {
fun filtering(elem: Any): Boolean { fun filtering(elem: Any): Boolean {
return when (elem) { return when (elem) {
is ReferenceStateRef -> true is ReferenceStateRef -> true

View File

@ -25,8 +25,8 @@ class SignedDataTest {
val data = "Just a simple test string" val data = "Just a simple test string"
lateinit var serialized: SerializedBytes<String> lateinit var serialized: SerializedBytes<String>
@Test @Test(timeout=300_000)
fun `make sure correctly signed data is released`() { fun `make sure correctly signed data is released`() {
val keyPair = generateKeyPair() val keyPair = generateKeyPair()
val sig = keyPair.private.sign(serialized.bytes, keyPair.public) val sig = keyPair.private.sign(serialized.bytes, keyPair.public)
val wrappedData = SignedData(serialized, sig) val wrappedData = SignedData(serialized, sig)

View File

@ -21,8 +21,8 @@ class TransactionSignatureTest {
private val testBytes = "12345678901234567890123456789012".toByteArray() private val testBytes = "12345678901234567890123456789012".toByteArray()
/** Valid sign and verify. */ /** Valid sign and verify. */
@Test @Test(timeout=300_000)
fun `Signature metadata full sign and verify`() { fun `Signature metadata full sign and verify`() {
val keyPair = Crypto.generateKeyPair("ECDSA_SECP256K1_SHA256") val keyPair = Crypto.generateKeyPair("ECDSA_SECP256K1_SHA256")
// Create a SignableData object. // Create a SignableData object.
@ -47,8 +47,8 @@ class TransactionSignatureTest {
Crypto.doVerify((testBytes + testBytes).sha256(), transactionSignature) Crypto.doVerify((testBytes + testBytes).sha256(), transactionSignature)
} }
@Test @Test(timeout=300_000)
fun `Verify multi-tx signature`() { fun `Verify multi-tx signature`() {
val keyPair = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, BigInteger.valueOf(1234567890L)) val keyPair = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, BigInteger.valueOf(1234567890L))
// Deterministically create 5 txIds. // Deterministically create 5 txIds.
val txIds: List<SecureHash> = IntRange(0, 4).map { byteArrayOf(it.toByte()).sha256() } val txIds: List<SecureHash> = IntRange(0, 4).map { byteArrayOf(it.toByte()).sha256() }
@ -94,8 +94,8 @@ class TransactionSignatureTest {
} }
} }
@Test @Test(timeout=300_000)
fun `Verify one-tx signature`() { fun `Verify one-tx signature`() {
val keyPair = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, BigInteger.valueOf(1234567890L)) val keyPair = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, BigInteger.valueOf(1234567890L))
val txId = "aTransaction".toByteArray().sha256() val txId = "aTransaction".toByteArray().sha256()
// One-tx signature. // One-tx signature.

View File

@ -57,8 +57,8 @@ class X509NameConstraintsTest {
return Pair(keyStore, trustStore) return Pair(keyStore, trustStore)
} }
@Test @Test(timeout=300_000)
fun `illegal common name`() { fun `illegal common name`() {
val acceptableNames = listOf("CN=Bank A TLS, O=Bank A", "CN=Bank A") val acceptableNames = listOf("CN=Bank A TLS, O=Bank A", "CN=Bank A")
.map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray() .map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray()
@ -92,8 +92,8 @@ class X509NameConstraintsTest {
} }
} }
@Test @Test(timeout=300_000)
fun `x500 name with correct cn and extra attribute`() { fun `x500 name with correct cn and extra attribute`() {
val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A") val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A")
.map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray() .map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray()
@ -135,8 +135,8 @@ class X509NameConstraintsTest {
} }
} }
@Test @Test(timeout=300_000)
fun `test private key retrieval`() { fun `test private key retrieval`() {
val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A") val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A")
.map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray() .map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray()

View File

@ -45,8 +45,8 @@ class AttachmentTests : WithMockNet {
private val bobNode = makeNode(BOB_NAME) private val bobNode = makeNode(BOB_NAME)
private val alice = aliceNode.info.singleIdentity() private val alice = aliceNode.info.singleIdentity()
@Test @Test(timeout=300_000)
fun `download and store`() { fun `download and store`() {
// Insert an attachment into node zero's store directly. // Insert an attachment into node zero's store directly.
val id = aliceNode.importAttachment(fakeAttachment("file1.txt", "Some useful content")) val id = aliceNode.importAttachment(fakeAttachment("file1.txt", "Some useful content"))
@ -67,8 +67,8 @@ class AttachmentTests : WithMockNet {
willReturn(soleAttachment(attachment))) willReturn(soleAttachment(attachment)))
} }
@Test @Test(timeout=300_000)
fun missing() { fun missing() {
val hash: SecureHash = SecureHash.randomSHA256() val hash: SecureHash = SecureHash.randomSHA256()
// Get node one to fetch a non-existent attachment. // Get node one to fetch a non-existent attachment.
@ -82,8 +82,8 @@ class AttachmentTests : WithMockNet {
FetchDataFlow.HashNotFound::requested, FetchDataFlow.HashNotFound::requested,
equalTo(expected)) equalTo(expected))
@Test @Test(timeout=300_000)
fun maliciousResponse() { fun maliciousResponse() {
// Make a node that doesn't do sanity checking at load time. // Make a node that doesn't do sanity checking at load time.
val badAliceNode = makeBadNode(ALICE_NAME) val badAliceNode = makeBadNode(ALICE_NAME)
val badAlice = badAliceNode.info.singleIdentity() val badAlice = badAliceNode.info.singleIdentity()

View File

@ -67,8 +67,8 @@ class CollectSignaturesFlowTests : WithContracts {
private val bob = bobNode.info.singleIdentity() private val bob = bobNode.info.singleIdentity()
private val charlie = charlieNode.info.singleIdentity() private val charlie = charlieNode.info.singleIdentity()
@Test @Test(timeout=300_000)
fun `successfully collects three signatures`() { fun `successfully collects three signatures`() {
val bConfidentialIdentity = bobNode.createConfidentialIdentity(bob) val bConfidentialIdentity = bobNode.createConfidentialIdentity(bob)
aliceNode.verifyAndRegister(bConfidentialIdentity) aliceNode.verifyAndRegister(bConfidentialIdentity)
@ -78,8 +78,8 @@ class CollectSignaturesFlowTests : WithContracts {
) )
} }
@Test @Test(timeout=300_000)
fun `successfully collects signatures when sessions are initiated with AnonymousParty`() { fun `successfully collects signatures when sessions are initiated with AnonymousParty`() {
val aConfidentialIdentity1 = aliceNode.createConfidentialIdentity(alice) val aConfidentialIdentity1 = aliceNode.createConfidentialIdentity(alice)
val bConfidentialIdentity1 = bobNode.createConfidentialIdentity(bob) val bConfidentialIdentity1 = bobNode.createConfidentialIdentity(bob)
val bConfidentialIdentity2 = bobNode.createConfidentialIdentity(bob) val bConfidentialIdentity2 = bobNode.createConfidentialIdentity(bob)
@ -97,8 +97,8 @@ class CollectSignaturesFlowTests : WithContracts {
Assert.assertThat(missingSigners, `is`(emptySet())) Assert.assertThat(missingSigners, `is`(emptySet()))
} }
@Test @Test(timeout=300_000)
fun `successfully collects signatures when sessions are initiated with both AnonymousParty and WellKnownParty`() { fun `successfully collects signatures when sessions are initiated with both AnonymousParty and WellKnownParty`() {
val aConfidentialIdentity1 = aliceNode.createConfidentialIdentity(alice) val aConfidentialIdentity1 = aliceNode.createConfidentialIdentity(alice)
val bConfidentialIdentity1 = bobNode.createConfidentialIdentity(bob) val bConfidentialIdentity1 = bobNode.createConfidentialIdentity(bob)
val bConfidentialIdentity2 = bobNode.createConfidentialIdentity(bob) val bConfidentialIdentity2 = bobNode.createConfidentialIdentity(bob)
@ -142,8 +142,8 @@ class CollectSignaturesFlowTests : WithContracts {
future.getOrThrow() future.getOrThrow()
} }
@Test @Test(timeout=300_000)
fun `it is possible to collect from multiple well known sessions`() { fun `it is possible to collect from multiple well known sessions`() {
bobNode.registerInitiatedFlow(ExtraSessionsFlowResponder::class.java) bobNode.registerInitiatedFlow(ExtraSessionsFlowResponder::class.java)
charlieNode.registerInitiatedFlow(ExtraSessionsFlowResponder::class.java) charlieNode.registerInitiatedFlow(ExtraSessionsFlowResponder::class.java)
val future = aliceNode.startFlow(ExtraSessionsFlow(listOf( val future = aliceNode.startFlow(ExtraSessionsFlow(listOf(
@ -157,8 +157,8 @@ class CollectSignaturesFlowTests : WithContracts {
Assert.assertThat(signedTx.getMissingSigners(), `is`(emptySet())) Assert.assertThat(signedTx.getMissingSigners(), `is`(emptySet()))
} }
@Test @Test(timeout=300_000)
fun `no need to collect any signatures`() { fun `no need to collect any signatures`() {
val ptx = aliceNode.signDummyContract(alice.ref(1)) val ptx = aliceNode.signDummyContract(alice.ref(1))
assertThat( assertThat(
@ -167,8 +167,8 @@ class CollectSignaturesFlowTests : WithContracts {
) )
} }
@Test @Test(timeout=300_000)
fun `fails when not signed by initiator`() { fun `fails when not signed by initiator`() {
val ptx = miniCorpServices.signDummyContract(alice.ref(1)) val ptx = miniCorpServices.signDummyContract(alice.ref(1))
assertThat( assertThat(
@ -176,8 +176,8 @@ class CollectSignaturesFlowTests : WithContracts {
willThrow(errorMessage("The Initiator of CollectSignaturesFlow must have signed the transaction."))) willThrow(errorMessage("The Initiator of CollectSignaturesFlow must have signed the transaction.")))
} }
@Test @Test(timeout=300_000)
fun `passes with multiple initial signatures`() { fun `passes with multiple initial signatures`() {
val signedByA = aliceNode.signDummyContract( val signedByA = aliceNode.signDummyContract(
alice.ref(1), alice.ref(1),
MAGIC_NUMBER, MAGIC_NUMBER,

View File

@ -42,8 +42,8 @@ class ContractUpgradeFlowRPCTest : WithContracts, WithFinality {
private val alice = aliceNode.info.singleIdentity() private val alice = aliceNode.info.singleIdentity()
private val bob = bobNode.info.singleIdentity() private val bob = bobNode.info.singleIdentity()
@Test @Test(timeout=300_000)
fun `2 parties contract upgrade using RPC`() = rpcDriver { fun `2 parties contract upgrade using RPC`() = rpcDriver {
val testUser = createTestUser() val testUser = createTestUser()
val rpcA = startProxy(aliceNode, testUser) val rpcA = startProxy(aliceNode, testUser)
val rpcB = startProxy(bobNode, testUser) val rpcB = startProxy(bobNode, testUser)

View File

@ -46,8 +46,8 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
private val bob = bobNode.info.singleIdentity() private val bob = bobNode.info.singleIdentity()
private val notary = mockNet.defaultNotaryIdentity private val notary = mockNet.defaultNotaryIdentity
@Test @Test(timeout=300_000)
fun `2 parties contract upgrade`() { fun `2 parties contract upgrade`() {
// Create dummy contract. // Create dummy contract.
val signedByA = aliceNode.signDummyContract(alice.ref(1), 0, bob.ref(1)) val signedByA = aliceNode.signDummyContract(alice.ref(1), 0, bob.ref(1))
val stx = bobNode.addSignatureTo(signedByA) val stx = bobNode.addSignatureTo(signedByA)
@ -116,8 +116,8 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
{ it.state.data }, { it.state.data },
expectation) expectation)
@Test @Test(timeout=300_000)
fun `upgrade Cash to v2`() { fun `upgrade Cash to v2`() {
// Create some cash. // Create some cash.
val cashFlowResult = aliceNode.issueCash() val cashFlowResult = aliceNode.issueCash()
val anonymisedRecipient = cashFlowResult.recipient!! val anonymisedRecipient = cashFlowResult.recipient!!

View File

@ -31,8 +31,8 @@ class FastThreadLocalTest {
private val expensiveObjCount = AtomicInteger() private val expensiveObjCount = AtomicInteger()
@Test @Test(timeout=300_000)
fun `ThreadLocal with plain old Thread is fiber-local`() = scheduled(3, ::Thread) { fun `ThreadLocal with plain old Thread is fiber-local`() = scheduled(3, ::Thread) {
val threadLocal = object : ThreadLocal<ExpensiveObj>() { val threadLocal = object : ThreadLocal<ExpensiveObj>() {
override fun initialValue() = ExpensiveObj() override fun initialValue() = ExpensiveObj()
} }
@ -40,8 +40,8 @@ class FastThreadLocalTest {
assertEquals(100, expensiveObjCount.get()) assertEquals(100, expensiveObjCount.get())
} }
@Test @Test(timeout=300_000)
fun `ThreadLocal with FastThreadLocalThread is fiber-local`() = scheduled(3, ::FastThreadLocalThread) { fun `ThreadLocal with FastThreadLocalThread is fiber-local`() = scheduled(3, ::FastThreadLocalThread) {
val threadLocal = object : ThreadLocal<ExpensiveObj>() { val threadLocal = object : ThreadLocal<ExpensiveObj>() {
override fun initialValue() = ExpensiveObj() override fun initialValue() = ExpensiveObj()
} }
@ -49,8 +49,8 @@ class FastThreadLocalTest {
assertEquals(100, expensiveObjCount.get()) assertEquals(100, expensiveObjCount.get())
} }
@Test @Test(timeout=300_000)
fun `FastThreadLocal with plain old Thread is fiber-local`() = scheduled(3, ::Thread) { fun `FastThreadLocal with plain old Thread is fiber-local`() = scheduled(3, ::Thread) {
val threadLocal = object : FastThreadLocal<ExpensiveObj>() { val threadLocal = object : FastThreadLocal<ExpensiveObj>() {
override fun initialValue() = ExpensiveObj() override fun initialValue() = ExpensiveObj()
} }
@ -58,8 +58,8 @@ class FastThreadLocalTest {
assertEquals(100, expensiveObjCount.get()) assertEquals(100, expensiveObjCount.get())
} }
@Test @Test(timeout=300_000)
fun `FastThreadLocal with FastThreadLocalThread is not fiber-local`() = fun `FastThreadLocal with FastThreadLocalThread is not fiber-local`() =
scheduled(3, ::FastThreadLocalThread) { scheduled(3, ::FastThreadLocalThread) {
val threadLocal = object : FastThreadLocal<ExpensiveObj>() { val threadLocal = object : FastThreadLocal<ExpensiveObj>() {
override fun initialValue() = ExpensiveObj() override fun initialValue() = ExpensiveObj()
@ -89,15 +89,15 @@ class FastThreadLocalTest {
private val fail: Nothing by lazy { throw UnsupportedOperationException("Nice try.") } private val fail: Nothing by lazy { throw UnsupportedOperationException("Nice try.") }
} }
@Test @Test(timeout=300_000)
fun `ThreadLocal content is not serialized`() { fun `ThreadLocal content is not serialized`() {
contentIsNotSerialized(object : ThreadLocal<UnserializableObj>() { contentIsNotSerialized(object : ThreadLocal<UnserializableObj>() {
override fun initialValue() = UnserializableObj() override fun initialValue() = UnserializableObj()
}::get) }::get)
} }
@Test @Test(timeout=300_000)
fun `FastThreadLocal content is not serialized`() { fun `FastThreadLocal content is not serialized`() {
contentIsNotSerialized(object : FastThreadLocal<UnserializableObj>() { contentIsNotSerialized(object : FastThreadLocal<UnserializableObj>() {
override fun initialValue() = UnserializableObj() override fun initialValue() = UnserializableObj()
}::get) }::get)

View File

@ -34,8 +34,8 @@ class FinalityFlowTests : WithFinality {
@After @After
fun tearDown() = mockNet.stopNodes() fun tearDown() = mockNet.stopNodes()
@Test @Test(timeout=300_000)
fun `finalise a simple transaction`() { fun `finalise a simple transaction`() {
val bob = createBob() val bob = createBob()
val stx = aliceNode.issuesCashTo(bob) val stx = aliceNode.issuesCashTo(bob)
@ -46,8 +46,8 @@ class FinalityFlowTests : WithFinality {
and visibleTo(bob))) and visibleTo(bob)))
} }
@Test @Test(timeout=300_000)
fun `reject a transaction with unknown parties`() { fun `reject a transaction with unknown parties`() {
// Charlie isn't part of this network, so node A won't recognise them // Charlie isn't part of this network, so node A won't recognise them
val stx = aliceNode.issuesCashTo(CHARLIE) val stx = aliceNode.issuesCashTo(CHARLIE)
@ -56,8 +56,8 @@ class FinalityFlowTests : WithFinality {
willThrow<IllegalArgumentException>()) willThrow<IllegalArgumentException>())
} }
@Test @Test(timeout=300_000)
fun `allow use of the old API if the CorDapp target version is 3`() { fun `allow use of the old API if the CorDapp target version is 3`() {
val oldBob = createBob(cordapps = listOf(tokenOldCordapp())) val oldBob = createBob(cordapps = listOf(tokenOldCordapp()))
val stx = aliceNode.issuesCashTo(oldBob) val stx = aliceNode.issuesCashTo(oldBob)
val resultFuture = CordappResolver.withTestCordapp(targetPlatformVersion = 3) { val resultFuture = CordappResolver.withTestCordapp(targetPlatformVersion = 3) {
@ -68,8 +68,8 @@ class FinalityFlowTests : WithFinality {
assertThat(oldBob.services.validatedTransactions.getTransaction(stx.id)).isNotNull() assertThat(oldBob.services.validatedTransactions.getTransaction(stx.id)).isNotNull()
} }
@Test @Test(timeout=300_000)
fun `broadcasting to both new and old participants`() { fun `broadcasting to both new and old participants`() {
val newCharlie = mockNet.createNode(InternalMockNodeParameters(legalName = CHARLIE_NAME)) val newCharlie = mockNet.createNode(InternalMockNodeParameters(legalName = CHARLIE_NAME))
val oldBob = createBob(cordapps = listOf(tokenOldCordapp())) val oldBob = createBob(cordapps = listOf(tokenOldCordapp()))
val stx = aliceNode.issuesCashTo(oldBob) val stx = aliceNode.issuesCashTo(oldBob)

View File

@ -28,8 +28,8 @@ import kotlin.test.assertTrue
class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() { class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
@Test @Test(timeout=300_000)
fun `external async operation`() { fun `external async operation`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -41,8 +41,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation that checks deduplicationId is not rerun when flow is retried`() { fun `external async operation that checks deduplicationId is not rerun when flow is retried`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -58,8 +58,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation propagates exception to calling flow`() { fun `external async operation propagates exception to calling flow`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -76,8 +76,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation exception can be caught in flow`() { fun `external async operation exception can be caught in flow`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -92,8 +92,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation with exception that hospital keeps for observation does not fail`() { fun `external async operation with exception that hospital keeps for observation does not fail`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -110,8 +110,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation with exception that hospital discharges is retried and runs the future again`() { fun `external async operation with exception that hospital discharges is retried and runs the future again`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -128,8 +128,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation that throws exception rather than completing future exceptionally fails with internal exception`() { fun `external async operation that throws exception rather than completing future exceptionally fails with internal exception`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -143,8 +143,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation that passes serviceHub into process can be retried`() { fun `external async operation that passes serviceHub into process can be retried`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -160,8 +160,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation that accesses serviceHub from flow directly will fail when retried`() { fun `external async operation that accesses serviceHub from flow directly will fail when retried`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -177,8 +177,8 @@ class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `starting multiple futures and joining on their results`() { fun `starting multiple futures and joining on their results`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()

View File

@ -16,8 +16,8 @@ import kotlin.test.assertEquals
class FlowExternalOperationStartFlowTest : AbstractFlowExternalOperationTest() { class FlowExternalOperationStartFlowTest : AbstractFlowExternalOperationTest() {
@Test @Test(timeout=300_000)
fun `starting a flow inside of a flow that starts a future will succeed`() { fun `starting a flow inside of a flow that starts a future will succeed`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -29,8 +29,8 @@ class FlowExternalOperationStartFlowTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `multiple flows can be started and their futures joined from inside a flow`() { fun `multiple flows can be started and their futures joined from inside a flow`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()

View File

@ -35,8 +35,8 @@ import kotlin.test.assertTrue
class FlowExternalOperationTest : AbstractFlowExternalOperationTest() { class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
@Test @Test(timeout=300_000)
fun `external operation`() { fun `external operation`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -48,8 +48,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external operation that checks deduplicationId is not rerun when flow is retried`() { fun `external operation that checks deduplicationId is not rerun when flow is retried`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -65,8 +65,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external operation propagates exception to calling flow`() { fun `external operation propagates exception to calling flow`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -83,8 +83,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external operation exception can be caught in flow`() { fun `external operation exception can be caught in flow`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -96,8 +96,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external operation with exception that hospital keeps for observation does not fail`() { fun `external operation with exception that hospital keeps for observation does not fail`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -114,8 +114,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external operation with exception that hospital discharges is retried and runs the external operation again`() { fun `external operation with exception that hospital discharges is retried and runs the external operation again`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -132,8 +132,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation that passes serviceHub into process can be retried`() { fun `external async operation that passes serviceHub into process can be retried`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -149,8 +149,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external async operation that accesses serviceHub from flow directly will fail when retried`() { fun `external async operation that accesses serviceHub from flow directly will fail when retried`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()
@ -166,8 +166,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `vault can be queried`() { fun `vault can be queried`() {
driver( driver(
DriverParameters( DriverParameters(
cordappsForAllNodes = cordappsForPackages(DummyState::class.packageName), cordappsForAllNodes = cordappsForPackages(DummyState::class.packageName),
@ -181,8 +181,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `data can be persisted to node database via entity manager`() { fun `data can be persisted to node database via entity manager`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsViaEntityManager) val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsViaEntityManager)
@ -191,8 +191,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `data can be persisted to node database via jdbc session`() { fun `data can be persisted to node database via jdbc session`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsViaJdbcSession) val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsViaJdbcSession)
@ -201,8 +201,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `data can be persisted to node database via servicehub database transaction`() { fun `data can be persisted to node database via servicehub database transaction`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsViaDatabaseTransaction) val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsViaDatabaseTransaction)
@ -211,8 +211,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `data can be persisted to node database in external operation and read from another process once finished`() { fun `data can be persisted to node database in external operation and read from another process once finished`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsToDatabaseAndReadsFromExternalOperation) val success = alice.rpc.startFlow(::FlowWithExternalOperationThatPersistsToDatabaseAndReadsFromExternalOperation)
@ -221,8 +221,8 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `external operation can be retried when an error occurs inside of database transaction`() { fun `external operation can be retried when an error occurs inside of database transaction`() {
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) { driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val bob = startNode(providedName = BOB_NAME).getOrThrow() val bob = startNode(providedName = BOB_NAME).getOrThrow()

View File

@ -32,8 +32,8 @@ class ReceiveMultipleFlowTests : WithMockNet {
private val nodes = (0..2).map { mockNet.createPartyNode() } private val nodes = (0..2).map { mockNet.createPartyNode() }
@Test @Test(timeout=300_000)
fun showcase_flows_as_closures() { fun showcase_flows_as_closures() {
val answer = 10.0 val answer = 10.0
val message = "Hello Ivan" val message = "Hello Ivan"
@ -66,8 +66,8 @@ class ReceiveMultipleFlowTests : WithMockNet {
willReturn(answer as Any)) willReturn(answer as Any))
} }
@Test @Test(timeout=300_000)
fun `receive all messages in parallel using map style`() { fun `receive all messages in parallel using map style`() {
val doubleValue = 5.0 val doubleValue = 5.0
nodes[1].registerAnswer(AlgorithmDefinition::class, doubleValue) nodes[1].registerAnswer(AlgorithmDefinition::class, doubleValue)
val stringValue = "Thriller" val stringValue = "Thriller"
@ -78,8 +78,8 @@ class ReceiveMultipleFlowTests : WithMockNet {
willReturn(doubleValue * stringValue.length)) willReturn(doubleValue * stringValue.length))
} }
@Test @Test(timeout=300_000)
fun `receive all messages in parallel using list style`() { fun `receive all messages in parallel using list style`() {
val value1 = 5.0 val value1 = 5.0
nodes[1].registerAnswer(ParallelAlgorithmList::class, value1) nodes[1].registerAnswer(ParallelAlgorithmList::class, value1)
val value2 = 6.0 val value2 = 6.0

View File

@ -33,8 +33,8 @@ class ReceiveFinalityFlowTest {
mockNet.stopNodes() mockNet.stopNodes()
} }
@Test @Test(timeout=300_000)
fun `sent to flow hospital on error and retry on node restart`() { fun `sent to flow hospital on error and retry on node restart`() {
val alice = mockNet.createNode(InternalMockNodeParameters(legalName = ALICE_NAME, additionalCordapps = FINANCE_CORDAPPS)) val alice = mockNet.createNode(InternalMockNodeParameters(legalName = ALICE_NAME, additionalCordapps = FINANCE_CORDAPPS))
// Bob initially does not have the finance contracts CorDapp so that it can throw an exception in ReceiveFinalityFlow when receiving // Bob initially does not have the finance contracts CorDapp so that it can throw an exception in ReceiveFinalityFlow when receiving
// the payment from Alice // the payment from Alice

View File

@ -44,8 +44,8 @@ class ReferencedStatesFlowTests {
mockNet.stopNodes() mockNet.stopNodes()
} }
@Test @Test(timeout=300_000)
fun `with referenced states flow blocks until the reference state update is received`() { fun `with referenced states flow blocks until the reference state update is received`() {
// 1. Create reference state. // 1. Create reference state.
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow() val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single() val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single()
@ -70,8 +70,8 @@ class ReferencedStatesFlowTests {
assertEquals(updatedRefState.ref, result.tx.references.single()) assertEquals(updatedRefState.ref, result.tx.references.single())
} }
@Test @Test(timeout=300_000)
fun `check ref state is persisted when used in tx with relevant states`() { fun `check ref state is persisted when used in tx with relevant states`() {
// 1. Create a state to be used as a reference state. Don't share it. // 1. Create a state to be used as a reference state. Don't share it.
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow() val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single() val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single()
@ -102,8 +102,8 @@ class ReferencedStatesFlowTests {
assertEquals(newRefState, theReferencedStateAgain.states.single()) assertEquals(newRefState, theReferencedStateAgain.states.single())
} }
@Test @Test(timeout=300_000)
fun `check schema mappings are updated for reference states`() { fun `check schema mappings are updated for reference states`() {
// 1. Create a state to be used as a reference state. Don't share it. // 1. Create a state to be used as a reference state. Don't share it.
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow() val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single() val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single()
@ -118,8 +118,8 @@ class ReferencedStatesFlowTests {
assertEquals(2, allRefStates.states.size) assertEquals(2, allRefStates.states.size)
} }
@Test @Test(timeout=300_000)
fun `check old ref state is consumed when update used in tx with relevant states`() { fun `check old ref state is consumed when update used in tx with relevant states`() {
// 1. Create a state to be used as a reference state. Don't share it. // 1. Create a state to be used as a reference state. Don't share it.
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow() val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single() val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single()
@ -170,8 +170,8 @@ class ReferencedStatesFlowTests {
assertEquals(Vault.StateStatus.CONSUMED, theOriginalReferencedStateOnNodeZero.statesMetadata.single().status) assertEquals(Vault.StateStatus.CONSUMED, theOriginalReferencedStateOnNodeZero.statesMetadata.single().status)
} }
@Test @Test(timeout=300_000)
fun `check consumed reference state is found if a transaction refers to it`() { fun `check consumed reference state is found if a transaction refers to it`() {
// 1. Create a state to be used as a reference state. Don't share it. // 1. Create a state to be used as a reference state. Don't share it.
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow() val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single() val newRefState = newRefTx.tx.outRefsOfType<RefState.State>().single()

View File

@ -24,14 +24,14 @@ class PartyAndCertificateTest {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule() val testSerialization = SerializationEnvironmentRule()
@Test @Test(timeout=300_000)
fun `reject a path with no roles`() { fun `reject a path with no roles`() {
val path = X509Utilities.buildCertPath(DEV_ROOT_CA.certificate) val path = X509Utilities.buildCertPath(DEV_ROOT_CA.certificate)
assertFailsWith<IllegalArgumentException> { PartyAndCertificate(path) } assertFailsWith<IllegalArgumentException> { PartyAndCertificate(path) }
} }
@Test @Test(timeout=300_000)
fun `kryo serialisation`() { fun `kryo serialisation`() {
val original = getTestPartyAndCertificate(Party( val original = getTestPartyAndCertificate(Party(
CordaX500Name(organisation = "Test Corp", locality = "Madrid", country = "ES"), CordaX500Name(organisation = "Test Corp", locality = "Madrid", country = "ES"),
entropyToKeyPair(BigInteger.valueOf(83)).public)) entropyToKeyPair(BigInteger.valueOf(83)).public))
@ -41,8 +41,8 @@ class PartyAndCertificateTest {
assertThat(copy.certificate).isEqualTo(original.certificate) assertThat(copy.certificate).isEqualTo(original.certificate)
} }
@Test @Test(timeout=300_000)
fun `jdk serialization`() { fun `jdk serialization`() {
val identity = getTestPartyAndCertificate(Party( val identity = getTestPartyAndCertificate(Party(
CordaX500Name(organisation = "Test Corp", locality = "Madrid", country = "ES"), CordaX500Name(organisation = "Test Corp", locality = "Madrid", country = "ES"),
entropyToKeyPair(BigInteger.valueOf(83)).public)) entropyToKeyPair(BigInteger.valueOf(83)).public))

View File

@ -11,8 +11,8 @@ import kotlin.test.assertEquals
import kotlin.test.assertNotEquals import kotlin.test.assertNotEquals
class PartyTest { class PartyTest {
@Test @Test(timeout=300_000)
fun equality() { fun equality() {
val key = entropyToKeyPair(BigInteger.valueOf(20170207L)).public val key = entropyToKeyPair(BigInteger.valueOf(20170207L)).public
val differentKey = entropyToKeyPair(BigInteger.valueOf(7201702L)).public val differentKey = entropyToKeyPair(BigInteger.valueOf(7201702L)).public
val anonymousParty = AnonymousParty(key) val anonymousParty = AnonymousParty(key)

View File

@ -10,15 +10,15 @@ import javax.security.auth.x500.X500Principal
import kotlin.test.* import kotlin.test.*
class CertRoleTests { class CertRoleTests {
@Test @Test(timeout=300_000)
fun `should deserialize valid value`() { fun `should deserialize valid value`() {
val expected = CertRole.DOORMAN_CA val expected = CertRole.DOORMAN_CA
val actual = CertRole.getInstance(ASN1Integer(1L)) val actual = CertRole.getInstance(ASN1Integer(1L))
assertEquals(expected, actual) assertEquals(expected, actual)
} }
@Test @Test(timeout=300_000)
fun `should reject invalid values`() { fun `should reject invalid values`() {
// Below the lowest used value // Below the lowest used value
assertFailsWith<IllegalArgumentException> { CertRole.getInstance(ASN1Integer(0L)) } assertFailsWith<IllegalArgumentException> { CertRole.getInstance(ASN1Integer(0L)) }
// Outside of the array size, but a valid integer // Outside of the array size, but a valid integer
@ -27,8 +27,8 @@ class CertRoleTests {
assertFailsWith<IllegalArgumentException> { CertRole.getInstance(ASN1Integer(Integer.MAX_VALUE + 1L)) } assertFailsWith<IllegalArgumentException> { CertRole.getInstance(ASN1Integer(Integer.MAX_VALUE + 1L)) }
} }
@Test @Test(timeout=300_000)
fun `check cert roles verify for various cert hierarchies`() { fun `check cert roles verify for various cert hierarchies`() {
// Testing for various certificate hierarchies (with or without NodeCA). // Testing for various certificate hierarchies (with or without NodeCA).
// ROOT -> Intermediate Root -> Doorman -> NodeCA -> Legal Identity cert -> Confidential key cert // ROOT -> Intermediate Root -> Doorman -> NodeCA -> Legal Identity cert -> Confidential key cert

View File

@ -111,8 +111,8 @@ class NetworkParametersResolutionTest {
return Pair(dummy1, dummy2) return Pair(dummy1, dummy2)
} }
@Test @Test(timeout=300_000)
fun `parameters all null`() { fun `parameters all null`() {
val (stx1, stx2) = makeTransactions(null, null) val (stx1, stx2) = makeTransactions(null, null)
assertThat(stx1.networkParametersHash).isNull() assertThat(stx1.networkParametersHash).isNull()
assertThat(stx2.networkParametersHash).isNull() assertThat(stx2.networkParametersHash).isNull()
@ -126,8 +126,8 @@ class NetworkParametersResolutionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `transaction chain out of order parameters`() { fun `transaction chain out of order parameters`() {
val hash2 = params2.serialize().hash val hash2 = params2.serialize().hash
val hash3 = params3.serialize().hash val hash3 = params3.serialize().hash
val (stx1, stx2) = makeTransactions(params3, params2) val (stx1, stx2) = makeTransactions(params3, params2)
@ -151,8 +151,8 @@ class NetworkParametersResolutionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `request parameters that are not in the storage`() { fun `request parameters that are not in the storage`() {
val hash1 = defaultParams.serialize().hash val hash1 = defaultParams.serialize().hash
val hash2 = params2.serialize().hash val hash2 = params2.serialize().hash
// Create two transactions on megaCorpNode // Create two transactions on megaCorpNode
@ -175,8 +175,8 @@ class NetworkParametersResolutionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `transaction chain out of order parameters with default`() { fun `transaction chain out of order parameters with default`() {
val hash3 = params3.serialize().hash val hash3 = params3.serialize().hash
// stx1 with epoch 3 -> stx2 with default epoch, which is 1 // stx1 with epoch 3 -> stx2 with default epoch, which is 1
val (stx1, stx2) = makeTransactions(params3, null) val (stx1, stx2) = makeTransactions(params3, null)
@ -196,8 +196,8 @@ class NetworkParametersResolutionTest {
} }
} }
@Test @Test(timeout=300_000)
fun `incorrect triangle of transactions`() { fun `incorrect triangle of transactions`() {
// stx1 with epoch 2, stx2 with epoch 1, stx3 with epoch 3 // stx1 with epoch 2, stx2 with epoch 1, stx3 with epoch 3
// stx1 -> stx2, stx1 -> stx3, stx2 -> stx3 // stx1 -> stx2, stx1 -> stx3, stx2 -> stx3
val stx1 = makeTransactions(params2, null).first val stx1 = makeTransactions(params2, null).first

View File

@ -84,8 +84,8 @@ class ResolveTransactionsFlowTest {
// DOCEND 3 // DOCEND 3
// DOCSTART 1 // DOCSTART 1
@Test @Test(timeout=300_000)
fun `resolve from two hashes`() { fun `resolve from two hashes`() {
val (stx1, stx2) = makeTransactions() val (stx1, stx2) = makeTransactions()
val p = TestFlow(setOf(stx2.id), megaCorp) val p = TestFlow(setOf(stx2.id), megaCorp)
val future = miniCorpNode.startFlow(p) val future = miniCorpNode.startFlow(p)
@ -98,8 +98,8 @@ class ResolveTransactionsFlowTest {
} }
// DOCEND 1 // DOCEND 1
@Test @Test(timeout=300_000)
fun `dependency with an error`() { fun `dependency with an error`() {
val stx = makeTransactions(signFirstTX = false).second val stx = makeTransactions(signFirstTX = false).second
val p = TestFlow(setOf(stx.id), megaCorp) val p = TestFlow(setOf(stx.id), megaCorp)
val future = miniCorpNode.startFlow(p) val future = miniCorpNode.startFlow(p)
@ -107,8 +107,8 @@ class ResolveTransactionsFlowTest {
assertFailsWith(SignedTransaction.SignaturesMissingException::class) { future.getOrThrow() } assertFailsWith(SignedTransaction.SignaturesMissingException::class) { future.getOrThrow() }
} }
@Test @Test(timeout=300_000)
fun `resolve from a signed transaction`() { fun `resolve from a signed transaction`() {
val (stx1, stx2) = makeTransactions() val (stx1, stx2) = makeTransactions()
val p = TestFlow(stx2, megaCorp) val p = TestFlow(stx2, megaCorp)
val future = miniCorpNode.startFlow(p) val future = miniCorpNode.startFlow(p)
@ -121,8 +121,8 @@ class ResolveTransactionsFlowTest {
} }
} }
@Test @Test(timeout=300_000)
fun `triangle of transactions resolves fine`() { fun `triangle of transactions resolves fine`() {
val stx1 = makeTransactions().first val stx1 = makeTransactions().first
val stx2 = DummyContract.move(stx1.tx.outRef(0), miniCorp).let { builder -> val stx2 = DummyContract.move(stx1.tx.outRef(0), miniCorp).let { builder ->
@ -149,8 +149,8 @@ class ResolveTransactionsFlowTest {
future.getOrThrow() future.getOrThrow()
} }
@Test @Test(timeout=300_000)
fun attachment() { fun attachment() {
fun makeJar(): InputStream { fun makeJar(): InputStream {
val bs = ByteArrayOutputStream() val bs = ByteArrayOutputStream()
val jar = JarOutputStream(bs) val jar = JarOutputStream(bs)
@ -176,8 +176,8 @@ class ResolveTransactionsFlowTest {
} }
} }
@Test @Test(timeout=300_000)
fun `Requesting a transaction while having the right to see it succeeds`() { fun `Requesting a transaction while having the right to see it succeeds`() {
val (_, stx2) = makeTransactions() val (_, stx2) = makeTransactions()
val p = TestNoRightsVendingFlow(miniCorp, toVend = stx2, toRequest = stx2) val p = TestNoRightsVendingFlow(miniCorp, toVend = stx2, toRequest = stx2)
val future = megaCorpNode.startFlow(p) val future = megaCorpNode.startFlow(p)
@ -185,8 +185,8 @@ class ResolveTransactionsFlowTest {
future.getOrThrow() future.getOrThrow()
} }
@Test @Test(timeout=300_000)
fun `Requesting a transaction without having the right to see it results in exception`() { fun `Requesting a transaction without having the right to see it results in exception`() {
val (_, stx2) = makeTransactions() val (_, stx2) = makeTransactions()
val (_, stx3) = makeTransactions() val (_, stx3) = makeTransactions()
val p = TestNoRightsVendingFlow(miniCorp, toVend = stx2, toRequest = stx3) val p = TestNoRightsVendingFlow(miniCorp, toVend = stx2, toRequest = stx3)
@ -195,8 +195,8 @@ class ResolveTransactionsFlowTest {
assertFailsWith<FetchDataFlow.IllegalTransactionRequest> { future.getOrThrow() } assertFailsWith<FetchDataFlow.IllegalTransactionRequest> { future.getOrThrow() }
} }
@Test @Test(timeout=300_000)
fun `Requesting a transaction twice results in exception`() { fun `Requesting a transaction twice results in exception`() {
val (_, stx2) = makeTransactions() val (_, stx2) = makeTransactions()
val p = TestResolveTwiceVendingFlow(miniCorp, stx2) val p = TestResolveTwiceVendingFlow(miniCorp, stx2)
val future = megaCorpNode.startFlow(p) val future = megaCorpNode.startFlow(p)
@ -204,8 +204,8 @@ class ResolveTransactionsFlowTest {
assertFailsWith<FetchDataFlow.IllegalTransactionRequest> { future.getOrThrow() } assertFailsWith<FetchDataFlow.IllegalTransactionRequest> { future.getOrThrow() }
} }
@Test @Test(timeout=300_000)
fun `resolution works when transaction in chain is already resolved`() { fun `resolution works when transaction in chain is already resolved`() {
val (tx1, tx2) = makeTransactions() val (tx1, tx2) = makeTransactions()
miniCorpNode.transaction { miniCorpNode.transaction {
miniCorpNode.services.recordTransactions(tx1) miniCorpNode.services.recordTransactions(tx1)
@ -217,8 +217,8 @@ class ResolveTransactionsFlowTest {
future.getOrThrow() future.getOrThrow()
} }
@Test @Test(timeout=300_000)
fun `can resolve a chain of transactions containing a notary change transaction`() { fun `can resolve a chain of transactions containing a notary change transaction`() {
val tx = notaryChangeChain() val tx = notaryChangeChain()
var numUpdates = 0 var numUpdates = 0
var notaryChangeTxSeen = false var notaryChangeTxSeen = false
@ -234,8 +234,8 @@ class ResolveTransactionsFlowTest {
assertTrue(notaryChangeTxSeen) assertTrue(notaryChangeTxSeen)
} }
@Test @Test(timeout=300_000)
fun `can resolve a chain of transactions containing a contract upgrade transaction`() { fun `can resolve a chain of transactions containing a contract upgrade transaction`() {
val tx = contractUpgradeChain() val tx = contractUpgradeChain()
var numUpdates = 0 var numUpdates = 0
var upgradeTxSeen = false var upgradeTxSeen = false
@ -252,8 +252,8 @@ class ResolveTransactionsFlowTest {
} }
// Used for checking larger chains resolve correctly. Note that this takes a long time to run, and so is not suitable for a CI gate. // Used for checking larger chains resolve correctly. Note that this takes a long time to run, and so is not suitable for a CI gate.
@Test @Test(timeout=300_000)
@Ignore @Ignore
fun `Can resolve large chain of transactions`() { fun `Can resolve large chain of transactions`() {
val txToResolve = makeLargeTransactionChain(2500) val txToResolve = makeLargeTransactionChain(2500)
val p = TestFlow(txToResolve, megaCorp) val p = TestFlow(txToResolve, megaCorp)

View File

@ -43,8 +43,8 @@ class NetworkParametersTest {
} }
// Minimum Platform Version tests // Minimum Platform Version tests
@Test @Test(timeout=300_000)
fun `node shutdowns when on lower platform version than network`() { fun `node shutdowns when on lower platform version than network`() {
val alice = mockNet.createUnstartedNode(InternalMockNodeParameters(legalName = ALICE_NAME, forcedID = 100, version = MOCK_VERSION_INFO.copy(platformVersion = 1))) val alice = mockNet.createUnstartedNode(InternalMockNodeParameters(legalName = ALICE_NAME, forcedID = 100, version = MOCK_VERSION_INFO.copy(platformVersion = 1)))
val aliceDirectory = mockNet.baseDirectory(100) val aliceDirectory = mockNet.baseDirectory(100)
val netParams = testNetworkParameters( val netParams = testNetworkParameters(
@ -54,8 +54,8 @@ class NetworkParametersTest {
assertThatThrownBy { alice.start() }.hasMessageContaining("platform version") assertThatThrownBy { alice.start() }.hasMessageContaining("platform version")
} }
@Test @Test(timeout=300_000)
fun `node works fine when on higher platform version`() { fun `node works fine when on higher platform version`() {
val alice = mockNet.createUnstartedNode(InternalMockNodeParameters(legalName = ALICE_NAME, forcedID = 100, version = MOCK_VERSION_INFO.copy(platformVersion = 2))) val alice = mockNet.createUnstartedNode(InternalMockNodeParameters(legalName = ALICE_NAME, forcedID = 100, version = MOCK_VERSION_INFO.copy(platformVersion = 2)))
val aliceDirectory = mockNet.baseDirectory(100) val aliceDirectory = mockNet.baseDirectory(100)
val netParams = testNetworkParameters( val netParams = testNetworkParameters(
@ -65,8 +65,8 @@ class NetworkParametersTest {
alice.start() alice.start()
} }
@Test @Test(timeout=300_000)
fun `that we can copy while preserving the event horizon`() { fun `that we can copy while preserving the event horizon`() {
// this is defensive tests in response to CORDA-2769 // this is defensive tests in response to CORDA-2769
val aliceNotaryParty = TestIdentity(ALICE_NAME).party val aliceNotaryParty = TestIdentity(ALICE_NAME).party
val aliceNotaryInfo = NotaryInfo(aliceNotaryParty, false) val aliceNotaryInfo = NotaryInfo(aliceNotaryParty, false)
@ -94,8 +94,8 @@ class NetworkParametersTest {
} }
// Notaries tests // Notaries tests
@Test @Test(timeout=300_000)
fun `choosing notary not specified in network parameters will fail`() { fun `choosing notary not specified in network parameters will fail`() {
val fakeNotary = mockNet.createNode( val fakeNotary = mockNet.createNode(
InternalMockNodeParameters( InternalMockNodeParameters(
legalName = BOB_NAME, legalName = BOB_NAME,
@ -112,8 +112,8 @@ class NetworkParametersTest {
} }
} }
@Test @Test(timeout=300_000)
fun `package ownership checks are correct`() { fun `package ownership checks are correct`() {
val key1 = generateKeyPair().public val key1 = generateKeyPair().public
val key2 = generateKeyPair().public val key2 = generateKeyPair().public

View File

@ -31,14 +31,14 @@ class NodeInfoTests {
) )
} }
@Test @Test(timeout=300_000)
fun `should return true when the X500Name is present on the node`() { fun `should return true when the X500Name is present on the node`() {
assertTrue(testNode.isLegalIdentity(party1.name), "Party 1 must exist on the node") assertTrue(testNode.isLegalIdentity(party1.name), "Party 1 must exist on the node")
assertTrue(testNode.isLegalIdentity(party2.name), "Party 2 must exist on the node") assertTrue(testNode.isLegalIdentity(party2.name), "Party 2 must exist on the node")
} }
@Test @Test(timeout=300_000)
fun `should return false when the X500Name is not present on the node`() { fun `should return false when the X500Name is not present on the node`() {
assertFalse(testNode.isLegalIdentity(TestIdentity.fresh("party3").name), assertFalse(testNode.isLegalIdentity(TestIdentity.fresh("party3").name),
"Party 3 must not exist on the node") "Party 3 must not exist on the node")
} }

View File

@ -41,54 +41,54 @@ class VaultUpdateTests {
private val stateAndRef3 = StateAndRef(TransactionState(DummyState(), DUMMY_PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), stateRef3) private val stateAndRef3 = StateAndRef(TransactionState(DummyState(), DUMMY_PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), stateRef3)
private val stateAndRef4 = StateAndRef(TransactionState(DummyState(), DUMMY_PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), stateRef4) private val stateAndRef4 = StateAndRef(TransactionState(DummyState(), DUMMY_PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), stateRef4)
@Test @Test(timeout=300_000)
fun `nothing plus nothing is nothing`() { fun `nothing plus nothing is nothing`() {
val before = emptyUpdate val before = emptyUpdate
val after = before + emptyUpdate val after = before + emptyUpdate
assertEquals(before, after) assertEquals(before, after)
} }
@Test @Test(timeout=300_000)
fun `something plus nothing is something`() { fun `something plus nothing is something`() {
val before = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3)) val before = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3))
val after = before + emptyUpdate val after = before + emptyUpdate
assertEquals(before, after) assertEquals(before, after)
} }
@Test @Test(timeout=300_000)
fun `nothing plus something is something`() { fun `nothing plus something is something`() {
val before = emptyUpdate val before = emptyUpdate
val after = before + Vault.Update(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3)) val after = before + Vault.Update(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3))
val expected = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3)) val expected = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3))
assertEquals(expected, after) assertEquals(expected, after)
} }
@Test @Test(timeout=300_000)
fun `something plus consume state 0 is something without state 0 output`() { fun `something plus consume state 0 is something without state 0 output`() {
val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1)) val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1))
val after = before + Vault.Update(setOf(stateAndRef0), setOf()) val after = before + Vault.Update(setOf(stateAndRef0), setOf())
val expected = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef1)) val expected = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef1))
assertEquals(expected, after) assertEquals(expected, after)
} }
@Test @Test(timeout=300_000)
fun `something plus produce state 4 is something with additional state 4 output`() { fun `something plus produce state 4 is something with additional state 4 output`() {
val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1)) val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1))
val after = before + Vault.Update(setOf(), setOf(stateAndRef4)) val after = before + Vault.Update(setOf(), setOf(stateAndRef4))
val expected = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1, stateAndRef4)) val expected = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1, stateAndRef4))
assertEquals(expected, after) assertEquals(expected, after)
} }
@Test @Test(timeout=300_000)
fun `something plus consume states 0 and 1, and produce state 4, is something without state 0 and 1 outputs and only state 4 output`() { fun `something plus consume states 0 and 1, and produce state 4, is something without state 0 and 1 outputs and only state 4 output`() {
val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1)) val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1))
val after = before + Vault.Update(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef4)) val after = before + Vault.Update(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef4))
val expected = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef4)) val expected = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef4))
assertEquals(expected, after) assertEquals(expected, after)
} }
@Test @Test(timeout=300_000)
fun `can't combine updates of different types`() { fun `can't combine updates of different types`() {
val regularUpdate = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef4)) val regularUpdate = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef4))
val notaryChangeUpdate = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1), type = Vault.UpdateType.NOTARY_CHANGE) val notaryChangeUpdate = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1), type = Vault.UpdateType.NOTARY_CHANGE)
assertFailsWith<IllegalArgumentException> { regularUpdate + notaryChangeUpdate } assertFailsWith<IllegalArgumentException> { regularUpdate + notaryChangeUpdate }

View File

@ -54,56 +54,56 @@ class MappedSchemasCrossReferenceDetectionTests {
) : PersistentState() ) : PersistentState()
} }
@Test @Test(timeout=300_000)
fun `no cross reference to other schema`() { fun `no cross reference to other schema`() {
assertThat(fieldsFromOtherMappedSchema(GoodSchema)).isEmpty() assertThat(fieldsFromOtherMappedSchema(GoodSchema)).isEmpty()
assertThat(methodsFromOtherMappedSchema(GoodSchema)).isEmpty() assertThat(methodsFromOtherMappedSchema(GoodSchema)).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `cross reference to other schema is detected`() { fun `cross reference to other schema is detected`() {
assertThat(fieldsFromOtherMappedSchema(BadSchema)).isNotEmpty assertThat(fieldsFromOtherMappedSchema(BadSchema)).isNotEmpty
assertThat(methodsFromOtherMappedSchema(BadSchema)).isEmpty() assertThat(methodsFromOtherMappedSchema(BadSchema)).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `cross reference via non JPA field is allowed`() { fun `cross reference via non JPA field is allowed`() {
assertThat(fieldsFromOtherMappedSchema(TrickySchema)).isEmpty() assertThat(fieldsFromOtherMappedSchema(TrickySchema)).isEmpty()
assertThat(methodsFromOtherMappedSchema(TrickySchema)).isEmpty() assertThat(methodsFromOtherMappedSchema(TrickySchema)).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `cross reference via transient field is allowed`() { fun `cross reference via transient field is allowed`() {
assertThat(fieldsFromOtherMappedSchema(PoliteSchema)).isEmpty() assertThat(fieldsFromOtherMappedSchema(PoliteSchema)).isEmpty()
assertThat(methodsFromOtherMappedSchema(PoliteSchema)).isEmpty() assertThat(methodsFromOtherMappedSchema(PoliteSchema)).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `no cross reference to other schema java`() { fun `no cross reference to other schema java`() {
assertThat(fieldsFromOtherMappedSchema(GoodSchemaJavaV1())).isEmpty() assertThat(fieldsFromOtherMappedSchema(GoodSchemaJavaV1())).isEmpty()
assertThat(methodsFromOtherMappedSchema(GoodSchemaJavaV1())).isEmpty() assertThat(methodsFromOtherMappedSchema(GoodSchemaJavaV1())).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `cross reference to other schema is detected java`() { fun `cross reference to other schema is detected java`() {
assertThat(fieldsFromOtherMappedSchema(BadSchemaJavaV1())).isEmpty() assertThat(fieldsFromOtherMappedSchema(BadSchemaJavaV1())).isEmpty()
assertThat(methodsFromOtherMappedSchema(BadSchemaJavaV1())).isNotEmpty assertThat(methodsFromOtherMappedSchema(BadSchemaJavaV1())).isNotEmpty
} }
@Test @Test(timeout=300_000)
fun `cross reference to other schema via field is detected java`() { fun `cross reference to other schema via field is detected java`() {
assertThat(fieldsFromOtherMappedSchema(BadSchemaNoGetterJavaV1())).isNotEmpty assertThat(fieldsFromOtherMappedSchema(BadSchemaNoGetterJavaV1())).isNotEmpty
assertThat(methodsFromOtherMappedSchema(BadSchemaNoGetterJavaV1())).isEmpty() assertThat(methodsFromOtherMappedSchema(BadSchemaNoGetterJavaV1())).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `cross reference via non JPA field is allowed java`() { fun `cross reference via non JPA field is allowed java`() {
assertThat(fieldsFromOtherMappedSchema(TrickySchemaJavaV1())).isEmpty() assertThat(fieldsFromOtherMappedSchema(TrickySchemaJavaV1())).isEmpty()
assertThat(methodsFromOtherMappedSchema(TrickySchemaJavaV1())).isEmpty() assertThat(methodsFromOtherMappedSchema(TrickySchemaJavaV1())).isEmpty()
} }
@Test @Test(timeout=300_000)
fun `cross reference via transient field is allowed java`() { fun `cross reference via transient field is allowed java`() {
assertThat(fieldsFromOtherMappedSchema(PoliteSchemaJavaV1())).isEmpty() assertThat(fieldsFromOtherMappedSchema(PoliteSchemaJavaV1())).isEmpty()
assertThat(methodsFromOtherMappedSchema(PoliteSchemaJavaV1())).isEmpty() assertThat(methodsFromOtherMappedSchema(PoliteSchemaJavaV1())).isEmpty()
} }

View File

@ -169,23 +169,23 @@ class AttachmentSerializationTest {
return (client.smm.allStateMachines[0].stateMachine.resultFuture.apply { mockNet.runNetwork() }.getOrThrow() as ClientResult).attachmentContent return (client.smm.allStateMachines[0].stateMachine.resultFuture.apply { mockNet.runNetwork() }.getOrThrow() as ClientResult).attachmentContent
} }
@Test @Test(timeout=300_000)
fun `custom (and non-persisted) attachment should be saved in checkpoint`() { fun `custom (and non-persisted) attachment should be saved in checkpoint`() {
val attachmentId = SecureHash.sha256("any old data") val attachmentId = SecureHash.sha256("any old data")
launchFlow(CustomAttachmentLogic(serverIdentity, attachmentId, "custom"), 1) launchFlow(CustomAttachmentLogic(serverIdentity, attachmentId, "custom"), 1)
assertEquals("custom", rebootClientAndGetAttachmentContent()) assertEquals("custom", rebootClientAndGetAttachmentContent())
} }
@Test @Test(timeout=300_000)
fun `custom attachment should be saved in checkpoint even if its data was persisted`() { fun `custom attachment should be saved in checkpoint even if its data was persisted`() {
val attachmentId = client.saveAttachment("genuine") val attachmentId = client.saveAttachment("genuine")
launchFlow(CustomAttachmentLogic(serverIdentity, attachmentId, "custom"), 1) launchFlow(CustomAttachmentLogic(serverIdentity, attachmentId, "custom"), 1)
client.hackAttachment(attachmentId, "hacked") // Should not be reloaded, checkAttachmentsOnLoad may cause next line to blow up if client attempts it. client.hackAttachment(attachmentId, "hacked") // Should not be reloaded, checkAttachmentsOnLoad may cause next line to blow up if client attempts it.
assertEquals("custom", rebootClientAndGetAttachmentContent()) assertEquals("custom", rebootClientAndGetAttachmentContent())
} }
@Test @Test(timeout=300_000)
fun `only the hash of a regular attachment should be saved in checkpoint`() { fun `only the hash of a regular attachment should be saved in checkpoint`() {
val attachmentId = client.saveAttachment("genuine") val attachmentId = client.saveAttachment("genuine")
client.attachments.checkAttachmentsOnLoad = false // Cached by AttachmentImpl. client.attachments.checkAttachmentsOnLoad = false // Cached by AttachmentImpl.
launchFlow(OpenAttachmentLogic(serverIdentity, attachmentId), 1) launchFlow(OpenAttachmentLogic(serverIdentity, attachmentId), 1)
@ -193,8 +193,8 @@ class AttachmentSerializationTest {
assertEquals("hacked", rebootClientAndGetAttachmentContent(false)) // Pass in false to allow non-genuine data to be loaded. assertEquals("hacked", rebootClientAndGetAttachmentContent(false)) // Pass in false to allow non-genuine data to be loaded.
} }
@Test @Test(timeout=300_000)
fun `only the hash of a FetchAttachmentsFlow attachment should be saved in checkpoint`() { fun `only the hash of a FetchAttachmentsFlow attachment should be saved in checkpoint`() {
val attachmentId = server.saveAttachment("genuine") val attachmentId = server.saveAttachment("genuine")
launchFlow(FetchAttachmentLogic(serverIdentity, attachmentId), 2, sendData = true) launchFlow(FetchAttachmentLogic(serverIdentity, attachmentId), 2, sendData = true)
client.hackAttachment(attachmentId, "hacked") client.hackAttachment(attachmentId, "hacked")

View File

@ -14,8 +14,8 @@ class CommandsSerializationTests {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule() val testSerialization = SerializationEnvironmentRule()
@Test @Test(timeout=300_000)
fun `test cash move serialization`() { fun `test cash move serialization`() {
val command = Cash.Commands.Move(CommercialPaper::class.java) val command = Cash.Commands.Move(CommercialPaper::class.java)
val copiedCommand = command.serialize().deserialize() val copiedCommand = command.serialize().deserialize()

View File

@ -19,8 +19,8 @@ class NotaryExceptionSerializationTest {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule() val testSerialization = SerializationEnvironmentRule()
@Test @Test(timeout=300_000)
fun testSerializationRoundTrip() { fun testSerializationRoundTrip() {
val txhash = SecureHash.randomSHA256() val txhash = SecureHash.randomSHA256()
val stateHistory: Map<StateRef, StateConsumptionDetails> = mapOf( val stateHistory: Map<StateRef, StateConsumptionDetails> = mapOf(
StateRef(txhash, 0) to StateConsumptionDetails(txhash.sha256()) StateRef(txhash, 0) to StateConsumptionDetails(txhash.sha256())

View File

@ -93,8 +93,8 @@ class TransactionSerializationTests {
tx = TransactionBuilder(DUMMY_NOTARY).withItems(inputState, outputState, changeState, Command(TestCash.Commands.Move(), arrayListOf(MEGA_CORP.owningKey))) tx = TransactionBuilder(DUMMY_NOTARY).withItems(inputState, outputState, changeState, Command(TestCash.Commands.Move(), arrayListOf(MEGA_CORP.owningKey)))
} }
@Test @Test(timeout=300_000)
fun signWireTX() { fun signWireTX() {
val ptx = megaCorpServices.signInitialTransaction(tx) val ptx = megaCorpServices.signInitialTransaction(tx)
val stx = notaryServices.addSignature(ptx) val stx = notaryServices.addSignature(ptx)
@ -111,8 +111,8 @@ class TransactionSerializationTests {
} }
} }
@Test @Test(timeout=300_000)
fun wrongKeys() { fun wrongKeys() {
val ptx = megaCorpServices.signInitialTransaction(tx) val ptx = megaCorpServices.signInitialTransaction(tx)
val stx = notaryServices.addSignature(ptx) val stx = notaryServices.addSignature(ptx)
@ -134,16 +134,16 @@ class TransactionSerializationTests {
} }
} }
@Test @Test(timeout=300_000)
fun timeWindow() { fun timeWindow() {
tx.setTimeWindow(TEST_TX_TIME, 30.seconds) tx.setTimeWindow(TEST_TX_TIME, 30.seconds)
val ptx = megaCorpServices.signInitialTransaction(tx) val ptx = megaCorpServices.signInitialTransaction(tx)
val stx = notaryServices.addSignature(ptx) val stx = notaryServices.addSignature(ptx)
assertEquals(TEST_TX_TIME, stx.tx.timeWindow?.midpoint) assertEquals(TEST_TX_TIME, stx.tx.timeWindow?.midpoint)
} }
@Test @Test(timeout=300_000)
fun storeAndLoadWhenSigning() { fun storeAndLoadWhenSigning() {
val ptx = megaCorpServices.signInitialTransaction(tx) val ptx = megaCorpServices.signInitialTransaction(tx)
ptx.verifySignaturesExcept(DUMMY_NOTARY_KEY.public) ptx.verifySignaturesExcept(DUMMY_NOTARY_KEY.public)
val stored = ptx.serialize() val stored = ptx.serialize()

View File

@ -41,8 +41,8 @@ class AttachmentsClassLoaderSerializationTests {
private val storage = InternalMockAttachmentStorage(MockAttachmentStorage()) private val storage = InternalMockAttachmentStorage(MockAttachmentStorage())
private val attachmentTrustCalculator = NodeAttachmentTrustCalculator(storage, TestingNamedCacheFactory()) private val attachmentTrustCalculator = NodeAttachmentTrustCalculator(storage, TestingNamedCacheFactory())
@Test @Test(timeout=300_000)
fun `Can serialize and deserialize with an attachment classloader`() { fun `Can serialize and deserialize with an attachment classloader`() {
val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party
val MEGA_CORP = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")).party val MEGA_CORP = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")).party
@ -77,8 +77,8 @@ class AttachmentsClassLoaderSerializationTests {
} }
// These tests are not Attachment specific. Should they be removed? // These tests are not Attachment specific. Should they be removed?
@Test @Test(timeout=300_000)
fun `test serialization of SecureHash`() { fun `test serialization of SecureHash`() {
val secureHash = SecureHash.randomSHA256() val secureHash = SecureHash.randomSHA256()
val bytes = secureHash.serialize() val bytes = secureHash.serialize()
val copiedSecuredHash = bytes.deserialize() val copiedSecuredHash = bytes.deserialize()
@ -86,8 +86,8 @@ class AttachmentsClassLoaderSerializationTests {
assertEquals(secureHash, copiedSecuredHash) assertEquals(secureHash, copiedSecuredHash)
} }
@Test @Test(timeout=300_000)
fun `test serialization of OpaqueBytes`() { fun `test serialization of OpaqueBytes`() {
val opaqueBytes = OpaqueBytes("0123456789".toByteArray()) val opaqueBytes = OpaqueBytes("0123456789".toByteArray())
val bytes = opaqueBytes.serialize() val bytes = opaqueBytes.serialize()
val copiedOpaqueBytes = bytes.deserialize() val copiedOpaqueBytes = bytes.deserialize()
@ -95,8 +95,8 @@ class AttachmentsClassLoaderSerializationTests {
assertEquals(opaqueBytes, copiedOpaqueBytes) assertEquals(opaqueBytes, copiedOpaqueBytes)
} }
@Test @Test(timeout=300_000)
fun `test serialization of sub-sequence OpaqueBytes`() { fun `test serialization of sub-sequence OpaqueBytes`() {
val bytesSequence = ByteSequence.of("0123456789".toByteArray(), 3, 2) val bytesSequence = ByteSequence.of("0123456789".toByteArray(), 3, 2)
val bytes = bytesSequence.serialize() val bytes = bytesSequence.serialize()
val copiedBytesSequence = bytes.deserialize() val copiedBytesSequence = bytes.deserialize()

View File

@ -77,15 +77,15 @@ class AttachmentsClassLoaderTests {
attachmentTrustCalculator = NodeAttachmentTrustCalculator(internalStorage, cacheFactory) attachmentTrustCalculator = NodeAttachmentTrustCalculator(internalStorage, cacheFactory)
} }
@Test @Test(timeout=300_000)
fun `Loading AnotherDummyContract without using the AttachmentsClassLoader fails`() { fun `Loading AnotherDummyContract without using the AttachmentsClassLoader fails`() {
assertFailsWith<ClassNotFoundException> { assertFailsWith<ClassNotFoundException> {
Class.forName(ISOLATED_CONTRACT_CLASS_NAME) Class.forName(ISOLATED_CONTRACT_CLASS_NAME)
} }
} }
@Test @Test(timeout=300_000)
fun `Dynamically load AnotherDummyContract from isolated contracts jar using the AttachmentsClassLoader`() { fun `Dynamically load AnotherDummyContract from isolated contracts jar using the AttachmentsClassLoader`() {
val isolatedId = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar") val isolatedId = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
val classloader = createClassloader(isolatedId) val classloader = createClassloader(isolatedId)
@ -94,8 +94,8 @@ class AttachmentsClassLoaderTests {
assertEquals("helloworld", contract.declaredField<Any?>("magicString").value) assertEquals("helloworld", contract.declaredField<Any?>("magicString").value)
} }
@Test @Test(timeout=300_000)
fun `Test non-overlapping contract jar`() { fun `Test non-overlapping contract jar`() {
val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar") val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
val att2 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH_V4.openStream(), "app", "isolated-4.0.jar") val att2 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH_V4.openStream(), "app", "isolated-4.0.jar")
@ -104,8 +104,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Test valid overlapping contract jar`() { fun `Test valid overlapping contract jar`() {
val isolatedId = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar") val isolatedId = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
val signedJar = signContractJar(ISOLATED_CONTRACTS_JAR_PATH, copyFirst = true) val signedJar = signContractJar(ISOLATED_CONTRACTS_JAR_PATH, copyFirst = true)
val isolatedSignedId = importAttachment(signedJar.first.toUri().toURL().openStream(), "app", "isolated-signed.jar") val isolatedSignedId = importAttachment(signedJar.first.toUri().toURL().openStream(), "app", "isolated-signed.jar")
@ -114,8 +114,8 @@ class AttachmentsClassLoaderTests {
createClassloader(listOf(isolatedId, isolatedSignedId)) createClassloader(listOf(isolatedId, isolatedSignedId))
} }
@Test @Test(timeout=300_000)
fun `Test non-overlapping different contract jars`() { fun `Test non-overlapping different contract jars`() {
val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar") val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
val att2 = importAttachment(FINANCE_CONTRACTS_CORDAPP.jarFile.inputStream(), "app", "finance.jar") val att2 = importAttachment(FINANCE_CONTRACTS_CORDAPP.jarFile.inputStream(), "app", "finance.jar")
@ -123,8 +123,8 @@ class AttachmentsClassLoaderTests {
createClassloader(listOf(att1, att2)) createClassloader(listOf(att1, att2))
} }
@Test @Test(timeout=300_000)
fun `Load text resources from AttachmentsClassLoader`() { fun `Load text resources from AttachmentsClassLoader`() {
val att1 = importAttachment(fakeAttachment("file1.txt", "some data").inputStream(), "app", "file1.jar") val att1 = importAttachment(fakeAttachment("file1.txt", "some data").inputStream(), "app", "file1.jar")
val att2 = importAttachment(fakeAttachment("file2.txt", "some other data").inputStream(), "app", "file2.jar") val att2 = importAttachment(fakeAttachment("file2.txt", "some other data").inputStream(), "app", "file2.jar")
@ -136,8 +136,8 @@ class AttachmentsClassLoaderTests {
assertEquals("some other data", txt1) assertEquals("some other data", txt1)
} }
@Test @Test(timeout=300_000)
fun `Test valid overlapping file condition`() { fun `Test valid overlapping file condition`() {
val att1 = importAttachment(fakeAttachment("file1.txt", "same data", "file2.txt", "same other data").inputStream(), "app", "file1.jar") val att1 = importAttachment(fakeAttachment("file1.txt", "same data", "file2.txt", "same other data").inputStream(), "app", "file1.jar")
val att2 = importAttachment(fakeAttachment("file1.txt", "same data", "file3.txt", "same totally different").inputStream(), "app", "file2.jar") val att2 = importAttachment(fakeAttachment("file1.txt", "same data", "file3.txt", "same totally different").inputStream(), "app", "file2.jar")
@ -146,8 +146,8 @@ class AttachmentsClassLoaderTests {
assertEquals("same data", txt) assertEquals("same data", txt)
} }
@Test @Test(timeout=300_000)
fun `No overlapping exception thrown on certain META-INF files`() { fun `No overlapping exception thrown on certain META-INF files`() {
listOf("meta-inf/manifest.mf", "meta-inf/license", "meta-inf/test.dsa", "meta-inf/test.sf").forEach { path -> listOf("meta-inf/manifest.mf", "meta-inf/license", "meta-inf/test.dsa", "meta-inf/test.sf").forEach { path ->
val att1 = importAttachment(fakeAttachment(path, "some data").inputStream(), "app", "file1.jar") val att1 = importAttachment(fakeAttachment(path, "some data").inputStream(), "app", "file1.jar")
val att2 = importAttachment(fakeAttachment(path, "some other data").inputStream(), "app", "file2.jar") val att2 = importAttachment(fakeAttachment(path, "some other data").inputStream(), "app", "file2.jar")
@ -156,16 +156,16 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Overlapping rules for META-INF SerializationWhitelist files`() { fun `Overlapping rules for META-INF SerializationWhitelist files`() {
val att1 = importAttachment(fakeAttachment("meta-inf/services/net.corda.core.serialization.SerializationWhitelist", "some data").inputStream(), "app", "file1.jar") val att1 = importAttachment(fakeAttachment("meta-inf/services/net.corda.core.serialization.SerializationWhitelist", "some data").inputStream(), "app", "file1.jar")
val att2 = importAttachment(fakeAttachment("meta-inf/services/net.corda.core.serialization.SerializationWhitelist", "some other data").inputStream(), "app", "file2.jar") val att2 = importAttachment(fakeAttachment("meta-inf/services/net.corda.core.serialization.SerializationWhitelist", "some other data").inputStream(), "app", "file2.jar")
createClassloader(listOf(att1, att2)) createClassloader(listOf(att1, att2))
} }
@Test @Test(timeout=300_000)
fun `Overlapping rules for META-INF random service files`() { fun `Overlapping rules for META-INF random service files`() {
val att1 = importAttachment(fakeAttachment("meta-inf/services/com.example.something", "some data").inputStream(), "app", "file1.jar") val att1 = importAttachment(fakeAttachment("meta-inf/services/com.example.something", "some data").inputStream(), "app", "file1.jar")
val att2 = importAttachment(fakeAttachment("meta-inf/services/com.example.something", "some other data").inputStream(), "app", "file2.jar") val att2 = importAttachment(fakeAttachment("meta-inf/services/com.example.something", "some other data").inputStream(), "app", "file2.jar")
@ -174,8 +174,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Test overlapping file exception`() { fun `Test overlapping file exception`() {
val att1 = storage.importAttachment(fakeAttachment("file1.txt", "some data").inputStream(), "app", "file1.jar") val att1 = storage.importAttachment(fakeAttachment("file1.txt", "some data").inputStream(), "app", "file1.jar")
val att2 = storage.importAttachment(fakeAttachment("file1.txt", "some other data").inputStream(), "app", "file2.jar") val att2 = storage.importAttachment(fakeAttachment("file1.txt", "some other data").inputStream(), "app", "file2.jar")
@ -184,8 +184,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `partial overlaps not possible`() { fun `partial overlaps not possible`() {
// Cover a previous bug whereby overlap checking had been optimized to only check contract classes, which isn't // Cover a previous bug whereby overlap checking had been optimized to only check contract classes, which isn't
// a valid optimization as code used by the contract class could then be overlapped. // a valid optimization as code used by the contract class could then be overlapped.
val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", ISOLATED_CONTRACTS_JAR_PATH.file) val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", ISOLATED_CONTRACTS_JAR_PATH.file)
@ -195,8 +195,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Check platform independent path handling in attachment jars`() { fun `Check platform independent path handling in attachment jars`() {
val att1 = importAttachment(fakeAttachment("/folder1/foldera/file1.txt", "some data").inputStream(), "app", "file1.jar") val att1 = importAttachment(fakeAttachment("/folder1/foldera/file1.txt", "some data").inputStream(), "app", "file1.jar")
val att2 = importAttachment(fakeAttachment("\\folder1\\folderb\\file2.txt", "some other data").inputStream(), "app", "file2.jar") val att2 = importAttachment(fakeAttachment("\\folder1\\folderb\\file2.txt", "some other data").inputStream(), "app", "file2.jar")
@ -213,8 +213,8 @@ class AttachmentsClassLoaderTests {
assertArrayEquals("some other data".toByteArray(), data2b) assertArrayEquals("some other data".toByteArray(), data2b)
} }
@Test @Test(timeout=300_000)
fun `Allow loading untrusted resource jars but only trusted jars that contain class files`() { fun `Allow loading untrusted resource jars but only trusted jars that contain class files`() {
val trustedResourceJar = importAttachment(fakeAttachment("file1.txt", "some data").inputStream(), "app", "file0.jar") val trustedResourceJar = importAttachment(fakeAttachment("file1.txt", "some data").inputStream(), "app", "file0.jar")
val untrustedResourceJar = importAttachment(fakeAttachment("file2.txt", "some malicious data").inputStream(), "untrusted", "file1.jar") val untrustedResourceJar = importAttachment(fakeAttachment("file2.txt", "some malicious data").inputStream(), "untrusted", "file1.jar")
val untrustedClassJar = importAttachment(fakeAttachment("/com/example/something/MaliciousClass.class", "some malicious data").inputStream(), "untrusted", "file2.jar") val untrustedClassJar = importAttachment(fakeAttachment("/com/example/something/MaliciousClass.class", "some malicious data").inputStream(), "untrusted", "file2.jar")
@ -231,8 +231,8 @@ class AttachmentsClassLoaderTests {
return jar.use { storage.importAttachment(jar, uploader, filename) } return jar.use { storage.importAttachment(jar, uploader, filename) }
} }
@Test @Test(timeout=300_000)
fun `Allow loading an untrusted contract jar if another attachment exists that was signed with the same keys and uploaded by a trusted uploader`() { fun `Allow loading an untrusted contract jar if another attachment exists that was signed with the same keys and uploaded by a trusted uploader`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
val keyPairB = Crypto.generateKeyPair() val keyPairB = Crypto.generateKeyPair()
val classJar = fakeAttachment( val classJar = fakeAttachment(
@ -260,8 +260,8 @@ class AttachmentsClassLoaderTests {
createClassloader(untrustedAttachment) createClassloader(untrustedAttachment)
} }
@Test @Test(timeout=300_000)
fun `Allow loading an untrusted contract jar if another attachment exists that was signed by a trusted uploader - intersection of keys match existing attachment`() { fun `Allow loading an untrusted contract jar if another attachment exists that was signed by a trusted uploader - intersection of keys match existing attachment`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
val keyPairB = Crypto.generateKeyPair() val keyPairB = Crypto.generateKeyPair()
val keyPairC = Crypto.generateKeyPair() val keyPairC = Crypto.generateKeyPair()
@ -290,8 +290,8 @@ class AttachmentsClassLoaderTests {
createClassloader(untrustedAttachment) createClassloader(untrustedAttachment)
} }
@Test @Test(timeout=300_000)
fun `Cannot load an untrusted contract jar if no other attachment exists that was signed with the same keys`() { fun `Cannot load an untrusted contract jar if no other attachment exists that was signed with the same keys`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
val keyPairB = Crypto.generateKeyPair() val keyPairB = Crypto.generateKeyPair()
val untrustedClassJar = fakeAttachment( val untrustedClassJar = fakeAttachment(
@ -310,8 +310,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Cannot load an untrusted contract jar if no other attachment exists that was signed with the same keys and uploaded by a trusted uploader`() { fun `Cannot load an untrusted contract jar if no other attachment exists that was signed with the same keys and uploaded by a trusted uploader`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
val keyPairB = Crypto.generateKeyPair() val keyPairB = Crypto.generateKeyPair()
val classJar = fakeAttachment( val classJar = fakeAttachment(
@ -341,8 +341,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Attachments with inherited trust do not grant trust to attachments being loaded (no chain of trust)`() { fun `Attachments with inherited trust do not grant trust to attachments being loaded (no chain of trust)`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
val keyPairB = Crypto.generateKeyPair() val keyPairB = Crypto.generateKeyPair()
val keyPairC = Crypto.generateKeyPair() val keyPairC = Crypto.generateKeyPair()
@ -387,8 +387,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Cannot load an untrusted contract jar if it is signed by a blacklisted key even if there is another attachment signed by the same keys that is trusted`() { fun `Cannot load an untrusted contract jar if it is signed by a blacklisted key even if there is another attachment signed by the same keys that is trusted`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
val keyPairB = Crypto.generateKeyPair() val keyPairB = Crypto.generateKeyPair()
@ -425,8 +425,8 @@ class AttachmentsClassLoaderTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Allow loading a trusted attachment that is signed by a blacklisted key`() { fun `Allow loading a trusted attachment that is signed by a blacklisted key`() {
val keyPairA = Crypto.generateKeyPair() val keyPairA = Crypto.generateKeyPair()
attachmentTrustCalculator = NodeAttachmentTrustCalculator( attachmentTrustCalculator = NodeAttachmentTrustCalculator(

View File

@ -69,8 +69,8 @@ class CompatibleTransactionTests {
} }
private val wireTransactionA by lazy { WireTransaction(componentGroups = componentGroupsA, privacySalt = privacySalt) } private val wireTransactionA by lazy { WireTransaction(componentGroups = componentGroupsA, privacySalt = privacySalt) }
@Test @Test(timeout=300_000)
fun `Merkle root computations`() { fun `Merkle root computations`() {
// Merkle tree computation is deterministic if the same salt and ordering are used. // Merkle tree computation is deterministic if the same salt and ordering are used.
val wireTransactionB = WireTransaction(componentGroups = componentGroupsA, privacySalt = privacySalt) val wireTransactionB = WireTransaction(componentGroups = componentGroupsA, privacySalt = privacySalt)
assertEquals(wireTransactionA, wireTransactionB) assertEquals(wireTransactionA, wireTransactionB)
@ -129,8 +129,8 @@ class CompatibleTransactionTests {
assertEquals(wireTransactionA, WireTransaction(componentGroups = shuffledComponentGroupsA, privacySalt = privacySalt)) assertEquals(wireTransactionA, WireTransaction(componentGroups = shuffledComponentGroupsA, privacySalt = privacySalt))
} }
@Test @Test(timeout=300_000)
fun `WireTransaction constructors and compatibility`() { fun `WireTransaction constructors and compatibility`() {
val groups = createComponentGroups(inputs, outputs, commands, attachments, notary, timeWindow, emptyList(), null) val groups = createComponentGroups(inputs, outputs, commands, attachments, notary, timeWindow, emptyList(), null)
val wireTransactionOldConstructor = WireTransaction(groups, privacySalt) val wireTransactionOldConstructor = WireTransaction(groups, privacySalt)
assertEquals(wireTransactionA, wireTransactionOldConstructor) assertEquals(wireTransactionA, wireTransactionOldConstructor)
@ -198,8 +198,8 @@ class CompatibleTransactionTests {
assertFails { WireTransaction(componentGroupsCompatibleEmptyNew, privacySalt) } assertFails { WireTransaction(componentGroupsCompatibleEmptyNew, privacySalt) }
} }
@Test @Test(timeout=300_000)
fun `FilteredTransaction constructors and compatibility`() { fun `FilteredTransaction constructors and compatibility`() {
// Filter out all of the components. // Filter out all of the components.
val ftxNothing = wireTransactionA.buildFilteredTransaction(Predicate { false }) // Nothing filtered. val ftxNothing = wireTransactionA.buildFilteredTransaction(Predicate { false }) // Nothing filtered.
// Although nothing filtered, we still receive the group hashes for the top level Merkle tree. // Although nothing filtered, we still receive the group hashes for the top level Merkle tree.
@ -295,8 +295,8 @@ class CompatibleTransactionTests {
assertEquals(wireTransactionCompatibleA.componentGroups.map { it.groupIndex }.max()!!, ftxCompatibleNoInputs.groupHashes.size - 1) assertEquals(wireTransactionCompatibleA.componentGroups.map { it.groupIndex }.max()!!, ftxCompatibleNoInputs.groupHashes.size - 1)
} }
@Test @Test(timeout=300_000)
fun `Command visibility tests`() { fun `Command visibility tests`() {
// 1st and 3rd commands require a signature from KEY_1. // 1st and 3rd commands require a signature from KEY_1.
val twoCommandsforKey1 = listOf(dummyCommand(DUMMY_KEY_1.public, DUMMY_KEY_2.public), dummyCommand(DUMMY_KEY_2.public), dummyCommand(DUMMY_KEY_1.public)) val twoCommandsforKey1 = listOf(dummyCommand(DUMMY_KEY_1.public, DUMMY_KEY_2.public), dummyCommand(DUMMY_KEY_2.public), dummyCommand(DUMMY_KEY_1.public))
val componentGroups = listOf( val componentGroups = listOf(
@ -414,8 +414,8 @@ class CompatibleTransactionTests {
allCommandsNoKey1Ftx.checkCommandVisibility(DUMMY_KEY_1.public) // This will pass, because there are indeed no commands to sign in the original transaction. allCommandsNoKey1Ftx.checkCommandVisibility(DUMMY_KEY_1.public) // This will pass, because there are indeed no commands to sign in the original transaction.
} }
@Test @Test(timeout=300_000)
fun `FilteredTransaction signer manipulation tests`() { fun `FilteredTransaction signer manipulation tests`() {
// Required to call the private constructor. // Required to call the private constructor.
val ftxConstructor = FilteredTransaction::class.constructors.first() val ftxConstructor = FilteredTransaction::class.constructors.first()
@ -557,8 +557,8 @@ class CompatibleTransactionTests {
assertFailsWith<ComponentVisibilityException> { ftxAlterSignerB.checkCommandVisibility(DUMMY_KEY_1.public) } assertFailsWith<ComponentVisibilityException> { ftxAlterSignerB.checkCommandVisibility(DUMMY_KEY_1.public) }
} }
@Test @Test(timeout=300_000)
fun `parameters hash visibility`() { fun `parameters hash visibility`() {
fun paramsFilter(elem: Any): Boolean = elem is NetworkParametersHash && elem.hash == paramsHash fun paramsFilter(elem: Any): Boolean = elem is NetworkParametersHash && elem.hash == paramsHash
fun attachmentFilter(elem: Any): Boolean = elem is SecureHash && elem == paramsHash fun attachmentFilter(elem: Any): Boolean = elem is SecureHash && elem == paramsHash
val attachments = ComponentGroup(ATTACHMENTS_GROUP.ordinal, listOf(paramsHash.serialize())) // Same hash as network parameters val attachments = ComponentGroup(ATTACHMENTS_GROUP.ordinal, listOf(paramsHash.serialize())) // Same hash as network parameters

View File

@ -98,8 +98,8 @@ class LedgerTransactionQueryTests {
return tx.toLedgerTransaction(services) return tx.toLedgerTransaction(services)
} }
@Test @Test(timeout=300_000)
fun `Simple InRef Indexer tests`() { fun `Simple InRef Indexer tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
assertEquals(0, ltx.inRef<IntTypeDummyState>(0).state.data.data) assertEquals(0, ltx.inRef<IntTypeDummyState>(0).state.data.data)
assertEquals("0", ltx.inRef<StringTypeDummyState>(1).state.data.data) assertEquals("0", ltx.inRef<StringTypeDummyState>(1).state.data.data)
@ -108,8 +108,8 @@ class LedgerTransactionQueryTests {
assertFailsWith<IndexOutOfBoundsException> { ltx.inRef<IntTypeDummyState>(10) } assertFailsWith<IndexOutOfBoundsException> { ltx.inRef<IntTypeDummyState>(10) }
} }
@Test @Test(timeout=300_000)
fun `Simple OutRef Indexer tests`() { fun `Simple OutRef Indexer tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
assertEquals(0, ltx.outRef<IntTypeDummyState>(0).state.data.data) assertEquals(0, ltx.outRef<IntTypeDummyState>(0).state.data.data)
assertEquals("0", ltx.outRef<StringTypeDummyState>(1).state.data.data) assertEquals("0", ltx.outRef<StringTypeDummyState>(1).state.data.data)
@ -118,8 +118,8 @@ class LedgerTransactionQueryTests {
assertFailsWith<IndexOutOfBoundsException> { ltx.outRef<IntTypeDummyState>(10) } assertFailsWith<IndexOutOfBoundsException> { ltx.outRef<IntTypeDummyState>(10) }
} }
@Test @Test(timeout=300_000)
fun `Simple Input Indexer tests`() { fun `Simple Input Indexer tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
assertEquals(0, (ltx.getInput(0) as IntTypeDummyState).data) assertEquals(0, (ltx.getInput(0) as IntTypeDummyState).data)
assertEquals("0", (ltx.getInput(1) as StringTypeDummyState).data) assertEquals("0", (ltx.getInput(1) as StringTypeDummyState).data)
@ -128,8 +128,8 @@ class LedgerTransactionQueryTests {
assertFailsWith<IndexOutOfBoundsException> { ltx.getInput(10) } assertFailsWith<IndexOutOfBoundsException> { ltx.getInput(10) }
} }
@Test @Test(timeout=300_000)
fun `Simple Output Indexer tests`() { fun `Simple Output Indexer tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
assertEquals(0, (ltx.getOutput(0) as IntTypeDummyState).data) assertEquals(0, (ltx.getOutput(0) as IntTypeDummyState).data)
assertEquals("0", (ltx.getOutput(1) as StringTypeDummyState).data) assertEquals("0", (ltx.getOutput(1) as StringTypeDummyState).data)
@ -138,8 +138,8 @@ class LedgerTransactionQueryTests {
assertFailsWith<IndexOutOfBoundsException> { ltx.getOutput(10) } assertFailsWith<IndexOutOfBoundsException> { ltx.getOutput(10) }
} }
@Test @Test(timeout=300_000)
fun `Simple Command Indexer tests`() { fun `Simple Command Indexer tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
assertEquals(0, ltx.getCommand<Commands.Cmd1>(0).value.id) assertEquals(0, ltx.getCommand<Commands.Cmd1>(0).value.id)
assertEquals(0, ltx.getCommand<Commands.Cmd2>(1).value.id) assertEquals(0, ltx.getCommand<Commands.Cmd2>(1).value.id)
@ -148,8 +148,8 @@ class LedgerTransactionQueryTests {
assertFailsWith<IndexOutOfBoundsException> { ltx.getOutput(10) } assertFailsWith<IndexOutOfBoundsException> { ltx.getOutput(10) }
} }
@Test @Test(timeout=300_000)
fun `Simple Inputs of type tests`() { fun `Simple Inputs of type tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.inputsOfType(IntTypeDummyState::class.java) val intStates = ltx.inputsOfType(IntTypeDummyState::class.java)
assertEquals(5, intStates.size) assertEquals(5, intStates.size)
@ -161,8 +161,8 @@ class LedgerTransactionQueryTests {
assertEquals(emptyList(), notPresentQuery) assertEquals(emptyList(), notPresentQuery)
} }
@Test @Test(timeout=300_000)
fun `Simple InputsRefs of type tests`() { fun `Simple InputsRefs of type tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.inRefsOfType(IntTypeDummyState::class.java) val intStates = ltx.inRefsOfType(IntTypeDummyState::class.java)
assertEquals(5, intStates.size) assertEquals(5, intStates.size)
@ -174,8 +174,8 @@ class LedgerTransactionQueryTests {
assertEquals(listOf(ltx.inputs[1], ltx.inputs[3], ltx.inputs[5], ltx.inputs[7], ltx.inputs[9]), stringStates) assertEquals(listOf(ltx.inputs[1], ltx.inputs[3], ltx.inputs[5], ltx.inputs[7], ltx.inputs[9]), stringStates)
} }
@Test @Test(timeout=300_000)
fun `Simple Outputs of type tests`() { fun `Simple Outputs of type tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.outputsOfType(IntTypeDummyState::class.java) val intStates = ltx.outputsOfType(IntTypeDummyState::class.java)
assertEquals(5, intStates.size) assertEquals(5, intStates.size)
@ -187,8 +187,8 @@ class LedgerTransactionQueryTests {
assertEquals(emptyList(), notPresentQuery) assertEquals(emptyList(), notPresentQuery)
} }
@Test @Test(timeout=300_000)
fun `Simple OutputsRefs of type tests`() { fun `Simple OutputsRefs of type tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.outRefsOfType(IntTypeDummyState::class.java) val intStates = ltx.outRefsOfType(IntTypeDummyState::class.java)
assertEquals(5, intStates.size) assertEquals(5, intStates.size)
@ -202,8 +202,8 @@ class LedgerTransactionQueryTests {
assertTrue(stringStates.all { it.ref.txhash == ltx.id }) assertTrue(stringStates.all { it.ref.txhash == ltx.id })
} }
@Test @Test(timeout=300_000)
fun `Simple Commands of type tests`() { fun `Simple Commands of type tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intCmd1 = ltx.commandsOfType(Commands.Cmd1::class.java) val intCmd1 = ltx.commandsOfType(Commands.Cmd1::class.java)
assertEquals(5, intCmd1.size) assertEquals(5, intCmd1.size)
@ -215,8 +215,8 @@ class LedgerTransactionQueryTests {
assertEquals(emptyList(), notPresentQuery) assertEquals(emptyList(), notPresentQuery)
} }
@Test @Test(timeout=300_000)
fun `Filtered Input Tests`() { fun `Filtered Input Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.filterInputs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 }) val intStates = ltx.filterInputs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 })
assertEquals(3, intStates.size) assertEquals(3, intStates.size)
@ -225,8 +225,8 @@ class LedgerTransactionQueryTests {
assertEquals("3", stringStates.single().data) assertEquals("3", stringStates.single().data)
} }
@Test @Test(timeout=300_000)
fun `Filtered InRef Tests`() { fun `Filtered InRef Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.filterInRefs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 }) val intStates = ltx.filterInRefs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 })
assertEquals(3, intStates.size) assertEquals(3, intStates.size)
@ -237,8 +237,8 @@ class LedgerTransactionQueryTests {
assertEquals(ltx.inputs[7], stringStates.single()) assertEquals(ltx.inputs[7], stringStates.single())
} }
@Test @Test(timeout=300_000)
fun `Filtered Output Tests`() { fun `Filtered Output Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.filterOutputs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 }) val intStates = ltx.filterOutputs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 })
assertEquals(3, intStates.size) assertEquals(3, intStates.size)
@ -247,8 +247,8 @@ class LedgerTransactionQueryTests {
assertEquals("3", stringStates.single().data) assertEquals("3", stringStates.single().data)
} }
@Test @Test(timeout=300_000)
fun `Filtered OutRef Tests`() { fun `Filtered OutRef Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intStates = ltx.filterOutRefs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 }) val intStates = ltx.filterOutRefs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 })
assertEquals(3, intStates.size) assertEquals(3, intStates.size)
@ -261,8 +261,8 @@ class LedgerTransactionQueryTests {
assertEquals(ltx.id, stringStates.single().ref.txhash) assertEquals(ltx.id, stringStates.single().ref.txhash)
} }
@Test @Test(timeout=300_000)
fun `Filtered Commands Tests`() { fun `Filtered Commands Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intCmds1 = ltx.filterCommands(Commands.Cmd1::class.java, Predicate { it.id.rem(2) == 0 }) val intCmds1 = ltx.filterCommands(Commands.Cmd1::class.java, Predicate { it.id.rem(2) == 0 })
assertEquals(3, intCmds1.size) assertEquals(3, intCmds1.size)
@ -271,8 +271,8 @@ class LedgerTransactionQueryTests {
assertEquals(3, intCmds2.single().value.id) assertEquals(3, intCmds2.single().value.id)
} }
@Test @Test(timeout=300_000)
fun `Find Input Tests`() { fun `Find Input Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intState = ltx.findInput(IntTypeDummyState::class.java, Predicate { it.data == 4 }) val intState = ltx.findInput(IntTypeDummyState::class.java, Predicate { it.data == 4 })
assertEquals(ltx.getInput(8), intState) assertEquals(ltx.getInput(8), intState)
@ -280,8 +280,8 @@ class LedgerTransactionQueryTests {
assertEquals(ltx.getInput(7), stringState) assertEquals(ltx.getInput(7), stringState)
} }
@Test @Test(timeout=300_000)
fun `Find InRef Tests`() { fun `Find InRef Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intState = ltx.findInRef(IntTypeDummyState::class.java, Predicate { it.data == 4 }) val intState = ltx.findInRef(IntTypeDummyState::class.java, Predicate { it.data == 4 })
assertEquals(ltx.inRef(8), intState) assertEquals(ltx.inRef(8), intState)
@ -289,8 +289,8 @@ class LedgerTransactionQueryTests {
assertEquals(ltx.inRef(7), stringState) assertEquals(ltx.inRef(7), stringState)
} }
@Test @Test(timeout=300_000)
fun `Find Output Tests`() { fun `Find Output Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intState = ltx.findOutput(IntTypeDummyState::class.java, Predicate { it.data == 4 }) val intState = ltx.findOutput(IntTypeDummyState::class.java, Predicate { it.data == 4 })
assertEquals(ltx.getOutput(8), intState) assertEquals(ltx.getOutput(8), intState)
@ -298,8 +298,8 @@ class LedgerTransactionQueryTests {
assertEquals(ltx.getOutput(7), stringState) assertEquals(ltx.getOutput(7), stringState)
} }
@Test @Test(timeout=300_000)
fun `Find OutRef Tests`() { fun `Find OutRef Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intState = ltx.findOutRef(IntTypeDummyState::class.java, Predicate { it.data == 4 }) val intState = ltx.findOutRef(IntTypeDummyState::class.java, Predicate { it.data == 4 })
assertEquals(ltx.outRef(8), intState) assertEquals(ltx.outRef(8), intState)
@ -307,8 +307,8 @@ class LedgerTransactionQueryTests {
assertEquals(ltx.outRef(7), stringState) assertEquals(ltx.outRef(7), stringState)
} }
@Test @Test(timeout=300_000)
fun `Find Commands Tests`() { fun `Find Commands Tests`() {
val ltx = makeDummyTransaction() val ltx = makeDummyTransaction()
val intCmd1 = ltx.findCommand(Commands.Cmd1::class.java, Predicate { it.id == 2 }) val intCmd1 = ltx.findCommand(Commands.Cmd1::class.java, Predicate { it.id == 2 })
assertEquals(ltx.getCommand(4), intCmd1) assertEquals(ltx.getCommand(4), intCmd1)

View File

@ -103,8 +103,8 @@ class ReferenceStateTests {
} }
} }
@Test @Test(timeout=300_000)
fun `create a reference state then refer to it multiple times`() { fun `create a reference state then refer to it multiple times`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
// Create a reference state. The reference state is created in the normal way. A transaction with one // Create a reference state. The reference state is created in the normal way. A transaction with one
// or more outputs. It makes sense to create them one at a time, so the creator can have fine grained // or more outputs. It makes sense to create them one at a time, so the creator can have fine grained
@ -142,8 +142,8 @@ class ReferenceStateTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Non-creator node cannot spend spend a reference state`() { fun `Non-creator node cannot spend spend a reference state`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
output(CONTRACT_ID, "REF DATA", ExampleState(ALICE_PARTY, "HELLO CORDA")) output(CONTRACT_ID, "REF DATA", ExampleState(ALICE_PARTY, "HELLO CORDA"))
@ -161,8 +161,8 @@ class ReferenceStateTests {
} }
} }
@Test @Test(timeout=300_000)
fun `Can't use old reference states`() { fun `Can't use old reference states`() {
val refData = ExampleState(ALICE_PARTY, "HELLO CORDA") val refData = ExampleState(ALICE_PARTY, "HELLO CORDA")
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
@ -197,8 +197,8 @@ class ReferenceStateTests {
} }
} }
@Test @Test(timeout=300_000)
fun `state ref cannot be a reference input and regular input in the same transaction`() { fun `state ref cannot be a reference input and regular input in the same transaction`() {
val state = ExampleState(ALICE_PARTY, "HELLO CORDA") val state = ExampleState(ALICE_PARTY, "HELLO CORDA")
val stateAndRef = StateAndRef(TransactionState(state, CONTRACT_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), StateRef(SecureHash.zeroHash, 0)) val stateAndRef = StateAndRef(TransactionState(state, CONTRACT_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), StateRef(SecureHash.zeroHash, 0))
assertThatIllegalArgumentException().isThrownBy { assertThatIllegalArgumentException().isThrownBy {

View File

@ -63,8 +63,8 @@ class TransactionBuilderTest {
.getLatestContractAttachments("net.corda.testing.contracts.DummyContract") .getLatestContractAttachments("net.corda.testing.contracts.DummyContract")
} }
@Test @Test(timeout=300_000)
fun `bare minimum issuance tx`() { fun `bare minimum issuance tx`() {
val outputState = TransactionState( val outputState = TransactionState(
data = DummyState(), data = DummyState(),
contract = DummyContract.PROGRAM_ID, contract = DummyContract.PROGRAM_ID,
@ -80,8 +80,8 @@ class TransactionBuilderTest {
assertThat(wtx.networkParametersHash).isEqualTo(networkParametersService.currentHash) assertThat(wtx.networkParametersHash).isEqualTo(networkParametersService.currentHash)
} }
@Test @Test(timeout=300_000)
fun `automatic hash constraint`() { fun `automatic hash constraint`() {
doReturn(unsignedAttachment).whenever(attachments).openAttachment(contractAttachmentId) doReturn(unsignedAttachment).whenever(attachments).openAttachment(contractAttachmentId)
val outputState = TransactionState(data = DummyState(), contract = DummyContract.PROGRAM_ID, notary = notary) val outputState = TransactionState(data = DummyState(), contract = DummyContract.PROGRAM_ID, notary = notary)
@ -92,8 +92,8 @@ class TransactionBuilderTest {
assertThat(wtx.outputs).containsOnly(outputState.copy(constraint = HashAttachmentConstraint(contractAttachmentId))) assertThat(wtx.outputs).containsOnly(outputState.copy(constraint = HashAttachmentConstraint(contractAttachmentId)))
} }
@Test @Test(timeout=300_000)
fun `reference states`() { fun `reference states`() {
doReturn(unsignedAttachment).whenever(attachments).openAttachment(contractAttachmentId) doReturn(unsignedAttachment).whenever(attachments).openAttachment(contractAttachmentId)
val referenceState = TransactionState(DummyState(), DummyContract.PROGRAM_ID, notary) val referenceState = TransactionState(DummyState(), DummyContract.PROGRAM_ID, notary)
@ -114,8 +114,8 @@ class TransactionBuilderTest {
assertThat(wtx.references).containsOnly(referenceStateRef) assertThat(wtx.references).containsOnly(referenceStateRef)
} }
@Test @Test(timeout=300_000)
fun `automatic signature constraint`() { fun `automatic signature constraint`() {
val aliceParty = TestIdentity(ALICE_NAME).party val aliceParty = TestIdentity(ALICE_NAME).party
val bobParty = TestIdentity(BOB_NAME).party val bobParty = TestIdentity(BOB_NAME).party
val compositeKey = CompositeKey.Builder().addKeys(aliceParty.owningKey, bobParty.owningKey).build() val compositeKey = CompositeKey.Builder().addKeys(aliceParty.owningKey, bobParty.owningKey).build()

View File

@ -82,8 +82,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `states must be bi-directionally encumbered`() { fun `states must be bi-directionally encumbered`() {
// Basic encumbrance example for encumbrance index links 0 -> 1 and 1 -> 0 // Basic encumbrance example for encumbrance index links 0 -> 1 and 1 -> 0
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
@ -145,8 +145,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `non bi-directional encumbrance will fail`() { fun `non bi-directional encumbrance will fail`() {
// Single encumbrance with no back link. // Single encumbrance with no back link.
assertFailsWith<TransactionVerificationException.TransactionNonMatchingEncumbranceException> { assertFailsWith<TransactionVerificationException.TransactionNonMatchingEncumbranceException> {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
@ -214,8 +214,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `state can transition if encumbrance rules are met`() { fun `state can transition if encumbrance rules are met`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
unverifiedTransaction { unverifiedTransaction {
attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID) attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID)
@ -235,8 +235,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `state cannot transition if the encumbrance contract fails to verify`() { fun `state cannot transition if the encumbrance contract fails to verify`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
unverifiedTransaction { unverifiedTransaction {
attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID) attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID)
@ -256,8 +256,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `state must be consumed along with its encumbrance`() { fun `state must be consumed along with its encumbrance`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
unverifiedTransaction { unverifiedTransaction {
attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID) attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID)
@ -275,8 +275,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `state cannot be encumbered by itself`() { fun `state cannot be encumbered by itself`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
attachments(Cash.PROGRAM_ID) attachments(Cash.PROGRAM_ID)
@ -288,8 +288,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `encumbrance state index must be valid`() { fun `encumbrance state index must be valid`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
transaction { transaction {
attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID) attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID)
@ -302,8 +302,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `correct encumbrance state must be provided`() { fun `correct encumbrance state must be provided`() {
ledgerServices.ledger(DUMMY_NOTARY) { ledgerServices.ledger(DUMMY_NOTARY) {
unverifiedTransaction { unverifiedTransaction {
attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID) attachments(Cash.PROGRAM_ID, TEST_TIMELOCK_ID)
@ -323,8 +323,8 @@ class TransactionEncumbranceTests {
} }
} }
@Test @Test(timeout=300_000)
fun `encumbered states cannot be assigned to different notaries`() { fun `encumbered states cannot be assigned to different notaries`() {
// Single encumbrance with different notaries. // Single encumbrance with different notaries.
assertFailsWith<TransactionVerificationException.TransactionNotaryMismatchEncumbranceException> { assertFailsWith<TransactionVerificationException.TransactionNotaryMismatchEncumbranceException> {
TransactionBuilder() TransactionBuilder()

View File

@ -53,8 +53,8 @@ class TransactionTests {
return SignedTransaction(wtx, sigs) return SignedTransaction(wtx, sigs)
} }
@Test @Test(timeout=300_000)
fun `signed transaction missing signatures - CompositeKey`() { fun `signed transaction missing signatures - CompositeKey`() {
val ak = generateKeyPair() val ak = generateKeyPair()
val bk = generateKeyPair() val bk = generateKeyPair()
val ck = generateKeyPair() val ck = generateKeyPair()
@ -87,8 +87,8 @@ class TransactionTests {
makeSigned(wtx, DUMMY_KEY_1, ak).verifySignaturesExcept(compKey, DUMMY_KEY_2.public) // Mixed allowed to be missing. makeSigned(wtx, DUMMY_KEY_1, ak).verifySignaturesExcept(compKey, DUMMY_KEY_2.public) // Mixed allowed to be missing.
} }
@Test @Test(timeout=300_000)
fun `signed transaction missing signatures`() { fun `signed transaction missing signatures`() {
val wtx = createWireTransaction( val wtx = createWireTransaction(
inputs = listOf(StateRef(SecureHash.randomSHA256(), 0)), inputs = listOf(StateRef(SecureHash.randomSHA256(), 0)),
attachments = emptyList(), attachments = emptyList(),
@ -118,8 +118,8 @@ class TransactionTests {
makeSigned(wtx, DUMMY_KEY_1, DUMMY_KEY_2).verifyRequiredSignatures() makeSigned(wtx, DUMMY_KEY_1, DUMMY_KEY_2).verifyRequiredSignatures()
} }
@Test @Test(timeout=300_000)
fun `transactions with no inputs can have any notary`() { fun `transactions with no inputs can have any notary`() {
val baseOutState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint) val baseOutState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint)
val inputs = emptyList<StateAndRef<*>>() val inputs = emptyList<StateAndRef<*>>()
val outputs = listOf(baseOutState, baseOutState.copy(notary = ALICE), baseOutState.copy(notary = BOB)) val outputs = listOf(baseOutState, baseOutState.copy(notary = ALICE), baseOutState.copy(notary = BOB))
@ -148,8 +148,8 @@ class TransactionTests {
transaction.verify() transaction.verify()
} }
@Test @Test(timeout=300_000)
fun `transaction cannot have duplicate inputs`() { fun `transaction cannot have duplicate inputs`() {
val stateRef = StateRef(SecureHash.randomSHA256(), 0) val stateRef = StateRef(SecureHash.randomSHA256(), 0)
fun buildTransaction() = createWireTransaction( fun buildTransaction() = createWireTransaction(
inputs = listOf(stateRef, stateRef), inputs = listOf(stateRef, stateRef),
@ -163,8 +163,8 @@ class TransactionTests {
assertFailsWith<IllegalStateException> { buildTransaction() } assertFailsWith<IllegalStateException> { buildTransaction() }
} }
@Test @Test(timeout=300_000)
fun `general transactions cannot change notary`() { fun `general transactions cannot change notary`() {
val notary: Party = DUMMY_NOTARY val notary: Party = DUMMY_NOTARY
val inState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, notary) val inState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, notary)
val outState = inState.copy(notary = ALICE) val outState = inState.copy(notary = ALICE)
@ -201,8 +201,8 @@ class TransactionTests {
assertFailsWith<TransactionVerificationException.NotaryChangeInWrongTransactionType> { buildTransaction().verify() } assertFailsWith<TransactionVerificationException.NotaryChangeInWrongTransactionType> { buildTransaction().verify() }
} }
@Test @Test(timeout=300_000)
fun `transactions with identical contents must have different ids`() { fun `transactions with identical contents must have different ids`() {
val outputState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, DUMMY_NOTARY) val outputState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, DUMMY_NOTARY)
fun buildTransaction() = createWireTransaction( fun buildTransaction() = createWireTransaction(
inputs = emptyList(), inputs = emptyList(),

View File

@ -34,16 +34,16 @@ class KotlinUtilsTest {
true, true,
null) null)
@Test @Test(timeout=300_000)
fun `transient property which is null`() { fun `transient property which is null`() {
val test = NullTransientProperty() val test = NullTransientProperty()
test.transientValue test.transientValue
test.transientValue test.transientValue
assertThat(test.evalCount).isEqualTo(1) assertThat(test.evalCount).isEqualTo(1)
} }
@Test @Test(timeout=300_000)
fun `checkpointing a transient property with non-capturing lambda`() { fun `checkpointing a transient property with non-capturing lambda`() {
val original = NonCapturingTransientProperty() val original = NonCapturingTransientProperty()
val originalVal = original.transientVal val originalVal = original.transientVal
val copy = original.checkpointSerialize(context = KRYO_CHECKPOINT_CONTEXT).checkpointDeserialize(context = KRYO_CHECKPOINT_CONTEXT) val copy = original.checkpointSerialize(context = KRYO_CHECKPOINT_CONTEXT).checkpointDeserialize(context = KRYO_CHECKPOINT_CONTEXT)
@ -52,16 +52,16 @@ class KotlinUtilsTest {
assertThat(copy.transientVal).isEqualTo(copyVal) assertThat(copy.transientVal).isEqualTo(copyVal)
} }
@Test @Test(timeout=300_000)
fun `deserialise transient property with non-capturing lambda`() { fun `deserialise transient property with non-capturing lambda`() {
expectedEx.expect(KryoException::class.java) expectedEx.expect(KryoException::class.java)
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization") expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")
val original = NonCapturingTransientProperty() val original = NonCapturingTransientProperty()
original.checkpointSerialize(context = KRYO_CHECKPOINT_CONTEXT).checkpointDeserialize(context = KRYO_CHECKPOINT_NOWHITELIST_CONTEXT) original.checkpointSerialize(context = KRYO_CHECKPOINT_CONTEXT).checkpointDeserialize(context = KRYO_CHECKPOINT_NOWHITELIST_CONTEXT)
} }
@Test @Test(timeout=300_000)
fun `checkpointing a transient property with capturing lambda`() { fun `checkpointing a transient property with capturing lambda`() {
val original = CapturingTransientProperty("Hello") val original = CapturingTransientProperty("Hello")
val originalVal = original.transientVal val originalVal = original.transientVal
val copy = original.checkpointSerialize(context = KRYO_CHECKPOINT_CONTEXT).checkpointDeserialize(context = KRYO_CHECKPOINT_CONTEXT) val copy = original.checkpointSerialize(context = KRYO_CHECKPOINT_CONTEXT).checkpointDeserialize(context = KRYO_CHECKPOINT_CONTEXT)
@ -71,8 +71,8 @@ class KotlinUtilsTest {
assertThat(copy.transientVal).startsWith("Hello") assertThat(copy.transientVal).startsWith("Hello")
} }
@Test @Test(timeout=300_000)
fun `deserialise transient property with capturing lambda`() { fun `deserialise transient property with capturing lambda`() {
expectedEx.expect(KryoException::class.java) expectedEx.expect(KryoException::class.java)
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization") expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")

View File

@ -42,18 +42,18 @@ class NonEmptySetTest {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule() val testSerialization = SerializationEnvironmentRule()
@Test @Test(timeout=300_000)
fun `copyOf - empty source`() { fun `copyOf - empty source`() {
assertThatThrownBy { NonEmptySet.copyOf(HashSet<Int>()) }.isInstanceOf(IllegalArgumentException::class.java) assertThatThrownBy { NonEmptySet.copyOf(HashSet<Int>()) }.isInstanceOf(IllegalArgumentException::class.java)
} }
@Test @Test(timeout=300_000)
fun head() { fun head() {
assertThat(NonEmptySet.of(1, 2).head()).isEqualTo(1) assertThat(NonEmptySet.of(1, 2).head()).isEqualTo(1)
} }
@Test @Test(timeout=300_000)
fun `serialize deserialize`() { fun `serialize deserialize`() {
val original = NonEmptySet.of(-17, 22, 17) val original = NonEmptySet.of(-17, 22, 17)
val copy = original.serialize().deserialize() val copy = original.serialize().deserialize()
assertThat(copy).isEqualTo(original).isNotSameAs(original) assertThat(copy).isEqualTo(original).isNotSameAs(original)

View File

@ -59,8 +59,8 @@ class ProgressTrackerTest {
pt4 = ChildSteps.tracker() pt4 = ChildSteps.tracker()
} }
@Test @Test(timeout=300_000)
fun `check basic steps`() { fun `check basic steps`() {
assertEquals(ProgressTracker.UNSTARTED, pt.currentStep) assertEquals(ProgressTracker.UNSTARTED, pt.currentStep)
assertEquals(0, pt.stepIndex) assertEquals(0, pt.stepIndex)
var stepNotification: ProgressTracker.Step? = null var stepNotification: ProgressTracker.Step? = null
@ -76,15 +76,15 @@ class ProgressTrackerTest {
assertEquals(ProgressTracker.DONE, pt.nextStep()) assertEquals(ProgressTracker.DONE, pt.nextStep())
} }
@Test @Test(timeout=300_000)
fun `cannot go beyond end`() { fun `cannot go beyond end`() {
pt.currentStep = SimpleSteps.FOUR pt.currentStep = SimpleSteps.FOUR
pt.nextStep() pt.nextStep()
assertFails { pt.nextStep() } assertFails { pt.nextStep() }
} }
@Test @Test(timeout=300_000)
fun `nested children are stepped correctly`() { fun `nested children are stepped correctly`() {
val stepNotification = LinkedList<ProgressTracker.Change>() val stepNotification = LinkedList<ProgressTracker.Change>()
pt.changes.subscribe { pt.changes.subscribe {
stepNotification += it stepNotification += it
@ -109,8 +109,8 @@ class ProgressTrackerTest {
assertEquals(ChildSteps.BEE, pt2.nextStep()) assertEquals(ChildSteps.BEE, pt2.nextStep())
} }
@Test @Test(timeout=300_000)
fun `steps tree index counts children steps`() { fun `steps tree index counts children steps`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2) pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
val allSteps = pt.allSteps val allSteps = pt.allSteps
@ -148,8 +148,8 @@ class ProgressTrackerTest {
assertThat(stepsTreeNotification).hasSize(2) // The initial tree state, plus one per tree update assertThat(stepsTreeNotification).hasSize(2) // The initial tree state, plus one per tree update
} }
@Test @Test(timeout=300_000)
fun `steps tree index counts two levels of children steps`() { fun `steps tree index counts two levels of children steps`() {
pt.setChildProgressTracker(SimpleSteps.FOUR, pt2) pt.setChildProgressTracker(SimpleSteps.FOUR, pt2)
pt2.setChildProgressTracker(ChildSteps.SEA, pt3) pt2.setChildProgressTracker(ChildSteps.SEA, pt3)
val allSteps = pt.allSteps val allSteps = pt.allSteps
@ -183,8 +183,8 @@ class ProgressTrackerTest {
assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update
} }
@Test @Test(timeout=300_000)
fun `structure changes are pushed down when progress trackers are added`() { fun `structure changes are pushed down when progress trackers are added`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2) pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
// Capture notifications. // Capture notifications.
@ -220,8 +220,8 @@ class ProgressTrackerTest {
assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update. assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update.
} }
@Test @Test(timeout=300_000)
fun `structure changes are pushed down when progress trackers are removed`() { fun `structure changes are pushed down when progress trackers are removed`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2) pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
// Capture notifications. // Capture notifications.
@ -255,16 +255,16 @@ class ProgressTrackerTest {
assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update
} }
@Test @Test(timeout=300_000)
fun `can be rewound`() { fun `can be rewound`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2) pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
repeat(4) { pt.nextStep() } repeat(4) { pt.nextStep() }
pt.currentStep = SimpleSteps.ONE pt.currentStep = SimpleSteps.ONE
assertEquals(SimpleSteps.TWO, pt.nextStep()) assertEquals(SimpleSteps.TWO, pt.nextStep())
} }
@Test @Test(timeout=300_000)
fun `all index changes seen if subscribed mid flow`() { fun `all index changes seen if subscribed mid flow`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2) pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
pt.currentStep = SimpleSteps.ONE pt.currentStep = SimpleSteps.ONE
@ -280,8 +280,8 @@ class ProgressTrackerTest {
assertThat(stepsIndexNotifications).containsExactlyElementsOf(listOf(0, 1, 2, 3)) assertThat(stepsIndexNotifications).containsExactlyElementsOf(listOf(0, 1, 2, 3))
} }
@Test @Test(timeout=300_000)
fun `all step changes seen if subscribed mid flow`() { fun `all step changes seen if subscribed mid flow`() {
val steps = mutableListOf<String>() val steps = mutableListOf<String>()
pt.nextStep() pt.nextStep()
pt.nextStep() pt.nextStep()
@ -293,8 +293,8 @@ class ProgressTrackerTest {
assertEquals(listOf("Starting", "one", "two", "three", "four", "Done"), steps) assertEquals(listOf("Starting", "one", "two", "three", "four", "Done"), steps)
} }
@Test @Test(timeout=300_000)
fun `all tree changes seen if subscribed mid flow`() { fun `all tree changes seen if subscribed mid flow`() {
val stepTreeNotifications = mutableListOf<List<Pair<Int, String>>>() val stepTreeNotifications = mutableListOf<List<Pair<Int, String>>>()
val firstStepLabels = pt.allStepsLabels val firstStepLabels = pt.allStepsLabels
@ -310,8 +310,8 @@ class ProgressTrackerTest {
assertEquals(listOf(firstStepLabels, secondStepLabels, thirdStepLabels), stepTreeNotifications) assertEquals(listOf(firstStepLabels, secondStepLabels, thirdStepLabels), stepTreeNotifications)
} }
@Test @Test(timeout=300_000)
fun `trees with child trackers with duplicate steps reported correctly`() { fun `trees with child trackers with duplicate steps reported correctly`() {
val stepTreeNotifications = mutableListOf<List<Pair<Int, String>>>() val stepTreeNotifications = mutableListOf<List<Pair<Int, String>>>()
val stepIndexNotifications = mutableListOf<Int>() val stepIndexNotifications = mutableListOf<Int>()
pt.stepsTreeChanges.subscribe { stepTreeNotifications += it } pt.stepsTreeChanges.subscribe { stepTreeNotifications += it }
@ -329,8 +329,8 @@ class ProgressTrackerTest {
assertEquals(listOf(0, 1, 2, 3, 4, 5, 6), stepIndexNotifications) assertEquals(listOf(0, 1, 2, 3, 4, 5, 6), stepIndexNotifications)
} }
@Test @Test(timeout=300_000)
fun `cannot assign step not belonging to this progress tracker`() { fun `cannot assign step not belonging to this progress tracker`() {
assertFails { pt.currentStep = BabySteps.UNOS } assertFails { pt.currentStep = BabySteps.UNOS }
} }
@ -341,8 +341,8 @@ class ProgressTrackerTest {
fun tracker() = ProgressTracker(first, second, first2) fun tracker() = ProgressTracker(first, second, first2)
} }
@Test @Test(timeout=300_000)
fun `Serializing and deserializing a tracker maintains equality`() { fun `Serializing and deserializing a tracker maintains equality`() {
val step = NonSingletonSteps.first val step = NonSingletonSteps.first
val recreatedStep = step val recreatedStep = step
.checkpointSerialize(testCheckpointSerialization.checkpointSerializationContext) .checkpointSerialize(testCheckpointSerialization.checkpointSerializationContext)
@ -350,8 +350,8 @@ class ProgressTrackerTest {
assertEquals(step, recreatedStep) assertEquals(step, recreatedStep)
} }
@Test @Test(timeout=300_000)
fun `can assign a recreated equal step`() { fun `can assign a recreated equal step`() {
val tracker = NonSingletonSteps.tracker() val tracker = NonSingletonSteps.tracker()
val recreatedStep = first val recreatedStep = first
.checkpointSerialize(testCheckpointSerialization.checkpointSerializationContext) .checkpointSerialize(testCheckpointSerialization.checkpointSerializationContext)
@ -359,14 +359,14 @@ class ProgressTrackerTest {
tracker.currentStep = recreatedStep tracker.currentStep = recreatedStep
} }
@Test @Test(timeout=300_000)
fun `Steps with the same label defined in different places are not equal`() { fun `Steps with the same label defined in different places are not equal`() {
val one = ProgressTracker.Step("one") val one = ProgressTracker.Step("one")
assertNotEquals(one, SimpleSteps.ONE) assertNotEquals(one, SimpleSteps.ONE)
} }
@Test @Test(timeout=300_000)
fun `Steps with the same label defined in the same place are also not equal`() { fun `Steps with the same label defined in the same place are also not equal`() {
assertNotEquals(first, first2) assertNotEquals(first, first2)
} }
} }

View File

@ -8,16 +8,16 @@ import java.util.*
import java.util.concurrent.CancellationException import java.util.concurrent.CancellationException
class UtilsTest { class UtilsTest {
@Test @Test(timeout=300_000)
fun `toFuture - single item observable`() { fun `toFuture - single item observable`() {
val subject = PublishSubject.create<String>() val subject = PublishSubject.create<String>()
val future = subject.toFuture() val future = subject.toFuture()
subject.onNext("Hello") subject.onNext("Hello")
assertThat(future.getOrThrow()).isEqualTo("Hello") assertThat(future.getOrThrow()).isEqualTo("Hello")
} }
@Test @Test(timeout=300_000)
fun `toFuture - empty obserable`() { fun `toFuture - empty obserable`() {
val subject = PublishSubject.create<String>() val subject = PublishSubject.create<String>()
val future = subject.toFuture() val future = subject.toFuture()
subject.onCompleted() subject.onCompleted()
@ -26,8 +26,8 @@ class UtilsTest {
} }
} }
@Test @Test(timeout=300_000)
fun `toFuture - more than one item observable`() { fun `toFuture - more than one item observable`() {
val subject = PublishSubject.create<String>() val subject = PublishSubject.create<String>()
val future = subject.toFuture() val future = subject.toFuture()
subject.onNext("Hello") subject.onNext("Hello")
@ -36,8 +36,8 @@ class UtilsTest {
assertThat(future.getOrThrow()).isEqualTo("Hello") assertThat(future.getOrThrow()).isEqualTo("Hello")
} }
@Test @Test(timeout=300_000)
fun `toFuture - erroring observable`() { fun `toFuture - erroring observable`() {
val subject = PublishSubject.create<String>() val subject = PublishSubject.create<String>()
val future = subject.toFuture() val future = subject.toFuture()
val exception = Exception("Error") val exception = Exception("Error")
@ -47,8 +47,8 @@ class UtilsTest {
}.isSameAs(exception) }.isSameAs(exception)
} }
@Test @Test(timeout=300_000)
fun `toFuture - cancel`() { fun `toFuture - cancel`() {
val subject = PublishSubject.create<String>() val subject = PublishSubject.create<String>()
val future = subject.toFuture() val future = subject.toFuture()
future.cancel(false) future.cancel(false)

View File

@ -20,8 +20,8 @@ class ConcurrencyUtilsTest {
doNothing().whenever(it).error(any(), any<Throwable>()) doNothing().whenever(it).error(any(), any<Throwable>())
} }
@Test @Test(timeout=300_000)
fun `firstOf short circuit`() { fun `firstOf short circuit`() {
// Order not significant in this case: // Order not significant in this case:
val g = firstOf(arrayOf(f2, f1), log) { val g = firstOf(arrayOf(f2, f1), log) {
++invocations ++invocations
@ -38,8 +38,8 @@ class ConcurrencyUtilsTest {
verifyNoMoreInteractions(log) verifyNoMoreInteractions(log)
} }
@Test @Test(timeout=300_000)
fun `firstOf re-entrant handler attempt due to cancel`() { fun `firstOf re-entrant handler attempt due to cancel`() {
val futures = arrayOf(f1, f2) val futures = arrayOf(f1, f2)
val g = firstOf(futures, log) { val g = firstOf(futures, log) {
++invocations ++invocations
@ -56,8 +56,8 @@ class ConcurrencyUtilsTest {
/** /**
* Note that if you set CancellationException on CompletableFuture it will report isCancelled. * Note that if you set CancellationException on CompletableFuture it will report isCancelled.
*/ */
@Test @Test(timeout=300_000)
fun `firstOf re-entrant handler attempt not due to cancel`() { fun `firstOf re-entrant handler attempt not due to cancel`() {
val futures = arrayOf(f1, f2) val futures = arrayOf(f1, f2)
val nonCancel = IllegalStateException() val nonCancel = IllegalStateException()
val g = firstOf(futures, log) { val g = firstOf(futures, log) {
@ -73,8 +73,8 @@ class ConcurrencyUtilsTest {
assertThatThrownBy { f2.getOrThrow() }.isSameAs(nonCancel) assertThatThrownBy { f2.getOrThrow() }.isSameAs(nonCancel)
} }
@Test @Test(timeout=300_000)
fun `firstOf cancel is not special`() { fun `firstOf cancel is not special`() {
val g = firstOf(arrayOf(f2, f1), log) { val g = firstOf(arrayOf(f2, f1), log) {
++invocations ++invocations
it.getOrThrow() // This can always do something fancy if 'it' was cancelled. it.getOrThrow() // This can always do something fancy if 'it' was cancelled.
@ -85,8 +85,8 @@ class ConcurrencyUtilsTest {
verifyNoMoreInteractions(log) verifyNoMoreInteractions(log)
} }
@Test @Test(timeout=300_000)
fun `match does not pass failure of success block into the failure block`() { fun `match does not pass failure of success block into the failure block`() {
val f = CompletableFuture.completedFuture(100) val f = CompletableFuture.completedFuture(100)
val successes = mutableListOf<Any?>() val successes = mutableListOf<Any?>()
val failures = mutableListOf<Any?>() val failures = mutableListOf<Any?>()
@ -101,8 +101,8 @@ class ConcurrencyUtilsTest {
assertEquals(emptyList<Any?>(), failures) assertEquals(emptyList<Any?>(), failures)
} }
@Test @Test(timeout=300_000)
fun `match does not pass ExecutionException to failure block`() { fun `match does not pass ExecutionException to failure block`() {
val e = Throwable() val e = Throwable()
val f = CompletableFuture<Void>().apply { completeExceptionally(e) } val f = CompletableFuture<Void>().apply { completeExceptionally(e) }
val successes = mutableListOf<Any?>() val successes = mutableListOf<Any?>()

Some files were not shown because too many files have changed in this diff Show More