Database integration tests - added NotaryService schema to database setup. (#328)

* Added NotaryService schema to database setup for two integration tests.
* SQL Server setup scripts - create Login only if not preset (as it's done for Azure SQL).
This commit is contained in:
szymonsztuka 2018-01-10 10:56:55 +00:00 committed by GitHub
parent c7487a8696
commit 1e2cc3e2df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -14,6 +14,7 @@ import net.corda.testing.common.internal.ProjectStructure.projectRootDir
import net.corda.testing.driver.driver
import net.corda.testing.internal.IntegrationTest
import net.corda.testing.internal.IntegrationTestSchemas
import net.corda.testing.internal.toDatabaseSchemaName
import net.corda.testing.internal.toDatabaseSchemaNames
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatThrownBy
@ -27,7 +28,8 @@ class BootTests : IntegrationTest() {
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME)
.map { it.toDatabaseSchemaNames("", "_10000", "_10003") }.flatten().toTypedArray())
.map { it.toDatabaseSchemaNames("", "_10000", "_10003") }.flatten().toTypedArray()
+ DUMMY_NOTARY_NAME.toDatabaseSchemaName())
}
@Test

View File

@ -21,7 +21,8 @@ import org.junit.Test
class CordappScanningDriverTest : IntegrationTest() {
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName())
val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(),
DUMMY_NOTARY_NAME.toDatabaseSchemaName())
}
@Test

View File

@ -52,7 +52,7 @@ DROP SEQUENCE IF EXISTS ${schema}.hibernate_sequence;
DROP USER IF EXISTS ${schema};
DROP LOGIN ${schema};
DROP SCHEMA IF EXISTS ${schema};
CREATE LOGIN ${schema} WITH PASSWORD = 'yourStrong(!)Password';
IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = N'${schema}') CREATE LOGIN ${schema} WITH PASSWORD = 'yourStrong(!)Password';
CREATE SCHEMA ${schema};
CREATE USER ${schema} FOR LOGIN ${schema} WITH DEFAULT_SCHEMA = ${schema};
GRANT ALTER, DELETE, EXECUTE, INSERT, REFERENCES, SELECT, UPDATE, VIEW DEFINITION ON SCHEMA::${schema} TO ${schema};