Search in sources :

Example 6 with ConsoleLogger

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());
}
Also used : HttpAsyncClientHookProxy(com.creditease.uav.hook.httpclients.async.HttpAsyncClientHookProxy) ConsoleLogger(com.creditease.monitor.log.ConsoleLogger)

Example 7 with ConsoleLogger

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();
}
Also used : MongoClient(com.mongodb.MongoClient) ConsoleLogger(com.creditease.monitor.log.ConsoleLogger) Document(org.bson.Document) MongoDatabase(com.mongodb.client.MongoDatabase)

Example 8 with ConsoleLogger

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();
    }
}
Also used : HashMap(java.util.HashMap) TestService_Service(com.creditease.monitorframework.fat.client.TestService_Service) TestService(com.creditease.monitorframework.fat.client.TestService) QName(javax.xml.namespace.QName) SOAPMessage(javax.xml.soap.SOAPMessage) HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) ConsoleLogger(com.creditease.monitor.log.ConsoleLogger) HTTPClientPolicy(org.apache.cxf.transports.http.configuration.HTTPClientPolicy) CECXFClient(com.creditease.monitorframework.fat.client.CECXFClient) Client(org.apache.cxf.endpoint.Client) CECXFClient(com.creditease.monitorframework.fat.client.CECXFClient) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with ConsoleLogger

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();
}
Also used : HttpClient3HookProxy(com.creditease.uav.hook.httpclients3.sync.HttpClient3HookProxy) ConsoleLogger(com.creditease.monitor.log.ConsoleLogger)

Example 10 with ConsoleLogger

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());
}
Also used : ConsoleLogger(com.creditease.monitor.log.ConsoleLogger) HttpClientHookProxy(com.creditease.uav.hook.httpclients.sync.HttpClientHookProxy)

Aggregations

ConsoleLogger (com.creditease.monitor.log.ConsoleLogger)10 HashMap (java.util.HashMap)4 DefaultMQPushConsumer (com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer)1 ConsumeConcurrentlyContext (com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext)1 ConsumeConcurrentlyStatus (com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus)1 ConsumeOrderlyContext (com.alibaba.rocketmq.client.consumer.listener.ConsumeOrderlyContext)1 ConsumeOrderlyStatus (com.alibaba.rocketmq.client.consumer.listener.ConsumeOrderlyStatus)1 MessageListenerConcurrently (com.alibaba.rocketmq.client.consumer.listener.MessageListenerConcurrently)1 MessageListenerOrderly (com.alibaba.rocketmq.client.consumer.listener.MessageListenerOrderly)1 MQBrokerException (com.alibaba.rocketmq.client.exception.MQBrokerException)1 MQClientException (com.alibaba.rocketmq.client.exception.MQClientException)1 DefaultMQProducer (com.alibaba.rocketmq.client.producer.DefaultMQProducer)1 Message (com.alibaba.rocketmq.common.message.Message)1 MessageExt (com.alibaba.rocketmq.common.message.MessageExt)1 RemotingException (com.alibaba.rocketmq.remoting.exception.RemotingException)1 CECXFClient (com.creditease.monitorframework.fat.client.CECXFClient)1 TestService (com.creditease.monitorframework.fat.client.TestService)1 TestService_Service (com.creditease.monitorframework.fat.client.TestService_Service)1 CacheManager (com.creditease.uav.cache.api.CacheManager)1 HttpAsyncClientHookProxy (com.creditease.uav.hook.httpclients.async.HttpAsyncClientHookProxy)1