You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by tp...@apache.org on 2015/03/13 23:09:53 UTC

svn commit: r1666596 [2/2] - in /tika/trunk: ./ tika-server/src/main/java/org/apache/tika/server/ tika-server/src/main/java/org/apache/tika/server/resource/ tika-server/src/main/java/org/apache/tika/server/writer/ tika-server/src/test/java/org/apache/t...

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/StackTraceTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/StackTraceTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/StackTraceTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/StackTraceTest.java Fri Mar 13 22:09:52 2015
@@ -30,6 +30,15 @@ import org.apache.cxf.jaxrs.JAXRSServerF
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.tika.server.resource.DetectorResource;
+import org.apache.tika.server.resource.MetadataResource;
+import org.apache.tika.server.resource.RecursiveMetadataResource;
+import org.apache.tika.server.resource.TikaResource;
+import org.apache.tika.server.resource.UnpackerResource;
+import org.apache.tika.server.writer.CSVMessageBodyWriter;
+import org.apache.tika.server.writer.JSONMessageBodyWriter;
+import org.apache.tika.server.writer.TextMessageBodyWriter;
+import org.apache.tika.server.writer.XMPMessageBodyWriter;
 import org.junit.Assert;
 import org.junit.Test;
 

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaDetectorsTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaDetectorsTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaDetectorsTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaDetectorsTest.java Fri Mar 13 22:09:52 2015
@@ -1,22 +1,22 @@
-/*
- * 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.server;
-
+/*
+ * 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.server;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -28,11 +28,12 @@ import java.util.Map;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.apache.tika.mime.MimeTypes;
-import org.apache.tika.parser.microsoft.POIFSContainerDetector;
-import org.apache.tika.parser.pkg.ZipContainerDetector;
-import org.eclipse.jetty.util.ajax.JSON;
-import org.gagravarr.tika.OggDetector;
+import org.apache.tika.mime.MimeTypes;
+import org.apache.tika.parser.microsoft.POIFSContainerDetector;
+import org.apache.tika.parser.pkg.ZipContainerDetector;
+import org.apache.tika.server.resource.TikaDetectors;
+import org.eclipse.jetty.util.ajax.JSON;
+import org.gagravarr.tika.OggDetector;
 import org.junit.Test;
 
 public class TikaDetectorsTest extends CXFTestBase {

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaMimeTypesTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaMimeTypesTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaMimeTypesTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaMimeTypesTest.java Fri Mar 13 22:09:52 2015
@@ -1,22 +1,22 @@
-/*
- * 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.server;
-
+/*
+ * 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.server;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -28,7 +28,8 @@ import java.util.Map;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.eclipse.jetty.util.ajax.JSON;
+import org.apache.tika.server.resource.TikaMimeTypes;
+import org.eclipse.jetty.util.ajax.JSON;
 import org.junit.Test;
 
 public class TikaMimeTypesTest extends CXFTestBase {

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaParsersTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaParsersTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaParsersTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaParsersTest.java Fri Mar 13 22:09:52 2015
@@ -1,22 +1,22 @@
-/*
- * 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.server;
-
+/*
+ * 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.server;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -28,11 +28,12 @@ import java.util.Map;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.apache.tika.parser.microsoft.ooxml.OOXMLParser;
-import org.apache.tika.parser.pdf.PDFParser;
-import org.apache.tika.parser.pkg.PackageParser;
-import org.eclipse.jetty.util.ajax.JSON;
-import org.gagravarr.tika.OpusParser;
+import org.apache.tika.parser.microsoft.ooxml.OOXMLParser;
+import org.apache.tika.parser.pdf.PDFParser;
+import org.apache.tika.parser.pkg.PackageParser;
+import org.apache.tika.server.resource.TikaParsers;
+import org.eclipse.jetty.util.ajax.JSON;
+import org.gagravarr.tika.OpusParser;
 import org.junit.Test;
 
 public class TikaParsersTest extends CXFTestBase {

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaResourceTest.java Fri Mar 13 22:09:52 2015
@@ -30,6 +30,7 @@ import org.apache.cxf.jaxrs.JAXRSServerF
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.tika.server.resource.TikaResource;
 import org.junit.Test;
 
 public class TikaResourceTest extends CXFTestBase {

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaVersionTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaVersionTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaVersionTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaVersionTest.java Fri Mar 13 22:09:52 2015
@@ -1,21 +1,21 @@
-/*
- * 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.server;
+/*
+ * 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.server;
 
 import static org.junit.Assert.assertEquals;
 
@@ -26,7 +26,8 @@ import java.io.InputStream;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.apache.tika.Tika;
+import org.apache.tika.Tika;
+import org.apache.tika.server.resource.TikaVersion;
 import org.junit.Test;
 
 public class TikaVersionTest extends CXFTestBase {

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaWelcomeTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaWelcomeTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaWelcomeTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/TikaWelcomeTest.java Fri Mar 13 22:09:52 2015
@@ -1,19 +1,19 @@
-/*
- * 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.
- */
+/*
+ * 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.server;
 
@@ -21,29 +21,32 @@ import javax.ws.rs.core.Response;
 
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
-import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.apache.tika.Tika;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.tika.Tika;
+import org.apache.tika.server.resource.DetectorResource;
+import org.apache.tika.server.resource.MetadataResource;
+import org.apache.tika.server.resource.TikaVersion;
+import org.apache.tika.server.resource.TikaWelcome;
 import org.junit.Test;
 
 public class TikaWelcomeTest extends CXFTestBase {
     protected static final String WELCOME_PATH = "/";
     private static final String VERSION_PATH = TikaVersionTest.VERSION_PATH;
-    protected static final String PATH_RESOURCE = "/detect/stream"; // TIKA-1567
-    protected static final String PATH_RESOURCE_2 = "/meta/form"; //TIKA-1567
+    protected static final String PATH_RESOURCE = "/detect/stream"; // TIKA-1567
+    protected static final String PATH_RESOURCE_2 = "/meta/form"; //TIKA-1567
 
     @Override
     protected void setUpResources(JAXRSServerFactoryBean sf) {
         List<ResourceProvider> rpsCore =
-	    new ArrayList<ResourceProvider>();
+	    new ArrayList<ResourceProvider>();
 	rpsCore.add(new SingletonResourceProvider(new TikaVersion(tika)));
-	rpsCore.add(new SingletonResourceProvider(new DetectorResource(tika)));
-	rpsCore.add(new SingletonResourceProvider(new MetadataResource(tika)));
+	rpsCore.add(new SingletonResourceProvider(new DetectorResource(tika)));
+	rpsCore.add(new SingletonResourceProvider(new MetadataResource(tika)));
         List<ResourceProvider> all = new ArrayList<ResourceProvider>(rpsCore);
         all.add(new SingletonResourceProvider(new TikaWelcome(tika, rpsCore)));
         sf.setResourceProviders(all);
@@ -92,18 +95,18 @@ public class TikaWelcomeTest extends CXF
         // Check that the Tika Version details come through too
         assertContains("GET " + VERSION_PATH, text);
     }
-
-
-    @Test
-    public void testProperPathWelcome() throws Exception{
-         Response response = WebClient
-	     .create(endPoint + WELCOME_PATH)
-             .type("text/html")
-             .accept("text/html")
-             .get();
-
-         String html = getStringFromInputStream((InputStream) response.getEntity());
-         assertContains(PATH_RESOURCE, html);
-         assertContains(PATH_RESOURCE_2, html);
-    }
+
+
+    @Test
+    public void testProperPathWelcome() throws Exception{
+         Response response = WebClient
+	     .create(endPoint + WELCOME_PATH)
+             .type("text/html")
+             .accept("text/html")
+             .get();
+
+         String html = getStringFromInputStream((InputStream) response.getEntity());
+         assertContains(PATH_RESOURCE, html);
+         assertContains(PATH_RESOURCE_2, html);
+    }
 }

Modified: tika/trunk/tika-server/src/test/java/org/apache/tika/server/UnpackerResourceTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/UnpackerResourceTest.java?rev=1666596&r1=1666595&r2=1666596&view=diff
==============================================================================
--- tika/trunk/tika-server/src/test/java/org/apache/tika/server/UnpackerResourceTest.java (original)
+++ tika/trunk/tika-server/src/test/java/org/apache/tika/server/UnpackerResourceTest.java Fri Mar 13 22:09:52 2015
@@ -33,6 +33,9 @@ import org.apache.commons.compress.archi
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.tika.server.resource.TarWriter;
+import org.apache.tika.server.resource.UnpackerResource;
+import org.apache.tika.server.writer.ZipWriter;
 import org.junit.Test;
 
 public class UnpackerResourceTest extends CXFTestBase {