Package org.apache.uima.util

Examples of org.apache.uima.util.ProcessTraceEvent


  }

  protected ProcessTraceEvent getEvent(List aEvents, String aComponentName, String aType) {
    Iterator it = aEvents.iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      if (aComponentName.equals(event.getComponentName()) && aType.equals(event.getType())) {
        return event;
      } else {
        ProcessTraceEvent matchingSubEvt = getEvent(event.getSubEvents(), aComponentName, aType);
        if (matchingSubEvt != null) {
          return matchingSubEvt;
        }
      }
    }
View Full Code Here


  public String toString() {
    // count total time so we can do percentages
    int totalTime = 0;
    Iterator it = mEventList.iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      totalTime += event.getDuration();
    }

    // go back through and generate string
    StringBuffer buf = new StringBuffer();
    it = mEventList.iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      event.toString(buf, 0, totalTime);
    }

    return buf.toString();
  }
View Full Code Here

    }

    // recurse into child events
    Iterator it = aEvent.getSubEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      getEventsByComponentName(event, aComponentName, aRecurseAfterMatch, aResultList);
    }
  }
View Full Code Here

    }

    // recurse into child events
    Iterator it = aEvent.getSubEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      getEventsByType(event, aType, aRecurseAfterMatch, aResultList);
    }
  }
View Full Code Here

    pt.endEvent("c2", "t1", "success");
    Assert.assertEquals(2, pt.getEvents().size());

    // verify contents of the ProcessTrace
    List evts = pt.getEvents();
    ProcessTraceEvent evt0 = (ProcessTraceEvent) evts.get(0);
    Assert.assertEquals("c1", evt0.getComponentName());
    Assert.assertEquals("t1", evt0.getType());
    Assert.assertEquals("testing", evt0.getDescription());
    Assert.assertEquals("success", evt0.getResultMessage());
    List subEvts = evt0.getSubEvents();
    ProcessTraceEvent subEvt0 = (ProcessTraceEvent) subEvts.get(0);
    Assert.assertEquals("c1", subEvt0.getComponentName());
    Assert.assertEquals("t2", subEvt0.getType());
    Assert.assertEquals("testing", subEvt0.getDescription());
    Assert.assertEquals("success", subEvt0.getResultMessage());
    Assert.assertTrue(subEvt0.getSubEvents().isEmpty());

    ProcessTraceEvent evt1 = (ProcessTraceEvent) evts.get(1);
    Assert.assertEquals("c2", evt1.getComponentName());
    Assert.assertEquals("t1", evt1.getType());
    Assert.assertEquals("testing", evt1.getDescription());
    Assert.assertEquals("success", evt1.getResultMessage());
    Assert.assertEquals(3, evt1.getSubEvents().size());
  }
View Full Code Here

    // end event that we started
    pt.endEvent("c2", "t1", "success");
    // should be 2 events on list
    Assert.assertEquals(2, pt.getEvents().size());
    // 2nd event should have a sub-event
    ProcessTraceEvent evt = (ProcessTraceEvent) pt.getEvents().get(1);
    Assert.assertEquals(1, evt.getSubEvents().size());
  }
View Full Code Here

    pt.endEvent("c2", "t1", "success");

    // get top-level events for component c1
    List c1evts = pt.getEventsByComponentName("c1", false);
    Assert.assertEquals(1, c1evts.size());
    ProcessTraceEvent evt = (ProcessTraceEvent) c1evts.get(0);
    Assert.assertEquals(evt.getType(), "t1");

    // get all events for component c1
    c1evts = pt.getEventsByComponentName("c1", true);
    Assert.assertEquals(2, c1evts.size());
    evt = (ProcessTraceEvent) c1evts.get(1);
    Assert.assertEquals(evt.getType(), "t2");

    // get top-level events for component c2
    List c2evts = pt.getEventsByComponentName("c2", false);
    Assert.assertEquals(1, c2evts.size());
    evt = (ProcessTraceEvent) c2evts.get(0);
    Assert.assertEquals(evt.getType(), "t1");

    // get all events for component c2
    c2evts = pt.getEventsByComponentName("c2", true);
    Assert.assertEquals(4, c2evts.size());
    evt = (ProcessTraceEvent) c2evts.get(3);
    Assert.assertEquals(evt.getType(), "t4");
  }
View Full Code Here

    pt.endEvent("c2", "t1", "success");

    // get top-level events of type t1
    List t1evts = pt.getEventsByType("t1", false);
    Assert.assertEquals(2, t1evts.size());
    ProcessTraceEvent evt = (ProcessTraceEvent) t1evts.get(0);
    Assert.assertEquals(evt.getComponentName(), "c1");
    evt = (ProcessTraceEvent) t1evts.get(1);
    Assert.assertEquals(evt.getComponentName(), "c2");

    // get all events for type t1
    t1evts = pt.getEventsByType("t1", true);
    Assert.assertEquals(3, t1evts.size());
    evt = (ProcessTraceEvent) t1evts.get(2);
    Assert.assertEquals(evt.getComponentName(), "c3");
  }
View Full Code Here

    pt.startEvent("c3", "t1", "testing");
    pt.endEvent("c3", "t1", "testing");
    pt.startEvent("c2", "t3", "testing");
    pt.endEvent("c2", "t1", "success");

    ProcessTraceEvent evt = pt.getEvent("c2", "t2");
    Assert.assertEquals("c2", evt.getComponentName());
    Assert.assertEquals("t2", evt.getType());

    evt = pt.getEvent("c3", "t2");
    Assert.assertNull(evt);
  }
View Full Code Here

    pt2.addEvent("c2", "t2", "testing", 500, "success");
    pt2.endEvent("c2", "t1", "success");
    pt2.addEvent("c1", "t1", "testing", 250, "success");

    pt1.aggregate(pt2);
    ProcessTraceEvent c1evt = (ProcessTraceEvent) pt1.getEvents().get(0);
    ProcessTraceEvent c2evt = (ProcessTraceEvent) pt1.getEvents().get(1);
    ProcessTraceEvent c2subEvt = (ProcessTraceEvent) c2evt.getSubEvents().get(0);
    Assert.assertEquals(1250, c1evt.getDuration());
    Assert.assertEquals(1000, c2subEvt.getDuration());
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.util.ProcessTraceEvent

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.