Package org.apache.uima.collection

Examples of org.apache.uima.collection.CollectionProcessingEngine


      int exceptionSequence = 4; // the sequence in which errors are produced
      boolean manuallyAborted = false; // flag, if we shut down the cpm by hand.
      ManageOutputDevice.setAllSystemOutputToNirvana();

      // setup CPM
      CollectionProcessingEngine cpe = setupCpm(documentCount,
            "NullPointerException", exceptionSequence, "hasNext");

      // Create and register a Status Callback Listener
      TestStatusCallbackListener listener = new CollectionReaderStatusCallbackListener(
            cpe);
      cpe.addStatusCallbackListener(listener);

      cpe.process();

      // wait until cpm has finished
      Date d = new Date();
      long time = d.getTime() + 1000 * TIMEOUT;
      while (!listener.isFinished() && !listener.isAborted()) {
         Thread.sleep(5);
         d = new Date();
         // timeout mechanism
         if (time < d.getTime()) {
            manuallyAborted = true;
            cpe.stop();
            // wait until CPM has aborted
            while (!listener.isAborted()) {
               Thread.sleep(5);
            }
         }
View Full Code Here


      // thrown
      ManageOutputDevice.setAllSystemOutputToNirvana();

      try {
         // setup CPM
         CollectionProcessingEngine cpe = setupCpm(documentCount,
               "ResourceInitializationException", exceptionSequence,
               "initialize");

         // Create and register a Status Callback Listener
         listener = new CollectionReaderStatusCallbackListener(cpe);
         cpe.addStatusCallbackListener(listener);

         cpe.process();

         // wait until cpm has finished

         while (!listener.isFinished() && !listener.isAborted()) {
            Thread.sleep(5);
View Full Code Here

      ManageOutputDevice.setAllSystemOutputToNirvana();
      TestStatusCallbackListener listener = null;

      try {
         // setup CPM
         CollectionProcessingEngine cpe = setupCpm(documentCount,
               "NullPointerException", exceptionSequence, "initialize");

         // Create and register a Status Callback Listener
         listener = new CollectionReaderStatusCallbackListener(cpe);
         cpe.addStatusCallbackListener(listener);

         cpe.process();

         // wait until cpm has finished
         while (!listener.isFinished() && !listener.isAborted()) {
            Thread.sleep(5);
         }
View Full Code Here

      // which the
      // statusinformation are made avaiable

      try {
         // setup CPM
         CollectionProcessingEngine cpe = setupCpm(documentCount,
               "OutOfMemoryError", exceptionSequence, "initialize");

         // Create and register a Status Callback Listener
         listener = new CollectionReaderStatusCallbackListener(cpe);
         cpe.addStatusCallbackListener(listener);

         cpe.process();

         // wait until cpm has finished
         while (!listener.isFinished() && !listener.isAborted()) {
            Thread.sleep(5);
         }
View Full Code Here

      int documentCount = 20; // number of documents processed
      int exceptionSequence = 3; // the sequence in which errors are produced
      ManageOutputDevice.setAllSystemOutputToNirvana();

      // setup CPM
      CollectionProcessingEngine cpe = setupCpm(documentCount, "IOException",
            exceptionSequence, "getProgress");

      // Create and register a Status Callback Listener
      TestStatusCallbackListener listener = new CollectionReaderStatusCallbackListener(
            cpe);
      cpe.addStatusCallbackListener(listener);

      cpe.process();

      // wait until cpm has finished
      while (!listener.isFinished() && !listener.isAborted()) {
         Thread.sleep(5);
      }
View Full Code Here

      int documentCount = 20; // number of documents processed
      int exceptionSequence = 3; // the sequence in which errors are produced
      ManageOutputDevice.setAllSystemOutputToNirvana();

      // setup CPM
      CollectionProcessingEngine cpe = setupCpm(documentCount,
            "OutOfMemoryError", exceptionSequence, "getProgress");

      // Create and register a Status Callback Listener
      CollectionReaderStatusCallbackListener listener = new CollectionReaderStatusCallbackListener(
            cpe);
      cpe.addStatusCallbackListener(listener);

      cpe.process();

      // wait until cpm has finished
      while (!listener.isFinished() && !listener.isAborted()) {
         Thread.sleep(5);
      }
View Full Code Here

  public void testInitSingleThreadCPMMode() throws Exception {
    int documentCount = 10000000;
    int threadCount = 1;

    // setup CPM to process 1 documents
    CollectionProcessingEngine cpe = setupCpm(documentCount, threadCount, false, true);

    // create and register a status callback listener
    TestStatusCallbackListener listener = new TestStatusCallbackListener();
    cpe.addStatusCallbackListener(listener);

    // run CPM
    cpe.process();

    // wait for initialized call from the CPM
    while (!listener.isInitialized()) {
      Thread.sleep(10);
    }
    System.out.println("SingleThreadCPMMode Initialize was called: " + listener.isInitialized());

    // Let the CPM process some docs, before calling stop
    Thread.sleep(300);

    // stop CPM
    cpe.stop();

    // wait until CPM has aborted
    while (!listener.isAborted()) {
      Thread.sleep(5);
    }
View Full Code Here

  public void testInitMultiThreadCPMMode() throws Exception {
    int documentCount = 10000000; // hopefully enough that we won't finish before we abort
    int threadCount = 1;

    // setup CPM to process 1 documents
    CollectionProcessingEngine cpe = setupCpm(documentCount, threadCount, false, false);

    // create and register a status callback listener
    TestStatusCallbackListener listener = new TestStatusCallbackListener();
    cpe.addStatusCallbackListener(listener);

    // run CPM
    cpe.process();

    while (!listener.isInitialized()) {
      Thread.sleep(10);
    }
    System.out.println("MultiThreadCPMMode Initialize was called: " + listener.isInitialized());

    // Let the CPM process some docs, before calling stop
    Thread.sleep(300);

    // stop CPM
    cpe.stop();

    // wait until CPM has aborted
    while (!listener.isAborted()) {
      Thread.sleep(5);
    }
View Full Code Here

  public void testInitMultiThreadCPM() throws Exception {
    int documentCount = 10000000;
    int threadCount = 3;

    // setup CPM to process documents
    CollectionProcessingEngine cpe = setupCpm(documentCount, threadCount, false, false);

    // create and register a status callback listener
    TestStatusCallbackListener listener = new TestStatusCallbackListener();
    cpe.addStatusCallbackListener(listener);

    // run CPM
    cpe.process();

    while (!listener.isInitialized()) {
      Thread.sleep(10);
    }
    System.out.println("testInitMultiThreadCPM()-Initialize was called: "
            + listener.isInitialized());
    // Let the CPM process some docs, before calling stop
    Thread.sleep(300);

    // stop CPM
    cpe.stop();

    // wait until CPM has aborted
    while (!listener.isAborted()) {
      Thread.sleep(5);
    }
View Full Code Here

   * @return CollectionProcessingEngine - initialized cpe
   */
  private CollectionProcessingEngine setupCpm(int documentCount, int threadCount,
          boolean useSlowAnnotator, boolean singleThreaded) throws Exception {
    CpeDescription cpeDesc = null;
    CollectionProcessingEngine cpe = null;

    try {
      String colReaderBase = JUnitExtension.getFile("CpmTests" + separator
              + "ErrorTestCollectionReader.xml").getAbsolutePath();
      String taeBase = JUnitExtension.getFile("CpmTests" + separator + "ErrorTestAnnotator.xml").getAbsolutePath();
View Full Code Here

TOP

Related Classes of org.apache.uima.collection.CollectionProcessingEngine

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.