Moved tests in net.corda.node.services to correct packages

This commit is contained in:
Shams Asari 2017-04-19 11:56:48 +01:00
parent 941bc9be5b
commit 37a94237c8
16 changed files with 40 additions and 53 deletions

View File

@ -1,7 +1,6 @@
package net.corda.node.services
package net.corda.core.node.services
import net.corda.core.contracts.Timestamp
import net.corda.core.node.services.TimestampChecker
import net.corda.core.seconds
import org.junit.Test
import java.time.Clock

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.events
import net.corda.core.contracts.*
import net.corda.core.days
@ -8,12 +8,12 @@ import net.corda.core.flows.FlowLogicRefFactory
import net.corda.core.node.ServiceHub
import net.corda.core.node.services.VaultService
import net.corda.core.serialization.SingletonSerializeAsToken
import net.corda.core.utilities.ALICE_KEY
import net.corda.core.utilities.DUMMY_NOTARY
import net.corda.node.services.events.NodeSchedulerService
import net.corda.node.services.MockServiceHubInternal
import net.corda.node.services.persistence.DBCheckpointStorage
import net.corda.node.services.statemachine.StateMachineManager
import net.corda.node.services.vault.NodeVaultService
import net.corda.core.utilities.ALICE_KEY
import net.corda.node.utilities.AddOrRemove
import net.corda.node.utilities.AffinityExecutor
import net.corda.node.utilities.configureDatabase
@ -38,7 +38,7 @@ import kotlin.test.assertTrue
class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
val realClock: Clock = Clock.systemUTC()
val stoppedClock = Clock.fixed(realClock.instant(), realClock.zone)
val stoppedClock: Clock = Clock.fixed(realClock.instant(), realClock.zone)
val testClock = TestClock(stoppedClock)
val schedulerGatedExecutor = AffinityExecutor.Gate(true)

View File

