Package com.dianping.cat.message.spi

Examples of com.dianping.cat.message.spi.MessageTree


   
    Thread.sleep(1000);

    for (int i = 0; i < m_num; i++) {
      String messageId = domain + "-" + ip + "-373203-" + i;
      MessageTree tree = m_manager.loadMessage(messageId);

      Assert.assertNotNull("Message " + i + " not found.", tree);
      if (tree != null) {
        Assert.assertEquals(messageId, tree.getMessageId());
      }
    }
  }
View Full Code Here


import com.dianping.cat.message.spi.MessageTree;
import com.dianping.cat.message.spi.internal.DefaultMessageTree;

public class CrossInfoTest extends ComponentTestCase {
  public MessageTree buildMockMessageTree() {
    MessageTree tree = new DefaultMessageTree();
    tree.setMessageId("Cat-c0a80746-373452-6");// 192.168.7.70 machine logview
    tree.setIpAddress("192.168.0.1");
    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");
View Full Code Here

      t5.addData("key and value");
      t5.setStatus(Message.SUCCESS);
      t5.complete();

      MessageTree tree = (MessageTree) Cat.getManager().getThreadLocalMessageTree();
      String messageId = tree.getMessageId();

      String[] ids = messageId.split("-");
      String ip6 = ids[1];

      String newMessageId = messageId.replaceAll(ip6, ip6.substring(0, ip6.length() - 1) + "" + i % 3);
      if (i % 3 == 1) {
        newMessageId = newMessageId.replaceAll("cat", "Cat1");
      } else if (i % 3 == 2) {
        newMessageId = newMessageId.replaceAll("cat", "Cat2");
      } else if (i % 3 == 0) {
        newMessageId = newMessageId.replaceAll("cat", "Cat0");
      }
      tree.setMessageId(newMessageId);
      t.complete();

      total.setStatus(Transaction.SUCCESS);
      total.complete();
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");
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);
View Full Code Here

      Transaction t = Cat.newTransaction("Neocortex", "Error");
     
      Cat.logError(able);
     

        MessageTree tree = Cat.getManager().getThreadLocalMessageTree();

        ((DefaultMessageTree) tree).setDomain("NeoCortex");
      t.complete();
  }
View Full Code Here

  }

  @Test
  public void testProcess() throws Exception {
    for (int i = 1; i <= 1000; i++) {
      MessageTree tree = generateMessageTree(i);

      m_analyzer.process(tree);
    }

    TransactionReport report = m_analyzer.getReport(m_domain);
View Full Code Here

    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("transaction_analyzer.xml"), "utf-8");
    Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));
  }

  protected MessageTree generateMessageTree(int i) {
    MessageTree tree = new DefaultMessageTree();

    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

TOP

Related Classes of com.dianping.cat.message.spi.MessageTree

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.