Package org.apache.uima.util

Examples of org.apache.uima.util.ProcessTraceEvent


        }
        if (logCas) {
          String ip = "no IP";
          List eList = aStatus.getProcessTrace().getEventsByComponentName("UimaEE", false);
          for (int e = 0; e < eList.size(); e++) {
            ProcessTraceEvent event = (ProcessTraceEvent) eList.get(e);
            if (event.getDescription().equals("Service IP")) {
              ip = event.getResultMessage();
            }
          }
          String casId = ((UimaASProcessStatus) aStatus).getCasReferenceId();
          if (casId != null) {
            long current = System.nanoTime() / 1000000 - mStartTime;
View Full Code Here


        if (parentCasReferenceId == null) {
          processCountLatch.countDown();
        }
        List eList = aProcessStatus.getProcessTrace().getEventsByComponentName("UimaEE", false);
        for (int i = 0; i < eList.size(); i++) {
          ProcessTraceEvent eEvent = (ProcessTraceEvent) eList.get(i);
          System.out.println("runTest: Received Process Event - " + eEvent.getDescription()
                  + " Duration::" + eEvent.getDuration() + " ms"); // / (float) 1000000);
          // Check if the running test wants to check how long the processing of CAS took
          if (expectedProcessTime > 0
                  && "Total Time In Process CAS".equals(eEvent.getDescription())) {
            // Check if the expected duration exceeded actual duration for processing
            // a CAS. Allow 50ms difference.
            if (eEvent.getDuration() > expectedProcessTime
                    && (eEvent.getDuration() % expectedProcessTime) > 50) {
              System.out.println("!!!!!!!!!!!!! runTest: Expected Process CAS Duration of:"
                      + expectedProcessTime + " ms. Instead Process CAS Took:"
                      + eEvent.getDuration());
              unexpectedException = true;
            }
          }

        }
View Full Code Here

  private void copyComponentEvents(String aEvType, List aList, ProcessTrace aPTr)
          throws IOException {
    String typeS;

    for (int i = 0; i < aList.size(); i++) {
      ProcessTraceEvent prEvent = (ProcessTraceEvent) aList.get(i);
      typeS = prEvent.getType();
      if (aEvType != null && aEvType.equals(typeS)) {
        aPTr.addEvent(prEvent);
      }
    }
  }
View Full Code Here

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

    // verify contents of the ProcessTrace
    List<ProcessTraceEvent> 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<ProcessTraceEvent> 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

    // count total time
    long totalTime = 0;
    Iterator it = aProcessTrace.getEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      totalTime += event.getDuration();
    }
    double totalTimeSeconds = (double) totalTime / 1000;
    totalTimeLabel.setText("Total Time: " + totalTimeSeconds + " seconds");

    // create root tree node
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("100% (" + totalTime
            + "ms) - Collection Processing Engine");
    // build tree
    it = aProcessTrace.getEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      buildEventTree(event, root, totalTime);
    }
    tree.setModel(new DefaultTreeModel(root));

    this.setVisible(true);
View Full Code Here

    DefaultMutableTreeNode node = new DefaultMutableTreeNode(pctStr + " (" + duration + "ms) - "
            + aEvent.getComponentName() + " (" + type + ")");
    aParentNode.add(node);
    Iterator it = aEvent.getSubEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      buildEventTree(event, node, aTotalTime);
    }
  }
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<ProcessTraceEvent> 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<ProcessTraceEvent> 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<ProcessTraceEvent> 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

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.