|
List Info
Thread: Running Unit Tests from inside Eclipse
|
|
| Running Unit Tests from inside Eclipse |
  United States |
2007-06-27 13:22:33 |
Hi all,
I always run into path issues when running the unit tests
from inside
of Eclipse...
For example, when I run TestCSVLoader.java I get
java.lang.ExceptionInInitializerError
at
org.apache.solr.util.TestHarness.<init>(TestHarness.ja
va:101)
at org.apache.solr.util.AbstractSolrTestCase.setUp
(AbstractSolrTestCase.java:102)
at
org.apache.solr.handler.TestCSVLoader.setUp(TestCSVLoader.ja
va:43)
at junit.framework.TestCase.runBare(TestCase.java:125)
at
junit.framework.TestResult$1.protect(TestResult.java:106)
at
junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer
ence.run
(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run
(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: Error in
solrconfig.xml
at
org.apache.solr.core.SolrConfig.<clinit>(SolrConfig.ja
va:90)
... 16 more
Caused by: java.lang.RuntimeException: Can't find resource
'solrconfig.xml' in classpath or 'solr/conf/',
cwd=/Users/eric/
Documents/code/oss/apache/solr/trunk
at
org.apache.solr.core.Config.openResource(Config.java:357)
at
org.apache.solr.core.SolrConfig.initConfig(SolrConfig.java:7
9)
at
org.apache.solr.core.SolrConfig.<clinit>(SolrConfig.ja
va:87)
... 16 more
I have a tweak that gives it an alternate path to look up
the
file... Would that be of interest to anyone as a patch
file? Is
there a specific way to config my Eclipse project to find
the path?
Eric Pugh
-------------------------------------------------------
Principal
OpenSource Connections
Site: http://www.opens
ourceconnections.com
Blog: http://blog.ope
nsourceconnections.com
Cell: 1-434-466-1467
|
|
| Re: Running Unit Tests from inside
Eclipse |

|
2007-06-27 13:29:22 |
I tell IntelliJ IDEA to set the working directory for all
the tests to
F:codesolrsrctesttest-files
-Yonik
On 6/27/07, Eric Pugh <epugh opensourceconnections.com> wrote:
> Hi all,
>
> I always run into path issues when running the unit
tests from inside
> of Eclipse...
>
> For example, when I run TestCSVLoader.java I get
>
> java.lang.ExceptionInInitializerError
> at
org.apache.solr.util.TestHarness.<init>(TestHarness.ja
va:101)
> at
org.apache.solr.util.AbstractSolrTestCase.setUp
> (AbstractSolrTestCase.java:102)
> at
org.apache.solr.handler.TestCSVLoader.setUp(TestCSVLoader.ja
va:43)
> at
junit.framework.TestCase.runBare(TestCase.java:125)
> at
junit.framework.TestResult$1.protect(TestResult.java:106)
> at
junit.framework.TestResult.runProtected(TestResult.java:124)
> at
junit.framework.TestResult.run(TestResult.java:109)
> at
junit.framework.TestCase.run(TestCase.java:118)
> at
junit.framework.TestSuite.runTest(TestSuite.java:208)
> at
junit.framework.TestSuite.run(TestSuite.java:203)
> at
>
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer
ence.run
> (JUnit3TestReference.java:128)
> at
org.eclipse.jdt.internal.junit.runner.TestExecution.run
> (TestExecution.java:38)
> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
> (RemoteTestRunner.java:460)
> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
> (RemoteTestRunner.java:673)
> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
> (RemoteTestRunner.java:386)
> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
> (RemoteTestRunner.java:196)
> Caused by: java.lang.RuntimeException: Error in
solrconfig.xml
> at
org.apache.solr.core.SolrConfig.<clinit>(SolrConfig.ja
va:90)
> ... 16 more
> Caused by: java.lang.RuntimeException: Can't find
resource
> 'solrconfig.xml' in classpath or 'solr/conf/',
cwd=/Users/eric/
> Documents/code/oss/apache/solr/trunk
> at
org.apache.solr.core.Config.openResource(Config.java:357)
> at
org.apache.solr.core.SolrConfig.initConfig(SolrConfig.java:7
9)
> at
org.apache.solr.core.SolrConfig.<clinit>(SolrConfig.ja
va:87)
> ... 16 more
>
>
> I have a tweak that gives it an alternate path to look
up the
> file... Would that be of interest to anyone as a patch
file? Is
> there a specific way to config my Eclipse project to
find the path?
>
> Eric Pugh
>
>
>
>
>
>
-------------------------------------------------------
> Principal
> OpenSource Connections
> Site: http://www.opens
ourceconnections.com
> Blog: http://blog.ope
nsourceconnections.com
> Cell: 1-434-466-1467
>
>
>
>
>
|
|
| Re: Running Unit Tests from inside
Eclipse |
  United States |
2007-06-27 14:12:21 |
I was wondering about that, but also, how do you handle the
two
system properties?
I added to public TestHarness(String dataDirectory,
String confFile,
String schemaFile) {
these lines:
System.setProperty("solr.test.sys.prop1",
"propone");
System.setProperty("solr.test.sys.prop2",
"proptwo");
Otherwise I always got an error about a missing system
property.
Normally, via Ant, these are passed in via the JUnit test
definition. Would this change be worth an issue in Jira and
a patch
file?
Also, mucking around with working-directories didn't work,
so I added
the path in Config.java. Attached is a patch file for these
two
changes.....
Eric
On Jun 27, 2007, at 2:29 PM, Yonik Seeley wrote:
> I tell IntelliJ IDEA to set the working directory for
all the tests to
> F:codesolrsrctesttest-files
>
> -Yonik
>
> On 6/27/07, Eric Pugh <epugh opensourceconnections.com> wrote:
>> Hi all,
>>
>> I always run into path issues when running the unit
tests from inside
>> of Eclipse...
>>
>> For example, when I run TestCSVLoader.java I get
>>
>> java.lang.ExceptionInInitializerError
>> at
org.apache.solr.util.TestHarness.<init>
>> (TestHarness.java:101)
>> at
org.apache.solr.util.AbstractSolrTestCase.setUp
>> (AbstractSolrTestCase.java:102)
>> at
org.apache.solr.handler.TestCSVLoader.setUp
>> (TestCSVLoader.java:43)
>> at
junit.framework.TestCase.runBare(TestCase.java:125)
>> at
junit.framework.TestResult$1.protect(TestResult.java:106)
>> at
junit.framework.TestResult.runProtected(TestResult.java:
>> 124)
>> at
junit.framework.TestResult.run(TestResult.java:109)
>> at
junit.framework.TestCase.run(TestCase.java:118)
>> at
junit.framework.TestSuite.runTest(TestSuite.java:208)
>> at
junit.framework.TestSuite.run(TestSuite.java:203)
>> at
>>
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer
ence.run
>> (JUnit3TestReference.java:128)
>> at
org.eclipse.jdt.internal.junit.runner.TestExecution.run
>> (TestExecution.java:38)
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
>> (RemoteTestRunner.java:460)
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
>> (RemoteTestRunner.java:673)
>> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
>> (RemoteTestRunner.java:386)
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
>> (RemoteTestRunner.java:196)
>> Caused by: java.lang.RuntimeException: Error in
solrconfig.xml
>> at
org.apache.solr.core.SolrConfig.<clinit>
>> (SolrConfig.java:90)
>> ... 16 more
>> Caused by: java.lang.RuntimeException: Can't find
resource
>> 'solrconfig.xml' in classpath or 'solr/conf/',
cwd=/Users/eric/
>> Documents/code/oss/apache/solr/trunk
>> at
org.apache.solr.core.Config.openResource(Config.java:357)
>> at
org.apache.solr.core.SolrConfig.initConfig
>> (SolrConfig.java:79)
>> at
org.apache.solr.core.SolrConfig.<clinit>
>> (SolrConfig.java:87)
>> ... 16 more
>>
>>
>> I have a tweak that gives it an alternate path to
look up the
>> file... Would that be of interest to anyone as a
patch file? Is
>> there a specific way to config my Eclipse project
to find the path?
>>
>> Eric Pugh
>>
>>
>>
>>
>>
>>
-------------------------------------------------------
>> Principal
>> OpenSource Connections
>> Site: http://www.opens
ourceconnections.com
>> Blog: http://blog.ope
nsourceconnections.com
>> Cell: 1-434-466-1467
>>
>>
>>
>>
>>
-------------------------------------------------------
Principal
OpenSource Connections
Site: http://www.opens
ourceconnections.com
Blog: http://blog.ope
nsourceconnections.com
Cell: 1-434-466-1467
|
|
| Re: Running Unit Tests from inside
Eclipse |
  United States |
2007-06-27 14:26:18 |
You need to add something like:
"-Dsolr.test.sys.prop1=xxx
-Dsolr.test.sys.prop2=xxx" to the VM
arguments in the Run panel.
It is kind of annoying they are required for all tests...
ideally we
would move the schema property testing to an independent
test, but that
has not happend yet.
Eric Pugh wrote:
> I was wondering about that, but also, how do you handle
the two system
> properties?
>
> I added to public TestHarness(String dataDirectory,
> String confFile,
> String schemaFile) {
>
> these lines:
>
> System.setProperty("solr.test.sys.prop1",
"propone");
> System.setProperty("solr.test.sys.prop2",
"proptwo");
>
> Otherwise I always got an error about a missing system
property.
> Normally, via Ant, these are passed in via the JUnit
test definition.
> Would this change be worth an issue in Jira and a patch
file?
>
> Also, mucking around with working-directories didn't
work, so I added
> the path in Config.java. Attached is a patch file for
these two
> changes.....
>
> Eric
>
>
>
>
> On Jun 27, 2007, at 2:29 PM, Yonik Seeley wrote:
>
>> I tell IntelliJ IDEA to set the working directory
for all the tests to
>> F:codesolrsrctesttest-files
>>
>> -Yonik
>>
>> On 6/27/07, Eric Pugh <epugh opensourceconnections.com> wrote:
>>> Hi all,
>>>
>>> I always run into path issues when running the
unit tests from inside
>>> of Eclipse...
>>>
>>> For example, when I run TestCSVLoader.java I
get
>>>
>>> java.lang.ExceptionInInitializerError
>>> at
org.apache.solr.util.TestHarness.<init>(TestHarness.ja
va:101)
>>> at
org.apache.solr.util.AbstractSolrTestCase.setUp
>>> (AbstractSolrTestCase.java:102)
>>> at
>>>
org.apache.solr.handler.TestCSVLoader.setUp(TestCSVLoader.ja
va:43)
>>> at
junit.framework.TestCase.runBare(TestCase.java:125)
>>> at
junit.framework.TestResult$1.protect(TestResult.java:106)
>>> at
junit.framework.TestResult.runProtected(TestResult.java:124)
>>> at
junit.framework.TestResult.run(TestResult.java:109)
>>> at
junit.framework.TestCase.run(TestCase.java:118)
>>> at
junit.framework.TestSuite.runTest(TestSuite.java:208)
>>> at
junit.framework.TestSuite.run(TestSuite.java:203)
>>> at
>>>
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer
ence.run
>>> (JUnit3TestReference.java:128)
>>> at
org.eclipse.jdt.internal.junit.runner.TestExecution.run
>>> (TestExecution.java:38)
>>> at
>>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
>>> (RemoteTestRunner.java:460)
>>> at
>>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
sts
>>> (RemoteTestRunner.java:673)
>>> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
>>> (RemoteTestRunner.java:386)
>>> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
>>> (RemoteTestRunner.java:196)
>>> Caused by: java.lang.RuntimeException: Error in
solrconfig.xml
>>> at
org.apache.solr.core.SolrConfig.<clinit>(SolrConfig.ja
va:90)
>>> ... 16 more
>>> Caused by: java.lang.RuntimeException: Can't
find resource
>>> 'solrconfig.xml' in classpath or 'solr/conf/',
cwd=/Users/eric/
>>> Documents/code/oss/apache/solr/trunk
>>> at
org.apache.solr.core.Config.openResource(Config.java:357)
>>> at
>>>
org.apache.solr.core.SolrConfig.initConfig(SolrConfig.java:7
9)
>>> at
org.apache.solr.core.SolrConfig.<clinit>(SolrConfig.ja
va:87)
>>> ... 16 more
>>>
>>>
>>> I have a tweak that gives it an alternate path
to look up the
>>> file... Would that be of interest to anyone as
a patch file? Is
>>> there a specific way to config my Eclipse
project to find the path?
>>>
>>> Eric Pugh
>>>
>>>
>>>
>>>
>>>
>>>
-------------------------------------------------------
>>> Principal
>>> OpenSource Connections
>>> Site: http://www.opens
ourceconnections.com
>>> Blog: http://blog.ope
nsourceconnections.com
>>> Cell: 1-434-466-1467
>>>
>>>
>>>
>>>
>>>
>
>
-------------------------------------------------------
> Principal
> OpenSource Connections
> Site: http://www.opens
ourceconnections.com
> Blog: http://blog.ope
nsourceconnections.com
> Cell: 1-434-466-1467
>
>
>
>
|
|
| Re: Running Unit Tests from inside
Eclipse |

|
2007-06-27 14:54:08 |
On 6/27/07, Eric Pugh <epugh opensourceconnections.com> wrote:
> I added to public TestHarness(String dataDirectory,
> String confFile,
> String schemaFile) {
>
> these lines:
>
> System.setProperty("solr.test.sys.prop1",
"propone");
> System.setProperty("solr.test.sys.prop2",
"proptwo");
>
> Otherwise I always got an error about a missing system
property.
> Normally, via Ant, these are passed in via the JUnit
test
> definition. Would this change be worth an issue in
Jira and a patch
> file?
Yes, either this, or make those specific tests use a
separate config.
> Also, mucking around with working-directories didn't
work, so I added
> the path in Config.java. Attached is a patch file for
these two
> changes.....
Hmmm, don't know why fixing the working directory wouldn't
work for
you... anyone else use Eclipse?
-Yonik
|
|
| Re: Running Unit Tests from inside
Eclipse |
  United States |
2007-06-27 15:11:26 |
: the path in Config.java. Attached is a patch file for
these two
: changes.....
FYI; apache mailing lists strip most attachments ... i think
it works if
hte mime-type is text/plain, but the simplest thing to do is
just include
it inline in your message.
(as a general philosophy, i'm opposed to code changes solely
for the
purpose of making IDEs happy ... IDEs should make developing
code easier,
not hte other way arround)
-Hoss
|
|
| Re: Running Unit Tests from inside
Eclipse |
  United States |
2007-06-28 05:42:15 |
I agree with the thought about bending your code to fit your
IDE.
In the case of the unit tests and though, it seems like a
simplification of the tests to make them not dependent on
external
configuration that is provided via Ant or any other tool....
Coming
from the "new to Solr and don't know the ins and
outs" end of things!
Hence why I like defining the System properties inside the
Java test
code.
Eric Pugh
On Jun 27, 2007, at 4:11 PM, Chris Hostetter wrote:
> : the path in Config.java. Attached is a patch file
for these two
> : changes.....
>
> FYI; apache mailing lists strip most attachments ... i
think it
> works if
> hte mime-type is text/plain, but the simplest thing to
do is just
> include
> it inline in your message.
>
> (as a general philosophy, i'm opposed to code changes
solely for the
> purpose of making IDEs happy ... IDEs should make
developing code
> easier,
> not hte other way arround)
>
>
>
> -Hoss
>
-------------------------------------------------------
Principal
OpenSource Connections
Site: http://www.opens
ourceconnections.com
Blog: http://blog.ope
nsourceconnections.com
Cell: 1-434-466-1467
|
|
[1-7]
|
|