use of com.creditease.monitor.log.ConsoleLogger in project uavstack by uavorg.
the class DoTestHttpAsyncClientProxy method main.
public static void main(String[] args) {
ConsoleLogger cl = new ConsoleLogger("test");
cl.setDebugable(true);
UAVServer.instance().setLog(cl);
UAVServer.instance().putServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR, ServerVendor.TOMCAT);
HttpAsyncClientHookProxy p = new HttpAsyncClientHookProxy("test", Collections.emptyMap());
p.doInstallDProxy(null, "testApp");
testClientWithoutCallback(HttpAsyncClients.custom().build());
testClientWithoutCallback(HttpAsyncClients.createMinimal());
testClientWithoutCallback(HttpAsyncClients.createDefault());
testClientWithoutCallback(HttpAsyncClients.createPipelining());
testClientWithoutCallback(HttpAsyncClients.createSystem());
testClient(HttpAsyncClients.custom().build());
testClient(HttpAsyncClients.createMinimal());
testClient(HttpAsyncClients.createDefault());
testClient(HttpAsyncClients.createPipelining());
testClient(HttpAsyncClients.createSystem());
}
use of com.creditease.monitor.log.ConsoleLogger in project uavstack by uavorg.
the class DoTestMongoClientProxy method main.
public static void main(String[] args) {
ConsoleLogger cl = new ConsoleLogger("test");
cl.setDebugable(true);
UAVServer.instance().setLog(cl);
UAVServer.instance().putServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR, ServerVendor.TOMCAT);
MongoClientHookProxy p = new MongoClientHookProxy("test", Collections.emptyMap());
p.doInstallDProxy(null, "testApp");
MongoClient client = new MongoClient();
client.listDatabaseNames().first();
MongoDatabase db = client.getDatabase("apphubDataStore");
db.listCollectionNames().first();
MongoCollection<Document> collection = db.getCollection("test");
collection.listIndexes().first();
Document doc = new Document("name", "Amarcord Pizzeria").append("contact", new Document("phone", "264-555-0193").append("email", "amarcord.pizzeria@example.net").append("location", Arrays.asList(-73.88502, 40.749556))).append("stars", 2).append("categories", Arrays.asList("Pizzeria", "Italian", "Pasta"));
collection.insertOne(doc);
collection.find().first();
MongoClient client2 = new MongoClient("localhost:27017");
db = client2.getDatabase("apphubDataStore");
db.listCollectionNames().first();
collection = db.getCollection("test");
collection.listIndexes().first();
client.close();
client2.close();
}
use of com.creditease.monitor.log.ConsoleLogger in project uavstack by uavorg.
the class DoTestJaxWSHook method main.
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) {
ConsoleLogger cl = new ConsoleLogger("test");
cl.setDebugable(true);
UAVServer.instance().setLog(cl);
UAVServer.instance().putServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR, ServerVendor.TOMCAT);
Map config = new HashMap();
Map adapts = JSONHelper.toObject("{\"org.apache.cxf.frontend.ClientProxy\":{\"getClient\":{args:[\"java.lang.Object\"],target:0}}}", Map.class);
config.put("adapts", adapts);
JaxWSHookProxy jp = new JaxWSHookProxy("test", config);
jp.doInstallDProxy(null, "test");
TestService_Service s = new TestService_Service();
TestService ts = s.getTestServicePort();
// 设置客户端的配置信息,超时等.
Client proxy = ClientProxy.getClient(ts);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
// 连接服务器超时时间
policy.setConnectionTimeout(30000);
// 等待服务器响应超时时间
policy.setReceiveTimeout(30000);
conduit.setClient(policy);
ts.echo();
try {
ts.echoFault();
} catch (Exception e) {
e.printStackTrace();
}
Dispatch<SOAPMessage> d = s.createDispatch(new QName("http://service.fat.monitorframework.creditease.com/", "TestServicePort"), SOAPMessage.class, Mode.MESSAGE);
try {
SOAPMessage msg = MessageFactory.newInstance().createMessage();
d.invoke(msg);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("--------------->CECXFClient");
CECXFClient client = new CECXFClient(TestService_Service.class, TestService.class, TestService_Service.TestServicePort);
client.setConnectTimeout(30000);
client.setReceiveTimeout(30000);
try {
client.invoke("echo", null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of com.creditease.monitor.log.ConsoleLogger in project uavstack by uavorg.
the class DoTestHttpClient3Proxy method main.
public static void main(String[] args) {
ConsoleLogger cl = new ConsoleLogger("test");
cl.setDebugable(true);
UAVServer.instance().setLog(cl);
UAVServer.instance().putServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR, ServerVendor.TOMCAT);
HttpClient3HookProxy p = new HttpClient3HookProxy("test", Collections.emptyMap());
p.doInstallDProxy(null, "testApp");
testClient();
}
use of com.creditease.monitor.log.ConsoleLogger in project uavstack by uavorg.
the class DoTestHttpClientProxy method main.
public static void main(String[] args) {
ConsoleLogger cl = new ConsoleLogger("test");
cl.setDebugable(true);
UAVServer.instance().setLog(cl);
UAVServer.instance().putServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR, ServerVendor.TOMCAT);
HttpClientHookProxy p = new HttpClientHookProxy("test", Collections.emptyMap());
p.doInstallDProxy(null, "testApp");
// testDefaultClient();
testClient(HttpClients.createDefault());
// testClient(HttpClients.createMinimal());
// testClient(HttpClients.createSystem());
}
Aggregations