mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
Merge pull request #6270 from corda/nnagy-os-4.5-os-4.6-20200520
Nnagy os 4.5 os 4.6 20200520
This commit is contained in:
commit
67298eb780
@ -1,4 +1,4 @@
|
||||
errorTemplate = Version identifier ({0}) for attribute {1} must be a whole number starting from 1.
|
||||
shortDescription = A version attribute with an invalid value was specified in the manifest of the CorDapp JAR. The version attribute value must be a whole number that is greater than or equal to 1.
|
||||
actionsToFix = Investigate the logs to find the invalid version attribute, and change its value to a valid one (a whole number greater than or equal to 1).
|
||||
aliases =
|
||||
aliases = 1nskd37
|
@ -1,4 +1,3 @@
|
||||
errorTemplate = Version identifier ({0}) for attribute {1} must be a whole number starting from 1.
|
||||
shortDescription = A version attribute with an invalid value was specified in the manifest of the CorDapp JAR. The version attribute value must be a whole number that is greater than or equal to 1.
|
||||
actionsToFix = Investigate the logs to find the invalid version attribute, and change its value to a valid one (a whole number greater than or equal to 1).
|
||||
aliases =
|
||||
actionsToFix = Investigate the logs to find the invalid version attribute, and change its value to a valid one (a whole number greater than or equal to 1).
|
@ -1,4 +1,4 @@
|
||||
errorTemplate = Target versionId attribute {0} not specified. Please specify a whole number starting from 1.
|
||||
shortDescription = A required version attribute was not specified in the manifest of the CorDapp JAR.
|
||||
actionsToFix = Investigate the logs to find out which version attribute was not specified, and add that version attribute to the CorDapp manifest.
|
||||
aliases =
|
||||
aliases = 1nskd37
|
@ -1,4 +1,3 @@
|
||||
errorTemplate = Target versionId attribute {0} not specified. Please specify a whole number starting from 1.
|
||||
shortDescription = A required version attribute was not specified in the manifest of the CorDapp JAR.
|
||||
actionsToFix = Investigate the logs to find out which version attribute was not specified, and add that version attribute to the CorDapp manifest.
|
||||
aliases =
|
||||
actionsToFix = Investigate the logs to find out which version attribute was not specified, and add that version attribute to the CorDapp manifest.
|
@ -20,10 +20,7 @@ import net.corda.testing.core.CHARLIE_NAME
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import net.corda.testing.driver.DriverParameters
|
||||
import net.corda.testing.driver.driver
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.apache.logging.log4j.core.config.Configurator
|
||||
import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.util.concurrent.Semaphore
|
||||
import kotlin.test.assertEquals
|
||||
@ -36,11 +33,6 @@ class FlowIsKilledTest {
|
||||
const val EXCEPTION_MESSAGE = "Goodbye, cruel world!"
|
||||
}
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
Configurator.setLevel("net.corda.node.services.statemachine", Level.DEBUG)
|
||||
}
|
||||
|
||||
@Test(timeout = 300_000)
|
||||
fun `manually handle the isKilled check`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
@ -111,7 +103,6 @@ class FlowIsKilledTest {
|
||||
assertFailsWith<UnexpectedFlowEndException> {
|
||||
handle.returnValue.getOrThrow(1.minutes)
|
||||
}
|
||||
assertTrue(AFlowThatGetsMurderedByItsFriend.receivedKilledException)
|
||||
assertEquals(11, AFlowThatGetsMurderedByItsFriendResponder.position)
|
||||
val aliceCheckpoints = alice.rpc.startFlow(::GetNumberOfCheckpointsFlow).returnValue.getOrThrow(20.seconds)
|
||||
assertEquals(1, aliceCheckpoints)
|
||||
@ -121,7 +112,7 @@ class FlowIsKilledTest {
|
||||
}
|
||||
|
||||
@Test(timeout = 300_000)
|
||||
fun `manually handle killed flows using checkForIsNotKilled`() {
|
||||
fun `manually handle killed flows using checkFlowIsNotKilled`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
|
||||
alice.rpc.let { rpc ->
|
||||
@ -140,7 +131,7 @@ class FlowIsKilledTest {
|
||||
}
|
||||
|
||||
@Test(timeout = 300_000)
|
||||
fun `manually handle killed flows using checkForIsNotKilled with lazy message`() {
|
||||
fun `manually handle killed flows using checkFlowIsNotKilled with lazy message`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
|
||||
alice.rpc.let { rpc ->
|
||||
@ -192,6 +183,7 @@ class FlowIsKilledTest {
|
||||
companion object {
|
||||
val lockA = Semaphore(0)
|
||||
val lockB = Semaphore(0)
|
||||
var isKilled = false
|
||||
var position = 0
|
||||
}
|
||||
|
||||
@ -208,6 +200,7 @@ class FlowIsKilledTest {
|
||||
position = i
|
||||
logger.info("i = $i")
|
||||
if (isKilled) {
|
||||
AFlowThatWantsToDieAndKillsItsFriends.isKilled = true
|
||||
throw KilledFlowException(runId, EXCEPTION_MESSAGE)
|
||||
}
|
||||
|
||||
@ -244,6 +237,9 @@ class FlowIsKilledTest {
|
||||
} catch (e: UnexpectedFlowEndException) {
|
||||
receivedKilledExceptions[ourIdentity.name] = true
|
||||
locks[ourIdentity.name]!!.release()
|
||||
require(AFlowThatWantsToDieAndKillsItsFriends.isKilled) {
|
||||
"The initiator must be killed when this exception is received"
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
@ -253,19 +249,16 @@ class FlowIsKilledTest {
|
||||
@InitiatingFlow
|
||||
class AFlowThatGetsMurderedByItsFriend(private val party: Party) : FlowLogic<Unit>() {
|
||||
|
||||
companion object {
|
||||
var receivedKilledException = false
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
override fun call() {
|
||||
val sessionOne = initiateFlow(party)
|
||||
// trigger sessions with 2 counter parties
|
||||
sessionOne.sendAndReceive<String>("what is up")
|
||||
try {
|
||||
sessionOne.sendAndReceive<String>("what is up")
|
||||
sessionOne.receive<String>()
|
||||
} catch (e: UnexpectedFlowEndException) {
|
||||
receivedKilledException = true
|
||||
require(AFlowThatGetsMurderedByItsFriendResponder.isKilled) {
|
||||
"The responder must be killed when this exception is received"
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
@ -277,6 +270,7 @@ class FlowIsKilledTest {
|
||||
companion object {
|
||||
val lockA = Semaphore(0)
|
||||
val lockB = Semaphore(0)
|
||||
var isKilled = false
|
||||
var flowId: StateMachineRunId? = null
|
||||
var position = 0
|
||||
}
|
||||
@ -289,6 +283,7 @@ class FlowIsKilledTest {
|
||||
for (i in 0..100) {
|
||||
position = i
|
||||
if (isKilled) {
|
||||
AFlowThatGetsMurderedByItsFriendResponder.isKilled = true
|
||||
throw KilledFlowException(runId, EXCEPTION_MESSAGE)
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,6 @@ import net.corda.testing.core.BOB_NAME
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import net.corda.testing.driver.DriverParameters
|
||||
import net.corda.testing.driver.driver
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.apache.logging.log4j.core.config.Configurator
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
@ -27,11 +24,6 @@ import kotlin.test.assertTrue
|
||||
|
||||
class FlowSleepTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
Configurator.setLevel("net.corda.node.services.statemachine", Level.DEBUG)
|
||||
}
|
||||
|
||||
@Test(timeout = 300_000)
|
||||
fun `flow can sleep`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
|
@ -34,10 +34,7 @@ import net.corda.testing.driver.NodeParameters
|
||||
import net.corda.testing.driver.OutOfProcess
|
||||
import net.corda.testing.driver.driver
|
||||
import net.corda.testing.node.internal.FINANCE_CORDAPPS
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.apache.logging.log4j.core.config.Configurator
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.time.Duration
|
||||
import java.util.concurrent.Semaphore
|
||||
@ -50,11 +47,6 @@ import kotlin.test.assertTrue
|
||||
|
||||
class KillFlowTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
Configurator.setLevel("net.corda.node.services.statemachine", Level.DEBUG)
|
||||
}
|
||||
|
||||
@Test(timeout = 300_000)
|
||||
fun `a killed flow will end when it reaches the next suspension point`() {
|
||||
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
|
||||
|
@ -761,8 +761,14 @@ class HibernateQueryCriteriaParser(val contractStateType: Class<out ContractStat
|
||||
val existingParticipants = ((((commonPredicates[predicateID]) as CompoundPredicate).expressions[0]) as InPredicate<*>)
|
||||
.values.map { participant -> (participant as LiteralExpression<*>).literal }
|
||||
log.warn("Adding new participants: $participants to existing participants: $existingParticipants")
|
||||
commonPredicates.replace(predicateID, criteriaBuilder.and(
|
||||
getPersistentPartyRoot().get<VaultSchemaV1.PersistentParty>("x500Name").`in`(existingParticipants + participants)))
|
||||
commonPredicates.replace(
|
||||
predicateID,
|
||||
checkIfListIsEmpty(
|
||||
args = existingParticipants + participants,
|
||||
criteriaBuilder = criteriaBuilder,
|
||||
predicate = criteriaBuilder.and(getPersistentPartyRoot().get<VaultSchemaV1.PersistentParty>("x500Name").`in`(existingParticipants + participants))
|
||||
)
|
||||
)
|
||||
}
|
||||
else {
|
||||
// Get the persistent party entity.
|
||||
@ -791,12 +797,18 @@ class HibernateQueryCriteriaParser(val contractStateType: Class<out ContractStat
|
||||
val subQueryNotExists = criteriaQuery.subquery(Tuple::class.java)
|
||||
val subRoot = subQueryNotExists.from(VaultSchemaV1.PersistentParty::class.java)
|
||||
subQueryNotExists.select(subRoot.get("x500Name"))
|
||||
subQueryNotExists.where(criteriaBuilder.and(
|
||||
criteriaBuilder.equal(vaultStates.get<VaultSchemaV1.VaultStates>("stateRef"),
|
||||
subRoot.get<VaultSchemaV1.PersistentParty>("compositeKey").get<PersistentStateRef>("stateRef"))),
|
||||
criteriaBuilder.not(subRoot.get<VaultSchemaV1.PersistentParty>("x500Name").`in`(exactParticipants)))
|
||||
val subQueryNotExistsPredicate = criteriaBuilder.and(criteriaBuilder.not(criteriaBuilder.exists(subQueryNotExists)))
|
||||
constraintPredicates.add(subQueryNotExistsPredicate)
|
||||
|
||||
//if the list of exact participants is empty, we return nothing with 1=0
|
||||
if (exactParticipants.isEmpty()) {
|
||||
constraintPredicates.add(criteriaBuilder.and(criteriaBuilder.equal(criteriaBuilder.literal(1), 0)))
|
||||
} else {
|
||||
subQueryNotExists.where(criteriaBuilder.and(
|
||||
criteriaBuilder.equal(vaultStates.get<VaultSchemaV1.VaultStates>("stateRef"),
|
||||
subRoot.get<VaultSchemaV1.PersistentParty>("compositeKey").get<PersistentStateRef>("stateRef"))),
|
||||
criteriaBuilder.not(subRoot.get<VaultSchemaV1.PersistentParty>("x500Name").`in`(exactParticipants)))
|
||||
val subQueryNotExistsPredicate = criteriaBuilder.and(criteriaBuilder.not(criteriaBuilder.exists(subQueryNotExists)))
|
||||
constraintPredicates.add(subQueryNotExistsPredicate)
|
||||
}
|
||||
|
||||
// join with transactions for each matching participant (only required where more than one)
|
||||
if (exactParticipants.size > 1)
|
||||
|
@ -249,6 +249,27 @@ abstract class VaultQueryTestsBase : VaultQueryParties {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout=300_000)
|
||||
fun `returns zero states when exact participants list is empty`() {
|
||||
database.transaction {
|
||||
identitySvc.verifyAndRegisterIdentity(BIG_CORP_IDENTITY)
|
||||
vaultFiller.fillWithDummyState(participants = listOf(MEGA_CORP))
|
||||
vaultFiller.fillWithDummyState(participants = listOf(MEGA_CORP, BIG_CORP))
|
||||
|
||||
val criteria = VaultQueryCriteria(exactParticipants = emptyList())
|
||||
val results = vaultService.queryBy<ContractState>(criteria)
|
||||
assertThat(results.states).hasSize(0)
|
||||
|
||||
val criteriaWithOneExactParticipant = VaultQueryCriteria(exactParticipants = listOf(MEGA_CORP))
|
||||
val resultsWithOneExactParticipant = vaultService.queryBy<ContractState>(criteriaWithOneExactParticipant)
|
||||
assertThat(resultsWithOneExactParticipant.states).hasSize(1)
|
||||
|
||||
val criteriaWithMoreExactParticipants = VaultQueryCriteria(exactParticipants = listOf(MEGA_CORP, BIG_CORP))
|
||||
val resultsWithMoreExactParticipants = vaultService.queryBy<ContractState>(criteriaWithMoreExactParticipants)
|
||||
assertThat(resultsWithMoreExactParticipants.states).hasSize(1)
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout=300_000)
|
||||
fun `unconsumed base contract states for two participants`() {
|
||||
database.transaction {
|
||||
|
Loading…
Reference in New Issue
Block a user