/** Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace. */
 @Test
 public void testCtfIterator_init() {
   trace.init("test");
   try (CtfIterator result = (CtfIterator) trace.createIterator(); ) {
     assertNotNull(result);
   }
 }
  /** Run the benchmark with 2 small traces */
  @Test
  public void testSmallTraces() {
    assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists());
    assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists());

    CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace();
    CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();

    Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2);
    runCpuTest(traces, "Match TCP events", 100);

    trace1.dispose();
    trace2.dispose();
  }
 /** Run the int compareTo(CtfIterator) method test. */
 @Test
 public void testCompareTo() {
   try (CtfIterator o = (CtfIterator) trace.createIterator(); ) {
     int result = iterator.compareTo(o);
     assertEquals(1L, result);
   }
 }
 /** Perform pre-test initialization. */
 @Before
 public void setUp() {
   trace = CtfTmfTestTraceUtils.getTrace(testTrace);
   iterator = (CtfIterator) trace.createIterator();
   CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
   iterator.setLocation(ctfLocation);
   iterator.increaseRank();
 }
 /**
  * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which specifies an initial
  * position for the iterator.
  */
 @Test
 public void testCtfIterator_position() {
   long timestampValue = 1L;
   long rank = 1L;
   try (CtfIterator result =
       (CtfIterator) trace.createIterator(new CtfLocationInfo(timestampValue, 0), rank); ) {
     assertNotNull(result);
   }
 }
 /** Perform post-test clean-up. */
 @After
 public void tearDown() {
   if (trace != null) {
     trace.dispose();
   }
   if (iterator != null) {
     iterator.dispose();
   }
 }
  /**
   * Run the boolean equals(Object) method test. Compare with another iterator on the same trace.
   */
  @Test
  public void testEquals_other() {
    try (CtfIterator obj = (CtfIterator) trace.createIterator(); ) {
      assertNotNull(obj);
      CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
      obj.setLocation(ctfLocation1);
      obj.increaseRank();

      boolean result = iterator.equals(obj);
      assertTrue(result);
    }
  }
  /** Run the benchmark with 3 bigger traces */
  @Test
  public void testDjangoTraces() {
    assumeTrue(CtfTmfTestTrace.DJANGO_CLIENT.exists());
    assumeTrue(CtfTmfTestTrace.DJANGO_DB.exists());
    assumeTrue(CtfTmfTestTrace.DJANGO_HTTPD.exists());

    CtfTmfTrace trace1 = CtfTmfTestTrace.DJANGO_CLIENT.getTrace();
    CtfTmfTrace trace2 = CtfTmfTestTrace.DJANGO_DB.getTrace();
    CtfTmfTrace trace3 = CtfTmfTestTrace.DJANGO_HTTPD.getTrace();

    Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2, trace3);
    runCpuTest(traces, "Django traces", 10);
    runMemoryTest(traces, "Django traces", 10);

    trace1.dispose();
    trace2.dispose();
    trace3.dispose();
  }