From b8538d5eb786debffc67b44fc9241684b01e8705 Mon Sep 17 00:00:00 2001 From: Christian Sailer Date: Fri, 13 Oct 2017 14:43:33 +0100 Subject: [PATCH 1/4] Fix file resource for non-unix filesystems. --- .../net/corda/signing/configuration/ConfigurationTest.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/signing-server/src/test/kotlin/net/corda/signing/configuration/ConfigurationTest.kt b/signing-server/src/test/kotlin/net/corda/signing/configuration/ConfigurationTest.kt index 57b9ee613b..514715037e 100644 --- a/signing-server/src/test/kotlin/net/corda/signing/configuration/ConfigurationTest.kt +++ b/signing-server/src/test/kotlin/net/corda/signing/configuration/ConfigurationTest.kt @@ -3,12 +3,13 @@ package net.corda.signing.configuration import com.typesafe.config.ConfigException import net.corda.signing.authentication.AuthMode import org.junit.Test +import java.io.File import kotlin.test.assertEquals import kotlin.test.assertFailsWith class ConfigurationTest { - private val validConfigPath = javaClass.getResource("/signing_service.conf").path - private val invalidConfigPath = javaClass.getResource("/signing_service_fail.conf").path + private val validConfigPath = File(javaClass.getResource("/signing_service.conf").path).absolutePath + private val invalidConfigPath = File(javaClass.getResource("/signing_service_fail.conf").path).absolutePath @Test fun `authMode is parsed correctly`() { From 8549a77a7624bb4a35acc34b5ec39fdac293b311 Mon Sep 17 00:00:00 2001 From: Christian Sailer Date: Fri, 13 Oct 2017 16:31:44 +0100 Subject: [PATCH 2/4] Use system tmp dir instead of hardcoding unix path --- .../src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt b/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt index 329eb22b8e..0aa04f5c29 100644 --- a/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt +++ b/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt @@ -44,7 +44,7 @@ class EnclaveletTest { val cashContract = MockContractAttachment(interpreter.services.cordappProvider.getContractAttachmentID(Cash.PROGRAM_ID)!!, Cash.PROGRAM_ID) val req = TransactionVerificationRequest(wtx3.serialize(), arrayOf(wtx1.serialize(), wtx2.serialize()), arrayOf(cashContract.serialize().bytes)) val serialized = req.serialize() - Files.write(Paths.get("/tmp/req"), serialized.bytes) + Files.write(Paths.get(System.getProperty("java.io.tmpdir"), "req"), serialized.bytes) verifyInEnclave(serialized.bytes) } } From ead805fb218b766035f4c05c84ec2954ad5ca857 Mon Sep 17 00:00:00 2001 From: Christian Sailer Date: Mon, 16 Oct 2017 14:32:16 +0100 Subject: [PATCH 3/4] Make it handle whitespace in paths correctly (needs to be URL decoded) --- .../com/r3/corda/signing/configuration/ConfigurationTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt b/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt index 979033a086..385049b23b 100644 --- a/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt +++ b/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt @@ -8,8 +8,8 @@ import kotlin.test.assertEquals import kotlin.test.assertFailsWith class ConfigurationTest { - private val validConfigPath = File(javaClass.getResource("/signing_service.conf").path).absolutePath - private val invalidConfigPath = File(javaClass.getResource("/signing_service_fail.conf").path).absolutePath + private val validConfigPath = File(java.net.URLDecoder.decode(javaClass.getResource("/signing_service.conf").path, "UTF-8")).absolutePath + private val invalidConfigPath = File(java.net.URLDecoder.decode(javaClass.getResource("/signing_service_fail.conf").path, "UTF-8")).absolutePath @Test fun `authMode is parsed correctly`() { From d8462ad6628410b832c72e638bf3a0c29fec4bda Mon Sep 17 00:00:00 2001 From: Christian Sailer Date: Mon, 16 Oct 2017 14:36:43 +0100 Subject: [PATCH 4/4] Make it handle whitespace in paths correctly - even better by using toURI() --- .idea/compiler.xml | 3 +++ .../com/r3/corda/signing/configuration/ConfigurationTest.kt | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 25abc91c93..1d5e5c9c1f 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -99,6 +99,9 @@ + + + diff --git a/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt b/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt index 385049b23b..7883e13ba7 100644 --- a/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt +++ b/signing-server/src/test/kotlin/com/r3/corda/signing/configuration/ConfigurationTest.kt @@ -8,8 +8,8 @@ import kotlin.test.assertEquals import kotlin.test.assertFailsWith class ConfigurationTest { - private val validConfigPath = File(java.net.URLDecoder.decode(javaClass.getResource("/signing_service.conf").path, "UTF-8")).absolutePath - private val invalidConfigPath = File(java.net.URLDecoder.decode(javaClass.getResource("/signing_service_fail.conf").path, "UTF-8")).absolutePath + private val validConfigPath = File(javaClass.getResource("/signing_service.conf").toURI()).absolutePath + private val invalidConfigPath = File(javaClass.getResource("/signing_service_fail.conf").toURI()).absolutePath @Test fun `authMode is parsed correctly`() {