mirror of
https://github.com/corda/corda.git
synced 2025-06-20 08:03:53 +00:00
Merge remote-tracking branch 'open/master' into bogdan-merge-14
This commit is contained in:
@ -17,6 +17,7 @@ import org.apache.activemq.artemis.api.core.SimpleString
|
||||
import rx.Notification
|
||||
import rx.exceptions.OnErrorNotImplementedException
|
||||
import sun.security.x509.X509CertImpl
|
||||
import java.security.cert.CRLReason
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@ -72,6 +73,7 @@ object DefaultWhitelist : SerializationWhitelist {
|
||||
StackTraceElement::class.java,
|
||||
|
||||
// Implementation of X509Certificate.
|
||||
X509CertImpl::class.java
|
||||
X509CertImpl::class.java,
|
||||
CRLReason::class.java
|
||||
)
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ import com.typesafe.config.ConfigValueFactory
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||
import org.assertj.core.api.Assertions.*
|
||||
import org.junit.Test
|
||||
import java.net.URL
|
||||
import java.nio.file.Path
|
||||
@ -198,6 +197,14 @@ class ConfigParsingTest {
|
||||
assertThat(NullableData(null).toConfig()).isEqualTo(empty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `data class with checks`() {
|
||||
val config = config("positive" to -1)
|
||||
assertThatExceptionOfType(IllegalArgumentException::class.java)
|
||||
.isThrownBy { config.parseAs<PositiveData>() }
|
||||
.withMessageContaining("-1")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `old config property`() {
|
||||
assertThat(config("oldValue" to "old").parseAs<OldData>().newValue).isEqualTo("old")
|
||||
@ -301,6 +308,11 @@ class ConfigParsingTest {
|
||||
data class DataListData(val list: List<StringData>)
|
||||
data class DefaultData(val a: Int, val defaultOfTwo: Int = 2)
|
||||
data class NullableData(val nullable: String?)
|
||||
data class PositiveData(private val positive: Int) {
|
||||
init {
|
||||
require(positive > 0) { "$positive is not positive" }
|
||||
}
|
||||
}
|
||||
data class OldData(
|
||||
@OldConfig("oldValue")
|
||||
val newValue: String)
|
||||
|
Reference in New Issue
Block a user