-
Notifications
You must be signed in to change notification settings - Fork 59
Issue34timestamp #36
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
Issue34timestamp #36
Changes from all commits
8527971
24313bc
1b8c426
fe9f5d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,4 +78,53 @@ public void someTest() throws Exception { | |
| await(); | ||
| } | ||
|
|
||
| @Test | ||
| public void queryTypeTimestampWithTimezoneTest() throws Exception { | ||
| asyncSqlClient.getConnection(onSuccess(conn -> { | ||
| conn.execute("CREATE TABLE IF NOT EXISTS timestamptest (ts timestamp with time zone)", onSuccess(resultSet -> { | ||
| conn.execute("INSERT INTO timestamptest (ts) VALUES (now())", onSuccess(rs1 -> { | ||
| conn.query("SELECT * FROM timestamptest;", onSuccess(rs2 -> { | ||
| assertNotNull(rs2); | ||
| assertNotNull(rs2.getResults()); | ||
| conn.execute("DROP TABLE timestamptest", onSuccess(rs3 -> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally, I'd recommend dropping the table before the test and not after it. You can then check the database if anything strange happened after running the test. |
||
| conn.close((ar) -> { | ||
| if (ar.succeeded()) { | ||
| testComplete(); | ||
| } else { | ||
| fail("should be able to close the asyncSqlClient"); | ||
| } | ||
| }); | ||
| })); | ||
| })); | ||
| })); | ||
| })); | ||
| })); | ||
|
|
||
| await(); | ||
| } | ||
|
|
||
| @Test | ||
| public void queryTypeTimestampWithoutTimezoneTest() throws Exception { | ||
| asyncSqlClient.getConnection(onSuccess(conn -> { | ||
| conn.execute("CREATE TABLE IF NOT EXISTS timestamptest (ts timestamp without time zone)", onSuccess(resultSet -> { | ||
| conn.execute("INSERT INTO timestamptest (ts) VALUES (now())", onSuccess(rs1 -> { | ||
| conn.query("SELECT * FROM timestamptest;", onSuccess(rs2 -> { | ||
| assertNotNull(rs2); | ||
| assertNotNull(rs2.getResults()); | ||
| conn.execute("DROP TABLE timestamptest", onSuccess(rs3 -> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for this test: Drop table before starting the test and assert that the received result is a correctly formed date. |
||
| conn.close((ar) -> { | ||
| if (ar.succeeded()) { | ||
| testComplete(); | ||
| } else { | ||
| fail("should be able to close the asyncSqlClient"); | ||
| } | ||
| }); | ||
| })); | ||
| })); | ||
| })); | ||
| })); | ||
| })); | ||
|
|
||
| await(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add at least some check that the data received is a correctly formed date or something like that.