Skip to content

Commit

Permalink
Merge pull request #732 from cheenamalhotra/module (Export driver in …
Browse files Browse the repository at this point in the history
…automatic module)

Introduce Automatic Module Name in POM.
  • Loading branch information
cheenamalhotra authored Jul 6, 2018
1 parent 38cddc6 commit 7243eb5
Show file tree
Hide file tree
Showing 18 changed files with 637 additions and 635 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ repositories {
}

dependencies {
compile 'com.microsoft.azure:azure-keyvault:1.0.0',
compileOnly 'com.microsoft.azure:azure-keyvault:1.0.0',
'com.microsoft.azure:adal4j:1.6.0'
testCompile 'junit:junit:4.12',
'org.junit.platform:junit-platform-console:1.2.0',
Expand Down
9 changes: 6 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>3.7.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java</exclude>
Expand Down Expand Up @@ -169,7 +169,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>3.7.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
Expand All @@ -185,6 +185,9 @@
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>com.microsoft.sqlserver.jdbc</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
Expand Down Expand Up @@ -302,7 +305,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<version>2.22.0</version>

<configuration>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class AESetup extends AbstractTest {
* @throws TestAbortedException
*/
@BeforeAll
static void setUpConnection() throws TestAbortedException, Exception {
public static void setUpConnection() throws TestAbortedException, Exception {
assumeTrue(13 <= new DBConnection(connectionString).getServerVersion(),
TestResource.getResource("R_Incompat_SQLServerVersion"));

Expand Down Expand Up @@ -122,7 +122,7 @@ static void setUpConnection() throws TestAbortedException, Exception {
* @throws SQLException
*/
@AfterAll
private static void dropAll() throws SQLException {
public static void dropAll() throws SQLException {
dropTables(stmt);
dropCEK(stmt);
dropCMK(stmt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static void initCallableStatementTest() throws SQLException {
}

@AfterAll
private static void dropAll() throws SQLException {
public static void dropAll() throws SQLException {
dropTables();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class BulkCopyCSVTest extends AbstractTest {
* Create connection, statement and generate path of resource file
*/
@BeforeAll
static void setUpConnection() {
public static void setUpConnection() {
con = new DBConnection(connectionString);
stmt = con.createStatement();
filePath = Utils.getCurrentClassPath();
Expand All @@ -75,7 +75,7 @@ static void setUpConnection() {
*/
@Test
@DisplayName("Test SQLServerBulkCSVFileRecord")
void testCSV() {
public void testCSV() {
try (SQLServerBulkCSVFileRecord fileRecord = new SQLServerBulkCSVFileRecord(filePath + inputFile, encoding, delimiter, true)) {
testBulkCopyCSV(fileRecord, true);
}
Expand All @@ -89,7 +89,7 @@ void testCSV() {
*/
@Test
@DisplayName("Test SQLServerBulkCSVFileRecord First line not being column name")
void testCSVFirstLineNotColumnName() {
public void testCSVFirstLineNotColumnName() {
try (SQLServerBulkCSVFileRecord fileRecord = new SQLServerBulkCSVFileRecord(filePath + inputFileNoColumnName, encoding, delimiter, false)) {
testBulkCopyCSV(fileRecord, false);
}
Expand All @@ -105,7 +105,7 @@ void testCSVFirstLineNotColumnName() {
*/
@Test
@DisplayName("Test SQLServerBulkCSVFileRecord with passing file from url")
void testCSVFromURL() throws SQLException {
public void testCSVFromURL() throws SQLException {
try (InputStream csvFileInputStream = new URL(
"https://raw.githubusercontent.com/Microsoft/mssql-jdbc/master/src/test/resources/BulkCopyCSVTestInput.csv").openStream();
SQLServerBulkCSVFileRecord fileRecord = new SQLServerBulkCSVFileRecord(csvFileInputStream, encoding, delimiter, true)) {
Expand Down Expand Up @@ -223,7 +223,7 @@ static void validateValuesFromCSV(DBTable destinationTable,
* @throws SQLException
*/
@AfterAll
static void tearConnection() throws SQLException {
public static void tearConnection() throws SQLException {
stmt.close();
con.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ public class BulkCopyColumnMappingTest extends BulkCopyTestSetUp {
* Create connection, statement and generate path of resource file
*/
@BeforeAll
static void setUpConnection() {
public static void setUpConnection() {
con = new DBConnection(connectionString);
stmt = con.createStatement();
}

@AfterAll
static void closeConnection() throws SQLException {
public static void closeConnection() throws SQLException {
stmt.close();
con.close();
}

@Test
@DisplayName("BulkCopy:test no explicit column mapping")
void testNoExplicitCM() {
public void testNoExplicitCM() {

// create dest table
DBTable destTable = sourceTable.cloneSchema();
Expand All @@ -72,7 +72,7 @@ void testNoExplicitCM() {

@Test
@DisplayName("BulkCopy:test explicit column mapping")
void testExplicitCM() {
public void testExplicitCM() {

// create dest table
DBTable destTable = sourceTable.cloneSchema();
Expand Down Expand Up @@ -107,7 +107,7 @@ void testExplicitCM() {

@Test
@DisplayName("BulkCopy:test unicode column mapping")
void testUnicodeCM() {
public void testUnicodeCM() {

// create source unicode table
DBTable sourceTableUnicode = new DBTable(true, true);
Expand Down Expand Up @@ -147,7 +147,7 @@ void testUnicodeCM() {

@Test
@DisplayName("BulkCopy:test repetative column mapping")
void testRepetativeCM() {
public void testRepetativeCM() {

// create source table
DBTable sourceTable1 = new DBTable(true);
Expand Down Expand Up @@ -207,7 +207,7 @@ void testRepetativeCM() {

@Test
@DisplayName("BulkCopy:test implicit mismatched column mapping")
void testImplicitMismatchCM() {
public void testImplicitMismatchCM() {

// create non unicode dest table with different schema from source table
DBTable destTable = new DBTable(true, false, true);
Expand Down Expand Up @@ -242,7 +242,7 @@ void testImplicitMismatchCM() {

@Test
@DisplayName("BulkCopy:test invalid column mapping")
void testInvalidCM() {
public void testInvalidCM() {

// create dest table
DBTable destTable = sourceTable.cloneSchema();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BulkCopyConnectionTest extends BulkCopyTestSetUp {
* @return
*/
@TestFactory
Stream<DynamicTest> generateBulkCopyConstructorTest() {
public Stream<DynamicTest> generateBulkCopyConstructorTest() {
List<BulkCopyTestWrapper> testData = createTestDatatestBulkCopyConstructor();
// had to avoid using lambdas as we need to test against java7
return testData.stream().map(new Function<BulkCopyTestWrapper, DynamicTest>() {
Expand All @@ -65,7 +65,7 @@ public void execute() {
* @return
*/
@TestFactory
Stream<DynamicTest> generateBulkCopyOptionsTest() {
public Stream<DynamicTest> generateBulkCopyOptionsTest() {
List<BulkCopyTestWrapper> testData = createTestDatatestBulkCopyOption();
return testData.stream().map(new Function<BulkCopyTestWrapper, DynamicTest>() {
@Override
Expand All @@ -85,7 +85,7 @@ public void execute() {
*/
@Test
@DisplayName("BulkCopy:test uninitialized Connection")
void testInvalidConnection1() {
public void testInvalidConnection1() {
assertThrows(SQLException.class, new org.junit.jupiter.api.function.Executable() {
@Override
public void execute() throws SQLException {
Expand All @@ -102,7 +102,7 @@ public void execute() throws SQLException {
*/
@Test
@DisplayName("BulkCopy:test uninitialized SQLServerConnection")
void testInvalidConnection2() {
public void testInvalidConnection2() {
assertThrows(SQLException.class, new org.junit.jupiter.api.function.Executable() {
@Override
public void execute() throws SQLException {
Expand All @@ -119,7 +119,7 @@ public void execute() throws SQLException {
*/
@Test
@DisplayName("BulkCopy:test empty connection string")
void testInvalidConnection3() {
public void testInvalidConnection3() {
assertThrows(SQLException.class, new org.junit.jupiter.api.function.Executable() {
@Override
public void execute() throws SQLException {
Expand All @@ -136,7 +136,7 @@ public void execute() throws SQLException {
*/
@Test
@DisplayName("BulkCopy:test null connenction string")
void testInvalidConnection4() {
public void testInvalidConnection4() {
assertThrows(SQLException.class, new org.junit.jupiter.api.function.Executable() {
@Override
public void execute() throws SQLException {
Expand All @@ -153,7 +153,7 @@ public void execute() throws SQLException {
*/
@Test
@DisplayName("BulkCopy:test null SQLServerBulkCopyOptions")
void testEmptyBulkCopyOptions() {
public void testEmptyBulkCopyOptions() {
BulkCopyTestWrapper bulkWrapper = new BulkCopyTestWrapper(connectionString);
bulkWrapper.setUsingConnection((0 == ThreadLocalRandom.current().nextInt(2)) ? true : false);
SQLServerBulkCopyOptions option = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class BulkCopyISQLServerBulkRecordTest extends AbstractTest {

@Test
void testISQLServerBulkRecord() throws SQLException {
public void testISQLServerBulkRecord() throws SQLException {
try (DBConnection con = new DBConnection(connectionString); DBStatement stmt = con.createStatement()) {
DBTable dstTable = new DBTable(true);
stmt.createTable(dstTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BulkCopyTestSetUp extends AbstractTest {
* @throws SQLException
*/
@BeforeAll
static void setUpSourceTable() throws SQLException {
public static void setUpSourceTable() throws SQLException {
try (DBConnection con = new DBConnection(connectionString);
DBStatement stmt = con.createStatement();
DBPreparedStatement pstmt = new DBPreparedStatement(con);) {
Expand All @@ -48,7 +48,7 @@ static void setUpSourceTable() throws SQLException {
* @throws SQLException
*/
@AfterAll
static void dropSourceTable() throws SQLException {
public static void dropSourceTable() throws SQLException {
try (DBConnection con = new DBConnection(connectionString);
DBStatement stmt = con.createStatement()) {
stmt.dropTable(sourceTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BulkCopyTimeoutTest extends BulkCopyTestSetUp {
*/
@Test
@DisplayName("BulkCopy:test zero timeout")
void testZeroTimeOut() throws SQLException {
public void testZeroTimeOut() throws SQLException {
testBulkCopyWithTimeout(0);
}

Expand All @@ -48,7 +48,7 @@ void testZeroTimeOut() throws SQLException {
*/
@Test
@DisplayName("BulkCopy:test negative timeout")
void testNegativeTimeOut() throws SQLException {
public void testNegativeTimeOut() throws SQLException {
assertThrows(SQLException.class, new org.junit.jupiter.api.function.Executable() {
@Override
public void execute() throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void SQLServerConnection43Test() throws SQLException {
}

@BeforeAll
private static void setupConnection() throws SQLException {
public static void setupConnection() throws SQLException {
connection = DriverManager.getConnection(connectionString);

DatabaseMetaData metadata = connection.getMetaData();
Expand All @@ -67,7 +67,7 @@ private static void setupConnection() throws SQLException {
}

@AfterAll
private static void terminateVariation() throws SQLException {
public static void terminateVariation() throws SQLException {
if (null != connection) {
connection.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class DatabaseMetaDataForeignKeyTest extends AbstractTest {
private static String catalog = null;

@BeforeAll
private static void setupVariation() throws SQLException {
public static void setupVariation() throws SQLException {
conn = (SQLServerConnection) DriverManager.getConnection(connectionString);
SQLServerStatement stmt = (SQLServerStatement) conn.createStatement();

Expand Down Expand Up @@ -78,7 +78,7 @@ private static void setupVariation() throws SQLException {
}

@AfterAll
private static void terminateVariation() throws SQLException {
public static void terminateVariation() throws SQLException {
conn = (SQLServerConnection) DriverManager.getConnection(connectionString);
stmt = (SQLServerStatement) conn.createStatement();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ private static String[] createNumericValues() {
}

@BeforeEach
private void testSetup() throws SQLException {
public void testSetup() throws SQLException {
conn = (SQLServerConnection) DriverManager.getConnection(connectionString + ";sendStringParametersAsUnicode=true;");
stmt = (SQLServerStatement) conn.createStatement();

Expand Down Expand Up @@ -493,7 +493,7 @@ private void createTVPS() throws SQLException {
}

@AfterEach
private void terminateVariation() throws SQLException {
public void terminateVariation() throws SQLException {
Utils.dropProcedureIfExists(procedureName, stmt);
Utils.dropTableIfExists(destTable, stmt);
dropTVPS();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void testNumericPresicionIssue211() throws SQLException {
}

@BeforeEach
private void testSetup() throws SQLException {
public void testSetup() throws SQLException {
conn = new DBConnection(connectionString);
stmt = conn.createStatement();

Expand Down Expand Up @@ -108,7 +108,7 @@ private void createTVPS() throws SQLException {
}

@AfterEach
private void terminateVariation() throws SQLException {
public void terminateVariation() throws SQLException {
if (null != conn) {
conn.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private static void createPreocedure() throws SQLException {
}

@AfterEach
private void terminateVariation() throws SQLException {
public void terminateVariation() throws SQLException {
if (null != conn) {
conn.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void testTVPSchemaCallableInsertCommand() throws SQLException, IOExceptio
}

@BeforeEach
private void testSetup() throws SQLException {
public void testSetup() throws SQLException {
conn = new DBConnection(connectionString);
stmt = conn.createStatement();

Expand Down Expand Up @@ -213,7 +213,7 @@ private void createTVPS() throws SQLException {
}

@AfterEach
private void terminateVariation() throws SQLException {
public void terminateVariation() throws SQLException {
if (null != conn) {
conn.close();
}
Expand Down
Loading

0 comments on commit 7243eb5

Please sign in to comment.