TIKA-1860 - Added bundle poms and tests to tika-parsers-bundle folder Project: http://git-wip-us.apache.org/repos/asf/tika/repo Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/9f8d6aed Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/9f8d6aed Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/9f8d6aed
Branch: refs/heads/2.x Commit: 9f8d6aedf375c64be428d36d555c15afa4d25c95 Parents: f1e4ebd Author: Bob Paulin <[email protected]> Authored: Tue Mar 1 21:11:01 2016 -0600 Committer: Bob Paulin <[email protected]> Committed: Tue Mar 1 21:11:41 2016 -0600 ---------------------------------------------------------------------- pom.xml | 1 + tika-parser-bundles/pom.xml | 65 +++++- .../tika-multimedia-bundle/pom.xml | 102 --------- .../module/multimedia/internal/Activator.java | 49 ----- .../java/org/apache/tika/module/BundleIT.java | 203 ------------------ .../src/test/resources/hadoop.jpg | Bin 8362 -> 0 bytes .../src/test/resources/testFLV.flv | Bin 90580 -> 0 bytes .../src/test/resources/testMID.mid | Bin 322 -> 0 bytes .../src/test/resources/testMP3i18n.mp3 | Bin 40832 -> 0 bytes .../src/test/resources/tika.png | Bin 22216 -> 0 bytes .../module/BundleIT.java | 89 ++++++++ .../tika-parser-advanced-bundle/pom.xml | 83 ++++++++ .../apache/tika/module/advanced/BundleIT.java | 98 +++++++++ .../test-bundles.xml | 34 +++ .../tika-parser-cad-bundle/pom.xml | 73 +++++++ .../org/apache/tika/module/cad/BundleIT.java | 96 +++++++++ .../tika-parser-cad-bundle/test-bundles.xml | 34 +++ .../tika-parser-code-bundle/.gitignore | 1 + .../tika-parser-code-bundle/pom.xml | 76 +++++++ .../org/apache/tika/module/code/BundleIT.java | 96 +++++++++ .../tika-parser-code-bundle/test-bundles.xml | 34 +++ .../tika-parser-crypto-bundle/.gitignore | 1 + .../tika-parser-crypto-bundle/pom.xml | 79 +++++++ .../org/apache/tika/module/crypto/BundleIT.java | 96 +++++++++ .../tika-parser-crypto-bundle/test-bundles.xml | 34 +++ .../tika-parser-database-bundle/.gitignore | 1 + .../tika-parser-database-bundle/pom.xml | 68 ++++++ .../apache/tika/module/database/BundleIT.java | 96 +++++++++ .../test-bundles.xml | 34 +++ .../tika-parser-ebook-bundle/pom.xml | 72 +++++++ .../org/apache/tika/module/ebook/BundleIT.java | 97 +++++++++ .../tika-parser-ebook-bundle/test-bundles.xml | 35 +++ .../tika-parser-journal-bundle/pom.xml | 80 +++++++ .../apache/tika/module/journal/BundleIT.java | 97 +++++++++ .../tika-parser-journal-bundle/test-bundles.xml | 35 +++ .../tika-parser-multimedia-bundle/pom.xml | 85 ++++++++ .../apache/tika/module/multimedia/BundleIT.java | 211 +++++++++++++++++++ .../src/test/resources/hadoop.jpg | Bin 0 -> 8362 bytes .../src/test/resources/testFLV.flv | Bin 0 -> 90580 bytes .../src/test/resources/testMID.mid | Bin 0 -> 322 bytes .../src/test/resources/testMP3i18n.mp3 | Bin 0 -> 40832 bytes .../src/test/resources/tika.png | Bin 0 -> 22216 bytes .../test-bundles.xml | 34 +++ .../tika-parser-office-bundle/pom.xml | 138 ++++++++++++ .../org/apache/tika/module/office/BundleIT.java | 87 ++++++++ .../tika-parser-office-bundle/test-bundles.xml | 37 ++++ .../tika-parser-package-bundle/pom.xml | 134 ++++++++++++ .../org/apache/tika/module/pkg/BundleIT.java | 96 +++++++++ .../tika-parser-package-bundle/test-bundles.xml | 34 +++ .../tika-parser-pdf-bundle/pom.xml | 87 ++++++++ .../org/apache/tika/module/pdf/BundleIT.java | 96 +++++++++ .../tika-parser-pdf-bundle/test-bundles.xml | 34 +++ .../tika-parser-scientific-bundle/pom.xml | 202 ++++++++++++++++++ .../apache/tika/module/scientific/BundleIT.java | 96 +++++++++ .../test-bundles.xml | 34 +++ .../tika-parser-text-bundle/pom.xml | 79 +++++++ .../org/apache/tika/module/text/BundleIT.java | 96 +++++++++ .../tika-parser-text-bundle/test-bundles.xml | 34 +++ .../tika-parser-web-bundle/pom.xml | 93 ++++++++ .../org/apache/tika/module/web/BundleIT.java | 96 +++++++++ .../tika-parser-web-bundle/test-bundles.xml | 34 +++ .../tika-parser-advanced-module/pom.xml | 44 ---- .../java/org/apache/tika/module/BundleIT.java | 89 -------- .../test-bundles.xml | 34 --- .../tika-parser-cad-module/pom.xml | 34 --- .../tika-parser-cad-module/test-bundles.xml | 34 --- .../tika-parser-code-module/pom.xml | 41 ---- .../java/org/apache/tika/module/BundleIT.java | 88 -------- .../tika-parser-code-module/test-bundles.xml | 34 --- .../tika-parser-crypto-module/pom.xml | 44 ---- .../java/org/apache/tika/module/BundleIT.java | 88 -------- .../tika-parser-crypto-module/test-bundles.xml | 34 --- .../module/database/internal/Activator.java | 36 ++++ .../tika/module/ebook/internal/Activator.java | 36 ++++ .../tika/module/journal/internal/Activator.java | 36 ++++ .../tika-parser-multimedia-module/pom.xml | 50 ----- .../java/org/apache/tika/module/BundleIT.java | 205 ------------------ .../test-bundles.xml | 34 --- .../tika/module/office/internal/Activator.java | 36 ++++ .../services/org.apache.tika.parser.Parser | 2 + .../tika-parser-package-module/pom.xml | 6 +- .../tika/module/pkg/internal/Activator.java | 36 ++++ .../tika/module/pdf/internal/Activator.java | 36 ++++ .../module/scientific/internal/Activator.java | 36 ++++ .../tika/module/text/internal/Activator.java | 20 ++ .../tika/module/web/internal/Activator.java | 36 ++++ .../services/org.apache.tika.parser.Parser | 2 - 87 files changed, 3752 insertions(+), 1215 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index f4024e3..c790244 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,7 @@ <module>tika-example</module> <module>tika-java7</module> <module>tika-parser-modules</module> + <module>tika-parser-bundles</module> </modules> <profiles> http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/pom.xml b/tika-parser-bundles/pom.xml index e7addc7..1b60f9f 100644 --- a/tika-parser-bundles/pom.xml +++ b/tika-parser-bundles/pom.xml @@ -40,10 +40,23 @@ <pdfbox.version>1.8.10</pdfbox.version> </properties> - <!-- <modules> - <module>tika-multimedia-bundle</module> + <modules> + <module>tika-parser-advanced-bundle</module> + <module>tika-parser-cad-bundle</module> + <module>tika-parser-code-bundle</module> + <module>tika-parser-crypto-bundle</module> + <module>tika-parser-database-bundle</module> + <module>tika-parser-ebook-bundle</module> + <module>tika-parser-journal-bundle</module> + <module>tika-parser-multimedia-bundle</module> + <module>tika-parser-office-bundle</module> + <module>tika-parser-package-bundle</module> + <module>tika-parser-pdf-bundle</module> + <module>tika-parser-scientific-bundle</module> + <module>tika-parser-text-bundle</module> + <module>tika-parser-web-bundle</module> </modules> - --> + <dependencies> <!-- Optional OSGi dependencies, used only when running within OSGi --> <dependency> @@ -113,4 +126,50 @@ <scope>test</scope> </dependency> </dependencies> + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + <configuration> + <systemPropertyVariables> + <org.ops4j.pax.logging.DefaultServiceLog.level> + WARN + </org.ops4j.pax.logging.DefaultServiceLog.level> + </systemPropertyVariables> + <systemProperties> + <property> + <name>project.bundle.file</name> + <value>target/${project.build.finalName}.jar</value> + </property> + </systemProperties> + </configuration> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <phase>pre-integration-test</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptor>test-bundles.xml</descriptor> + <finalName>test</finalName> + <attach>false</attach> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> + </build> </project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/pom.xml b/tika-parser-bundles/tika-multimedia-bundle/pom.xml deleted file mode 100644 index 2e48ff6..0000000 --- a/tika-parser-bundles/tika-multimedia-bundle/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?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. --> -<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/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.tika</groupId> - <artifactId>tika-parser-bundles</artifactId> - <version>2.0-SNAPSHOT</version> - </parent> - - <artifactId>tika-multimedia-bundle</artifactId> - <packaging>bundle</packaging> - <name>Apache Tika Multimedia Bundle</name> - <url>http://tika.apache.org/</url> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>tika-parser-multimedia-module</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-Activator>org.apache.tika.module.multimedia.internal.Activator</Bundle-Activator> - <_runsystempackages>com.sun.xml.bind.marshaller, - com.sun.xml.internal.bind.marshaller</_runsystempackages> - <Embed-Dependency> - metadata-extractor, - xmpcore, - commons-codec, - commons-io, - jempbox, - poi, - isoparser, - aspectjrt, - tika-multimedia-parser-module;inline=true - </Embed-Dependency> - <Embed-Transitive>true</Embed-Transitive> - <Export-Package> - org.apache.tika.parser.image.*, - org.apache.tika.parser.jpeg.*, - org.apache.tika.parser.audio.*, - org.apache.tika.parser.video.*, - org.apache.tika.parser.mp3.*, - org.apache.tika.parser.mp4.* - </Export-Package> - <Import-Package> - *, - com.adobe.xmp;resolution:=optional, - com.adobe.xmp.properties;resolution:=optional, - android.util;resolution:=optional - </Import-Package> - </instructions> - </configuration> - </plugin> - <plugin> - <artifactId>maven-failsafe-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <org.ops4j.pax.logging.DefaultServiceLog.level> - WARN - </org.ops4j.pax.logging.DefaultServiceLog.level> - </systemPropertyVariables> - <systemProperties> - <property> - <name>project.bundle.file</name> - <value>target/${project.build.finalName}.jar</value> - </property> - </systemProperties> - </configuration> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/main/java/org/apache/tika/module/multimedia/internal/Activator.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/main/java/org/apache/tika/module/multimedia/internal/Activator.java b/tika-parser-bundles/tika-multimedia-bundle/src/main/java/org/apache/tika/module/multimedia/internal/Activator.java deleted file mode 100644 index 278fb4f..0000000 --- a/tika-parser-bundles/tika-multimedia-bundle/src/main/java/org/apache/tika/module/multimedia/internal/Activator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.module.multimedia.internal; - -import org.apache.tika.osgi.TikaAbstractBundleActivator; -import org.apache.tika.parser.audio.AudioParser; -import org.apache.tika.parser.audio.MidiParser; -import org.apache.tika.parser.image.ImageParser; -import org.apache.tika.parser.jpeg.JpegParser; -import org.apache.tika.parser.mp3.Mp3Parser; -import org.apache.tika.parser.mp4.MP4Parser; -import org.apache.tika.parser.video.FLVParser; -import org.osgi.framework.BundleContext; - -public class Activator extends TikaAbstractBundleActivator { - - @Override - public void start(BundleContext context) throws Exception { - - registerTikaService(context, new JpegParser(), null); - registerTikaService(context, new ImageParser(), null); - registerTikaService(context, new AudioParser(), null); - registerTikaService(context, new MidiParser(), null); - registerTikaService(context, new FLVParser(), null); - registerTikaService(context, new Mp3Parser(), null); - registerTikaService(context, new MP4Parser(), null); - - } - - @Override - public void stop(BundleContext context) throws Exception { - - } - -} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/test/java/org/apache/tika/module/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/test/java/org/apache/tika/module/BundleIT.java b/tika-parser-bundles/tika-multimedia-bundle/src/test/java/org/apache/tika/module/BundleIT.java deleted file mode 100644 index bd6225e..0000000 --- a/tika-parser-bundles/tika-multimedia-bundle/src/test/java/org/apache/tika/module/BundleIT.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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.module; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertNotNull; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.junitBundles; -import static org.ops4j.pax.exam.CoreOptions.options; -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; - -import javax.inject.Inject; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.io.Writer; -import java.net.URISyntaxException; -import java.util.Dictionary; - -import org.apache.tika.io.TikaInputStream; -import org.apache.tika.metadata.Metadata; -import org.apache.tika.metadata.TikaCoreProperties; -import org.apache.tika.mime.MediaType; -import org.apache.tika.osgi.TikaService; -import org.apache.tika.parser.ParseContext; -import org.apache.tika.sax.BodyContentHandler; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.xml.sax.ContentHandler; - -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerMethod.class) -public class BundleIT { - - private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; - @Inject - private BundleContext bc; - - @Configuration - public Option[] configuration() throws IOException, URISyntaxException { - String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); - return options(junitBundles(), mavenBundle("org.apache.tika", "tika-core"), - bundle(new File(bundleFileName).toURI().toString())); - } - - @Test - public void testBundleLoaded() throws Exception { - boolean hasCore = false, hasBundle = false; - for (Bundle b : bc.getBundles()) { - if ("org.apache.tika.core".equals(b.getSymbolicName())) { - hasCore = true; - assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); - } - if ("org.apache.tika.multimedia-bundle".equals(b.getSymbolicName())) { - hasBundle = true; - assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); - } - } - assertTrue("Core bundle not found", hasCore); - assertTrue("Image bundle not found", hasBundle); - } - - @Test - public void testImageParser() throws Exception { - TikaService tikaService = bc.getService(bc.getServiceReference(TikaService.class)); - InputStream stream = bc.getBundle().getResource("tika.png").openStream(); - - assertNotNull(stream); - - Metadata metadata = new Metadata(); - TikaInputStream tikaStream = TikaInputStream.get(stream); - MediaType type = tikaService.detect(tikaStream, metadata); - - assertEquals("Media Type should be PNG", MediaType.image("png"), type); - - metadata.add(Metadata.CONTENT_TYPE, type.toString()); - Writer writer = new StringWriter(); - ContentHandler contentHandler = new BodyContentHandler(writer); - ParseContext context = new ParseContext(); - - tikaService.parse(tikaStream, contentHandler, metadata, context); - - assertEquals("Image Output Width Should Match", "292", metadata.get(Metadata.IMAGE_WIDTH)); - } - - @Test - public void testJpegParser() throws Exception { - - TikaService tikaService = bc.getService(bc.getServiceReference(TikaService.class)); - InputStream stream = bc.getBundle().getResource("hadoop.jpg").openStream(); - - assertNotNull(stream); - - Metadata metadata = new Metadata(); - TikaInputStream tikaStream = TikaInputStream.get(stream); - MediaType type = tikaService.detect(tikaStream, metadata); - - assertEquals("Media Type should be JPEG", MediaType.image("jpeg"), type); - - metadata.add(Metadata.CONTENT_TYPE, type.toString()); - Writer writer = new StringWriter(); - ContentHandler contentHandler = new BodyContentHandler(writer); - ParseContext context = new ParseContext(); - - tikaService.parse(tikaStream, contentHandler, metadata, context); - - assertEquals("Jpg Output Width Should Match", "212", metadata.get(Metadata.IMAGE_WIDTH)); - } - @Test - public void testVideoParser() throws Exception { - TikaService tikaService = bc.getService(bc.getServiceReference(TikaService.class)); - InputStream stream = bc.getBundle().getResource("testFLV.flv").openStream(); - - assertNotNull(stream); - - Metadata metadata = new Metadata(); - TikaInputStream tikaStream = TikaInputStream.get(stream); - MediaType type = tikaService.detect(tikaStream, metadata); - - assertEquals("Media Type should be FLV", MediaType.video("x-flv"), type); - - metadata.add(Metadata.CONTENT_TYPE, type.toString()); - Writer writer = new StringWriter(); - ContentHandler contentHandler = new BodyContentHandler(writer); - ParseContext context = new ParseContext(); - - tikaService.parse(tikaStream, contentHandler, metadata, context); - - assertEquals("Video Should have audio", "true", metadata.get("hasAudio")); - - } - - @Test - public void testMp3Parser() throws Exception { - TikaService tikaService = bc.getService(bc.getServiceReference(TikaService.class)); - InputStream stream = bc.getBundle().getResource("testMP3i18n.mp3").openStream(); - - assertNotNull(stream); - - Metadata metadata = new Metadata(); - TikaInputStream tikaStream = TikaInputStream.get(stream); - MediaType type = tikaService.detect(tikaStream, metadata); - - assertEquals("Media Type should be MP3", MediaType.audio("mpeg"), type); - - metadata.add(Metadata.CONTENT_TYPE, type.toString()); - Writer writer = new StringWriter(); - ContentHandler contentHandler = new BodyContentHandler(writer); - ParseContext context = new ParseContext(); - - tikaService.parse(tikaStream, contentHandler, metadata, context); - - assertEquals("MP3 should have title", "Une chason en Fran\u00e7ais", metadata.get(TikaCoreProperties.TITLE)); - - } - - @Test - public void testMidiParser() throws Exception { - TikaService tikaService = bc.getService(bc.getServiceReference(TikaService.class)); - InputStream stream = bc.getBundle().getResource("testMID.mid").openStream(); - - assertNotNull(stream); - - Metadata metadata = new Metadata(); - TikaInputStream tikaStream = TikaInputStream.get(stream); - MediaType type = tikaService.detect(tikaStream, metadata); - - assertEquals("Media Type should be Midi", MediaType.audio("midi"), type); - - metadata.add(Metadata.CONTENT_TYPE, type.toString()); - Writer writer = new StringWriter(); - ContentHandler contentHandler = new BodyContentHandler(writer); - ParseContext context = new ParseContext(); - - tikaService.parse(tikaStream, contentHandler, metadata, context); - assertEquals("Midi should have 2 tracks", "2", metadata.get("tracks")); - } - -} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/hadoop.jpg ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/hadoop.jpg b/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/hadoop.jpg deleted file mode 100644 index f1bc2da..0000000 Binary files a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/hadoop.jpg and /dev/null differ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testFLV.flv ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testFLV.flv b/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testFLV.flv deleted file mode 100644 index d35e9bb..0000000 Binary files a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testFLV.flv and /dev/null differ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMID.mid ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMID.mid b/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMID.mid deleted file mode 100644 index 883ef37..0000000 Binary files a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMID.mid and /dev/null differ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMP3i18n.mp3 ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMP3i18n.mp3 b/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMP3i18n.mp3 deleted file mode 100644 index 0f25370..0000000 Binary files a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/testMP3i18n.mp3 and /dev/null differ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/tika.png ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/tika.png b/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/tika.png deleted file mode 100644 index d3487c5..0000000 Binary files a/tika-parser-bundles/tika-multimedia-bundle/src/test/resources/tika.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-advanced-bundle/module/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-advanced-bundle/module/BundleIT.java b/tika-parser-bundles/tika-parser-advanced-bundle/module/BundleIT.java new file mode 100644 index 0000000..c446ee8 --- /dev/null +++ b/tika-parser-bundles/tika-parser-advanced-bundle/module/BundleIT.java @@ -0,0 +1,89 @@ +/* + * 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.module; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + + return options(junitBundles(), + bundle(new File("target/test-bundles/tika-core.jar").toURI().toURL().toString()), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-advanced-module".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Advanced bundle not found", hasBundle); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-advanced-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-advanced-bundle/pom.xml b/tika-parser-bundles/tika-parser-advanced-bundle/pom.xml new file mode 100644 index 0000000..2339483 --- /dev/null +++ b/tika-parser-bundles/tika-parser-advanced-bundle/pom.xml @@ -0,0 +1,83 @@ +<?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. --> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parser-bundles</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <artifactId>tika-parser-advanced-bundle</artifactId> + <packaging>bundle</packaging> + <name>Apache Tika parser advanced bundle</name> + <url>http://tika.apache.org/</url> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-advanced-module</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator>org.apache.tika.module.advanced.internal.Activator</Bundle-Activator> + <Embed-Dependency> + tika-parser-advanced-module;inline=true, + opennlp-tools;inline=true, + opennlp-maxent;inline=true, + commons-io;inline=true, + jwnl;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.ner.*, + org.apache.tika.parser.ner.corenlp.*, + org.apache.tika.parser.ner.opennlp.*, + org.apache.tika.parser.ner.regex.* + </Export-Package> + <Import-Package> + *, + opennlp.maxent;resolution:=optional, + opennlp.tools.namefind;resolution:=optional, + org.apache.commons.io;resolution:=optional, + org.json;resolution:=optional, + org.osgi.framework;resolution:=optional, + net.didion.jwnl;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-advanced-bundle/src/test/java/org/apache/tika/module/advanced/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-advanced-bundle/src/test/java/org/apache/tika/module/advanced/BundleIT.java b/tika-parser-bundles/tika-parser-advanced-bundle/src/test/java/org/apache/tika/module/advanced/BundleIT.java new file mode 100644 index 0000000..3f30950 --- /dev/null +++ b/tika-parser-bundles/tika-parser-advanced-bundle/src/test/java/org/apache/tika/module/advanced/BundleIT.java @@ -0,0 +1,98 @@ +/* + * 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.module.advanced; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.parser.Parser; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + + return options(junitBundles(), + bundle(new File("target/test-bundles/tika-core.jar").toURI().toURL().toString()), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-advanced-bundle".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Advanced bundle not found", hasBundle); + } + + @Test + public void testNoServicesCreated() throws Exception { + ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null); + assertNull("Not all Services have started", services); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-advanced-bundle/test-bundles.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-advanced-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-advanced-bundle/test-bundles.xml new file mode 100644 index 0000000..53bb6e4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-advanced-bundle/test-bundles.xml @@ -0,0 +1,34 @@ +<!-- + 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. + --> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bundles</id> + <formats> + <format>dir</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory/> + <outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping> + <includes> + <include>org.apache.tika:tika-core</include> + </includes> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-cad-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-cad-bundle/pom.xml b/tika-parser-bundles/tika-parser-cad-bundle/pom.xml new file mode 100644 index 0000000..f269a7d --- /dev/null +++ b/tika-parser-bundles/tika-parser-cad-bundle/pom.xml @@ -0,0 +1,73 @@ +<?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. --> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parser-bundles</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <artifactId>tika-parser-cad-bundle</artifactId> + <packaging>bundle</packaging> + <name>Apache Tika parser cad bundle</name> + <url>http://tika.apache.org/</url> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-cad-module</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator>org.apache.tika.module.cad.internal.Activator</Bundle-Activator> + <Embed-Dependency> + tika-parser-cad-module;inline=true, + poi;inline=true, + commons-codec;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.dwg.*, + org.apache.tika.parser.prt.* + </Export-Package> + <Import-Package> + * + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-cad-bundle/src/test/java/org/apache/tika/module/cad/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-cad-bundle/src/test/java/org/apache/tika/module/cad/BundleIT.java b/tika-parser-bundles/tika-parser-cad-bundle/src/test/java/org/apache/tika/module/cad/BundleIT.java new file mode 100644 index 0000000..849c1f4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-cad-bundle/src/test/java/org/apache/tika/module/cad/BundleIT.java @@ -0,0 +1,96 @@ +/* + * 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.module.cad; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.parser.Parser; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), + bundle(new File("target/test-bundles/tika-core.jar").toURI().toURL().toString()), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-cad-bundle".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Cad bundle not found", hasBundle); + } + + @Test + public void testServicesCreated() throws Exception { + ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null); + assertEquals("Not all Services have started", 1, services.length); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-cad-bundle/test-bundles.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-cad-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-cad-bundle/test-bundles.xml new file mode 100644 index 0000000..53bb6e4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-cad-bundle/test-bundles.xml @@ -0,0 +1,34 @@ +<!-- + 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. + --> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bundles</id> + <formats> + <format>dir</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory/> + <outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping> + <includes> + <include>org.apache.tika:tika-core</include> + </includes> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-code-bundle/.gitignore ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-code-bundle/.gitignore b/tika-parser-bundles/tika-parser-code-bundle/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/tika-parser-bundles/tika-parser-code-bundle/.gitignore @@ -0,0 +1 @@ +/target/ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-code-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-code-bundle/pom.xml b/tika-parser-bundles/tika-parser-code-bundle/pom.xml new file mode 100644 index 0000000..c900de4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-code-bundle/pom.xml @@ -0,0 +1,76 @@ +<?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. --> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parser-bundles</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <artifactId>tika-parser-code-bundle</artifactId> + <packaging>bundle</packaging> + <name>Apache Tika parser code bundle</name> + <url>http://tika.apache.org/</url> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-code-module</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator>org.apache.tika.module.code.internal.Activator</Bundle-Activator> + <Embed-Dependency> + tika-parser-code-module;inline=true, + asm;inline=true, + tagsoup;inline=true, + jhighlight;inline=true, + commons-io;inline=true, + commons-codec;inline=true, + poi;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.asm.*, + org.apache.tika.parser.code.*, + org.apache.tika.parser.executable.* + </Export-Package> + <Import-Package> + *, + javax.servlet;resolution:=optional, + javax.servlet.http;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-code-bundle/src/test/java/org/apache/tika/module/code/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-code-bundle/src/test/java/org/apache/tika/module/code/BundleIT.java b/tika-parser-bundles/tika-parser-code-bundle/src/test/java/org/apache/tika/module/code/BundleIT.java new file mode 100644 index 0000000..1dda91b --- /dev/null +++ b/tika-parser-bundles/tika-parser-code-bundle/src/test/java/org/apache/tika/module/code/BundleIT.java @@ -0,0 +1,96 @@ +/* + * 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.module.code; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.parser.Parser; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), + bundle(new File("target/test-bundles/tika-core.jar").toURI().toURL().toString()), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-code-bundle".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Code bundle not found", hasBundle); + } + + @Test + public void testServicesCreated() throws Exception { + ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null); + assertEquals("Not all Services have started", 3, services.length); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-code-bundle/test-bundles.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-code-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-code-bundle/test-bundles.xml new file mode 100644 index 0000000..53bb6e4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-code-bundle/test-bundles.xml @@ -0,0 +1,34 @@ +<!-- + 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. + --> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bundles</id> + <formats> + <format>dir</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory/> + <outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping> + <includes> + <include>org.apache.tika:tika-core</include> + </includes> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-crypto-bundle/.gitignore ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-crypto-bundle/.gitignore b/tika-parser-bundles/tika-parser-crypto-bundle/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/tika-parser-bundles/tika-parser-crypto-bundle/.gitignore @@ -0,0 +1 @@ +/target/ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-crypto-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-crypto-bundle/pom.xml b/tika-parser-bundles/tika-parser-crypto-bundle/pom.xml new file mode 100644 index 0000000..64203fe --- /dev/null +++ b/tika-parser-bundles/tika-parser-crypto-bundle/pom.xml @@ -0,0 +1,79 @@ +<?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. --> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parser-bundles</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <artifactId>tika-parser-crypto-bundle</artifactId> + <packaging>bundle</packaging> + <name>Apache Tika parser crypto bundle</name> + <url>http://tika.apache.org/</url> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-crypto-module</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator>org.apache.tika.module.crypto.internal.Activator</Bundle-Activator> + <Embed-Dependency> + tika-parser-crypto-module;inline=true, + bcmail-jdk15on;inline=true, + bcprov-jdk15on;inline=true, + bcpkix-jdk15on;inline=true, + commons-io;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.crypto.*, + </Export-Package> + <Import-Package> + *, + javax.mail;resolution:=optional, + javax.mail.internet;resolution:=optional, + org.bouncycastle.cert;resolution:=optional, + org.bouncycastle.cert.jcajce;resolution:=optional, + org.bouncycastle.cert.ocsp;resolution:=optional, + org.bouncycastle.cms.bc;resolution:=optional, + org.bouncycastle.operator;resolution:=optional, + org.bouncycastle.operator.bc;resolution:=optional, + org.bouncycastle.tsp;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-crypto-bundle/src/test/java/org/apache/tika/module/crypto/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-crypto-bundle/src/test/java/org/apache/tika/module/crypto/BundleIT.java b/tika-parser-bundles/tika-parser-crypto-bundle/src/test/java/org/apache/tika/module/crypto/BundleIT.java new file mode 100644 index 0000000..46fba94 --- /dev/null +++ b/tika-parser-bundles/tika-parser-crypto-bundle/src/test/java/org/apache/tika/module/crypto/BundleIT.java @@ -0,0 +1,96 @@ +/* + * 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.module.crypto; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.parser.Parser; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), + bundle(new File("target/test-bundles/tika-core.jar").toURI().toURL().toString()), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-crypto-bundle".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Crypto bundle not found", hasBundle); + } + + @Test + public void testServicesCreated() throws Exception { + ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null); + assertEquals("Not all Services have started", 1, services.length); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-crypto-bundle/test-bundles.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-crypto-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-crypto-bundle/test-bundles.xml new file mode 100644 index 0000000..53bb6e4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-crypto-bundle/test-bundles.xml @@ -0,0 +1,34 @@ +<!-- + 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. + --> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bundles</id> + <formats> + <format>dir</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory/> + <outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping> + <includes> + <include>org.apache.tika:tika-core</include> + </includes> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-database-bundle/.gitignore ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-database-bundle/.gitignore b/tika-parser-bundles/tika-parser-database-bundle/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/tika-parser-bundles/tika-parser-database-bundle/.gitignore @@ -0,0 +1 @@ +/target/ http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-database-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-database-bundle/pom.xml b/tika-parser-bundles/tika-parser-database-bundle/pom.xml new file mode 100644 index 0000000..972dce3 --- /dev/null +++ b/tika-parser-bundles/tika-parser-database-bundle/pom.xml @@ -0,0 +1,68 @@ +<?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. --> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parser-bundles</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <artifactId>tika-parser-database-bundle</artifactId> + <packaging>bundle</packaging> + <name>Apache Tika parser database bundle</name> + <url>http://tika.apache.org/</url> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-database-module</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator>org.apache.tika.module.database.internal.Activator</Bundle-Activator> + <Embed-Dependency> + tika-parser-database-module;inline=true, + commons-io;inline=true, + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.jdbc.* + </Export-Package> + <Import-Package> + *, + org.sqlite;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-database-bundle/src/test/java/org/apache/tika/module/database/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-database-bundle/src/test/java/org/apache/tika/module/database/BundleIT.java b/tika-parser-bundles/tika-parser-database-bundle/src/test/java/org/apache/tika/module/database/BundleIT.java new file mode 100644 index 0000000..b431da5 --- /dev/null +++ b/tika-parser-bundles/tika-parser-database-bundle/src/test/java/org/apache/tika/module/database/BundleIT.java @@ -0,0 +1,96 @@ +/* + * 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.module.database; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.parser.Parser; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), + bundle(new File("target/test-bundles/tika-core.jar").toURI().toURL().toString()), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-database-bundle".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Database bundle not found", hasBundle); + } + + @Test + public void testServicesCreated() throws Exception { + ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null); + assertEquals("Not all Services have started", 1, services.length); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-database-bundle/test-bundles.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-database-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-database-bundle/test-bundles.xml new file mode 100644 index 0000000..53bb6e4 --- /dev/null +++ b/tika-parser-bundles/tika-parser-database-bundle/test-bundles.xml @@ -0,0 +1,34 @@ +<!-- + 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. + --> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bundles</id> + <formats> + <format>dir</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory/> + <outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping> + <includes> + <include>org.apache.tika:tika-core</include> + </includes> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-ebook-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-bundles/tika-parser-ebook-bundle/pom.xml b/tika-parser-bundles/tika-parser-ebook-bundle/pom.xml new file mode 100644 index 0000000..742ec99 --- /dev/null +++ b/tika-parser-bundles/tika-parser-ebook-bundle/pom.xml @@ -0,0 +1,72 @@ +<?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. --> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parser-bundles</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <artifactId>tika-parser-ebook-bundle</artifactId> + <packaging>bundle</packaging> + <name>Apache Tika parser ebook bundle</name> + <url>http://tika.apache.org/</url> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-ebook-module</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>tika-parser-text-bundle</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator>org.apache.tika.module.ebook.internal.Activator</Bundle-Activator> + <Embed-Dependency> + tika-parser-ebook-module;inline=true, + commons-io;inline=true, + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.epub.* + </Export-Package> + <Import-Package> + * + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file
