SQL Azure and SQL Server database integration tests (#115)

* Integration test are parameterised (extends IntegrationTest) to run against a remote database with 4 db scripts run @BeforeClass, @Before, @After and @AfterClass.
* SQL script for SQL Azure and SQL Server databases and templates of JDBC configuration.
This commit is contained in:
szymonsztuka
2017-12-01 17:17:51 +00:00
committed by GitHub
parent d81e4809bb
commit 709b3791a3
50 changed files with 606 additions and 105 deletions

View File

@ -27,6 +27,9 @@ sourceSets {
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources {
srcDir file('../../testing/test-utils/src/main/resources')
}
}
smokeTest {
kotlin {

View File

@ -12,9 +12,12 @@ import net.corda.node.internal.Node;
import net.corda.node.internal.StartedNode;
import net.corda.nodeapi.User;
import net.corda.testing.CoreTestUtils;
import net.corda.testing.IntegrationTestKt;
import net.corda.testing.IntegrationTestSchemas;
import net.corda.testing.internal.NodeBasedTest;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import java.io.IOException;
@ -29,12 +32,17 @@ import static net.corda.finance.contracts.GetBalances.getCashBalance;
import static net.corda.node.services.Permissions.invokeRpc;
import static net.corda.node.services.Permissions.startFlow;
import static net.corda.testing.TestConstants.getALICE;
import static net.corda.testing.TestConstants.getDUMMY_NOTARY;
public class CordaRPCJavaClientTest extends NodeBasedTest {
public CordaRPCJavaClientTest() {
super(Arrays.asList("net.corda.finance.contracts", CashSchemaV1.class.getPackage().getName()));
}
@ClassRule
public static IntegrationTestSchemas databaseSchemas = new IntegrationTestSchemas(IntegrationTestKt.toDatabaseSchemaName(getALICE()),
IntegrationTestKt.toDatabaseSchemaName(getDUMMY_NOTARY()));
private List<String> perms = Arrays.asList(
startFlow(CashPaymentFlow.class),
startFlow(CashIssueFlow.class),

View File

@ -7,15 +7,18 @@ import net.corda.core.flows.StartableByRPC
import net.corda.core.messaging.startFlow
import net.corda.core.serialization.CordaSerializable
import net.corda.core.utilities.getOrThrow
import net.corda.testing.ALICE
import net.corda.testing.IntegrationTest
import net.corda.testing.*
import net.corda.testing.driver.driver
import org.assertj.core.api.Assertions.assertThatExceptionOfType
import org.junit.ClassRule
import org.junit.Test
class BlacklistKotlinClosureTest : IntegrationTest() {
companion object {
const val EVIL: Long = 666
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(ALICE.toDatabaseSchemaName(), DUMMY_NOTARY.toDatabaseSchemaName())
}
@StartableByRPC

View File

@ -28,6 +28,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatExceptionOfType
import org.junit.After
import org.junit.Before
import org.junit.ClassRule
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
@ -49,6 +50,10 @@ class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance.contracts", C
private fun login(username: String, password: String, externalTrace: Trace? = null, impersonatedActor: Actor? = null) {
connection = client.start(username, password, externalTrace, impersonatedActor)
}
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(ALICE.toDatabaseSchemaName())
}
@Before
override fun setUp() {

View File

@ -12,14 +12,14 @@ import net.corda.core.serialization.serialize
import net.corda.core.utilities.*
import net.corda.node.services.messaging.RPCServerConfiguration
import net.corda.nodeapi.RPCApi
import net.corda.testing.SerializationEnvironmentRule
import net.corda.testing.IntegrationTest
import net.corda.testing.*
import net.corda.testing.driver.poll
import net.corda.testing.internal.*
import org.apache.activemq.artemis.api.core.SimpleString
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import rx.Observable
@ -39,6 +39,12 @@ class RPCStabilityTests : IntegrationTest() {
pool.shutdown()
}
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE, BOB, DUMMY_BANK_A)
.map { it.toDatabaseSchemaNames("","_10000","_10003","_10012") }.flatten().toTypedArray())
}
object DummyOps : RPCOps {
override val protocolVersion = 0
}