Grokbase Groups Lucene dev March 2010
FAQ
Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
-----------------------------------------------------------------------

Key: LUCENE-2318
URL: https://issues.apache.org/jira/browse/LUCENE-2318
Project: Lucene - Java
Issue Type: Test
Reporter: Uwe Schindler
Assignee: Uwe Schindler
Fix For: 3.1


Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.

We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org

Search Discussions

  • Shai Erera (JIRA) at Mar 14, 2010 at 7:20 am
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845038#action_12845038 ]

    Shai Erera commented on LUCENE-2318:
    ------------------------------------

    Uwe, can you default to "java.io.tmpdir" instead? "." is not properly defined. It will create indexes in the current directory where the tests run from, which is different if I run "ant test" from <root>, <root>/contrib and <root>/benchmark ...

    Or, we can tweak common-build.xml to fallback to <root>/test. In fact, looking in common-build.xml, I already see tempDir defaults to {build.dir}/test. Look at lines 448 (where it is set), 417 where it is used and 418 where java.io.tmpdir is set to that value.

    Maybe we need to change the definition of build.dir from location="build" to location="{common.dir}/build" so that it always references <root>/build.

    And if run from eclipse, default TEMP_DIR constant to "java.io.tmpdir"?
    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org
  • Uwe Schindler (JIRA) at Mar 14, 2010 at 8:44 am
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845049#action_12845049 ]

    Uwe Schindler commented on LUCENE-2318:
    ---------------------------------------

    bq. Uwe, can you default to "java.io.tmpdir" instead?

    The problem are only test runs outside ANT. If you run the tests from ANT there is never a problem, they use ${build.dir}/test, which is perfectly defined. But the tempDir system property is not set when running the tests from eclipse. So Your suggestion to fallback to java.io.tmpdir is a good idea, maybe with "/lucene-test" appended.

    bq. Maybe we need to change the definition of build.dir from location="build" to location="{common.dir}/build" so that it always references <root>/build.

    This would break contrib. Its defined correctly at the moment, as ANT guarantees that "." or the current dir defaults to the `dirname build.xml`.

    bq. Or, we can tweak common-build.xml to fallback to <root>/test.

    common-build never needs a fallback, as its always defined. and <root>/test is exactly what we do not want to have as it will not be cleaned up on "ant clean"
    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org
  • Uwe Schindler (JIRA) at Mar 14, 2010 at 11:32 am
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Uwe Schindler updated LUCENE-2318:
    ----------------------------------

    Attachment: LUCENE-2318.patch

    Here the patch.

    I removed almost all System.getProperty calls from tests. Only remaining are the special properties in benchmark (maybe that can be solved, too) and System.getProperty("line.separator") - but that's fine.

    LuceneTestCaseJ4 now has two fields of type java.io.File:
    - TEMP_DIR that is retrieved from system property "tempDir", set by ANT or, if not available from "java.io.tmpdir". By this tests will also run correctly from eclipse. This is static.
    - DATA_DIR (deprecated) that is used by some contrib tests. This should not be used, instead the tests should use this.getClass().getResource/getResourceAsStream, which is also relative to the current tests. I did not change the tests to use this. DATA_DIR is detected from system property (set by ANT), else it is loaded from classpath of the *current* test class, because of that it is not static (but final) and initialized in the class ctor.
    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1

    Attachments: LUCENE-2318.patch


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org
  • Uwe Schindler (JIRA) at Mar 14, 2010 at 1:12 pm
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Uwe Schindler updated LUCENE-2318:
    ----------------------------------

    Attachment: LUCENE-2318.patch

    New patch, removed usage of DATA_DIR again.

    All tests that simply needed an InputStream were converted to getResourceAsStream(). Other tests that really need a File instance can use LuceneTestCase(J4).getDataFile(String), which was heavily borrowed from the PorterTestCase, I moved the code there. Its only few tests that use this function.

    This is now ready to commit.
    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1

    Attachments: LUCENE-2318.patch, LUCENE-2318.patch


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org
  • Shai Erera (JIRA) at Mar 14, 2010 at 3:22 pm
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845097#action_12845097 ]

    Shai Erera commented on LUCENE-2318:
    ------------------------------------

    Patch looks good.

    I see that you've documented TEST_VERSION_CURRENT in LuceneTestCase(J4) as: /** Use this constant when creating Analyzers. */. It's used already for creating IndexWriterConfig,and I assume it will be used for other components as we'll introduce it in them (LUCENE-2305). So perhaps generalize the jdoc?

    It bothered me for a long time that I cannot run some tests from eclipse because of this 'tempDir'. I'm glad you fixed it !

    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1

    Attachments: LUCENE-2318.patch, LUCENE-2318.patch


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org
  • Uwe Schindler (JIRA) at Mar 14, 2010 at 3:30 pm
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845098#action_12845098 ]

    Uwe Schindler commented on LUCENE-2318:
    ---------------------------------------

    OK, I fixed the javadocs here! Thanks.
    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1

    Attachments: LUCENE-2318.patch, LUCENE-2318.patch


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org
  • Uwe Schindler (JIRA) at Mar 14, 2010 at 4:24 pm
    [ https://issues.apache.org/jira/browse/LUCENE-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Uwe Schindler resolved LUCENE-2318.
    -----------------------------------

    Resolution: Fixed
    Lucene Fields: [New, Patch Available] (was: [New])

    Committed revision: 922886
    Add System.getProperty("tempDir") as final static to LuceneTestCase(J4)
    -----------------------------------------------------------------------

    Key: LUCENE-2318
    URL: https://issues.apache.org/jira/browse/LUCENE-2318
    Project: Lucene - Java
    Issue Type: Test
    Reporter: Uwe Schindler
    Assignee: Uwe Schindler
    Fix For: 3.1

    Attachments: LUCENE-2318.patch, LUCENE-2318.patch


    Almost every test calls System.getProperty("tempDir") and some of them check the return value for null. In other cases the test simply fails from within eclipse.
    We should add this to LuceneTestCase(J4) as a static final constant. For enabling tests run in eclipse, we can add a fallback to ".", if the Sysprop is not defined.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-dev-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categorieslucene
postedMar 13, '10 at 4:57p
activeMar 14, '10 at 4:24p
posts8
users1
websitelucene.apache.org

1 user in discussion

Uwe Schindler (JIRA): 8 posts

People

Translate

site design / logo © 2021 Grokbase