package test;
import java.net.URL;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringRunner;
import com.cmb.server.ServerApplication;
import com.cmb.server.dao.QueryDataDao;
import com.cmb.server.service.QueryDataService;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ServerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestSpring {
@LocalServerPort
private int port;
private URL base;
@Autowired
private QueryDataDao queryDataDao;
@Autowired
private QueryDataService queryDataService;
@Before
public void setUp() throws Exception {
String url = String.format("http://localhost:%d/", port);
System.out.println(String.format("port is : [%d]", port));
this.base = new URL(url);
}
/**
* 向"/test"地址发送请求,并打印返回结果
* @throws Exception
*/
@Test
public void test1(){
//Map<String,Object> totalMap = queryDataDao.queryIsiRtmTotalCountAndAmtDao("0000-01-01");
//System.out.println(queryDataDao.huiRuHuiChuMainByKeyDao("sss"));
try{
Map<String,Object> resultMap = queryDataService.topDataService();
System.out.println(resultMap);
}catch(Exception e){
e.printStackTrace();
}
}
}