[jira] [Commented] (TIKA-1501) Fix the disabled Tika Bundle OSGi related unit tests

2015-04-21 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/TIKA-1501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14505051#comment-14505051
 ] 

Hudson commented on TIKA-1501:
--

SUCCESS: Integrated in tika-trunk-jdk1.7 #638 (See 
[https://builds.apache.org/job/tika-trunk-jdk1.7/638/])
TIKA-1501: Fix disabled OSGi related unit tests. Fixes from Bob Paulin. 
(tallison: http://svn.apache.org/viewvc/tika/trunk/?view=revrev=1675121)
* /tika/trunk/tika-bundle/src/test/java/org/apache/tika/bundle/BundleIT.java


 Fix the disabled Tika Bundle OSGi related unit tests
 

 Key: TIKA-1501
 URL: https://issues.apache.org/jira/browse/TIKA-1501
 Project: Tika
  Issue Type: Improvement
  Components: packaging
Affects Versions: 1.6, 1.7
Reporter: Nick Burch
 Fix For: 1.9

 Attachments: TIKA-1501-trunk.patch, TIKA-1501-trunkv2.patch, 
 TIKA-1501.patch


 Currently, the unit tests for the Tika Bundle contain several bits like:
 {code}
 @Ignore // TODO Fix this test
 {code}
 We should really fix these unit tests so they work, and re-enable them



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TIKA-1501) Fix the disabled Tika Bundle OSGi related unit tests

2015-04-20 Thread Tim Allison (JIRA)

[ 
https://issues.apache.org/jira/browse/TIKA-1501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14502776#comment-14502776
 ] 

Tim Allison commented on TIKA-1501:
---

Ah, ok.  This is the first time I've really looked at this code, and I frankly 
wouldn't touch this portion of the code without an OSGi expert collaborating 
with us!  

I think the expectation is: there should be the same detectors both inside and 
outside the OSGi environment.

I think what I found is that there is a very slight difference in structure, 
but that the same detectors exist both inside and outside.


So, it looks like our comments and variable names are backwards?

This:
{noformat}
// Get the classes found within OSGi
DefaultDetector detector = new DefaultDetector();
SetString osgiDetectors = new HashSetString();
{noformat}

should be:
{noformat}
// Get the classes found by normal means outside of the OSGi bundle
DefaultDetector detector = new DefaultDetector();
SetString rawDetectors = new HashSetString();

{noformat}

Unless I misunderstand, the DefaultDetector is picking up the following via the 
regular service mechanism+classpath (outside of OSGi):
{noformat}
org.apache.tika.parser.microsoft.POIFSContainerDetector
 org.apache.tika.parser.pkg.ZipContainerDetector
{noformat}

So, this passes (after I prevent the addition of the child DefaultDetector):
{noformat}
assertEquals(osgiDetectors.size(), rawDetectors.size());
{noformat} 

 Fix the disabled Tika Bundle OSGi related unit tests
 

 Key: TIKA-1501
 URL: https://issues.apache.org/jira/browse/TIKA-1501
 Project: Tika
  Issue Type: Improvement
  Components: packaging
Affects Versions: 1.6, 1.7
Reporter: Nick Burch
 Attachments: TIKA-1501-trunk.patch, TIKA-1501-trunkv2.patch, 
 TIKA-1501.patch


 Currently, the unit tests for the Tika Bundle contain several bits like:
 {code}
 @Ignore // TODO Fix this test
 {code}
 We should really fix these unit tests so they work, and re-enable them



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TIKA-1501) Fix the disabled Tika Bundle OSGi related unit tests

2015-04-20 Thread Bob Paulin (JIRA)

[ 
https://issues.apache.org/jira/browse/TIKA-1501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14502747#comment-14502747
 ] 

Bob Paulin commented on TIKA-1501:
--

