Skip to content

Commit

Permalink
Merge pull request #12 from Microsoft/dev
Browse files Browse the repository at this point in the history
pull
  • Loading branch information
rene-ye authored Jan 30, 2018
2 parents c1f7ffd + 5856172 commit 2c2a224
Show file tree
Hide file tree
Showing 42 changed files with 782 additions and 204 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ local.properties
.settings/
.gradle/
.loadpath
outdated-dependencies.txt
pom.xml.versionBackup

# External tool builders
.externalToolBuilders/
Expand Down
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

language: java
jdk:
- oraclejdk8
- oraclejdk9

addons:
apt:
packages:
- oracle-java9-installer

services:
- docker

Expand All @@ -29,7 +34,7 @@ install:
- keytool -importkeystore -destkeystore clientcert.jks -deststorepass password -srckeystore identity.p12 -srcstoretype PKCS12 -srcstorepass password
- keytool -list -v -keystore clientcert.jks -storepass "password" > JavaKeyStore.txt
- cd ..
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild41
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild43
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild42

before_script:
Expand All @@ -39,6 +44,6 @@ before_script:
script:
- docker ps -a

##Test for JDBC Specification 41 & 42 and submit coverage report.
- mvn test -B -Pbuild41 jacoco:report && bash <(curl -s https://codecov.io/bash) -cF JDBC41
##Test for JDBC Specification 43 & 42 and submit coverage report.
- mvn test -B -Pbuild41 jacoco:report && bash <(curl -s https://codecov.io/bash) -cF JDBC43
- mvn test -B -Pbuild42 jacoco:report && bash <(curl -s https://codecov.io/bash) -cF JDBC42
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ What's coming next? We will look into adding a more comprehensive set of tests,

## Build
### Prerequisites
* Java 8
* Java 9
* [Maven](http://maven.apache.org/download.cgi)
* An instance of SQL Server or Azure SQL Database that you can connect to.

### Build the JAR files
Maven builds automatically trigger a set of verification tests to run. For these tests to pass, you will first need to add an environment variable in your system called `mssql_jdbc_test_connection_properties` to provide the [correct connection properties](https://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx) for your SQL Server or Azure SQL Database instance.

To build the jar files, you must use Java 8 with Maven. You can choose to build a JDBC 4.1 compliant jar file (for use with JRE 7) and/or a JDBC 4.2 compliant jar file (for use with JRE 8).
To build the jar files, you must use Java 9 with Maven. You can choose to build a JDBC 4.3 compliant jar file (for use with JRE 9) and/or a JDBC 4.2 compliant jar file (for use with JRE 8).

* Maven:
1. If you have not already done so, add the environment variable `mssql_jdbc_test_connection_properties` in your system with the connection properties for your SQL Server or SQL DB instance.
2. Run one of the commands below to build a JDBC 4.1 compliant jar or JDBC 4.2 compliant jar in the \target directory.
* Run `mvn install -Pbuild41`. This creates JDBC 4.1 compliant jar in \target directory
2. Run one of the commands below to build a JDBC 4.3 compliant jar or JDBC 4.2 compliant jar in the \target directory.
* Run `mvn install -Pbuild43`. This creates JDBC 4.3 compliant jar in \target directory
* Run `mvn install -Pbuild42`. This creates JDBC 4.2 compliant jar in \target directory

**NOTE**: Beginning release v6.1.7, we will no longer be maintaining the existing [Gradle build script](build.gradle) and it will be left in the repository for reference. Please refer to issue [#62](https://github.com/Microsoft/mssql-jdbc/issues/62) for this decision.
Expand Down
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ build_script:
- keytool -importkeystore -srckeystore cert.pfx -srcstoretype pkcs12 -destkeystore clientcert.jks -deststoretype JKS -srcstorepass password -deststorepass password
- keytool -list -v -keystore clientcert.jks -storepass "password" > JavaKeyStore.txt
- cd..
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild41
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild42
# - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild41
# - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -Pbuild42

test_script:
- mvn test -B -Pbuild41
- mvn test -B -Pbuild42
#test_script:
# - mvn test -B -Pbuild41
# - mvn test -B -Pbuild42
26 changes: 26 additions & 0 deletions maven-version-rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<!-- Ignore Alpha's, Beta's, release candidates and milestones -->
<ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*EA(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*SNAPSHOT(?:-?\d+)?</ignoreVersion>
<!-- Sometimes Milestone releases are fair enough for testing libs like JUnit-->
<ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion>
</ignoreVersions>

<rules>
<!-- One can add different rules in order to exclude specific version from automatic updates. -->
<!-- Testing... Update groupId, artifact id and appropriate version in order to exclude from versioning plugin
<rule groupId="com.microsoft.azure" artifactId="adal4j">
<ignoreVersions>
<ignoreVersion>1.3.0</ignoreVersion>
</ignoreVersions>
</rule>
-->
</rules>

</ruleset>
46 changes: 27 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.3.6.${jreVersion}-preview</version>
<version>6.4.0-SNAPSHOT.${jreVersion}</version>
<packaging>jar</packaging>

<name>Microsoft JDBC Driver for SQL Server</name>
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<optional>true</optional>
</dependency>

Expand Down Expand Up @@ -118,7 +118,7 @@
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.6.1</version>
<version>2.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -139,10 +139,10 @@

<profiles>
<profile>
<id>build41</id>
<id>build42</id>

<properties>
<jreVersion>jre7</jreVersion>
<jreVersion>jre8</jreVersion>
</properties>

<build>
Expand All @@ -152,10 +152,10 @@
<version>3.6.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java</exclude>
</excludes>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -167,21 +167,19 @@
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>

</plugin>
</plugins>
</build>
</profile>

<profile>
<id>build42</id>

<id>build43</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>

<properties>
<jreVersion>jre8</jreVersion>
<jreVersion>jre9</jreVersion>
</properties>

<build>
Expand All @@ -191,10 +189,10 @@
<version>3.6.0</version>
<configuration>
<excludes>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc41.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
</excludes>
<source>1.8</source>
<target>1.8</target>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -279,7 +277,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
Expand All @@ -301,7 +299,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.0.0-M1</version>

<configuration>
<failOnError>true</failOnError>
Expand Down Expand Up @@ -336,6 +334,16 @@
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<outputFile>outdated-dependencies.txt</outputFile>
<rulesUri>file:///${session.executionRootDirectory}/maven-version-rules.xml</rulesUri>
</configuration>
</plugin>

</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ final class AuthenticationJNI extends SSPIAuthentication {
static int GetMaxSSPIBlobSize() {
return sspiBlobMaxlen;
}

static boolean isDllLoaded() {
return enabled;
}

static {
UnsatisfiedLinkError temp = null;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/sqlserver/jdbc/DDC.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static final Object convertFloatToObject(float floatVal,
return new BigDecimal(Float.toString(floatVal));
case FLOAT:
case DOUBLE:
return ((Float)floatVal).doubleValue();
return (Float.valueOf(floatVal)).doubleValue();
case BINARY:
return convertIntToBytes(Float.floatToRawIntBits(floatVal), 4);
default:
Expand Down Expand Up @@ -275,7 +275,7 @@ static final Object convertDoubleToObject(double doubleVal,
case DOUBLE:
return doubleVal;
case REAL:
return ((Double)doubleVal).floatValue();
return (Double.valueOf(doubleVal)).floatValue();
case INTEGER:
return (int) doubleVal;
case SMALLINT: // small and tinyint returned as short
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void setupInfo(SQLServerConnection con) throws SQLServerException {
instancePort = con.getInstancePort(failoverPartner, instanceValue);

try {
portNumber = new Integer(instancePort);
portNumber = Integer.parseInt(instancePort);
}
catch (NumberFormatException e) {
// Should not get here as the server should give a proper port number anyway.
Expand Down
Loading

0 comments on commit 2c2a224

Please sign in to comment.