package com.elab.spring.monitor;

import com.alibaba.fastjson.JSON;
import com.elab.spring.config.SpringMvcConfig;
import com.google.common.base.Supplier;
import com.jay.monitor.data.client.config.ClientMonitorAutoConfiguration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

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

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ClientMonitorAutoConfiguration.class, SpringMvcConfig.class})
public class MonitorCollectTest {

    @Test
    public void testSendServiceDataSuccess() throws Throwable {
        String[] author = {"liukx", "jayzhou"};

        Map map = new HashMap<>();
        map.put("username", "jayzhou");
        map.put("password", "1234567");
        map.put("id", "7845");
        map.put("name", "可惜不是你,陪我到最后");

        Map res = new HashMap<>();
        res.put("test_id", 12312321);

        Object result = MonitorCollect.SERVICE.send(author, "my", "user", "login", "222", map, () -> {
            //            Thread.sleep(5000);
            return res;
        });

        System.out.println(JSON.toJSONString(result));

        System.in.read();
    }

    public Object testMethod() {
        return null;
    }

    public void testSendServiceDataFail() {
    }
}