Skip to content

Commit

Permalink
Upgraded to corda 4.1/Gradle 4.10.2 and switched AttachmentReceipt#da…
Browse files Browse the repository at this point in the history
…te from java.time.LocalDateTime to java.util.Date to work around corda/corda#5298
  • Loading branch information
manosbatsis committed Jul 27, 2019
1 parent ec75e5f commit 629e35d
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 15 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Expand Up @@ -6,7 +6,7 @@ buildscript {
dokka_version = '0.9.17'

corda_release_group = 'net.corda'
corda_release_version = '4.0'
corda_release_version = '4.1'
corda_gradle_plugins_version = '4.0.45'
corda_solutions_version = '2.0'

Expand Down Expand Up @@ -105,9 +105,11 @@ allprojects {
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
// Corda BNMS
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-solutions-releases'}
// Gradle tooling API
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}

version = "0.26-SNAPSHOT"
version = "0.26"
group = 'com.github.manosbatsis.corbeans'
apply from: "$rootDir/gradle/published.gradle"
apply plugin: 'project-report'
Expand Down
Expand Up @@ -191,8 +191,6 @@ class CorbeansSpringExtensionIntegrationTest {
@Test
@Throws(Exception::class)
fun `Can save and retrieve regular files as attachments`() {
val headers = HttpHeaders()
headers.contentType = MediaType.MULTIPART_FORM_DATA
// Upload a couple of files
var attachmentReceipt: JsonNode = uploadAttachmentFiles(
Pair("test.txt", "text/plain"),
Expand Down
Expand Up @@ -52,10 +52,10 @@ management.endpoints.web.exposure.include=*
# Logging
# ==================================
#debug=true
logging.level.root=info
logging.level.root=WARN
logging.level.com.github.manosbatsis.corbeans=debug
logging.level.org.apache.activemq=error
# logging.level.net.corda=INFO
# logging.level.org.apache.http=DEBUG
logging.level.org.springframework.web.servlet.handler=TRACE
logging.level.org.springframework.web.client.RestTemplate=DEBUG
#logging.level.org.springframework.web.servlet.handler=TRACE
#logging.level.org.springframework.web.client.RestTemplate=WARN
Expand Up @@ -59,7 +59,7 @@ class NodeParams {
@JvmStatic
fun mergeParams(partialParams: NodeParams, defaultParams: NodeParams): NodeParams {
val nodeParams = NodeParams()
nodeParams.testPartyName = partialParams.testPartyName ?: null
nodeParams.testPartyName = partialParams.testPartyName
nodeParams.username = partialParams.username ?: throw IllegalArgumentException("Node configuration is missing a username property")
nodeParams.password = partialParams.password ?: throw IllegalArgumentException("Node configuration is missing a password property")
nodeParams.address = partialParams.address ?: throw IllegalArgumentException("Node configuration is missing an address property")
Expand Down
Expand Up @@ -21,7 +21,7 @@ package com.github.manosbatsis.corbeans.spring.boot.corda.model.upload

import com.fasterxml.jackson.annotation.JsonFormat
import net.corda.core.serialization.CordaSerializable
import java.time.LocalDateTime
import java.util.*

/**
* Receipt of an attachment saved to the vault.
Expand All @@ -31,7 +31,7 @@ import java.time.LocalDateTime
data class AttachmentReceipt(
/** The datetime of attachment persistence to the vault */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy, HH:mm:ss", timezone = "UTC")
val date: LocalDateTime? = null,
val date: Date? = null,
/** The attachment [net.corda.core.crypto.SecureHash] string */
val hash: String,
/** The attached files */
Expand Down
Expand Up @@ -41,9 +41,13 @@ fun toAttachmentFiles(uploadedFiles: Array<MultipartFile>): List<AttachmentFile>
)
}

/** Converts the input [MultipartFile] to an [Attachment] */
fun toAttachment(uploadedFile: MultipartFile): Attachment =
toAttachment(toAttachmentFiles(arrayOf(uploadedFile)))

/** Converts the input [MultipartFile]s to an [Attachment] */
fun toAttachment(uploadedFiles: Array<MultipartFile>): Attachment =
toAttachment(toAttachmentFiles(uploadedFiles))
toAttachment(toAttachmentFiles(uploadedFiles))

/**
* Converts the input [AttachmentFile]s to an [Attachment].
Expand Down
Expand Up @@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory
import java.io.InputStream
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*


/**
Expand Down Expand Up @@ -161,7 +162,7 @@ open class CordaNodeServiceImpl(open val nodeRpcConnection: NodeRpcConnection):
}
// Return receipt
return AttachmentReceipt(
date = LocalDateTime.now(),
date = Date(),
hash = hash,
files = attachment.filenames,
author = this.myIdentity.name.organisation,
Expand Down
1 change: 0 additions & 1 deletion corbeans-spring-boot-starter-test/build.gradle
Expand Up @@ -25,5 +25,4 @@ dependencies {
compile "$corda_release_group:corda-node-driver:$corda_release_version"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-properties:$jackson_version"


}
1 change: 1 addition & 0 deletions docs/src/main/tut/docs/changelog.md
Expand Up @@ -11,6 +11,7 @@ and can be helpful with version upgrades.
## 0.26-SNAPSHOT

- Improved `UniqueIdentifierConverter` to properly handle externalIDs that contain an underscore.
- Upgraded to Corda 4.1 and Gradle (wrapper) 4.10.2.

## 0.25

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
#Thu Dec 27 15:01:35 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

0 comments on commit 629e35d

Please sign in to comment.