This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/main by this push:
new 994ee00 TIKA-3355 -- integrate fakeload library into MockParser
994ee00 is described below
commit 994ee00a49cdaf4af51b681a4675d909b35c0263
Author: tallison <[email protected]>
AuthorDate: Wed Apr 14 16:22:12 2021 -0400
TIKA-3355 -- integrate fakeload library into MockParser
---
NOTICE.txt | 24 ++
tika-core/pom.xml | 451 +++++++++++----------
.../org/apache/tika/parser/mock/MockParser.java | 75 ++++
.../apache/tika/parser/mock/MockParserTest.java | 30 ++
.../resources/test-documents/mock_fakeload.xml | 29 ++
5 files changed, 391 insertions(+), 218 deletions(-)
diff --git a/NOTICE.txt b/NOTICE.txt
index 097695a..e471357 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1542,3 +1542,27 @@ based on this library. If you modify this library, you
may extend this
exception to your version of the library, but you are not obligated to
do so. If you do not wish to do so, delete this exception statement
from your version.
+
+--------------------
+The Fakeload library
+
+MIT License
+
+Copyright (c) 2017 Marten Sigwart
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation files
+(the "Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the following
conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tika-core/pom.xml b/tika-core/pom.xml
index 4788456..0d026f5 100644
--- a/tika-core/pom.xml
+++ b/tika-core/pom.xml
@@ -19,229 +19,244 @@
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tika</groupId>
- <artifactId>tika-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../tika-parent/pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>org.apache.tika</groupId>
+ <artifactId>tika-parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../tika-parent/pom.xml</relativePath>
+ </parent>
- <artifactId>tika-core</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Tika core</name>
- <url>http://tika.apache.org/</url>
+ <artifactId>tika-core</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika core</name>
+ <url>http://tika.apache.org/</url>
- <dependencies>
- <!-- See https://issues.apache.org/jira/browse/TIKA-2566 for more info -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
+ <dependencies>
+ <!-- See https://issues.apache.org/jira/browse/TIKA-2566 for more info
-->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons.io.version}</version>
+ </dependency>
- <!-- Optional OSGi dependencies, used only when running within OSGi -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.core.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>4.0.0</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bndlib</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Optional OSGi dependencies, used only when running within OSGi -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bndlib</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- versions > 0.4.0 require java > 8 -->
+ <dependency>
+ <groupId>com.martensigwart</groupId>
+ <artifactId>fakeload</artifactId>
+ <version>0.4.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.plugin.version}</version>
- <dependencies>
- <dependency>
- <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId>
- <version>8.41</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>validate</id>
- <phase>validate</phase>
- <configuration>
- <configLocation>checkstyle.xml</configLocation>
- <encoding>UTF-8</encoding>
- <consoleOutput>false</consoleOutput>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
-
<testSourceDirectories>${project.basedir}/src/test/java</testSourceDirectories>
- <violationSeverity>error</violationSeverity>
- <failOnViolation>true</failOnViolation>
- </configuration>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>${maven.bundle.version}</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-DocURL>${project.url}</Bundle-DocURL>
- <Bundle-Activator>
- org.apache.tika.config.TikaActivator
- </Bundle-Activator>
- <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
-
<Import-Package>!sun.misc,org.apache.xerces.util;resolution:=optional,*</Import-Package>
- <Export-Package>
- org.apache.tika.*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <version>${rat.version}</version>
- <configuration>
- <excludes>
- <exclude>src/test/resources/org/apache/tika/**</exclude>
-
<exclude>src/main/resources/org/apache/tika/language/*.ngp</exclude>
-
<exclude>src/main/resources/org/apache/tika/detect/*.nnmodel</exclude>
-
<exclude>src/test/resources/test-documents/ang20150420t182050_corr_v1e_img.hdr</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestEntries>
-
<Automatic-Module-Name>org.apache.tika.core</Automatic-Module-Name>
- </manifestEntries>
- </archive>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- no harm, no foul for 2.0.0 :D TODO: turn this back on after the
2.0.0 release
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>clirr-maven-plugin</artifactId>
- <version>2.8</version>
- <executions>
- <execution>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- <configuration>
- <excludes>
- <exlude>org/apache/tika/config/TikaActivator</exlude>
- <exlude>org/apache/tika/language/LanguageIdentifier</exlude>
- <exlude>org/apache/tika/language/LanguageProfile</exlude>
-
<exlude>org/apache/tika/language/LanguageProfilerBuilder</exlude>
- <exlude>org/apache/tika/language/ProfilingHandler</exlude>
- <exlude>org/apache/tika/language/ProfilingWriter</exlude>
- <exlude>org/apache/tika/metadata/Property$PropertyType</exlude>
- <exlude>org/apache/tika/metadata/Property$ValueType</exlude>
- <exlude>org/apache/tika/metadata/DublinCore</exlude>
- <exlude>org/apache/tika/metadata/Metadata</exlude>
- <exlude>org/apache/tika/metadata/MSOffice</exlude>
- <exlude>org/apache/tika/parser/EmptyParser</exlude>
- <exclude>org/apache/tika/metadata/TikaMetadataKeys</exclude>
- </excludes>
- <comparisonArtifacts>
- <comparisonArtifact>
- <groupId>org.apache.tika</groupId>
- <artifactId>tika-core</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <type>jar</type>
- </comparisonArtifact>
- </comparisonArtifacts>
- </configuration>
- </execution>
- </executions>
- </plugin> -->
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.22.1</version>
- <configuration>
- <additionalClasspathElements>
- <additionalClasspathElement>
- ${project.build.directory}/${project.build.finalName}.jar
- </additionalClasspathElement>
- </additionalClasspathElements>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${checkstyle.plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>8.41</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>validate</id>
+ <phase>validate</phase>
+ <configuration>
+ <configLocation>checkstyle.xml</configLocation>
+ <encoding>UTF-8</encoding>
+ <consoleOutput>false</consoleOutput>
+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
+
<testSourceDirectories>${project.basedir}/src/test/java</testSourceDirectories>
+ <violationSeverity>error</violationSeverity>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
+ <Bundle-Activator>
+ org.apache.tika.config.TikaActivator
+ </Bundle-Activator>
+ <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
+
<Import-Package>!sun.misc,org.apache.xerces.util;resolution:=optional,*</Import-Package>
+ <Export-Package>
+ org.apache.tika.*
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>${rat.version}</version>
+ <configuration>
+ <excludes>
+
<exclude>src/test/resources/org/apache/tika/**</exclude>
+
<exclude>src/main/resources/org/apache/tika/language/*.ngp</exclude>
+
<exclude>src/main/resources/org/apache/tika/detect/*.nnmodel</exclude>
+
<exclude>src/test/resources/test-documents/ang20150420t182050_corr_v1e_img.hdr</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+
<Automatic-Module-Name>org.apache.tika.core</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- no harm, no foul for 2.0.0 :D TODO: turn this back on after
the 2.0.0 release
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>clirr-maven-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <excludes>
+ <exlude>org/apache/tika/config/TikaActivator</exlude>
+
<exlude>org/apache/tika/language/LanguageIdentifier</exlude>
+ <exlude>org/apache/tika/language/LanguageProfile</exlude>
+
<exlude>org/apache/tika/language/LanguageProfilerBuilder</exlude>
+
<exlude>org/apache/tika/language/ProfilingHandler</exlude>
+ <exlude>org/apache/tika/language/ProfilingWriter</exlude>
+
<exlude>org/apache/tika/metadata/Property$PropertyType</exlude>
+
<exlude>org/apache/tika/metadata/Property$ValueType</exlude>
+ <exlude>org/apache/tika/metadata/DublinCore</exlude>
+ <exlude>org/apache/tika/metadata/Metadata</exlude>
+ <exlude>org/apache/tika/metadata/MSOffice</exlude>
+ <exlude>org/apache/tika/parser/EmptyParser</exlude>
+
<exclude>org/apache/tika/metadata/TikaMetadataKeys</exclude>
+ </excludes>
+ <comparisonArtifacts>
+ <comparisonArtifact>
+ <groupId>org.apache.tika</groupId>
+ <artifactId>tika-core</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <type>jar</type>
+ </comparisonArtifact>
+ </comparisonArtifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin> -->
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.22.1</version>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>
+
${project.build.directory}/${project.build.finalName}.jar
+ </additionalClasspathElement>
+ </additionalClasspathElements>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
- <description>This is the core Apache Tika™ toolkit library from which all
other modules inherit functionality. It also
- includes the core facades for the Tika API.
- </description>
- <organization>
- <name>The Apache Software Foundation</name>
- <url>http://www.apache.org</url>
- </organization>
- <issueManagement>
- <system>JIRA</system>
- <url>https://issues.apache.org/jira/browse/TIKA</url>
- </issueManagement>
- <ciManagement>
- <system>Jenkins</system>
- <url>https://builds.apache.org/job/Tika-trunk/</url>
- </ciManagement>
+ <description>This is the core Apache Tika™ toolkit library from which all
other modules inherit functionality. It
+ also
+ includes the core facades for the Tika API.
+ </description>
+ <organization>
+ <name>The Apache Software Foundation</name>
+ <url>http://www.apache.org</url>
+ </organization>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://issues.apache.org/jira/browse/TIKA</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Jenkins</system>
+ <url>https://builds.apache.org/job/Tika-trunk/</url>
+ </ciManagement>
</project>
diff --git
a/tika-core/src/test/java/org/apache/tika/parser/mock/MockParser.java
b/tika-core/src/test/java/org/apache/tika/parser/mock/MockParser.java
index 0f78f6f..b394c7a 100644
--- a/tika-core/src/test/java/org/apache/tika/parser/mock/MockParser.java
+++ b/tika-core/src/test/java/org/apache/tika/parser/mock/MockParser.java
@@ -31,9 +31,20 @@ import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.parsers.DocumentBuilder;
+import com.martensigwart.fakeload.FakeLoad;
+import com.martensigwart.fakeload.FakeLoadBuilder;
+import com.martensigwart.fakeload.FakeLoadExecutor;
+import com.martensigwart.fakeload.FakeLoadExecutors;
+import com.martensigwart.fakeload.MemoryUnit;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -141,6 +152,8 @@ public class MockParser extends AbstractParser {
throwIt(action);
} else if ("hang".equals(name)) {
hang(action);
+ } else if ("fakeload".equals(name)) {
+ fakeload(action);
} else if ("oom".equals(name)) {
kabOOM();
} else if ("print_out".equals(name) || "print_err".equals(name)) {
@@ -158,6 +171,68 @@ public class MockParser extends AbstractParser {
}
}
+ private void fakeload(Node action) {
+ //https://github.com/msigwart/fakeload
+ //with this version of fakeload, you should only need one thread to hit
+ //the cpu targets; on Linux with Java 8 at least, two or more threads
did
+ //not increase the overall CPU over a single thread
+ int numThreads = 1;
+ NamedNodeMap attrs = action.getAttributes();
+ if (attrs == null) {
+ throw new IllegalArgumentException("Must specify details...no
attributes for " +
+ "fakeload?!");
+ }
+ if (attrs.getNamedItem("millis") == null || attrs.getNamedItem("cpu")
== null ||
+ attrs.getNamedItem("mb") == null) {
+ throw new IllegalArgumentException("must specify 'millis' (time to
process), " +
+ "'cpu' (% cpu as an integer, e.g. 50% would be '50'), " +
+ "and 'mb' (megabytes as an integer)");
+ }
+ Node n = attrs.getNamedItem("numThreads");
+ if (n != null) {
+ numThreads = Integer.parseInt(n.getNodeValue());
+ }
+ final long millis =
Long.parseLong(attrs.getNamedItem("millis").getNodeValue());
+ final int cpu =
Integer.parseInt(attrs.getNamedItem("cpu").getNodeValue());
+ final int mb =
Integer.parseInt(attrs.getNamedItem("mb").getNodeValue());
+
+ ExecutorService executorService =
Executors.newFixedThreadPool(numThreads);
+ ExecutorCompletionService<Integer> executorCompletionService =
+ new ExecutorCompletionService<>(executorService);
+
+ for (int i = 0; i < numThreads; i++) {
+ executorCompletionService.submit(new Runnable() {
+ @Override
+ public void run() {
+ FakeLoad fakeload =
+ new FakeLoadBuilder().lasting(millis,
TimeUnit.MILLISECONDS)
+ .withCpu(cpu).withMemory(mb,
MemoryUnit.MB).build();
+ FakeLoadExecutor executor =
FakeLoadExecutors.newDefaultExecutor();
+ executor.execute(fakeload);
+ }
+ }, 1);
+
+ int finished = 0;
+ try {
+ while (finished < numThreads) {
+ Future<Integer> future = executorCompletionService.take();
+ if (future != null) {
+ future.get();
+ finished++;
+ }
+ }
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ executorService.shutdownNow();
+ }
+
+ }
+
+ }
+
private void throwIllegalChars() throws IOException {
throw new IOException("Can't say \u0000 in xml or \u0001 or \u0002 or
\u0003");
}
diff --git
a/tika-core/src/test/java/org/apache/tika/parser/mock/MockParserTest.java
b/tika-core/src/test/java/org/apache/tika/parser/mock/MockParserTest.java
new file mode 100644
index 0000000..843d737
--- /dev/null
+++ b/tika-core/src/test/java/org/apache/tika/parser/mock/MockParserTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.tika.parser.mock;
+
+import org.junit.Test;
+
+import org.apache.tika.TikaTest;
+
+public class MockParserTest extends TikaTest {
+
+ @Test
+ public void testFakeload() throws Exception {
+ //just make sure there aren't any exceptions
+ getRecursiveMetadata("mock_fakeload.xml");
+ }
+}
diff --git a/tika-core/src/test/resources/test-documents/mock_fakeload.xml
b/tika-core/src/test/resources/test-documents/mock_fakeload.xml
new file mode 100644
index 0000000..f926b91
--- /dev/null
+++ b/tika-core/src/test/resources/test-documents/mock_fakeload.xml
@@ -0,0 +1,29 @@
+<?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="dc:creator">Nikolai Lobachevsky</metadata>
+ <write element="p">main_content</write>
+ <!-- millis = milliseconds to run, cpu is % of the cpu to peg and mb is the
+ amount of memory to consume in megabytes -->
+ <fakeload millis="100" cpu="10" mb="10"/>
+</mock>
\ No newline at end of file