You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by bo...@apache.org on 2016/03/02 14:54:32 UTC
[2/3] tika git commit: TIKA-1860 - Added bundle poms and tests to
tika-parsers-bundle folder
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-ebook-bundle/src/test/java/org/apache/tika/module/ebook/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-ebook-bundle/src/test/java/org/apache/tika/module/ebook/BundleIT.java b/tika-parser-bundles/tika-parser-ebook-bundle/src/test/java/org/apache/tika/module/ebook/BundleIT.java
new file mode 100644
index 0000000..9af01f8
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-ebook-bundle/src/test/java/org/apache/tika/module/ebook/BundleIT.java
@@ -0,0 +1,97 @@
+/*
+ * 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.ebook;
+
+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("target/test-bundles/tika-parser-text-bundle.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-ebook-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("E-Book bundle not found", hasBundle);
+ }
+
+ @Test
+ public void testServicesCreated() throws Exception {
+ ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null);
+ assertEquals("Not all Services have started", 4, services.length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-ebook-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-ebook-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-ebook-bundle/test-bundles.xml
new file mode 100644
index 0000000..65978d0
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-ebook-bundle/test-bundles.xml
@@ -0,0 +1,35 @@
+<!--
+ 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>
+ <include>org.apache.tika:tika-parser-text-bundle</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-journal-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-journal-bundle/pom.xml b/tika-parser-bundles/tika-parser-journal-bundle/pom.xml
new file mode 100644
index 0000000..c03cb4b
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-journal-bundle/pom.xml
@@ -0,0 +1,80 @@
+<?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-journal-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika parser journal bundle</name>
+ <url>http://tika.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-journal-module</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-pdf-bundle</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.journal.internal.Activator</Bundle-Activator>
+ <Embed-Dependency>
+ tika-parser-journal-module;inline=true,
+ commons-io;inline=true,
+ </Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Package>
+ org.apache.tika.parser.journal.*
+ </Export-Package>
+ <Import-Package>
+ *,
+ javax.ws.rs.core;resolution:=optional,
+ org.apache.cxf.jaxrs.client;resolution:=optional,
+ org.apache.cxf.jaxrs.ext.multipart;resolution:=optional,
+ org.json;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-journal-bundle/src/test/java/org/apache/tika/module/journal/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-journal-bundle/src/test/java/org/apache/tika/module/journal/BundleIT.java b/tika-parser-bundles/tika-parser-journal-bundle/src/test/java/org/apache/tika/module/journal/BundleIT.java
new file mode 100644
index 0000000..6d65164
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-journal-bundle/src/test/java/org/apache/tika/module/journal/BundleIT.java
@@ -0,0 +1,97 @@
+/*
+ * 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.journal;
+
+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("target/test-bundles/tika-parser-pdf-bundle.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-journal-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("Journal bundle not found", hasBundle);
+ }
+
+ @Test
+ public void testServicesCreated() throws Exception {
+ ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null);
+ assertEquals("Not all Services have started", 2, services.length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-journal-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-journal-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-journal-bundle/test-bundles.xml
new file mode 100644
index 0000000..8cd36d6
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-journal-bundle/test-bundles.xml
@@ -0,0 +1,35 @@
+<!--
+ 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>
+ <include>org.apache.tika:tika-parser-pdf-bundle</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-multimedia-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/pom.xml b/tika-parser-bundles/tika-parser-multimedia-bundle/pom.xml
new file mode 100644
index 0000000..85e09f8
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-multimedia-bundle/pom.xml
@@ -0,0 +1,85 @@
+<?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-multimedia-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika parser 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>
+ tika-parser-multimedia-module;inline=true,
+ metadata-extractor;inline=true,
+ xmpcore;inline=true,
+ commons-codec;inline=true,
+ commons-io;inline=true,
+ jempbox;inline=true,
+ fontbox;inline=true,
+ poi;inline=true,
+ isoparser;inline=true,
+ aspectjrt;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>
+ </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-multimedia-bundle/src/test/java/org/apache/tika/module/multimedia/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/java/org/apache/tika/module/multimedia/BundleIT.java b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/java/org/apache/tika/module/multimedia/BundleIT.java
new file mode 100644
index 0000000..10568ca
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/java/org/apache/tika/module/multimedia/BundleIT.java
@@ -0,0 +1,211 @@
+/*
+ * 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;
+
+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(), 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.parser-multimedia-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("Multimedia bundle not found", hasBundle);
+ }
+
+ @Test
+ public void testServicesCreated() throws Exception {
+ ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null);
+ assertEquals("Not all Services have started", 14, services.length);
+ }
+
+ @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-parser-multimedia-bundle/src/test/resources/hadoop.jpg
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/hadoop.jpg b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/hadoop.jpg
new file mode 100644
index 0000000..f1bc2da
Binary files /dev/null and b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/hadoop.jpg differ
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testFLV.flv
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testFLV.flv b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testFLV.flv
new file mode 100644
index 0000000..d35e9bb
Binary files /dev/null and b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testFLV.flv differ
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMID.mid
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMID.mid b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMID.mid
new file mode 100644
index 0000000..883ef37
Binary files /dev/null and b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMID.mid differ
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMP3i18n.mp3
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMP3i18n.mp3 b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMP3i18n.mp3
new file mode 100644
index 0000000..0f25370
Binary files /dev/null and b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/testMP3i18n.mp3 differ
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/tika.png
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/tika.png b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/tika.png
new file mode 100644
index 0000000..d3487c5
Binary files /dev/null and b/tika-parser-bundles/tika-parser-multimedia-bundle/src/test/resources/tika.png differ
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-multimedia-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-multimedia-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-multimedia-bundle/test-bundles.xml
new file mode 100644
index 0000000..53bb6e4
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-multimedia-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-office-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-office-bundle/pom.xml b/tika-parser-bundles/tika-parser-office-bundle/pom.xml
new file mode 100644
index 0000000..cd6ef7f
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-office-bundle/pom.xml
@@ -0,0 +1,138 @@
+<?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-office-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika parser office bundle</name>
+ <url>http://tika.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-office-module</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-package-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-web-bundle</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.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.office.internal.Activator</Bundle-Activator>
+ <Embed-Dependency>
+ tika-parser-office-module;inline=true,
+ commons-lang;inline=true,
+ commons-io;inline=true,
+ commons-codec;inline=true,
+ poi;inline=true,
+ poi-scratchpad;inline=true,
+ poi-ooxml;inline=true,
+ poi-ooxml-schemas;inline=true;
+ jackcess;inline=true,
+ jackcess-encrypt;inline=true,
+ java-libpst;inline=true,
+ curvesapi;inline=true,
+ xmlbeans;inline=true,
+ bcprov-jdk15on;inline=true,
+ </Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Package>
+ org.apache.tika.parser.chm.*,
+ org.apache.tika.parser.mbox.*,
+ org.apache.tika.parser.microsoft.*,
+ org.apache.tika.parser.microsoft.ooxml.*,
+ org.apache.tika.parser.odf.*,
+ org.apache.tika.parser.opendocument.*,
+ org.apache.tika.parser.rtf.*
+ </Export-Package>
+ <Import-Package>
+ !org.junit,
+ !org.junit.*,
+ !junit.*,
+ *,
+ com.microsoft.schemas.office.powerpoint;resolution:=optional,
+ com.microsoft.schemas.office.word;resolution:=optional,
+ com.sun.javadoc;resolution:=optional,
+ com.sun.xml.bind.marshaller;resolution:=optional,
+ com.sun.xml.internal.bind.marshaller;resolution:=optional,
+ com.sun.msv.datatype;resolution:=optional,
+ com.sun.msv.datatype.xsd;resolution:=optional,
+ com.sun.tools.javadoc;resolution:=optional,
+ org.apache.crimson.jaxp;resolution:=optional,
+ org.apache.jcp.xml.dsig.internal.dom;resolution:=optional,
+ org.apache.tools.ant;resolution:=optional,
+ org.apache.tools.ant.taskdefs;resolution:=optional,
+ org.apache.tools.ant.types;resolution:=optional,
+ org.apache.xml.resolver;resolution:=optional,
+ org.apache.xml.resolver.tools;resolution:=optional,
+ org.apache.xml.security;resolution:=optional,
+ org.apache.xml.security.c14n;resolution:=optional,
+ org.apache.xml.security.utils;resolution:=optional,
+ org.apache.xmlbeans.impl.xpath.saxon;resolution:=optional,
+ org.apache.xmlbeans.impl.xquery.saxon;resolution:=optional,
+ org.bouncycastle.cert;resolution:=optional,
+ org.bouncycastle.cert.jcajce;resolution:=optional,
+ org.bouncycastle.cert.ocsp;resolution:=optional,
+ org.bouncycastle.cms;resolution:=optional,
+ org.bouncycastle.cms.bc;resolution:=optional,
+ org.bouncycastle.operator;resolution:=optional,
+ org.bouncycastle.operator.bc;resolution:=optional,
+ org.bouncycastle.tsp;resolution:=optional,
+ org.etsi.uri.x01903.v14;resolution:=optional,
+ org.openxmlformats.schemas.officeDocument.x2006.math;resolution:=optional,
+ org.openxmlformats.schemas.schemaLibrary.x2006.main;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-office-bundle/src/test/java/org/apache/tika/module/office/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-office-bundle/src/test/java/org/apache/tika/module/office/BundleIT.java b/tika-parser-bundles/tika-parser-office-bundle/src/test/java/org/apache/tika/module/office/BundleIT.java
new file mode 100644
index 0000000..7b0ca8b
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-office-bundle/src/test/java/org/apache/tika/module/office/BundleIT.java
@@ -0,0 +1,87 @@
+/*
+ * 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.office;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+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 javax.inject.Inject;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.net.URISyntaxException;
+
+import org.apache.tika.parser.Parser;
+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;
+
+
+@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("target/test-bundles/tika-parser-web-bundle.jar").toURI().toURL().toString()),
+ bundle(new File("target/test-bundles/tika-parser-package-bundle.jar").toURI().toURL().toString()),
+ bundle(new File("target/test-bundles/tika-parser-text-bundle.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-office-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("Office bundle not found", hasBundle);
+ }
+
+ @Test
+ public void testServicesCreated() throws Exception {
+ ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null);
+ assertEquals("Not all Services have started", 21, services.length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-office-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-office-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-office-bundle/test-bundles.xml
new file mode 100644
index 0000000..d106357
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-office-bundle/test-bundles.xml
@@ -0,0 +1,37 @@
+<!--
+ 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>
+ <include>org.apache.tika:tika-parser-web-bundle</include>
+ <include>org.apache.tika:tika-parser-package-bundle</include>
+ <include>org.apache.tika:tika-parser-text-bundle</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-package-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-package-bundle/pom.xml b/tika-parser-bundles/tika-parser-package-bundle/pom.xml
new file mode 100644
index 0000000..bbd917f
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-package-bundle/pom.xml
@@ -0,0 +1,134 @@
+<?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-package-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika parser package bundle</name>
+ <url>http://tika.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-package-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.pkg.internal.Activator</Bundle-Activator>
+ <Embed-Dependency>
+ tika-parser-package-module;inline=true,
+ commons-io;inline=true,
+ commons-codec;inline=true,
+ xz;inline=true,
+ poi;inline=true,
+ poi-ooxml;inline=true,
+ poi-ooxml-schemas;inline=true,
+ xmlbeans;inline=true,
+ commons-compress;inline=true,
+ junrar;inline=true,
+ curvesapi;inline=true
+ </Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Package>
+ org.apache.tika.parser.pkg.*,
+ org.apache.tika.parser.iwork.*
+ </Export-Package>
+ <Import-Package>
+ !org.junit,
+ !org.junit.*,
+ !junit.*,
+ *,
+ com.microsoft.schemas.office.powerpoint;resolution:=optional,
+ com.microsoft.schemas.office.word;resolution:=optional,
+ org.apache.commons.vfs2;resolution:=optional,
+ org.apache.commons.vfs2.provider;resolution:=optional,
+ org.apache.commons.vfs2.util;resolution:=optional,
+ org.apache.crimson.jaxp;resolution:=optional,
+ org.apache.jcp.xml.dsig.internal.dom;resolution:=optional,
+ org.apache.xml.resolver;resolution:=optional,
+ org.apache.xml.resolver.tools;resolution:=optional,
+ org.apache.xml.security;resolution:=optional,
+ org.apache.xml.security.c14n;resolution:=optional,
+ org.apache.xml.security.utils;resolution:=optional,
+ org.apache.xmlbeans.impl.xpath.saxon;resolution:=optional,
+ org.apache.xmlbeans.impl.xquery.saxon;resolution:=optional,
+ com.sun.javadoc;resolution:=optional,
+ com.sun.xml.bind.marshaller;resolution:=optional,
+ com.sun.xml.internal.bind.marshaller;resolution:=optional,
+ com.sun.msv.datatype;resolution:=optional,
+ com.sun.msv.datatype.xsd;resolution:=optional,
+ com.sun.tools.javadoc;resolution:=optional,
+ org.apache.poi.hdgf.extractor;resolution:=optional,
+ org.apache.poi.hpbf.extractor;resolution:=optional,
+ org.apache.poi.hslf.blip;resolution:=optional,
+ org.apache.poi.hslf.extractor;resolution:=optional,
+ org.apache.poi.hsmf;resolution:=optional,
+ org.apache.poi.hsmf.datatypes;resolution:=optional,
+ org.apache.poi.hsmf.extractor;resolution:=optional,
+ org.apache.poi.hwpf;resolution:=optional,
+ org.apache.poi.hwpf.extractor;resolution:=optional,
+ org.apache.tools.ant;resolution:=optional,
+ org.apache.tools.ant.taskdefs;resolution:=optional,
+ org.apache.tools.ant.types;resolution:=optional,
+ org.bouncycastle.asn1;resolution:=optional,
+ org.bouncycastle.asn1.cmp;resolution:=optional,
+ org.bouncycastle.asn1.nist;resolution:=optional,
+ org.bouncycastle.asn1.ocsp;resolution:=optional,
+ org.bouncycastle.asn1.x500;resolution:=optional,
+ org.bouncycastle.asn1.x509;resolution:=optional,
+ org.bouncycastle.cert;resolution:=optional,
+ org.bouncycastle.cert.jcajce;resolution:=optional,
+ org.bouncycastle.cert.ocsp;resolution:=optional,
+ org.bouncycastle.cms;resolution:=optional,
+ org.bouncycastle.cms.bc;resolution:=optional,
+ org.bouncycastle.operator;resolution:=optional,
+ org.bouncycastle.operator.bc;resolution:=optional,
+ org.bouncycastle.tsp;resolution:=optional,
+ org.bouncycastle.util;resolution:=optional,
+ org.etsi.uri.x01903.v14;resolution:=optional,
+ org.openxmlformats.schemas.officeDocument.x2006.math;resolution:=optional,
+ org.openxmlformats.schemas.schemaLibrary.x2006.main;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-package-bundle/src/test/java/org/apache/tika/module/pkg/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-package-bundle/src/test/java/org/apache/tika/module/pkg/BundleIT.java b/tika-parser-bundles/tika-parser-package-bundle/src/test/java/org/apache/tika/module/pkg/BundleIT.java
new file mode 100644
index 0000000..afe8911
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-package-bundle/src/test/java/org/apache/tika/module/pkg/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.pkg;
+
+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-package-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("Package bundle not found", hasBundle);
+ }
+
+ @Test
+ public void testServicesCreated() throws Exception {
+ ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null);
+ assertEquals("Not all Services have started", 4, services.length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tika/blob/9f8d6aed/tika-parser-bundles/tika-parser-package-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-package-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-package-bundle/test-bundles.xml
new file mode 100644
index 0000000..53bb6e4
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-package-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-pdf-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-pdf-bundle/pom.xml b/tika-parser-bundles/tika-parser-pdf-bundle/pom.xml
new file mode 100644
index 0000000..08cd863
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-pdf-bundle/pom.xml
@@ -0,0 +1,87 @@
+<?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-pdf-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika parser pdf bundle</name>
+ <url>http://tika.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-pdf-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.pdf.internal.Activator</Bundle-Activator>
+ <Embed-Dependency>
+ tika-parser-pdf-module;inline=true,
+ commons-io;inline=true,
+ pdfbox;inline=true,
+ bcmail-jdk15on;inline=true,
+ bcprov-jdk15on;inline=true,
+ fontbox;inline=true,
+ jempbox;inline=true,
+ bcpkix-jdk15on;inline=true
+ </Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Package>
+ org.apache.tika.parser.pdf.*
+ </Export-Package>
+ <Import-Package>
+ *,
+ com.ibm.icu.text;resolution:=optional,
+ 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-pdf-bundle/src/test/java/org/apache/tika/module/pdf/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-pdf-bundle/src/test/java/org/apache/tika/module/pdf/BundleIT.java b/tika-parser-bundles/tika-parser-pdf-bundle/src/test/java/org/apache/tika/module/pdf/BundleIT.java
new file mode 100644
index 0000000..bbc72bb
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-pdf-bundle/src/test/java/org/apache/tika/module/pdf/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.pdf;
+
+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-pdf-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("PDF 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-pdf-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-pdf-bundle/test-bundles.xml b/tika-parser-bundles/tika-parser-pdf-bundle/test-bundles.xml
new file mode 100644
index 0000000..53bb6e4
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-pdf-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-scientific-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-scientific-bundle/pom.xml b/tika-parser-bundles/tika-parser-scientific-bundle/pom.xml
new file mode 100644
index 0000000..578ecab
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-scientific-bundle/pom.xml
@@ -0,0 +1,202 @@
+<?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-scientific-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Tika parser scientific bundle</name>
+ <url>http://tika.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tika-parser-scientific-module</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes-core</artifactId>
+ <version>3.2.2</version>
+ <scope>provided</scope>
+ </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.scientific.internal.Activator</Bundle-Activator>
+ <Embed-Dependency>
+ tika-parser-scientific-module;inline=true,
+ commons-csv;inline=true,
+ commons-exec;inline=true,
+ commons-codec;inline=true,
+ commons-io;inline=true,
+ json-simple;inline=true,
+ sis-utility;inline=true,
+ sis-netcdf;inline=true,
+ sis-metadata;inline=true,
+ sis-storage;inline=true,
+ netcdf4;inline=true,
+ grib;inline=true,
+ cdm;inline=true,
+ httpservices;inline=true,
+ jmatio;inline=true,
+ jsr-275;inline=true,
+ jcip-annotations;inline=true,
+ opennlp-tools;inline=true,
+ opennlp-maxent;inline=true,
+ jwnl;inline=true,
+ geoapi;inline=true
+ </Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Package>
+ org.apache.tika.parser.ctakes.*,
+ org.apache.tika.parser.dif.*,
+ org.apache.tika.parser.envi.*,
+ org.apache.tika.parser.gdal.*
+ </Export-Package>
+ <Import-Package>
+ !org.apache.ctakes.*,
+ !org.apache.uima.*,
+ *,
+ colorspace;resolution:=optional,
+ org.apache.sis;resolution:=optional,
+ org.apache.sis.distance;resolution:=optional,
+ org.apache.sis.geometry;resolution:=optional,
+ com.beust.jcommander;resolution:=optional,
+ com.google.common.base;resolution:=optional,
+ com.google.common.math;resolution:=optional,
+ com.google.protobuf;resolution:=optional,
+ ucar.units;resolution:=optional,
+ ucar.httpservices;resolution:=optional,
+ ucar.nc2.util;resolution:=optional,
+ ucar.nc2.util.cache;resolution:=optional,
+ ucar.nc2.dataset;resolution:=optional,
+ ucar.nc2;resolution:=optional,
+ ucar.nc2.constants;resolution:=optional,
+ ucar.nc2.dt;resolution:=optional,
+ ucar.nc2.dt.grid;resolution:=optional,
+ ucar.nc2.ft;resolution:=optional,
+ ucar.nc2.iosp;resolution:=optional,
+ ucar.nc2.iosp.hdf4;resolution:=optional,
+ ucar.nc2.ncml;resolution:=optional,
+ ucar.nc2.stream;resolution:=optional,
+ ucar.nc2.time;resolution:=optional,
+ ucar.nc2.units;resolution:=optional,
+ ucar.nc2.wmo;resolution:=optional,
+ ucar.nc2.write;resolution:=optional,
+ ucar.ma2;resolution:=optional,
+ ucar.grib;resolution:=optional,
+ ucar.grib.grib1;resolution:=optional,
+ ucar.grib.grib2;resolution:=optional,
+ ucar.grid;resolution:=optional,
+ ucar.unidata.geoloc;resolution:=optional,
+ ucar.unidata.geoloc.projection;resolution:=optional,
+ ucar.unidata.geoloc.projection.proj4;resolution:=optional,
+ ucar.unidata.geoloc.projection.sat;resolution:=optional,
+ ucar.unidata.io;resolution:=optional,
+ ucar.unidata.util;resolution:=optional,
+ com.jmatio.io;resolution:=optional,
+ com.sun.jna;resolution:=optional,
+ com.sun.jna.ptr;resolution:=optional,
+ com.sun.xml.bind.marshaller;resolution:=optional,
+ com.sun.xml.internal.bind.marshaller;resolution:=optional,
+ com.sun.msv.datatype;resolution:=optional,
+ com.sun.msv.datatype.xsd;resolution:=optional,
+ com.sun.tools.javadoc;resolution:=optional,
+ sun.misc;resolution:=optional,
+ sun.reflect.generics.reflectiveObjects;resolution:=optional,
+ org.quartz;resolution:=optional,
+ org.quartz.impl;resolution:=optional,
+ icc;resolution:=optional,
+ org.jdom;resolution:=optional,
+ org.jdom.input;resolution:=optional,
+ org.jdom.output;resolution:=optional,
+ org.jdom2;resolution:=optional,
+ org.jdom2.input;resolution:=optional,
+ org.jdom2.input.sax;resolution:=optional,
+ org.jdom2.output;resolution:=optional,
+ org.jdom2.filter;resolution:=optional,
+ javax.measure.converter;resolution:=optional,
+ javax.servlet.annotation;resolution:=optional,
+ javax.servlet;resolution:=optional,
+ javax.servlet.http;resolution:=optional,
+ jj2000.j2k.codestream;resolution:=optional,
+ jj2000.j2k.codestream.reader;resolution:=optional,
+ jj2000.j2k.decoder;resolution:=optional,
+ jj2000.j2k.entropy.decoder;resolution:=optional,
+ jj2000.j2k.fileformat.reader;resolution:=optional,
+ jj2000.j2k.image;resolution:=optional,
+ jj2000.j2k.image.invcomptransf;resolution:=optional,
+ jj2000.j2k.image.output;resolution:=optional,
+ jj2000.j2k.io;resolution:=optional,
+ jj2000.j2k.quantization.dequantizer;resolution:=optional,
+ jj2000.j2k.roi;resolution:=optional,
+ jj2000.j2k.util;resolution:=optional,
+ jj2000.j2k.wavelet.synthesis;resolution:=optional,
+ org.itadaki.bzip2;resolution:=optional,
+ org.jsoup;resolution:=optional,
+ org.jsoup.nodes;resolution:=optional,
+ org.jsoup.select;resolution:=optional,
+ opennlp.maxent;resolution:=optional,
+ opennlp.tools.namefind;resolution:=optional,
+ net.didion.jwnl;resolution:=optional,
+ org.joda.time;resolution:=optional,
+ org.joda.time.chrono;resolution:=optional,
+ org.joda.time.field;resolution:=optional,
+ org.joda.time.format;resolution:=optional,
+ org.apache.http;resolution:=optional,
+ org.apache.http.auth;resolution:=optional,
+ org.apache.http.client;resolution:=optional,
+ org.apache.http.client.entity;resolution:=optional,
+ org.apache.http.client.methods;resolution:=optional,
+ org.apache.http.conn;resolution:=optional,
+ org.apache.http.conn.scheme;resolution:=optional,
+ org.apache.http.cookie;resolution:=optional,
+ org.apache.http.entity;resolution:=optional,
+ org.apache.http.impl.client;resolution:=optional,
+ org.apache.http.impl.conn;resolution:=optional,
+ org.apache.http.message;resolution:=optional,
+ org.apache.http.params;resolution:=optional,
+ org.apache.http.protocol;resolution:=optional,
+ org.apache.http.util;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-scientific-bundle/src/test/java/org/apache/tika/module/scientific/BundleIT.java
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-scientific-bundle/src/test/java/org/apache/tika/module/scientific/BundleIT.java b/tika-parser-bundles/tika-parser-scientific-bundle/src/test/java/org/apache/tika/module/scientific/BundleIT.java
new file mode 100644
index 0000000..503bc44
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-scientific-bundle/src/test/java/org/apache/tika/module/scientific/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.scientific;
+
+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-scientific-bundle".equals(b.getSymbolicName())) {
+ hasBundle = true;
+ assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState());
+ }
+ }
+ assertTrue("Core bundle not found", hasCore);
+ assertTrue("Scientific bundle not found", hasBundle);
+ }
+
+ @Test
+ public void testServicesCreated() throws Exception {
+ ServiceReference[] services = bc.getAllServiceReferences(Parser.class.getName(), null);
+ assertEquals("Not all Services have started", 10, services.length);
+ }
+}