You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by "Sebastian Nagel (JIRA)" <ji...@apache.org> on 2014/07/10 13:46:05 UTC

[jira] [Commented] (NUTCH-1814) TestMimeUtils#testBinaryFiles fails under Eclipse

    [ https://issues.apache.org/jira/browse/NUTCH-1814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14057390#comment-14057390 ] 

Sebastian Nagel commented on NUTCH-1814:
----------------------------------------

Hi [~vschiavoni], all resources required by unit tests are "installed" into {{build/test/data}} by ant target "test-core". This also includes configuration files (e.g., "domain-suffixes.xml", see NUTCH-1813). Then in Eclipse the run configuration for (some) test classes needs to be adjusted by adding {{-Dtest.build.data=build/test/data}} to "VM arguments". That's not ideal, I know. But tests are primarily executed via ant. In the case a unit test is executed in Eclipse, this little extra effort is ok. To change the paths inside the test classes is not ideal, since it may break the tests when executed on build machines.  But good ideas to simplify the setup in Eclipse are always appreciated. Thanks!

> TestMimeUtils#testBinaryFiles fails under Eclipse
> -------------------------------------------------
>
>                 Key: NUTCH-1814
>                 URL: https://issues.apache.org/jira/browse/NUTCH-1814
>             Project: Nutch
>          Issue Type: Bug
>         Environment: Eclipse Kepler Service Release 2
> Build id: 20140224-0627
>            Reporter: Valerio Schiavoni
>
> Test TestMimeUtils#testBinaryFiles fails in finding the input test directory 'test-mime-util'. :
> java.io.FileNotFoundException: ./test-mime-util/test.xlsx (No such file or directory)
> 	at java.io.FileInputStream.open(Native Method)
> 	at java.io.FileInputStream.<init>(FileInputStream.java:146)
> 	at com.google.common.io.Files$1.getInput(Files.java:109)
> 	at com.google.common.io.Files$1.getInput(Files.java:106)
> 	at com.google.common.io.ByteStreams.toByteArray(ByteStreams.java:250)
> 	at com.google.common.io.Files.toByteArray(Files.java:204)
> 	at org.apache.nutch.util.TestMimeUtil.getMimeType(TestMimeUtil.java:82)
> 	at org.apache.nutch.util.TestMimeUtil.testBinaryFiles(TestMimeUtil.java:124)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at junit.framework.TestCase.runTest(TestCase.java:176)
> 	at junit.framework.TestCase.runBare(TestCase.java:141)
> 	at junit.framework.TestResult$1.protect(TestResult.java:122)
> 	at junit.framework.TestResult.runProtected(TestResult.java:142)
> 	at junit.framework.TestResult.run(TestResult.java:125)
> 	at junit.framework.TestCase.run(TestCase.java:129)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:255)
> 	at junit.framework.TestSuite.run(TestSuite.java:250)
> 	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> In my case, a simple fix is to change the initialisation of sampleDir from:
> private File sampleDir = new File(System.getProperty("test.build.data", "."),
>       "test-mime-util");
> to
> private File sampleDir = new File(System.getProperty("test.build.data", "."),
>       "src/testresources/test-mime-util");



--
This message was sent by Atlassian JIRA
(v6.2#6252)