-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for JDK 10 in both Maven and Gradle (#691)
* Feature | Added support for JDK 10 in both Maven and Gradle - builds jre10 jars for the driver, replacing jre9 * JDK 10 | Merge 42 classes to base classes to reduce class redundancy. * JDK 10 | Attempt to run JDK 10 with Appveyor * Remove unwanted space * Updating Travis script to use JDK 10 * Testing without addons * Update script for Jacoco report to build 43 profile * Revert driver changes for 42 compliance - to be added in a separate PR * Revert Test class changes for 42 compliance - to be done in a separate PR * Reformatted code * Add ID to jacoco plugin execution task
- Loading branch information
1 parent
a409708
commit ae8d4a1
Showing
5 changed files
with
145 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionWrapper43Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Microsoft JDBC Driver for SQL Server | ||
* | ||
* Copyright(c) Microsoft Corporation All rights reserved. | ||
* | ||
* This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. | ||
*/ | ||
package com.microsoft.sqlserver.jdbc.connection; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.sql.Connection; | ||
import java.sql.DatabaseMetaData; | ||
import java.sql.DriverManager; | ||
import java.sql.SQLException; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.microsoft.sqlserver.jdbc.SQLServerConnection; | ||
import com.microsoft.sqlserver.jdbc.SQLServerConnection43; | ||
import com.microsoft.sqlserver.testframework.AbstractTest; | ||
|
||
/** | ||
* Test ConnectionWrapper43Test class | ||
* | ||
*/ | ||
@RunWith(JUnitPlatform.class) | ||
public class ConnectionWrapper43Test extends AbstractTest { | ||
static Connection connection = null; | ||
double javaVersion = Double.parseDouble(System.getProperty("java.specification.version")); | ||
static int major; | ||
static int minor; | ||
|
||
/** | ||
* Tests creation of SQLServerConnection43Test object | ||
* | ||
* @throws SQLException | ||
*/ | ||
@Test | ||
public void SQLServerConnection43Test() throws SQLException { | ||
try { | ||
if (1.8d <= javaVersion && 4 == major && 2 == minor) { | ||
assertTrue(connection instanceof SQLServerConnection); | ||
} | ||
else { | ||
assertTrue(connection instanceof SQLServerConnection43); | ||
} | ||
} | ||
finally { | ||
if (null != connection) { | ||
connection.close(); | ||
} | ||
} | ||
} | ||
|
||
@BeforeAll | ||
private static void setupConnection() throws SQLException { | ||
connection = DriverManager.getConnection(connectionString); | ||
|
||
DatabaseMetaData metadata = connection.getMetaData(); | ||
major = metadata.getJDBCMajorVersion(); | ||
minor = metadata.getJDBCMinorVersion(); | ||
} | ||
|
||
@AfterAll | ||
private static void terminateVariation() throws SQLException { | ||
if (null != connection) { | ||
connection.close(); | ||
} | ||
} | ||
|
||
} |