|
| 1 | +package com.taosdata.jdbc.ws; |
| 2 | + |
| 3 | +import com.taosdata.jdbc.TSDBDriver; |
| 4 | +import com.taosdata.jdbc.annotation.TestTarget; |
| 5 | +import com.taosdata.jdbc.utils.DateTimeUtils; |
| 6 | +import com.taosdata.jdbc.utils.SpecifyAddress; |
| 7 | +import com.taosdata.jdbc.utils.TestUtils; |
| 8 | +import org.junit.After; |
| 9 | +import org.junit.Assert; |
| 10 | +import org.junit.Before; |
| 11 | +import org.junit.Test; |
| 12 | +import org.junit.runner.RunWith; |
| 13 | +import org.junit.runners.Parameterized; |
| 14 | + |
| 15 | +import java.sql.Date; |
| 16 | +import java.sql.*; |
| 17 | +import java.time.*; |
| 18 | +import java.time.temporal.ChronoUnit; |
| 19 | +import java.util.*; |
| 20 | + |
| 21 | +@TestTarget(alias = "websocket timezon test", author = "sheyj", version = "3.7.0") |
| 22 | +public class WSTimeZoneTest2 { |
| 23 | + |
| 24 | + private static final String host = "127.0.0.1"; |
| 25 | + private static final int port = 6041; |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + @Test |
| 30 | + public void UTC8Test() throws SQLException { |
| 31 | + String url = SpecifyAddress.getInstance().getRestWithoutUrl(); |
| 32 | + if (url == null) { |
| 33 | + url = "jdbc:TAOS-WS://" + host + ":" + port + "/?user=root&password=taosdata"; |
| 34 | + } else { |
| 35 | + url += "?user=root&password=taosdata"; |
| 36 | + } |
| 37 | + Properties properties = new Properties(); |
| 38 | + properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "Asia/Shanghai"); |
| 39 | + try ( Connection connection = DriverManager.getConnection(url, properties)) { |
| 40 | + WSConnection wsConnection = (WSConnection) connection; |
| 41 | + Assert.assertEquals("Asia/Shanghai", wsConnection.getParam().getTz()); |
| 42 | + } |
| 43 | + } |
| 44 | +} |
0 commit comments