Skip to content

Commit

Permalink
Merge pull request microsoft#6 from lilgreenbird/icr
Browse files Browse the repository at this point in the history
Updated getConnectionFields to account for SQLServerConnectionPoolProxy
  • Loading branch information
VeryVerySpicy authored Oct 5, 2021
2 parents 5b8527a + cee6dd6 commit 548ace6
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 20 deletions.
17 changes: 10 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,22 @@
<!-- 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
xSQLv11 - - - - - - For tests not compatible with SQL Server 2012 - - - -
xSQLv12 - - - - - - For tests not compatible with SQL Server 2014 - - - -
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
NTLM - - - - - - - For tests using NTLM Authentication mode (excluded by default)
reqExternalSetup - For tests requiring external setup (excluded by default)
clientCertAuth - - For tests requiring client certificate authentication setup (excluded by default)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NTLM - - - - - - - For tests using NTLM Authentication mode (excluded by
default) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
reqExternalSetup - For tests requiring external setup (excluded by default)
clientCertAuth - - For tests requiring client certificate authentication
setup (excluded by default) - - - - - - - - - - - - - - - - - - - - - - -
Default testing enabled with SQL Server 2019 (SQLv15) -->
<excludedGroups>xSQLv12,xSQLv15,NTLM,MSI,reqExternalSetup,clientCertAuth,fedAuth</excludedGroups>

<!-- Use -preview for preview release, leave empty for official release.-->
<!-- Use -preview for preview release, leave empty for official release. -->
<releaseExt>-preview</releaseExt>

