Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,11 @@ public void testMSIAuth() throws SQLException {
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) {
Expand All @@ -92,18 +85,10 @@ public void testMSIAuthWithMSIClientId() throws SQLException {
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
}

/*
Expand All @@ -123,7 +108,12 @@ public void testDSMSIAuth() throws SQLException {
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()) {}
}

/*
Expand All @@ -144,7 +134,12 @@ public void testDSMSIAuthWithMSIClientId() throws SQLException {
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()) {}
}

/*
Expand Down