mirror of
https://github.com/corda/corda.git
synced 2025-06-21 16:49:45 +00:00
CORDA-939 - Don't expose StartedNode and AbstractNode as part of public test api (#2472)
* Don't expose StartedNode via Node Driver * Dont expose StartedNode/Abstract Node via MockNetwork * Remove internal var from constructor as it doesn't hide from public api and change to internal initialisation method * Update api * Rename MockNode to StartedMockNode to avoid confusion Update documentation Update api-current.txt * Fix typo * Fix test failure * Modify flow tests to use internal mock network and remove additional internal exposures from StartedMockNode * Fix api-current * Change InProcess and OutOfProcess to interfaces * Explicitly declare MockNetwork parameters Dont expose StateMachineManager Move affected tests to use internal mock network * Fix api-current * Changes requested via review * Fix IRS Demo address * Fix api * Remove internal attribute from classes in internal package * Remove accidentally added code * Move useHttps into NodeHandleInternal * Remove duplicated code * Update api-current * Make webAddress internal on NodeHandle * Make sure parameters in public api are explicitly specified * Use correct address in IRS Demo * Get webaddress from webserver handle * Update api-current
This commit is contained in:
@ -6,22 +6,15 @@ import static java.util.Collections.emptyList;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MockNodeFactoryInJavaTest {
|
||||
private static class CustomNode extends MockNetwork.MockNode {
|
||||
private CustomNode(@NotNull MockNodeArgs args) {
|
||||
super(args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does not need to run, only compile.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static void factoryIsEasyToPassInUsingJava() {
|
||||
//noinspection Convert2MethodRef
|
||||
new MockNetwork(emptyList(), new MockNetworkParameters().setDefaultFactory(args -> new CustomNode(args)));
|
||||
new MockNetwork(emptyList(), new MockNetworkParameters().setDefaultFactory(CustomNode::new));
|
||||
new MockNetwork(emptyList());
|
||||
new MockNetwork(emptyList(), new MockNetworkParameters().setInitialiseSerialization(false));
|
||||
//noinspection Convert2MethodRef
|
||||
new MockNetwork(emptyList()).createNode(new MockNodeParameters(), args -> new CustomNode(args));
|
||||
new MockNetwork(emptyList()).createNode(new MockNodeParameters(), CustomNode::new);
|
||||
new MockNetwork(emptyList()).createNode(new MockNodeParameters());
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
package net.corda.testing.node
|
||||
package net.corda.testing.node.internal
|
||||
|
||||
import net.corda.core.serialization.internal.effectiveSerializationEnv
|
||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||
import org.junit.Test
|
||||
|
||||
class MockNetworkTests {
|
||||
class InternalMockNetworkTests {
|
||||
@Test
|
||||
fun `does not leak serialization env if init fails`() {
|
||||
val e = Exception("didn't work")
|
||||
assertThatThrownBy {
|
||||
object : MockNetwork(emptyList(), initialiseSerialization = true) {
|
||||
object : InternalMockNetwork(emptyList(), initialiseSerialization = true) {
|
||||
override fun createNotaries() = throw e
|
||||
}
|
||||
}.isSameAs(e)
|
||||
assertThatThrownBy { effectiveSerializationEnv }.isInstanceOf(IllegalStateException::class.java)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user