diff --git a/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java b/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java index 89fc874e1b..3f2f2ec680 100644 --- a/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java +++ b/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java @@ -13,6 +13,7 @@ import net.corda.node.internal.NodeWithInfo; import net.corda.testing.internal.InternalTestUtilsKt; import net.corda.testing.node.User; import net.corda.testing.node.internal.NodeBasedTest; +import net.corda.testing.node.internal.TestCordappInternal; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -30,10 +31,18 @@ import static net.corda.node.services.Permissions.invokeRpc; import static net.corda.node.services.Permissions.startFlow; import static net.corda.testing.core.TestConstants.ALICE_NAME; import static net.corda.testing.core.TestConstants.DUMMY_NOTARY_NAME; +import static net.corda.testing.node.internal.InternalTestUtilsKt.FINANCE_CORDAPPS; +import static net.corda.testing.node.internal.InternalTestUtilsKt.cordappWithPackages; public class CordaRPCJavaClientTest extends NodeBasedTest { public CordaRPCJavaClientTest() { - super(Arrays.asList("net.corda.finance.contracts", CashSchemaV1.class.getPackage().getName()), Collections.singletonList(DUMMY_NOTARY_NAME)); + super(cordapps(), Collections.singletonList(DUMMY_NOTARY_NAME)); + } + + private static Set cordapps() { + Set cordapps = new HashSet<>(FINANCE_CORDAPPS); + cordapps.add(cordappWithPackages(CashSchemaV1.class.getPackage().getName())); + return cordapps; } private List perms = Arrays.asList( diff --git a/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/CordaRPCClientTest.kt b/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/CordaRPCClientTest.kt index 59f05cb8e2..1ebd6f29b5 100644 --- a/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/CordaRPCClientTest.kt +++ b/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/CordaRPCClientTest.kt @@ -40,6 +40,7 @@ import net.corda.testing.core.expect import net.corda.testing.core.expectEvents import net.corda.testing.core.sequence import net.corda.testing.node.User +import net.corda.testing.node.internal.FINANCE_CORDAPPS import net.corda.testing.node.internal.NodeBasedTest import net.corda.testing.node.internal.ProcessUtilities import net.corda.testing.node.internal.poll @@ -62,7 +63,7 @@ import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue -class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance"), notaries = listOf(DUMMY_NOTARY_NAME)) { +class CordaRPCClientTest : NodeBasedTest(FINANCE_CORDAPPS, notaries = listOf(DUMMY_NOTARY_NAME)) { companion object { val rpcUser = User("user1", "test", permissions = setOf(all())) val log = contextLogger() diff --git a/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/FlowsExecutionModeRpcTest.kt b/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/FlowsExecutionModeRpcTest.kt index 8084484735..22b11cee50 100644 --- a/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/FlowsExecutionModeRpcTest.kt +++ b/client/rpc/src/integration-test/kotlin/net/corda/client/rpc/FlowsExecutionModeRpcTest.kt @@ -2,9 +2,7 @@ package net.corda.client.rpc import net.corda.core.context.Actor import net.corda.core.context.Trace -import net.corda.core.internal.packageName import net.corda.core.messaging.CordaRPCOps -import net.corda.finance.schemas.CashSchemaV1 import net.corda.node.internal.NodeWithInfo import net.corda.node.services.Permissions import net.corda.testing.core.ALICE_NAME @@ -14,7 +12,7 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test -class FlowsExecutionModeTests : NodeBasedTest(emptyList()) { +class FlowsExecutionModeTests : NodeBasedTest() { private val rpcUser = User("user1", "test", permissions = setOf(Permissions.all())) private lateinit var node: NodeWithInfo diff --git a/node/src/integration-test/kotlin/net/corda/node/AuthDBTests.kt b/node/src/integration-test/kotlin/net/corda/node/AuthDBTests.kt index 70293b6074..e2795b83b3 100644 --- a/node/src/integration-test/kotlin/net/corda/node/AuthDBTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/AuthDBTests.kt @@ -15,6 +15,7 @@ import net.corda.node.services.Permissions import net.corda.node.services.config.PasswordEncryption import net.corda.testing.core.ALICE_NAME import net.corda.testing.node.internal.NodeBasedTest +import net.corda.testing.node.internal.cordappForClasses import org.apache.activemq.artemis.api.core.ActiveMQSecurityException import org.apache.shiro.authc.credential.DefaultPasswordService import org.junit.After @@ -32,7 +33,7 @@ import kotlin.test.assertFailsWith * check authentication/authorization of RPC connections. */ @RunWith(Parameterized::class) -class AuthDBTests : NodeBasedTest() { +class AuthDBTests : NodeBasedTest(cordappPackages = CORDAPPS) { private lateinit var node: NodeWithInfo private lateinit var client: CordaRPCClient private lateinit var db: UsersDB @@ -43,6 +44,9 @@ class AuthDBTests : NodeBasedTest() { @JvmStatic @Parameterized.Parameters(name = "password encryption format = {0}") fun encFormats() = arrayOf(PasswordEncryption.NONE, PasswordEncryption.SHIRO_1_CRYPT) + + @Suppress("SpreadOperator") + private val CORDAPPS = setOf(cordappForClasses(*AuthDBTests::class.nestedClasses.map { it.java }.toTypedArray())) } @Suppress("MemberVisibilityCanBePrivate") diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/NodeBasedTest.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/NodeBasedTest.kt index 662766665b..e24c82e982 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/NodeBasedTest.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/NodeBasedTest.kt @@ -39,9 +39,10 @@ import kotlin.test.assertFalse // TODO Some of the logic here duplicates what's in the driver - the reason why it's not straightforward to replace it by // using DriverDSLImpl in `init()` and `stopAllNodes()` is because of the platform version passed to nodes (driver doesn't // support this, and it's a property of the Corda JAR) -abstract class NodeBasedTest -@JvmOverloads -constructor(private val cordappPackages: List = emptyList(), private val notaries: List = emptyList()) { +abstract class NodeBasedTest @JvmOverloads constructor( + private val cordappPackages: Set = emptySet(), + private val notaries: List = emptyList() +) { companion object { private val WHITESPACE = "\\s++".toRegex() } @@ -120,7 +121,11 @@ constructor(private val cordappPackages: List = emptyList(), private val ) + configOverrides ) - val customCordapps = cordappsForPackages(getCallerPackage(NodeBasedTest::class)?.let { cordappPackages + it } ?: cordappPackages) + val customCordapps = if (cordappPackages.isNotEmpty()) { + cordappPackages + } else { + cordappsForPackages(getCallerPackage(NodeBasedTest::class)?.let { listOf(it) } ?: emptyList()) + } TestCordappInternal.installCordapps(baseDirectory, emptySet(), customCordapps) val parsedConfig = config.parseAsNodeConfiguration().value()