BenchmarkingHiveApplicationTests.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.gyee.benchmarkinghive;
  2. import com.gyee.benchmarkinghive.model.auto.Windpowerstation;
  3. import com.gyee.benchmarkinghive.service.WindpowerstationService;
  4. import com.gyee.benchmarkinghive.util.taos.EdosUtil;
  5. import lombok.extern.slf4j.Slf4j;
  6. import org.junit.jupiter.api.Test;
  7. import org.junit.runner.RunWith;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.beans.factory.annotation.Qualifier;
  10. import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  11. import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  12. import org.springframework.boot.test.context.SpringBootTest;
  13. import org.springframework.jdbc.core.JdbcTemplate;
  14. import org.springframework.test.context.junit4.SpringRunner;
  15. import java.util.List;
  16. import java.util.Map;
  17. @Slf4j
  18. @SpringBootTest
  19. @RunWith(SpringRunner.class)
  20. @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
  21. class BenchmarkingHiveApplicationTests {
  22. private EdosUtil edosUtil = new EdosUtil();
  23. @Autowired
  24. private JdbcTemplate jdbcTemplateImpala;
  25. @Autowired
  26. private WindpowerstationService windpowerstationService;
  27. @Test
  28. public void testImpalaJdbcTemplate() {
  29. log.info("impala jdbctemplate connection start:");
  30. 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';";
  31. List<Map<String, Object>> maps = jdbcTemplateImpala.queryForList(sql);
  32. log.info("impalaJdbcTemplate query result :\t" + maps);
  33. }
  34. @Test
  35. public void testTaosTemplate() throws Exception {
  36. log.info("testTaos connection start:");
  37. double pointValueInDouble = edosUtil.getRealData("SBQFJ.NX_GD_SBQF_FJ_P1_L1_001_AI0009").getPointValueInDouble();
  38. log.info("testTaos query result :\t" + pointValueInDouble);
  39. }
  40. @Test
  41. public void test1() throws Exception {
  42. List<Windpowerstation> windpowerstations = windpowerstationService.wpList();
  43. log.info("testTaos query result :\t" + windpowerstations);
  44. }
  45. }