Package org.apache.uima.cas

Examples of org.apache.uima.cas.CAS.reset()


    // compare
    assertEquals(cas.getAnnotationIndex().size(), v1cas.getAnnotationIndex().size());

    // now a v1.x version of a multiple Sofa CAS
    v1cas.reset();
    serCasStream = new FileInputStream(JUnitExtension.getFile("ExampleCas/v1MultiSofaCas.xml"));
    deser = new XCASDeserializer(v1cas.getTypeSystem());
    deserHandler = deser.getXCASHandler(v1cas);
    fact = SAXParserFactory.newInstance();
    parser = fact.newSAXParser();
View Full Code Here


      //System.out.println("Heap size: " + heapSize + ", buffer size: " + bufSize);     
      assertTrue(heapSize <= bufSize);
      Assert.assertTrue(heapSize > CASImpl.DEFAULT_RESET_HEAP_SIZE);
     
      //reset the CAS - it should shrink
      cas.reset();
      heapSize = ((CASImpl) cas).getHeap().getCurrentTempSize();
      bufSize = ((CASImpl)cas).getHeap().heap.length;
      //System.out.println("Heap size: " + heapSize + ", buffer size: " + bufSize);
      assertTrue(heapSize <= bufSize);
      Assert.assertTrue(bufSize < CASImpl.DEFAULT_RESET_HEAP_SIZE);
View Full Code Here

        heapSize = ((CASImpl) cas).getHeap().getCurrentTempSize();
        bufSize = ((CASImpl)cas).getHeap().heap.length;
        //System.out.println("Heap size: " + heapSize + ", buffer size: " + bufSize);     
        assertTrue(heapSize <= bufSize);
        Assert.assertTrue(bufSize < CASImpl.DEFAULT_RESET_HEAP_SIZE);     
        cas.reset();
      }
 
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
View Full Code Here

    // compare
    assertEquals(cas.getAnnotationIndex().size(), v1cas.getAnnotationIndex().size());
    assertTrue(CAS.NAME_DEFAULT_SOFA.equals(v1cas.getSofa().getSofaID()));

    // now a v1 XMI version of a multiple Sofa CAS
    v1cas.reset();
    serCasStream = new FileInputStream(JUnitExtension.getFile("ExampleCas/xmiMsCasV1.xml"));
    deser2 = new XmiCasDeserializer(v1cas.getTypeSystem());
    deserHandler2 = deser2.getXmiCasHandler(v1cas);
    xmlReader.setContentHandler(deserHandler2);
    xmlReader.parse(new InputSource(serCasStream));
View Full Code Here

      //flow controller should not be notified
      assertTrue(FlowControllerForErrorTest.abortedDocuments.isEmpty());
      assertTrue(FlowControllerForErrorTest.failedAEs.isEmpty());
     
      //now one that fails
      cas.reset();
      cas.setDocumentText("ERROR");
      try {
        UIMAFramework.getLogger().setLevel(Level.OFF)// Suppress logging of expected exception
        ae.process(cas);
        fail();
View Full Code Here

      assertEquals(1, FlowControllerForErrorTest.failedAEs.size());
      assertTrue(FlowControllerForErrorTest.failedAEs.contains("ErrorAnnotator"));
   
      //AE should still be able to process a new document now
      FlowControllerForErrorTest.reset();
      cas.reset();
      cas.setDocumentText("This is OK");
      ae.process(cas);
      assertTrue(FlowControllerForErrorTest.abortedDocuments.isEmpty());
      assertTrue(FlowControllerForErrorTest.failedAEs.isEmpty());
     
View Full Code Here

      assertTrue(FlowControllerForErrorTest.failedAEs.isEmpty());
     
      //configure AE to continue after error
      ae.setConfigParameterValue("ContinueOnFailure", Boolean.TRUE);
      ae.reconfigure();
      cas.reset();
      cas.setDocumentText("ERROR");
      UIMAFramework.getLogger().setLevel(Level.OFF)// Suppress logging of expected exception
      ae.process(cas); //should not throw exception now
      UIMAFramework.getLogger().setLevel(Level.INFO); // Restore to apparent default of INFO
     
View Full Code Here

      CAS cas = ae.newCAS();
      cas.setDocumentText("new test");
      ae.process(cas);
      assertEquals("new test", TestAnnotator.lastDocument);
      assertEquals("new test", TestAnnotator2.lastDocument);
      cas.reset();
     
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

    }

    for (AnnotationCheckTreeNode each : children) {
      CheckDocument cd = (CheckDocument) each.getElement();
      if (cd.checked && cd.keep) {
        cas.reset();
        File oldFile = new File(cd.source);
        File goldFile = new File(documentSink.getText(), oldFile.getName());
        if (goldFile.exists()) {
          try {
            XmiCasDeserializer.deserialize(new FileInputStream(goldFile), cas, false);
View Full Code Here

            RutaAddonsPlugin.error(e);
          } catch (IOException e) {
            RutaAddonsPlugin.error(e);
          }
          String documentText = cas.getDocumentText();
          cas.reset();
          cas.setDocumentText(documentText);
        }
        AnnotationCheckTreeNode[] annotationNodes = each.getChildren();
        for (AnnotationCheckTreeNode eachAN : annotationNodes) {
          CheckAnnotation ca = (CheckAnnotation) eachAN.getElement();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.