@ -1,8 +1,7 @@
package net.corda.node.services
package net.corda.node.services.events
import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.*
import net.corda.core.crypto.CompositeKey
import net.corda.core.crypto.Party
import net.corda.core.crypto.containsAny
import net.corda.core.flows.FlowLogic
@ -85,7 +84,7 @@ class ScheduledFlowTests {
}
}
class ScheduledFlowTestPlugin : CordaPluginRegistry() {
object ScheduledFlowTestPlugin : CordaPluginRegistry() {
override val requiredFlows: Map<String, Set<String>> = mapOf(
InsertInitialStateFlow::class.java.name to setOf(Party::class.java.name),
ScheduledFlow::class.java.name to setOf(StateRef::class.java.name)
@ -101,8 +100,8 @@ class ScheduledFlowTests {
advertisedServices = *arrayOf(ServiceInfo(NetworkMapService.type), ServiceInfo(ValidatingNotaryService.type)))
nodeA = net.createNode(notaryNode.info.address, start = false)
nodeB = net.createNode(notaryNode.info.address, start = false)
nodeA.testPluginRegistries.add(ScheduledFlowTestPlugin())
nodeB.testPluginRegistries.add(ScheduledFlowTestPlugin())
nodeA.testPluginRegistries.add(ScheduledFlowTestPlugin)
nodeB.testPluginRegistries.add(ScheduledFlowTestPlugin)
net.startNodes()
}

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.network
import com.google.common.util.concurrent.ListenableFuture
import net.corda.core.getOrThrow
@ -8,12 +8,12 @@ import net.corda.core.node.NodeInfo
import net.corda.core.node.services.DEFAULT_SESSION_ID
import net.corda.core.node.services.ServiceInfo
import net.corda.core.serialization.deserialize
import net.corda.core.utilities.ALICE
import net.corda.core.utilities.BOB
import net.corda.flows.sendRequest
import net.corda.node.services.AbstractNetworkMapServiceTest.Changed.Added
import net.corda.node.services.AbstractNetworkMapServiceTest.Changed.Removed
import net.corda.node.services.config.NodeConfiguration
import net.corda.node.services.network.AbstractNetworkMapService
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.network.AbstractNetworkMapServiceTest.Changed.Added
import net.corda.node.services.network.AbstractNetworkMapServiceTest.Changed.Removed
import net.corda.node.services.network.NetworkMapService.*
import net.corda.node.services.network.NetworkMapService.Companion.FETCH_TOPIC
import net.corda.node.services.network.NetworkMapService.Companion.PUSH_ACK_TOPIC
@ -21,9 +21,6 @@ import net.corda.node.services.network.NetworkMapService.Companion.PUSH_TOPIC
import net.corda.node.services.network.NetworkMapService.Companion.QUERY_TOPIC
import net.corda.node.services.network.NetworkMapService.Companion.REGISTER_TOPIC
import net.corda.node.services.network.NetworkMapService.Companion.SUBSCRIPTION_TOPIC
import net.corda.node.services.network.NodeRegistration
import net.corda.core.utilities.ALICE
import net.corda.core.utilities.BOB
import net.corda.node.utilities.AddOrRemove
import net.corda.node.utilities.AddOrRemove.ADD
import net.corda.node.utilities.AddOrRemove.REMOVE

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.network
import net.corda.core.crypto.Party
import net.corda.core.crypto.generateKeyPair

View File

@ -1,8 +1,7 @@
package net.corda.node.services
package net.corda.node.services.network
import net.corda.core.getOrThrow
import net.corda.core.node.services.ServiceInfo
import net.corda.node.services.network.NetworkMapService
import net.corda.node.utilities.transaction
import net.corda.testing.node.MockNetwork
import org.junit.Test

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.network
import net.corda.node.services.network.InMemoryNetworkMapService
import net.corda.testing.node.MockNetwork

View File

@ -1,11 +1,9 @@
package net.corda.node.services
package net.corda.node.services.network
import net.corda.core.messaging.SingleMessageRecipient
import net.corda.core.node.services.ServiceInfo
import net.corda.node.services.api.ServiceHubInternal
import net.corda.node.services.config.NodeConfiguration
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.network.PersistentNetworkMapService
import net.corda.node.utilities.transaction
import net.corda.testing.node.MockNetwork
import net.corda.testing.node.MockNetwork.MockNode

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.persistence
import com.codahale.metrics.MetricRegistry
import com.google.common.jimfs.Configuration
@ -11,7 +11,6 @@ import net.corda.core.utilities.LogHelper
import net.corda.core.write
import net.corda.core.writeLines
import net.corda.node.services.database.RequeryConfiguration
import net.corda.node.services.persistence.NodeAttachmentService
import net.corda.node.services.persistence.schemas.AttachmentEntity
import net.corda.node.services.transactions.PersistentUniquenessProvider
import net.corda.node.utilities.configureDatabase

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.schema
import net.corda.core.contracts.Contract
import net.corda.core.contracts.StateAndRef

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.transactions
import com.google.common.net.HostAndPort
import io.atomix.catalyst.transport.Address

View File

@ -1,15 +1,14 @@
package net.corda.node.services
package net.corda.node.services.transactions
import net.corda.core.crypto.SecureHash
import net.corda.core.node.services.UniquenessException
import net.corda.node.services.transactions.InMemoryUniquenessProvider
import net.corda.testing.MEGA_CORP
import net.corda.testing.generateStateRef
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
class UniquenessProviderTests {
class InMemoryUniquenessProviderTests {
val identity = MEGA_CORP
val txID = SecureHash.randomSHA256()

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.transactions
import com.google.common.util.concurrent.ListenableFuture
import net.corda.core.contracts.DummyContract
@ -17,7 +17,6 @@ import net.corda.flows.NotaryException
import net.corda.flows.NotaryFlow
import net.corda.node.internal.AbstractNode
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.transactions.SimpleNotaryService
import net.corda.testing.node.MockNetwork
import org.assertj.core.api.Assertions.assertThat
import org.junit.Before

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.transactions
import net.corda.core.crypto.SecureHash
import net.corda.core.node.services.UniquenessException

View File

@ -1,4 +1,4 @@
package net.corda.node.services
package net.corda.node.services.transactions
import com.google.common.util.concurrent.ListenableFuture
import net.corda.core.contracts.*
@ -12,8 +12,8 @@ import net.corda.flows.NotaryError
import net.corda.flows.NotaryException
import net.corda.flows.NotaryFlow
import net.corda.node.internal.AbstractNode
import net.corda.node.services.issueInvalidState
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.testing.MEGA_CORP_KEY
import net.corda.testing.node.MockNetwork
import org.assertj.core.api.Assertions.assertThat

View File

@ -1,10 +1,8 @@
package net.corda.node.services
package net.corda.node.services.vault
import net.corda.contracts.asset.Cash
import net.corda.contracts.asset.DUMMY_CASH_ISSUER
import net.corda.contracts.testing.fillWithSomeTestCash
import net.corda.contracts.testing.fillWithSomeTestDeals
import net.corda.contracts.testing.fillWithSomeTestLinearStates
import net.corda.contracts.testing.*
import net.corda.core.contracts.*
import net.corda.core.node.services.VaultService
import net.corda.core.node.services.consumedStates
@ -225,8 +223,8 @@ class VaultWithCashTest {
// Issue a linear state
val dummyIssue = TransactionType.General.Builder(notary = DUMMY_NOTARY).apply {
addOutputState(net.corda.contracts.testing.DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
addOutputState(net.corda.contracts.testing.DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
addOutputState(DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
addOutputState(DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
signWith(freshKey)
signWith(DUMMY_NOTARY_KEY)
}.toSignedTransaction()
@ -246,7 +244,7 @@ class VaultWithCashTest {
// Issue a linear state
val dummyIssue = TransactionType.General.Builder(notary = DUMMY_NOTARY).apply {
addOutputState(net.corda.contracts.testing.DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
addOutputState(DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
signWith(freshKey)
signWith(DUMMY_NOTARY_KEY)
}.toSignedTransaction()
@ -254,11 +252,11 @@ class VaultWithCashTest {
dummyIssue.toLedgerTransaction(services).verify()
services.recordTransactions(dummyIssue)
assertThat(vault.unconsumedStates<net.corda.contracts.testing.DummyLinearContract.State>()).hasSize(1)
assertThat(vault.unconsumedStates<DummyLinearContract.State>()).hasSize(1)
// Move the same state
val dummyMove = TransactionType.General.Builder(notary = DUMMY_NOTARY).apply {
addOutputState(net.corda.contracts.testing.DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
addOutputState(DummyLinearContract.State(linearId = linearId, participants = listOf(freshKey.public)))
addInputState(dummyIssue.tx.outRef<LinearState>(0))
signWith(DUMMY_NOTARY_KEY)
}.toSignedTransaction()
@ -266,7 +264,7 @@ class VaultWithCashTest {
dummyIssue.toLedgerTransaction(services).verify()
services.recordTransactions(dummyMove)
assertThat(vault.unconsumedStates<net.corda.contracts.testing.DummyLinearContract.State>()).hasSize(1)
assertThat(vault.unconsumedStates<DummyLinearContract.State>()).hasSize(1)
}
}
@ -282,7 +280,7 @@ class VaultWithCashTest {
cash.forEach { println(it.state.data.amount) }
services.fillWithSomeTestDeals(listOf("123", "456", "789"))
val deals = vault.unconsumedStates<net.corda.contracts.testing.DummyDealContract.State>()
val deals = vault.unconsumedStates<DummyDealContract.State>()
deals.forEach { println(it.state.data.ref) }
}
@ -310,17 +308,17 @@ class VaultWithCashTest {
database.transaction {
services.fillWithSomeTestDeals(listOf("123", "456", "789"))
val deals = vault.unconsumedStates<net.corda.contracts.testing.DummyDealContract.State>().toList()
val deals = vault.unconsumedStates<DummyDealContract.State>().toList()
deals.forEach { println(it.state.data.ref) }
services.fillWithSomeTestLinearStates(3)
val linearStates = vault.unconsumedStates<net.corda.contracts.testing.DummyLinearContract.State>().toList()
val linearStates = vault.unconsumedStates<DummyLinearContract.State>().toList()
linearStates.forEach { println(it.state.data.linearId) }
// Create a txn consuming different contract types
val dummyMove = TransactionType.General.Builder(notary = DUMMY_NOTARY).apply {
addOutputState(net.corda.contracts.testing.DummyLinearContract.State(participants = listOf(freshKey.public)))
addOutputState(net.corda.contracts.testing.DummyDealContract.State(ref = "999", participants = listOf(freshKey.public)))
addOutputState(DummyLinearContract.State(participants = listOf(freshKey.public)))
addOutputState(DummyDealContract.State(ref = "999", participants = listOf(freshKey.public)))
addInputState(linearStates.first())
addInputState(deals.first())
signWith(DUMMY_NOTARY_KEY)