This commit is contained in:
zyyang 2020-11-14 12:35:59 +08:00
parent deb6cd23f9
commit ee814ac85b
2 changed files with 15 additions and 12 deletions

View File

@ -1,14 +1,17 @@
spring: spring:
datasource: datasource:
driver-class-name: com.taosdata.jdbc.TSDBDriver # driver-class-name: com.taosdata.jdbc.TSDBDriver
url: jdbc:TAOS://master:6030/mp_test # url: jdbc:TAOS://localhost:6030/mp_test
user: root # user: root
password: taosdata # password: taosdata
# charset: UTF-8
# locale: en_US.UTF-8
# timezone: UTC-8
# driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://master:3306/test?useSSL=false url: jdbc:mysql://master:3306/test?useSSL=false
# username: root username: root
# password: 123456 password: 123456
logging: logging:
level: level:

View File

@ -34,23 +34,23 @@ public class WeatherMapperTest {
@Test @Test
public void testInsert() { public void testInsert() {
Weather weather = new Weather(); Weather weather = new Weather();
weather.setTs(new Timestamp(System.currentTimeMillis())); weather.setTs(new Timestamp(1605024000000l));
weather.setTemperature(random.nextFloat() * 50); weather.setTemperature(random.nextFloat() * 50);
weather.setHumidity(random.nextInt(100)); weather.setHumidity(random.nextInt(100));
weather.setLocation("望京"); weather.setLocation("wangjing");
int affectRows = mapper.insert(weather); int affectRows = mapper.insert(weather);
Assert.assertEquals(1, affectRows); Assert.assertEquals(1, affectRows);
} }
@Test @Test
public void testDelete() { public void testDelete() {
mapper.delete(new QueryWrapper<Weather>().eq("location", "望京")); mapper.delete(new QueryWrapper<Weather>().eq("location", "wangjing"));
} }
@Test @Test
public void testDeleteByMap() { public void testDeleteByMap() {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("location", "望京"); map.put("location", "wangjing");
int affectRows = mapper.deleteByMap(map); int affectRows = mapper.deleteByMap(map);
// Assert.assertEquals(0, affectRows); // Assert.assertEquals(0, affectRows);
} }