-
Notifications
You must be signed in to change notification settings - Fork 187
SNOW-1016470: Increase code coverage to at least 90% in JDBC #2069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sfc-gh-ext-simba-vb
merged 84 commits into
master
from
SNOW-1016470-increase-code-coverage-to-at-least-90
Sep 15, 2025
Merged
Changes from 26 commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
3fa101d
Additional Tests for code coverage.
sfc-gh-ext-simba-vb b45eec4
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 472f51a
Added tests for code coverage.
sfc-gh-ext-simba-vb 4efcb8e
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb faf1bae
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 3c32bb1
Code coverage added for StorageProviderException class.
sfc-gh-ext-simba-vb b02716c
Code cov file added.
sfc-gh-ext-simba-vb 72ecc7f
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb edfd096
Code coverage added for log package.
sfc-gh-ext-simba-vb be64d98
Formatted the java files.
sfc-gh-ext-simba-vb 6ddb478
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 36830e6
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 1ba2343
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 8707273
Junit tests added to increase the code coverage.
sfc-gh-ext-simba-vb 2bc0b76
reverting due to version compatibility.
sfc-gh-ext-simba-vb f4d929f
Fixed the Checkstyle errors.
sfc-gh-ext-simba-vb e4df842
Code reverted due to JVM version incompatibility.
sfc-gh-ext-simba-vb ef4bbed
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 911b03d
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb b11dcc5
Review comments implemented.
sfc-gh-ext-simba-vb 95f9d3a
Build failure addressed.
sfc-gh-ext-simba-vb b0c7c89
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb b8ed58f
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 7a2b1dc
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb 7c3b5bd
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb affed29
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb f54df02
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb bcb11d0
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb d881ae7
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 92ede36
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 991aedc
Review comments implemented.
sfc-gh-ext-simba-vb 0aaf661
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb 0add3db
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 3161fbe
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb f2d64ad
Build issue resolved.
sfc-gh-ext-simba-vb c55ce67
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb 1ed179e
External browser changes reverted due to browser issue.
sfc-gh-ext-simba-vb f760b52
initial commit.
sfc-gh-ext-simba-vb 6ac7c26
checkstyle correction.
sfc-gh-ext-simba-vb 9f2cf69
Merge branch 'master' into SNOW-1943242-jdbc-caches-closeablehttpclie…
sfc-gh-ext-simba-vb 185c9d3
Http client cache management and re initialization implementation.
sfc-gh-ext-simba-vb 675d2d7
added class
sfc-gh-ext-simba-vb 4d367a1
Modified tests.
sfc-gh-ext-simba-vb 7f22457
Merge branch 'master' into SNOW-1943242-jdbc-caches-closeablehttpclie…
sfc-gh-ext-simba-vb 05c72c3
Junit tests added.
sfc-gh-ext-simba-vb 9152bb0
Merge branch 'master' into SNOW-1943242-jdbc-caches-closeablehttpclie…
sfc-gh-ext-simba-vb 4ef5839
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 2321d92
Merge branch 'master' into SNOW-1943242-jdbc-caches-closeablehttpclie…
sfc-gh-ext-simba-vb f959c04
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb f865ceb
Merge branch 'master' into SNOW-1943242-jdbc-caches-closeablehttpclie…
sfc-gh-ext-simba-hx 653fa54
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 88b4ccb
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb e2029e2
Merge branch 'SNOW-1943242-jdbc-caches-closeablehttpclient-indefinite…
sfc-gh-ext-simba-vb 0e7c4e9
check style
sfc-gh-ext-simba-vb f505aa1
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 86ebee4
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb aa01508
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb 63bd5cb
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb cf465b4
Corrected the code.
sfc-gh-ext-simba-vb d54dd89
Reverting the code
sfc-gh-ext-simba-vb 5d4d464
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 0e9bf94
Fixing compile failure.
sfc-gh-ext-simba-vb 73f9ee9
Reverting URLutil code for test purpose.
sfc-gh-ext-simba-vb b29da4d
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 3817455
UrlUTil modification.
sfc-gh-ext-simba-vb 4fa99b5
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb 2b7e176
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 4b3dd71
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb f51d336
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 1a76157
Review comments addressed.
sfc-gh-ext-simba-vb 7b15f82
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb c181f3e
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 50c6120
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb dff8fe0
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 8f21858
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 6e8c600
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 38018ef
Merge branch 'master' of https://github.com/snowflakedb/snowflake-jdb…
sfc-gh-ext-simba-vb 966a7c8
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb 88f43b5
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb f137512
Merge branch 'SNOW-1016470-increase-code-coverage-to-at-least-90' of …
sfc-gh-ext-simba-vb e11e38f
reduced line.
sfc-gh-ext-simba-vb aa68fbd
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb 1030d08
Revert the code due to linux failure
sfc-gh-ext-simba-vb 12cb0e8
Merge branch 'master' into SNOW-1016470-increase-code-coverage-to-at-…
sfc-gh-ext-simba-vb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/test/java/net/snowflake/client/core/QueryContextEntryDTOTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package net.snowflake.client.core; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
class QueryContextEntryDTOTest { | ||
|
||
@Mock private OpaqueContextDTO mockContext; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
MockitoAnnotations.openMocks(this); | ||
} | ||
|
||
@Test | ||
void testDefaultConstructor() { | ||
QueryContextEntryDTO entry = new QueryContextEntryDTO(); | ||
assertNotNull(entry); | ||
assertEquals(0, entry.getId()); | ||
assertEquals(0, entry.getTimestamp()); | ||
assertEquals(0, entry.getPriority()); | ||
assertNull(entry.getContext()); | ||
} | ||
|
||
@Test | ||
void testParameterizedConstructor() { | ||
QueryContextEntryDTO entry = new QueryContextEntryDTO(1L, 100L, 10L, mockContext); | ||
|
||
assertEquals(1L, entry.getId()); | ||
assertEquals(100L, entry.getTimestamp()); | ||
assertEquals(10L, entry.getPriority()); | ||
assertEquals(mockContext, entry.getContext()); | ||
} | ||
|
||
@Test | ||
void testSettersAndGetters() { | ||
QueryContextEntryDTO entry = new QueryContextEntryDTO(); | ||
|
||
entry.setId(2L); | ||
entry.setTimestamp(200L); | ||
entry.setPriority(20L); | ||
entry.setContext(mockContext); | ||
|
||
assertEquals(2L, entry.getId()); | ||
assertEquals(200L, entry.getTimestamp()); | ||
assertEquals(20L, entry.getPriority()); | ||
assertEquals(mockContext, entry.getContext()); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/test/java/net/snowflake/client/core/auth/oauth/RandomStateProviderTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.snowflake.client.core.auth.oauth; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class RandomStateProviderTest { | ||
|
||
private RandomStateProvider randomStateProvider; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
// Initialize the RandomStateProvider before each test | ||
randomStateProvider = new RandomStateProvider(); | ||
} | ||
|
||
@Test | ||
public void testGetState_ShouldReturnNonNullState() { | ||
// Call getState() and verify that it returns a non-null value | ||
String state = randomStateProvider.getState(); | ||
assertNotNull(state, "State should not be null"); | ||
} | ||
|
||
@Test | ||
public void testGetState_ShouldReturnUniqueValues() { | ||
// Ensure that the state is random and different each time | ||
String state1 = randomStateProvider.getState(); | ||
String state2 = randomStateProvider.getState(); | ||
|
||
// Assert that the two generated states are different | ||
assertNotEquals(state1, state2, "State should be different on subsequent calls"); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/test/java/net/snowflake/client/core/auth/oauth/TokenResponseDTOTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package net.snowflake.client.core.auth.oauth; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class TokenResponseDTOTest { | ||
|
||
private static final String JSON_SAMPLE = | ||
"{" | ||
+ "\"access_token\":\"abc123\"," | ||
+ "\"refresh_token\":\"refresh123\"," | ||
+ "\"token_type\":\"bearer\"," | ||
+ "\"scope\":\"read write\"," | ||
+ "\"username\":\"testUser\"," | ||
+ "\"idp_initiated\":true," | ||
+ "\"expires_in\":3600," | ||
+ "\"refresh_token_expires_in\":7200" | ||
+ "}"; | ||
|
||
@Test | ||
public void testConstructorAndGetters() { | ||
TokenResponseDTO tokenResponseDTO = | ||
new TokenResponseDTO( | ||
"abc123", "refresh123", "bearer", "read write", "testUser", true, 3600, 7200); | ||
// Assert that the constructor has correctly initialized the object | ||
assertEquals("abc123", tokenResponseDTO.getAccessToken()); | ||
assertEquals("bearer", tokenResponseDTO.getTokenType()); | ||
assertEquals("refresh123", tokenResponseDTO.getRefreshToken()); | ||
assertEquals("read write", tokenResponseDTO.getScope()); | ||
assertEquals("testUser", tokenResponseDTO.getUsername()); | ||
assertTrue(tokenResponseDTO.isIdpInitiated()); | ||
assertEquals(3600, tokenResponseDTO.getExpiresIn()); | ||
assertEquals(7200, tokenResponseDTO.getRefreshTokenExpiresIn()); | ||
} | ||
|
||
@Test | ||
public void testJsonDeserialization() throws Exception { | ||
// Create an ObjectMapper to convert JSON to TokenResponseDTO | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
// Deserialize the JSON string into a TokenResponseDTO object | ||
TokenResponseDTO deserializedTokenResponseDTO = | ||
objectMapper.readValue(JSON_SAMPLE, TokenResponseDTO.class); | ||
|
||
// Assert that the deserialized object matches the expected values | ||
assertEquals("abc123", deserializedTokenResponseDTO.getAccessToken()); | ||
assertEquals("bearer", deserializedTokenResponseDTO.getTokenType()); | ||
assertEquals("refresh123", deserializedTokenResponseDTO.getRefreshToken()); | ||
assertEquals("read write", deserializedTokenResponseDTO.getScope()); | ||
assertEquals("testUser", deserializedTokenResponseDTO.getUsername()); | ||
assertTrue(deserializedTokenResponseDTO.isIdpInitiated()); | ||
assertEquals(3600, deserializedTokenResponseDTO.getExpiresIn()); | ||
assertEquals(7200, deserializedTokenResponseDTO.getRefreshTokenExpiresIn()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.