mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
CORDA-939 Make SerializationEnvironmentRule.env private so as not to expose internals. (#2404)
* Make SerializationEnvironment private so as not to expose internals. * Only expose used parts of api * Make properties lateinit * Removing java calls to getEnv * Initialise properties at declaration * Tidy up imports
This commit is contained in:
parent
443afb3515
commit
70f1fdeb2b
@ -25,7 +25,7 @@ public final class ForbiddenLambdaSerializationTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
factory = testSerialization.getEnv().getSerializationFactory();
|
||||
factory = testSerialization.getSerializationFactory();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -25,7 +25,7 @@ public final class LambdaCheckpointSerializationTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
factory = testSerialization.getEnv().getSerializationFactory();
|
||||
factory = testSerialization.getSerializationFactory();
|
||||
context = new SerializationContextImpl(KryoSerializationSchemeKt.getKryoHeaderV0_1(), this.getClass().getClassLoader(), AllWhitelist.INSTANCE, Maps.newHashMap(), true, SerializationContext.UseCase.Checkpoint);
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,11 @@ class ContractAttachmentSerializerTest {
|
||||
private lateinit var context: SerializationContext
|
||||
private lateinit var contextWithToken: SerializationContext
|
||||
private val mockServices = MockServices(emptyList(), rigorousMock(), CordaX500Name("MegaCorp", "London", "GB"))
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
factory = testSerialization.env.serializationFactory
|
||||
context = testSerialization.env.checkpointContext
|
||||
factory = testSerialization.serializationFactory
|
||||
context = testSerialization.checkpointContext
|
||||
contextWithToken = context.withTokenContext(SerializeAsTokenContextImpl(Any(), factory, context, mockServices))
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ class SerializationTokenTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
factory = testSerialization.env.serializationFactory
|
||||
context = testSerialization.env.checkpointContext.withWhitelisted(SingletonSerializationToken::class.java)
|
||||
factory = testSerialization.serializationFactory
|
||||
context = testSerialization.checkpointContext.withWhitelisted(SingletonSerializationToken::class.java)
|
||||
}
|
||||
|
||||
// Large tokenizable object so we can tell from the smaller number of serialized bytes it was actually tokenized
|
||||
|
@ -1,10 +1,16 @@
|
||||
package net.corda.testing.core
|
||||
|
||||
import com.nhaarman.mockito_kotlin.*
|
||||
import com.nhaarman.mockito_kotlin.any
|
||||
import com.nhaarman.mockito_kotlin.doAnswer
|
||||
import com.nhaarman.mockito_kotlin.doNothing
|
||||
import com.nhaarman.mockito_kotlin.whenever
|
||||
import net.corda.client.rpc.internal.KryoClientSerializationScheme
|
||||
import net.corda.core.DoNotImplement
|
||||
import net.corda.core.internal.staticField
|
||||
import net.corda.core.serialization.internal.*
|
||||
import net.corda.core.serialization.internal.SerializationEnvironment
|
||||
import net.corda.core.serialization.internal.SerializationEnvironmentImpl
|
||||
import net.corda.core.serialization.internal._globalSerializationEnv
|
||||
import net.corda.core.serialization.internal.effectiveSerializationEnv
|
||||
import net.corda.node.serialization.KryoServerSerializationScheme
|
||||
import net.corda.nodeapi.internal.serialization.*
|
||||
import net.corda.nodeapi.internal.serialization.amqp.AMQPClientSerializationScheme
|
||||
@ -42,7 +48,10 @@ class SerializationEnvironmentRule(private val inheritable: Boolean = false) : T
|
||||
}
|
||||
}
|
||||
|
||||
lateinit var env: SerializationEnvironment
|
||||
private lateinit var env: SerializationEnvironment
|
||||
val serializationFactory get() = env.serializationFactory
|
||||
val checkpointContext get() = env.checkpointContext
|
||||
|
||||
override fun apply(base: Statement, description: Description): Statement {
|
||||
init(description.toString())
|
||||
return object : Statement() {
|
||||
|
Loading…
Reference in New Issue
Block a user