CORE-15541: release ga builds prep (#61)
* CORE-15561: Use Beta versions of the CSDE gradle plugin (#58) * CORE-15572: deleted stale todo comment (#59) * CORE-15541: release ga-rc12 prep * CORE:15541: update combined worker version to RC12 * CORE-15541: release ga build prep --------- Co-authored-by: Tony Lawson <tony.lawson@r3.com>
This commit is contained in:
parent
bb380544d6
commit
15f1043a39
17
build.gradle
17
build.gradle
@ -32,7 +32,6 @@ allprojects {
|
||||
cordaDbContainerName = "CSDEpostgresql"
|
||||
cordaBinDir = "${System.getProperty("user.home")}/.corda/corda5"
|
||||
cordaCliBinDir = "${System.getProperty("user.home")}/.corda/cli"
|
||||
cpiUploadTimeout = cpiUploadDefault
|
||||
}
|
||||
|
||||
// Declare the set of Java compiler options we need to build a CorDapp.
|
||||
@ -47,22 +46,6 @@ allprojects {
|
||||
// All dependencies are held in Maven Central
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
// R3 Internal repositories for dev
|
||||
// Repository provides Corda 5 binaries that implement Corda-API.
|
||||
// These will be made publicly available.
|
||||
// Final location to be decided.
|
||||
// Repository subject to change
|
||||
maven {
|
||||
url = "$artifactoryContextUrl/corda-os-maven"
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
credentials {
|
||||
username = findProperty('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME')
|
||||
password = findProperty('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
|
@ -1,38 +1,32 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIGsDCCBJigAwIBAgIQCK1AsmDSnEyfXs2pvZOu2TANBgkqhkiG9w0BAQwFADBi
|
||||
MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi
|
||||
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNl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q6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+
|
||||
-----END CERTIFICATE-----
|
||||
|
@ -39,23 +39,16 @@ dependencies {
|
||||
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
||||
cordaProvided 'org.slf4j:slf4j-api'
|
||||
|
||||
// This are shared so should be here.
|
||||
// Dependencies Required By Test Tooling
|
||||
// Todo: these are commented out as the simulator UTXO work has not been merged into Gecko yet.
|
||||
// testImplementation "net.corda:corda-simulator-api:$simulatorVersion"
|
||||
// testRuntimeOnly "net.corda:corda-simulator-runtime:$simulatorVersion"
|
||||
|
||||
// 3rd party libraries
|
||||
// Required
|
||||
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||
|
||||
// Optional but used by exmaple tests.
|
||||
// Optional but used by example tests.
|
||||
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
|
||||
testImplementation "com.r3.corda.ledger.utxo:contract-testing:$contractTestingVersion"
|
||||
}
|
||||
|
||||
// The CordApp section.
|
||||
|
@ -1,158 +0,0 @@
|
||||
package com.r3.developers.csdetemplate.utxoexample.contracts;
|
||||
|
||||
import com.r3.corda.ledger.utxo.testing.ContractTest;
|
||||
import com.r3.developers.csdetemplate.utxoexample.states.ChatState;
|
||||
import net.corda.v5.ledger.utxo.Command;
|
||||
import net.corda.v5.ledger.utxo.StateAndRef;
|
||||
import net.corda.v5.ledger.utxo.transaction.UtxoSignedTransaction;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.*;
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class ChatContractCreateCommandTest extends ContractTest {
|
||||
|
||||
protected ChatState outputChatState = new ChatState(
|
||||
UUID.randomUUID(),
|
||||
"aliceChatName",
|
||||
aliceName,
|
||||
"aliceChatMessage",
|
||||
List.of(aliceKey, bobKey)
|
||||
);
|
||||
|
||||
@Test
|
||||
public void happyPath() {
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.addSignatories(outputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertVerifies(transaction);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingCommand() {
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + REQUIRE_SINGLE_COMMAND);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotAcceptUnknownCommand() {
|
||||
class MyDummyCommand implements Command {
|
||||
}
|
||||
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new MyDummyCommand())
|
||||
.addSignatories(outputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
|
||||
assertFailsWith(transaction, UNKNOWN_COMMAND);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateCannotHaveZeroParticipants() {
|
||||
ChatState state = new ChatState(
|
||||
UUID.randomUUID(),
|
||||
"myChatName",
|
||||
aliceName,
|
||||
"myChatMessage",
|
||||
emptyList()
|
||||
);
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(state)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateCannotHaveOneParticipant() {
|
||||
ChatState state = new ChatState(
|
||||
UUID.randomUUID(),
|
||||
"myChatName",
|
||||
aliceName,
|
||||
"myChatMessage",
|
||||
List.of(aliceKey)
|
||||
);
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(state)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateCannotHaveThreeParticipants() {
|
||||
ChatState state = new ChatState(
|
||||
UUID.randomUUID(),
|
||||
"myChatName",
|
||||
aliceName,
|
||||
"myChatMessage",
|
||||
List.of(aliceKey, bobKey, charlieKey)
|
||||
);
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(state)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateMustBeSigned() {
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateCannotBeSignedByOnlyOneParticipant() {
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.addSignatories(outputChatState.participants.get(0))
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotIncludeInputState() {
|
||||
happyPath(); // generate an existing state to search for
|
||||
StateAndRef<ChatState> existingState = getLedgerService().findUnconsumedStatesByType(ChatState.class).get(0); // doesn't matter which as this will fail validation
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.addSignatories(outputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + CREATE_COMMAND_SHOULD_HAVE_NO_INPUT_STATES);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveTwoOutputStates() {
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.addSignatories(outputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + CREATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE);
|
||||
}
|
||||
}
|
@ -1,175 +0,0 @@
|
||||
package com.r3.developers.csdetemplate.utxoexample.contracts;
|
||||
|
||||
import com.r3.corda.ledger.utxo.testing.ContractTest;
|
||||
import com.r3.developers.csdetemplate.utxoexample.states.ChatState;
|
||||
import net.corda.v5.ledger.utxo.StateAndRef;
|
||||
import net.corda.v5.ledger.utxo.transaction.UtxoSignedTransaction;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.*;
|
||||
|
||||
public class ChatContractUpdateCommandTest extends ContractTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private StateAndRef<ChatState> createInitialChatState() {
|
||||
ChatState outputChatState = new ChatContractCreateCommandTest().outputChatState;
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(outputChatState)
|
||||
.addCommand(new ChatContract.Create())
|
||||
.addSignatories(outputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
transaction.toLedgerTransaction();
|
||||
return (StateAndRef<ChatState>) transaction.getOutputStateAndRefs().get(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void happyPath() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState updatedOutputChatState = existingState.getState().getContractState().updateMessage(bobName, "bobResponse");
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertVerifies(transaction);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveNoInputState() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState updatedOutputChatState = existingState.getState().getContractState().updateMessage(bobName, "bobResponse");
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveTwoInputStates() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState updatedOutputChatState = existingState.getState().getContractState().updateMessage(bobName, "bobResponse");
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveTwoOutputStates() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState updatedOutputChatState = existingState.getState().getContractState().updateMessage(bobName, "bobResponse");
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void idShouldNotChange() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState esDetails = existingState.getState().getContractState();
|
||||
ChatState updatedOutputChatState = new ChatState(
|
||||
UUID.randomUUID(),
|
||||
esDetails.getChatName(),
|
||||
bobName,
|
||||
"bobResponse",
|
||||
esDetails.getParticipants()
|
||||
);
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + UPDATE_COMMAND_ID_SHOULD_NOT_CHANGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void chatNameShouldNotChange() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState esDetails = existingState.getState().getContractState();
|
||||
ChatState updatedOutputChatState = new ChatState(
|
||||
esDetails.getId(),
|
||||
"newName",
|
||||
bobName,
|
||||
"bobResponse",
|
||||
esDetails.getParticipants()
|
||||
);
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + UPDATE_COMMAND_CHATNAME_SHOULD_NOT_CHANGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void participantsShouldNotChange() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState esDetails = existingState.getState().getContractState();
|
||||
ChatState updatedOutputChatState = new ChatState(
|
||||
esDetails.getId(),
|
||||
esDetails.getChatName(),
|
||||
bobName,
|
||||
"bobResponse",
|
||||
List.of(bobKey, charlieKey)
|
||||
);
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants)
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + UPDATE_COMMAND_PARTICIPANTS_SHOULD_NOT_CHANGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateMustBeSigned() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState updatedOutputChatState = existingState.getState().getContractState().updateMessage(bobName, "bobResponse");
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputStateCannotBeSignedByOnlyOneParticipant() {
|
||||
StateAndRef<ChatState> existingState = createInitialChatState();
|
||||
ChatState updatedOutputChatState = existingState.getState().getContractState().updateMessage(bobName, "bobResponse");
|
||||
UtxoSignedTransaction transaction = getLedgerService()
|
||||
.createTransactionBuilder()
|
||||
.addInputState(existingState.getRef())
|
||||
.addOutputState(updatedOutputChatState)
|
||||
.addCommand(new ChatContract.Update())
|
||||
.addSignatories(updatedOutputChatState.participants.get(0))
|
||||
.toSignedTransaction();
|
||||
assertFailsWith(transaction, "Failed requirement: " + TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS);
|
||||
}
|
||||
}
|
@ -2,20 +2,20 @@ kotlin.code.style=official
|
||||
|
||||
# Specify the version of the Corda-API to use.
|
||||
# This needs to match the version supported by the Corda Cluster the CorDapp will run on.
|
||||
cordaApiVersion=5.0.0.763-Iguana1.0
|
||||
cordaApiVersion=5.0.0.765
|
||||
|
||||
# Specify the version of the notary plugins to use.
|
||||
# Currently packaged as part of corda-runtime-os, so should be set to a corda-runtime-os version.
|
||||
cordaNotaryPluginsVersion=5.0.0.0-Iguana1.0
|
||||
cordaNotaryPluginsVersion=5.0.0.0
|
||||
|
||||
# Specify the version of the Combined Worker to use
|
||||
combinedWorkerJarVersion=5.0.0.0-Iguana1.0
|
||||
combinedWorkerJarVersion=5.0.0.0
|
||||
|
||||
# Specify the version of the cordapp-cpb and cordapp-cpk plugins
|
||||
cordaPluginsVersion=7.0.3
|
||||
|
||||
# Specify the version of the CSDE gradle plugin to use
|
||||
csdePluginVersion=1.2.0-alpha-+
|
||||
csdePluginVersion=1.1.0
|
||||
|
||||
# Specify the name of the workflows module
|
||||
workflowsModule=workflows
|
||||
@ -35,13 +35,3 @@ junitVersion = 5.8.2
|
||||
mockitoKotlinVersion=4.0.0
|
||||
mockitoVersion=4.6.1
|
||||
hamcrestVersion=2.2
|
||||
contractTestingVersion=0.9.0-beta-+
|
||||
|
||||
# Specify the maximum amount of time allowed for the CPI upload
|
||||
# As your CorDapp grows you might need to increase this
|
||||
# Value is in milliseconds
|
||||
cpiUploadDefault=10000
|
||||
|
||||
# R3 internal repository
|
||||
# Use this version when pointing to artefacts in artifactory that have not been published to S3
|
||||
artifactoryContextUrl=https://software.r3.com/artifactory
|
||||
|
@ -4,16 +4,6 @@ pluginManagement {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven {
|
||||
url = "$artifactoryContextUrl/corda-os-maven"
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
credentials {
|
||||
username = settings.ext.find('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME')
|
||||
password = settings.ext.find('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The plugin dependencies with versions of the plugins congruent with the specified CorDapp plugin version,
|
||||
|
@ -40,12 +40,6 @@ dependencies {
|
||||
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
||||
cordaProvided 'org.slf4j:slf4j-api'
|
||||
|
||||
// This are shared so should be here.
|
||||
// Dependencies Required By Test Tooling
|
||||
// Todo: these are commented out as the simulator UTXO work has not been merged into Gecko yet.
|
||||
// testImplementation "net.corda:corda-simulator-api:$simulatorVersion"
|
||||
// testRuntimeOnly "net.corda:corda-simulator-runtime:$simulatorVersion"
|
||||
|
||||
// 3rd party libraries
|
||||
// Required
|
||||
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user