Merge remote-tracking branch 'remotes/open/master' into merges/08_11_2018_16_05

# Conflicts:
#	docs/source/corda-configuration-file.rst
#	node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/CordaPersistence.kt
#	node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt
#	node/src/test/kotlin/net/corda/node/services/config/NodeConfigurationImplTest.kt
This commit is contained in:
Michele Sollecito
2018-11-08 16:39:09 +00:00
51 changed files with 1332 additions and 634 deletions

View File

@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
public class TemplateContract implements Contract {
// This is used to identify our contract when building a transaction.
public static final String TEMPLATE_CONTRACT_ID = "com.template.TemplateContract";
public static final String ID = "com.template.TemplateContract";
/**
* A transaction is considered valid if the verify() function of the contract of each of the transaction's input

View File

@ -13,8 +13,6 @@ import net.corda.core.transactions.SignedTransaction;
import net.corda.core.transactions.TransactionBuilder;
import net.corda.core.utilities.ProgressTracker;
import static com.template.TemplateContract.TEMPLATE_CONTRACT_ID;
// Replace Initiator's definition with:
@InitiatingFlow
@StartableByRPC
@ -53,7 +51,7 @@ public class IOUFlow extends FlowLogic<Void> {
// We create a transaction builder and add the components.
TransactionBuilder txBuilder = new TransactionBuilder(notary)
.addOutputState(outputState, TEMPLATE_CONTRACT_ID)
.addOutputState(outputState, TemplateContract.ID)
.addCommand(cmd);
// Signing the transaction.

View File

@ -18,7 +18,7 @@ import static net.corda.core.contracts.ContractsDSL.requireThat;
// Replace TemplateContract's definition with:
public class IOUContract implements Contract {
public static final String IOU_CONTRACT_ID = "com.template.IOUContract";
public static final String ID = "com.template.IOUContract";
// Our Create command.
public static class Create implements CommandData {

View File

@ -52,7 +52,7 @@ public class IOUFlow extends FlowLogic<Void> {
// We create the transaction components.
IOUState outputState = new IOUState(iouValue, getOurIdentity(), otherParty);
StateAndContract outputContractAndState = new StateAndContract(outputState, IOUContract.IOU_CONTRACT_ID);
StateAndContract outputContractAndState = new StateAndContract(outputState, IOUContract.ID);
List<PublicKey> requiredSigners = ImmutableList.of(getOurIdentity().getOwningKey(), otherParty.getOwningKey());
Command cmd = new Command<>(new IOUContract.Create(), requiredSigners);

View File

@ -16,8 +16,6 @@ import net.corda.core.identity.Party
import net.corda.core.transactions.TransactionBuilder
import net.corda.core.utilities.ProgressTracker
import com.template.TemplateContract.TEMPLATE_CONTRACT_ID
// Replace Initiator's definition with:
@InitiatingFlow
@StartableByRPC
@ -39,7 +37,7 @@ class IOUFlow(val iouValue: Int,
// We create a transaction builder and add the components.
val txBuilder = TransactionBuilder(notary = notary)
.addOutputState(outputState, TEMPLATE_CONTRACT_ID)
.addOutputState(outputState, TemplateContract.ID)
.addCommand(cmd)
// We sign the transaction.

View File

@ -8,10 +8,11 @@ import net.corda.core.transactions.LedgerTransaction
// Add these imports:
import net.corda.core.contracts.*
// Replace IOUContract's contract ID and definition with:
const val IOU_CONTRACT_ID = "com.template.IOUContract"
class IOUContract : Contract {
companion object {
const val ID = "com.template.IOUContract"
}
// Our Create command.
class Create : CommandData

View File

@ -36,7 +36,7 @@ class IOUFlow(val iouValue: Int,
// We create the transaction components.
val outputState = IOUState(iouValue, ourIdentity, otherParty)
val outputContractAndState = StateAndContract(outputState, IOU_CONTRACT_ID)
val outputContractAndState = StateAndContract(outputState, IOUContract.ID)
val cmd = Command(IOUContract.Create(), listOf(ourIdentity.owningKey, otherParty.owningKey))
// We add the items to the builder.

View File

@ -3,6 +3,7 @@ package net.corda.docs
import net.corda.core.internal.toPath
import net.corda.node.services.config.ConfigHelper
import net.corda.node.services.config.parseAsNodeConfiguration
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import java.nio.file.Path
import java.nio.file.Paths
@ -27,14 +28,9 @@ class ExampleConfigTest {
@Test
fun `example node_confs parses fine`() {
readAndCheckConfigurations(
"example-node.conf"
) {
readAndCheckConfigurations("example-node.conf") {
val baseDirectory = Paths.get("some-example-base-dir")
ConfigHelper.loadConfig(
baseDirectory = baseDirectory,
configFile = it
).parseAsNodeConfiguration()
assertThat(ConfigHelper.loadConfig(baseDirectory = baseDirectory, configFile = it).parseAsNodeConfiguration().isValid).isTrue()
}
}
}