mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Merge pull request #5940 from corda/release/os/4.4
Merge OS 4.4 -> OS 4.5
This commit is contained in:
commit
4a54374f86
3
.ci/Dockerfile
Normal file
3
.ci/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM amazoncorretto:8u242
|
||||
RUN yum install -y shadow-utils
|
||||
RUN useradd -m buildUser
|
@ -18,7 +18,7 @@ class AmountTest {
|
||||
private val yamlMapper: ObjectMapper = ObjectMapper(YAMLFactory()).registerModule(CordaModule())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Currency) JSON deserialization`() {
|
||||
val str = """{ "quantity": 100, "token": "USD" }"""
|
||||
val amount = jsonMapper.readValue<Amount<Currency>>(str, object : TypeReference<Amount<Currency>>() {})
|
||||
@ -26,7 +26,7 @@ class AmountTest {
|
||||
assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Currency) YAML deserialization`() {
|
||||
val str = """{ quantity: 100, token: USD }"""
|
||||
val amount = yamlMapper.readValue<Amount<Currency>>(str, object : TypeReference<Amount<Currency>>() {})
|
||||
@ -34,7 +34,7 @@ class AmountTest {
|
||||
assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(CarbonCredit) JSON deserialization`() {
|
||||
val str = """{ "quantity": 200, "token": { "type": "CO2" } }"""
|
||||
val amount = jsonMapper.readValue<Amount<CarbonCredit>>(str, object : TypeReference<Amount<CarbonCredit>>() {})
|
||||
@ -42,7 +42,7 @@ class AmountTest {
|
||||
assertThat(amount.token).isEqualTo(CO2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(CarbonCredit) YAML deserialization`() {
|
||||
val str = """{ quantity: 250, token: { type: CO2 } }"""
|
||||
val amount = yamlMapper.readValue<Amount<CarbonCredit>>(str, object : TypeReference<Amount<CarbonCredit>>() {})
|
||||
@ -50,7 +50,7 @@ class AmountTest {
|
||||
assertThat(amount.token).isEqualTo(CO2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Unknown) JSON deserialization`() {
|
||||
val str = """{ "quantity": 100, "token": "USD" }"""
|
||||
val amount = jsonMapper.readValue<Amount<*>>(str, object : TypeReference<Amount<*>>() {})
|
||||
@ -58,7 +58,7 @@ class AmountTest {
|
||||
assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Unknown) YAML deserialization`() {
|
||||
val str = """{ quantity: 100, token: USD }"""
|
||||
val amount = yamlMapper.readValue<Amount<*>>(str, object : TypeReference<Amount<*>>() {})
|
||||
@ -66,19 +66,19 @@ class AmountTest {
|
||||
assertThat(amount.token).isEqualTo(Currency.getInstance("USD"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Currency) YAML serialization`() {
|
||||
assertThat(yamlMapper.valueToTree<TextNode>(Amount.parseCurrency("£25000000"))).isEqualTo(TextNode("25000000.00 GBP"))
|
||||
assertThat(yamlMapper.valueToTree<TextNode>(Amount.parseCurrency("$250000"))).isEqualTo(TextNode("250000.00 USD"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(CarbonCredit) JSON serialization`() {
|
||||
assertThat(jsonMapper.writeValueAsString(Amount(123456, CO2)).trim())
|
||||
.isEqualTo(""""123456 CarbonCredit(type=CO2)"""")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(CarbonCredit) YAML serialization`() {
|
||||
assertThat(yamlMapper.writeValueAsString(Amount(123456, CO2)).trim())
|
||||
.isEqualTo("""--- "123456 CarbonCredit(type=CO2)"""")
|
||||
|
@ -107,13 +107,13 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
doReturn(attachments).whenever(services).attachments
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Currency) serialization`() {
|
||||
assertThat(mapper.valueToTree<TextNode>(Amount.parseCurrency("£25000000")).textValue()).isEqualTo("25000000.00 GBP")
|
||||
assertThat(mapper.valueToTree<TextNode>(Amount.parseCurrency("$250000")).textValue()).isEqualTo("250000.00 USD")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Currency) deserialization`() {
|
||||
val old = mapOf(
|
||||
"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))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Amount(Currency) Text deserialization`() {
|
||||
assertThat(mapper.convertValue<Amount<Currency>>(TextNode("$25000000"))).isEqualTo(Amount(2_500_000_000, USD))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun ByteSequence() {
|
||||
val byteSequence: ByteSequence = OpaqueBytes.of(1, 2, 3, 4).subSequence(0, 2)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `OpaqueBytes serialization`() {
|
||||
val opaqueBytes = OpaqueBytes(secureRandomBytes(128))
|
||||
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())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `OpaqueBytes deserialization`() {
|
||||
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))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun SerializedBytes() {
|
||||
val data = TestData(BOB_NAME, "Summary", SubTestData(1234))
|
||||
val serializedBytes = data.serialize()
|
||||
@ -168,7 +168,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
// @CordaSerializable
|
||||
// data class ClassNotOnClasspath(val name: CordaX500Name, val value: Int)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `SerializedBytes of class not on classpath`() {
|
||||
// The contents of the file were written out as follows:
|
||||
// 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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun DigitalSignature() {
|
||||
val digitalSignature = DigitalSignature(secureRandomBytes(128))
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `DigitalSignature WithKey`() {
|
||||
val digitalSignature = DigitalSignature.WithKey(BOB_PUBKEY, secureRandomBytes(128))
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun DigitalSignatureWithCert() {
|
||||
val digitalSignature = DigitalSignatureWithCert(MINI_CORP.identity.certificate, secureRandomBytes(128))
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun TransactionSignature() {
|
||||
val signatureMetadata = SignatureMetadata(1, 1)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `SignedTransaction (WireTransaction)`() {
|
||||
val attachmentId = SecureHash.randomSHA256()
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun TransactionState() {
|
||||
val txState = createTransactionState()
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun Command() {
|
||||
val command = Command(DummyCommandData, listOf(BOB_PUBKEY))
|
||||
val json = mapper.valueToTree<ObjectNode>(command)
|
||||
assertThat(mapper.convertValue<Command<*>>(json)).isEqualTo(command)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `TimeWindow - fromOnly`() {
|
||||
val fromOnly = TimeWindow.fromOnly(Instant.now())
|
||||
val json = mapper.valueToTree<ObjectNode>(fromOnly)
|
||||
assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(fromOnly)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `TimeWindow - untilOnly`() {
|
||||
val untilOnly = TimeWindow.untilOnly(Instant.now())
|
||||
val json = mapper.valueToTree<ObjectNode>(untilOnly)
|
||||
assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(untilOnly)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `TimeWindow - between`() {
|
||||
val between = TimeWindow.between(Instant.now(), Instant.now() + 1.days)
|
||||
val json = mapper.valueToTree<ObjectNode>(between)
|
||||
assertThat(mapper.convertValue<TimeWindow>(json)).isEqualTo(between)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun PrivacySalt() {
|
||||
val privacySalt = net.corda.core.contracts.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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun SignatureMetadata() {
|
||||
val signatureMetadata = SignatureMetadata(2, Crypto.ECDSA_SECP256R1_SHA256.schemeNumberID)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `SignatureMetadata on unknown schemeNumberID`() {
|
||||
val signatureMetadata = SignatureMetadata(2, Int.MAX_VALUE)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `SignatureScheme serialization`() {
|
||||
val json = mapper.valueToTree<TextNode>(Crypto.ECDSA_SECP256R1_SHA256)
|
||||
assertThat(json.textValue()).isEqualTo("ECDSA_SECP256R1_SHA256")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `SignatureScheme deserialization`() {
|
||||
assertThat(mapper.convertValue<SignatureScheme>(TextNode("EDDSA_ED25519_SHA512"))).isSameAs(Crypto.EDDSA_ED25519_SHA512)
|
||||
assertThat(mapper.convertValue<SignatureScheme>(IntNode(4))).isSameAs(Crypto.EDDSA_ED25519_SHA512)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `PartialTree IncludedLeaf`() {
|
||||
val includedLeaf = PartialTree.IncludedLeaf(SecureHash.randomSHA256())
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `PartialTree Leaf`() {
|
||||
val leaf = PartialTree.Leaf(SecureHash.randomSHA256())
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `simple PartialTree Node`() {
|
||||
val node = PartialTree.Node(
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `complex PartialTree Node`() {
|
||||
val node = PartialTree.Node(
|
||||
left = PartialTree.IncludedLeaf(SecureHash.randomSHA256()),
|
||||
@ -401,7 +401,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
// TODO Issued
|
||||
// TODO PartyAndReference
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun CordaX500Name() {
|
||||
testToStringSerialisation(CordaX500Name(
|
||||
commonName = "COMMON",
|
||||
@ -413,27 +413,27 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `SecureHash SHA256`() {
|
||||
testToStringSerialisation(SecureHash.randomSHA256())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun NetworkHostAndPort() {
|
||||
testToStringSerialisation(NetworkHostAndPort("localhost", 9090))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun UUID() {
|
||||
testToStringSerialisation(UUID.randomUUID())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun Instant() {
|
||||
testToStringSerialisation(Instant.now())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Date is treated as Instant`() {
|
||||
val date = 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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Party serialization`() {
|
||||
val json = mapper.valueToTree<TextNode>(MINI_CORP.party)
|
||||
assertThat(json.textValue()).isEqualTo(MINI_CORP.name.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Party serialization with isFullParty = true`() {
|
||||
partyObjectMapper.isFullParties = true
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Party deserialization on full name`() {
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Party deserialization on part of name`() {
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Party deserialization on public key`() {
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Party deserialization on name and key`() {
|
||||
val party = mapper.convertValue<Party>(mapOf(
|
||||
"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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun PublicKey() {
|
||||
val json = mapper.valueToTree<TextNode>(MINI_CORP.publicKey)
|
||||
assertThat(json.textValue()).isEqualTo(MINI_CORP.publicKey.toBase58String())
|
||||
assertThat(mapper.convertValue<PublicKey>(json)).isEqualTo(MINI_CORP.publicKey)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `EdDSA public key`() {
|
||||
val publicKey = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, SEED).public
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun CompositeKey() {
|
||||
val innerKeys = (1..3).map { i ->
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun AnonymousParty() {
|
||||
val anonymousParty = AnonymousParty(ALICE_PUBKEY)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `PartyAndCertificate serialization`() {
|
||||
val json = mapper.valueToTree<TextNode>(MINI_CORP.identity)
|
||||
assertThat(json.textValue()).isEqualTo(MINI_CORP.name.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `PartyAndCertificate serialization with isFullParty = true`() {
|
||||
partyObjectMapper.isFullParties = true
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `PartyAndCertificate deserialization on cert path`() {
|
||||
val certPathJson = mapper.valueToTree<JsonNode>(MINI_CORP.identity.certPath)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `NodeInfo serialization`() {
|
||||
val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `NodeInfo deserialization on name`() {
|
||||
val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME)
|
||||
|
||||
@ -597,7 +597,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
assertThat(convertToNodeInfo()).isEqualTo(nodeInfo)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `NodeInfo deserialization on public key`() {
|
||||
val (nodeInfo) = createNodeInfoAndSigned(ALICE_NAME)
|
||||
|
||||
@ -610,7 +610,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
assertThat(convertToNodeInfo()).isEqualTo(nodeInfo)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun CertPath() {
|
||||
val certPath = MINI_CORP.identity.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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `X509Certificate serialization`() {
|
||||
val cert: X509Certificate = MINI_CORP.identity.certificate
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `X509Certificate serialization when extendedKeyUsage is null`() {
|
||||
val cert: X509Certificate = spy(MINI_CORP.identity.certificate)
|
||||
whenever(cert.extendedKeyUsage).thenReturn(null)
|
||||
@ -647,19 +647,19 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
mapper.valueToTree<ObjectNode>(cert)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `X509Certificate deserialization`() {
|
||||
val cert: X509Certificate = MINI_CORP.identity.certificate
|
||||
assertThat(mapper.convertValue<X509Certificate>(mapOf("encoded" to cert.encoded))).isEqualTo(cert)
|
||||
assertThat(mapper.convertValue<X509Certificate>(BinaryNode(cert.encoded))).isEqualTo(cert)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun X500Principal() {
|
||||
testToStringSerialisation(X500Principal("CN=Common,L=London,O=Org,C=UK"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `@CordaSerializable class which has non-c'tor properties`() {
|
||||
val data = NonCtorPropertiesData(4434)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `LinearState where the linearId property does not match the backing field`() {
|
||||
val funkyLinearState = FunkyLinearState(UniqueIdentifier())
|
||||
// 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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `kotlin object`() {
|
||||
val json = mapper.valueToTree<ObjectNode>(KotlinObject)
|
||||
assertThat(mapper.convertValue<KotlinObject>(json)).isSameAs(KotlinObject)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `@CordaSerializable kotlin object`() {
|
||||
val json = mapper.valueToTree<ObjectNode>(CordaSerializableKotlinObject)
|
||||
assertThat(mapper.convertValue<CordaSerializableKotlinObject>(json)).isSameAs(CordaSerializableKotlinObject)
|
||||
|
@ -13,14 +13,14 @@ class StateMachineRunIdTest {
|
||||
private val jsonMapper: ObjectMapper = ObjectMapper().registerModule(CordaModule())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `state machine run ID deserialise`() {
|
||||
val str = """"$ID""""
|
||||
val runID = jsonMapper.readValue(str, StateMachineRunId::class.java)
|
||||
assertEquals(StateMachineRunId(UUID.fromString(ID)), runID)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `state machine run ID serialise`() {
|
||||
val runId = StateMachineRunId(UUID.fromString(ID))
|
||||
val str = jsonMapper.writeValueAsString(runId)
|
||||
|
@ -32,7 +32,7 @@ class StringToMethodCallParserTest {
|
||||
"overload a: A, b: B" to "AB"
|
||||
)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun calls() {
|
||||
val parser = StringToMethodCallParser(Target::class)
|
||||
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.
|
||||
* Deque is chosen as we still expect it to preserve the order of its elements.
|
||||
*/
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun complexNestedGenericMethod() {
|
||||
val parser = StringToMethodCallParser(Target::class)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun ctor1() {
|
||||
val clazz = ConstructorTarget::class.java
|
||||
val parser = StringToMethodCallParser(clazz)
|
||||
@ -77,7 +77,7 @@ class StringToMethodCallParserTest {
|
||||
assertArrayEquals(arrayOf("Blah blah blah", 12), args)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun ctor2() {
|
||||
val clazz = ConstructorTarget::class.java
|
||||
val parser = StringToMethodCallParser(clazz)
|
||||
@ -88,7 +88,7 @@ class StringToMethodCallParserTest {
|
||||
assertArrayEquals(arrayOf("Foo bar!"), args)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun constructorWithGenericArgs() {
|
||||
val clazz = ConstructorTarget::class.java
|
||||
val ctor = clazz.getDeclaredConstructor(List::class.java)
|
||||
|
@ -23,7 +23,7 @@ class ExchangeRateModelTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `perform fx testing`() {
|
||||
val tenSwissies = Amount(10, BigDecimal.ONE, CHF)
|
||||
assertEquals(instance.exchangeAmount(tenSwissies, CHF), tenSwissies)
|
||||
|
@ -20,7 +20,7 @@ class AggregatedListTest {
|
||||
replayedList = ReplayedList(aggregatedList)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
assertEquals(replayedList.size, 0)
|
||||
|
||||
@ -43,7 +43,7 @@ class AggregatedListTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
sourceList.addAll(0, 1, 2, 3, 4)
|
||||
|
||||
@ -82,7 +82,7 @@ class AggregatedListTest {
|
||||
assertEquals(replayedList.size, 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun multipleElementsWithSameHashWorks() {
|
||||
sourceList.addAll(0, 0)
|
||||
assertEquals(replayedList.size, 1)
|
||||
|
@ -20,7 +20,7 @@ class AssociatedListTest {
|
||||
replayedMap = ReplayedMap(associatedList)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
assertEquals(replayedMap.size, 1)
|
||||
assertEquals(replayedMap[0], 0)
|
||||
@ -37,7 +37,7 @@ class AssociatedListTest {
|
||||
assertEquals(replayedMap[1], 4)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
sourceList.addAll(2, 4)
|
||||
assertEquals(replayedMap.size, 3)
|
||||
@ -57,7 +57,7 @@ class AssociatedListTest {
|
||||
assertEquals(replayedMap.size, 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun updateWorks() {
|
||||
sourceList.addAll(2, 4)
|
||||
assertEquals(replayedMap.size, 3)
|
||||
|
@ -42,7 +42,7 @@ class ConcatenatedListTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
concatenatedList.checkInvariants()
|
||||
assertEquals(replayedList.size, 1)
|
||||
@ -85,7 +85,7 @@ class ConcatenatedListTest {
|
||||
assertEquals(replayedList[6], "b")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
sourceList.add(FXCollections.observableArrayList("a", "b"))
|
||||
sourceList.add(1, FXCollections.observableArrayList("c"))
|
||||
@ -113,7 +113,7 @@ class ConcatenatedListTest {
|
||||
assertEquals(replayedList[0], "b")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun permutationWorks() {
|
||||
sourceList.addAll(FXCollections.observableArrayList("a", "b"), FXCollections.observableArrayList("c"))
|
||||
concatenatedList.checkInvariants()
|
||||
|
@ -21,7 +21,7 @@ class FlattenedListTest {
|
||||
replayedList = ReplayedList(flattenedList)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
assertEquals(replayedList.size, 1)
|
||||
assertEquals(replayedList[0], 1234)
|
||||
@ -54,7 +54,7 @@ class FlattenedListTest {
|
||||
assertEquals(replayedList[5], 34)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
val firstRemoved = sourceList.removeAt(0)
|
||||
assertEquals(firstRemoved.get(), 1234)
|
||||
@ -76,7 +76,7 @@ class FlattenedListTest {
|
||||
assertEquals(replayedList.size, 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun updatingObservableWorks() {
|
||||
assertEquals(replayedList[0], 1234)
|
||||
sourceList[0].set(4321)
|
||||
@ -92,7 +92,7 @@ class FlattenedListTest {
|
||||
assertEquals(replayedList[1], 8765)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun reusingObservableWorks() {
|
||||
val observable = SimpleObjectProperty(12)
|
||||
sourceList.add(observable)
|
||||
|
@ -26,7 +26,7 @@ class LeftOuterJoinedMapTest {
|
||||
}
|
||||
|
||||
// TODO perhaps these are too brittle because they test indices that are not stable. Use Expect dsl?
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
assertEquals(replayedList.size, 1)
|
||||
assertEquals(replayedList[0].first.name, "Alice")
|
||||
@ -73,7 +73,7 @@ class LeftOuterJoinedMapTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
dogs.add(Dog("Scooby", owner = "Alice"))
|
||||
people.add(Person("Bob", 34))
|
||||
|
@ -19,7 +19,7 @@ class MappedListTest {
|
||||
replayedList = ReplayedList(mappedList)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
assertEquals(replayedList.size, 1)
|
||||
assertEquals(replayedList[0], 5)
|
||||
@ -36,7 +36,7 @@ class MappedListTest {
|
||||
assertEquals(replayedList[2], 3)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
sourceList.add("Bob")
|
||||
sourceList.add(0, "Charlie")
|
||||
@ -48,7 +48,7 @@ class MappedListTest {
|
||||
assertEquals(replayedList[1], 3)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun permuteWorks() {
|
||||
sourceList.add("Bob")
|
||||
sourceList.add(0, "Charlie")
|
||||
|
@ -17,7 +17,7 @@ class ReplayedListTest {
|
||||
replayedList = ReplayedList(sourceList)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun addWorks() {
|
||||
assertEquals(replayedList.size, 1)
|
||||
assertEquals(replayedList[0], 1234)
|
||||
@ -50,7 +50,7 @@ class ReplayedListTest {
|
||||
assertEquals(replayedList[5], 34)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun removeWorks() {
|
||||
val firstRemoved = sourceList.removeAt(0)
|
||||
assertEquals(firstRemoved, 1234)
|
||||
@ -70,7 +70,7 @@ class ReplayedListTest {
|
||||
assertEquals(replayedList.size, 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun updateWorks() {
|
||||
assertEquals(replayedList[0], 1234)
|
||||
sourceList[0] = 4321
|
||||
|
@ -28,7 +28,7 @@ class BlacklistKotlinClosureTest {
|
||||
@CordaSerializable
|
||||
data class Packet(val x: () -> Long)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `closure sent via RPC`() {
|
||||
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList(), cordappsForAllNodes = listOf(enclosedCordapp()))) {
|
||||
val rpc = startNode(providedName = ALICE_NAME).getOrThrow().rpc
|
||||
|
@ -73,26 +73,26 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
|
||||
connection?.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `log in with valid username and password`() {
|
||||
login(rpcUser.username, rpcUser.password)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `log in with unknown user`() {
|
||||
assertThatExceptionOfType(ActiveMQSecurityException::class.java).isThrownBy {
|
||||
login(random63BitValue().toString(), rpcUser.password)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `log in with incorrect password`() {
|
||||
assertThatExceptionOfType(ActiveMQSecurityException::class.java).isThrownBy {
|
||||
login(rpcUser.username, random63BitValue().toString())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `shutdown command stops the node`() {
|
||||
val nodeIsShut: PublishSubject<Unit> = PublishSubject.create()
|
||||
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`() {
|
||||
println("Starting client")
|
||||
login(rpcUser.username, rpcUser.password)
|
||||
@ -165,7 +165,7 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
|
||||
println("Result: ${flowHandle.returnValue.getOrThrow()}")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check basic flow has no progress`() {
|
||||
login(rpcUser.username, rpcUser.password)
|
||||
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`() {
|
||||
login(rpcUser.username, rpcUser.password)
|
||||
val proxy = connection!!.proxy
|
||||
@ -191,7 +191,7 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries =
|
||||
assertEquals(123.DOLLARS, cashDollars)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `flow initiator via RPC`() {
|
||||
val externalTrace = Trace.newInstance()
|
||||
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
|
||||
// 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.
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `additional class loader used by WireTransaction when it deserialises its components`() {
|
||||
val financeLocation = Cash::class.java.location.toPath().toString()
|
||||
val classPathWithoutFinance = ProcessUtilities.defaultClassPath.filter { financeLocation !in it }
|
||||
|
@ -27,7 +27,7 @@ class FlowsExecutionModeTests : NodeBasedTest(emptyList()) {
|
||||
client = CordaRPCClient(node.node.configuration.rpcOptions.address)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `flows draining mode can be enabled and queried`() {
|
||||
asALoggerUser { rpcOps ->
|
||||
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`() {
|
||||
asALoggerUser { rpcOps ->
|
||||
rpcOps.setFlowsDrainingModeEnabled(true)
|
||||
@ -52,7 +52,7 @@ class FlowsExecutionModeTests : NodeBasedTest(emptyList()) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `node starts with flows draining mode disabled`() {
|
||||
asALoggerUser { rpcOps ->
|
||||
val defaultStartingMode = rpcOps.isFlowsDrainingModeEnabled()
|
||||
|
@ -64,7 +64,7 @@ class RPCMultipleInterfacesTests {
|
||||
|
||||
interface ImaginaryFriend : RPCOps
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `can talk multiple interfaces`() {
|
||||
rpcDriver {
|
||||
val server = startRpcServer(listOps = listOf(IntRPCOpsImpl(), StringRPCOpsImpl, MyCordaRpcOpsImpl)).get()
|
||||
|
@ -83,7 +83,7 @@ class RPCStabilityTests {
|
||||
}.get()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `client and server dont leak threads`() {
|
||||
fun startAndStop() {
|
||||
rpcDriver {
|
||||
@ -115,7 +115,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `client doesnt leak threads when it fails to start`() {
|
||||
fun startAndStop() {
|
||||
rpcDriver {
|
||||
@ -142,7 +142,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `rpc server close doesnt leak broker resources`() {
|
||||
rpcDriver {
|
||||
fun startAndCloseServer(broker: RpcBrokerHandle) {
|
||||
@ -165,7 +165,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `rpc client close doesnt leak broker resources`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
val server = startRpcServer(ops = DummyOps).get()
|
||||
@ -191,7 +191,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `rpc client close is idempotent`() {
|
||||
rpcDriver {
|
||||
val serverShutdown = shutdownManager.follower()
|
||||
@ -215,7 +215,7 @@ class RPCStabilityTests {
|
||||
fun leakObservable(): Observable<Nothing>
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `client cleans up leaked observables`() {
|
||||
rpcDriver {
|
||||
val leakObservableOpsImpl = object : LeakObservableOps {
|
||||
@ -247,7 +247,7 @@ class RPCStabilityTests {
|
||||
fun ping(): String
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `client reconnects to rebooted server`() {
|
||||
rpcDriver {
|
||||
val ops = object : ReconnectOps {
|
||||
@ -274,7 +274,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `connection failover fails, rpc calls throw`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
val ops = object : ReconnectOps {
|
||||
@ -330,7 +330,7 @@ class RPCStabilityTests {
|
||||
fun subscribe(): Observable<Nothing>
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `observables error when connection breaks`() {
|
||||
rpcDriver {
|
||||
val ops = object : NoOps {
|
||||
@ -371,7 +371,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `client throws RPCException after initial connection attempt fails`() {
|
||||
val client = CordaRPCClient(portAllocation.nextHostAndPort())
|
||||
var exceptionMessage: String? = null
|
||||
@ -390,7 +390,7 @@ class RPCStabilityTests {
|
||||
fun serverId(): String
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `client connects to first available server`() {
|
||||
rpcDriver {
|
||||
val ops = object : ServerOps {
|
||||
@ -411,7 +411,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `3 server failover`() {
|
||||
rpcDriver {
|
||||
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.
|
||||
*/
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `server cleans up queues after disconnected clients`() {
|
||||
rpcDriver {
|
||||
val trackSubscriberOpsImpl = object : TrackSubscriberOps {
|
||||
@ -538,8 +538,8 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // TODO: This is ignored because Artemis slow consumers are broken. I'm not deleting it in case we can get the feature fixed.
|
||||
@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.
|
||||
fun `slow consumers are kicked`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
val server = startRpcServer(ops = SlowConsumerRPCOpsImpl()).getOrThrow()
|
||||
@ -617,7 +617,7 @@ class RPCStabilityTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `deduplication in the client`() {
|
||||
rpcDriver {
|
||||
val broker = startRpcBroker().getOrThrow()
|
||||
|
@ -28,7 +28,7 @@ import java.io.NotSerializableException
|
||||
|
||||
class RpcCustomSerializersTest {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `when custom serializers are not provided, the classpath is scanned to identify any existing ones`() {
|
||||
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = listOf(enclosedCordapp()))) {
|
||||
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`() {
|
||||
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = listOf(enclosedCordapp()))) {
|
||||
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`() {
|
||||
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptyList())) {
|
||||
val server = startNode(providedName = ALICE_NAME).get()
|
||||
|
@ -48,7 +48,7 @@ class CordaRPCClientReconnectionTest {
|
||||
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`() {
|
||||
driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) {
|
||||
val latch = CountDownLatch(2)
|
||||
@ -86,7 +86,7 @@ class CordaRPCClientReconnectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `a client can successfully unsubscribe a reconnecting observable`() {
|
||||
driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) {
|
||||
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`() {
|
||||
driver(DriverParameters(cordappsForAllNodes = FINANCE_CORDAPPS)) {
|
||||
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`() {
|
||||
driver(DriverParameters(cordappsForAllNodes = emptyList())) {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
driver(DriverParameters(cordappsForAllNodes = emptyList())) {
|
||||
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`() {
|
||||
driver(DriverParameters(cordappsForAllNodes = emptyList())) {
|
||||
val address = NetworkHostAndPort("localhost", portAllocator.nextPort())
|
||||
|
@ -92,7 +92,7 @@ class StandaloneCordaRPClientTest {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test attachments`() {
|
||||
val attachment = InputStreamAndHash.createInMemoryTestZip(attachmentSize, 1)
|
||||
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")
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test wrapped attachments`() {
|
||||
val attachment = InputStreamAndHash.createInMemoryTestZip(attachmentSize, 1)
|
||||
assertFalse(rpcProxy.attachmentExists(attachment.sha256))
|
||||
@ -121,13 +121,13 @@ class StandaloneCordaRPClientTest {
|
||||
assertEquals(attachment.sha256, hash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test starting flow`() {
|
||||
rpcProxy.startFlow(::CashIssueFlow, 127.POUNDS, OpaqueBytes.of(0), notaryNodeIdentity)
|
||||
.returnValue.getOrThrow(timeout)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test starting tracked flow`() {
|
||||
var trackCount = 0
|
||||
val handle = rpcProxy.startTrackedFlow(
|
||||
@ -144,12 +144,12 @@ class StandaloneCordaRPClientTest {
|
||||
assertNotEquals(0, trackCount)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test network map`() {
|
||||
assertEquals(notaryConfig.legalName, notaryNodeIdentity.name)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test state machines`() {
|
||||
val (stateMachines, updates) = rpcProxy.stateMachinesFeed()
|
||||
assertEquals(0, stateMachines.size)
|
||||
@ -171,7 +171,7 @@ class StandaloneCordaRPClientTest {
|
||||
assertEquals(1, updateCount.get())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test vault track by`() {
|
||||
val (vault, vaultUpdates) = rpcProxy.vaultTrackBy<Cash.State>(paging = PageSpecification(DEFAULT_PAGE_NUM))
|
||||
assertEquals(0, vault.totalStatesAvailable)
|
||||
@ -194,7 +194,7 @@ class StandaloneCordaRPClientTest {
|
||||
assertEquals(629.POUNDS, cashBalance[Currency.getInstance("GBP")])
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test vault query by`() {
|
||||
// Now issue some cash
|
||||
rpcProxy.startFlow(::CashIssueFlow, 629.POUNDS, OpaqueBytes.of(0), notaryNodeIdentity)
|
||||
@ -220,7 +220,7 @@ class StandaloneCordaRPClientTest {
|
||||
assertEquals(629.POUNDS, cashBalances[Currency.getInstance("GBP")])
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test cash balances`() {
|
||||
val startCash = rpcProxy.getCashBalances()
|
||||
println(startCash)
|
||||
@ -235,7 +235,7 @@ class StandaloneCordaRPClientTest {
|
||||
assertEquals(629.DOLLARS, balance)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test kill flow without killFlow permission`() {
|
||||
exception.expect(PermissionException::class.java)
|
||||
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`() {
|
||||
val flowHandle = rpcProxy.startFlow(::CashIssueFlow, 83.DOLLARS, OpaqueBytes.of(0), notaryNodeIdentity)
|
||||
notary.connect(rpcUser).use { connection ->
|
||||
|
@ -72,7 +72,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
override fun captureUser(): String = rpcContext().invocation.principal().name
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `simple RPCs`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -88,7 +88,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `simple observable`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -98,7 +98,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `complex observables`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -143,7 +143,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `simple ListenableFuture`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -152,7 +152,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `complex ListenableFuture`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -180,7 +180,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun versioning() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -188,7 +188,7 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `authenticated user is available to RPC`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
|
@ -104,7 +104,7 @@ class RPCConcurrencyTests : AbstractRPCTest() {
|
||||
pool.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `call multiple RPCs in parallel`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
@ -140,7 +140,7 @@ class RPCConcurrencyTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `nested immediate observables sequence correctly`() {
|
||||
rpcDriver {
|
||||
// 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`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
|
@ -46,27 +46,27 @@ class RPCFailureTests {
|
||||
proc(startRpcClient<Ops>(server.broker.hostAndPort!!).getOrThrow())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `kotlin NPE`() = rpc {
|
||||
assertThatThrownBy { it.kotlinNPE() }.isInstanceOf(CordaRuntimeException::class.java)
|
||||
.hasMessageContaining("kotlin.KotlinNullPointerException")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `kotlin NPE async`() = rpc {
|
||||
val future = it.kotlinNPEAsync()
|
||||
assertThatThrownBy { future.getOrThrow() }.isInstanceOf(CordaRuntimeException::class.java)
|
||||
.hasMessageContaining("kotlin.KotlinNullPointerException")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun unserializable() = rpc {
|
||||
assertThatThrownBy { it.getUnserializable() }.isInstanceOf(CordaRuntimeException::class.java)
|
||||
.hasMessageContaining("java.io.NotSerializableException:")
|
||||
.hasMessageContaining("Unserializable\" is not on the whitelist or annotated with @CordaSerializable.")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `unserializable async`() = rpc {
|
||||
val future = it.getUnserializableAsync()
|
||||
assertThatThrownBy { future.getOrThrow() }.isInstanceOf(CordaRuntimeException::class.java)
|
||||
|
@ -29,7 +29,7 @@ class RPCHighThroughputObservableTests : AbstractRPCTest() {
|
||||
override fun makeObservable(): Observable<Int> = Observable.interval(0, TimeUnit.MICROSECONDS).map { it.toInt() + 1 }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `simple observable`() {
|
||||
rpcDriver {
|
||||
val proxy = testProxy()
|
||||
|
@ -76,7 +76,7 @@ class RPCPerformanceTests : AbstractRPCTest() {
|
||||
val Mbps: Double
|
||||
)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `measure Megabytes per second for simple RPCs`() {
|
||||
warmup()
|
||||
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.
|
||||
*/
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `consumption rate`() {
|
||||
rpcDriver {
|
||||
val metricRegistry = startReporter(shutdownManager)
|
||||
@ -148,7 +148,7 @@ class RPCPerformanceTests : AbstractRPCTest() {
|
||||
val Mbps: Double
|
||||
)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `big messages`() {
|
||||
warmup()
|
||||
measure(listOf(1)) { clientParallelism ->
|
||||
|
@ -46,7 +46,7 @@ class RPCPermissionsTests : AbstractRPCTest() {
|
||||
|
||||
private fun userOf(name: String, permissions: Set<String>) = User(name, "password", permissions)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `empty user cannot use any flows`() {
|
||||
rpcDriver {
|
||||
val emptyUser = userOf("empty", emptySet())
|
||||
@ -57,7 +57,7 @@ class RPCPermissionsTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `admin user can use any flow`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
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`() {
|
||||
rpcDriver {
|
||||
val joeUser = userOf("joe", setOf(WILDCARD_FLOW))
|
||||
@ -128,7 +128,7 @@ class RPCPermissionsTests : AbstractRPCTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `checking invokeRpc permissions entitlements`() {
|
||||
rpcDriver {
|
||||
val joeUser = userOf("joe", setOf("InvokeRpc.networkMapFeed"))
|
||||
|
@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
class PropertyTest {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun present_value_with_correct_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -25,7 +25,7 @@ class PropertyTest {
|
||||
assertThat(configuration[property]).isEqualTo(value)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun present_value_with_wrong_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -41,7 +41,7 @@ class PropertyTest {
|
||||
assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.WrongType::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun present_value_of_list_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -57,7 +57,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(value)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun present_value_of_list_type_with_whole_list_mapping() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -73,7 +73,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(value.max())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun absent_value_of_list_type_with_whole_list_mapping() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -88,7 +88,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(null)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun present_value_of_list_type_with_single_element_and_whole_list_mapping() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -104,7 +104,7 @@ class PropertyTest {
|
||||
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() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -119,7 +119,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(null)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun optional_present_value_of_list_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -135,7 +135,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(value)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun optional_absent_value_of_list_type() {
|
||||
|
||||
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() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -167,7 +167,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(defaultValue)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun absent_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -182,7 +182,7 @@ class PropertyTest {
|
||||
assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.Missing::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun optional_present_value_with_correct_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -198,7 +198,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isEqualTo(value)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun optional_present_value_with_wrong_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -214,7 +214,7 @@ class PropertyTest {
|
||||
assertThatThrownBy { property.valueIn(configuration) }.isInstanceOf(ConfigException.WrongType::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun optional_absent_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -229,7 +229,7 @@ class PropertyTest {
|
||||
assertThat(property.valueIn(configuration)).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun optional_absent_with_default_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
|
@ -7,7 +7,7 @@ import org.junit.Test
|
||||
|
||||
class PropertyValidationTest {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun absent_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -26,7 +26,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun missing_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -45,7 +45,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun absent_list_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -64,7 +64,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun missing_list_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -83,7 +83,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun whole_list_validation_valid_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -97,7 +97,7 @@ class PropertyValidationTest {
|
||||
assertThat(property.validate(configuration).errors).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun whole_list_validation_invalid_value() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -125,7 +125,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun wrong_type() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -145,7 +145,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun wrong_floating_numeric_type_when_integer_expected() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -165,7 +165,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun integer_numeric_type_when_floating_expected_works() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -177,7 +177,7 @@ class PropertyValidationTest {
|
||||
assertThat(property.validate(configuration).isValid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun wrong_element_type_for_list() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -197,7 +197,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun list_type_when_declared_single() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -217,7 +217,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun single_type_when_declared_list() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -237,7 +237,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun wrong_type_in_nested_property() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -260,7 +260,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun absent_value_in_nested_property() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -283,7 +283,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun missing_value_in_nested_property() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -306,7 +306,7 @@ class PropertyValidationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun nested_property_without_schema_does_not_validate() {
|
||||
|
||||
val key = "a.b.c"
|
||||
@ -320,7 +320,7 @@ class PropertyValidationTest {
|
||||
assertThat(property.validate(configuration).isValid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun valid_mapped_property() {
|
||||
|
||||
val key = "a"
|
||||
@ -336,7 +336,7 @@ class PropertyValidationTest {
|
||||
assertThat(property.validate(configuration).isValid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun invalid_mapped_property() {
|
||||
|
||||
val key = "a.b.c"
|
||||
|
@ -7,7 +7,7 @@ import org.junit.Test
|
||||
|
||||
class SchemaTest {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validation_with_nested_properties() {
|
||||
|
||||
val prop1 = "prop1"
|
||||
@ -35,7 +35,7 @@ class SchemaTest {
|
||||
assertThat(result.isValid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validation_with_unknown_properties() {
|
||||
|
||||
val prop1 = "prop1"
|
||||
@ -74,7 +74,7 @@ class SchemaTest {
|
||||
assertThat(errorsWithDefaultOptions).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validation_with_unknown_properties_non_strict() {
|
||||
|
||||
val prop1 = "prop1"
|
||||
@ -103,7 +103,7 @@ class SchemaTest {
|
||||
assertThat(result.isValid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validation_with_wrong_nested_properties() {
|
||||
|
||||
val prop1 = "prop1"
|
||||
@ -133,7 +133,7 @@ class SchemaTest {
|
||||
assertThat(errors).hasSize(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun describe_with_nested_properties_does_not_show_sensitive_values() {
|
||||
|
||||
val prop1 = "prop1"
|
||||
@ -164,7 +164,7 @@ class SchemaTest {
|
||||
assertThat(description).doesNotContain(prop5Value)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun describe_with_nested_properties_list_does_not_show_sensitive_values() {
|
||||
|
||||
val prop1 = "prop1"
|
||||
|
@ -30,7 +30,7 @@ class SpecificationTest {
|
||||
override fun parseValid(configuration: Config) = valid<RpcSettings>(RpcSettingsImpl(configuration[addresses], configuration[useSsl]))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun parse() {
|
||||
|
||||
val useSslValue = true
|
||||
@ -53,7 +53,7 @@ class SpecificationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun parse_list_aggregation() {
|
||||
|
||||
val spec = object : Configuration.Specification<AtomicLong>("AtomicLong") {
|
||||
@ -75,7 +75,7 @@ class SpecificationTest {
|
||||
assertThat(result.value().get()).isEqualTo(elements.max())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validate() {
|
||||
|
||||
val principalAddressValue = Address("localhost", 8080)
|
||||
@ -93,7 +93,7 @@ class SpecificationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validate_list_aggregation() {
|
||||
|
||||
fun parseMax(elements: List<Long>): Valid<Long> {
|
||||
@ -130,7 +130,7 @@ class SpecificationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun validate_with_domain_specific_errors() {
|
||||
|
||||
val useSslValue = true
|
||||
@ -151,7 +151,7 @@ class SpecificationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun chained_delegated_properties_are_not_added_multiple_times() {
|
||||
|
||||
val spec = object : Configuration.Specification<List<String>?>("Test") {
|
||||
|
@ -6,7 +6,7 @@ import org.junit.Test
|
||||
|
||||
class UtilsTest {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun serialize_deserialize_configuration() {
|
||||
|
||||
var rawConfiguration = ConfigFactory.empty()
|
||||
|
@ -12,7 +12,7 @@ class VersionExtractorTest {
|
||||
private val versionExtractor = Configuration.Version.Extractor.fromPath("configuration.metadata.version")
|
||||
private val extractVersion: (Config) -> Valid<Int> = { config -> versionExtractor.parse(config) }
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun version_header_extraction_present() {
|
||||
|
||||
val versionValue = Configuration.Version.Extractor.DEFAULT_VERSION_VALUE + 1
|
||||
@ -22,7 +22,7 @@ class VersionExtractorTest {
|
||||
assertThat(version).isEqualTo(versionValue)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun version_header_extraction_no_metadata() {
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun version_header_extraction_no_key() {
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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()
|
||||
@ -51,7 +51,7 @@ class VersionExtractorTest {
|
||||
assertThat(version).isEqualTo(Configuration.Version.Extractor.DEFAULT_VERSION_VALUE)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun version_header_extraction_no_configuration() {
|
||||
|
||||
val rawConfiguration = configObject().toConfig()
|
||||
|
@ -9,7 +9,7 @@ import org.junit.Test
|
||||
|
||||
class VersionedParsingExampleTest {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun correct_parsing_function_is_used_for_present_version() {
|
||||
|
||||
val versionParser = Configuration.Version.Extractor.fromPath("configuration.metadata.version")
|
||||
@ -31,7 +31,7 @@ class VersionedParsingExampleTest {
|
||||
assertResult(rpcSettingsFromVersion2Conf, principalAddressValue, adminAddressValue)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun default_value_is_used_for_absent_version() {
|
||||
|
||||
val defaultVersion = 2
|
||||
|
@ -46,7 +46,7 @@ class IdentitySyncFlowTests {
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `sync confidential identities`() {
|
||||
// Set up values we'll need
|
||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||
@ -74,7 +74,7 @@ class IdentitySyncFlowTests {
|
||||
assertEquals(expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `don't offer other's identities confidential identities`() {
|
||||
// Set up values we'll need
|
||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||
|
@ -46,7 +46,7 @@ class SwapIdentitiesFlowTests {
|
||||
private val alice = aliceNode.info.singleIdentity()
|
||||
private val bob = bobNode.info.singleIdentity()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `issue key`() {
|
||||
assertThat(
|
||||
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.
|
||||
*/
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `verifies identity name`() {
|
||||
val notBob = charlieNode.issueFreshKeyAndCert()
|
||||
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.
|
||||
*/
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `verification rejects signature if name is right but key is wrong`() {
|
||||
val evilBobNode = mockNet.createPartyNode(bobNode.info.singleIdentity().name)
|
||||
val evilBob = evilBobNode.info.singleIdentityAndCert()
|
||||
@ -96,7 +96,7 @@ class SwapIdentitiesFlowTests {
|
||||
.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`() {
|
||||
val anonymousAlice = aliceNode.issueFreshKeyAndCert()
|
||||
val anonymousBob = bobNode.issueFreshKeyAndCert()
|
||||
|
@ -35,32 +35,32 @@ class CordaExceptionTest {
|
||||
val BOB = Party(BOB_NAME, BOB_KEY)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testCordaException() {
|
||||
val ex = assertFailsWith<CordaException> { throw CordaException("BAD THING") }
|
||||
assertEquals("BAD THING", ex.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testAttachmentResolutionException() {
|
||||
val ex = assertFailsWith<AttachmentResolutionException> { throw AttachmentResolutionException(TEST_HASH) }
|
||||
assertEquals(TEST_HASH, ex.hash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testTransactionResolutionException() {
|
||||
val ex = assertFailsWith<TransactionResolutionException> { throw TransactionResolutionException(TEST_HASH) }
|
||||
assertEquals(TEST_HASH, ex.hash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testConflictingAttachmentsRejection() {
|
||||
val ex = assertFailsWith<ConflictingAttachmentsRejection> { throw ConflictingAttachmentsRejection(TX_ID, CONTRACT_CLASS) }
|
||||
assertEquals(TX_ID, ex.txId)
|
||||
assertEquals(CONTRACT_CLASS, ex.contractClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testNotaryChangeInWrongTransactionType() {
|
||||
val ex = assertFailsWith<NotaryChangeInWrongTransactionType> { throw NotaryChangeInWrongTransactionType(TX_ID, ALICE, BOB) }
|
||||
assertEquals(TX_ID, ex.txId)
|
||||
|
@ -55,7 +55,7 @@ class AttachmentTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testAttachmentJar() {
|
||||
attachment.openAsJAR().use { jar ->
|
||||
val entry = jar.nextJarEntry ?: return@use
|
||||
@ -68,7 +68,7 @@ class AttachmentTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testExtractFromAttachment() {
|
||||
val resultData = ByteArrayOutputStream().use {
|
||||
attachment.extractFile("data.bin", it)
|
||||
|
@ -9,24 +9,24 @@ class PrivacySaltTest {
|
||||
private const val SALT_SIZE = 32
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testValidSalt() {
|
||||
PrivacySalt(ByteArray(SALT_SIZE) { 0x14 })
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testInvalidSaltWithAllZeros() {
|
||||
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE)) }
|
||||
assertEquals("Privacy salt should not be all zeros.", ex.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testTooShortPrivacySalt() {
|
||||
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE - 1) { 0x7f }) }
|
||||
assertEquals("Privacy salt should be 32 bytes.", ex.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testTooLongPrivacySalt() {
|
||||
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE + 1) { 0x7f }) }
|
||||
assertEquals("Privacy salt should be 32 bytes.", ex.message)
|
||||
|
@ -14,7 +14,7 @@ class UniqueIdentifierTest {
|
||||
private val TEST_UUID: UUID = UUID.fromString("00000000-1111-2222-3333-444444444444")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testNewInstance() {
|
||||
val id = UniqueIdentifier(NAME, TEST_UUID)
|
||||
assertEquals("${NAME}_$TEST_UUID", id.toString())
|
||||
@ -22,13 +22,13 @@ class UniqueIdentifierTest {
|
||||
assertEquals(TEST_UUID, id.id)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testPrimaryConstructor() {
|
||||
val primary = UniqueIdentifier::class.primaryConstructor ?: throw AssertionError("primary constructor missing")
|
||||
assertThat(primary.call(NAME, TEST_UUID)).isEqualTo(UniqueIdentifier(NAME, TEST_UUID))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testConstructors() {
|
||||
assertEquals(1, UniqueIdentifier::class.constructors.size)
|
||||
val ex = assertFailsWith<IllegalArgumentException> { UniqueIdentifier::class.constructors.first().call() }
|
||||
|
@ -6,7 +6,7 @@ import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class MerkleTreeTest {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testCreate() {
|
||||
val merkle = MerkleTree.getMerkleTree(listOf(SecureHash.allOnesHash, SecureHash.zeroHash))
|
||||
assertEquals(SecureHash.parse("A5DE9B714ACCD8AFAAABF1CBD6E1014C9D07FF95C2AE154D91EC68485B31E7B5"), merkle.hash)
|
||||
|
@ -7,14 +7,14 @@ import org.junit.Test
|
||||
import java.security.MessageDigest
|
||||
|
||||
class SecureHashTest {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testSHA256() {
|
||||
val hash = SecureHash.sha256(byteArrayOf(0x64, -0x13, 0x42, 0x3a))
|
||||
assertEquals(SecureHash.parse("6D1687C143DF792A011A1E80670A4E4E0C25D0D87A39514409B1ABFC2043581F"), hash)
|
||||
assertEquals("6D1687C143DF792A011A1E80670A4E4E0C25D0D87A39514409B1ABFC2043581F", hash.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testPrefix() {
|
||||
val data = byteArrayOf(0x7d, 0x03, -0x21, 0x32, 0x56, 0x47)
|
||||
val digest = data.digestFor("SHA-256")
|
||||
@ -22,7 +22,7 @@ class SecureHashTest {
|
||||
assertEquals(Hex.toHexString(digest).substring(0, 8).toUpperCase(), prefix)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testConcat() {
|
||||
val hash1 = SecureHash.sha256(byteArrayOf(0x7d, 0x03, -0x21, 0x32, 0x56, 0x47))
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testConstants() {
|
||||
assertArrayEquals(SecureHash.zeroHash.bytes, ByteArray(32))
|
||||
assertArrayEquals(SecureHash.allOnesHash.bytes, ByteArray(32) { 0xFF.toByte() })
|
||||
|
@ -14,7 +14,7 @@ class SecureRandomTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testNoCordaPRNG() {
|
||||
val error = assertFailsWith<NoSuchAlgorithmException> { SecureRandom.getInstance("CordaPRNG") }
|
||||
assertThat(error).hasMessage("CordaPRNG SecureRandom not available")
|
||||
|
@ -30,7 +30,7 @@ class TransactionSignatureTest {
|
||||
}
|
||||
|
||||
/** Valid sign and verify. */
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Signature metadata full sign and verify`() {
|
||||
// Create a SignableData object.
|
||||
val signableData = SignableData(testBytes.sha256(), SignatureMetadata(1, Crypto.findSignatureScheme(keyPair.public).schemeNumberID))
|
||||
@ -57,7 +57,7 @@ class TransactionSignatureTest {
|
||||
Crypto.doVerify((testBytes + testBytes).sha256(), transactionSignature)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Verify multi-tx signature`() {
|
||||
// Deterministically create 5 txIds.
|
||||
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`() {
|
||||
val txId = "aTransaction".toByteArray().sha256()
|
||||
// One-tx signature.
|
||||
|
@ -7,7 +7,7 @@ import org.junit.Test
|
||||
import java.security.PublicKey
|
||||
|
||||
class TransactionWithSignaturesTest {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun txWithSigs() {
|
||||
val tx = object : TransactionWithSignatures {
|
||||
override val id: SecureHash
|
||||
|
@ -16,12 +16,12 @@ class VerifyTransactionTest {
|
||||
val serialization = LocalSerializationRule(VerifyTransactionTest::class)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun success() {
|
||||
verifyTransaction(bytesOfResource("txverify/tx-success.bin"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun failure() {
|
||||
val e = assertFailsWith<Exception> { verifyTransaction(bytesOfResource("txverify/tx-failure.bin")) }
|
||||
assertThat(e).hasMessageContaining("Required ${Move::class.java.canonicalName} command")
|
||||
|
@ -5,7 +5,7 @@ import net.corda.core.serialization.SerializationContext.UseCase.P2P
|
||||
import net.corda.core.serialization.SerializationCustomSerializer
|
||||
import net.corda.core.serialization.SerializationWhitelist
|
||||
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.amqp.*
|
||||
import org.junit.rules.TestRule
|
||||
@ -48,11 +48,11 @@ class LocalSerializationRule(private val label: String) : TestRule {
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
_contextSerializationEnv.set(createTestSerializationEnv())
|
||||
_driverSerializationEnv.set(createTestSerializationEnv())
|
||||
}
|
||||
|
||||
private fun clear() {
|
||||
_contextSerializationEnv.set(null)
|
||||
_driverSerializationEnv.set(null)
|
||||
}
|
||||
|
||||
private fun createTestSerializationEnv(): SerializationEnvironment {
|
||||
|
@ -57,13 +57,13 @@ class NodeVersioningTest {
|
||||
notary.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `platform version in manifest file`() {
|
||||
val manifest = JarFile(factory.cordaJar.toFile()).manifest
|
||||
assertThat(manifest.mainAttributes.getValue("Corda-Platform-Version").toInt()).isEqualTo(PLATFORM_VERSION)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `platform version from RPC`() {
|
||||
val cordappsDir = (factory.baseDirectory(aliceConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories()
|
||||
// Find the jar file for the smoke tests of this module
|
||||
|
@ -74,7 +74,7 @@ class CordappSmokeTest {
|
||||
notary.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `FlowContent appName returns the filename of the CorDapp jar`() {
|
||||
val baseDir = factory.baseDirectory(aliceConfig)
|
||||
val cordappsDir = (baseDir / CORDAPPS_DIR_NAME).createDirectories()
|
||||
@ -103,7 +103,7 @@ class CordappSmokeTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `empty cordapps directory`() {
|
||||
(factory.baseDirectory(aliceConfig) / CORDAPPS_DIR_NAME).createDirectories()
|
||||
factory.create(aliceConfig).close()
|
||||
|
@ -19,13 +19,13 @@ import kotlin.test.assertTrue
|
||||
* Tests of the [Amount] class.
|
||||
*/
|
||||
class AmountTests {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `make sure Amount has decimal places`() {
|
||||
val x = Amount(1, Currency.getInstance("USD"))
|
||||
assertTrue("0.01" in x.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `decimal conversion`() {
|
||||
val quantity = 1234L
|
||||
val amountGBP = Amount(quantity, GBP)
|
||||
@ -48,7 +48,7 @@ class AmountTests {
|
||||
override fun toString(): String = name
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun split() {
|
||||
for (baseQuantity in 0..1000) {
|
||||
val baseAmount = Amount(baseQuantity.toLong(), GBP)
|
||||
@ -63,7 +63,7 @@ class AmountTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `amount transfers equality`() {
|
||||
val partyA = "A"
|
||||
val partyB = "B"
|
||||
@ -88,7 +88,7 @@ class AmountTests {
|
||||
assertNotEquals(transferE.hashCode(), transferA.hashCode())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `amount transfer aggregation`() {
|
||||
val partyA = "A"
|
||||
val partyB = "B"
|
||||
@ -119,7 +119,7 @@ class AmountTests {
|
||||
assertEquals(negativeTransfer, sumUntilNegative)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `amount transfer apply`() {
|
||||
val partyA = "A"
|
||||
val partyB = "B"
|
||||
@ -167,7 +167,7 @@ class AmountTests {
|
||||
assertEquals(originalTotals[Pair(partyB, GBP)], newTotals3[Pair(partyB, GBP)])
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testGbpParse() {
|
||||
assertEquals(POUNDS(10), Amount.parseCurrency("10 GBP"))
|
||||
assertEquals(POUNDS(11), Amount.parseCurrency("£11"))
|
||||
|
@ -96,7 +96,7 @@ class ConstraintsPropagationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Happy path with the HashConstraint`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
ledgerServices.recordTransaction(transaction {
|
||||
@ -115,8 +115,8 @@ class ConstraintsPropagationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // TODO(mike): rework
|
||||
@Test(timeout=300_000)
|
||||
@Ignore // TODO(mike): rework
|
||||
fun `Happy path for Hash to Signature Constraint migration`() {
|
||||
val cordapps = (ledgerServices.cordappProvider as MockCordappProvider).cordapps
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
transaction {
|
||||
@ -177,7 +177,7 @@ class ConstraintsPropagationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Transaction validation fails, when constraints do not propagate correctly`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
ledgerServices.recordTransaction(transaction {
|
||||
@ -300,7 +300,7 @@ class ConstraintsPropagationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Signature Constraints canBeTransitionedFrom Hash Constraints behaves as expected`() {
|
||||
|
||||
// unsigned attachment (for hash constraint)
|
||||
@ -326,7 +326,7 @@ class ConstraintsPropagationTests {
|
||||
assertFalse(SignatureAttachmentConstraint(ALICE_PUBKEY).canBeTransitionedFrom(HashAttachmentConstraint(allOnesHash), attachmentSigned))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Attachment canBeTransitionedFrom behaves as expected`() {
|
||||
|
||||
// signed attachment (for signature constraint)
|
||||
@ -378,7 +378,7 @@ class ConstraintsPropagationTests {
|
||||
recordTransactions(SignedTransaction(wireTransaction, sigs))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Input state contract version may be incompatible with lower version`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
ledgerServices.recordTransaction(transaction {
|
||||
@ -416,7 +416,7 @@ class ConstraintsPropagationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Input state contract version is compatible with higher version`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
ledgerServices.recordTransaction(transaction {
|
||||
|
@ -34,7 +34,7 @@ class ContractHierarchyTest {
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `hierarchical contracts work with mock network`() {
|
||||
// Set up values we'll need
|
||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||
|
@ -40,7 +40,7 @@ class RequireSingleCommandTests(private val testFunction: (Collection<CommandWit
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check function returns one value`() {
|
||||
val commands = listOf(validCommandOne, invalidCommand)
|
||||
val returnedCommand = testFunction(commands)
|
||||
@ -53,7 +53,7 @@ class RequireSingleCommandTests(private val testFunction: (Collection<CommandWit
|
||||
testFunction(commands)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check error is thrown when command is of wrong type`() {
|
||||
val commands = listOf(invalidCommand)
|
||||
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`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
testFunction(commands, null, null)
|
||||
@ -83,7 +83,7 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
|
||||
assertTrue(commands.contains(validCommandTwo))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function does not return invalid command types`() {
|
||||
val commands = listOf(validCommandOne, invalidCommand)
|
||||
val filteredCommands = testFunction(commands, null, null).toList()
|
||||
@ -92,7 +92,7 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
|
||||
assertFalse(filteredCommands.contains(invalidCommand))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function returns commands from valid signers`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
val filteredCommands = testFunction(commands, miniCorp.publicKey, null).toList()
|
||||
@ -101,7 +101,7 @@ class SelectWithSingleInputsTests(private val testFunction: (Collection<CommandW
|
||||
assertFalse(filteredCommands.contains(validCommandTwo))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function returns commands from valid parties`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
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`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
testFunction(commands, null, null)
|
||||
@ -132,7 +132,7 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
|
||||
assertTrue(commands.contains(validCommandTwo))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function does not return invalid command types`() {
|
||||
val commands = listOf(validCommandOne, invalidCommand)
|
||||
val filteredCommands = testFunction(commands, null, null).toList()
|
||||
@ -141,7 +141,7 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
|
||||
assertFalse(filteredCommands.contains(invalidCommand))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function returns commands from valid signers`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
val filteredCommands = testFunction(commands, listOf(megaCorp.publicKey), null).toList()
|
||||
@ -150,7 +150,7 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
|
||||
assertTrue(filteredCommands.contains(validCommandTwo))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function returns commands from all valid signers`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
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))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function returns commands from valid parties`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
val filteredCommands = testFunction(commands, null, listOf(megaCorp.party)).toList()
|
||||
@ -168,7 +168,7 @@ class SelectWithMultipleInputsTests(private val testFunction: (Collection<Comman
|
||||
assertTrue(filteredCommands.contains(validCommandTwo))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check that function returns commands from all valid parties`() {
|
||||
val commands = listOf(validCommandOne, validCommandTwo)
|
||||
val filteredCommands = testFunction(commands, null, listOf(miniCorp.party, megaCorp.party)).toList()
|
||||
|
@ -54,7 +54,7 @@ class PackageOwnershipVerificationTests {
|
||||
)
|
||||
)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Happy path - Transaction validates when package signed by owner`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
transaction {
|
||||
@ -78,7 +78,7 @@ class PackageOwnershipVerificationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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
|
||||
// classes, but for the feature to work it must apply to any package. This tests that by using a package
|
||||
|
@ -15,7 +15,7 @@ import java.time.ZoneOffset.UTC
|
||||
class TimeWindowTest {
|
||||
private val now = Instant.now()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun fromOnly() {
|
||||
val timeWindow = TimeWindow.fromOnly(now)
|
||||
assertThat(timeWindow.fromTime).isEqualTo(now)
|
||||
@ -27,7 +27,7 @@ class TimeWindowTest {
|
||||
assertThat(timeWindow.contains(now + 1.millis)).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun untilOnly() {
|
||||
val timeWindow = TimeWindow.untilOnly(now)
|
||||
assertThat(timeWindow.fromTime).isNull()
|
||||
@ -39,7 +39,7 @@ class TimeWindowTest {
|
||||
assertThat(timeWindow.contains(now + 1.millis)).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun between() {
|
||||
val today = LocalDate.now()
|
||||
val fromTime = today.atTime(12, 0).toInstant(UTC)
|
||||
@ -56,7 +56,7 @@ class TimeWindowTest {
|
||||
assertThat(timeWindow.contains(untilTime + 1.millis)).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun fromStartAndDuration() {
|
||||
val duration = 10.minutes
|
||||
val timeWindow = TimeWindow.fromStartAndDuration(now, duration)
|
||||
@ -66,7 +66,7 @@ class TimeWindowTest {
|
||||
assertThat(timeWindow.length).isEqualTo(duration)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun withTolerance() {
|
||||
val tolerance = 10.minutes
|
||||
val timeWindow = TimeWindow.withTolerance(now, tolerance)
|
||||
|
@ -41,7 +41,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
private val attachmentHash = SecureHash.allOnesHash
|
||||
private val factory = defaultFactory()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun contractConstraintRejectionTest() {
|
||||
val excp = TransactionVerificationException.ContractConstraintRejection(txid, "This is only a test")
|
||||
val excp2 = DeserializationInput(factory).deserialize(
|
||||
@ -53,7 +53,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(excp.txId, excp2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun contractRejectionTest() {
|
||||
class TestContract(val thing: Int) : Contract {
|
||||
override fun verify(tx: LedgerTransaction) = Unit
|
||||
@ -72,7 +72,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun missingAttachmentRejectionTest() {
|
||||
val exception = TransactionVerificationException.MissingAttachmentRejection(txid, "Some contract class")
|
||||
val exception2 = DeserializationInput(factory).deserialize(
|
||||
@ -84,7 +84,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun conflictingAttachmentsRejectionTest() {
|
||||
val exception = TransactionVerificationException.ContractConstraintRejection(txid, "Some contract class")
|
||||
val exception2 = DeserializationInput(factory).deserialize(
|
||||
@ -96,7 +96,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun invalidConstraintRejectionError() {
|
||||
val exception = TransactionVerificationException.InvalidConstraintRejection(txid, "Some contract class", "for being too funny")
|
||||
val exceptionAfterSerialisation = DeserializationInput(factory).deserialize(
|
||||
@ -110,7 +110,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.reason, exceptionAfterSerialisation.reason)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun contractCreationErrorTest() {
|
||||
val cause = Throwable("wibble")
|
||||
val exception = createContractCreationError(txid, "Some contract class", cause)
|
||||
@ -123,7 +123,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionMissingEncumbranceTest() {
|
||||
val exception = TransactionVerificationException.TransactionMissingEncumbranceException(
|
||||
txid, 12, TransactionVerificationException.Direction.INPUT)
|
||||
@ -136,7 +136,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun notaryChangeInWrongTransactionTypeTest() {
|
||||
val dummyBankA = TestIdentity(DUMMY_BANK_A_NAME, 40).party
|
||||
val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20).party
|
||||
@ -153,7 +153,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun overlappingAttachmentsExceptionTest() {
|
||||
val exc = TransactionVerificationException.OverlappingAttachmentsException(txid, "foo/bar/baz")
|
||||
val exc2 = DeserializationInput(factory).deserialize(
|
||||
@ -163,7 +163,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun packageOwnershipExceptionTest() {
|
||||
val exc = TransactionVerificationException.PackageOwnershipException(
|
||||
txid,
|
||||
@ -178,7 +178,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun invalidAttachmentExceptionTest() {
|
||||
val exc = TransactionVerificationException.InvalidAttachmentException(
|
||||
txid,
|
||||
@ -191,7 +191,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun untrustedAttachmentsExceptionTest() {
|
||||
val exc = TransactionVerificationException.UntrustedAttachmentsException(
|
||||
txid,
|
||||
@ -204,7 +204,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionNetworkParameterOrderingExceptionTest() {
|
||||
val exception = TransactionVerificationException.TransactionNetworkParameterOrderingException(
|
||||
txid,
|
||||
@ -222,7 +222,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun missingNetworkParametersExceptionTest() {
|
||||
val exception = TransactionVerificationException.MissingNetworkParametersException(txid, SecureHash.zeroHash)
|
||||
val exception2 = DeserializationInput(factory)
|
||||
@ -236,7 +236,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun constraintPropagationRejectionTest() {
|
||||
val exception = TransactionVerificationException.ConstraintPropagationRejection(txid, "com.test.Contract",
|
||||
AlwaysAcceptAttachmentConstraint, AlwaysAcceptAttachmentConstraint)
|
||||
@ -252,7 +252,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals("com.test.Contract", exception2.contractClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionDuplicateEncumbranceExceptionTest() {
|
||||
val exception = TransactionVerificationException.TransactionDuplicateEncumbranceException(txid, 1)
|
||||
val exception2 = DeserializationInput(factory)
|
||||
@ -266,7 +266,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionNonMatchingEncumbranceExceptionTest() {
|
||||
val exception = TransactionVerificationException.TransactionNonMatchingEncumbranceException(txid, listOf(1, 2, 3))
|
||||
val exception2 = DeserializationInput(factory)
|
||||
@ -280,7 +280,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionNotaryMismatchEncumbranceExceptionTest() {
|
||||
val exception = TransactionVerificationException.TransactionNotaryMismatchEncumbranceException(
|
||||
txid, 1, 2, Party(ALICE_NAME, generateKeyPair().public), Party(BOB_NAME, generateKeyPair().public))
|
||||
@ -295,7 +295,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionContractConflictExceptionTest() {
|
||||
val exception = TransactionVerificationException.TransactionContractConflictException(
|
||||
txid, TransactionState(DummyContractState(), notary = Party(BOB_NAME, generateKeyPair().public)), "aa")
|
||||
@ -310,7 +310,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun transactionRequiredContractUnspecifiedExceptionTest() {
|
||||
val exception = TransactionVerificationException.TransactionRequiredContractUnspecifiedException(
|
||||
txid, TransactionState(DummyContractState(), notary = Party(BOB_NAME, generateKeyPair().public)))
|
||||
|
@ -49,13 +49,13 @@ class CompositeKeyTests {
|
||||
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))) }
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `(Alice) fulfilled by Alice signature`() {
|
||||
assertTrue { alicePublicKey.isFulfilledBy(aliceSignature.by) }
|
||||
assertFalse { alicePublicKey.isFulfilledBy(charlieSignature.by) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `(Alice or Bob) fulfilled by either signature`() {
|
||||
val aliceOrBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build(threshold = 1)
|
||||
assertTrue { aliceOrBob.isFulfilledBy(aliceSignature.by) }
|
||||
@ -64,14 +64,14 @@ class CompositeKeyTests {
|
||||
assertFalse { aliceOrBob.isFulfilledBy(charlieSignature.by) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `(Alice and Bob) fulfilled by Alice, Bob signatures`() {
|
||||
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
|
||||
val signatures = listOf(aliceSignature, bobSignature)
|
||||
assertTrue { aliceAndBob.isFulfilledBy(signatures.byKeys()) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `(Alice and Bob) requires both signatures to fulfil`() {
|
||||
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
|
||||
assertFalse { aliceAndBob.isFulfilledBy(listOf(aliceSignature).byKeys()) }
|
||||
@ -79,7 +79,7 @@ class CompositeKeyTests {
|
||||
assertTrue { aliceAndBob.isFulfilledBy(listOf(aliceSignature, bobSignature).byKeys()) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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
|
||||
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
|
||||
@ -90,7 +90,7 @@ class CompositeKeyTests {
|
||||
assertTrue { aliceAndBobOrCharlie.isFulfilledBy(signatures.byKeys()) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `encoded tree decodes correctly`() {
|
||||
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
|
||||
val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1)
|
||||
@ -101,7 +101,7 @@ class CompositeKeyTests {
|
||||
assertEquals(decoded, aliceAndBobOrCharlie)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `der encoded tree decodes correctly`() {
|
||||
val aliceAndBob = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build()
|
||||
val aliceAndBobOrCharlie = CompositeKey.Builder().addKeys(aliceAndBob, charliePublicKey).build(threshold = 1)
|
||||
@ -112,7 +112,7 @@ class CompositeKeyTests {
|
||||
assertEquals(decoded, aliceAndBobOrCharlie)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `der encoded tree decodes correctly with weighting`() {
|
||||
val aliceAndBob = CompositeKey.Builder()
|
||||
.addKey(alicePublicKey, 2)
|
||||
@ -130,7 +130,7 @@ class CompositeKeyTests {
|
||||
assertEquals(decoded, aliceAndBobOrCharlie)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `tree canonical form`() {
|
||||
assertEquals(CompositeKey.Builder().addKeys(alicePublicKey).build(), alicePublicKey)
|
||||
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.
|
||||
*/
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `composite TransactionSignature verification `() {
|
||||
val twoOfThree = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey, charliePublicKey).build(threshold = 2)
|
||||
|
||||
@ -289,7 +289,7 @@ class CompositeKeyTests {
|
||||
key1.checkValidity()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `CompositeKey from multiple signature schemes and signature verification`() {
|
||||
val keyPairRSA = Crypto.generateKeyPair(Crypto.RSA_SHA256)
|
||||
val keyPairK1 = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256)
|
||||
@ -313,7 +313,7 @@ class CompositeKeyTests {
|
||||
assertFalse { compositeKey.isFulfilledBy(signaturesWithoutRSA.byKeys()) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Test save to keystore`() {
|
||||
// From test case [CompositeKey from multiple signature schemes and signature verification]
|
||||
val keyPairRSA = Crypto.generateKeyPair(Crypto.RSA_SHA256)
|
||||
@ -367,7 +367,7 @@ class CompositeKeyTests {
|
||||
assertEquals(compositeKey, compositeKey2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `CompositeKey deterministic children sorting`() {
|
||||
val (_, pub1) = Crypto.generateKeyPair(Crypto.EDDSA_ED25519_SHA512)
|
||||
val (_, pub2) = Crypto.generateKeyPair(Crypto.ECDSA_SECP256K1_SHA256)
|
||||
|
@ -100,24 +100,24 @@ class PartialMerkleTreeTest {
|
||||
}
|
||||
|
||||
// Building full Merkle Tree tests.
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `building Merkle tree with 6 nodes - no rightmost nodes`() {
|
||||
assertEquals(expectedRoot, merkleTree.hash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `building Merkle tree - no hashes`() {
|
||||
assertFailsWith<MerkleTreeException> { MerkleTree.getMerkleTree(emptyList()) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `building Merkle tree one node`() {
|
||||
val node = 'a'.serialize().sha256()
|
||||
val mt = MerkleTree.getMerkleTree(listOf(node))
|
||||
assertEquals(node, mt.hash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `building Merkle tree odd number of nodes`() {
|
||||
val odd = hashed.subList(0, 3)
|
||||
val h1 = hashed[0].hashConcat(hashed[1])
|
||||
@ -127,7 +127,7 @@ class PartialMerkleTreeTest {
|
||||
assertEquals(mt.hash, expected)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check full tree`() {
|
||||
val h = SecureHash.randomSHA256()
|
||||
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.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `building Merkle tree for a tx and nonce test`() {
|
||||
fun filtering(elem: Any): Boolean {
|
||||
return when (elem) {
|
||||
@ -171,7 +171,7 @@ class PartialMerkleTreeTest {
|
||||
ftx.verify()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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.
|
||||
val privacySalt = PrivacySalt()
|
||||
@ -181,7 +181,7 @@ class PartialMerkleTreeTest {
|
||||
assertNotEquals(wtx1.id, wtx2.id)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `nothing filtered`() {
|
||||
val ftxNothing = testTx.buildFilteredTransaction(Predicate { false })
|
||||
assertTrue(ftxNothing.componentGroups.isEmpty())
|
||||
@ -197,32 +197,32 @@ class PartialMerkleTreeTest {
|
||||
}
|
||||
|
||||
// Partial Merkle Tree building tests.
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `build Partial Merkle Tree, only left nodes branch`() {
|
||||
val inclHashes = listOf(hashed[3], hashed[5])
|
||||
val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
|
||||
assertTrue(pmt.verify(merkleTree.hash, inclHashes))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `build Partial Merkle Tree, include zero leaves`() {
|
||||
val pmt = PartialMerkleTree.build(merkleTree, emptyList())
|
||||
assertTrue(pmt.verify(merkleTree.hash, emptyList()))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `build Partial Merkle Tree, include all leaves`() {
|
||||
val pmt = PartialMerkleTree.build(merkleTree, hashed)
|
||||
assertTrue(pmt.verify(merkleTree.hash, hashed))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `build Partial Merkle Tree - duplicate leaves failure`() {
|
||||
val inclHashes = arrayListOf(hashed[3], hashed[5], hashed[3], hashed[5])
|
||||
assertFailsWith<MerkleTreeException> { PartialMerkleTree.build(merkleTree, inclHashes) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `build Partial Merkle Tree - only duplicate leaves, less included failure`() {
|
||||
val leaves = "aaa"
|
||||
val hashes = leaves.map { it.serialize().hash }
|
||||
@ -230,7 +230,7 @@ class PartialMerkleTreeTest {
|
||||
assertFailsWith<MerkleTreeException> { PartialMerkleTree.build(mt, hashes.subList(0, 1)) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `verify Partial Merkle Tree - too many leaves failure`() {
|
||||
val inclHashes = arrayListOf(hashed[3], hashed[5])
|
||||
val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
|
||||
@ -238,7 +238,7 @@ class PartialMerkleTreeTest {
|
||||
assertFalse(pmt.verify(merkleTree.hash, inclHashes))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `verify Partial Merkle Tree - too little leaves failure`() {
|
||||
val inclHashes = arrayListOf(hashed[3], hashed[5], hashed[0])
|
||||
val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
|
||||
@ -246,7 +246,7 @@ class PartialMerkleTreeTest {
|
||||
assertFalse(pmt.verify(merkleTree.hash, inclHashes))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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 inclHashes = arrayListOf(hashed[3], hashed[4])
|
||||
@ -255,14 +255,14 @@ class PartialMerkleTreeTest {
|
||||
assertFalse(pmt.verify(mt.hash, inclHashes))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `verify Partial Merkle Tree - different leaves failure`() {
|
||||
val inclHashes = arrayListOf(hashed[3], hashed[5])
|
||||
val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
|
||||
assertFalse(pmt.verify(merkleTree.hash, listOf(hashed[2], hashed[4])))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `verify Partial Merkle Tree - wrong root`() {
|
||||
val inclHashes = listOf(hashed[3], hashed[5])
|
||||
val pmt = PartialMerkleTree.build(merkleTree, inclHashes)
|
||||
@ -293,7 +293,7 @@ class PartialMerkleTreeTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Find leaf index`() {
|
||||
// A Merkle tree with 20 leaves.
|
||||
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")) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `building Merkle for reference states only`() {
|
||||
fun filtering(elem: Any): Boolean {
|
||||
return when (elem) {
|
||||
|
@ -25,7 +25,7 @@ class SignedDataTest {
|
||||
val data = "Just a simple test string"
|
||||
lateinit var serialized: SerializedBytes<String>
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `make sure correctly signed data is released`() {
|
||||
val keyPair = generateKeyPair()
|
||||
val sig = keyPair.private.sign(serialized.bytes, keyPair.public)
|
||||
|
@ -21,7 +21,7 @@ class TransactionSignatureTest {
|
||||
private val testBytes = "12345678901234567890123456789012".toByteArray()
|
||||
|
||||
/** Valid sign and verify. */
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Signature metadata full sign and verify`() {
|
||||
val keyPair = Crypto.generateKeyPair("ECDSA_SECP256K1_SHA256")
|
||||
|
||||
@ -47,7 +47,7 @@ class TransactionSignatureTest {
|
||||
Crypto.doVerify((testBytes + testBytes).sha256(), transactionSignature)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Verify multi-tx signature`() {
|
||||
val keyPair = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, BigInteger.valueOf(1234567890L))
|
||||
// Deterministically create 5 txIds.
|
||||
@ -94,7 +94,7 @@ class TransactionSignatureTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Verify one-tx signature`() {
|
||||
val keyPair = Crypto.deriveKeyPairFromEntropy(Crypto.EDDSA_ED25519_SHA512, BigInteger.valueOf(1234567890L))
|
||||
val txId = "aTransaction".toByteArray().sha256()
|
||||
|
@ -57,7 +57,7 @@ class X509NameConstraintsTest {
|
||||
return Pair(keyStore, trustStore)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `illegal common name`() {
|
||||
val acceptableNames = listOf("CN=Bank A TLS, O=Bank A", "CN=Bank A")
|
||||
.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`() {
|
||||
val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A")
|
||||
.map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray()
|
||||
@ -135,7 +135,7 @@ class X509NameConstraintsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test private key retrieval`() {
|
||||
val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A")
|
||||
.map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray()
|
||||
|
@ -45,7 +45,7 @@ class AttachmentTests : WithMockNet {
|
||||
private val bobNode = makeNode(BOB_NAME)
|
||||
private val alice = aliceNode.info.singleIdentity()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `download and store`() {
|
||||
// Insert an attachment into node zero's store directly.
|
||||
val id = aliceNode.importAttachment(fakeAttachment("file1.txt", "Some useful content"))
|
||||
@ -67,7 +67,7 @@ class AttachmentTests : WithMockNet {
|
||||
willReturn(soleAttachment(attachment)))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun missing() {
|
||||
val hash: SecureHash = SecureHash.randomSHA256()
|
||||
|
||||
@ -82,7 +82,7 @@ class AttachmentTests : WithMockNet {
|
||||
FetchDataFlow.HashNotFound::requested,
|
||||
equalTo(expected))
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun maliciousResponse() {
|
||||
// Make a node that doesn't do sanity checking at load time.
|
||||
val badAliceNode = makeBadNode(ALICE_NAME)
|
||||
|
@ -67,7 +67,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
||||
private val bob = bobNode.info.singleIdentity()
|
||||
private val charlie = charlieNode.info.singleIdentity()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `successfully collects three signatures`() {
|
||||
val bConfidentialIdentity = bobNode.createConfidentialIdentity(bob)
|
||||
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`() {
|
||||
val aConfidentialIdentity1 = aliceNode.createConfidentialIdentity(alice)
|
||||
val bConfidentialIdentity1 = bobNode.createConfidentialIdentity(bob)
|
||||
@ -97,7 +97,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
||||
Assert.assertThat(missingSigners, `is`(emptySet()))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `successfully collects signatures when sessions are initiated with both AnonymousParty and WellKnownParty`() {
|
||||
val aConfidentialIdentity1 = aliceNode.createConfidentialIdentity(alice)
|
||||
val bConfidentialIdentity1 = bobNode.createConfidentialIdentity(bob)
|
||||
@ -142,7 +142,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
||||
future.getOrThrow()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `it is possible to collect from multiple well known sessions`() {
|
||||
bobNode.registerInitiatedFlow(ExtraSessionsFlowResponder::class.java)
|
||||
charlieNode.registerInitiatedFlow(ExtraSessionsFlowResponder::class.java)
|
||||
@ -157,7 +157,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
||||
Assert.assertThat(signedTx.getMissingSigners(), `is`(emptySet()))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `no need to collect any signatures`() {
|
||||
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`() {
|
||||
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.")))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `passes with multiple initial signatures`() {
|
||||
val signedByA = aliceNode.signDummyContract(
|
||||
alice.ref(1),
|
||||
|
@ -42,7 +42,7 @@ class ContractUpgradeFlowRPCTest : WithContracts, WithFinality {
|
||||
private val alice = aliceNode.info.singleIdentity()
|
||||
private val bob = bobNode.info.singleIdentity()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `2 parties contract upgrade using RPC`() = rpcDriver {
|
||||
val testUser = createTestUser()
|
||||
val rpcA = startProxy(aliceNode, testUser)
|
||||
|
@ -46,7 +46,7 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
|
||||
private val bob = bobNode.info.singleIdentity()
|
||||
private val notary = mockNet.defaultNotaryIdentity
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `2 parties contract upgrade`() {
|
||||
// Create dummy contract.
|
||||
val signedByA = aliceNode.signDummyContract(alice.ref(1), 0, bob.ref(1))
|
||||
@ -116,7 +116,7 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
|
||||
{ it.state.data },
|
||||
expectation)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `upgrade Cash to v2`() {
|
||||
// Create some cash.
|
||||
val cashFlowResult = aliceNode.issueCash()
|
||||
|
@ -31,7 +31,7 @@ class FastThreadLocalTest {
|
||||
|
||||
private val expensiveObjCount = AtomicInteger()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `ThreadLocal with plain old Thread is fiber-local`() = scheduled(3, ::Thread) {
|
||||
val threadLocal = object : ThreadLocal<ExpensiveObj>() {
|
||||
override fun initialValue() = ExpensiveObj()
|
||||
@ -40,7 +40,7 @@ class FastThreadLocalTest {
|
||||
assertEquals(100, expensiveObjCount.get())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `ThreadLocal with FastThreadLocalThread is fiber-local`() = scheduled(3, ::FastThreadLocalThread) {
|
||||
val threadLocal = object : ThreadLocal<ExpensiveObj>() {
|
||||
override fun initialValue() = ExpensiveObj()
|
||||
@ -49,7 +49,7 @@ class FastThreadLocalTest {
|
||||
assertEquals(100, expensiveObjCount.get())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `FastThreadLocal with plain old Thread is fiber-local`() = scheduled(3, ::Thread) {
|
||||
val threadLocal = object : FastThreadLocal<ExpensiveObj>() {
|
||||
override fun initialValue() = ExpensiveObj()
|
||||
@ -58,7 +58,7 @@ class FastThreadLocalTest {
|
||||
assertEquals(100, expensiveObjCount.get())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `FastThreadLocal with FastThreadLocalThread is not fiber-local`() =
|
||||
scheduled(3, ::FastThreadLocalThread) {
|
||||
val threadLocal = object : FastThreadLocal<ExpensiveObj>() {
|
||||
@ -89,14 +89,14 @@ class FastThreadLocalTest {
|
||||
private val fail: Nothing by lazy { throw UnsupportedOperationException("Nice try.") }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `ThreadLocal content is not serialized`() {
|
||||
contentIsNotSerialized(object : ThreadLocal<UnserializableObj>() {
|
||||
override fun initialValue() = UnserializableObj()
|
||||
}::get)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `FastThreadLocal content is not serialized`() {
|
||||
contentIsNotSerialized(object : FastThreadLocal<UnserializableObj>() {
|
||||
override fun initialValue() = UnserializableObj()
|
||||
|
@ -34,7 +34,7 @@ class FinalityFlowTests : WithFinality {
|
||||
@After
|
||||
fun tearDown() = mockNet.stopNodes()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `finalise a simple transaction`() {
|
||||
val bob = createBob()
|
||||
val stx = aliceNode.issuesCashTo(bob)
|
||||
@ -46,7 +46,7 @@ class FinalityFlowTests : WithFinality {
|
||||
and visibleTo(bob)))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `reject a transaction with unknown parties`() {
|
||||
// Charlie isn't part of this network, so node A won't recognise them
|
||||
val stx = aliceNode.issuesCashTo(CHARLIE)
|
||||
@ -56,7 +56,7 @@ class FinalityFlowTests : WithFinality {
|
||||
willThrow<IllegalArgumentException>())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `allow use of the old API if the CorDapp target version is 3`() {
|
||||
val oldBob = createBob(cordapps = listOf(tokenOldCordapp()))
|
||||
val stx = aliceNode.issuesCashTo(oldBob)
|
||||
@ -68,7 +68,7 @@ class FinalityFlowTests : WithFinality {
|
||||
assertThat(oldBob.services.validatedTransactions.getTransaction(stx.id)).isNotNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `broadcasting to both new and old participants`() {
|
||||
val newCharlie = mockNet.createNode(InternalMockNodeParameters(legalName = CHARLIE_NAME))
|
||||
val oldBob = createBob(cordapps = listOf(tokenOldCordapp()))
|
||||
|
@ -28,7 +28,7 @@ import kotlin.test.assertTrue
|
||||
|
||||
class FlowExternalAsyncOperationTest : AbstractFlowExternalOperationTest() {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `external async operation`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
|
||||
|
@ -16,7 +16,7 @@ import kotlin.test.assertEquals
|
||||
|
||||
class FlowExternalOperationStartFlowTest : AbstractFlowExternalOperationTest() {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `starting a flow inside of a flow that starts a future will succeed`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
|
||||
|
@ -35,7 +35,7 @@ import kotlin.test.assertTrue
|
||||
|
||||
class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `external operation`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
|
||||
@ -166,7 +166,7 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `vault can be queried`() {
|
||||
driver(
|
||||
DriverParameters(
|
||||
@ -181,7 +181,7 @@ class FlowExternalOperationTest : AbstractFlowExternalOperationTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `data can be persisted to node database via entity manager`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
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`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
|
||||
|
@ -32,7 +32,7 @@ class ReceiveMultipleFlowTests : WithMockNet {
|
||||
|
||||
private val nodes = (0..2).map { mockNet.createPartyNode() }
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun showcase_flows_as_closures() {
|
||||
val answer = 10.0
|
||||
val message = "Hello Ivan"
|
||||
@ -66,7 +66,7 @@ class ReceiveMultipleFlowTests : WithMockNet {
|
||||
willReturn(answer as Any))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `receive all messages in parallel using map style`() {
|
||||
val doubleValue = 5.0
|
||||
nodes[1].registerAnswer(AlgorithmDefinition::class, doubleValue)
|
||||
@ -78,7 +78,7 @@ class ReceiveMultipleFlowTests : WithMockNet {
|
||||
willReturn(doubleValue * stringValue.length))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `receive all messages in parallel using list style`() {
|
||||
val value1 = 5.0
|
||||
nodes[1].registerAnswer(ParallelAlgorithmList::class, value1)
|
||||
|
@ -33,7 +33,7 @@ class ReceiveFinalityFlowTest {
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `sent to flow hospital on error and retry on node restart`() {
|
||||
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
|
||||
|
@ -44,7 +44,7 @@ class ReferencedStatesFlowTests {
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `with referenced states flow blocks until the reference state update is received`() {
|
||||
// 1. Create reference state.
|
||||
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
|
||||
@ -70,7 +70,7 @@ class ReferencedStatesFlowTests {
|
||||
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`() {
|
||||
// 1. Create a state to be used as a reference state. Don't share it.
|
||||
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
|
||||
@ -102,7 +102,7 @@ class ReferencedStatesFlowTests {
|
||||
assertEquals(newRefState, theReferencedStateAgain.states.single())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check schema mappings are updated for reference states`() {
|
||||
// 1. Create a state to be used as a reference state. Don't share it.
|
||||
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
|
||||
@ -118,7 +118,7 @@ class ReferencedStatesFlowTests {
|
||||
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`() {
|
||||
// 1. Create a state to be used as a reference state. Don't share it.
|
||||
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
|
||||
@ -170,7 +170,7 @@ class ReferencedStatesFlowTests {
|
||||
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`() {
|
||||
// 1. Create a state to be used as a reference state. Don't share it.
|
||||
val newRefTx = nodes[0].services.startFlow(CreateRefState()).resultFuture.getOrThrow()
|
||||
|
@ -24,13 +24,13 @@ class PartyAndCertificateTest {
|
||||
@JvmField
|
||||
val testSerialization = SerializationEnvironmentRule()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `reject a path with no roles`() {
|
||||
val path = X509Utilities.buildCertPath(DEV_ROOT_CA.certificate)
|
||||
assertFailsWith<IllegalArgumentException> { PartyAndCertificate(path) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `kryo serialisation`() {
|
||||
val original = getTestPartyAndCertificate(Party(
|
||||
CordaX500Name(organisation = "Test Corp", locality = "Madrid", country = "ES"),
|
||||
@ -41,7 +41,7 @@ class PartyAndCertificateTest {
|
||||
assertThat(copy.certificate).isEqualTo(original.certificate)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `jdk serialization`() {
|
||||
val identity = getTestPartyAndCertificate(Party(
|
||||
CordaX500Name(organisation = "Test Corp", locality = "Madrid", country = "ES"),
|
||||
|
@ -11,7 +11,7 @@ import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotEquals
|
||||
|
||||
class PartyTest {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun equality() {
|
||||
val key = entropyToKeyPair(BigInteger.valueOf(20170207L)).public
|
||||
val differentKey = entropyToKeyPair(BigInteger.valueOf(7201702L)).public
|
||||
|
@ -10,14 +10,14 @@ import javax.security.auth.x500.X500Principal
|
||||
import kotlin.test.*
|
||||
|
||||
class CertRoleTests {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `should deserialize valid value`() {
|
||||
val expected = CertRole.DOORMAN_CA
|
||||
val actual = CertRole.getInstance(ASN1Integer(1L))
|
||||
assertEquals(expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `should reject invalid values`() {
|
||||
// Below the lowest used value
|
||||
assertFailsWith<IllegalArgumentException> { CertRole.getInstance(ASN1Integer(0L)) }
|
||||
@ -27,7 +27,7 @@ class CertRoleTests {
|
||||
assertFailsWith<IllegalArgumentException> { CertRole.getInstance(ASN1Integer(Integer.MAX_VALUE + 1L)) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check cert roles verify for various cert hierarchies`() {
|
||||
|
||||
// Testing for various certificate hierarchies (with or without NodeCA).
|
||||
|
@ -111,7 +111,7 @@ class NetworkParametersResolutionTest {
|
||||
return Pair(dummy1, dummy2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `parameters all null`() {
|
||||
val (stx1, stx2) = makeTransactions(null, null)
|
||||
assertThat(stx1.networkParametersHash).isNull()
|
||||
@ -126,7 +126,7 @@ class NetworkParametersResolutionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `transaction chain out of order parameters`() {
|
||||
val hash2 = params2.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`() {
|
||||
val hash1 = defaultParams.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`() {
|
||||
val hash3 = params3.serialize().hash
|
||||
// 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`() {
|
||||
// stx1 with epoch 2, stx2 with epoch 1, stx3 with epoch 3
|
||||
// stx1 -> stx2, stx1 -> stx3, stx2 -> stx3
|
||||
|
@ -84,7 +84,7 @@ class ResolveTransactionsFlowTest {
|
||||
// DOCEND 3
|
||||
|
||||
// DOCSTART 1
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `resolve from two hashes`() {
|
||||
val (stx1, stx2) = makeTransactions()
|
||||
val p = TestFlow(setOf(stx2.id), megaCorp)
|
||||
@ -98,7 +98,7 @@ class ResolveTransactionsFlowTest {
|
||||
}
|
||||
// DOCEND 1
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `dependency with an error`() {
|
||||
val stx = makeTransactions(signFirstTX = false).second
|
||||
val p = TestFlow(setOf(stx.id), megaCorp)
|
||||
@ -107,7 +107,7 @@ class ResolveTransactionsFlowTest {
|
||||
assertFailsWith(SignedTransaction.SignaturesMissingException::class) { future.getOrThrow() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `resolve from a signed transaction`() {
|
||||
val (stx1, stx2) = makeTransactions()
|
||||
val p = TestFlow(stx2, megaCorp)
|
||||
@ -121,7 +121,7 @@ class ResolveTransactionsFlowTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `triangle of transactions resolves fine`() {
|
||||
val stx1 = makeTransactions().first
|
||||
|
||||
@ -149,7 +149,7 @@ class ResolveTransactionsFlowTest {
|
||||
future.getOrThrow()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun attachment() {
|
||||
fun makeJar(): InputStream {
|
||||
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`() {
|
||||
val (_, stx2) = makeTransactions()
|
||||
val p = TestNoRightsVendingFlow(miniCorp, toVend = stx2, toRequest = stx2)
|
||||
@ -185,7 +185,7 @@ class ResolveTransactionsFlowTest {
|
||||
future.getOrThrow()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Requesting a transaction without having the right to see it results in exception`() {
|
||||
val (_, stx2) = makeTransactions()
|
||||
val (_, stx3) = makeTransactions()
|
||||
@ -195,7 +195,7 @@ class ResolveTransactionsFlowTest {
|
||||
assertFailsWith<FetchDataFlow.IllegalTransactionRequest> { future.getOrThrow() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Requesting a transaction twice results in exception`() {
|
||||
val (_, stx2) = makeTransactions()
|
||||
val p = TestResolveTwiceVendingFlow(miniCorp, stx2)
|
||||
@ -204,7 +204,7 @@ class ResolveTransactionsFlowTest {
|
||||
assertFailsWith<FetchDataFlow.IllegalTransactionRequest> { future.getOrThrow() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `resolution works when transaction in chain is already resolved`() {
|
||||
val (tx1, tx2) = makeTransactions()
|
||||
miniCorpNode.transaction {
|
||||
@ -217,7 +217,7 @@ class ResolveTransactionsFlowTest {
|
||||
future.getOrThrow()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `can resolve a chain of transactions containing a notary change transaction`() {
|
||||
val tx = notaryChangeChain()
|
||||
var numUpdates = 0
|
||||
@ -234,7 +234,7 @@ class ResolveTransactionsFlowTest {
|
||||
assertTrue(notaryChangeTxSeen)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `can resolve a chain of transactions containing a contract upgrade transaction`() {
|
||||
val tx = contractUpgradeChain()
|
||||
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.
|
||||
@Test
|
||||
@Ignore
|
||||
@Test(timeout=300_000)
|
||||
@Ignore
|
||||
fun `Can resolve large chain of transactions`() {
|
||||
val txToResolve = makeLargeTransactionChain(2500)
|
||||
val p = TestFlow(txToResolve, megaCorp)
|
||||
|
@ -43,7 +43,7 @@ class NetworkParametersTest {
|
||||
}
|
||||
|
||||
// Minimum Platform Version tests
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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 aliceDirectory = mockNet.baseDirectory(100)
|
||||
@ -54,7 +54,7 @@ class NetworkParametersTest {
|
||||
assertThatThrownBy { alice.start() }.hasMessageContaining("platform version")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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 aliceDirectory = mockNet.baseDirectory(100)
|
||||
@ -65,7 +65,7 @@ class NetworkParametersTest {
|
||||
alice.start()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `that we can copy while preserving the event horizon`() {
|
||||
// this is defensive tests in response to CORDA-2769
|
||||
val aliceNotaryParty = TestIdentity(ALICE_NAME).party
|
||||
@ -94,7 +94,7 @@ class NetworkParametersTest {
|
||||
}
|
||||
|
||||
// Notaries tests
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `choosing notary not specified in network parameters will fail`() {
|
||||
val fakeNotary = mockNet.createNode(
|
||||
InternalMockNodeParameters(
|
||||
@ -112,7 +112,7 @@ class NetworkParametersTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `package ownership checks are correct`() {
|
||||
val key1 = generateKeyPair().public
|
||||
val key2 = generateKeyPair().public
|
||||
|
@ -31,13 +31,13 @@ class NodeInfoTests {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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(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`() {
|
||||
assertFalse(testNode.isLegalIdentity(TestIdentity.fresh("party3").name),
|
||||
"Party 3 must not exist on the node")
|
||||
|
@ -41,21 +41,21 @@ class VaultUpdateTests {
|
||||
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)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `nothing plus nothing is nothing`() {
|
||||
val before = emptyUpdate
|
||||
val after = before + emptyUpdate
|
||||
assertEquals(before, after)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `something plus nothing is something`() {
|
||||
val before = Vault.Update<ContractState>(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3))
|
||||
val after = before + emptyUpdate
|
||||
assertEquals(before, after)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `nothing plus something is something`() {
|
||||
val before = emptyUpdate
|
||||
val after = before + Vault.Update(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef2, stateAndRef3))
|
||||
@ -63,7 +63,7 @@ class VaultUpdateTests {
|
||||
assertEquals(expected, after)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `something plus consume state 0 is something without state 0 output`() {
|
||||
val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1))
|
||||
val after = before + Vault.Update(setOf(stateAndRef0), setOf())
|
||||
@ -71,7 +71,7 @@ class VaultUpdateTests {
|
||||
assertEquals(expected, after)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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 after = before + Vault.Update(setOf(), setOf(stateAndRef4))
|
||||
@ -79,7 +79,7 @@ class VaultUpdateTests {
|
||||
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`() {
|
||||
val before = Vault.Update<ContractState>(setOf(stateAndRef2, stateAndRef3), setOf(stateAndRef0, stateAndRef1))
|
||||
val after = before + Vault.Update(setOf(stateAndRef0, stateAndRef1), setOf(stateAndRef4))
|
||||
@ -87,7 +87,7 @@ class VaultUpdateTests {
|
||||
assertEquals(expected, after)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `can't combine updates of different types`() {
|
||||
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)
|
||||
|
@ -54,55 +54,55 @@ class MappedSchemasCrossReferenceDetectionTests {
|
||||
) : PersistentState()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `no cross reference to other schema`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(GoodSchema)).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(GoodSchema)).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference to other schema is detected`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(BadSchema)).isNotEmpty
|
||||
assertThat(methodsFromOtherMappedSchema(BadSchema)).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference via non JPA field is allowed`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(TrickySchema)).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(TrickySchema)).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference via transient field is allowed`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(PoliteSchema)).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(PoliteSchema)).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `no cross reference to other schema java`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(GoodSchemaJavaV1())).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(GoodSchemaJavaV1())).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference to other schema is detected java`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(BadSchemaJavaV1())).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(BadSchemaJavaV1())).isNotEmpty
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference to other schema via field is detected java`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(BadSchemaNoGetterJavaV1())).isNotEmpty
|
||||
assertThat(methodsFromOtherMappedSchema(BadSchemaNoGetterJavaV1())).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference via non JPA field is allowed java`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(TrickySchemaJavaV1())).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(TrickySchemaJavaV1())).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cross reference via transient field is allowed java`() {
|
||||
assertThat(fieldsFromOtherMappedSchema(PoliteSchemaJavaV1())).isEmpty()
|
||||
assertThat(methodsFromOtherMappedSchema(PoliteSchemaJavaV1())).isEmpty()
|
||||
|
@ -169,14 +169,14 @@ class AttachmentSerializationTest {
|
||||
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`() {
|
||||
val attachmentId = SecureHash.sha256("any old data")
|
||||
launchFlow(CustomAttachmentLogic(serverIdentity, attachmentId, "custom"), 1)
|
||||
assertEquals("custom", rebootClientAndGetAttachmentContent())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `custom attachment should be saved in checkpoint even if its data was persisted`() {
|
||||
val attachmentId = client.saveAttachment("genuine")
|
||||
launchFlow(CustomAttachmentLogic(serverIdentity, attachmentId, "custom"), 1)
|
||||
@ -184,7 +184,7 @@ class AttachmentSerializationTest {
|
||||
assertEquals("custom", rebootClientAndGetAttachmentContent())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `only the hash of a regular attachment should be saved in checkpoint`() {
|
||||
val attachmentId = client.saveAttachment("genuine")
|
||||
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.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `only the hash of a FetchAttachmentsFlow attachment should be saved in checkpoint`() {
|
||||
val attachmentId = server.saveAttachment("genuine")
|
||||
launchFlow(FetchAttachmentLogic(serverIdentity, attachmentId), 2, sendData = true)
|
||||
|
@ -14,7 +14,7 @@ class CommandsSerializationTests {
|
||||
@JvmField
|
||||
val testSerialization = SerializationEnvironmentRule()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test cash move serialization`() {
|
||||
val command = Cash.Commands.Move(CommercialPaper::class.java)
|
||||
val copiedCommand = command.serialize().deserialize()
|
||||
|
@ -19,7 +19,7 @@ class NotaryExceptionSerializationTest {
|
||||
@JvmField
|
||||
val testSerialization = SerializationEnvironmentRule()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun testSerializationRoundTrip() {
|
||||
val txhash = SecureHash.randomSHA256()
|
||||
val stateHistory: Map<StateRef, StateConsumptionDetails> = mapOf(
|
||||
|
@ -93,7 +93,7 @@ class TransactionSerializationTests {
|
||||
tx = TransactionBuilder(DUMMY_NOTARY).withItems(inputState, outputState, changeState, Command(TestCash.Commands.Move(), arrayListOf(MEGA_CORP.owningKey)))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun signWireTX() {
|
||||
val ptx = megaCorpServices.signInitialTransaction(tx)
|
||||
val stx = notaryServices.addSignature(ptx)
|
||||
@ -111,7 +111,7 @@ class TransactionSerializationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun wrongKeys() {
|
||||
val ptx = megaCorpServices.signInitialTransaction(tx)
|
||||
val stx = notaryServices.addSignature(ptx)
|
||||
@ -134,7 +134,7 @@ class TransactionSerializationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun timeWindow() {
|
||||
tx.setTimeWindow(TEST_TX_TIME, 30.seconds)
|
||||
val ptx = megaCorpServices.signInitialTransaction(tx)
|
||||
@ -142,7 +142,7 @@ class TransactionSerializationTests {
|
||||
assertEquals(TEST_TX_TIME, stx.tx.timeWindow?.midpoint)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun storeAndLoadWhenSigning() {
|
||||
val ptx = megaCorpServices.signInitialTransaction(tx)
|
||||
ptx.verifySignaturesExcept(DUMMY_NOTARY_KEY.public)
|
||||
|
@ -41,7 +41,7 @@ class AttachmentsClassLoaderSerializationTests {
|
||||
private val storage = InternalMockAttachmentStorage(MockAttachmentStorage())
|
||||
private val attachmentTrustCalculator = NodeAttachmentTrustCalculator(storage, TestingNamedCacheFactory())
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Can serialize and deserialize with an attachment classloader`() {
|
||||
|
||||
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?
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test serialization of SecureHash`() {
|
||||
val secureHash = SecureHash.randomSHA256()
|
||||
val bytes = secureHash.serialize()
|
||||
@ -86,7 +86,7 @@ class AttachmentsClassLoaderSerializationTests {
|
||||
assertEquals(secureHash, copiedSecuredHash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test serialization of OpaqueBytes`() {
|
||||
val opaqueBytes = OpaqueBytes("0123456789".toByteArray())
|
||||
val bytes = opaqueBytes.serialize()
|
||||
@ -95,7 +95,7 @@ class AttachmentsClassLoaderSerializationTests {
|
||||
assertEquals(opaqueBytes, copiedOpaqueBytes)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `test serialization of sub-sequence OpaqueBytes`() {
|
||||
val bytesSequence = ByteSequence.of("0123456789".toByteArray(), 3, 2)
|
||||
val bytes = bytesSequence.serialize()
|
||||
|
@ -77,14 +77,14 @@ class AttachmentsClassLoaderTests {
|
||||
attachmentTrustCalculator = NodeAttachmentTrustCalculator(internalStorage, cacheFactory)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Loading AnotherDummyContract without using the AttachmentsClassLoader fails`() {
|
||||
assertFailsWith<ClassNotFoundException> {
|
||||
Class.forName(ISOLATED_CONTRACT_CLASS_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Dynamically load AnotherDummyContract from isolated contracts jar using the AttachmentsClassLoader`() {
|
||||
val isolatedId = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
|
||||
|
||||
@ -94,7 +94,7 @@ class AttachmentsClassLoaderTests {
|
||||
assertEquals("helloworld", contract.declaredField<Any?>("magicString").value)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Test non-overlapping contract 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")
|
||||
@ -104,7 +104,7 @@ class AttachmentsClassLoaderTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Test valid overlapping contract jar`() {
|
||||
val isolatedId = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
|
||||
val signedJar = signContractJar(ISOLATED_CONTRACTS_JAR_PATH, copyFirst = true)
|
||||
@ -114,7 +114,7 @@ class AttachmentsClassLoaderTests {
|
||||
createClassloader(listOf(isolatedId, isolatedSignedId))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Test non-overlapping different contract jars`() {
|
||||
val att1 = importAttachment(ISOLATED_CONTRACTS_JAR_PATH.openStream(), "app", "isolated.jar")
|
||||
val att2 = importAttachment(FINANCE_CONTRACTS_CORDAPP.jarFile.inputStream(), "app", "finance.jar")
|
||||
@ -123,7 +123,7 @@ class AttachmentsClassLoaderTests {
|
||||
createClassloader(listOf(att1, att2))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Load text resources from AttachmentsClassLoader`() {
|
||||
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")
|
||||
@ -136,7 +136,7 @@ class AttachmentsClassLoaderTests {
|
||||
assertEquals("some other data", txt1)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Test valid overlapping file condition`() {
|
||||
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")
|
||||
@ -146,7 +146,7 @@ class AttachmentsClassLoaderTests {
|
||||
assertEquals("same data", txt)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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 ->
|
||||
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`() {
|
||||
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")
|
||||
@ -164,7 +164,7 @@ class AttachmentsClassLoaderTests {
|
||||
createClassloader(listOf(att1, att2))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
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 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`() {
|
||||
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")
|
||||
@ -184,7 +184,7 @@ class AttachmentsClassLoaderTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `partial overlaps not possible`() {
|
||||
// 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.
|
||||
@ -195,7 +195,7 @@ class AttachmentsClassLoaderTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Check platform independent path handling in attachment jars`() {
|
||||
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")
|
||||
@ -213,7 +213,7 @@ class AttachmentsClassLoaderTests {
|
||||
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`() {
|
||||
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")
|
||||
@ -231,7 +231,7 @@ class AttachmentsClassLoaderTests {
|
||||
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`() {
|
||||
val keyPairA = Crypto.generateKeyPair()
|
||||
val keyPairB = Crypto.generateKeyPair()
|
||||
@ -260,7 +260,7 @@ class AttachmentsClassLoaderTests {
|
||||
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`() {
|
||||
val keyPairA = Crypto.generateKeyPair()
|
||||
val keyPairB = Crypto.generateKeyPair()
|
||||
@ -290,7 +290,7 @@ class AttachmentsClassLoaderTests {
|
||||
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`() {
|
||||
val keyPairA = 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`() {
|
||||
val keyPairA = 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)`() {
|
||||
val keyPairA = 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`() {
|
||||
val keyPairA = 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`() {
|
||||
val keyPairA = Crypto.generateKeyPair()
|
||||
|
||||
|
@ -69,7 +69,7 @@ class CompatibleTransactionTests {
|
||||
}
|
||||
private val wireTransactionA by lazy { WireTransaction(componentGroups = componentGroupsA, privacySalt = privacySalt) }
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Merkle root computations`() {
|
||||
// Merkle tree computation is deterministic if the same salt and ordering are used.
|
||||
val wireTransactionB = WireTransaction(componentGroups = componentGroupsA, privacySalt = privacySalt)
|
||||
@ -129,7 +129,7 @@ class CompatibleTransactionTests {
|
||||
assertEquals(wireTransactionA, WireTransaction(componentGroups = shuffledComponentGroupsA, privacySalt = privacySalt))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `WireTransaction constructors and compatibility`() {
|
||||
val groups = createComponentGroups(inputs, outputs, commands, attachments, notary, timeWindow, emptyList(), null)
|
||||
val wireTransactionOldConstructor = WireTransaction(groups, privacySalt)
|
||||
@ -198,7 +198,7 @@ class CompatibleTransactionTests {
|
||||
assertFails { WireTransaction(componentGroupsCompatibleEmptyNew, privacySalt) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `FilteredTransaction constructors and compatibility`() {
|
||||
// Filter out all of the components.
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Command visibility tests`() {
|
||||
// 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))
|
||||
@ -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.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `FilteredTransaction signer manipulation tests`() {
|
||||
// Required to call the private constructor.
|
||||
val ftxConstructor = FilteredTransaction::class.constructors.first()
|
||||
@ -557,7 +557,7 @@ class CompatibleTransactionTests {
|
||||
assertFailsWith<ComponentVisibilityException> { ftxAlterSignerB.checkCommandVisibility(DUMMY_KEY_1.public) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `parameters hash visibility`() {
|
||||
fun paramsFilter(elem: Any): Boolean = elem is NetworkParametersHash && elem.hash == paramsHash
|
||||
fun attachmentFilter(elem: Any): Boolean = elem is SecureHash && elem == paramsHash
|
||||
|
@ -98,7 +98,7 @@ class LedgerTransactionQueryTests {
|
||||
return tx.toLedgerTransaction(services)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple InRef Indexer tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
assertEquals(0, ltx.inRef<IntTypeDummyState>(0).state.data.data)
|
||||
@ -108,7 +108,7 @@ class LedgerTransactionQueryTests {
|
||||
assertFailsWith<IndexOutOfBoundsException> { ltx.inRef<IntTypeDummyState>(10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple OutRef Indexer tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
assertEquals(0, ltx.outRef<IntTypeDummyState>(0).state.data.data)
|
||||
@ -118,7 +118,7 @@ class LedgerTransactionQueryTests {
|
||||
assertFailsWith<IndexOutOfBoundsException> { ltx.outRef<IntTypeDummyState>(10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple Input Indexer tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
assertEquals(0, (ltx.getInput(0) as IntTypeDummyState).data)
|
||||
@ -128,7 +128,7 @@ class LedgerTransactionQueryTests {
|
||||
assertFailsWith<IndexOutOfBoundsException> { ltx.getInput(10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple Output Indexer tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
assertEquals(0, (ltx.getOutput(0) as IntTypeDummyState).data)
|
||||
@ -138,7 +138,7 @@ class LedgerTransactionQueryTests {
|
||||
assertFailsWith<IndexOutOfBoundsException> { ltx.getOutput(10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple Command Indexer tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
assertEquals(0, ltx.getCommand<Commands.Cmd1>(0).value.id)
|
||||
@ -148,7 +148,7 @@ class LedgerTransactionQueryTests {
|
||||
assertFailsWith<IndexOutOfBoundsException> { ltx.getOutput(10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple Inputs of type tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intStates = ltx.inputsOfType(IntTypeDummyState::class.java)
|
||||
@ -161,7 +161,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(emptyList(), notPresentQuery)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple InputsRefs of type tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple Outputs of type tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intStates = ltx.outputsOfType(IntTypeDummyState::class.java)
|
||||
@ -187,7 +187,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(emptyList(), notPresentQuery)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple OutputsRefs of type tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intStates = ltx.outRefsOfType(IntTypeDummyState::class.java)
|
||||
@ -202,7 +202,7 @@ class LedgerTransactionQueryTests {
|
||||
assertTrue(stringStates.all { it.ref.txhash == ltx.id })
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Simple Commands of type tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intCmd1 = ltx.commandsOfType(Commands.Cmd1::class.java)
|
||||
@ -215,7 +215,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(emptyList(), notPresentQuery)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Filtered Input Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intStates = ltx.filterInputs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 })
|
||||
@ -225,7 +225,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals("3", stringStates.single().data)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Filtered InRef Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
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())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Filtered Output Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intStates = ltx.filterOutputs(IntTypeDummyState::class.java, Predicate { it.data.rem(2) == 0 })
|
||||
@ -247,7 +247,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals("3", stringStates.single().data)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Filtered OutRef Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Filtered Commands Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Find Input Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intState = ltx.findInput(IntTypeDummyState::class.java, Predicate { it.data == 4 })
|
||||
@ -280,7 +280,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(ltx.getInput(7), stringState)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Find InRef Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intState = ltx.findInRef(IntTypeDummyState::class.java, Predicate { it.data == 4 })
|
||||
@ -289,7 +289,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(ltx.inRef(7), stringState)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Find Output Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intState = ltx.findOutput(IntTypeDummyState::class.java, Predicate { it.data == 4 })
|
||||
@ -298,7 +298,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(ltx.getOutput(7), stringState)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Find OutRef Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intState = ltx.findOutRef(IntTypeDummyState::class.java, Predicate { it.data == 4 })
|
||||
@ -307,7 +307,7 @@ class LedgerTransactionQueryTests {
|
||||
assertEquals(ltx.outRef(7), stringState)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Find Commands Tests`() {
|
||||
val ltx = makeDummyTransaction()
|
||||
val intCmd1 = ltx.findCommand(Commands.Cmd1::class.java, Predicate { it.id == 2 })
|
||||
|
@ -103,7 +103,7 @@ class ReferenceStateTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `create a reference state then refer to it multiple times`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
// 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`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
transaction {
|
||||
@ -161,7 +161,7 @@ class ReferenceStateTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Can't use old reference states`() {
|
||||
val refData = ExampleState(ALICE_PARTY, "HELLO CORDA")
|
||||
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`() {
|
||||
val state = ExampleState(ALICE_PARTY, "HELLO CORDA")
|
||||
val stateAndRef = StateAndRef(TransactionState(state, CONTRACT_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint), StateRef(SecureHash.zeroHash, 0))
|
||||
|
@ -63,7 +63,7 @@ class TransactionBuilderTest {
|
||||
.getLatestContractAttachments("net.corda.testing.contracts.DummyContract")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `bare minimum issuance tx`() {
|
||||
val outputState = TransactionState(
|
||||
data = DummyState(),
|
||||
@ -80,7 +80,7 @@ class TransactionBuilderTest {
|
||||
assertThat(wtx.networkParametersHash).isEqualTo(networkParametersService.currentHash)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `automatic hash constraint`() {
|
||||
doReturn(unsignedAttachment).whenever(attachments).openAttachment(contractAttachmentId)
|
||||
|
||||
@ -92,7 +92,7 @@ class TransactionBuilderTest {
|
||||
assertThat(wtx.outputs).containsOnly(outputState.copy(constraint = HashAttachmentConstraint(contractAttachmentId)))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `reference states`() {
|
||||
doReturn(unsignedAttachment).whenever(attachments).openAttachment(contractAttachmentId)
|
||||
|
||||
@ -114,7 +114,7 @@ class TransactionBuilderTest {
|
||||
assertThat(wtx.references).containsOnly(referenceStateRef)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `automatic signature constraint`() {
|
||||
val aliceParty = TestIdentity(ALICE_NAME).party
|
||||
val bobParty = TestIdentity(BOB_NAME).party
|
||||
|
@ -82,7 +82,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `states must be bi-directionally encumbered`() {
|
||||
// Basic encumbrance example for encumbrance index links 0 -> 1 and 1 -> 0
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
@ -145,7 +145,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `non bi-directional encumbrance will fail`() {
|
||||
// Single encumbrance with no back link.
|
||||
assertFailsWith<TransactionVerificationException.TransactionNonMatchingEncumbranceException> {
|
||||
@ -214,7 +214,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `state can transition if encumbrance rules are met`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
unverifiedTransaction {
|
||||
@ -235,7 +235,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `state cannot transition if the encumbrance contract fails to verify`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
unverifiedTransaction {
|
||||
@ -256,7 +256,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `state must be consumed along with its encumbrance`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
unverifiedTransaction {
|
||||
@ -275,7 +275,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `state cannot be encumbered by itself`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
transaction {
|
||||
@ -288,7 +288,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `encumbrance state index must be valid`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
transaction {
|
||||
@ -302,7 +302,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `correct encumbrance state must be provided`() {
|
||||
ledgerServices.ledger(DUMMY_NOTARY) {
|
||||
unverifiedTransaction {
|
||||
@ -323,7 +323,7 @@ class TransactionEncumbranceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `encumbered states cannot be assigned to different notaries`() {
|
||||
// Single encumbrance with different notaries.
|
||||
assertFailsWith<TransactionVerificationException.TransactionNotaryMismatchEncumbranceException> {
|
||||
|
@ -53,7 +53,7 @@ class TransactionTests {
|
||||
return SignedTransaction(wtx, sigs)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `signed transaction missing signatures - CompositeKey`() {
|
||||
val ak = 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.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `signed transaction missing signatures`() {
|
||||
val wtx = createWireTransaction(
|
||||
inputs = listOf(StateRef(SecureHash.randomSHA256(), 0)),
|
||||
@ -118,7 +118,7 @@ class TransactionTests {
|
||||
makeSigned(wtx, DUMMY_KEY_1, DUMMY_KEY_2).verifyRequiredSignatures()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `transactions with no inputs can have any notary`() {
|
||||
val baseOutState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, DUMMY_NOTARY, constraint = AlwaysAcceptAttachmentConstraint)
|
||||
val inputs = emptyList<StateAndRef<*>>()
|
||||
@ -148,7 +148,7 @@ class TransactionTests {
|
||||
transaction.verify()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `transaction cannot have duplicate inputs`() {
|
||||
val stateRef = StateRef(SecureHash.randomSHA256(), 0)
|
||||
fun buildTransaction() = createWireTransaction(
|
||||
@ -163,7 +163,7 @@ class TransactionTests {
|
||||
assertFailsWith<IllegalStateException> { buildTransaction() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `general transactions cannot change notary`() {
|
||||
val notary: Party = DUMMY_NOTARY
|
||||
val inState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, notary)
|
||||
@ -201,7 +201,7 @@ class TransactionTests {
|
||||
assertFailsWith<TransactionVerificationException.NotaryChangeInWrongTransactionType> { buildTransaction().verify() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `transactions with identical contents must have different ids`() {
|
||||
val outputState = TransactionState(DummyContract.SingleOwnerState(0, ALICE), DummyContract.PROGRAM_ID, DUMMY_NOTARY)
|
||||
fun buildTransaction() = createWireTransaction(
|
||||
|
@ -34,7 +34,7 @@ class KotlinUtilsTest {
|
||||
true,
|
||||
null)
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `transient property which is null`() {
|
||||
val test = NullTransientProperty()
|
||||
test.transientValue
|
||||
@ -42,7 +42,7 @@ class KotlinUtilsTest {
|
||||
assertThat(test.evalCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `checkpointing a transient property with non-capturing lambda`() {
|
||||
val original = NonCapturingTransientProperty()
|
||||
val originalVal = original.transientVal
|
||||
@ -52,7 +52,7 @@ class KotlinUtilsTest {
|
||||
assertThat(copy.transientVal).isEqualTo(copyVal)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `deserialise transient property with non-capturing lambda`() {
|
||||
expectedEx.expect(KryoException::class.java)
|
||||
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)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `checkpointing a transient property with capturing lambda`() {
|
||||
val original = CapturingTransientProperty("Hello")
|
||||
val originalVal = original.transientVal
|
||||
@ -71,7 +71,7 @@ class KotlinUtilsTest {
|
||||
assertThat(copy.transientVal).startsWith("Hello")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `deserialise transient property with capturing lambda`() {
|
||||
expectedEx.expect(KryoException::class.java)
|
||||
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")
|
||||
|
@ -42,17 +42,17 @@ class NonEmptySetTest {
|
||||
@JvmField
|
||||
val testSerialization = SerializationEnvironmentRule()
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `copyOf - empty source`() {
|
||||
assertThatThrownBy { NonEmptySet.copyOf(HashSet<Int>()) }.isInstanceOf(IllegalArgumentException::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun head() {
|
||||
assertThat(NonEmptySet.of(1, 2).head()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `serialize deserialize`() {
|
||||
val original = NonEmptySet.of(-17, 22, 17)
|
||||
val copy = original.serialize().deserialize()
|
||||
|
@ -59,7 +59,7 @@ class ProgressTrackerTest {
|
||||
pt4 = ChildSteps.tracker()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `check basic steps`() {
|
||||
assertEquals(ProgressTracker.UNSTARTED, pt.currentStep)
|
||||
assertEquals(0, pt.stepIndex)
|
||||
@ -76,14 +76,14 @@ class ProgressTrackerTest {
|
||||
assertEquals(ProgressTracker.DONE, pt.nextStep())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `cannot go beyond end`() {
|
||||
pt.currentStep = SimpleSteps.FOUR
|
||||
pt.nextStep()
|
||||
assertFails { pt.nextStep() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `nested children are stepped correctly`() {
|
||||
val stepNotification = LinkedList<ProgressTracker.Change>()
|
||||
pt.changes.subscribe {
|
||||
@ -109,7 +109,7 @@ class ProgressTrackerTest {
|
||||
assertEquals(ChildSteps.BEE, pt2.nextStep())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `steps tree index counts children steps`() {
|
||||
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
|
||||
|
||||
@ -148,7 +148,7 @@ class ProgressTrackerTest {
|
||||
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`() {
|
||||
pt.setChildProgressTracker(SimpleSteps.FOUR, pt2)
|
||||
pt2.setChildProgressTracker(ChildSteps.SEA, pt3)
|
||||
@ -183,7 +183,7 @@ class ProgressTrackerTest {
|
||||
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`() {
|
||||
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
|
||||
|
||||
@ -220,7 +220,7 @@ class ProgressTrackerTest {
|
||||
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`() {
|
||||
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
|
||||
|
||||
@ -255,7 +255,7 @@ class ProgressTrackerTest {
|
||||
assertThat(stepsTreeNotification).hasSize(3) // The initial tree state, plus one per update
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `can be rewound`() {
|
||||
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
|
||||
repeat(4) { pt.nextStep() }
|
||||
@ -263,7 +263,7 @@ class ProgressTrackerTest {
|
||||
assertEquals(SimpleSteps.TWO, pt.nextStep())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `all index changes seen if subscribed mid flow`() {
|
||||
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
|
||||
|
||||
@ -280,7 +280,7 @@ class ProgressTrackerTest {
|
||||
assertThat(stepsIndexNotifications).containsExactlyElementsOf(listOf(0, 1, 2, 3))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `all step changes seen if subscribed mid flow`() {
|
||||
val steps = mutableListOf<String>()
|
||||
pt.nextStep()
|
||||
@ -293,7 +293,7 @@ class ProgressTrackerTest {
|
||||
assertEquals(listOf("Starting", "one", "two", "three", "four", "Done"), steps)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `all tree changes seen if subscribed mid flow`() {
|
||||
val stepTreeNotifications = mutableListOf<List<Pair<Int, String>>>()
|
||||
val firstStepLabels = pt.allStepsLabels
|
||||
@ -310,7 +310,7 @@ class ProgressTrackerTest {
|
||||
assertEquals(listOf(firstStepLabels, secondStepLabels, thirdStepLabels), stepTreeNotifications)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `trees with child trackers with duplicate steps reported correctly`() {
|
||||
val stepTreeNotifications = mutableListOf<List<Pair<Int, String>>>()
|
||||
val stepIndexNotifications = mutableListOf<Int>()
|
||||
@ -329,7 +329,7 @@ class ProgressTrackerTest {
|
||||
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`() {
|
||||
assertFails { pt.currentStep = BabySteps.UNOS }
|
||||
}
|
||||
@ -341,7 +341,7 @@ class ProgressTrackerTest {
|
||||
fun tracker() = ProgressTracker(first, second, first2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Serializing and deserializing a tracker maintains equality`() {
|
||||
val step = NonSingletonSteps.first
|
||||
val recreatedStep = step
|
||||
@ -350,7 +350,7 @@ class ProgressTrackerTest {
|
||||
assertEquals(step, recreatedStep)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `can assign a recreated equal step`() {
|
||||
val tracker = NonSingletonSteps.tracker()
|
||||
val recreatedStep = first
|
||||
@ -359,13 +359,13 @@ class ProgressTrackerTest {
|
||||
tracker.currentStep = recreatedStep
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `Steps with the same label defined in different places are not equal`() {
|
||||
val one = ProgressTracker.Step("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`() {
|
||||
assertNotEquals(first, first2)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import java.util.*
|
||||
import java.util.concurrent.CancellationException
|
||||
|
||||
class UtilsTest {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `toFuture - single item observable`() {
|
||||
val subject = PublishSubject.create<String>()
|
||||
val future = subject.toFuture()
|
||||
@ -16,7 +16,7 @@ class UtilsTest {
|
||||
assertThat(future.getOrThrow()).isEqualTo("Hello")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `toFuture - empty obserable`() {
|
||||
val subject = PublishSubject.create<String>()
|
||||
val future = subject.toFuture()
|
||||
@ -26,7 +26,7 @@ class UtilsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `toFuture - more than one item observable`() {
|
||||
val subject = PublishSubject.create<String>()
|
||||
val future = subject.toFuture()
|
||||
@ -36,7 +36,7 @@ class UtilsTest {
|
||||
assertThat(future.getOrThrow()).isEqualTo("Hello")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `toFuture - erroring observable`() {
|
||||
val subject = PublishSubject.create<String>()
|
||||
val future = subject.toFuture()
|
||||
@ -47,7 +47,7 @@ class UtilsTest {
|
||||
}.isSameAs(exception)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `toFuture - cancel`() {
|
||||
val subject = PublishSubject.create<String>()
|
||||
val future = subject.toFuture()
|
||||
|
@ -20,7 +20,7 @@ class ConcurrencyUtilsTest {
|
||||
doNothing().whenever(it).error(any(), any<Throwable>())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `firstOf short circuit`() {
|
||||
// Order not significant in this case:
|
||||
val g = firstOf(arrayOf(f2, f1), log) {
|
||||
@ -38,7 +38,7 @@ class ConcurrencyUtilsTest {
|
||||
verifyNoMoreInteractions(log)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `firstOf re-entrant handler attempt due to cancel`() {
|
||||
val futures = arrayOf(f1, f2)
|
||||
val g = firstOf(futures, log) {
|
||||
@ -56,7 +56,7 @@ class ConcurrencyUtilsTest {
|
||||
/**
|
||||
* 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`() {
|
||||
val futures = arrayOf(f1, f2)
|
||||
val nonCancel = IllegalStateException()
|
||||
@ -73,7 +73,7 @@ class ConcurrencyUtilsTest {
|
||||
assertThatThrownBy { f2.getOrThrow() }.isSameAs(nonCancel)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `firstOf cancel is not special`() {
|
||||
val g = firstOf(arrayOf(f2, f1), log) {
|
||||
++invocations
|
||||
@ -85,7 +85,7 @@ class ConcurrencyUtilsTest {
|
||||
verifyNoMoreInteractions(log)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `match does not pass failure of success block into the failure block`() {
|
||||
val f = CompletableFuture.completedFuture(100)
|
||||
val successes = mutableListOf<Any?>()
|
||||
@ -101,7 +101,7 @@ class ConcurrencyUtilsTest {
|
||||
assertEquals(emptyList<Any?>(), failures)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `match does not pass ExecutionException to failure block`() {
|
||||
val e = Throwable()
|
||||
val f = CompletableFuture<Void>().apply { completeExceptionally(e) }
|
||||
|
@ -4,7 +4,7 @@ import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
||||
import org.junit.Test
|
||||
|
||||
class PrivacySaltTest {
|
||||
@Test
|
||||
@Test(timeout=300_000)
|
||||
fun `all-zero PrivacySalt not allowed`() {
|
||||
assertThatExceptionOfType(IllegalArgumentException::class.java).isThrownBy {
|
||||
PrivacySalt(ByteArray(32))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user