Examples of headless Java Projects [message #84735] |
Mon, 11 August 2003 20:53 |
Eclipse User |
|
|
|
Originally posted by: Jim.OConnor.microfocus.com
Hi All,
I would like to build some Java Projects in a headless mode, "save off"
an AST or XML representation, and query the information for Classes and
uses of classes. The org.eclipse.jdt.core.test appear to be a good place
to start to analyze this process.
I am using Eclipse Version 2.1.0. I "checked out as project" the
versions of org.eclipse.jdt.core.tests.compiler and
org.eclipse.jdt.core.tests.model. I resolved the project dependencies by
pointing to the jars in the plugins directory for core.boot, core.runtime,
jdt.core, jdt.debug and junit.
I run the JUNIT test with a test class
"org.eclipse.jdt.core.tests.model.AllJavaModelTests". 323 of the 325
tests fail. The routine in "AbstractJavaModelTests.java" is not happy:
public IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
}
protected IWorkspaceRoot getWorkspaceRoot() {
return getWorkspace().getRoot();
}
getWorkspace() returns null. ResourcesPlugin.workspace field is null. It
gets initialized in the ResourcePlugin.startup() routine.
Am I running these tests correctly? A little information might be a lot
of help.
Thanks, in advance, for help.
Jim
|
|
|
|
|
|
Re: Examples of headless Java Projects [message #84853 is a reply to message #84822] |
Tue, 12 August 2003 14:54 |
Eclipse User |
|
|
|
Originally posted by: olivier_thomann.ca.ibm.comNOSPAM
Le Tue, 12 Aug 2003 14:26:24 +0000 (UTC), Jim.OConnor@microfocus.com
(Jim OConnor) a écrit :
>"No, I am launching the test from the "Debug..." menu from inside Eclipse"
>
>This location uses the org.eclipse.jdt.junit. Correct?
You should see different launching configuration and one of them is
JUnit Plugin Test. This is the one you want to use.
--
Olivier
|
|
|
Re: Examples of headless Java Projects [message #84882 is a reply to message #84853] |
Tue, 12 August 2003 15:19 |
Eclipse User |
|
|
|
Originally posted by: Jim.OConnor.microfocus.com
Olivier Thomann wrote:
> Le Tue, 12 Aug 2003 14:26:24 +0000 (UTC), Jim.OConnor@microfocus.com
> (Jim OConnor) a écrit :
> >"No, I am launching the test from the "Debug..." menu from inside Eclipse"
> >
> >This location uses the org.eclipse.jdt.junit. Correct?
> You should see different launching configuration and one of them is
> JUnit Plugin Test. This is the one you want to use.
> --
> Olivier
Yes, I do this.
Under "Test" Tab, I have
"Project:" org.eclipse.jdt.core.tests.model and
"Test class:" org.eclipse.jdt.core.tests.model.JavaModelTests, a short
test. When I hit "Debug", 4 of 4 tests fail, and the console shows
java.lang.NullPointerException
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.getW orkspaceRoot(AbstractJavaModelTests.java:513)
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setu pExternalJCL(AbstractJavaModelTests.java:574)
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setU pSuite(AbstractJavaModelTests.java:642)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runT est(SuiteOfTestCases.java:77)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.acce ss$0(SuiteOfTestCases.java:1)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect( SuiteOfTestCases.java:61)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run( SuiteOfTestCases.java:70)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:392)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:276)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:167)
Debuging yields the information that
ResourcesPlugin.getWorkspace() returns null.
I have downloaded org.eclipse.jdt.core.tests.compiler and model. The
other libraries come from my 2.1.0 installation of eclipse.
Would it make a diference if I removed the jdt.junit and tried the
pde.junit plugin?
|
|
|
Re: Examples of headless Java Projects [message #84897 is a reply to message #84882] |
Tue, 12 August 2003 16:28 |
Eclipse User |
|
|
|
Originally posted by: adam_kiezun.ch.ibm.remove.com
> Would it make a diference if I removed the jdt.junit and tried the
> pde.junit plugin?
you don't replace jdt.junit with pde.junit
you ADD pde.junit to your plugin set
a.
|
|
|
Re: Examples of headless Java Projects [message #84912 is a reply to message #84882] |
Tue, 12 August 2003 16:39 |
Eclipse User |
|
|
|
Originally posted by: olivier_thomann.ca.ibm.comNOSPAM
Le Tue, 12 Aug 2003 15:19:29 +0000 (UTC), Jim.OConnor@microfocus.com
(Jim OConnor) a écrit :
>Under "Test" Tab, I have
>"Project:" org.eclipse.jdt.core.tests.model and
>"Test class:" org.eclipse.jdt.core.tests.model.JavaModelTests, a short
>test. When I hit "Debug", 4 of 4 tests fail, and the console shows
>
>java.lang.NullPointerException
> at
> org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.getW orkspaceRoot(AbstractJavaModelTests.java:513)
> at
> org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setu pExternalJCL(AbstractJavaModelTests.java:574)
> at
> org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setU pSuite(AbstractJavaModelTests.java:642)
> at
> org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runT est(SuiteOfTestCases.java:77)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.acce ss$0(SuiteOfTestCases.java:1)
> at
> org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect( SuiteOfTestCases.java:61)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at
> org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run( SuiteOfTestCases.java:70)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:392)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:276)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:167)
>
>Debuging yields the information that
>
>ResourcesPlugin.getWorkspace() returns null.
That would mean that there is no eclipse workspace running.
>I have downloaded org.eclipse.jdt.core.tests.compiler and model. The
>other libraries come from my 2.1.0 installation of eclipse.
You should keep everything consistent. Some tests rely on fixes made
after 2.1.0. So you should always test the Java model tests relative
to the build they are coming from.
>Would it make a diference if I removed the jdt.junit and tried the
>pde.junit plugin?
No. That should not matter.
--
Olivier
|
|
|
Re: Examples of headless Java Projects [message #84971 is a reply to message #84897] |
Tue, 12 August 2003 17:18 |
Eclipse User |
|
|
|
Originally posted by: Jim.OConnor.microfocus.com
Adam Kiezun wrote:
> > Would it make a diference if I removed the jdt.junit and tried the
> > pde.junit plugin?
> you don't replace jdt.junit with pde.junit
> you ADD pde.junit to your plugin set
> a.
Cool. Things are still a bit funky but they are changing.
I added pde.junit to the plugins directory and re-started Eclipse.
This added a "JUnit Plug-in test" to the launch configurations.
I tried a adding the JavaModel tests from the
org.eclipse.jdt.core.test.model project. This is a Java project in the
workspace that was created from the dev.eclipse.org CVS repository menu
option "Checkout as project".
I get the message
java.io.FileNotFoundException:
E:\eclipse\plugins\org.eclipse.jdt.core.tests.model\JCL\jclM in.jar (The
system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.read (AbstractJavaModelTests.java:518)
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.copy (AbstractJavaModelTests.java:150)
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setu pExternalJCL(AbstractJavaModelTests.java:599)
at
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setU pSuite(AbstractJavaModelTests.java:642)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runT est(SuiteOfTestCases.java:77)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.acce ss$0(SuiteOfTestCases.java:1)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect( SuiteOfTestCases.java:61)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run( SuiteOfTestCases.java:70)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:392)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:276)
at
org.eclipse.pde.internal.junit.ui.RemotePluginTestRunner.mai n(RemotePluginTestRunner.java:30)
at
org.eclipse.pde.internal.junit.ui.UITestApplication.runEvent Loop(UITestApplication.java:35)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.java:845)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:431)
at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
Do I need to "install" the tests.model plugin?
i.e. copy the org.eclipse.jdt.core.test.model files into the plugins
directory?
|
|
|
Re: Examples of headless Java Projects [message #84986 is a reply to message #84971] |
Tue, 12 August 2003 17:26 |
Eclipse User |
|
|
|
Originally posted by: Jim.OConnor.microfocus.com
Jim OConnor wrote:
Sorry, again.
The test explicitly looks for *.jar and *.zip files in the
ECLIPSE_HOME\plugins\org.eclipse.jdt.core.tests.model\JCL directory. I'm
good to go. Thanks for the help to both Adam and Olivier.
Now I get no messages in the console and the tests pass. Back to figure
out what they do!!
> Adam Kiezun wrote:
> > > Would it make a diference if I removed the jdt.junit and tried the
> > > pde.junit plugin?
> > you don't replace jdt.junit with pde.junit
> > you ADD pde.junit to your plugin set
> > a.
> Cool. Things are still a bit funky but they are changing.
> I added pde.junit to the plugins directory and re-started Eclipse.
> This added a "JUnit Plug-in test" to the launch configurations.
> I tried a adding the JavaModel tests from the
> org.eclipse.jdt.core.test.model project. This is a Java project in the
> workspace that was created from the dev.eclipse.org CVS repository menu
> option "Checkout as project".
> I get the message
> java.io.FileNotFoundException:
> E:eclipsepluginsorg.eclipse.jdt.core.tests.modelJCLjclMin.ja r (The
> system cannot find the path specified)
> at java.io.FileInputStream.open(Native Method)
> at java.io.FileInputStream.<init>(FileInputStream.java:103)
> at
>
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.read (AbstractJavaModelTests.java:518)
> at
>
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.copy (AbstractJavaModelTests.java:150)
> at
>
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setu pExternalJCL(AbstractJavaModelTests.java:599)
> at
>
org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setU pSuite(AbstractJavaModelTests.java:642)
> at
>
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runT est(SuiteOfTestCases.java:77)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
>
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.acce ss$0(SuiteOfTestCases.java:1)
> at
>
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect( SuiteOfTestCases.java:61)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at
>
org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run( SuiteOfTestCases.java:70)
> at
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:392)
> at
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:276)
> at
>
org.eclipse.pde.internal.junit.ui.RemotePluginTestRunner.mai n(RemotePluginTestRunner.java:30)
> at
>
org.eclipse.pde.internal.junit.ui.UITestApplication.runEvent Loop(UITestApplication.java:35)
> at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
> at
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.java:845)
> at org.eclipse.core.boot.BootLoader.run(BootLoader.java:431)
> at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
> Do I need to "install" the tests.model plugin?
> i.e. copy the org.eclipse.jdt.core.test.model files into the plugins
> directory?
|
|
|
Powered by
FUDForum. Page generated in 0.04365 seconds