Package com.dianping.cat.message.internal

Examples of com.dianping.cat.message.internal.DefaultTransaction


    Assert.assertEquals(false, manager.isJobMachine());
    Assert.assertEquals(false, manager.isLocalMode());
    Assert.assertEquals(true, manager.isServerService("Service"));
    Assert.assertEquals(false, manager.validateDomain("All"));
   
    Transaction t = new DefaultTransaction("Service", "piegonService:heartTaskService:heartBeat", null);
    Assert.assertEquals(true, manager.discardTransaction(t));

    manager.initialize(null);

    Assert.assertEquals(true, manager.getServerConfig() != null);
View Full Code Here


    tree.setMessageId("" + i);
    tree.setDomain(m_domain);
    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");

    DefaultTransaction t;

    if (i % 2 == 0) {
      t = new DefaultTransaction("PigeonCall", "Cat-Test-Call", null);
      DefaultEvent event = new DefaultEvent("PigeonCall.server", "192.168.1.0:3000:class:method1");

      event.setTimestamp(m_timestamp + 5 * 60 * 1000);
      event.setStatus(Message.SUCCESS);
      t.addChild(event);

      DefaultEvent eventApp = new DefaultEvent("PigeonCall.app", "server");

      eventApp.setTimestamp(m_timestamp + 5 * 60 * 1000 + 100);
      eventApp.setStatus(Message.SUCCESS);
      t.addChild(eventApp);
    } else {
      t = new DefaultTransaction("PigeonService", "Cat-Test-Service", null);
      DefaultEvent event = new DefaultEvent("PigeonService.client", "192.168.1.2:3000:class:method2");

      event.setTimestamp(m_timestamp + 5 * 60 * 1000);
      event.setStatus(Message.SUCCESS);
      t.addChild(event);

      DefaultEvent eventApp = new DefaultEvent("PigeonService.app", "client");

      eventApp.setTimestamp(m_timestamp + 5 * 60 * 1000 + 100);
      eventApp.setStatus(Message.SUCCESS);
      t.addChild(eventApp);
    }

    t.complete();
    t.setDurationInMillis(i * 2);
    t.setTimestamp(m_timestamp + 1000);
    tree.setMessage(t);

    return tree;
  }
View Full Code Here

    analyzer.setServerConfigManager(lookup(ServerConfigManager.class));
    analyzer.setIpConvertManager(new IpConvertManager());
    analyzer.setCrossAppSwitch(new CrossAppSwitch().setTurnOn(true));

    DefaultTransaction t = new DefaultTransaction("Other", "method1", null);
    MessageTree tree = buildMockMessageTree();
    CrossInfo info = analyzer.parseCorssTransaction(t, tree);

    Assert.assertEquals(true, info == null);
  }
View Full Code Here

    analyzer.setServerConfigManager(lookup(ServerConfigManager.class));
    analyzer.setIpConvertManager(new IpConvertManager());
    analyzer.setCrossAppSwitch(new CrossAppSwitch().setTurnOn(true));

    DefaultTransaction t = new DefaultTransaction("Call", "method1", null);
    MessageTree tree = buildMockMessageTree();
    CrossInfo info = analyzer.parseCorssTransaction(t, tree);

    Assert.assertEquals(info.getLocalAddress(), "192.168.0.1");
    Assert.assertEquals(info.getRemoteAddress(), "Unknown");

    Message message = new DefaultEvent("PigeonCall.server", "10.1.1.1", null);
    Message messageApp = new DefaultEvent("PigeonCall.app", "myDomain", null);
    t.addChild(message);
    t.addChild(messageApp);

    info = analyzer.parseCorssTransaction(t, tree);

    Assert.assertEquals(info.getLocalAddress(), "192.168.0.1");
    Assert.assertEquals(info.getRemoteAddress(), "10.1.1.1");
View Full Code Here

    analyzer.setServerConfigManager(lookup(ServerConfigManager.class));
    analyzer.setIpConvertManager(new IpConvertManager());
    analyzer.setCrossAppSwitch(new CrossAppSwitch().setTurnOn(true));

    DefaultTransaction t = new DefaultTransaction("Service", "method1", null);
    MessageTree tree = buildMockMessageTree();
    CrossInfo info = analyzer.parseCorssTransaction(t, tree);

    Assert.assertEquals(info.getLocalAddress(), "192.168.0.1");
    Assert.assertEquals(info.getRemoteAddress(), "192.168.7.70");

    Message message = new DefaultEvent("PigeonService.client", "192.168.7.71", null);
    Message messageApp = new DefaultEvent("PigeonService.app", "myDomain", null);
    t.addChild(message);
    t.addChild(messageApp);

    info = analyzer.parseCorssTransaction(t, tree);

    Assert.assertEquals(info.getLocalAddress(), "192.168.0.1");
    Assert.assertEquals(info.getRemoteAddress(), "192.168.7.71");
