Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Microsoft/mssql-jdbc into Fa…
Browse files Browse the repository at this point in the history
…tJar

# Conflicts:
#	pom.xml
  • Loading branch information
rene-ye committed May 13, 2019
2 parents 6968ac4 + 2c965e2 commit 58d19da
Show file tree
Hide file tree
Showing 16 changed files with 1,007 additions and 751 deletions.
31 changes: 18 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,29 @@ jobs:
Remove-Item –path .\JavaKeyStoreBase.txt
displayName: 'PowerShell Script'
- task: Maven@3
displayName: 'Maven build 43'
displayName: 'Maven build jre12'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pbuild43 -DexcludeGroups=$(Ex_Groups)'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre12 -DexcludedGroups=$(Ex_Groups)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build 43'
testRunTitle: 'Maven build jre12'
javaHomeOption: Path
jdkDirectory: $(JDK11)
mavenAuthenticateFeed: true
checkStyleRunAnalysis: true
pmdRunAnalysis: true
jdkDirectory: $(JDK12)
- task: Maven@3
displayName: 'Maven build 42'
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 -Pbuild42 -DexcludeGroups=$(Ex_Groups)'
testRunTitle: 'Maven build 42'
goals: 'clean -Dmssql_jdbc_test_connection_properties=jdbc:sqlserver://$(Target_SQL)$(server_domain);$(database);$(user);$(password); install -Pjre11 -DexcludedGroups=$(Ex_Groups)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build jre11'
javaHomeOption: Path
jdkDirectory: $(JDK12)
- task: Maven@3
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 -DexcludedGroups=$(Ex_Groups)'
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Maven build jre8'
javaHomeOption: Path
jdkDirectory: $(JDK11)
checkStyleRunAnalysis: true
pmdRunAnalysis: true
jdkDirectory: $(JDK12)
44 changes: 35 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
* Gradle Scipt for Building Microsoft JDBC Driver for SQL Server
****************************************************************
* Instruction for Building JDBC Driver:
* For building jre9 version of the driver,
* use command 'gradle build' or 'gradle build -PbuildProfile=build43'
* Whereas, for building jre8 version of the driver,
* use command 'gradle build -PbuildProfile=build42'
* For building particular version of the driver, use commands:
* jre12 - - PS> gradle build
PS> gradle build -PbuildProfile=jre12
* jre11 - - PS> gradle build -PbuildProfile=jre11
* jre8 - - PS> gradle build -PbuildProfile=jre8
*
* For Excluding Groups in command line:
* PS> gradle build -PbuildProfile=jre11 "-PexcludedGroups=['xSQLv15','xGradle']"
****************************************************************/

apply plugin: 'java'
Expand All @@ -25,7 +29,26 @@ allprojects {
}
}

if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "build43")){
test {
useJUnitPlatform {
excludeTags (hasProperty('excludedGroups') ? excludedGroups : 'xSQLv15','xGradle')
}
}

if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "jre12")){

jreVersion = "jre12"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
}
}
sourceCompatibility = 12
targetCompatibility = 12
}

if (hasProperty('buildProfile') && buildProfile == "jre11"){

jreVersion = "jre11"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
Expand All @@ -38,13 +61,18 @@ if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile
targetCompatibility = 11
}

if((hasProperty('buildProfile') && buildProfile == "build42")) {
if(hasProperty('buildProfile') && buildProfile == "jre8") {

jreVersion = "jre8"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java'

sourceCompatibility = 1.8
targetCompatibility = 1.8
test {
useJUnitPlatform {
excludeTags (hasProperty('excludedGroups') ? excludedGroups : 'xSQLv15','xGradle','xJDBC42')
}
}
}

jar.archiveName = "${archivesBaseName}-${version}.${jreVersion}-preview.jar"
Expand All @@ -55,7 +83,6 @@ jar {
'Vendor': 'Microsoft Corporation'
}
}

