Remove advertised services from NodeInfo (#1521)

* Remove advertisedServices from NodeInfo.

Introduce notaryIdentities in NetworkMapCache, that will be filled in
later from NetworkParameters. Clean up NetworkMapCache API. Expose
notaryIdentities through RPC. For now we assume as temporary solution
that notaries in NetworkMap have to contain "notary" in name.

* Further clean up of NetworkMapCache API

Remve partyNodes. Introduce getAllNodeInfos function

* Remove notaryIdentity from ServiceHub

* Address Shams review comments

* Address Andrius review comments

* Add comments, cleanup

* Fixes

* Address comments

* Yet another commit with comments addressed

* Move ServiceType and ServiceInfo to node-api

Add changelog entry. Address rest of comments.

* Minor comments
This commit is contained in:
Katarzyna Streich
2017-09-20 13:19:57 +01:00
committed by josecoll
parent 6887947a4d
commit fd57cf1c0c
122 changed files with 467 additions and 615 deletions

View File

@ -1,7 +1,7 @@
package net.corda.docs
import net.corda.core.contracts.Amount
import net.corda.core.node.services.ServiceInfo
import net.corda.core.identity.Party
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.getOrThrow
import net.corda.finance.*
@ -9,11 +9,13 @@ import net.corda.finance.contracts.getCashBalances
import net.corda.finance.flows.CashIssueFlow
import net.corda.node.internal.StartedNode
import net.corda.finance.schemas.CashSchemaV1
import net.corda.nodeapi.ServiceInfo
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.testing.DUMMY_NOTARY
import net.corda.testing.DUMMY_NOTARY_KEY
import net.corda.testing.chooseIdentity
import net.corda.testing.getDefaultNotary
import net.corda.testing.node.MockNetwork
import org.junit.After
import org.junit.Assert
@ -27,6 +29,7 @@ class CustomVaultQueryTest {
lateinit var notaryNode: StartedNode<MockNetwork.MockNode>
lateinit var nodeA: StartedNode<MockNetwork.MockNode>
lateinit var nodeB: StartedNode<MockNetwork.MockNode>
lateinit var notary: Party
@Before
fun setup() {
@ -43,6 +46,7 @@ class CustomVaultQueryTest {
nodeA.internals.installCordaService(CustomVaultQuery.Service::class.java)
nodeA.internals.registerCustomSchemas(setOf(CashSchemaV1))
nodeB.internals.registerCustomSchemas(setOf(CashSchemaV1))
notary = nodeA.services.getDefaultNotary()
}
@After
@ -71,7 +75,7 @@ class CustomVaultQueryTest {
// Use NodeA as issuer and create some dollars
val flowHandle1 = nodeA.services.startFlow(CashIssueFlow(amountToIssue,
OpaqueBytes.of(0x01),
notaryNode.info.notaryIdentity))
notary))
// Wait for the flow to stop and print
flowHandle1.resultFuture.getOrThrow()
}
@ -81,7 +85,7 @@ class CustomVaultQueryTest {
nodeA.info.chooseIdentity(),
OpaqueBytes.of(0x01),
nodeA.info.chooseIdentity(),
notaryNode.info.notaryIdentity))
notary))
flowHandle1.resultFuture.getOrThrow()
}

View File

@ -1,6 +1,6 @@
package net.corda.docs
import net.corda.core.node.services.ServiceInfo
import net.corda.core.identity.Party
import net.corda.core.toFuture
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.getOrThrow
@ -9,11 +9,13 @@ import net.corda.finance.contracts.getCashBalances
import net.corda.finance.flows.CashIssueFlow
import net.corda.node.internal.StartedNode
import net.corda.finance.schemas.CashSchemaV1
import net.corda.nodeapi.ServiceInfo
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.testing.DUMMY_NOTARY
import net.corda.testing.DUMMY_NOTARY_KEY
import net.corda.testing.chooseIdentity
import net.corda.testing.getDefaultNotary
import net.corda.testing.node.MockNetwork
import org.junit.After
import org.junit.Before
@ -25,6 +27,7 @@ class FxTransactionBuildTutorialTest {
lateinit var notaryNode: StartedNode<MockNetwork.MockNode>
lateinit var nodeA: StartedNode<MockNetwork.MockNode>
lateinit var nodeB: StartedNode<MockNetwork.MockNode>
lateinit var notary: Party
@Before
fun setup() {
@ -39,6 +42,7 @@ class FxTransactionBuildTutorialTest {
nodeA.internals.registerCustomSchemas(setOf(CashSchemaV1))
nodeB.internals.registerCustomSchemas(setOf(CashSchemaV1))
nodeB.internals.registerInitiatedFlow(ForeignExchangeRemoteFlow::class.java)
notary = nodeA.services.getDefaultNotary()
}
@After
@ -51,7 +55,7 @@ class FxTransactionBuildTutorialTest {
// Use NodeA as issuer and create some dollars
val flowHandle1 = nodeA.services.startFlow(CashIssueFlow(DOLLARS(1000),
OpaqueBytes.of(0x01),
notaryNode.info.notaryIdentity))
notary))
// Wait for the flow to stop and print
flowHandle1.resultFuture.getOrThrow()
printBalances()
@ -59,7 +63,7 @@ class FxTransactionBuildTutorialTest {
// Using NodeB as Issuer create some pounds.
val flowHandle2 = nodeB.services.startFlow(CashIssueFlow(POUNDS(1000),
OpaqueBytes.of(0x01),
notaryNode.info.notaryIdentity))
notary))
// Wait for flow to come to an end and print
flowHandle2.resultFuture.getOrThrow()
printBalances()

View File

@ -4,12 +4,12 @@ import net.corda.core.contracts.LinearState
import net.corda.core.contracts.StateAndRef
import net.corda.core.contracts.UniqueIdentifier
import net.corda.core.node.ServiceHub
import net.corda.core.node.services.ServiceInfo
import net.corda.core.node.services.queryBy
import net.corda.core.node.services.vault.QueryCriteria
import net.corda.core.toFuture
import net.corda.core.utilities.getOrThrow
import net.corda.node.internal.StartedNode
import net.corda.nodeapi.ServiceInfo
import net.corda.node.services.network.NetworkMapService
import net.corda.node.services.transactions.ValidatingNotaryService
import net.corda.testing.DUMMY_NOTARY