Skip to content

Commit

Permalink
Merge branch 'ms-dev' into fixGetMaxConnections (Resolve conflicts)
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/test/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionTest.java
  • Loading branch information
cheenamalhotra committed May 13, 2019
2 parents 12dd3f7 + 2c965e2 commit 9dfa996
Show file tree
Hide file tree
Showing 16 changed files with 984 additions and 746 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
127 changes: 64 additions & 63 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,49 +216,20 @@
</archive>
</configuration>
</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>
<excludedGroups>${excludedGroups}, 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 @@ -285,39 +258,40 @@
</archive>
</configuration>
</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.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>
<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.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<argLine>
${argLine} --illegal-access=permit
</argLine>
<properties>
<excludeTags>${skipTestTag}</excludeTags>
</properties>
<excludedGroups>
${excludeGroups}</excludedGroups>
<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>
</plugins>
Expand Down Expand Up @@ -381,6 +355,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 @@ -453,6 +439,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
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,9 @@ public final void setLargeMaxRows(long max) throws SQLServerException {
// SQL server only supports integer limits for setting max rows.
// If <max> is bigger than integer limits then throw an exception, otherwise call setMaxRows(int)
if (max > Integer.MAX_VALUE) {
throw new UnsupportedOperationException(SQLServerException.getErrString("R_invalidMaxRows"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_invalidMaxRows"));
Object[] msgArgs = {max};
SQLServerException.makeFromDriverError(connection, this, form.format(msgArgs), null, true);
}
setMaxRows((int) max);
loggerExternal.exiting(getClassNameLogging(), "setLargeMaxRows");
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* Various driver utilities.
*
*/

final class Util {
final static String SYSTEM_SPEC_VERSION = System.getProperty("java.specification.version");
final static char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/com/microsoft/sqlserver/jdbc/JDBC43Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import org.junit.runner.RunWith;
import org.opentest4j.TestAbortedException;

import com.microsoft.sqlserver.testframework.AbstractTest;;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Constants;


/**
Expand Down Expand Up @@ -127,7 +128,7 @@ public void connectionPoolDataSourceTest() throws TestAbortedException, SQLExcep
* @since 1.9
*/
@Test
@Tag("xJDBC42")
@Tag(Constants.xJDBC42)
public void setShardingKeyIfValidTest() throws TestAbortedException, SQLException {
try (SQLServerConnection connection43 = (SQLServerConnection43) getConnection()) {
try {
Expand All @@ -151,7 +152,7 @@ public void setShardingKeyIfValidTest() throws TestAbortedException, SQLExceptio
* @since 1.9
*/
@Test
@Tag("xJDBC42")
@Tag(Constants.xJDBC42)
public void setShardingKeyTest() throws TestAbortedException, SQLException {
try (SQLServerConnection connection43 = (SQLServerConnection43) getConnection()) {
try {
Expand Down
Loading

0 comments on commit 9dfa996

Please sign in to comment.