Improved SQL test setup for Azure SQL and SQL Server (#152)

* Improved SQL scripts for SQL Server and Azure to drop user/permissions on class setup not on test setup
* Set Micorsoft JDBC driver as compile time dependency.
* Database testing description.
* New table node_mutual_exclusion added to SQL test setup scripts.
This commit is contained in:
szymonsztuka 2017-12-07 16:26:17 +00:00 committed by GitHub
parent b3ca36132f
commit 737cd7edba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 318 additions and 115 deletions

View File

@ -16,12 +16,15 @@ import net.corda.node.services.Permissions.Companion.startFlow
import net.corda.nodeapi.internal.config.User
import net.corda.testing.*
import net.corda.testing.driver.driver
import org.junit.ClassRule
import org.junit.Test
import kotlin.test.assertEquals
class IntegrationTestingTutorial : IntegrationTest() {
override val databaseSchemas: MutableList<String>
get() = listOf(ALICE, BOB, DUMMY_NOTARY).map { it.toDatabaseSchemaName() }.toMutableList()
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE, BOB, DUMMY_NOTARY).map { it.toDatabaseSchemaName() }.toTypedArray())
}
@Test
fun `alice bob cash exchange example`() {

View File

@ -38,7 +38,7 @@ and Hibernate properties in `database` entry - see `:ref:`dataSourceProperties`.
SQL Azure and SQL Server
````````````````````````
Corda supports SQL Server 2017 adn SQL Azure.
Corda supports SQL Server 2017 (14.0.3006.16) and Azure SQL (12.0.2000.8).
The minimum transaction isolation level ``database.transactionIsolationLevel`` is 'readCommitted'.
The property ``database.schema`` is optional.
Corda ships with Microsoft JDBC Driver 6.2 for SQLServer out-of-the-box.

View File

@ -43,24 +43,50 @@ TODO: Add instructions on manual testing
External Database Testing
-------------------------
By default, all tests which need a database, utilize built-in H2 instances. For the purpose of testing other relational
database providers or different database setups (for example, H2 in server mode), we introduce an optional system
property called ``databaseProvider`` which is resolved at run-time to load a configuration file on the classpath with the
name ``$databaseProvider.conf`` containing database configuration properties defined in the general node configuration
file (see ``reference.conf``). These will be used to override the default H2 settings defined in ``reference.conf``.
Integration test can be parameterised to run against any remote database (by default, integration tests use in-memory H2 instances).
For the purpose of testing other relational database providers or different database setups (for example, H2 in server mode),
we introduce an optional system property called ``databaseProvider`` which is resolved at run-time to load a configuration file on the classpath with the
name ``$databaseProvider.conf`` containing database configuration properties that override the default H2 settings
defined in the general node configuration file (see ``reference.conf``).
Integration test runs predefined set of SQL setup scripts selected for a specific database provider by ``test.db.script.dir``.
SQL scripts is a template which contains standard SQL DDL statements with a ${schema} placeholder. An integration test runs the SQL scripts
for all nodes involed in the test and replaces ${schema} with appropriate value derived from node name.
SQL templates files are executed at different stage of an integration test:
``db-global-setup.sql``- before a test class (@BeforeClass), should create database users, schema and permissions
``db-setup.sql`` - before a test (@Before), should clean up/drop tables
``db-cleanup.sql` - after a test (@After), may clean up/drop tables
``db-global-cleanup.sql`` - after a test class (@AfterClass), may drop user and schema
Depends on the database providers not each SQL file is present (e.g. db-setp always deletes tabels so db-cleanp is not needed).
Appropriate changes will then be applied to all tests in a appropriate manner.
The setup ensures that all nodes involved in a single integration test use different database users to achieve database separation.
The data source configuration files (denote by ``databaseProvider``) define user and schema by ${nodeOrganizationName} placeholder.
At a runtime the node resolves the placeholder to its organization name.
- ``dataSourceProperties.dataSource.url`` - JDBC datasource URL. Appropriate drivers must be available in classpath. Also, for
different tests random database name is appended at the end of this string, ie. ``jdbc:h2:tcp://localhost:9092`` will become
full, proper URL - ie.``jdbc:h2:tcp://localhost:9092/34jh543gk243g2`` - mind the last slash missing.
- ``dataSourceProperties.dataSourceClassName`` - JDBC driver classname
To run integration tests against a remote database provide these system properties:
- ``dataSourceProperties.dataSource.user`` - JDBC username
- ``databaseProvider`` - a template dataSource/database configuration for a node, accepted values [“integration-azure-sql”, “integration-sql-server”]
- ``dataSourceProperties.dataSource.password`` - JDBC password
- ``test.db.script.dir`` - a relative directory path with SQL script templates for a given database,
accepted values [“database-scripts/azure-sql”, “database-scripts/sql-server”]
- ``database.transactionIsolationLevel`` - Isolation level pertinent to relevant database provider
- ``test.db.admin.user`` - a database user to run SQL setup scripts, the user need to have permissions
to create other users and grant them permissions
- ``test.db.admin.password`` - a password for the database user to run SQL scripts
Provided configuration file ``$databaseProvider.conf``file () contains a specific JDBC connection string with a dummy database host,
the following properties can override JDBC connection string and password:
- ``dataSourceProperties.dataSource.url`` - specify full JDBC connection string use by a node to connect to database
- ``dataSourceProperties.dataSource.password`` - optional setup, currently SQL scripts creates users with a given hardcoded
password with matches one in node configuration
All defaults are taken from the ``reference.conf`` file.
Example running Gradle integration tests task against Azure SQL database running at ``mycordadb.database.windows.net``:
``./gradlew integrationTest -DdataSourceProperties.dataSource.url="jdbc:sqlserver://mycordadb.database.windows.net:1433;databaseName=mycordadb;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30"
-DdatabaseProvider=integration-sql-azure -Dtest.db.admin.user=dbuser@mycordadb -Dtest.db.admin.password='paSSword(!'
-Dtest.db.script.dir=database-scripts/sql-azure --info``

View File

@ -116,8 +116,12 @@ dependencies {
// For H2 database support in persistence
compile "com.h2database:h2:$h2_version"
//TODO remove once we can put driver jar into a predefined directory
//JDBC driver can be passed to the Node at startup using setting the jarDirs property in the Node configuration file.
//For Postgres database support in persistence
compile "org.postgresql:postgresql:$postgresql_version"
//For Azure SQL and SQL Server support in persistence
compile 'com.microsoft.sqlserver:mssql-jdbc:6.2.1.jre8'
// SQL connection pooling library
compile "com.zaxxer:HikariCP:2.5.1"
@ -162,10 +166,6 @@ dependencies {
// Jsh: A SSH implementation for tunneling inbound traffic via a relay
compile group: 'com.jcraft', name: 'jsch', version: '0.1.54'
//TODO remove once we can put driver jar into a predefined directory
//JDBC driver can be passed to the Node at startup using setting the jarDirs property in the Node configuration file.
runtime 'com.microsoft.sqlserver:mssql-jdbc:6.2.1.jre8'
// Integration test helpers
integrationTestCompile "junit:junit:$junit_version"
integrationTestCompile "org.assertj:assertj-core:${assertj_version}"

View File

@ -2,10 +2,17 @@ package net.corda.bank
import net.corda.finance.DOLLARS
import net.corda.finance.POUNDS
import net.corda.testing.*
import net.corda.testing.internal.demorun.deployNodesThen
import org.junit.ClassRule
import org.junit.Test
class BankOfCordaCordformTest {
class BankOfCordaCordformTest : IntegrationTest() {
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas("NotaryService", "BankOfCorda", BIGCORP_NAME.organisation)
}
@Test
fun `run demo`() {
BankOfCordaCordform().deployNodesThen {

View File

@ -12,10 +12,7 @@ import org.junit.rules.ExternalResource
* Base class for all integration tests that require common setup and/or teardown.
* eg. serialization, database schema creation and data population / clean-up
*/
abstract class IntegrationTest {
open protected val databaseSchemas = Companion.databaseSchemas
// System properties set in main 'corda-project' build.gradle
// Note: the database provider configuration file for integration tests should specify:
// dataSource.user = ${nodeOrganizationName}
@ -63,10 +60,10 @@ abstract class IntegrationTest {
class IntegrationTestSchemas(vararg var list : String) : ExternalResource() {
override fun before() {
IntegrationTest.Companion.databaseSchemas.addAll(list)
IntegrationTest.databaseSchemas.addAll(list)
}
override fun after() {
IntegrationTest.Companion.databaseSchemas.clear()
IntegrationTest.databaseSchemas.clear()
}
}

View File

@ -0,0 +1,48 @@
DROP TABLE IF EXISTS ${schema}.node_attachments;
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
DROP TABLE IF EXISTS ${schema}.node_transactions;
DROP TABLE IF EXISTS ${schema}.node_message_retry;
DROP TABLE IF EXISTS ${schema}.node_message_ids;
DROP TABLE IF EXISTS ${schema}.vault_states;
DROP TABLE IF EXISTS ${schema}.node_our_key_pairs;
DROP TABLE IF EXISTS ${schema}.node_scheduled_states;
DROP TABLE IF EXISTS ${schema}.node_network_map_nodes;
DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers;
DROP TABLE IF EXISTS ${schema}.node_notary_commit_log;
DROP TABLE IF EXISTS ${schema}.node_transaction_mappings;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states;
DROP TABLE IF EXISTS ${schema}.vault_linear_states;
DROP TABLE IF EXISTS ${schema}.node_bft_committed_states;
DROP TABLE IF EXISTS ${schema}.node_raft_committed_states;
DROP TABLE IF EXISTS ${schema}.vault_transaction_notes;
DROP TABLE IF EXISTS ${schema}.link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_info_party_cert;
DROP TABLE IF EXISTS ${schema}.node_info_hosts;
DROP TABLE IF EXISTS ${schema}.node_infos;
DROP TABLE IF EXISTS ${schema}.cp_states;
DROP TABLE IF EXISTS ${schema}.node_contract_upgrades;
DROP TABLE IF EXISTS ${schema}.node_identities;
DROP TABLE IF EXISTS ${schema}.node_named_identities;
DROP TABLE IF EXISTS ${schema}.children;
DROP TABLE IF EXISTS ${schema}.parents;
DROP TABLE IF EXISTS ${schema}.contract_cash_states;
DROP TABLE IF EXISTS ${schema}.messages;
DROP TABLE IF EXISTS ${schema}.DummyDealStateSchemaV1$PersistentDummyDealState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV1$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV2$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV2$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV3$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCommercialPaperSchemaV2$PersistentCommercialPaperState_participants;
DROP TABLE IF EXISTS ${schema}.cash_states_v2;
DROP TABLE IF EXISTS ${schema}.cash_states_v3;
DROP TABLE IF EXISTS ${schema}.cp_states_v2;
DROP TABLE IF EXISTS ${schema}.dummy_deal_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2;
DROP TABLE IF EXISTS ${schema}.node_mutual_exclusion;
DROP SEQUENCE IF EXISTS ${schema}.hibernate_sequence;
DROP USER IF EXISTS ${schema};
DROP SCHEMA IF EXISTS ${schema};

View File

@ -0,0 +1,4 @@
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};
GRANT CREATE TABLE, CREATE PROCEDURE, CREATE FUNCTION, CREATE VIEW TO ${schema};

View File

@ -0,0 +1,46 @@
DROP TABLE IF EXISTS ${schema}.node_attachments;
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
DROP TABLE IF EXISTS ${schema}.node_transactions;
DROP TABLE IF EXISTS ${schema}.node_message_retry;
DROP TABLE IF EXISTS ${schema}.node_message_ids;
DROP TABLE IF EXISTS ${schema}.vault_states;
DROP TABLE IF EXISTS ${schema}.node_our_key_pairs;
DROP TABLE IF EXISTS ${schema}.node_scheduled_states;
DROP TABLE IF EXISTS ${schema}.node_network_map_nodes;
DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers;
DROP TABLE IF EXISTS ${schema}.node_notary_commit_log;
DROP TABLE IF EXISTS ${schema}.node_transaction_mappings;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states;
DROP TABLE IF EXISTS ${schema}.vault_linear_states;
DROP TABLE IF EXISTS ${schema}.node_bft_committed_states;
DROP TABLE IF EXISTS ${schema}.node_raft_committed_states;
DROP TABLE IF EXISTS ${schema}.vault_transaction_notes;
DROP TABLE IF EXISTS ${schema}.link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_info_party_cert;
DROP TABLE IF EXISTS ${schema}.node_info_hosts;
DROP TABLE IF EXISTS ${schema}.node_infos;
DROP TABLE IF EXISTS ${schema}.cp_states;
DROP TABLE IF EXISTS ${schema}.node_contract_upgrades;
DROP TABLE IF EXISTS ${schema}.node_identities;
DROP TABLE IF EXISTS ${schema}.node_named_identities;
DROP TABLE IF EXISTS ${schema}.children;
DROP TABLE IF EXISTS ${schema}.parents;
DROP TABLE IF EXISTS ${schema}.contract_cash_states;
DROP TABLE IF EXISTS ${schema}.messages;
DROP TABLE IF EXISTS ${schema}.DummyDealStateSchemaV1$PersistentDummyDealState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV1$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV2$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV2$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV3$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCommercialPaperSchemaV2$PersistentCommercialPaperState_participants;
DROP TABLE IF EXISTS ${schema}.cash_states_v2;
DROP TABLE IF EXISTS ${schema}.cash_states_v3;
DROP TABLE IF EXISTS ${schema}.cp_states_v2;
DROP TABLE IF EXISTS ${schema}.dummy_deal_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2;
DROP TABLE IF EXISTS ${schema}.node_mutual_exclusion;
DROP SEQUENCE IF EXISTS ${schema}.hibernate_sequence;

View File

@ -1,87 +1,49 @@
--once off script to run against master database (not a user database)
CREATE LOGIN AliceCorp WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER AliceCorp FROM LOGIN AliceCorp;
CREATE LOGIN AliceCorp_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER AliceCorp_10000 FROM LOGIN AliceCorp_10003;
CREATE LOGIN AliceCorp_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER AliceCorp_10003 FROM LOGIN AliceCorp_10003;
CREATE LOGIN AliceCorp_10006 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER AliceCorp_10006 FROM LOGIN AliceCorp_10006;
CREATE LOGIN BankA WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BankA FROM LOGIN BankA;
CREATE LOGIN BankA_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BankA_10000 FROM LOGIN BankA_10000;
CREATE LOGIN BankA_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BankA_10003 FROM LOGIN BankA_10003;
CREATE LOGIN BankA_10006 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BankA_10006 FROM LOGIN BankA_10006;
CREATE LOGIN BankB WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BankB FROM LOGIN BankB;
CREATE LOGIN BobPlc WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BobPlc FROM LOGIN BobPlc;
CREATE LOGIN BobPlc_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BobPlc_10000 FROM LOGIN BobPlc_10000;
CREATE LOGIN BobPlc_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BobPlc_10003 FROM LOGIN BobPlc_10003;
CREATE LOGIN BobPlc_10006 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BobPlc_10006 FROM LOGIN BobPlc_10006;
CREATE LOGIN CharlieLtd WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER CharlieLtd FROM LOGIN CharlieLtd;
CREATE LOGIN DistributedService_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER DistributedService_0 FROM LOGIN DistributedService_0;
CREATE LOGIN DistributedService_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER DistributedService_1 FROM LOGIN DistributedService_1;
CREATE LOGIN NetworkMapService WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NetworkMapService FROM LOGIN NetworkMapService;
CREATE LOGIN Notary WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER Notary FROM LOGIN Notary;
CREATE LOGIN NotaryService WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService FROM LOGIN NotaryService;
CREATE LOGIN NotaryService0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService0 FROM LOGIN NotaryService0;
CREATE LOGIN NotaryService1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService1 FROM LOGIN NotaryService1;
CREATE LOGIN NotaryService2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService2 FROM LOGIN NotaryService2;
CREATE LOGIN NotaryService_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService_0 FROM LOGIN NotaryService_0;
CREATE LOGIN NotaryService_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService_1 FROM LOGIN NotaryService_1;
CREATE LOGIN NotaryService_2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER NotaryService_2 FROM LOGIN NotaryService_2;
CREATE LOGIN MegaCorp WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER MegaCorp FOR LOGIN MegaCorp;
CREATE LOGIN node_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_0 FOR LOGIN node_0;
CREATE LOGIN node_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_1 FOR LOGIN node_1;
CREATE LOGIN node_2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_2 FOR LOGIN node_2;
CREATE LOGIN node_3 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_3 FOR LOGIN node_3;
CREATE LOGIN node_4 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_4 FOR LOGIN node_4;
CREATE LOGIN node_5 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_5 FOR LOGIN node_5;
CREATE LOGIN node_6 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_6 FOR LOGIN node_6;
CREATE LOGIN node_7 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_7 FOR LOGIN node_7;
CREATE LOGIN node_8 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_8 FOR LOGIN node_8;
CREATE LOGIN node_9 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER node_9 FOR LOGIN node_9;
CREATE LOGIN RAFTNotaryService_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER RAFTNotaryService_0 FROM LOGIN RAFTNotaryService_0;
CREATE LOGIN RAFTNotaryService_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER RAFTNotaryService_1 FROM LOGIN RAFTNotaryService_1;
CREATE LOGIN RAFTNotaryService_2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER RAFTNotaryService_2 FROM LOGIN RAFTNotaryService_2;
CREATE LOGIN RegulatorA WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER RegulatorA FROM LOGIN RegulatorA;
CREATE LOGIN AliceCorp_10012 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER AliceCorp_10012 FROM LOGIN AliceCorp_10012;
CREATE LOGIN BobPlc_10012 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BobPlc_10012 FROM LOGIN BobPlc_10012;
CREATE LOGIN BankA WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankA_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankA_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankA_10006 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankA_10012 WITH PASSWORD = 'yourStrong(!)Password';
CREATE USER BankA_10012 FROM LOGIN BankA_10012;
CREATE LOGIN BankB WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc_10006 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc_10012 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN CharlieLtd WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN CharlieLtd_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN CharlieLtd_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN CharlieLtd WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN DistributedService_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN DistributedService_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NetworkMapService WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN Notary WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN NotaryService_2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN MegaCorp WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_3 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_4 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_5 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_6 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_7 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_8 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN node_9 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN RAFTNotaryService_0 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN RAFTNotaryService_1 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN RAFTNotaryService_2 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN RegulatorA WITH PASSWORD = 'yourStrong(!)Password';

View File

@ -0,0 +1,49 @@
DROP TABLE IF EXISTS ${schema}.node_attachments;
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
DROP TABLE IF EXISTS ${schema}.node_transactions;
DROP TABLE IF EXISTS ${schema}.node_message_retry;
DROP TABLE IF EXISTS ${schema}.node_message_ids;
DROP TABLE IF EXISTS ${schema}.vault_states;
DROP TABLE IF EXISTS ${schema}.node_our_key_pairs;
DROP TABLE IF EXISTS ${schema}.node_scheduled_states;
DROP TABLE IF EXISTS ${schema}.node_network_map_nodes;
DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers;
DROP TABLE IF EXISTS ${schema}.node_notary_commit_log;
DROP TABLE IF EXISTS ${schema}.node_transaction_mappings;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states;
DROP TABLE IF EXISTS ${schema}.vault_linear_states;
DROP TABLE IF EXISTS ${schema}.node_bft_committed_states;
DROP TABLE IF EXISTS ${schema}.node_raft_committed_states;
DROP TABLE IF EXISTS ${schema}.vault_transaction_notes;
DROP TABLE IF EXISTS ${schema}.link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_info_party_cert;
DROP TABLE IF EXISTS ${schema}.node_info_hosts;
DROP TABLE IF EXISTS ${schema}.node_infos;
DROP TABLE IF EXISTS ${schema}.cp_states;
DROP TABLE IF EXISTS ${schema}.node_contract_upgrades;
DROP TABLE IF EXISTS ${schema}.node_identities;
DROP TABLE IF EXISTS ${schema}.node_named_identities;
DROP TABLE IF EXISTS ${schema}.children;
DROP TABLE IF EXISTS ${schema}.parents;
DROP TABLE IF EXISTS ${schema}.contract_cash_states;
DROP TABLE IF EXISTS ${schema}.messages;
DROP TABLE IF EXISTS ${schema}.DummyDealStateSchemaV1$PersistentDummyDealState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV1$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV2$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV2$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV3$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCommercialPaperSchemaV2$PersistentCommercialPaperState_participants;
DROP TABLE IF EXISTS ${schema}.cash_states_v2;
DROP TABLE IF EXISTS ${schema}.cash_states_v3;
DROP TABLE IF EXISTS ${schema}.cp_states_v2;
DROP TABLE IF EXISTS ${schema}.dummy_deal_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2;
DROP TABLE IF EXISTS ${schema}.node_mutual_exclusion;
DROP SEQUENCE IF EXISTS ${schema}.hibernate_sequence;
DROP USER IF EXISTS ${schema};
DROP LOGIN ${schema};
DROP SCHEMA IF EXISTS ${schema};

View File

@ -0,0 +1,54 @@
DROP TABLE IF EXISTS ${schema}.node_attachments;
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
DROP TABLE IF EXISTS ${schema}.node_transactions;
DROP TABLE IF EXISTS ${schema}.node_message_retry;
DROP TABLE IF EXISTS ${schema}.node_message_ids;
DROP TABLE IF EXISTS ${schema}.vault_states;
DROP TABLE IF EXISTS ${schema}.node_our_key_pairs;
DROP TABLE IF EXISTS ${schema}.node_scheduled_states;
DROP TABLE IF EXISTS ${schema}.node_network_map_nodes;
DROP TABLE IF EXISTS ${schema}.node_network_map_subscribers;
DROP TABLE IF EXISTS ${schema}.node_notary_commit_log;
DROP TABLE IF EXISTS ${schema}.node_transaction_mappings;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_linear_states_parts;
DROP TABLE IF EXISTS ${schema}.vault_fungible_states;
DROP TABLE IF EXISTS ${schema}.vault_linear_states;
DROP TABLE IF EXISTS ${schema}.node_bft_committed_states;
DROP TABLE IF EXISTS ${schema}.node_raft_committed_states;
DROP TABLE IF EXISTS ${schema}.vault_transaction_notes;
DROP TABLE IF EXISTS ${schema}.link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_link_nodeinfo_party;
DROP TABLE IF EXISTS ${schema}.node_info_party_cert;
DROP TABLE IF EXISTS ${schema}.node_info_hosts;
DROP TABLE IF EXISTS ${schema}.node_infos;
DROP TABLE IF EXISTS ${schema}.cp_states;
DROP TABLE IF EXISTS ${schema}.node_contract_upgrades;
DROP TABLE IF EXISTS ${schema}.node_identities;
DROP TABLE IF EXISTS ${schema}.node_named_identities;
DROP TABLE IF EXISTS ${schema}.children;
DROP TABLE IF EXISTS ${schema}.parents;
DROP TABLE IF EXISTS ${schema}.contract_cash_states;
DROP TABLE IF EXISTS ${schema}.messages;
DROP TABLE IF EXISTS ${schema}.DummyDealStateSchemaV1$PersistentDummyDealState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV1$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.DummyLinearStateSchemaV2$PersistentDummyLinearState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV2$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCashSchemaV3$PersistentCashState_participants;
DROP TABLE IF EXISTS ${schema}.SampleCommercialPaperSchemaV2$PersistentCommercialPaperState_participants;
DROP TABLE IF EXISTS ${schema}.cash_states_v2;
DROP TABLE IF EXISTS ${schema}.cash_states_v3;
DROP TABLE IF EXISTS ${schema}.cp_states_v2;
DROP TABLE IF EXISTS ${schema}.dummy_deal_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2;
DROP TABLE IF EXISTS ${schema}.node_mutual_exclusion;
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';
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};
GRANT CREATE TABLE, CREATE PROCEDURE, CREATE FUNCTION, CREATE VIEW TO ${schema};

View File

@ -42,6 +42,7 @@ DROP TABLE IF EXISTS ${schema}.cp_states_v2;
DROP TABLE IF EXISTS ${schema}.dummy_deal_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states;
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2;
DROP TABLE IF EXISTS ${schema}.node_mutual_exclusion;
DROP SEQUENCE IF EXISTS ${schema}.hibernate_sequence;
IF NOT EXISTS (SELECT schema_name FROM information_schema.schemata WHERE schema_name = '${schema}') EXEC('CREATE SCHEMA ${schema}');
IF NOT EXISTS (SELECT * FROM sys.sysusers WHERE name='${schema}') CREATE USER ${schema} FOR LOGIN ${schema} WITH DEFAULT_SCHEMA = ${schema};

View File

@ -12,11 +12,9 @@ import net.corda.finance.DOLLARS
import net.corda.finance.flows.CashIssueFlow
import net.corda.finance.flows.CashPaymentFlow
import net.corda.node.services.config.VerifierType
import net.corda.testing.ALICE
import net.corda.testing.ALICE_NAME
import net.corda.testing.DUMMY_NOTARY
import net.corda.testing.SerializationEnvironmentRule
import net.corda.testing.*
import net.corda.testing.node.NotarySpec
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import java.util.*
@ -24,7 +22,11 @@ import java.util.concurrent.atomic.AtomicInteger
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
class VerifierTests {
class VerifierTests : IntegrationTest() {
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(ALICE.toDatabaseSchemaName(), DUMMY_NOTARY.toDatabaseSchemaName())
}
@Rule
@JvmField
val testSerialization = SerializationEnvironmentRule(true)

View File

@ -2,16 +2,17 @@ package net.corda.webserver
import net.corda.core.utilities.NetworkHostAndPort
import net.corda.core.utilities.getOrThrow
import net.corda.testing.DUMMY_BANK_A
import net.corda.testing.*
import net.corda.testing.driver.WebserverHandle
import net.corda.testing.driver.addressMustBeBound
import net.corda.testing.driver.addressMustNotBeBound
import net.corda.testing.driver.driver
import org.junit.ClassRule
import org.junit.Test
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService
class WebserverDriverTests {
class WebserverDriverTests : IntegrationTest() {
companion object {
val executorService: ScheduledExecutorService = Executors.newScheduledThreadPool(2)
@ -22,6 +23,9 @@ class WebserverDriverTests {
fun webserverMustBeDown(webserverAddr: NetworkHostAndPort) {
addressMustNotBeBound(executorService, webserverAddr)
}
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(DUMMY_BANK_A.toDatabaseSchemaName())
}
@Test