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.

Bug 47826 - New j2seproject from sources wizard permits ${test.src.dir} to be beneath ${src.dir}
Summary: New j2seproject from sources wizard permits ${test.src.dir} to be beneath ${s...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks: 41537
  Show dependency tree
 
Reported: 2004-08-24 17:53 UTC by timbray
Modified: 2004-08-26 13:35 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
tar.gz Project provided by the reporter (6.47 KB, application/octet-stream)
2004-08-25 15:14 UTC, dmladek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description timbray 2004-08-24 17:53:25 UTC
Created a new project with a directory full of code.  Went to one 
of the Xxx.java files, right clicked, went to tools/junit/create 
test.  It created a XxxTest.java in a reasonable place, I tried to 
compile that file, it blew up apparently because JUnit isn't in the 
classpath.

 Nothing in the logfile, but here's the compilation readout
====================================
init:
deps-jar:
Created dir: /Users/twbray/dev/NetBeans_projects/RgbPlane/
build/classes
Compiling 1 source file to /Users/twbray/dev/
NetBeans_projects/RgbPlane/build/classes
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:14: package junit.framework does not exist
import junit.framework.*;
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:15: package junit.framework does not exist
import junit.framework.*;
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:21: cannot resolve symbol
symbol  : class TestCase 
location: class RgbPlane.RgbPlaneTest
public class RgbPlaneTest extends TestCase {
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:27: cannot resolve symbol
symbol  : class Test 
location: class RgbPlane.RgbPlaneTest
    public static Test suite() {
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:28: cannot resolve symbol
symbol  : class TestSuite 
location: class RgbPlane.RgbPlaneTest
        TestSuite suite = new TestSuite(RgbPlaneTest.class);
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:28: cannot resolve symbol
symbol  : class TestSuite 
location: class RgbPlane.RgbPlaneTest
        TestSuite suite = new TestSuite(RgbPlaneTest.class);
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:46: cannot resolve symbol
symbol  : method fail (java.lang.String)
location: class RgbPlane.RgbPlaneTest
        fail("The test case is empty.");
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:57: cannot resolve symbol
symbol  : method fail (java.lang.String)
location: class RgbPlane.RgbPlaneTest
        fail("The test case is empty.");
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:68: cannot resolve symbol
symbol  : method fail (java.lang.String)
location: class RgbPlane.RgbPlaneTest
        fail("The test case is empty.");
/Users/twbray/dev/RgbPlane/vests/RgbPlane/
RgbPlaneTest.java:79: cannot resolve symbol
symbol  : method fail (java.lang.String)
location: class RgbPlane.RgbPlaneTest
        fail("The test case is empty.");
10 errors
BUILD FAILED (total time: 2 seconds)
Comment 1 timbray 2004-08-24 17:55:32 UTC
Changed to OS X
Comment 2 dmladek 2004-08-24 19:49:47 UTC
...maybe :-)

would you mind to specify more detaily how you...
>Created a new project with.... 
Please?

If you create New Standard -> Java Application Project

than I don't understabd where is problem 'cause it works for me:
Please try download Sample Project at:
http://junit.netbeans.org/qa/testspecs/promo-d/download/SampleProject.zip
and follow the instruction of JUnit TestSpec
http://junit.netbeans.org/qa/testspecs/promo-d/testspec.html


if it is not your case than you're probably using some kind of Project
 which doesn't support JUnit:
eg. "imported project": Standard -> Java Project with Existing Ant Script
which is newly discovered (not entered as issue yet) and we're solving it.

But sure... this is a bug, but not of junit
Comment 3 dmladek 2004-08-24 19:57:12 UTC
Also if you could attach your build.xml file
and content of your $ProjectFolder/nbproject

of'course if it's not secret. It helps us detect where is the problem.


And one more question:
Did you use NB to create such project? And which version or rather
build it was? 
And again: What type of project it is... Just snapshot of Project icon
would tell us much :-) Is it a coffie cup or Earth or Ant's icon or...?

thanks for answering those quastions
Comment 4 timbray 2004-08-24 20:26:01 UTC
Summary:
 I uncovered this on a big complex project that I don't want to share.
 So I made a simple project, and found the problem.
 In the new-project dialogue, if you fill in a value for "Test Packages Folder" under the 
main source folder, that does it.  See below.
============================

I have a directory ~/dev/X, containing one project, RgbPlane.java

I select "New Project", type "Standard", "Java Project with Existing Files"

package file ~/dev/X/
test dir left blank

project file ~/dev/NetBeans_projects/X

RgbPlane.java shows up under "default package", hmmmmmmm

compile RgbPlane.java, OK

right-click RgbPlane.java, select tools, select JUnit, select "create tests"

take defaults

Creates "Test Packages"/"RgbPlane"/"RgbPlaneTest.java"

It all works...

Aha! the problem was, that in the previous run, I had filled in the "Test Packages Dir" in the 
new project. as subdirectory "tests" of the main project directory.  That screwed everything 
up.

Is that enough or shall I go through again and reproduce it completely?
Comment 5 dmladek 2004-08-24 21:33:11 UTC
wait a minute, please. Don't hurry.
Thanks for the report. 

But still I need to clarify some stuffs, please:
>I have a directory ~/dev/X, containing one project, RgbPlane.java
using your words: Project is equal to RgbPlane.java (only), right?

What is the package statement in RgbPlane.java, please?
I suppose it is "package X;"


just only correct me if I'm wrong with following expressions...
>package file ~/dev/X/
... means "Source Packages Folder"
>test dir left blank
doesn't mather, but...
... means Test Packages Folder"

>project file ~/dev/NetBeans_projects/X
...means "Project Folder"


>RgbPlane.java shows up under "default package", hmmmmmmm
It's correct behaviour. You don't have any package structure in your
Project :-/




And as you writting next, it is correct behaviour. But previously,
somewhere occured misstake :-|

>the problem was, that in the previous run, I had filled in the "Test
>Packages Dir" in the new project. as subdirectory "tests" of the main 
> project directory.
The dir structure, plese. Was it something like this?
|-- dev
|   |-- X
|   |   `-- RgbPlane.java
|   `-- test

I don't understand what you mean by what, realy. I need better
description :-/ sorry .... 
>That screwed everything up.
It sounds strange. I'm trying to reproduce....

well, with description you've provided, it seems you misunderstand
the terminology used in ide or for what purposes it is used.
Definitely it could be done better...

 More probably it is issue on project UI ->reasigning

Comment 6 dmladek 2004-08-24 21:36:45 UTC
Target Milestone can be < Version .... thus setting to TBD.

Comment 7 timbray 2004-08-24 21:46:07 UTC
I sent a .tgz to dmladek of the project & package directories with the problem 
reproducible. 
Comment 8 Jesse Glick 2004-08-24 23:48:28 UTC
BTW reporter:

1. Please do not paste long blocks of text into the description field;
save to a file and make an attachment. Prevents lines from being
reformatted, which makes them harder to read.

2. Any Ant problems are best diagnosed by changing Verbosity in Ant
Settings, so you can track the problem back to the source.

Still not sure what exactly the reporter is reporting, here. Looks
like a unit test was in the main sources package root?? Useless until
precise details to reproduce have been posted.
Comment 9 dmladek 2004-08-25 15:14:22 UTC
Created attachment 17136 [details]
tar.gz Project provided by the reporter
Comment 10 dmladek 2004-08-25 15:27:36 UTC
I've just attached comprimed nbProject.tar.gz which reported send it
to me. He wrote me following:
----------------------
And, btw, the code isn't sensitive or private in the slightest; see
http://tbray.org/ongoing/When/200x/2004/05/19/RGBPlane

I was just using it as a stand-in to reproduce the problem on my real
source files.  The problem exists because in my real project I already
have a directory full of JUnit tests for that one, and thus got
tangled up there. -Tim
-----------------------

so, I hope I didn't public here what had to stay private/secret.


I asked reporter for providing original project (before he projectized
it which he send me). But he didn't answer me till now, so I'm sharing 
all useful hints I've got from our private converation.




Comment 11 Jesse Glick 2004-08-25 16:47:08 UTC
Well one obvious thing wrong with the project is that ${test.src.dir}
refers to a subdir of ${src.dir}, which is completely illegal (not
supported by any NB project type). If some wizard created this
configuration then that is certainly a bug in the wizard.

Seems that the New Java Project from Existing Sources wizard does not
guard against this condition. E.g. with /space/src/xerces being a
Xerces checkout w/ package roots at "src" and "tests", I select
/space/src/xerces for the src dir (erroneously), and
/space/src/xerces/tests for the test dir, and no error message is
shown and Finish is enabled. Furthermore, mistyping "tests" to refer
to a nonexistent dir does not produce an error message!

Tomas please review the error logic in this wizard, since it is
clearly inadequate. Preferably factor the error handling -
PanelSourceFolders.valid - into an independently testable method
taking inputs and producing a message or null for valid, and write
exhaustive unit tests checking all possible cases.
Comment 12 Tomas Zezula 2004-08-26 13:35:23 UTC
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFolders.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFolders.java,v
 <--  PanelSourceFolders.java
new revision: 1.25; previous revision: 1.24
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFoldersTest.java,v
done
Checking in
j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFoldersTest.java;
/cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFoldersTest.java,v
 <--  PanelSourceFoldersTest.java
initial revision: 1.1
done