package com.cesgroup.cesmonitor.test;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.cesgroup.cesmonitor.service.MapService;

public class MapTest extends MyTest {

    @Autowired
    MapService mapService;

    //	//@Test
    //	public void listHost(){
    //		try {
    //			List<HostGetResponse.Result> list=mapService.listHost();
    //			logger.debug(Util.toJSON2(list));
    //		} catch (Exception e) {
    //			// TODO Auto-generated catch block
    //			e.printStackTrace();
    //		}
    //	}

    //@Test
    public void createHostMap() {
        try {
            List<String> ips = new ArrayList<String>();
            ips.add("192.168.10.254");
            ips.add("192.168.20.254");
            //            //            ips.add("192.168.30.254");
            mapService.createFromHosts("拓扑test", ips, 4);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Test
    public void createHostMapUpdate() {
        try {
            List<String> ips = new ArrayList<String>();
            ips.add("192.168.10.254");
            ips.add("192.168.20.254");
            //            //            ips.add("192.168.30.254");
            mapService.createFromHostsUpdate(457, ips);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    //@Test
    public void createMapFromITService() {
        try {
            mapService.createFromITService(1);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    //@Test
    public void createMapFromITServiceUpdate() {
        try {
            mapService.createFromITServiceUpdate(460, 1);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    //@Test
    public void createAuto() {
        try {
            mapService.createAuto("拓扑图" + new Date().toString(), "10.250.200.254", "public");
            //            mapService.createAuto("拓扑图" + new Date().toString(), "10.250.200.2");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    //@Test
    public void autoUpdate() {
        try {
            mapService.createAutoUpdate(456, "10.250.200.254", "public");
            //            mapService.createAuto("拓扑图" + new Date().toString(), "10.250.200.2");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}
