Repository: tika
Updated Branches:
  refs/heads/2.x dc841e6ba -> fcefaae59


TIKA-2063 - Create vorbis bundle

Project: http://git-wip-us.apache.org/repos/asf/tika/repo
Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/fcefaae5
Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/fcefaae5
Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/fcefaae5

Branch: refs/heads/2.x
Commit: fcefaae59537462caac49a8d7c675e97d982cfa2
Parents: dc841e6
Author: Bob Paulin <[email protected]>
Authored: Sun Aug 28 18:54:21 2016 -0500
Committer: Bob Paulin <[email protected]>
Committed: Sun Aug 28 18:54:21 2016 -0500

----------------------------------------------------------------------
 .../tika-parser-vorbis-bundle/pom.xml           | 85 +++++++++++++++++
 .../tika/module/vorbis/internal/Activator.java  | 20 ++++
 .../org/apache/tika/module/vorbis/BundleIT.java | 96 ++++++++++++++++++++
 .../tika-parser-vorbis-bundle/test-bundles.xml  | 34 +++++++
 4 files changed, 235 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tika/blob/fcefaae5/tika-parser-bundles/tika-parser-vorbis-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-vorbis-bundle/pom.xml 
b/tika-parser-bundles/tika-parser-vorbis-bundle/pom.xml
new file mode 100644
index 0000000..b4ab33a
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-vorbis-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-vorbis-bundle</artifactId>
+  <packaging>bundle</packaging>
+  <name>Apache Tika parser web bundle</name>
+  <url>http://tika.apache.org/</url>
+  
+  <properties>
+    <vorbis.version>0.8</vorbis.version>
+  </properties>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.gagravarr</groupId>
+      <artifactId>vorbis-java-tika</artifactId>
+      <version>${vorbis.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.gagravarr</groupId>
+      <artifactId>vorbis-java-core</artifactId>
+      <version>${vorbis.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>tika-core</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.vorbis.internal.Activator</Bundle-Activator>
+            <Embed-Dependency>
+              vorbis-java-tika;inline=true,
+              vorbis-java-core;inline=true
+            </Embed-Dependency> 
+            <Embed-Transitive>true</Embed-Transitive>
+            <Export-Package>
+              org.gagravarr.tika.*
+            </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/fcefaae5/tika-parser-bundles/tika-parser-vorbis-bundle/src/main/java/org/apache/tika/module/vorbis/internal/Activator.java
----------------------------------------------------------------------
diff --git 
a/tika-parser-bundles/tika-parser-vorbis-bundle/src/main/java/org/apache/tika/module/vorbis/internal/Activator.java
 
b/tika-parser-bundles/tika-parser-vorbis-bundle/src/main/java/org/apache/tika/module/vorbis/internal/Activator.java
new file mode 100644
index 0000000..7f933a0
--- /dev/null
+++ 
b/tika-parser-bundles/tika-parser-vorbis-bundle/src/main/java/org/apache/tika/module/vorbis/internal/Activator.java
@@ -0,0 +1,20 @@
+package org.apache.tika.module.vorbis.internal;
+
+import org.apache.tika.osgi.TikaAbstractBundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends TikaAbstractBundleActivator {
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+
+        registerTikaParserServiceLoader(context, 
Activator.class.getClassLoader());
+
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tika/blob/fcefaae5/tika-parser-bundles/tika-parser-vorbis-bundle/src/test/java/org/apache/tika/module/vorbis/BundleIT.java
----------------------------------------------------------------------
diff --git 
a/tika-parser-bundles/tika-parser-vorbis-bundle/src/test/java/org/apache/tika/module/vorbis/BundleIT.java
 
b/tika-parser-bundles/tika-parser-vorbis-bundle/src/test/java/org/apache/tika/module/vorbis/BundleIT.java
new file mode 100644
index 0000000..2c58e9a
--- /dev/null
+++ 
b/tika-parser-bundles/tika-parser-vorbis-bundle/src/test/java/org/apache/tika/module/vorbis/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.vorbis;
+
+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-vorbis-bundle".equals(b.getSymbolicName())) {
+                hasBundle = true;
+                assertEquals("Bundle not activated", Bundle.ACTIVE, 
b.getState());
+            }
+        }
+        assertTrue("Core bundle not found", hasCore);
+        assertTrue("Text bundle not found", hasBundle);
+    }
+    
+    @Test
+    public void testServicesCreated() throws Exception {
+        ServiceReference[] services = 
bc.getAllServiceReferences(Parser.class.getName(), null);
+        assertEquals("Not all Services have started", 6, services.length);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/fcefaae5/tika-parser-bundles/tika-parser-vorbis-bundle/test-bundles.xml
----------------------------------------------------------------------
diff --git a/tika-parser-bundles/tika-parser-vorbis-bundle/test-bundles.xml 
b/tika-parser-bundles/tika-parser-vorbis-bundle/test-bundles.xml
new file mode 100644
index 0000000..53bb6e4
--- /dev/null
+++ b/tika-parser-bundles/tika-parser-vorbis-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

Reply via email to