Author: ogrisel
Date: Fri May 13 17:15:23 2011
New Revision: 1102818

URL: http://svn.apache.org/viewvc?rev=1102818&view=rev
Log:
make SolrYard tests work with the default eclipse config

Modified:
    
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java
    
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java

Modified: 
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java?rev=1102818&r1=1102817&r2=1102818&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java
 (original)
+++ 
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java
 Fri May 13 17:15:23 2011
@@ -46,11 +46,13 @@ public class SolrDirectoryManagerTest {
     @BeforeClass
     public static void init() {
         // set to "${basedir}/some/rel/path" to test if property substitution 
works!
-        String solrServerDir = "${basedir}" + SolrYardTest.TEST_INDEX_REL_PATH;
+        String prefix = System.getProperty("basedir") == null ? "." : 
"${basedir}";
+        String resolvedPrefix = System.getProperty("basedir") == null ? "." : 
System.getProperty("basedir");
+        String solrServerDir = prefix + SolrYardTest.TEST_INDEX_REL_PATH;
         log.info("configured directory: " + solrServerDir);
         System.setProperty(SolrDirectoryManager.MANAGED_SOLR_DIR_PROPERTY, 
solrServerDir);
         // store the expected managed directory for later testing
-        expectedManagedDirectory = new File(System.getProperty("basedir"), 
SolrYardTest.TEST_INDEX_REL_PATH);
+        expectedManagedDirectory = new File(resolvedPrefix, 
SolrYardTest.TEST_INDEX_REL_PATH);
         log.info("expected managed directory: " + expectedManagedDirectory);
         // create the SolrDirectoryManager used for the tests
         Iterator<SolrDirectoryManager> providerIt = 
ServiceLoader.load(SolrDirectoryManager.class,

Modified: 
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java?rev=1102818&r1=1102817&r2=1102818&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java
 (original)
+++ 
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java
 Fri May 13 17:15:23 2011
@@ -56,7 +56,8 @@ public class SolrYardTest extends YardTe
     public static final void initYard() throws YardException {
         // get the working directory
         // use property substitution to test this feature!
-        String solrServerDir = "${basedir}" + TEST_INDEX_REL_PATH;
+        String prefix = System.getProperty("basedir") == null ? "." : 
"${basedir}";
+        String solrServerDir = prefix + TEST_INDEX_REL_PATH;
         log.info("Test Solr Server Directory: " + solrServerDir);
         System.setProperty(SolrDirectoryManager.MANAGED_SOLR_DIR_PROPERTY, 
solrServerDir);
         SolrYardConfig config = new SolrYardConfig(TEST_YARD_ID, 
TEST_SOLR_CORE_NAME);


Reply via email to