Skip to content

Commit

Permalink
resolves #26 optimised test case for upload
Browse files Browse the repository at this point in the history
  • Loading branch information
parthbond180 committed Nov 17, 2021
1 parent ba66c52 commit 90499b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ClientNodeStateImpl : CordaNodeStateInner, CordaptorComponent, CordaNodeVa
}

override fun createAttachment(attachment: CordaNodeAttachment): SecureHash {
val zipName = "$attachment.filename-${UUID.randomUUID()}.zip"
val zipName = "${attachment.filename}-${UUID.randomUUID()}.zip"
FileOutputStream(zipName).use { fileOutputStream ->
ZipOutputStream(fileOutputStream).use { zipOutputStream ->
val zipEntry = ZipEntry(attachment.filename)
Expand Down Expand Up @@ -159,7 +159,7 @@ class RPCFlowInitiator<ReturnType: Any> : FlowInitiator<ReturnType>(), Cordaptor
val flowClass = instruction.flowClass.java
logger.debug("Preparing to initiate flow {} over Corda RPC connection", flowClass)

val typeInfo: LocalTypeInformation = localTypeModel.inspect(flowClass);
val typeInfo: LocalTypeInformation = localTypeModel.inspect(flowClass)

val constructorParameters = when (typeInfo){
is LocalTypeInformation.Composable -> (typeInfo as? LocalTypeInformation.Composable)?.constructor?.parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CordaNodeStateImpl : CordaNodeStateInner, CordaptorComponent, CordaNodeVau
}

override fun createAttachment(attachment: CordaNodeAttachment): SecureHash {
val zipName = "$attachment.filename-${UUID.randomUUID()}.zip"
val zipName = "${attachment.filename}-${UUID.randomUUID()}.zip"
FileOutputStream(zipName).use { fileOutputStream ->
ZipOutputStream(fileOutputStream).use { zipOutputStream ->
val zipEntry = ZipEntry(attachment.filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.eclipse.jetty.client.util.MultiPartContentProvider
import org.eclipse.jetty.client.util.PathContentProvider
import org.eclipse.jetty.client.util.StringContentProvider
import org.eclipse.jetty.http.HttpHeader
import org.junit.jupiter.api.assertDoesNotThrow
import tech.b180.ref_cordapp.DelayedProgressFlow
import tech.b180.ref_cordapp.SimpleFlow
import java.io.StringReader
Expand Down Expand Up @@ -231,8 +232,9 @@ class CordaptorAPITestSuite(
req.content(multiPartContentProvider)
val response = req.send()

assertEquals(HttpServletResponse.SC_OK, response.status)
assertEquals("application/json", response.mediaType)
assertEquals(HttpServletResponse.SC_ACCEPTED, response.status)
assertDoesNotThrow { SecureHash.parse(response.contentAsString) }

/*val page = response.contentAsString.asJsonObject()
assertEquals(1, page.getInt("totalStatesAvailable"))*/
Expand Down

0 comments on commit 90499b2

Please sign in to comment.