You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2013/02/21 12:59:55 UTC

svn commit: r1448616 - in /stanbol/trunk/integration-tests/src/test: java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java resources/testWORD.docx

Author: rwesten
Date: Thu Feb 21 11:59:54 2013
New Revision: 1448616

URL: http://svn.apache.org/r1448616
Log:
STANBOL-810: Added integration test for a docx document

Added:
    stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java   (with props)
    stanbol/trunk/integration-tests/src/test/resources/testWORD.docx   (with props)

Added: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java?rev=1448616&view=auto
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java (added)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java Thu Feb 21 11:59:54 2013
@@ -0,0 +1,56 @@
+/*
+ * 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.stanbol.enhancer.it;
+
+import java.io.InputStream;
+
+import org.apache.http.entity.InputStreamEntity;
+import org.junit.Assert;
+import org.junit.Test;
+/**
+ * This test sends an XML based document to the Tika engine to test if
+ * XML processing works as expected when Tika is running in the
+ * OSGI environment (see 
+ * <a href="https://issues.apache.org/jira/browse/STANBOL-810">STANBOL-810</a>
+ * for details).
+ *
+ */
+public class TikaXmlDocumentOsgiTest extends EnhancerTestBase {
+    
+    public TikaXmlDocumentOsgiTest(){
+        super();
+    }
+
+    /**
+     * Tests docx format
+     * engine 
+     * @throws Exception
+     */
+    @Test
+    public void testDocx() throws Exception {
+        InputStream in = EngineEnhancementRequestTest.class.getClassLoader().getResourceAsStream("testWORD.docx");
+        Assert.assertNotNull("Unable to find test resource 'testWORD.docx'",in);
+        executor.execute(
+            builder.buildPostRequest(getEndpoint()+"/engine/tika?omitMetadata=true")
+            .withHeader("Accept","text/plain")
+            .withHeader("Content-Type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
+            .withEntity(new InputStreamEntity(in, -1))
+        )
+        .assertStatus(200); //not interested in the results, just that it worked
+    }
+
+}

Propchange: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/TikaXmlDocumentOsgiTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: stanbol/trunk/integration-tests/src/test/resources/testWORD.docx
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/resources/testWORD.docx?rev=1448616&view=auto
==============================================================================
Binary file - no diff available.

Propchange: stanbol/trunk/integration-tests/src/test/resources/testWORD.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream