You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by th...@apache.org on 2014/02/27 16:34:14 UTC

svn commit: r1572629 - in /tika/trunk/tika-parsers/src/test: java/org/apache/tika/parser/microsoft/OfficeParserTest.java resources/test-documents/test.doc

Author: thaichat04
Date: Thu Feb 27 15:34:13 2014
New Revision: 1572629

URL: http://svn.apache.org/r1572629
Log:
Add more test of OfficeParser

Added:
    tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/OfficeParserTest.java   (with props)
    tika/trunk/tika-parsers/src/test/resources/test-documents/test.doc   (with props)

Added: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/OfficeParserTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/OfficeParserTest.java?rev=1572629&view=auto
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/OfficeParserTest.java (added)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/OfficeParserTest.java Thu Feb 27 15:34:13 2014
@@ -0,0 +1,47 @@
+/*
+ * 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.microsoft;
+
+import static junit.framework.Assert.assertTrue;
+
+import java.io.InputStream;
+
+import org.apache.tika.TikaTest;
+import org.apache.tika.io.TikaInputStream;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.parser.microsoft.ooxml.OOXMLParserTest;
+import org.junit.Test;
+
+
+
+public class OfficeParserTest extends TikaTest {
+
+  @Test
+  public void parseOfficeWord() throws Exception {
+    Metadata metadata = new Metadata();
+    Parser parser = new OfficeParser();
+
+    String xml = getXML(getTestDocument("test.doc"), parser, metadata).xml;
+
+    assertTrue(xml.contains("test"));
+  }
+
+  private InputStream getTestDocument(String name) {
+    return TikaInputStream.get(OOXMLParserTest.class.getResourceAsStream("/test-documents/" + name));
+}
+}

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/OfficeParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tika/trunk/tika-parsers/src/test/resources/test-documents/test.doc
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/resources/test-documents/test.doc?rev=1572629&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tika/trunk/tika-parsers/src/test/resources/test-documents/test.doc
------------------------------------------------------------------------------
    svn:mime-type = application/msword