Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.7
-
Don't Know (Unsure) - The default level
Description
This step fixes unit tests for the file manager's 'repository' package. This package has only a single test class TestXMLRepositoryManager and the changes are trivial (a couple of lines in the constructor):
Before:
public TestXMLRepositoryManager() { productTypeDirUris.add(new File("./src/testdata/repomgr").toURI().toString()); ... }
After:
import java.net.URL; ... public TestXMLRepositoryManager() { URL url = this.getClass().getResource("/repomgr"); productTypeDirUris.add(new File(url.getFile()).toURI().toString()); ... }
There aren't any System.setProperty() calls in this test class so it's fairly straightforward to fix.
Test results before applying the patch:
Results : Failed tests: testGetProductTypes(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): expected:<3> but was:<0> testGetProductTypeByName(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testGetProductTypeById(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadProductTypeWithMetadataWithBlankMet(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadProductTypeWithMetadataWithNoMet(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadProductTypeWithMetadata(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadBadFormattedDescriptionTrimImplicitTrue(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadDescriptionTrimExplicitFalse(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadDescriptionTrimExplicitTrue(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadVersionerClass(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null testReadRepoPath(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): null Tests in error: testRepoPathEnvVarReplace(org.apache.oodt.cas.filemgr.repository.TestXMLRepositoryManager): 0 Tests run: 12, Failures: 11, Errors: 1, Skipped: 0
Test results after applying the patch:
Results : Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
The following command runs the test from the top level directory:
mvn clean -Dtest=TestXMLRepositoryManager -DfailIfNoTests=false test -pl filemgr -am
The following command runs the test within the filemgr subdirectory:
mvn clean -Dtest=TestXMLRepositoryManager test