sourceSets {
main {
java {
Expand All @@ -69,8 +96,7 @@ sourceSets {
}
test {
resources {
srcDirs 'src/test/resources'
include '**/*.csv'
srcDirs "src/test/resources", "AE_Certificates"
output.resourcesDir = testOutputDir
}
}
Expand Down
159 changes: 87 additions & 72 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@

<properties>
<!-- Allowed values for excluded Groups here - - - - - - - - - - - - -
xJDBC42 - - - - - - For tests not compatible with JDBC 42 Specifications
xGradle - - - - - - For tests not compatible with Gradle Script - - - - -
xSQLv12 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2014
xSQLv14 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2017
xSQLv15 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2019
xSQLv14 - - - - - - For tests not compatible with SQL Server 2016 - 2017
xSQLv15 - - - - - - For tests not compatible with SQL Server 2019 - - - -
xAzureSQLDB - - - - For tests not compatible with Azure SQL Database - -
xAzureSQLDW - - - - For tests not compatible with Azure Data Warehouse -
xAzureSQLMI - - - - For tests not compatible with Azure SQL Managed Instance
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Default testing enabled with SQL Server 2019 (SQLv14) -->
<excludeGroups>xSQLv15</excludeGroups>
<excludedGroups>xSQLv15</excludedGroups>

<!-- Driver Dependencies -->
<azure.keyvault.version>1.2.1</azure.keyvault.version>
Expand Down Expand Up @@ -181,7 +183,7 @@

<profiles>
<profile>
<id>build42</id>
<id>jre8</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre8-preview</finalName>
<plugins>
Expand Down Expand Up @@ -214,12 +216,20 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<!-- Exclude [xJDBC42] For tests not compatible with JDBC 4.2 Specifications -->
<excludedGroups>${excludedGroups}, xJDBC42</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<goals>
<goal>shade</goal>
Expand All @@ -231,49 +241,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<id>pre-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<argLine>
${argLine} --illegal-access=permit
</argLine>
<properties>
<excludeTags>${skipTestTag}</excludeTags>
</properties>
<!-- Exclude [xJDBC42] For tests not compatible with JDBC 4.2 Specifications -->
<excludedGroups>${excludeGroups}, xJDBC42</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build43</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<id>jre11</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre11-preview</finalName>
<plugins>
Expand Down Expand Up @@ -307,7 +279,6 @@
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<goals>
<goal>shade</goal>
Expand All @@ -319,41 +290,58 @@
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jre12</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<finalName>${project.artifactId}-${project.version}.jre12-preview</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
</excludes>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<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>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<id>pre-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded.jre12-preview</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<argLine>
${argLine} --illegal-access=permit
</argLine>
<properties>
<excludeTags>${skipTestTag}</excludeTags>
</properties>
<excludedGroups>
${excludeGroups}</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -415,6 +403,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<argLine>
${argLine} --illegal-access=permit
</argLine>
<excludedGroups>
${excludedGroups}</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down Expand Up @@ -487,6 +487,21 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<id>pre-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<fileSets>
<fileSet>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3025,7 +3025,7 @@ void setDataLoggable(boolean value) {
dataIsLoggable = value;
}

SharedTimer getSharedTimer() {
SharedTimer getSharedTimer() throws SQLServerException {
return con.getSharedTimer();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ public class SQLServerConnection implements ISQLServerConnection, java.io.Serial
* Return an existing cached SharedTimer associated with this Connection or create a new one.
*
* The SharedTimer will be released when the Connection is closed.
*
* @throws SQLServerException
*/
SharedTimer getSharedTimer() {
SharedTimer getSharedTimer() throws SQLServerException {
if (state == State.Closed) {
throw new IllegalStateException(SQLServerException.getErrString("R_connectionIsClosed"));
SQLServerException.makeFromDriverError(null, null, SQLServerException.getErrString("R_connectionIsClosed"),
null, false);
}
if (null == sharedTimer) {
this.sharedTimer = SharedTimer.getTimer();
Expand Down
Loading

0 comments on commit 58d19da

Please sign in to comment.