View Full Code Here

    trace.setTimestamp(timestamp);
    return trace;
  }

  private Transaction newTransaction(String type, String name, long timestamp, String status, int duration, String data) {
    DefaultTransaction transaction = new DefaultTransaction(type, name, null);

    transaction.setStatus(status);
    transaction.addData(data);
    transaction.complete();
    transaction.setTimestamp(timestamp);
    transaction.setDurationInMillis(duration);
    return transaction;
  }
View Full Code Here

    analyzer.setServerConfigManager(lookup(ServerConfigManager.class));
    analyzer.setIpConvertManager(new IpConvertManager());
    analyzer.setCrossAppSwitch(new CrossAppSwitch().setTurnOn(true));

    DefaultTransaction t = new DefaultTransaction("Service", "method1", null);
    MessageTree tree = buildMockMessageTree();
    CrossInfo info = analyzer.parseCorssTransaction(t, tree);

    Message message = new DefaultEvent("PigeonService.client", "192.168.7.71:29987", null);
    Message messageApp = new DefaultEvent("PigeonService.app", "myDomain", null);
    t.addChild(message);
    t.addChild(messageApp);

    info = analyzer.parseCorssTransaction(t, tree);

    Assert.assertEquals(info.getLocalAddress(), "192.168.0.1");
    Assert.assertEquals(info.getRemoteAddress(), "192.168.7.71");
View Full Code Here

    tree.setMessageId("" + i);
    tree.setDomain(m_domain);
    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");

    DefaultTransaction t = new DefaultTransaction("A", "n" + i % 2, null);
    DefaultTransaction t2 = new DefaultTransaction("A-1", "n" + i % 3, null);

    if (i % 2 == 0) {
      t2.setStatus("ERROR");
    } else {
      t2.setStatus(Message.SUCCESS);
    }

    t2.complete();
    t2.setDurationInMillis(i);

    t.addChild(t2);

    if (i % 2 == 0) {
      t.setStatus("ERROR");
    } else {
      t.setStatus(Message.SUCCESS);
    }

    t.complete();
    t.setDurationInMillis(i * 2);
    t.setTimestamp(m_timestamp + 1000);
    t2.setTimestamp(m_timestamp + 2000);
    tree.setMessage(t);

    return tree;
  }
View Full Code Here

    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");
    tree.setThreadGroupName("cat");
    tree.setThreadName("Cat-ProblemAnalyzer-Test");

    DefaultTransaction t = new DefaultTransaction("A", "n" + i % 2, null);

    t.setTimestamp(m_timestamp);
    t.setDurationInMillis(i * 50);

    switch (i % 7) {
    case 0:
      t.setType("URL");
      break;
    case 1:
      t.setType("Call");
      break;
    case 2:
      t.setType("Cache.");
      t.setDurationInMillis(i * 5);
      break;
    case 3:
      t.setType("SQL");
      break;
    case 4:
      t.setType("PigeonCall");
      break;
    case 5:
      t.setType("Service");
      break;
    case 6:
      t.setType("PigeonService");
      break;
    }

    tree.setMessage(t);

View Full Code Here

    tree.setMessageId("" + i);
    tree.setDomain(m_domain);
    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");

    DefaultTransaction t = new DefaultTransaction("A", "n" + i % 2, null);
    DefaultTransaction t2 = new DefaultTransaction("A-1", "n" + i % 3, null);

    if (i % 2 == 0) {
      t2.setStatus("ERROR");
    } else {
      t2.setStatus(Message.SUCCESS);
    }

    DefaultEvent event1 = new DefaultEvent("test2", "fail");
    event1.setTimestamp(m_timestamp + 5 * 60 * 1000);

    t2.addChild(event1);
    t2.complete();
    t2.setDurationInMillis(i);

    t.addChild(t2);

    if (i % 2 == 0) {
      t.setStatus("ERROR");
    } else {
      t.setStatus(Message.SUCCESS);
    }

    DefaultEvent event = new DefaultEvent("test1", "success");
    event.setTimestamp(m_timestamp + 5 * 60 * 1000);
    event.setStatus(Message.SUCCESS);
    t.addChild(event);

    t.complete();
    t.setDurationInMillis(i * 2);
    t.setTimestamp(m_timestamp + 1000);
    t2.setTimestamp(m_timestamp + 2000);
    tree.setMessage(t);

    return tree;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.message.internal.DefaultTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.