Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,220 @@ +package org.apache.tika.batch.fs; + +/* + * 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. + */ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.io.FileUtils; +import org.apache.tika.TikaTest; +import org.apache.tika.batch.BatchProcess; +import org.apache.tika.batch.BatchProcessDriverCLI; +import org.apache.tika.batch.ParallelFileProcessingResult; +import org.apache.tika.batch.builders.BatchProcessBuilder; +import org.apache.tika.io.IOUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * This is the base class for file-system batch tests. + * <p/> + * There are a few areas for improvement in this test suite. + * <ol> + * <li>For the heavy load tests, the test cases leave behind files that + * cannot be deleted from within the same jvm. A thread is still actively writing to an + * OutputStream when tearDown() is called. The current solution is to create + * the temp dir within the target/tika-batch/test-classes so that they will at least + * be removed during each maven "clean"</li> + * <li>The "mock" tests are time-based. This is not + * extremely reliable across different machines with different number/power of cpus. + * </li> + * </ol> + */ +public abstract class FSBatchTestBase extends TikaTest { + + private static File outputRoot = null; + + @BeforeClass + public static void setUp() throws Exception { + + File testOutput = new File("target/test-classes/test-output"); + testOutput.mkdirs(); + outputRoot = File.createTempFile("tika-batch-output-root-", "", testOutput); + outputRoot.delete(); + outputRoot.mkdirs(); + + } + + @AfterClass + public static void tearDown() throws Exception { + //not ideal, but should be ok for testing + //see caveat in TikaCLITest's textExtract + + try { + FileUtils.deleteDirectory(outputRoot); + } catch (IOException e) { + e.printStackTrace(); + } + } + + protected void destroyProcess(Process p) { + if (p == null) + return; + + try { + p.exitValue(); + } catch (IllegalThreadStateException e) { + p.destroy(); + } + } + + File getNewOutputDir(String subdirPrefix) throws IOException { + File outputDir = File.createTempFile(subdirPrefix, "", outputRoot); + outputDir.delete(); + outputDir.mkdirs(); + return outputDir; + } + + Map<String, String> getDefaultArgs(String inputSubDir, File outputDir) throws Exception { + Map<String, String> args = new HashMap<String, String>(); + args.put("inputDir", "\""+getInputRoot(inputSubDir).getAbsolutePath()+"\""); + if (outputDir != null) { + args.put("outputDir", "\""+outputDir.getAbsolutePath()+"\""); + } + return args; + } + + public String[] getDefaultCommandLineArgsArr(String inputSubDir, File outputDir, Map<String, String> commandLine) throws Exception { + List<String> args = new ArrayList<String>(); + //need to include "-" because these are going to the commandline! + if (inputSubDir != null) { + args.add("-inputDir"); + args.add(getInputRoot(inputSubDir).getAbsolutePath()); + } + if (outputDir != null) { + args.add("-outputDir"); + args.add(outputDir.getAbsolutePath()); + } + if (commandLine != null) { + for (Map.Entry<String, String> e : commandLine.entrySet()) { + args.add(e.getKey()); + args.add(e.getValue()); + } + } + return args.toArray(new String[args.size()]); + } + + + public File getInputRoot(String subdir) throws Exception { + String path = (subdir == null || subdir.length() == 0) ? "/test-input" : "/test-input/"+subdir; + return new File(this.getClass().getResource(path).toURI()); + } + + BatchProcess getNewBatchRunner(String testConfig, + Map<String, String> args) throws IOException { + InputStream is = this.getClass().getResourceAsStream(testConfig); + BatchProcessBuilder b = new BatchProcessBuilder(); + BatchProcess runner = b.build(is, args); + + IOUtils.closeQuietly(is); + return runner; + } + + public ProcessBuilder getNewBatchRunnerProcess(String testConfig, Map<String, String> args) { + List<String> argList = new ArrayList<String>(); + for (Map.Entry<String, String> e : args.entrySet()) { + argList.add("-"+e.getKey()); + argList.add(e.getValue()); + } + + String[] fullCommandLine = commandLine(testConfig, argList.toArray(new String[argList.size()])); + return new ProcessBuilder(fullCommandLine); + } + + private String[] commandLine(String testConfig, String[] args) { + List<String> commandLine = new ArrayList<String>(); + commandLine.add("java"); + commandLine.add("-Dlog4j.configuration=file:"+ + this.getClass().getResource("/log4j_process.properties").getFile()); + commandLine.add("-Xmx128m"); + commandLine.add("-cp"); + String cp = System.getProperty("java.class.path"); + //need to test for " " on *nix, can't just add double quotes + //across platforms. + if (cp.contains(" ")){ + cp = "\""+cp+"\""; + } + commandLine.add(cp); + commandLine.add("org.apache.tika.batch.fs.FSBatchProcessCLI"); + + String configFile = this.getClass().getResource(testConfig).getFile(); + commandLine.add("-bc"); + + commandLine.add(configFile); + + for (String s : args) { + commandLine.add(s); + } + return commandLine.toArray(new String[commandLine.size()]); + } + + public BatchProcessDriverCLI getNewDriver(String testConfig, + String[] args) throws Exception { + List<String> commandLine = new ArrayList<String>(); + commandLine.add("java"); + commandLine.add("-Xmx128m"); + commandLine.add("-cp"); + String cp = System.getProperty("java.class.path"); + //need to test for " " on *nix, can't just add double quotes + //across platforms. + if (cp.contains(" ")){ + cp = "\""+cp+"\""; + } + commandLine.add(cp); + commandLine.add("org.apache.tika.batch.fs.FSBatchProcessCLI"); + + String configFile = this.getClass().getResource(testConfig).getFile(); + commandLine.add("-bc"); + + commandLine.add(configFile); + + for (String s : args) { + commandLine.add(s); + } + + BatchProcessDriverCLI driver = new BatchProcessDriverCLI( + commandLine.toArray(new String[commandLine.size()])); + driver.setRedirectChildProcessToStdOut(false); + return driver; + } + + protected ParallelFileProcessingResult run(BatchProcess process) throws Exception { + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future<ParallelFileProcessingResult> futureResult = executor.submit(process); + return futureResult.get(10, TimeUnit.SECONDS); + } +}
Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,121 @@ +package org.apache.tika.batch.fs; + +/* + * 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. + */ + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Map; + +import org.apache.commons.io.FileUtils; +import org.apache.tika.batch.BatchProcess; +import org.apache.tika.batch.ParallelFileProcessingResult; +import org.apache.tika.io.IOUtils; +import org.junit.Test; + +public class HandlerBuilderTest extends FSBatchTestBase { + + @Test + public void testXML() throws Exception { + + File outputDir = getNewOutputDir("handler-xml-"); + Map<String, String> args = getDefaultArgs("basic", outputDir); + args.put("basicHandlerType", "xml"); + args.put("outputSuffix", "xml"); + + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + ParallelFileProcessingResult result = run(runner); + File outputFile = new File(outputDir, "test0.xml.xml"); + String resultString = FileUtils.readFileToString(outputFile, IOUtils.UTF_8.toString()); + assertTrue(resultString.contains("<html xmlns=\"http://www.w3.org/1999/xhtml\">")); + assertTrue(resultString.contains("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")); + assertTrue(resultString.contains("This is tika-batch's first test file")); + } + + + @Test + public void testHTML() throws Exception { + File outputDir = getNewOutputDir("handler-html-"); + + Map<String, String> args = getDefaultArgs("basic", outputDir); + args.put("basicHandlerType", "html"); + args.put("outputSuffix", "html"); + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + ParallelFileProcessingResult result = run(runner); + File outputFile = new File(outputDir, "test0.xml.html"); + String resultString = FileUtils.readFileToString(outputFile, IOUtils.UTF_8.toString()); + assertTrue(resultString.contains("<html xmlns=\"http://www.w3.org/1999/xhtml\">")); + assertFalse(resultString.contains("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")); + assertTrue(resultString.contains("This is tika-batch's first test file")); + } + + @Test + public void testText() throws Exception { + File outputDir = getNewOutputDir("handler-txt-"); + + Map<String, String> args = getDefaultArgs("basic", outputDir); + args.put("basicHandlerType", "txt"); + args.put("outputSuffix", "txt"); + + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + ParallelFileProcessingResult result = run(runner); + File outputFile = new File(outputDir, "test0.xml.txt"); + String resultString = FileUtils.readFileToString(outputFile, IOUtils.UTF_8.toString()); + assertFalse(resultString.contains("<html xmlns=\"http://www.w3.org/1999/xhtml\">")); + assertFalse(resultString.contains("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")); + assertTrue(resultString.contains("This is tika-batch's first test file")); + } + + + @Test + public void testXMLWithWriteLimit() throws Exception { + File outputDir = getNewOutputDir("handler-xml-write-limit-"); + + Map<String, String> args = getDefaultArgs("basic", outputDir); + args.put("writeLimit", "5"); + + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + ParallelFileProcessingResult result = run(runner); + + File outputFile = new File(outputDir, "test0.xml.xml"); + String resultString = FileUtils.readFileToString(outputFile, IOUtils.UTF_8.toString()); + //this is not ideal. How can we change handlers to writeout whatever + //they've gotten so far, up to the writeLimit? + assertTrue(resultString.equals("")); + } + + @Test + public void testRecursiveParserWrapper() throws Exception { + File outputDir = getNewOutputDir("handler-recursive-parser"); + + Map<String, String> args = getDefaultArgs("basic", outputDir); + args.put("basicHandlerType", "txt"); + args.put("outputSuffix", "json"); + args.put("recursiveParserWrapper", "true"); + + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + ParallelFileProcessingResult result = run(runner); + File outputFile = new File(outputDir, "test0.xml.json"); + String resultString = FileUtils.readFileToString(outputFile, IOUtils.UTF_8.toString()); + assertTrue(resultString.contains("\"author\":\"Nikolai Lobachevsky\"")); + assertTrue(resultString.contains("tika-batch\\u0027s first test file")); + } + + +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,101 @@ +package org.apache.tika.batch.fs; + +/* + * 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. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Map; +import java.util.concurrent.ExecutionException; + +import org.apache.tika.batch.BatchProcess; +import org.apache.tika.batch.ParallelFileProcessingResult; +import org.junit.Test; + +public class OutputStreamFactoryTest extends FSBatchTestBase { + + + @Test + public void testIllegalState() throws Exception { + File outputDir = getNewOutputDir("os-factory-illegal-state-"); + Map<String, String> args = getDefaultArgs("basic", outputDir); + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + run(runner); + assertEquals(1, outputDir.listFiles().length); + + boolean illegalState = false; + try { + ParallelFileProcessingResult result = run(runner); + } catch (ExecutionException e) { + if (e.getCause() instanceof IllegalStateException) { + illegalState = true; + } + } + assertTrue("Should have been an illegal state exception", illegalState); + } + + @Test + public void testSkip() throws Exception { + File outputDir = getNewOutputDir("os-factory-skip-"); + Map<String, String> args = getDefaultArgs("basic", outputDir); + args.put("handleExisting", "skip"); + BatchProcess runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + ParallelFileProcessingResult result = run(runner); + assertEquals(1, outputDir.listFiles().length); + + runner = getNewBatchRunner("/tika-batch-config-test.xml", args); + result = run(runner); + assertEquals(1, outputDir.listFiles().length); + } + + /* turn this back on if there is any need to add "handleExisting" + @Test + public void testRename() throws Exception { + File outputDir = getNewOutputDir("os-factory-rename-"); + Map<String, String> args = getDefaultArgs("basic", outputDir); + + args.put("handleExisting", "rename"); + BatchProcess runner = getNewBatchRunner("/tika-batch-config-basic-test.xml", args); + ParallelFileProcessingResult result = runner.execute(); + assertEquals(1, outputDir.listFiles().length); + + runner = getNewBatchRunner("/tika-batch-config-basic-test.xml", args); + result = runner.execute(); + assertEquals(2, outputDir.listFiles().length); + + runner = getNewBatchRunner("/tika-batch-config-basic-test.xml", args); + result = runner.execute(); + assertEquals(3, outputDir.listFiles().length); + + int hits = 0; + for (File f : outputDir.listFiles()){ + String name = f.getName(); + if (name.equals("test2_ok.xml.xml")) { + hits++; + } else if (name.equals("test1(1).txt.xml")) { + hits++; + } else if (name.equals("test1(2).txt.xml")) { + hits++; + } + } + assertEquals(3, hits); + } + */ + +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/StringStreamGobbler.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/StringStreamGobbler.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/StringStreamGobbler.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/StringStreamGobbler.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,63 @@ +package org.apache.tika.batch.fs; + +/* + * 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. + */ + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.apache.tika.io.IOUtils; + +public class StringStreamGobbler implements Runnable { + + //plagiarized from org.apache.oodt's StreamGobbler + private final BufferedReader reader; + private volatile boolean running = true; + private final StringBuilder sb = new StringBuilder(); + + public StringStreamGobbler(InputStream is) { + this.reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(is), + IOUtils.UTF_8)); + } + + @Override + public void run() { + String line = null; + try { + while ((line = reader.readLine()) != null && this.running) { + sb.append(line); + sb.append("\n"); + } + } catch (IOException e) { + //swallow ioe + } + } + + public void stopGobblingAndDie() { + running = false; + IOUtils.closeQuietly(reader); + } + + @Override + public String toString() { + return sb.toString(); + } + +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,26 @@ +package org.apache.tika.batch.fs.strawman; +/* + * 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. + */ +import org.junit.Test; + +public class StrawmanTest { + //TODO: actually write some tests!!! + @Test + public void basicTest() { + + } +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersBuilder.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersBuilder.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersBuilder.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersBuilder.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,38 @@ +package org.apache.tika.batch.mock; + +/* + * 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. + */ +import java.util.Map; +import java.util.concurrent.ArrayBlockingQueue; + +import org.apache.tika.batch.ConsumersManager; +import org.apache.tika.batch.FileResource; +import org.apache.tika.batch.fs.builders.BasicTikaFSConsumersBuilder; +import org.w3c.dom.Node; + +public class MockConsumersBuilder extends BasicTikaFSConsumersBuilder { + + @Override + public ConsumersManager build(Node node, Map<String, String> runtimeAttributes, + ArrayBlockingQueue<FileResource> queue) { + ConsumersManager manager = super.build(node, runtimeAttributes, queue); + + boolean hangOnInit = runtimeAttributes.containsKey("hangOnInit"); + boolean hangOnShutdown = runtimeAttributes.containsKey("hangOnShutdown"); + return new MockConsumersManager(manager, hangOnInit, hangOnShutdown); + } +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersManager.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersManager.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersManager.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/batch/mock/MockConsumersManager.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,77 @@ +package org.apache.tika.batch.mock; + +import org.apache.tika.batch.ConsumersManager; + +/* + * 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. + */ + +public class MockConsumersManager extends ConsumersManager { + + private final long HANG_MS = 30000; + + private final ConsumersManager wrapped; + private final boolean hangOnInit; + private final boolean hangOnClose; + + public MockConsumersManager(ConsumersManager wrapped, boolean hangOnInit, + boolean hangOnClose) { + super(wrapped.getConsumers()); + this.wrapped = wrapped; + this.hangOnInit = hangOnInit; + this.hangOnClose = hangOnClose; + } + + + @Override + public void init() { + if (hangOnInit) { + //interruptible light hang + try { + Thread.sleep(HANG_MS); + } catch (InterruptedException e) { + return; + } + return; + } + super.init(); + } + + @Override + public void shutdown() { + if (hangOnClose) { + //interruptible light hang + try { + Thread.sleep(HANG_MS); + } catch (InterruptedException e) { + return; + } + return; + } + super.shutdown(); + } + + @Override + public long getConsumersManagerMaxMillis() { + return wrapped.getConsumersManagerMaxMillis(); + } + + @Override + public void setConsumersManagerMaxMillis(long millis) { + wrapped.setConsumersManagerMaxMillis(millis); + } + +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/parser/mock/MockParserFactory.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/parser/mock/MockParserFactory.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/parser/mock/MockParserFactory.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/parser/mock/MockParserFactory.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,29 @@ +package org.apache.tika.parser.mock; + +/* + * 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. + */ + +import org.apache.tika.batch.ParserFactory; +import org.apache.tika.config.TikaConfig; +import org.apache.tika.parser.Parser; + +public class MockParserFactory implements ParserFactory { + @Override + public Parser getParser(TikaConfig config) { + return new MockParser(); + } +} Added: tika/trunk/tika-batch/src/test/java/org/apache/tika/util/TikaExceptionFilterTest.java URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/java/org/apache/tika/util/TikaExceptionFilterTest.java?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/java/org/apache/tika/util/TikaExceptionFilterTest.java (added) +++ tika/trunk/tika-batch/src/test/java/org/apache/tika/util/TikaExceptionFilterTest.java Mon Mar 23 16:09:10 2015 @@ -0,0 +1,39 @@ +package org.apache.tika.util; + +import static org.junit.Assert.assertEquals; + +import org.apache.tika.TikaTest; +import org.junit.Test; + +/* + * 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. + */ +public class TikaExceptionFilterTest extends TikaTest { + + @Test + public void simpleNPETest() { + TikaExceptionFilter filter = new TikaExceptionFilter(); + Throwable t = null; + try { + getXML("null_pointer.xml"); + } catch (Throwable t2) { + assertContains("Unexpected RuntimeException", t2.getMessage()); + t = filter.filter(t2); + } + assertEquals("another null pointer exception", t.getMessage()); + } + +} Added: tika/trunk/tika-batch/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/log4j.properties?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/log4j.properties (added) +++ tika/trunk/tika-batch/src/test/resources/log4j.properties Mon Mar 23 16:09:10 2015 @@ -0,0 +1,11 @@ + +log4j.rootLogger=OFF,A1 + +#for debugging +#log4j.rootLogger=TRACE,A1 + +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n Added: tika/trunk/tika-batch/src/test/resources/log4j_process.properties URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/log4j_process.properties?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/log4j_process.properties (added) +++ tika/trunk/tika-batch/src/test/resources/log4j_process.properties Mon Mar 23 16:09:10 2015 @@ -0,0 +1,11 @@ + +log4j.rootLogger=OFF,A1 + +#for debugging +#log4j.rootLogger=TRACE,A1 + +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n Added: tika/trunk/tika-batch/src/test/resources/test-documents/null_pointer.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-documents/null_pointer.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-documents/null_pointer.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-documents/null_pointer.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <throw class="java.lang.NullPointerException">another null pointer exception</throw> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/basic/test0.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/basic/test0.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/basic/test0.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/basic/test0.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test0_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test0_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test0_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test0_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test1_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test1_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test1_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test1_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test2_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test2_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test2_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test2_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test3_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test3_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test3_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test3_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test4_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test4_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test4_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test4_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test5_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test5_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test5_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test5_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test6_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test6_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test6_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/heavy_heavy_hangs/test6_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test0_oom.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test0_oom.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test0_oom.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test0_oom.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<mock> + <throw class="java.lang.OutOfMemoryError"/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test1_oom.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test1_oom.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test1_oom.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test1_oom.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<mock> + <throw class="java.lang.OutOfMemoryError"/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test2_oom.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test2_oom.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test2_oom.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test2_oom.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<mock> + <throw class="java.lang.OutOfMemoryError"/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test3_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test3_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test3_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/max_restarts/test3_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<mock> + <write element="p">this is a tika test</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test1_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test1_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test1_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test1_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test2_norestart.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test2_norestart.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test2_norestart.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test2_norestart.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <throw class="org.apache.tika.batch.BatchNoRestartError">batch no restart</throw> +</mock> Added: tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test3_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test3_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test3_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/no_restart/test3_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/noisy_parsers/test0.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/noisy_parsers/test0.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/noisy_parsers/test0.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/noisy_parsers/test0.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + 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. +--> + +<mock> + <!-- this file offers all of the options as documentation + Parsing should stop at an IOException, of course + --> + + <write element="p">some content</write> + <!-- write something to System.out --> + <print_out>writing something to System.out</print_out> + <!-- write something to System.err --> + <print_err>writing something to System.err</print_err> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test0_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test0_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test0_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test0_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false"/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test1_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test1_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test1_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test1_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test2_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test2_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test2_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test2_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test3_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test3_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test3_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test3_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test4_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test4_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test4_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/one_heavy_hang/test4_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/oom/test0_sleep.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/oom/test0_sleep.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/oom/test0_sleep.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/oom/test0_sleep.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="10000" heavy="false" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/oom/test1_heavy_hang.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/oom/test1_heavy_hang.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/oom/test1_heavy_hang.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/oom/test1_heavy_hang.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false"/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/oom/test2_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/oom/test2_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/oom/test2_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/oom/test2_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/oom/test3_oom.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/oom/test3_oom.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/oom/test3_oom.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/oom/test3_oom.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <oom/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/oom/test4_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/oom/test4_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/oom/test4_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/oom/test4_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/oom/test5_ok.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/oom/test5_ok.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/oom/test5_ok.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/oom/test5_ok.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">This is tika-batch's first test file.</write> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/timeout_after_early_termination/test0_sleep.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/timeout_after_early_termination/test0_sleep.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/timeout_after_early_termination/test0_sleep.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/timeout_after_early_termination/test0_sleep.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="60000" heavy="true" pulse_millis="10000" interruptible="false"/> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/test-input/wait_after_early_termination/test0_sleep.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/test-input/wait_after_early_termination/test0_sleep.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/test-input/wait_after_early_termination/test0_sleep.xml (added) +++ tika/trunk/tika-batch/src/test/resources/test-input/wait_after_early_termination/test0_sleep.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<mock> + <metadata action="add" name="author">Nikolai Lobachevsky</metadata> + <write element="p">some content</write> + <hang millis="10000" heavy="false" interruptible="false" /> +</mock> \ No newline at end of file Added: tika/trunk/tika-batch/src/test/resources/tika-batch-config-MockConsumersBuilder.xml URL: http://svn.apache.org/viewvc/tika/trunk/tika-batch/src/test/resources/tika-batch-config-MockConsumersBuilder.xml?rev=1668673&view=auto ============================================================================== --- tika/trunk/tika-batch/src/test/resources/tika-batch-config-MockConsumersBuilder.xml (added) +++ tika/trunk/tika-batch/src/test/resources/tika-batch-config-MockConsumersBuilder.xml Mon Mar 23 16:09:10 2015 @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<!-- + 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. +--> +<!-- NOTE: tika-batch is still an experimental feature. + The configuration file will likely change and be backward incompatible + with new versions of Tika. Please stay tuned. + --> +<tika-batch-config + maxAliveTimeSeconds="-1" + pauseOnEarlyTerminationMillis="500" + timeoutThresholdMillis="3000" + timeoutCheckPulseMillis="1000" + maxQueueSize="10000" + numConsumers="3"> + <!-- options to allow on the commandline --> + <commandline> + <option opt="hangOnInit" hasArg="true" description="for mock consumersbuilder in testing only"/> + <option opt="hangOnShutdown" hasArg="true" description="for mock consumersbuilder in testing only"/> + <option opt="c" longOpt="tika-config" hasArg="true" + description="TikaConfig file"/> + <option opt="bc" longOpt="batch-config" hasArg="true" + description="xml batch config file" required="true"/> + <!-- We needed sorted for testing. We added random for performance. + Where crawling a directory is slow, it might be beneficial to + go randomly so that the parsers are triggered earlier. The + default is operating system's choice ("os") which means whatever order + the os returns files in .listFiles(). --> + <option opt="crawlOrder" hasArg="true" + description="how does the crawler sort the directories and files: + (random|sorted|os)"/> + <option opt="numConsumers" hasArg="true" + description="number of fileConsumers threads"/> + <option opt="minFileSizeBytes" hasArg="true" + description="minimum file size to process; do not process files smaller than this"/> + <option opt="maxFileSizeBytes" hasArg="true" + description="maximum file size to process; do not process files larger than this"/> + <option opt="maxQueueSize" hasArg="true" + description="maximum queue size for FileResources"/> + <option opt="fileList" hasArg="true" + description="file that contains a list of files (relative to inputDir) to process"/> + <option opt="fileListEncoding" hasArg="true" + description="encoding for fileList"/> + <option opt="inputDir" hasArg="true" + description="root directory for the files to be processed" + required="true"/> + <option opt="startDir" hasArg="true" + description="directory (under inputDir) at which to start crawling"/> + <option opt="outputDir" hasArg="true" + description="output directory" + required="true"/> + <option opt="recursiveParserWrapper" + description="use the RecursiveParserWrapper or not (default = false)"/> + <option opt="handleExisting" hasArg="true" + description="if an output file already exists, do you want to: overwrite, rename or skip"/> + <option opt="basicHandlerType" hasArg="true" + description="what type of content handler: xml, text, html, body"/> + <option opt="outputSuffix" hasArg="true" + description="suffix to add to the end of the output file name"/> + <option opt="timeoutThresholdMillis" hasArg="true" + description="how long to wait before determining that a consumer should be timed out"/> + <option opt="pauseOnEarlyTerminationMillis" hasArg="true" + description="how long to wait for parsers to finish if there is an early termination from the main loop."/> + <!-- in long running process, might be good to restart every hour or so to avoid memory leaks--> + <option opt="maxAliveTimeSeconds" hasArg="true" + description="how long should this process run in seconds."/> + </commandline> + <!-- + Can also add startDir: this tells the crawler to start indexing a + child directory of the inputDir directory. + --> + <crawler builderClass="org.apache.tika.batch.fs.builders.FSCrawlerBuilder" + crawlOrder="sorted" + maxConsecWaitMillis="5000" + maxFilesToAdd="-1" + maxFilesToConsider="-1" + includeFilePat="" + excludeFilePat="" + maxFileSizeBytes="-1" + /> + + <consumers builderClass="org.apache.tika.batch.mock.MockConsumersBuilder" + recursiveParserWrapper="false" consumersManagerMaxMillis="1000"> + <parser class="org.apache.tika.parser.mock.MockParserFactory" parseRecursively="true"/> + <contenthandler builderClass="org.apache.tika.batch.builders.DefaultContentHandlerFactoryBuilder" + basicHandlerType="xml" writeLimit="-1"/> + + + <outputstream class="FSOutputStreamFactory" + encoding="UTF-8" outputSuffix="xml"/> + </consumers> + + <!-- reporter and interrupter are optional --> + <reporter builderClass="org.apache.tika.batch.builders.SimpleLogReporterBuilder" sleepMillis="1000" + reporterStaleThresholdMillis="500000"/> + <interrupter builderClass="org.apache.tika.batch.builders.InterrupterBuilder"/> +</tika-batch-config> \ No newline at end of file