package com.gyee.benchmarkinghive; import com.gyee.benchmarkinghive.model.auto.Windpowerstation; import com.gyee.benchmarkinghive.service.WindpowerstationService; import com.gyee.benchmarkinghive.util.taos.EdosUtil; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.junit4.SpringRunner; import java.util.List; import java.util.Map; @Slf4j @SpringBootTest @RunWith(SpringRunner.class) @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) class BenchmarkingHiveApplicationTests { private EdosUtil edosUtil = new EdosUtil(); @Autowired private JdbcTemplate jdbcTemplateImpala; @Autowired private WindpowerstationService windpowerstationService; @Test public void testImpalaJdbcTemplate() { log.info("impala jdbctemplate connection start:"); String sql = "select * from scada_history.gdnxfd_sbq where tagname = 'SBQFJ.NX_GD_SBQF_FJ_P1_L1_001_DI0008' and point_time >= '2021-04-12 00:00:04' and point_time <= '2021-04-18 00:00:04';"; List> maps = jdbcTemplateImpala.queryForList(sql); log.info("impalaJdbcTemplate query result :\t" + maps); } @Test public void testTaosTemplate() throws Exception { log.info("testTaos connection start:"); double pointValueInDouble = edosUtil.getRealData("SBQFJ.NX_GD_SBQF_FJ_P1_L1_001_AI0009").getPointValueInDouble(); log.info("testTaos query result :\t" + pointValueInDouble); } @Test public void test1() throws Exception { List windpowerstations = windpowerstationService.wpList(); log.info("testTaos query result :\t" + windpowerstations); } }