Package com.dianping.cat.message.internal

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


  @Ignore
  public void testReadWrite() throws Exception {
    LocalMessageBucketManager localManager = (LocalMessageBucketManager) lookup(MessageBucketManager.class,
          LocalMessageBucketManager.ID);
    MessageBucketManager hdfsManager = lookup(MessageBucketManager.class, HdfsMessageBucketManager.ID);
    MessageIdFactory factory = new MockMessageIdFactory();
    long now = 1343532130488L;
    int num = 100;

    factory.setIpAddress("7f000001");
    factory.initialize("source");
    localManager.setBaseDir(new File("target/bucket/hdfs/dump")); // make local and hdfs base dir same

    for (int i = 0; i < num; i++) {
      MessageTree tree = newMessageTree(factory.getNextId(), i, now + i * 10L);
      MessageId id = MessageId.parse(tree.getMessageId());
      localManager.storeMessage(tree,id);
    }

    for (int i = 0; i < num; i++) {
View Full Code Here


  @Test
  public void generateDataFile() throws Exception {
    File idx = new File("/data/appdatas/cat/mmap.idx");
    File dat = new File("/data/appdatas/cat/mmap.dat");

    MessageIdFactory factory = lookup(MessageIdFactory.class);
    StringBuilder sb = new StringBuilder(8192);

    factory.initialize("cat");

    for (int i = 0; i < 100; i++) {
      createMessage(factory, sb, i);
    }
View Full Code Here

  }

  @Test
  public void updateWriterIndex() throws Exception {
    File idx = new File("/data/appdatas/cat/mmap.idx");
    MessageIdFactory factory = lookup(MessageIdFactory.class);
    StringBuilder sb = new StringBuilder(8192);

    factory.initialize("cat");

    for (int i = 0; i < 50; i++) {
      createMessage(factory, sb, i);
    }
View Full Code Here

    new File(System.getProperty("java.io.tmpdir"), "cat-" + domain + ".mark").delete();
  }

  private MessageIdFactory getMessageIdFactory(String ip, String domain) throws IOException {
    MessageIdFactory factory = new MockMessageIdFactory();

    factory.setIpAddress(ip);
    factory.initialize(domain);

    return factory;
  }
View Full Code Here

      e.printStackTrace();
    }
  }

  public void testReadWrite(String ip, String domain) throws Exception {
    MessageIdFactory factory = getMessageIdFactory(ip, domain);

    for (int i = 0; i < m_num; i++) {
      String messageId = factory.getNextId();
      DefaultMessageTree tree = newMessageTree(messageId, i, m_now + i * 10L);
      MessageId id = MessageId.parse(tree.getMessageId());

      ChannelBuffer buf = ChannelBuffers.dynamicBuffer(512); // 8K
      m_codec.encode(tree, buf);
View Full Code Here

  }

  @Test
  public void testReadWrite() throws Exception {
    setup();
    MessageIdFactory factory = new MockMessageIdFactory();
    LocalMessageBucket bucket = createBucket(factory, "");
    MessageCodec codec = lookup(MessageCodec.class, PlainTextMessageCodec.ID);

    int count = 2000;
    int i = 0;
View Full Code Here

  }

  public void testManyReadWrite() throws Exception {
    setup();

    MessageIdFactory factory = new MockMessageIdFactory();
    LocalMessageBucket[] buckets = new LocalMessageBucket[3];
    MessageCodec codec = lookup(MessageCodec.class, PlainTextMessageCodec.ID);

    for (int i = 0; i < buckets.length; i++) {
      LocalMessageBucket bucket = createBucket(factory, "-" + i);
View Full Code Here

TOP

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

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.