[ 
https://issues.apache.org/jira/browse/OODT-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14093394#comment-14093394
 ] 

Ross Laidlaw commented on OODT-736:
-----------------------------------

Hi Rishi,

When running the structs.type.TestTypeHandler tests, they leave behind some 
data in the filemgr directory.  They create a directory named 'file:' 
(including the colon character) and inside that directory is a subdirectory 
'testdata', which contains a 'segments' file:

{noformat}
filemgr/file:/testdata/segments
{noformat}

I looked at the filemgr.properties file and the following setting is present:

{noformat}
# lucene catalog configuration
org.apache.oodt.cas.filemgr.catalog.lucene.idxPath=file:/testdata/
{noformat}

And it seems that this is contributing to the issue, as the path 
'file:/testdata/' is used to set the Lucene catalog location.  But it looks 
like TestTypeHandler is using a DataSourceCatalog.  Do you think it might be 
trying to access a LuceneCatalog configuration too?

I tried a quick fix by overriding the lucene.idxPath property in the setUp 
method (actually in the 'setUpProperties()' method, which is called from 
setUp), by adding the following line:

{code}
properties.setProperty("org.apache.oodt.cas.filemgr.catalog.lucene.idxPath", 
tmpDirPath);
{code}


Where 'tmpDirPath' is already defined in setUpProperties.  Here's the added 
line with a bit more context:

{code}
public void setUpProperties() {
        ...
        File tempDir = null;
        File tempFile = null;

        try {
            tempFile = File.createTempFile("foo", "bar");
            tempFile.deleteOnExit();
            tempDir = tempFile.getParentFile();
        } catch (Exception e) {
            fail(e.getMessage());
        }

        tmpDirPath = tempDir.getAbsolutePath();
        if (!tmpDirPath.endsWith("/")) {
            tmpDirPath += "/";
        }

        tmpDirPath += "testCat";

        properties.setProperty(
          "org.apache.oodt.cas.filemgr.catalog.lucene.idxPath",
          tmpDirPath);
        ...
}
{code}

This seemed to fix the problem, as the tmpDirPath directory is already cleared 
up in the tearDown method.  Would this be an acceptable fix?  Or is there 
something going wrong here where the test shouldn't be accessing Lucene config 
info if it's using a DataSourceCatalog?

> Fix File Manager Unit Tests - 'structs' Package
> -----------------------------------------------
>
>                 Key: OODT-736
>                 URL: https://issues.apache.org/jira/browse/OODT-736
>             Project: OODT
>          Issue Type: Sub-task
>          Components: file manager
>    Affects Versions: 0.7
>            Reporter: Ross Laidlaw
>            Assignee: Ross Laidlaw
>              Labels: patch, test
>             Fix For: 0.7
>
>         Attachments: OODT-736.fix-structs-tests.rlaidlaw.2014-08-05.patch.txt
>
>
> There are three failing tests from the structs.type package (TestTypeHandler 
> class) that need to be repaired, plus some paths/properties in the 
> TestProduct and TestReference classes (structs package) that need updating.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to