Fixed Managed Identity tests
@@ -57,18 +57,11 @@ public class MSITest extends AESetup {
connStr = TestUtils.addOrOverrideProperty(connStr, Constants.PASSWORD, "");
connStr = TestUtils.addOrOverrideProperty(connStr, Constants.AUTHENTICATION, "ActiveDirectoryMSI");
- connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSITOKENCACHETTL, "0");
-
testSimpleConnect(connStr);
- connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSITOKENCACHETTL,
- Integer.toString(Integer.MAX_VALUE));
+ connStr = TestUtils.addOrOverrideProperty(connStr, Constants.AUTHENTICATION, "ActiveDirectoryMSI");
testSimpleConnect(connStr);
-
- connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSITOKENCACHETTL, "");
-
- testSimpleConnect(connStr); // This call will use a cached token
}
private void testSimpleConnect(String connStr) {
@@ -92,18 +85,10 @@ public class MSITest extends AESetup {
connStr = TestUtils.addOrOverrideProperty(connStr, Constants.AUTHENTICATION, "ActiveDirectoryMSI");
connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSICLIENTID, msiClientId);
- connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSITOKENCACHETTL, "0");
-
testSimpleConnect(connStr);
- connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSITOKENCACHETTL,
- Integer.toString(Integer.MAX_VALUE));
-
+ connStr = TestUtils.addOrOverrideProperty(connStr, Constants.AUTHENTICATION, "ActiveDirectoryMSI");
testSimpleConnect(connStr);
-
- connStr = TestUtils.addOrOverrideProperty(connStr, Constants.MSITOKENCACHETTL, "");
-
- testSimpleConnect(connStr); // This call will use a cached token
}
/*
@@ -123,7 +108,12 @@ public class MSITest extends AESetup {
ds.setAuthentication("ActiveDirectoryMSI");
AbstractTest.updateDataSource(connStr, ds);
- testSimpleConnect(connStr);
+ try (SQLServerConnection con = (SQLServerConnection) ds.getConnection()) {}
+
+ ds.setAuthentication("ActiveDirectoryMSI");
+ AbstractTest.updateDataSource(connStr, ds);
+
+ try (SQLServerConnection con = (SQLServerConnection) ds.getConnection()) {}
}
/*
@@ -144,7 +134,12 @@ public class MSITest extends AESetup {
ds.setMSIClientId(msiClientId);
AbstractTest.updateDataSource(connStr, ds);
- testSimpleConnect(connStr);
+ try (SQLServerConnection con = (SQLServerConnection) ds.getConnection()) {}
+
+ ds.setAuthentication("ActiveDirectoryMSI");
+ AbstractTest.updateDataSource(connStr, ds);
+
+ try (SQLServerConnection con = (SQLServerConnection) ds.getConnection()) {}
}
/*
