package cn.ksource.test.remote; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import cn.ksource.core.remote.BaseRemote; import cn.ksource.core.util.HttpRemoteException; import cn.ksource.core.util.JsonUtil; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"/applicationContext_core.xml"}) public class TestRemote { @Autowired private BaseRemote baseRemote; @Test public void testHttp() throws HttpRemoteException { // Map map = new HashMap(); // map.put("search_code", "12345"); // map.put("remark", "放松放松"); // map.put("reply_phone", "15803816250"); // map.put("config_item_third", "seffsd"); // map.put("search_code", "12345"); // map.put("order_type", "1"); // map.put("user_id", "aaaaff"); // map.put("order_detail", "fsdfsafsd"); // map.put("solve_time", "2014-05-15"); // map.put("reply_user", "测试用"); //// Map map1 = baseRemote.queryForMap("http://localhost:8080/cloud_cmdb/business/remote.html", map); //// System.out.println(JsonUtil.map2Json(map1)); // String s=baseRemote.queryForString("http://192.168.1.100:8080/cmdb/interface/CI_queryCategory.html", null); // System.out.println("s==="+s); // JSONArray arr=JSONArray.fromObject(s); // System.out.println("==aarr=="+arr); // List list=JsonUtil.json2List(s); // System.out.println("==========>"+list); } }