-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-980046 Make QueryStatus thread safe
- Loading branch information
1 parent
4db5434
commit fe0ed36
Showing
2 changed files
with
95 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
38 changes: 38 additions & 0 deletions
38
src/test/java/net/snowflake/client/core/QueryStatusTest.java
This file contains 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,38 @@ | ||
package net.snowflake.client.core; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class QueryStatusTest { | ||
@Test | ||
public void testThreadSafetyByConstructor() { | ||
QueryStatus status1 = | ||
new QueryStatus(QueryStatus.RUNNING.getValue(), QueryStatus.RUNNING.getDescription()); | ||
QueryStatus status2 = | ||
new QueryStatus(QueryStatus.RUNNING.getValue(), QueryStatus.RUNNING.getDescription()); | ||
status1.setErrorCode(1); | ||
status2.setErrorCode(2); | ||
|
||
assertEquals(status1.getErrorCode(), 1); | ||
assertEquals(status2.getErrorCode(), 2); | ||
} | ||
|
||
@Test | ||
public void testThreadSafetyByDescription() { | ||
QueryStatus status1 = QueryStatus.getStatusFromString(QueryStatus.RUNNING.getDescription()); | ||
QueryStatus status2 = QueryStatus.getStatusFromString(QueryStatus.RUNNING.getDescription()); | ||
status1.setErrorCode(1); | ||
status2.setErrorCode(2); | ||
|
||
assertEquals(status1.getErrorCode(), 1); | ||
assertEquals(status2.getErrorCode(), 2); | ||
} | ||
|
||
@Test | ||
public void testEquality() { | ||
assertEquals( | ||
QueryStatus.RUNNING, | ||
new QueryStatus(QueryStatus.RUNNING.getValue(), QueryStatus.RUNNING.getDescription())); | ||
} | ||
} |