add timeouts to all tests (#5875)

This commit is contained in:
Stefano Franz 2020-02-11 10:14:05 +00:00 committed by GitHub
parent 1d0918cdde
commit b23af5f0d2
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,7 +18,7 @@ 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>>() {})
@ -26,7 +26,7 @@ class AmountTest {
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>>() {})
@ -34,7 +34,7 @@ class AmountTest {
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>>() {})
@ -42,7 +42,7 @@ class AmountTest {
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>>() {})
@ -50,7 +50,7 @@ class AmountTest {
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<*>>() {})
@ -58,7 +58,7 @@ class AmountTest {
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<*>>() {})
@ -66,19 +66,19 @@ class AmountTest {
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,13 +107,13 @@ 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,
@ -122,12 +122,12 @@ 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)
@ -136,7 +136,7 @@ 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)
@ -144,13 +144,13 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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()
@ -168,7 +168,7 @@ 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,7 +184,7 @@ 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)
@ -193,7 +193,7 @@ 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)
@ -203,7 +203,7 @@ 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)
@ -213,7 +213,7 @@ 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(
@ -235,7 +235,7 @@ 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)
@ -279,7 +279,7 @@ 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)
@ -288,35 +288,35 @@ 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)
@ -324,7 +324,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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)
@ -334,7 +334,7 @@ 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)
@ -342,19 +342,19 @@ 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 `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)
@ -362,7 +362,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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)
@ -370,7 +370,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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()),
@ -384,7 +384,7 @@ 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()),
@ -401,7 +401,7 @@ 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",
@ -413,27 +413,27 @@ 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)
@ -441,13 +441,13 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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)
@ -456,7 +456,7 @@ 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()))
@ -467,7 +467,7 @@ 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))
@ -478,7 +478,7 @@ 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()))
@ -489,7 +489,7 @@ 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,
@ -500,14 +500,14 @@ 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)
@ -515,7 +515,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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,7 +530,7 @@ 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)
@ -538,13 +538,13 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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)
@ -554,7 +554,7 @@ 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))
@ -562,7 +562,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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)
@ -584,7 +584,7 @@ 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)
@ -597,7 +597,7 @@ 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)
@ -610,7 +610,7 @@ 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)
@ -624,7 +624,7 @@ 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)
@ -639,7 +639,7 @@ 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)
@ -647,19 +647,19 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
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)
@ -668,7 +668,7 @@ 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
@ -677,13 +677,13 @@ 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,14 +13,14 @@ 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)

View File

@ -32,7 +32,7 @@ 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()
@ -45,7 +45,7 @@ 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,7 +66,7 @@ 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)
@ -77,7 +77,7 @@ 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)
@ -88,7 +88,7 @@ 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)

View File

@ -23,7 +23,7 @@ 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,7 +20,7 @@ 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)
@ -43,7 +43,7 @@ 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)
@ -82,7 +82,7 @@ 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)

View File

@ -20,7 +20,7 @@ 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,7 +37,7 @@ 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,7 +57,7 @@ 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,7 +42,7 @@ class ConcatenatedListTest {
} }
} }
@Test @Test(timeout=300_000)
fun addWorks() { fun addWorks() {
concatenatedList.checkInvariants() concatenatedList.checkInvariants()
assertEquals(replayedList.size, 1) assertEquals(replayedList.size, 1)
@ -85,7 +85,7 @@ 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"))
@ -113,7 +113,7 @@ 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()

View File

@ -21,7 +21,7 @@ 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,7 +54,7 @@ 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)
@ -76,7 +76,7 @@ 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)
@ -92,7 +92,7 @@ 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)

View File

@ -26,7 +26,7 @@ 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")
@ -73,7 +73,7 @@ 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))

View File

@ -19,7 +19,7 @@ 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,7 +36,7 @@ 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")
@ -48,7 +48,7 @@ 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,7 +17,7 @@ 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,7 +50,7 @@ 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)
@ -70,7 +70,7 @@ 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

View File

@ -28,7 +28,7 @@ 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

View File

@ -73,26 +73,26 @@ 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)
@ -149,7 +149,7 @@ 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)
@ -165,7 +165,7 @@ 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 {
@ -173,7 +173,7 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
} }
} }
@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
@ -191,7 +191,7 @@ 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)
@ -230,7 +230,7 @@ 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,7 +27,7 @@ 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
@ -39,7 +39,7 @@ 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)
@ -52,7 +52,7 @@ 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,7 +64,7 @@ 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,7 +83,7 @@ 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 {
@ -115,7 +115,7 @@ 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 {
@ -142,7 +142,7 @@ 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) {
@ -165,7 +165,7 @@ 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()
@ -181,7 +181,7 @@ 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()
@ -191,7 +191,7 @@ 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()
@ -215,7 +215,7 @@ 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 {
@ -247,7 +247,7 @@ 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 {
@ -274,7 +274,7 @@ 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 {
@ -301,7 +301,7 @@ 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 {
@ -330,7 +330,7 @@ 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 {
@ -371,7 +371,7 @@ 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
@ -390,7 +390,7 @@ 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 {
@ -411,7 +411,7 @@ 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 {
@ -483,7 +483,7 @@ 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 {
@ -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,7 +576,7 @@ 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,7 +617,7 @@ 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,7 +28,7 @@ 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,7 +43,7 @@ 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,7 +57,7 @@ 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,7 +92,7 @@ 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))
@ -107,7 +107,7 @@ 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))
@ -121,13 +121,13 @@ 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(
@ -144,12 +144,12 @@ 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,7 +171,7 @@ 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,7 +194,7 @@ 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)
@ -220,7 +220,7 @@ 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)
@ -235,7 +235,7 @@ 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,7 +247,7 @@ 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 ->

View File

@ -72,7 +72,7 @@ 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()
@ -88,7 +88,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `simple observable`() { fun `simple observable`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
@ -98,7 +98,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `complex observables`() { fun `complex observables`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
@ -143,7 +143,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `simple ListenableFuture`() { fun `simple ListenableFuture`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
@ -152,7 +152,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `complex ListenableFuture`() { fun `complex ListenableFuture`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
@ -180,7 +180,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun versioning() { fun versioning() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()
@ -188,7 +188,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
} }
} }
@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()

View File

@ -104,7 +104,7 @@ 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()
@ -140,7 +140,7 @@ 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.
@ -164,7 +164,7 @@ class RPCConcurrencyTests : AbstractRPCTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `parallel nested observables`() { fun `parallel nested observables`() {
rpcDriver { rpcDriver {
val proxy = testProxy() val proxy = testProxy()

View File

@ -46,27 +46,27 @@ 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)

View File

@ -29,7 +29,7 @@ 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()

View File

@ -76,7 +76,7 @@ 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)
@ -118,7 +118,7 @@ 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)
@ -148,7 +148,7 @@ 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 ->

View File

@ -46,7 +46,7 @@ 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())
@ -57,7 +57,7 @@ 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))
@ -67,7 +67,7 @@ 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))
@ -77,7 +77,7 @@ 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))
@ -91,7 +91,7 @@ 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))
@ -105,7 +105,7 @@ 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))
@ -128,7 +128,7 @@ 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"))

View File

@ -8,7 +8,7 @@ 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"
@ -25,7 +25,7 @@ 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"
@ -41,7 +41,7 @@ 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"
@ -57,7 +57,7 @@ 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"
@ -73,7 +73,7 @@ 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"
@ -88,7 +88,7 @@ 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"
@ -104,7 +104,7 @@ 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"
@ -119,7 +119,7 @@ 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"
@ -135,7 +135,7 @@ 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"
@ -151,7 +151,7 @@ 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"
@ -167,7 +167,7 @@ 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"
@ -182,7 +182,7 @@ 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"
@ -198,7 +198,7 @@ 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"
@ -214,7 +214,7 @@ 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"
@ -229,7 +229,7 @@ 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"

View File

@ -7,7 +7,7 @@ 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"
@ -26,7 +26,7 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun missing_value() { fun missing_value() {
val key = "a.b.c" val key = "a.b.c"
@ -45,7 +45,7 @@ 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"
@ -64,7 +64,7 @@ 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"
@ -83,7 +83,7 @@ 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"
@ -97,7 +97,7 @@ 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"
@ -125,7 +125,7 @@ class PropertyValidationTest {
} }
} }
@Test @Test(timeout=300_000)
fun wrong_type() { fun wrong_type() {
val key = "a.b.c" val key = "a.b.c"
@ -145,7 +145,7 @@ 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,7 +165,7 @@ 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,7 +177,7 @@ 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,7 +197,7 @@ 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,7 +217,7 @@ 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,7 +237,7 @@ 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,7 +260,7 @@ 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,7 +283,7 @@ 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,7 +306,7 @@ 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,7 +320,7 @@ 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,7 +336,7 @@ 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,7 +7,7 @@ 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"
@ -35,7 +35,7 @@ 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"
@ -74,7 +74,7 @@ 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"
@ -103,7 +103,7 @@ 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"
@ -133,7 +133,7 @@ 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"
@ -164,7 +164,7 @@ 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"

View File

@ -30,7 +30,7 @@ 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
@ -53,7 +53,7 @@ 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,7 +75,7 @@ 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)
@ -93,7 +93,7 @@ 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,7 +130,7 @@ 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
@ -151,7 +151,7 @@ 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,7 +6,7 @@ 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,7 +12,7 @@ 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
@ -22,7 +22,7 @@ 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,7 +31,7 @@ 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,7 +41,7 @@ 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,7 +51,7 @@ 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,7 +9,7 @@ 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")
@ -31,7 +31,7 @@ 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

View File

@ -46,7 +46,7 @@ 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)
@ -74,7 +74,7 @@ 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)

View File

@ -46,7 +46,7 @@ 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)),
@ -72,7 +72,7 @@ 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)
@ -84,7 +84,7 @@ 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()
@ -96,7 +96,7 @@ 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()

View File

@ -35,32 +35,32 @@ 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)

View File

@ -55,7 +55,7 @@ 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
@ -68,7 +68,7 @@ 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)

View File

@ -9,24 +9,24 @@ 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,7 +14,7 @@ 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())
@ -22,13 +22,13 @@ class UniqueIdentifierTest {
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() }

View File

@ -6,7 +6,7 @@ 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,14 +7,14 @@ 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")
@ -22,7 +22,7 @@ class SecureHashTest {
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))
@ -30,7 +30,7 @@ class SecureHashTest {
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,7 +14,7 @@ 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,7 +30,7 @@ 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,7 +57,7 @@ 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() }
@ -103,7 +103,7 @@ 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.

View File

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

View File

@ -16,12 +16,12 @@ 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,13 +57,13 @@ 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

View File

@ -74,7 +74,7 @@ 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()
@ -103,7 +103,7 @@ 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,13 +19,13 @@ 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)
@ -48,7 +48,7 @@ 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)
@ -63,7 +63,7 @@ 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"
@ -88,7 +88,7 @@ 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"
@ -119,7 +119,7 @@ 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"
@ -167,7 +167,7 @@ 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,7 +96,7 @@ 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 {
@ -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,7 +156,7 @@ 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 {
@ -177,7 +177,7 @@ 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 {
@ -210,7 +210,7 @@ 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 {
@ -229,7 +229,7 @@ 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) {
@ -251,7 +251,7 @@ 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 {
@ -272,7 +272,7 @@ 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 {
@ -300,7 +300,7 @@ 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)
@ -326,7 +326,7 @@ 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)
@ -378,7 +378,7 @@ 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 {
@ -397,7 +397,7 @@ 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 {
@ -416,7 +416,7 @@ 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 {
@ -435,7 +435,7 @@ 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 {
@ -460,7 +460,7 @@ 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 {
@ -479,7 +479,7 @@ 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 {

View File

@ -34,7 +34,7 @@ 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)

View File

@ -40,7 +40,7 @@ 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)
@ -53,7 +53,7 @@ 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) }
@ -74,7 +74,7 @@ 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)
@ -83,7 +83,7 @@ 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()
@ -92,7 +92,7 @@ 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()
@ -101,7 +101,7 @@ 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()
@ -123,7 +123,7 @@ 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)
@ -132,7 +132,7 @@ 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()
@ -141,7 +141,7 @@ 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()
@ -150,7 +150,7 @@ 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()
@ -159,7 +159,7 @@ 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()
@ -168,7 +168,7 @@ 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()

View File

@ -54,7 +54,7 @@ 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 {
@ -66,7 +66,7 @@ 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 {
@ -78,7 +78,7 @@ 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

View File

@ -15,7 +15,7 @@ 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)
@ -27,7 +27,7 @@ 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()
@ -39,7 +39,7 @@ 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)
@ -56,7 +56,7 @@ 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)
@ -66,7 +66,7 @@ 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)

View File

@ -41,7 +41,7 @@ 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(
@ -53,7 +53,7 @@ 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,7 +72,7 @@ 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(
@ -84,7 +84,7 @@ 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(
@ -96,7 +96,7 @@ 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(
@ -110,7 +110,7 @@ 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)
@ -123,7 +123,7 @@ 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)
@ -136,7 +136,7 @@ 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,7 +153,7 @@ 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(
@ -163,7 +163,7 @@ 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,
@ -178,7 +178,7 @@ 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,
@ -191,7 +191,7 @@ 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,
@ -204,7 +204,7 @@ 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,
@ -222,7 +222,7 @@ 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)
@ -236,7 +236,7 @@ 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)
@ -252,7 +252,7 @@ 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)
@ -266,7 +266,7 @@ 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)
@ -280,7 +280,7 @@ 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))
@ -295,7 +295,7 @@ 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")
@ -310,7 +310,7 @@ 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)))

View File

@ -49,13 +49,13 @@ 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) }
@ -64,14 +64,14 @@ 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()) }
@ -79,7 +79,7 @@ class CompositeKeyTests {
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()
@ -90,7 +90,7 @@ 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,7 +101,7 @@ 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,7 +112,7 @@ 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)
@ -130,7 +130,7 @@ 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
@ -160,7 +160,7 @@ 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)
@ -289,7 +289,7 @@ 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)
@ -313,7 +313,7 @@ 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)
@ -367,7 +367,7 @@ 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)

View File

@ -100,24 +100,24 @@ 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])
@ -127,7 +127,7 @@ 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)),
@ -139,7 +139,7 @@ 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) {
@ -171,7 +171,7 @@ 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()
@ -181,7 +181,7 @@ 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())
@ -197,32 +197,32 @@ 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 }
@ -230,7 +230,7 @@ class PartialMerkleTreeTest {
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)
@ -238,7 +238,7 @@ class PartialMerkleTreeTest {
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)
@ -246,7 +246,7 @@ class PartialMerkleTreeTest {
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])
@ -255,14 +255,14 @@ 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)
@ -293,7 +293,7 @@ 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()) }
@ -339,7 +339,7 @@ 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) {

View File

@ -25,7 +25,7 @@ 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)

View File

@ -21,7 +21,7 @@ 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")
@ -47,7 +47,7 @@ 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.
@ -94,7 +94,7 @@ 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()

View File

@ -57,7 +57,7 @@ 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,7 +92,7 @@ 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,7 +135,7 @@ 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,7 +45,7 @@ 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,7 +67,7 @@ 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()
@ -82,7 +82,7 @@ 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)

View File

@ -67,7 +67,7 @@ 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,7 +78,7 @@ 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)
@ -97,7 +97,7 @@ 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)
@ -142,7 +142,7 @@ 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)
@ -157,7 +157,7 @@ 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))
@ -167,7 +167,7 @@ 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))
@ -176,7 +176,7 @@ 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),

View File

@ -42,7 +42,7 @@ 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)

View File

@ -46,7 +46,7 @@ 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))
@ -116,7 +116,7 @@ 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()

View File

@ -31,7 +31,7 @@ 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,7 +40,7 @@ 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,7 +49,7 @@ 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,7 +58,7 @@ 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>() {
@ -89,14 +89,14 @@ 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()

View File

@ -34,7 +34,7 @@ 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,7 +46,7 @@ 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,7 +56,7 @@ 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)
@ -68,7 +68,7 @@ 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()))

View File

@ -28,7 +28,7 @@ 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()
@ -41,7 +41,7 @@ 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()
@ -58,7 +58,7 @@ 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()
@ -76,7 +76,7 @@ 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()
@ -92,7 +92,7 @@ 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()
@ -110,7 +110,7 @@ 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()
@ -128,7 +128,7 @@ 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()
@ -143,7 +143,7 @@ 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()
@ -160,7 +160,7 @@ 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()
@ -177,7 +177,7 @@ 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()

View File

@ -16,7 +16,7 @@ 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()
@ -29,7 +29,7 @@ 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()

View File

@ -35,7 +35,7 @@ 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()
@ -48,7 +48,7 @@ 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()
@ -65,7 +65,7 @@ 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()
@ -83,7 +83,7 @@ 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()
@ -96,7 +96,7 @@ 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()
@ -114,7 +114,7 @@ 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()
@ -132,7 +132,7 @@ 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()
@ -149,7 +149,7 @@ 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()
@ -166,7 +166,7 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
} }
} }
@Test @Test(timeout=300_000)
fun `vault can be queried`() { fun `vault can be queried`() {
driver( driver(
DriverParameters( DriverParameters(
@ -181,7 +181,7 @@ 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()
@ -191,7 +191,7 @@ 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()
@ -201,7 +201,7 @@ 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()
@ -211,7 +211,7 @@ 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()
@ -221,7 +221,7 @@ 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()

View File

@ -32,7 +32,7 @@ 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,7 +66,7 @@ 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)
@ -78,7 +78,7 @@ 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)

View File

@ -33,7 +33,7 @@ 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

View File

@ -44,7 +44,7 @@ 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()
@ -70,7 +70,7 @@ 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()
@ -102,7 +102,7 @@ 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()
@ -118,7 +118,7 @@ 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()
@ -170,7 +170,7 @@ 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()

View File

@ -24,13 +24,13 @@ 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"),
@ -41,7 +41,7 @@ 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"),

View File

@ -11,7 +11,7 @@ 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

View File

@ -10,14 +10,14 @@ 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)) }
@ -27,7 +27,7 @@ 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).

View File

@ -111,7 +111,7 @@ 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()
@ -126,7 +126,7 @@ 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
@ -151,7 +151,7 @@ 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
@ -175,7 +175,7 @@ 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
@ -196,7 +196,7 @@ 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

View File

@ -84,7 +84,7 @@ 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)
@ -98,7 +98,7 @@ 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)
@ -107,7 +107,7 @@ 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)
@ -121,7 +121,7 @@ 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
@ -149,7 +149,7 @@ 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()
@ -176,7 +176,7 @@ 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)
@ -185,7 +185,7 @@ 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()
@ -195,7 +195,7 @@ 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)
@ -204,7 +204,7 @@ 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 {
@ -217,7 +217,7 @@ 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
@ -234,7 +234,7 @@ 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
@ -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,7 +43,7 @@ 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)
@ -54,7 +54,7 @@ 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)
@ -65,7 +65,7 @@ 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
@ -94,7 +94,7 @@ 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(
@ -112,7 +112,7 @@ 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,13 +31,13 @@ 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,21 +41,21 @@ 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))
@ -63,7 +63,7 @@ class VaultUpdateTests {
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())
@ -71,7 +71,7 @@ class VaultUpdateTests {
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))
@ -79,7 +79,7 @@ class VaultUpdateTests {
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))
@ -87,7 +87,7 @@ class VaultUpdateTests {
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)

View File

@ -54,55 +54,55 @@ 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,14 +169,14 @@ 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)
@ -184,7 +184,7 @@ class AttachmentSerializationTest {
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.
@ -193,7 +193,7 @@ 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)

View File

@ -14,7 +14,7 @@ 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,7 +19,7 @@ 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(

View File

@ -93,7 +93,7 @@ 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,7 +111,7 @@ 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,7 +134,7 @@ 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)
@ -142,7 +142,7 @@ class TransactionSerializationTests {
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)

View File

@ -41,7 +41,7 @@ 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
@ -77,7 +77,7 @@ 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()
@ -86,7 +86,7 @@ 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()
@ -95,7 +95,7 @@ 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()

View File

@ -77,14 +77,14 @@ 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")
@ -94,7 +94,7 @@ 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,7 +104,7 @@ 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)
@ -114,7 +114,7 @@ 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,7 +123,7 @@ 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,7 +136,7 @@ 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,7 +146,7 @@ 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")
@ -156,7 +156,7 @@ 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")
@ -164,7 +164,7 @@ class AttachmentsClassLoaderTests {
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,7 +174,7 @@ 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,7 +184,7 @@ 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.
@ -195,7 +195,7 @@ 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,7 +213,7 @@ 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")
@ -231,7 +231,7 @@ 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()
@ -260,7 +260,7 @@ 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()
@ -290,7 +290,7 @@ 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()
@ -310,7 +310,7 @@ 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()
@ -341,7 +341,7 @@ 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()
@ -387,7 +387,7 @@ 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,7 +425,7 @@ 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()

View File

@ -69,7 +69,7 @@ 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)
@ -129,7 +129,7 @@ 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)
@ -198,7 +198,7 @@ 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.
@ -295,7 +295,7 @@ 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))
@ -414,7 +414,7 @@ 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,7 +557,7 @@ 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

View File

@ -98,7 +98,7 @@ 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)
@ -108,7 +108,7 @@ 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)
@ -118,7 +118,7 @@ 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)
@ -128,7 +128,7 @@ 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)
@ -138,7 +138,7 @@ 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)
@ -148,7 +148,7 @@ 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)
@ -161,7 +161,7 @@ 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)
@ -174,7 +174,7 @@ 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)
@ -187,7 +187,7 @@ 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)
@ -202,7 +202,7 @@ 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)
@ -215,7 +215,7 @@ 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 })
@ -225,7 +225,7 @@ 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 })
@ -237,7 +237,7 @@ 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 })
@ -247,7 +247,7 @@ 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 })
@ -261,7 +261,7 @@ 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 })
@ -271,7 +271,7 @@ 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 })
@ -280,7 +280,7 @@ 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 })
@ -289,7 +289,7 @@ 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 })
@ -298,7 +298,7 @@ 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 })
@ -307,7 +307,7 @@ 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 })

View File

@ -103,7 +103,7 @@ 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
@ -142,7 +142,7 @@ 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 {
@ -161,7 +161,7 @@ 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) {
@ -197,7 +197,7 @@ 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))

View File

@ -63,7 +63,7 @@ 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(),
@ -80,7 +80,7 @@ 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)
@ -92,7 +92,7 @@ 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)
@ -114,7 +114,7 @@ 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

View File

@ -82,7 +82,7 @@ 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) {
@ -145,7 +145,7 @@ 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> {
@ -214,7 +214,7 @@ 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 {
@ -235,7 +235,7 @@ 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 {
@ -256,7 +256,7 @@ 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 {
@ -275,7 +275,7 @@ 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 {
@ -288,7 +288,7 @@ 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 {
@ -302,7 +302,7 @@ 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 {
@ -323,7 +323,7 @@ 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> {

View File

@ -53,7 +53,7 @@ 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()
@ -87,7 +87,7 @@ 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)),
@ -118,7 +118,7 @@ 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<*>>()
@ -148,7 +148,7 @@ 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(
@ -163,7 +163,7 @@ 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)
@ -201,7 +201,7 @@ 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(

View File

@ -34,7 +34,7 @@ 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
@ -42,7 +42,7 @@ class KotlinUtilsTest {
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
@ -52,7 +52,7 @@ 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")
@ -60,7 +60,7 @@ class KotlinUtilsTest {
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
@ -71,7 +71,7 @@ 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,17 +42,17 @@ 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()

View File

@ -59,7 +59,7 @@ 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)
@ -76,14 +76,14 @@ 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 {
@ -109,7 +109,7 @@ 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)
@ -148,7 +148,7 @@ 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)
@ -183,7 +183,7 @@ 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)
@ -220,7 +220,7 @@ 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)
@ -255,7 +255,7 @@ 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() }
@ -263,7 +263,7 @@ class ProgressTrackerTest {
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)
@ -280,7 +280,7 @@ 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()
@ -293,7 +293,7 @@ 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,7 +310,7 @@ 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>()
@ -329,7 +329,7 @@ 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,7 +341,7 @@ 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
@ -350,7 +350,7 @@ 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
@ -359,13 +359,13 @@ 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,7 +8,7 @@ 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()
@ -16,7 +16,7 @@ class UtilsTest {
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()
@ -26,7 +26,7 @@ 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()
@ -36,7 +36,7 @@ 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()
@ -47,7 +47,7 @@ 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()

View File

@ -20,7 +20,7 @@ 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) {
@ -38,7 +38,7 @@ 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) {
@ -56,7 +56,7 @@ 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()
@ -73,7 +73,7 @@ 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
@ -85,7 +85,7 @@ 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?>()
@ -101,7 +101,7 @@ 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) }

View File

@ -4,7 +4,7 @@ import org.assertj.core.api.Assertions.assertThatExceptionOfType
import org.junit.Test import org.junit.Test
class PrivacySaltTest { class PrivacySaltTest {
@Test @Test(timeout=300_000)
fun `all-zero PrivacySalt not allowed`() { fun `all-zero PrivacySalt not allowed`() {
assertThatExceptionOfType(IllegalArgumentException::class.java).isThrownBy { assertThatExceptionOfType(IllegalArgumentException::class.java).isThrownBy {
PrivacySalt(ByteArray(32)) PrivacySalt(ByteArray(32))

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