use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class AppHubInit method getRequestData.
protected byte[] getRequestData(String type, Map<String, Object> mapParam) {
Map<String, String> dbInfo = getDBInfo(type);
UAVHttpMessage request = new UAVHttpMessage();
request.putRequest("mrd.data", JSONHelper.toString(mapParam));
request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
String jsonStr = JSONHelper.toString(request);
byte[] datab = null;
try {
datab = jsonStr.getBytes("utf8");
} catch (Exception e) {
logger.err(this, "ManageBaseRestService getRequestData " + e.getMessage());
throw new ApphubException(e);
}
return datab;
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class AppHubManagerServerWorker method adaptRequest.
@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
String messageBody = message.getRequestBodyAsString("UTF-8");
if (log.isDebugEnable()) {
log.debug(this, "AppHubMangerServerWorker Request: " + messageBody);
}
UAVHttpMessage msg = new UAVHttpMessage(messageBody);
return msg;
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class HealthManagerServerWorker method adaptRequest.
@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
String messageBody = message.getRequestBodyAsString("UTF-8");
if (log.isDebugEnable()) {
log.debug(this, "HealthManagerServerWorker Request: " + messageBody);
}
UAVHttpMessage msg = new UAVHttpMessage(messageBody);
return msg;
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class DoTestOpenTSDBQuery method main.
@SuppressWarnings("resource")
public static void main(String[] args) throws ClientProtocolException, IOException {
String queryurl = "http://localhost:8765/hm/query";
HttpPost post = new HttpPost(queryurl);
HttpClient client = new DefaultHttpClient();
UAVHttpMessage request = new UAVHttpMessage();
request.putRequest("start", "146234606");
request.putRequest("end", "1462346020");
request.putRequest("metric", "urlResp.tmax");
request.putRequest("aggregator", "sum");
request.putRequest("downsample", "1ms-avg");
LinkedHashMap<String, String> tags = new LinkedHashMap<String, String>();
tags.put("ip", "127.0.0.1");
request.putRequest("tags", JSONHelper.toString(tags));
request.putRequest(DataStoreProtocol.DATASTORE_NAME, HealthManagerConstants.DataStore_Monitor);
String queryJson = JSONHelper.toString(request);
// String queryJson = "{\"request\":"
// +"{\"start\":\"1461908927\",\"end\":\"1461908932\","
// +"\"datastore.name\":\"monitorDataStore\","
// +"\"queries\":[{"
// +"\"aggregator\":\"sum\","
// +"\"metric\":\"urlResp.tmax\","
// +"\"downsample\":\"1ms-avg\","
// +"\"tags\":{\"ip\":\"127.0.0.1\"}"
// +"}]"
// +"},"
// +"\"responseAsJsonString\":\"{}\"}";
StringEntity entity = new StringEntity(queryJson);
post.setEntity(entity);
HttpResponse response = client.execute(post);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
String result = EntityUtils.toString(resEntity);
LOG.info(result);
}
}
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class HttpTestQuery method executeQuery.
public static void executeQuery(dataType4Test type) {
System.out.println("################### TEST CASE:: " + jsonQuery + " ####### \n");
HttpAsyncClient.build(1000, 1000, 100000, 100000, 100000);
String url = "http://localhost:8765/hm/query";
UAVHttpMessage request = new UAVHttpMessage();
String content = null;
switch(type) {
case profile:
// content = prepareMongoProfileDBdata(request);
// executeHttpCommand(url, content);
loopTest();
break;
case notfication:
content = prepareNotifcationData(request);
executeHttpCommand("NotifcationData", url, content);
break;
case monitor:
// executeHttpCommand("InfluxDBdata",url, content);
break;
case log:
content = prepareLogData(request);
executeHttpCommand("HBaseLogdata", url, content);
break;
default:
System.out.println("not support data type");
break;
}
}
Aggregations