You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2014/09/12 21:00:40 UTC

svn commit: r1624616 - in /lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj: SolrSchemalessExampleTest.java SolrSchemalessExampleTests.java

Author: sarowe
Date: Fri Sep 12 19:00:39 2014
New Revision: 1624616

URL: http://svn.apache.org/r1624616
Log:
SOLR-6508: SolrSchemalessExampleTests -> SolrSchemalessExampleTest (removed trailing 's' blocking execution under Ant); example-schemaless solr home is now copied to a temp dir before executing the tests.

Added:
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java
      - copied, changed from r1624593, lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTests.java
Removed:
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTests.java

Copied: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java (from r1624593, lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTests.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java?p2=lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java&p1=lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTests.java&r1=1624593&r2=1624616&rev=1624616&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTests.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java Fri Sep 12 19:00:39 2014
@@ -17,6 +17,7 @@
 
 package org.apache.solr.client.solrj;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpPost;
@@ -24,7 +25,6 @@ import org.apache.http.entity.InputStrea
 import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
 import org.apache.solr.client.solrj.impl.BinaryResponseParser;
 import org.apache.solr.client.solrj.impl.HttpSolrServer;
-import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.util.ExternalPaths;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -32,16 +32,20 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
+
+public class SolrSchemalessExampleTest extends SolrExampleTestsBase {
+  private static Logger log = LoggerFactory.getLogger(SolrSchemalessExampleTest.class);
 
-public class SolrSchemalessExampleTests extends SolrExampleTestsBase {
-  private static Logger log = LoggerFactory
-      .getLogger(SolrSchemalessExampleTests.class);
-  
   @BeforeClass
-  public static void beforeTest() throws Exception {
-    createJetty(ExternalPaths.EXAMPLE_SCHEMALESS_HOME, null, null);
+  public static void beforeClass() throws Exception {
+    File tempSolrHome = createTempDir();
+    // Schemaless renames schema.xml -> schema.xml.bak, and creates + modifies conf/managed-schema,
+    // which violates the test security manager's rules, which disallow writes outside the build dir,
+    // so we copy the example/example-schemaless/solr/ directory to a new temp dir where writes are allowed. 
+    FileUtils.copyDirectory(new File(ExternalPaths.EXAMPLE_SCHEMALESS_HOME), tempSolrHome);
+    createJetty(tempSolrHome.getAbsolutePath(), null, null);
   }
-
   @Test
   public void testArbitraryJsonIndexing() throws Exception  {
     HttpSolrServer server = (HttpSolrServer) getSolrServer();