[~talli...@mitre.org] The code you've cited above obtains a reference to the 
service that is instantiated in the tika-bunlde in the 
org.apache.tika.parser.internal.Activator which sets the tika-bundle's 
classloader as the classloader for the ServiceLoader and registered the 
DefaultDetector object as a service with the framework.  The tika-bundle has 
it's own classloader within OSGi (as all bundles do) and the 
ServiceLoader.identifyStaticServiceProviders code looks for 
META-INF/services/org.apache.tika.detect.Detector which only exists in the 
tika-bundle classloader (this file is generated during the build).  So when you 
look at the detectorService object from the code you cite above it has a number 
of detectors.  However when you instantiate DefaultDetector in the test code 
(for example in testBundleDetectors()) you are not in the tika-bundle so it 
can't see META-INF/services/org.apache.tika.detect.Detector.  This accounts for 
why you see 

org.apache.tika.parser.microsoft.POIFSContainerDetector
org.apache.tika.parser.pkg.ZipContainerDetector

in the detectorService but not in the DefaultDetector you instantiate in the 
test.  This is why I really was not clear on what was being tested since it 
appears that there are in fact different expectations inside and outside of the 
OSGi environment for this class.

 Fix the disabled Tika Bundle OSGi related unit tests
 

 Key: TIKA-1501
 URL: https://issues.apache.org/jira/browse/TIKA-1501
 Project: Tika
  Issue Type: Improvement
  Components: packaging
Affects Versions: 1.6, 1.7
Reporter: Nick Burch
 Attachments: TIKA-1501-trunk.patch, TIKA-1501-trunkv2.patch, 
 TIKA-1501.patch


 Currently, the unit tests for the Tika Bundle contain several bits like:
 {code}
 @Ignore // TODO Fix this test
 {code}
 We should really fix these unit tests so they work, and re-enable them



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TIKA-1501) Fix the disabled Tika Bundle OSGi related unit tests

2015-04-20 Thread Bob Paulin (JIRA)

[ 
https://issues.apache.org/jira/browse/TIKA-1501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14502863#comment-14502863
 ] 

Bob Paulin commented on TIKA-1501:
--

 Yes I would agree that the comments and variable names are flipped! The test 
methods should be outside of OSGi and yes I would agree that there is something 
else driving the DefaultDetector that is instantiated outside of OSGi. I'm a 
bit confused now at the difference in the structures.  Maybe for another day or 
in a separate JIRA...

 Fix the disabled Tika Bundle OSGi related unit tests
 

 Key: TIKA-1501
 URL: https://issues.apache.org/jira/browse/TIKA-1501
 Project: Tika
  Issue Type: Improvement
  Components: packaging
Affects Versions: 1.6, 1.7
Reporter: Nick Burch
 Attachments: TIKA-1501-trunk.patch, TIKA-1501-trunkv2.patch, 
 TIKA-1501.patch


 Currently, the unit tests for the Tika Bundle contain several bits like:
 {code}
 @Ignore // TODO Fix this test
 {code}
 We should really fix these unit tests so they work, and re-enable them



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TIKA-1501) Fix the disabled Tika Bundle OSGi related unit tests

2015-04-18 Thread Tim Allison (JIRA)

[ 
https://issues.apache.org/jira/browse/TIKA-1501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14501514#comment-14501514
 ] 

Tim Allison commented on TIKA-1501:
---

[~bobpaulin], I'm very grateful to have someone who actually knows about OSGi 
helping out on this!  The patch didn't work for me against trunk, as far as I 
can tell...git/svn might not be looking kindly upon me today, I admit.  Would 
you be willing to check that you're at the latest revision?  Thank you!

 Fix the disabled Tika Bundle OSGi related unit tests
 

 Key: TIKA-1501
 URL: https://issues.apache.org/jira/browse/TIKA-1501
 Project: Tika
  Issue Type: Improvement
  Components: packaging
Affects Versions: 1.6, 1.7
Reporter: Nick Burch
 Attachments: TIKA-1501.patch


 Currently, the unit tests for the Tika Bundle contain several bits like:
 {code}
 @Ignore // TODO Fix this test
 {code}
 We should really fix these unit tests so they work, and re-enable them



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)