package com.bz.rmcp.alarm;
import java.util.Date;
import com.google.common.collect.Maps;

import com.bz.rmcp.alarm.service.impl.DeviceAlarmServiceImpl;
import com.zcxk.rmcp.api.dto.product.MeasureDataDto;
import com.zcxk.rmcp.core.mongo.DeviceData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.Map;

/**
 * @author linqingwei
 * @date 2021-08-06 9:37
 */
@RunWith(SpringRunner.class)
@SpringBootTest
@EnableCaching  //开启缓存
@ComponentScan(basePackages = {"com.zcxk","com.bz"})
@MapperScan("com.zcxk.rmcp.core.dao")
public class AlarmTests {

    @Autowired
    private DeviceAlarmServiceImpl deviceAlarmService;

    @Test
    public void alarm(){
        Map<String,Object> map = new HashMap<>();
        map.put("WSV",90);
        map.put("VALVE","01");

        MeasureDataDto measureDataDto = new MeasureDataDto();
        measureDataDto.setDeviceId(870001919702208512L);
        measureDataDto.setReceiveDate(new Date());
        measureDataDto.setMeasureMap(map);



        deviceAlarmService.handle(measureDataDto);
    }
}
