This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 115170 [details] Contains the sources and the results from running the tests I was trying to create a functional test to a platform application and I encountered a problem because I had also external dependencies in some modules and when I run the test those modules will not load. I followed the tutorial from: http://netbeans.dzone.com/nb-mvn-functional-tests I also attached my sources and the result from surefire. Steps to reproduce: 1. Create a new Maven-based NetBeans Platform application via the related template in the IDE. 2. Add a new class "DoStuff" in the sample module and resolve the dependecies problems 3. Create new folders in the app module: "src/test/java" 4. Add a new class "FuncTest" and resolve the dependecies problems 5. Run test (right click on the app module and test to run integration-test goal) Result: the test is running succesfully (surefire-reports_success directory) 6. Add an external library like lib-common (http://mvnrepository.com/artifact/nl.cloudfarming.client/lib-common) to the sample module 7. Rebuid and run the test again Expected result: The test should run ok Actual result: The test is running but a lot of java.io.FileNotFoundException are thrown in the console as you can see in the console.txt file from surefire-reports_errors directory. My guess is that it is trying to load the libraries from the classpath and not from the maven repository.
NBJUnit in Maven report.
The problem is in that particular artifact's manifest: Class-Path: ext/commons-collections/commons-collections-3.2.1.jar .... should not be there. MNBMODULE-133 already fixed this in the 3.6 version of the plugin, but presumably this module was built using an earlier version of the plugin. (It is hard to say for sure since the POM [2] is missing a version for the plugin, which is poor practice [3].) [1] https://jira.codehaus.org/browse/MNBMODULE-133 [2] https://hg.java.net/hg/nb-library-wrappers~core/file/fba56fd88ddd/lib-commons/pom.xml [3] https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-AutomaticPluginVersionResolution
Created attachment 115344 [details] the application to reproduce the error
Thanks Jesse. You were right that library was build with an old version and had problems with the classpath. I gave up using that. I need two libraries from the commons the lang and the collection. I created a wrapper module that will add these libraries to the application. This module is a dependency to the sample. When I run the test I'm getting: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.484 sec <<< FAILURE! org.netbeans.junit.NbModuleSuite$S@765291(org.netbeans.junit.NbModuleSuite$S) Time elapsed: 0 sec <<< ERROR! java.io.IOException: read wrong amount at org.netbeans.junit.NbModuleSuite$S.rewrite(NbModuleSuite.java:1146) at org.netbeans.junit.NbModuleSuite$S.turnClassPathModules(NbModuleSuite.java:1080) at org.netbeans.junit.NbModuleSuite$S.runInRuntimeContainer(NbModuleSuite.java:855) at org.netbeans.junit.NbModuleSuite$S.access$100(NbModuleSuite.java:660) at org.netbeans.junit.NbModuleSuite$S$1.protect(NbModuleSuite.java:679) at junit.framework.TestResult.runProtected(TestResult.java:128) .............. I added the project and the surefire report to the attachements
Created attachment 115345 [details] surefire report for the wrapper module error
This looks like a completely unrelated bug that really should have been filed separately. It is a general bug to assume that InputStream.read will read as many bytes as you believe are present; the actual return value may be any positive number up to the buffer size according to unpredictable platform-specific factors.
ergonomics#84239fe654ae
There is a workaround for this problem, I have this IO exception in 7.1.1 version.
No workaround that I know of. Could probably be backported, especially if alexandru.stan can verify the fix (it may well occur only on Windows).
*** Bug 211297 has been marked as a duplicate of this bug. ***
As pointed out in bug #211297 comment #5, the attempted fix in fact just goes into an endless loop at org.netbeans.junit.NbModuleSuite$S.rewrite(NbModuleSuite.java:1146). Remember that the Javadoc for the read method states "...otherwise, no bytes are read and <code>0</code> is returned", yet the return value is checked only for -1, not 0.
Created attachment 118451 [details] Test case for endless loop Reproducible on Linux / JDK 7. Unpack and run 'mvn integration-test'.
Note that a similar loop in FileObject.asBytes uses a condition on the loop (pos < arr.length).
ergonomics#e8bc885e40e6
Is the fix deployed on the SNAPSHOT version of the plugin? I would like to try. Thanks.
(In reply to comment #15) > Is the fix deployed on the SNAPSHOT version of the plugin? I doubt it. When the fix is in main sources and makes it into a development build, an automated notation should be added here (though it apparently did not work in the case of the initial fix, 84239fe654ae). Around that time the snapshot repo should be recreated.
Integrated into 'main-golden', will be available in build *201204260400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/e8bc885e40e6 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #207646: Reading a file into memory is not very clueless in Java6
See bug #211297 comment #5 (and #6); the fix does not work at all, the loop simply spins forever. Both initial "read wrong amount" and endless loop reproducible even on Linux. I am looking into it.
Never mind, the fix does work, the problem is that the snapshot repository is very old (20120424) so the fixed JAR is not being published. The only workaround is to build a Mavenized copy of the development version of this module for yourself; for example: ant -f nbjunit patch-for-maven Having done that, the test case from comment #3 works for me on both Linux and XP (using JDK 7u4 in both cases).
SNAPSHOT repo working for me now in Ubuntu. alexandru.stan, mbastian, csesteban - please mark VERIFIED if you can confirm on your own projects/repositories.
To be clear, you will need <version>SNAPSHOT</version> of at least org.netbeans.api:org-netbeans-modules-nbjunit, available from <repository> <id>netbeans-snapshot</id> <url>http://bits.netbeans.org/netbeans/trunk/maven-snapshot/</url> </repository>