<!-- Driver Dependencies -->
Expand Down Expand Up @@ -288,7 +290,8 @@
<configuration>
<!-- Exclude [xJDBC42] For tests not compatible with JDBC 4.2 Specifications -->
<excludedGroups>${excludedGroups}, xJDBC42</excludedGroups>
<!-- needs to be overridden as illegal-access and MaxPermSize=256m not valid in java 8 -->
<!-- needs to be overridden as illegal-access and MaxPermSize=256m
not valid in java 8 -->
<argLine>-Xmx1024m -Djava.library.path=${dllPath}</argLine>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
*
*/
@RunWith(JUnitPlatform.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.xAzureSQLDW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
*
*/
@RunWith(Parameterized.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*
*/
@RunWith(Parameterized.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xAzureSQLDW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
*
*/
@RunWith(Parameterized.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class MSITest extends AESetup {
/*
* Test MSI auth
*/
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xSQLv15)
Expand All @@ -66,6 +67,7 @@ public void testMSIAuth() throws SQLException {
/*
* Test MSI auth with msiClientId
*/
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xSQLv15)
Expand All @@ -85,6 +87,7 @@ public void testMSIAuthWithMSIClientId() throws SQLException {
/*
* Test MSI auth using datasource
*/
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xSQLv15)
Expand All @@ -106,6 +109,7 @@ public void testDSMSIAuth() throws SQLException {
/*
* Test MSI auth with msiClientId using datasource
*/
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xSQLv15)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* Test multi-user Azure Key Store provider.
*/
@RunWith(JUnitPlatform.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*
*/
@RunWith(Parameterized.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@


@RunWith(Parameterized.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
*/
@RunWith(JUnitPlatform.class)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xAzureSQLDW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ public void testGetColumns() throws SQLException {
}

@Test
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xSQLv15)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,7 @@ public void testDateTimeInsertUpdate() throws Exception {
*
* @throws Exception
*/
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Test
public void testGetLocalDateTimePriorGregorian() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void testAddBatch2(Connection conn) throws SQLException {
* @throws SQLException
*/
@Test
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
public void testAddbatch2AEOnConnection() throws SQLException {
try (Connection connection = PrepUtil.getConnection(connectionString + ";columnEncryptionSetting=Enabled;")) {
Expand All @@ -119,6 +120,7 @@ public void testAddbatch2() throws SQLException {
* @throws SQLException
*/
@Test
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
public void testClearBatchAEOnConnection() throws SQLException {
try (Connection connection = PrepUtil.getConnection(connectionString + ";columnEncryptionSetting=Enabled;")) {
Expand Down Expand Up @@ -180,6 +182,7 @@ private void executeBatch(PreparedStatement pstmt, int count, int run) throws SQ
}

@BeforeEach
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
public void testSetup() throws TestAbortedException, Exception {
try (Statement stmt = connection.createStatement()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import javax.sql.PooledConnection;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import com.microsoft.sqlserver.jdbc.RandomUtil;
import com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource;
import com.microsoft.sqlserver.jdbc.TestResource;
import com.microsoft.sqlserver.jdbc.TestUtils;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Constants;


@Tag(Constants.xSQLv11)
public class BasicConnectionTest extends AbstractTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
import java.sql.Statement;
import java.util.concurrent.ThreadLocalRandom;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

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


@Tag(Constants.xSQLv11)
public class PropertyTest extends AbstractTest {

private void testInvalidPropertyOverBrokenConnection(String prop, String val,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
import java.util.Map;
import java.util.Optional;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

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


@Tag(Constants.xSQLv11)
public class ReflectiveTests extends AbstractTest {

private void timeoutVariations(Map<String, String> props, long expectedDuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import javax.sql.PooledConnection;

import org.junit.Assert;
import org.junit.jupiter.api.Tag;

import com.microsoft.sqlserver.jdbc.ISQLServerConnection;
import com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource;
import com.microsoft.sqlserver.testframework.Constants;


@Tag(Constants.xSQLv11)
public final class ResiliencyUtils {

private static final String[] ON_OFF = new String[] {"ON", "OFF"};
Expand Down Expand Up @@ -325,20 +327,20 @@ protected static String setConnectionProps(String base, Map<String, String> prop
}

/**
* Get declared fields of connection depending on Java version. Connection class SQLServerConnection43 is returned
* for Java >=9 and SQLServerConnection for Java 8
* Get declared fields of connection class depending on Java version. Connection class SQLServerConnection43 is
* returned for Java >=9 and SQLServerConnection or SQLServerConnectPoolProxy for Java 8
*
* @param c
* Connection class that implements ISQLServerConnection
* @return declared fields for SQLServerConnection class
* connection class that implements ISQLServerConnection
* @return declared fields for Connection class
*/
private static Field[] getConnectionFields(Connection c) {
Class cls = c.getClass();
// SQLServerConnection43 is returned for java >=9 so need to get super class
if (!ISQLServerConnection.class.isAssignableFrom(c.getClass())) {
Class<? extends Connection> cls = c.getClass();
// SQLServerConnection43 is returned for Java >=9 so need to get super class
if (cls.getName() == "com.microsoft.sqlserver.jdbc.SQLServerConnection43") {
return cls.getSuperclass().getDeclaredFields();
}
return cls.getDeclaredFields();

return cls.getDeclaredFields();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import com.microsoft.sqlserver.jdbc.RandomUtil;
import com.microsoft.sqlserver.jdbc.SQLServerException;
import com.microsoft.sqlserver.jdbc.TestResource;
import com.microsoft.sqlserver.jdbc.TestUtils;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Constants;


@Tag(Constants.xSQLv11)
public class ResultSetsWithResiliencyTest extends AbstractTest {
static String tableName = "[" + RandomUtil.getIdentifier("resTable") + "]";
static int numberOfRows = 10000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class DataClassificationTest extends AbstractTest {
*
* @throws Exception
*/
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
@Tag(Constants.xAzureSQLDW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@RunWith(JUnitPlatform.class)
@Tag(Constants.xAzureSQLDW)
@Tag(Constants.xAzureSQLDB)
@Tag(Constants.xSQLv11)
@Tag(Constants.xSQLv12)
@Tag(Constants.xSQLv14)
public class UTF8SupportTest extends AbstractTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ private Constants() {}
* <pre>
* xJDBC42 - - - - - - For tests not compatible with JDBC 42 Specifications
* xGradle - - - - - - For tests not compatible with Gradle Script (e.g. Manifest File)
* xSQLv12 - - - - - - For tests not compatible with SQL Server 2008 R2 - 2014
* xSQLv11 - - - - - - For tests not compatible with SQL Server 2012
* xSQLv12 - - - - - - For tests not compatible with SQL Server 2014
* 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
Expand All @@ -30,6 +31,7 @@ private Constants() {}
*/
public static final String xJDBC42 = "xJDBC42";
public static final String xGradle = "xGradle";
public static final String xSQLv11 = "xSQLv11";
public static final String xSQLv12 = "xSQLv12";
public static final String xSQLv14 = "xSQLv14";
public static final String xSQLv15 = "xSQLv15";
Expand Down

0 comments on commit 548ace6

Please sign in to comment.