|
|
@@ -82,104 +82,104 @@ class TDengineServiceTest {
|
|
82
|
82
|
@Test
|
|
83
|
83
|
@DisplayName("getValueType: Boolean 返回 BOOL")
|
|
84
|
84
|
void getValueType_boolean_returnsBool() throws Exception {
|
|
85
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
85
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
86
|
86
|
method.setAccessible(true);
|
|
87
|
87
|
|
|
88
|
|
- assertThat(method.invoke(tdengineService, Boolean.TRUE)).isEqualTo("BOOL");
|
|
89
|
|
- assertThat(method.invoke(tdengineService, Boolean.FALSE)).isEqualTo("BOOL");
|
|
|
88
|
+ assertThat(method.invoke(tdengineService, "test_col", Boolean.TRUE)).isEqualTo("BOOL");
|
|
|
89
|
+ assertThat(method.invoke(tdengineService, "test_col", Boolean.FALSE)).isEqualTo("BOOL");
|
|
90
|
90
|
}
|
|
91
|
91
|
|
|
92
|
92
|
@Test
|
|
93
|
93
|
@DisplayName("getValueType: Integer 返回 BIGINT")
|
|
94
|
94
|
void getValueType_integer_returnsBigint() throws Exception {
|
|
95
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
95
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
96
|
96
|
method.setAccessible(true);
|
|
97
|
97
|
|
|
98
|
|
- assertThat(method.invoke(tdengineService, 123)).isEqualTo("BIGINT");
|
|
99
|
|
- assertThat(method.invoke(tdengineService, Integer.valueOf(456))).isEqualTo("BIGINT");
|
|
|
98
|
+ assertThat(method.invoke(tdengineService, "test_col", 123)).isEqualTo("BIGINT");
|
|
|
99
|
+ assertThat(method.invoke(tdengineService, "test_col", Integer.valueOf(456))).isEqualTo("BIGINT");
|
|
100
|
100
|
}
|
|
101
|
101
|
|
|
102
|
102
|
@Test
|
|
103
|
103
|
@DisplayName("getValueType: Long 返回 BIGINT")
|
|
104
|
104
|
void getValueType_long_returnsBigint() throws Exception {
|
|
105
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
105
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
106
|
106
|
method.setAccessible(true);
|
|
107
|
107
|
|
|
108
|
|
- assertThat(method.invoke(tdengineService, 123L)).isEqualTo("BIGINT");
|
|
|
108
|
+ assertThat(method.invoke(tdengineService, "test_col", 123L)).isEqualTo("BIGINT");
|
|
109
|
109
|
}
|
|
110
|
110
|
|
|
111
|
111
|
@Test
|
|
112
|
112
|
@DisplayName("getValueType: Float 返回 DOUBLE")
|
|
113
|
113
|
void getValueType_float_returnsDouble() throws Exception {
|
|
114
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
114
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
115
|
115
|
method.setAccessible(true);
|
|
116
|
116
|
|
|
117
|
|
- assertThat(method.invoke(tdengineService, 12.34f)).isEqualTo("DOUBLE");
|
|
|
117
|
+ assertThat(method.invoke(tdengineService, "test_col", 12.34f)).isEqualTo("DOUBLE");
|
|
118
|
118
|
}
|
|
119
|
119
|
|
|
120
|
120
|
@Test
|
|
121
|
121
|
@DisplayName("getValueType: Double 返回 DOUBLE")
|
|
122
|
122
|
void getValueType_double_returnsDouble() throws Exception {
|
|
123
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
123
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
124
|
124
|
method.setAccessible(true);
|
|
125
|
125
|
|
|
126
|
|
- assertThat(method.invoke(tdengineService, 56.78)).isEqualTo("DOUBLE");
|
|
127
|
|
- assertThat(method.invoke(tdengineService, Double.valueOf(99.99))).isEqualTo("DOUBLE");
|
|
|
126
|
+ assertThat(method.invoke(tdengineService, "test_col", 56.78)).isEqualTo("DOUBLE");
|
|
|
127
|
+ assertThat(method.invoke(tdengineService, "test_col", Double.valueOf(99.99))).isEqualTo("DOUBLE");
|
|
128
|
128
|
}
|
|
129
|
129
|
|
|
130
|
130
|
@Test
|
|
131
|
131
|
@DisplayName("getValueType: java.util.Date 返回 TIMESTAMP")
|
|
132
|
132
|
void getValueType_date_returnsTimestamp() throws Exception {
|
|
133
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
133
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
134
|
134
|
method.setAccessible(true);
|
|
135
|
135
|
|
|
136
|
|
- assertThat(method.invoke(tdengineService, new java.util.Date())).isEqualTo("TIMESTAMP");
|
|
|
136
|
+ assertThat(method.invoke(tdengineService, "test_col", new java.util.Date())).isEqualTo("TIMESTAMP");
|
|
137
|
137
|
}
|
|
138
|
138
|
|
|
139
|
139
|
@Test
|
|
140
|
140
|
@DisplayName("getValueType: java.sql.Timestamp 返回 TIMESTAMP")
|
|
141
|
141
|
void getValueType_timestamp_returnsTimestamp() throws Exception {
|
|
142
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
142
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
143
|
143
|
method.setAccessible(true);
|
|
144
|
144
|
|
|
145
|
|
- assertThat(method.invoke(tdengineService, new java.sql.Timestamp(System.currentTimeMillis()))).isEqualTo("TIMESTAMP");
|
|
|
145
|
+ assertThat(method.invoke(tdengineService, "test_col", new java.sql.Timestamp(System.currentTimeMillis()))).isEqualTo("TIMESTAMP");
|
|
146
|
146
|
}
|
|
147
|
147
|
|
|
148
|
148
|
@Test
|
|
149
|
149
|
@DisplayName("getValueType: java.time.LocalDateTime 返回 TIMESTAMP")
|
|
150
|
150
|
void getValueType_localDateTime_returnsTimestamp() throws Exception {
|
|
151
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
151
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
152
|
152
|
method.setAccessible(true);
|
|
153
|
153
|
|
|
154
|
|
- assertThat(method.invoke(tdengineService, java.time.LocalDateTime.now())).isEqualTo("TIMESTAMP");
|
|
|
154
|
+ assertThat(method.invoke(tdengineService, "test_col", java.time.LocalDateTime.now())).isEqualTo("TIMESTAMP");
|
|
155
|
155
|
}
|
|
156
|
156
|
|
|
157
|
157
|
@Test
|
|
158
|
158
|
@DisplayName("getValueType: java.time.Instant 返回 TIMESTAMP")
|
|
159
|
159
|
void getValueType_instant_returnsTimestamp() throws Exception {
|
|
160
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
160
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
161
|
161
|
method.setAccessible(true);
|
|
162
|
162
|
|
|
163
|
|
- assertThat(method.invoke(tdengineService, java.time.Instant.now())).isEqualTo("TIMESTAMP");
|
|
|
163
|
+ assertThat(method.invoke(tdengineService, "test_col", java.time.Instant.now())).isEqualTo("TIMESTAMP");
|
|
164
|
164
|
}
|
|
165
|
165
|
|
|
166
|
166
|
@Test
|
|
167
|
167
|
@DisplayName("getValueType: String 返回 VARCHAR")
|
|
168
|
168
|
void getValueType_string_returnsVarchar() throws Exception {
|
|
169
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
169
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
170
|
170
|
method.setAccessible(true);
|
|
171
|
171
|
|
|
172
|
|
- assertThat(method.invoke(tdengineService, "test")).isEqualTo("VARCHAR");
|
|
173
|
|
- assertThat(method.invoke(tdengineService, "")).isEqualTo("VARCHAR");
|
|
|
172
|
+ assertThat(method.invoke(tdengineService, "test_col", "test")).isEqualTo("VARCHAR");
|
|
|
173
|
+ assertThat(method.invoke(tdengineService, "test_col", "")).isEqualTo("VARCHAR");
|
|
174
|
174
|
}
|
|
175
|
175
|
|
|
176
|
176
|
@Test
|
|
177
|
177
|
@DisplayName("getValueType: null 返回 VARCHAR")
|
|
178
|
178
|
void getValueType_null_returnsVarchar() throws Exception {
|
|
179
|
|
- Method method = TdEngineService.class.getDeclaredMethod("getValueType", Object.class);
|
|
|
179
|
+ Method method = TdEngineService.class.getDeclaredMethod("getValueType", String.class, Object.class);
|
|
180
|
180
|
method.setAccessible(true);
|
|
181
|
181
|
|
|
182
|
|
- assertThat(method.invoke(tdengineService, (Object) null)).isEqualTo("VARCHAR");
|
|
|
182
|
+ assertThat(method.invoke(tdengineService, "test_col", (Object) null)).isEqualTo("VARCHAR");
|
|
183
|
183
|
}
|
|
184
|
184
|
|
|
185
|
185
|
@Test
|