package com.neverwinterdp.scribengin.storage.kafka.perftest;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.neverwinterdp.kafka.tool.server.KafkaCluster;
import com.neverwinterdp.scribengin.storage.kafka.perftest.KafkaPerfTest;

public class PerfTestUnitTest {
  private KafkaCluster cluster;

  @Before
  public void setUp() throws Exception {
    cluster = new KafkaCluster("./build/cluster", 1, 1);
    cluster.setNumOfPartition(5);
    cluster.start();
    Thread.sleep(3000);
  }
  
  @After
  public void tearDown() throws Exception {
    cluster.shutdown();
  }

  @Test
  public void testPerf() throws Exception {
    String[] args = {
        "--topics", "tracking.input,tracking.info,tracking.warn,tracking.error,tracking.aggregate",

        "--zk-connect", "127.0.0.1:2181",
        "--topic-num-of-message", "10000",
        "--topic-num-of-partition", "10",
        "--topic-num-of-replication", "1",
        
        "--writer-write-per-writer", "1000",
        "--writer-write-break-in-period", "25",
        
        "--reader-read-per-reader", "1000",
        "--reader-run-delay", "5000"
    };
    KafkaPerfTest.main(args);
  }
}

@@ -852,18 +852,23 @@
 ssage%22, 
-%221
+    %2250
 0000%22,%0A 
@@ -901,16 +901,18 @@
 tition%22,
+  
  %2210%22,%0A 
@@ -1144,16 +1144,51 @@
 , %225000%22
+,%0A        %22--max-runtime%22, %22600000%22
 %0A    %7D;%0A

fix timeout