blob: 5ec335827350acc3e75910f6d66b73916da5a145 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.uima.collection.impl;
import java.io.IOException;
import org.apache.uima.cas.CAS;
import org.apache.uima.collection.CollectionException;
import org.apache.uima.collection.CollectionReader_ImplBase;
import org.apache.uima.util.Progress;
/**
* A test collection reader that just Asserts the CAS heap size to be a specified value.
*
*/
public class SingleDocCollectionReader extends CollectionReader_ImplBase {
static final int EXPECTED_HEAP_SIZE = 100000;
private boolean done = false;
/*
* (non-Javadoc)
*
* @see org.apache.uima.collection.CollectionReader#getNext(org.apache.uima.cas.CAS)
*/
public void getNext(CAS aCAS) throws IOException, CollectionException {
assert(!done);
aCAS.setDocumentText("This is a test");
done = true;
}
/*
* (non-Javadoc)
*
* @see org.apache.uima.collection.base_cpm.BaseCollectionReader#close()
*/
public void close() throws IOException {
}
/*
* (non-Javadoc)
*
* @see org.apache.uima.collection.base_cpm.BaseCollectionReader#getProgress()
*/
public Progress[] getProgress() {
return null;
}
/*
* (non-Javadoc)
*
* @see org.apache.uima.collection.base_cpm.BaseCollectionReader#hasNext()
*/
public boolean hasNext() throws IOException, CollectionException {
return !done;
}
}