You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2008/12/01 00:15:11 UTC
svn commit: r721926 [5/5] - in /lucene/tika/trunk/src:
main/java/org/apache/tika/cli/ main/java/org/apache/tika/gui/
main/java/org/apache/tika/mime/ main/java/org/apache/tika/parser/
main/java/org/apache/tika/parser/audio/ main/java/org/apache/tika/par...
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/mp3/Mp3ParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/mp3/Mp3ParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/mp3/Mp3ParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/mp3/Mp3ParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,60 +1,60 @@
-/*
- * 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.mp3;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.AutoDetectParser;
-import org.apache.tika.parser.Parser;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-
-/**
- * Test case for parsing mp3 files.
- */
-public class Mp3ParserTest extends TestCase {
-
- public void testMp3Parsing() throws Exception {
- Parser parser = new AutoDetectParser(); // Should auto-detect!
- ContentHandler handler = new BodyContentHandler();
- Metadata metadata = new Metadata();
-
- InputStream stream = Mp3ParserTest.class.getResourceAsStream(
- "/test-documents/testMP3.mp3");
- try {
- parser.parse(stream, handler, metadata);
- } finally {
- stream.close();
- }
-
- assertEquals("audio/mpeg", metadata.get(Metadata.CONTENT_TYPE));
- assertEquals("Test Title", metadata.get(Metadata.TITLE));
- assertEquals("Test Artist", metadata.get(Metadata.AUTHOR));
-
- String content = handler.toString();
- assertTrue(content.contains("Test Title"));
- assertTrue(content.contains("Test Artist"));
- assertTrue(content.contains("Test Album"));
- assertTrue(content.contains("2008"));
- assertTrue(content.contains("Test Comment"));
- assertTrue(content.contains("Rock"));
- }
-
-}
+/*
+ * 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.mp3;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.AutoDetectParser;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Test case for parsing mp3 files.
+ */
+public class Mp3ParserTest extends TestCase {
+
+ public void testMp3Parsing() throws Exception {
+ Parser parser = new AutoDetectParser(); // Should auto-detect!
+ ContentHandler handler = new BodyContentHandler();
+ Metadata metadata = new Metadata();
+
+ InputStream stream = Mp3ParserTest.class.getResourceAsStream(
+ "/test-documents/testMP3.mp3");
+ try {
+ parser.parse(stream, handler, metadata);
+ } finally {
+ stream.close();
+ }
+
+ assertEquals("audio/mpeg", metadata.get(Metadata.CONTENT_TYPE));
+ assertEquals("Test Title", metadata.get(Metadata.TITLE));
+ assertEquals("Test Artist", metadata.get(Metadata.AUTHOR));
+
+ String content = handler.toString();
+ assertTrue(content.contains("Test Title"));
+ assertTrue(content.contains("Test Artist"));
+ assertTrue(content.contains("Test Album"));
+ assertTrue(content.contains("2008"));
+ assertTrue(content.contains("Test Comment"));
+ assertTrue(content.contains("Rock"));
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/mp3/Mp3ParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/opendocument/OpenOfficeParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/opendocument/OpenOfficeParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/opendocument/OpenOfficeParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/opendocument/OpenOfficeParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,62 +1,62 @@
-/**
- * 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.opendocument;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-
-public class OpenOfficeParserTest extends TestCase {
-
- public void testXMLParser() throws Exception {
- InputStream input = OpenOfficeParserTest.class.getResourceAsStream(
- "/test-documents/testOpenOffice2.odt");
- try {
- Metadata metadata = new Metadata();
- ContentHandler handler = new BodyContentHandler();
- new OpenOfficeParser().parse(input, handler, metadata);
-
- assertEquals(
- "application/vnd.oasis.opendocument.text",
- metadata.get(Metadata.CONTENT_TYPE));
- assertEquals("2007-09-14T11:07:10", metadata.get(Metadata.DATE));
- assertEquals("en-US", metadata.get(Metadata.LANGUAGE));
- assertEquals(
- "NeoOffice/2.2$Unix OpenOffice.org_project/680m18$Build-9161",
- metadata.get("generator"));
- assertEquals("0", metadata.get("nbTab"));
- assertEquals("0", metadata.get("nbObject"));
- assertEquals("0", metadata.get("nbImg"));
- assertEquals("1", metadata.get("nbPage"));
- assertEquals("1", metadata.get("nbPara"));
- assertEquals("14", metadata.get("nbWord"));
- assertEquals("78", metadata.get("nbCharacter"));
-
- String content = handler.toString();
- assertTrue(content.contains(
- "This is a sample Open Office document,"
- + " written in NeoOffice 2.2.1 for the Mac."));
- } finally {
- input.close();
- }
- }
-
-}
+/**
+ * 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.opendocument;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+public class OpenOfficeParserTest extends TestCase {
+
+ public void testXMLParser() throws Exception {
+ InputStream input = OpenOfficeParserTest.class.getResourceAsStream(
+ "/test-documents/testOpenOffice2.odt");
+ try {
+ Metadata metadata = new Metadata();
+ ContentHandler handler = new BodyContentHandler();
+ new OpenOfficeParser().parse(input, handler, metadata);
+
+ assertEquals(
+ "application/vnd.oasis.opendocument.text",
+ metadata.get(Metadata.CONTENT_TYPE));
+ assertEquals("2007-09-14T11:07:10", metadata.get(Metadata.DATE));
+ assertEquals("en-US", metadata.get(Metadata.LANGUAGE));
+ assertEquals(
+ "NeoOffice/2.2$Unix OpenOffice.org_project/680m18$Build-9161",
+ metadata.get("generator"));
+ assertEquals("0", metadata.get("nbTab"));
+ assertEquals("0", metadata.get("nbObject"));
+ assertEquals("0", metadata.get("nbImg"));
+ assertEquals("1", metadata.get("nbPage"));
+ assertEquals("1", metadata.get("nbPara"));
+ assertEquals("14", metadata.get("nbWord"));
+ assertEquals("78", metadata.get("nbCharacter"));
+
+ String content = handler.toString();
+ assertTrue(content.contains(
+ "This is a sample Open Office document,"
+ + " written in NeoOffice 2.2.1 for the Mac."));
+ } finally {
+ input.close();
+ }
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/opendocument/OpenOfficeParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/Bzip2ParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/Bzip2ParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/Bzip2ParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/Bzip2ParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,69 +1,69 @@
-/*
- * 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.pkg;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.AutoDetectParser;
-import org.apache.tika.parser.Parser;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-
-/**
- * Test case for parsing bzip2 files.
- */
-public class Bzip2ParserTest extends TestCase {
-
- public void testBzip2Parsing() throws Exception {
- Parser parser = new AutoDetectParser(); // Should auto-detect!
- ContentHandler handler = new BodyContentHandler();
- Metadata metadata = new Metadata();
-
- InputStream stream = Bzip2ParserTest.class.getResourceAsStream(
- "/test-documents/test-documents.tbz2");
- try {
- parser.parse(stream, handler, metadata);
- } finally {
- stream.close();
- }
-
- assertEquals("application/x-bzip", metadata.get(Metadata.CONTENT_TYPE));
- String content = handler.toString();
- assertTrue(content.contains("test-documents/testEXCEL.xls"));
- assertTrue(content.contains("Sample Excel Worksheet"));
- assertTrue(content.contains("test-documents/testHTML.html"));
- assertTrue(content.contains("Test Indexation Html"));
- assertTrue(content.contains("test-documents/testOpenOffice2.odt"));
- assertTrue(content.contains("This is a sample Open Office document"));
- assertTrue(content.contains("test-documents/testPDF.pdf"));
- assertTrue(content.contains("Apache Tika"));
- assertTrue(content.contains("test-documents/testPPT.ppt"));
- assertTrue(content.contains("Sample Powerpoint Slide"));
- assertTrue(content.contains("test-documents/testRTF.rtf"));
- assertTrue(content.contains("indexation Word"));
- assertTrue(content.contains("test-documents/testTXT.txt"));
- assertTrue(content.contains("Test d'indexation de Txt"));
- assertTrue(content.contains("test-documents/testWORD.doc"));
- assertTrue(content.contains("This is a sample Microsoft Word Document"));
- assertTrue(content.contains("test-documents/testXML.xml"));
- assertTrue(content.contains("Rida Benjelloun"));
- }
-
-}
+/*
+ * 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.pkg;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.AutoDetectParser;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Test case for parsing bzip2 files.
+ */
+public class Bzip2ParserTest extends TestCase {
+
+ public void testBzip2Parsing() throws Exception {
+ Parser parser = new AutoDetectParser(); // Should auto-detect!
+ ContentHandler handler = new BodyContentHandler();
+ Metadata metadata = new Metadata();
+
+ InputStream stream = Bzip2ParserTest.class.getResourceAsStream(
+ "/test-documents/test-documents.tbz2");
+ try {
+ parser.parse(stream, handler, metadata);
+ } finally {
+ stream.close();
+ }
+
+ assertEquals("application/x-bzip", metadata.get(Metadata.CONTENT_TYPE));
+ String content = handler.toString();
+ assertTrue(content.contains("test-documents/testEXCEL.xls"));
+ assertTrue(content.contains("Sample Excel Worksheet"));
+ assertTrue(content.contains("test-documents/testHTML.html"));
+ assertTrue(content.contains("Test Indexation Html"));
+ assertTrue(content.contains("test-documents/testOpenOffice2.odt"));
+ assertTrue(content.contains("This is a sample Open Office document"));
+ assertTrue(content.contains("test-documents/testPDF.pdf"));
+ assertTrue(content.contains("Apache Tika"));
+ assertTrue(content.contains("test-documents/testPPT.ppt"));
+ assertTrue(content.contains("Sample Powerpoint Slide"));
+ assertTrue(content.contains("test-documents/testRTF.rtf"));
+ assertTrue(content.contains("indexation Word"));
+ assertTrue(content.contains("test-documents/testTXT.txt"));
+ assertTrue(content.contains("Test d'indexation de Txt"));
+ assertTrue(content.contains("test-documents/testWORD.doc"));
+ assertTrue(content.contains("This is a sample Microsoft Word Document"));
+ assertTrue(content.contains("test-documents/testXML.xml"));
+ assertTrue(content.contains("Rida Benjelloun"));
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/Bzip2ParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/GzipParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/GzipParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/GzipParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/GzipParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,69 +1,69 @@
-/*
- * 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.pkg;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.AutoDetectParser;
-import org.apache.tika.parser.Parser;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-
-/**
- * Test case for parsing gzip files.
- */
-public class GzipParserTest extends TestCase {
-
- public void testGzipParsing() throws Exception {
- Parser parser = new AutoDetectParser(); // Should auto-detect!
- ContentHandler handler = new BodyContentHandler();
- Metadata metadata = new Metadata();
-
- InputStream stream = GzipParserTest.class.getResourceAsStream(
- "/test-documents/test-documents.tgz");
- try {
- parser.parse(stream, handler, metadata);
- } finally {
- stream.close();
- }
-
- assertEquals("application/x-gzip", metadata.get(Metadata.CONTENT_TYPE));
- String content = handler.toString();
- assertTrue(content.contains("test-documents/testEXCEL.xls"));
- assertTrue(content.contains("Sample Excel Worksheet"));
- assertTrue(content.contains("test-documents/testHTML.html"));
- assertTrue(content.contains("Test Indexation Html"));
- assertTrue(content.contains("test-documents/testOpenOffice2.odt"));
- assertTrue(content.contains("This is a sample Open Office document"));
- assertTrue(content.contains("test-documents/testPDF.pdf"));
- assertTrue(content.contains("Apache Tika"));
- assertTrue(content.contains("test-documents/testPPT.ppt"));
- assertTrue(content.contains("Sample Powerpoint Slide"));
- assertTrue(content.contains("test-documents/testRTF.rtf"));
- assertTrue(content.contains("indexation Word"));
- assertTrue(content.contains("test-documents/testTXT.txt"));
- assertTrue(content.contains("Test d'indexation de Txt"));
- assertTrue(content.contains("test-documents/testWORD.doc"));
- assertTrue(content.contains("This is a sample Microsoft Word Document"));
- assertTrue(content.contains("test-documents/testXML.xml"));
- assertTrue(content.contains("Rida Benjelloun"));
- }
-
-}
+/*
+ * 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.pkg;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.AutoDetectParser;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Test case for parsing gzip files.
+ */
+public class GzipParserTest extends TestCase {
+
+ public void testGzipParsing() throws Exception {
+ Parser parser = new AutoDetectParser(); // Should auto-detect!
+ ContentHandler handler = new BodyContentHandler();
+ Metadata metadata = new Metadata();
+
+ InputStream stream = GzipParserTest.class.getResourceAsStream(
+ "/test-documents/test-documents.tgz");
+ try {
+ parser.parse(stream, handler, metadata);
+ } finally {
+ stream.close();
+ }
+
+ assertEquals("application/x-gzip", metadata.get(Metadata.CONTENT_TYPE));
+ String content = handler.toString();
+ assertTrue(content.contains("test-documents/testEXCEL.xls"));
+ assertTrue(content.contains("Sample Excel Worksheet"));
+ assertTrue(content.contains("test-documents/testHTML.html"));
+ assertTrue(content.contains("Test Indexation Html"));
+ assertTrue(content.contains("test-documents/testOpenOffice2.odt"));
+ assertTrue(content.contains("This is a sample Open Office document"));
+ assertTrue(content.contains("test-documents/testPDF.pdf"));
+ assertTrue(content.contains("Apache Tika"));
+ assertTrue(content.contains("test-documents/testPPT.ppt"));
+ assertTrue(content.contains("Sample Powerpoint Slide"));
+ assertTrue(content.contains("test-documents/testRTF.rtf"));
+ assertTrue(content.contains("indexation Word"));
+ assertTrue(content.contains("test-documents/testTXT.txt"));
+ assertTrue(content.contains("Test d'indexation de Txt"));
+ assertTrue(content.contains("test-documents/testWORD.doc"));
+ assertTrue(content.contains("This is a sample Microsoft Word Document"));
+ assertTrue(content.contains("test-documents/testXML.xml"));
+ assertTrue(content.contains("Rida Benjelloun"));
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/GzipParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/TarParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/TarParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/TarParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/TarParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,69 +1,69 @@
-/*
- * 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.pkg;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.AutoDetectParser;
-import org.apache.tika.parser.Parser;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-
-/**
- * Test case for parsing tar files.
- */
-public class TarParserTest extends TestCase {
-
- public void testTarParsing() throws Exception {
- Parser parser = new AutoDetectParser(); // Should auto-detect!
- ContentHandler handler = new BodyContentHandler();
- Metadata metadata = new Metadata();
-
- InputStream stream = TarParserTest.class.getResourceAsStream(
- "/test-documents/test-documents.tar");
- try {
- parser.parse(stream, handler, metadata);
- } finally {
- stream.close();
- }
-
- assertEquals("application/x-tar", metadata.get(Metadata.CONTENT_TYPE));
- String content = handler.toString();
- assertTrue(content.contains("test-documents/testEXCEL.xls"));
- assertTrue(content.contains("Sample Excel Worksheet"));
- assertTrue(content.contains("test-documents/testHTML.html"));
- assertTrue(content.contains("Test Indexation Html"));
- assertTrue(content.contains("test-documents/testOpenOffice2.odt"));
- assertTrue(content.contains("This is a sample Open Office document"));
- assertTrue(content.contains("test-documents/testPDF.pdf"));
- assertTrue(content.contains("Apache Tika"));
- assertTrue(content.contains("test-documents/testPPT.ppt"));
- assertTrue(content.contains("Sample Powerpoint Slide"));
- assertTrue(content.contains("test-documents/testRTF.rtf"));
- assertTrue(content.contains("indexation Word"));
- assertTrue(content.contains("test-documents/testTXT.txt"));
- assertTrue(content.contains("Test d'indexation de Txt"));
- assertTrue(content.contains("test-documents/testWORD.doc"));
- assertTrue(content.contains("This is a sample Microsoft Word Document"));
- assertTrue(content.contains("test-documents/testXML.xml"));
- assertTrue(content.contains("Rida Benjelloun"));
- }
-
-}
+/*
+ * 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.pkg;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.AutoDetectParser;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Test case for parsing tar files.
+ */
+public class TarParserTest extends TestCase {
+
+ public void testTarParsing() throws Exception {
+ Parser parser = new AutoDetectParser(); // Should auto-detect!
+ ContentHandler handler = new BodyContentHandler();
+ Metadata metadata = new Metadata();
+
+ InputStream stream = TarParserTest.class.getResourceAsStream(
+ "/test-documents/test-documents.tar");
+ try {
+ parser.parse(stream, handler, metadata);
+ } finally {
+ stream.close();
+ }
+
+ assertEquals("application/x-tar", metadata.get(Metadata.CONTENT_TYPE));
+ String content = handler.toString();
+ assertTrue(content.contains("test-documents/testEXCEL.xls"));
+ assertTrue(content.contains("Sample Excel Worksheet"));
+ assertTrue(content.contains("test-documents/testHTML.html"));
+ assertTrue(content.contains("Test Indexation Html"));
+ assertTrue(content.contains("test-documents/testOpenOffice2.odt"));
+ assertTrue(content.contains("This is a sample Open Office document"));
+ assertTrue(content.contains("test-documents/testPDF.pdf"));
+ assertTrue(content.contains("Apache Tika"));
+ assertTrue(content.contains("test-documents/testPPT.ppt"));
+ assertTrue(content.contains("Sample Powerpoint Slide"));
+ assertTrue(content.contains("test-documents/testRTF.rtf"));
+ assertTrue(content.contains("indexation Word"));
+ assertTrue(content.contains("test-documents/testTXT.txt"));
+ assertTrue(content.contains("Test d'indexation de Txt"));
+ assertTrue(content.contains("test-documents/testWORD.doc"));
+ assertTrue(content.contains("This is a sample Microsoft Word Document"));
+ assertTrue(content.contains("test-documents/testXML.xml"));
+ assertTrue(content.contains("Rida Benjelloun"));
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/pkg/TarParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/xml/DcXMLParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/xml/DcXMLParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/xml/DcXMLParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/xml/DcXMLParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,77 +1,77 @@
-/**
- * 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.xml;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class DcXMLParserTest extends TestCase {
-
- public void testXMLParserAsciiChars() throws Exception {
- InputStream input = DcXMLParserTest.class.getResourceAsStream(
- "/test-documents/testXML.xml");
- try {
- Metadata metadata = new Metadata();
- ContentHandler handler = new BodyContentHandler();
- new DcXMLParser().parse(input, handler, metadata);
-
- assertEquals(
- "application/xml",
- metadata.get(Metadata.CONTENT_TYPE));
- assertEquals("Tika test document", metadata.get(Metadata.TITLE));
- assertEquals("Rida Benjelloun", metadata.get(Metadata.CREATOR));
- assertEquals(
- "Java, XML, XSLT, JDOM, Indexation",
- metadata.get(Metadata.SUBJECT));
- assertEquals(
- "Framework d\'indexation des documents XML, HTML, PDF etc.. ",
- metadata.get(Metadata.DESCRIPTION));
- assertEquals(
- "http://www.apache.org",
- metadata.get(Metadata.IDENTIFIER));
- assertEquals("test", metadata.get(Metadata.TYPE));
- assertEquals("application/msword", metadata.get(Metadata.FORMAT));
- assertEquals("Fr", metadata.get(Metadata.LANGUAGE));
- assertTrue(metadata.get(Metadata.RIGHTS).contains("testing chars"));
-
- String content = handler.toString();
- assertTrue(content.contains("Tika test document"));
- } finally {
- input.close();
- }
- }
-
- public void testXMLParserNonAsciiChars() throws Exception {
- InputStream input = DcXMLParserTest.class.getResourceAsStream("/test-documents/testXML.xml");
- try {
- Metadata metadata = new Metadata();
- new DcXMLParser().parse(input, new DefaultHandler(), metadata);
-
- final String expected = "Archim\u00E8de et Lius \u00E0 Ch\u00E2teauneuf testing chars en \u00E9t\u00E9";
- assertEquals(expected,metadata.get(Metadata.RIGHTS));
- } finally {
- input.close();
- }
- }
-
-}
+/**
+ * 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.xml;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class DcXMLParserTest extends TestCase {
+
+ public void testXMLParserAsciiChars() throws Exception {
+ InputStream input = DcXMLParserTest.class.getResourceAsStream(
+ "/test-documents/testXML.xml");
+ try {
+ Metadata metadata = new Metadata();
+ ContentHandler handler = new BodyContentHandler();
+ new DcXMLParser().parse(input, handler, metadata);
+
+ assertEquals(
+ "application/xml",
+ metadata.get(Metadata.CONTENT_TYPE));
+ assertEquals("Tika test document", metadata.get(Metadata.TITLE));
+ assertEquals("Rida Benjelloun", metadata.get(Metadata.CREATOR));
+ assertEquals(
+ "Java, XML, XSLT, JDOM, Indexation",
+ metadata.get(Metadata.SUBJECT));
+ assertEquals(
+ "Framework d\'indexation des documents XML, HTML, PDF etc.. ",
+ metadata.get(Metadata.DESCRIPTION));
+ assertEquals(
+ "http://www.apache.org",
+ metadata.get(Metadata.IDENTIFIER));
+ assertEquals("test", metadata.get(Metadata.TYPE));
+ assertEquals("application/msword", metadata.get(Metadata.FORMAT));
+ assertEquals("Fr", metadata.get(Metadata.LANGUAGE));
+ assertTrue(metadata.get(Metadata.RIGHTS).contains("testing chars"));
+
+ String content = handler.toString();
+ assertTrue(content.contains("Tika test document"));
+ } finally {
+ input.close();
+ }
+ }
+
+ public void testXMLParserNonAsciiChars() throws Exception {
+ InputStream input = DcXMLParserTest.class.getResourceAsStream("/test-documents/testXML.xml");
+ try {
+ Metadata metadata = new Metadata();
+ new DcXMLParser().parse(input, new DefaultHandler(), metadata);
+
+ final String expected = "Archim\u00E8de et Lius \u00E0 Ch\u00E2teauneuf testing chars en \u00E9t\u00E9";
+ assertEquals(expected,metadata.get(Metadata.RIGHTS));
+ } finally {
+ input.close();
+ }
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/xml/DcXMLParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/sax/xpath/XPathParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/sax/xpath/XPathParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/sax/xpath/XPathParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/sax/xpath/XPathParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,121 +1,121 @@
-/*
- * 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.sax.xpath;
-
-import junit.framework.TestCase;
-
-public class XPathParserTest extends TestCase {
-
- private static final String NS = "test namespace";
-
- private XPathParser parser;
-
- protected void setUp() {
- parser = new XPathParser();
- parser.addPrefix(null, null);
- parser.addPrefix("prefix", NS);
- }
-
- public void testText() {
- Matcher matcher = parser.parse("/text()");
- assertTrue(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
- }
-
- public void testAnyAttribute() {
- Matcher matcher = parser.parse("/@*");
- assertFalse(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertTrue(matcher.matchesAttribute(null, "name"));
- assertTrue(matcher.matchesAttribute(NS, "name"));
- assertTrue(matcher.matchesAttribute(NS, "eman"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
- }
-
- public void testNamedAttribute() {
- Matcher matcher = parser.parse("/@name");
- assertFalse(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertTrue(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
- }
-
- public void testPrefixedAttribute() {
- Matcher matcher = parser.parse("/@prefix:name");
- assertFalse(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertTrue(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
- }
-
- public void testAnyElement() {
- Matcher matcher = parser.parse("/*");
- assertFalse(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- matcher = matcher.descend(NS, "name");
- assertFalse(matcher.matchesText());
- assertTrue(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
- }
-
- public void testNamedElement() {
- Matcher matcher = parser.parse("/name");
- assertFalse(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
- assertEquals(Matcher.FAIL, matcher.descend(null, "enam"));
- matcher = matcher.descend(null, "name");
- assertFalse(matcher.matchesText());
- assertTrue(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- }
-
- public void testPrefixedElement() {
- Matcher matcher = parser.parse("/prefix:name");
- assertFalse(matcher.matchesText());
- assertFalse(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- assertEquals(Matcher.FAIL, matcher.descend(null, "name"));
- assertEquals(Matcher.FAIL, matcher.descend(NS, "enam"));
- matcher = matcher.descend(NS, "name");
- assertFalse(matcher.matchesText());
- assertTrue(matcher.matchesElement());
- assertFalse(matcher.matchesAttribute(null, "name"));
- assertFalse(matcher.matchesAttribute(NS, "name"));
- assertFalse(matcher.matchesAttribute(NS, "eman"));
- }
-
-}
+/*
+ * 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.sax.xpath;
+
+import junit.framework.TestCase;
+
+public class XPathParserTest extends TestCase {
+
+ private static final String NS = "test namespace";
+
+ private XPathParser parser;
+
+ protected void setUp() {
+ parser = new XPathParser();
+ parser.addPrefix(null, null);
+ parser.addPrefix("prefix", NS);
+ }
+
+ public void testText() {
+ Matcher matcher = parser.parse("/text()");
+ assertTrue(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
+ }
+
+ public void testAnyAttribute() {
+ Matcher matcher = parser.parse("/@*");
+ assertFalse(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertTrue(matcher.matchesAttribute(null, "name"));
+ assertTrue(matcher.matchesAttribute(NS, "name"));
+ assertTrue(matcher.matchesAttribute(NS, "eman"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
+ }
+
+ public void testNamedAttribute() {
+ Matcher matcher = parser.parse("/@name");
+ assertFalse(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertTrue(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
+ }
+
+ public void testPrefixedAttribute() {
+ Matcher matcher = parser.parse("/@prefix:name");
+ assertFalse(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertTrue(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
+ }
+
+ public void testAnyElement() {
+ Matcher matcher = parser.parse("/*");
+ assertFalse(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ matcher = matcher.descend(NS, "name");
+ assertFalse(matcher.matchesText());
+ assertTrue(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
+ }
+
+ public void testNamedElement() {
+ Matcher matcher = parser.parse("/name");
+ assertFalse(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "name"));
+ assertEquals(Matcher.FAIL, matcher.descend(null, "enam"));
+ matcher = matcher.descend(null, "name");
+ assertFalse(matcher.matchesText());
+ assertTrue(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ }
+
+ public void testPrefixedElement() {
+ Matcher matcher = parser.parse("/prefix:name");
+ assertFalse(matcher.matchesText());
+ assertFalse(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ assertEquals(Matcher.FAIL, matcher.descend(null, "name"));
+ assertEquals(Matcher.FAIL, matcher.descend(NS, "enam"));
+ matcher = matcher.descend(NS, "name");
+ assertFalse(matcher.matchesText());
+ assertTrue(matcher.matchesElement());
+ assertFalse(matcher.matchesAttribute(null, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "name"));
+ assertFalse(matcher.matchesAttribute(NS, "eman"));
+ }
+
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/sax/xpath/XPathParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java Sun Nov 30 15:15:09 2008
@@ -1,79 +1,79 @@
-/**
- * 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.utils;
-
-import java.util.List;
-import junit.framework.TestCase;
-
-/**
- * Test case for {@link RegexUtils}.
- *
- * @version $Revision$ $Date$
- */
-public class RegexUtilsTest extends TestCase {
-
- /**
- * Test {@link RegexUtils#extractLinks(String)} with no links.
- */
-
- public void testExtractLinksNone() {
- List<String> links = null;
-
- links = RegexUtils.extractLinks(null);
- assertNotNull(links);
- assertEquals(0, links.size());
-
- links = RegexUtils.extractLinks("");
- assertNotNull(links);
- assertEquals(0, links.size());
-
- links = RegexUtils.extractLinks(
- "Test with no links " +
- "What about www.google.com");
- assertNotNull(links);
- assertEquals(0, links.size());
- }
-
-
- /**
- * Test {@link RegexUtils#extractLinks(String)} for http.
- */
- public void testExtractLinksHttp() {
- List<String> links = RegexUtils.extractLinks(
- "Test with http://www.nutch.org/index.html is it found? " +
- "What about www.google.com at http://www.google.de " +
- "A longer URL could be http://www.sybit.com/solutions/portals.html");
-
- assertTrue("Url not found!", links.size() == 3);
- assertEquals("Wrong URL", "http://www.nutch.org/index.html", links.get(0));
- assertEquals("Wrong URL", "http://www.google.de", links.get(1));
- assertEquals("Wrong URL", "http://www.sybit.com/solutions/portals.html", links.get(2));
- }
-
- /**
- * Test {@link RegexUtils#extractLinks(String)} for ftp.
- */
- public void testExtractLinksFtp() {
- List<String> links = RegexUtils.extractLinks(
- "Test with ftp://www.nutch.org is it found? " +
- "What about www.google.com at ftp://www.google.de");
-
- assertTrue("Url not found!", links.size() == 2);
- assertEquals("Wrong URL", "ftp://www.nutch.org", links.get(0));
- assertEquals("Wrong URL", "ftp://www.google.de", links.get(1));
- }
-}
+/**
+ * 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.utils;
+
+import java.util.List;
+import junit.framework.TestCase;
+
+/**
+ * Test case for {@link RegexUtils}.
+ *
+ * @version $Revision$ $Date$
+ */
+public class RegexUtilsTest extends TestCase {
+
+ /**
+ * Test {@link RegexUtils#extractLinks(String)} with no links.
+ */
+
+ public void testExtractLinksNone() {
+ List<String> links = null;
+
+ links = RegexUtils.extractLinks(null);
+ assertNotNull(links);
+ assertEquals(0, links.size());
+
+ links = RegexUtils.extractLinks("");
+ assertNotNull(links);
+ assertEquals(0, links.size());
+
+ links = RegexUtils.extractLinks(
+ "Test with no links " +
+ "What about www.google.com");
+ assertNotNull(links);
+ assertEquals(0, links.size());
+ }
+
+
+ /**
+ * Test {@link RegexUtils#extractLinks(String)} for http.
+ */
+ public void testExtractLinksHttp() {
+ List<String> links = RegexUtils.extractLinks(
+ "Test with http://www.nutch.org/index.html is it found? " +
+ "What about www.google.com at http://www.google.de " +
+ "A longer URL could be http://www.sybit.com/solutions/portals.html");
+
+ assertTrue("Url not found!", links.size() == 3);
+ assertEquals("Wrong URL", "http://www.nutch.org/index.html", links.get(0));
+ assertEquals("Wrong URL", "http://www.google.de", links.get(1));
+ assertEquals("Wrong URL", "http://www.sybit.com/solutions/portals.html", links.get(2));
+ }
+
+ /**
+ * Test {@link RegexUtils#extractLinks(String)} for ftp.
+ */
+ public void testExtractLinksFtp() {
+ List<String> links = RegexUtils.extractLinks(
+ "Test with ftp://www.nutch.org is it found? " +
+ "What about www.google.com at ftp://www.google.de");
+
+ assertTrue("Url not found!", links.size() == 2);
+ assertEquals("Wrong URL", "ftp://www.nutch.org", links.get(0));
+ assertEquals("Wrong URL", "ftp://www.google.de", links.get(1));
+ }
+}
Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native