Skip to content

Commit

Permalink
Test | Cleanup before running tests (#1387)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilgreenbird authored Jul 20, 2020
1 parent 423be4a commit 8b5bf2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
displayName: 'Maven build jre14'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre14 -DuserNTLM=$(userNTLM) -DpasswordNTLM=$(passwordNTLM) -DdomainNTLM=$(domainNTLM) -DexcludedGroups=$(Ex_Groups) -Dpkcs12_truststore_password=$(pkcs12_truststore_password) -Dpkcs12_truststore=$(pkcs12_truststore.secureFilePath)
goals: 'clean dependency:purge-local-repository -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre14 -DuserNTLM=$(userNTLM) -DpasswordNTLM=$(passwordNTLM) -DdomainNTLM=$(domainNTLM) -DexcludedGroups=$(Ex_Groups) -Dpkcs12_truststore_password=$(pkcs12_truststore_password) -Dpkcs12_truststore=$(pkcs12_truststore.secureFilePath)
-DapplicationClientID=$(applicationClientID) -DapplicationKey=$(applicationKey) -DkeyID=$(keyID) -DwindowsKeyPath=$(windowsKeyPath) -DenclaveAttestationUrl=$(enclaveAttestationUrl) -DenclaveAttestationProtocol=$(enclaveAttestationProtocol) -DenclaveServer=$(enclaveServer)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build jre14'
Expand All @@ -48,7 +48,7 @@ jobs:
displayName: 'Maven build jre11'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre11 -DuserNTLM=$(userNTLM) -DpasswordNTLM=$(passwordNTLM) -DdomainNTLM=$(domainNTLM) -DexcludedGroups=$(Ex_Groups) -Dpkcs12_truststore_password=$(pkcs12_truststore_password) -Dpkcs12_truststore=$(pkcs12_truststore.secureFilePath)
goals: 'clean dependency:purge-local-repository -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre11 -DuserNTLM=$(userNTLM) -DpasswordNTLM=$(passwordNTLM) -DdomainNTLM=$(domainNTLM) -DexcludedGroups=$(Ex_Groups) -Dpkcs12_truststore_password=$(pkcs12_truststore_password) -Dpkcs12_truststore=$(pkcs12_truststore.secureFilePath)
-DapplicationClientID=$(applicationClientID) -DapplicationKey=$(applicationKey) -DkeyID=$(keyID) -DwindowsKeyPath=$(windowsKeyPath) -DenclaveAttestationUrl=$(enclaveAttestationUrl) -DenclaveAttestationProtocol=$(enclaveAttestationProtocol) -DenclaveServer=$(enclaveServer)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build jre11'
Expand All @@ -58,7 +58,7 @@ jobs:
displayName: 'Maven build jre8'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre8 -DuserNTLM=$(userNTLM) -DpasswordNTLM=$(passwordNTLM) -DdomainNTLM=$(domainNTLM) -DexcludedGroups=$(Ex_Groups) -Dpkcs12_truststore_password=$(pkcs12_truststore_password) -Dpkcs12_truststore=$(pkcs12_truststore.secureFilePath)
goals: 'clean dependency:purge-local-repository -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre8 -DuserNTLM=$(userNTLM) -DpasswordNTLM=$(passwordNTLM) -DdomainNTLM=$(domainNTLM) -DexcludedGroups=$(Ex_Groups) -Dpkcs12_truststore_password=$(pkcs12_truststore_password) -Dpkcs12_truststore=$(pkcs12_truststore.secureFilePath)
-DapplicationClientID=$(applicationClientID) -DapplicationKey=$(applicationKey) -DkeyID=$(keyID) -DwindowsKeyPath=$(windowsKeyPath) -DenclaveAttestationUrl=$(enclaveAttestationUrl) -DenclaveAttestationProtocol=$(enclaveAttestationProtocol) -DenclaveServer=$(enclaveServer)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build jre8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,12 @@ public class DatabaseMetaDataForeignKeyTest extends AbstractTest {

@BeforeAll
public static void setupVariation() throws SQLException {
cleanup();

try (Connection conn = getConnection(); Statement stmt = conn.createStatement()) {
catalog = conn.getCatalog();
schema = conn.getSchema();

TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table1), stmt);
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table2), stmt);
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table3), stmt);
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table4), stmt);
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table5), stmt);

stmt.execute("Create table " + AbstractSQLGenerator.escapeIdentifier(table2)
+ " (c21 int NOT NULL PRIMARY KEY)");

Expand Down Expand Up @@ -111,6 +107,10 @@ public static void setupVariation() throws SQLException {

@AfterAll
public static void terminateVariation() throws SQLException {
cleanup();
}

private static void cleanup() {
try (Statement stmt = connection.createStatement()) {
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table1), stmt);
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(table2), stmt);
Expand All @@ -126,7 +126,6 @@ public static void terminateVariation() throws SQLException {
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(PKTable1), stmt);

TestUtils.dropSchemaIfExists(anotherSchema, stmt);

} catch (Exception e) {
fail(TestResource.getResource("R_unexpectedErrorMessage") + e.getMessage());
}
Expand Down

0 comments on commit 8b5bf2f

Please sign in to comment.