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