lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr git commit: SOLR-8029 Randomly run schema tests with v2 API
Date Fri, 29 Jan 2016 12:32:55 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/apiv2 1381cc686 -> acf1a310b


SOLR-8029 Randomly run schema tests with v2 API


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/acf1a310
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/acf1a310
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/acf1a310

Branch: refs/heads/apiv2
Commit: acf1a310b40b9e68eadfc21687d7f4b92721a4cc
Parents: 1381cc6
Author: Noble Paul <noble@apache.org>
Authored: Fri Jan 29 18:02:15 2016 +0530
Committer: Noble Paul <noble@apache.org>
Committed: Fri Jan 29 18:02:15 2016 +0530

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/v2api/ApiBag.java    |  1 -
 solr/core/src/resources/v2apispec/node.Info.json        |  8 ++++----
 .../org/apache/solr/handler/admin/TestV2Framework.java  | 12 +++++++-----
 .../org/apache/solr/rest/schema/TestBulkSchemaAPI.java  |  9 +++++++++
 .../src/java/org/apache/solr/util/RestTestHarness.java  |  8 ++++++++
 5 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/acf1a310/solr/core/src/java/org/apache/solr/v2api/ApiBag.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/v2api/ApiBag.java b/solr/core/src/java/org/apache/solr/v2api/ApiBag.java
index 383fb79..6e1a07f 100644
--- a/solr/core/src/java/org/apache/solr/v2api/ApiBag.java
+++ b/solr/core/src/java/org/apache/solr/v2api/ApiBag.java
@@ -57,7 +57,6 @@ public class ApiBag {
 
   public static Map2 getResource(String name) {
     InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
-//    ByteBuffer buf = webappResourceLoader.get(name);
     if (is == null)
       throw new RuntimeException("invalid API spec :" + name );
     Map2 map1 = null;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/acf1a310/solr/core/src/resources/v2apispec/node.Info.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/v2apispec/node.Info.json b/solr/core/src/resources/v2apispec/node.Info.json
index 0e6dccf..687b6b6 100644
--- a/solr/core/src/resources/v2apispec/node.Info.json
+++ b/solr/core/src/resources/v2apispec/node.Info.json
@@ -5,10 +5,10 @@
     "url": {
       "path": "/node",
       "paths": [
-        "node/properties",
-        "node/threads",
-        "node/logging",
-        "node/system"]
+        "/node/properties",
+        "/node/threads",
+        "/node/logging",
+        "/node/system"]
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/acf1a310/solr/core/src/test/org/apache/solr/handler/admin/TestV2Framework.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestV2Framework.java b/solr/core/src/test/org/apache/solr/handler/admin/TestV2Framework.java
index f984bb1..5dd4376 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/TestV2Framework.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestV2Framework.java
@@ -114,19 +114,19 @@ public class TestV2Framework extends SolrTestCaseJ4 {
     assertEquals("shard1", parts.get("shard"));
     assertEquals("replica1", parts.get("replica"));
 
-    SolrQueryResponse rsp = invoke(containerHandlers, "/collections/_introspect", GET, mockCC,
lookup);
+    SolrQueryResponse rsp = invoke(containerHandlers, "/collections/_introspect", GET, mockCC);
 
     assertConditions(rsp.getValues().asMap(2), Utils.makeMap(
         "/spec[0]/methods[0]", "POST",
         "/spec[0]/methods[1]", "GET"));
 
-    rsp = invoke(coreHandlers, "/collections/hello/schema/_introspect", GET, mockCC, lookup);
+    rsp = invoke(coreHandlers, "/collections/hello/schema/_introspect", GET, mockCC);
     assertConditions(rsp.getValues().asMap(2), Utils.makeMap(
         "/spec[0]/methods[0]", "POST",
         "/spec[0]/commands", NOT_NULL,
         "/spec[1]/methods[0]", "GET"));
 
-    rsp = invoke(coreHandlers, "/collections/hello", GET, mockCC, lookup);
+    rsp = invoke(coreHandlers, "/collections/hello", GET, mockCC);
     assertConditions(rsp.getValues().asMap(2), Utils.makeMap(
         "/availableSubPaths", NOT_NULL,
         "availableSubPaths /collections/hello/config/jmx", NOT_NULL,
@@ -136,12 +136,14 @@ public class TestV2Framework extends SolrTestCaseJ4 {
         "availableSubPaths /collections/hello/shards/{shard}/{replica}", NOT_NULL
     ));
 
+    rsp = invoke(coreHandlers,"/collections/hello/schema",SolrRequest.METHOD.POST, mockCC);
+
 
 
   }
 
   private SolrQueryResponse invoke(PluginBag<SolrRequestHandler> reqHandlers, String
path, SolrRequest.METHOD method,
-                                   CoreContainer mockCC, Lookup<String, Map2> lookup)
{
+                                   CoreContainer mockCC) {
     HashMap<String, String> parts = new HashMap<>();
     boolean containerHandlerLookup = mockCC.getRequestHandlers() == reqHandlers;
     String fullPath = path;
@@ -155,7 +157,7 @@ public class TestV2Framework extends SolrTestCaseJ4 {
 
     V2Api api = V2HttpCall.getApiInfo(reqHandlers, path, "GET", mockCC, prefix, fullPath,
parts);
     LocalSolrQueryRequest req = new LocalSolrQueryRequest(null, new MapSolrParams(new HashMap<>()));
-    V2RequestContext ctx = getV2RequestContext(lookup, path, method, null, mockCC, parts,
api, req);
+    V2RequestContext ctx = getV2RequestContext(reqHandlers.getApiBag().getSpecLookup() ,
path, method, null, mockCC, parts, api, req);
     api.call(ctx);
     return ctx.getResponse();
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/acf1a310/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java b/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java
index ca6f1fc..fd513ba 100644
--- a/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java
+++ b/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java
@@ -28,6 +28,7 @@ import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.schema.SimilarityFactory;
 import org.apache.solr.search.similarities.SchemaSimilarityFactory;
+import org.apache.solr.util.RESTfulServerProvider;
 import org.apache.solr.util.RestTestBase;
 import org.apache.solr.util.RestTestHarness;
 
@@ -59,6 +60,14 @@ public class TestBulkSchemaAPI extends RestTestBase {
 
     createJettyAndHarness(tmpSolrHome.getAbsolutePath(), "solrconfig-managed-schema.xml",
"schema-rest.xml",
         "/solr", true, null);
+    if (random().nextBoolean()) {
+      restTestHarness.setServerProvider(new RESTfulServerProvider() {
+        @Override
+        public String getBaseURL() {
+          return jetty.getBaseUrl().toString() + "/v2/cores/" + DEFAULT_TEST_CORENAME;
+        }
+      });
+    }
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/acf1a310/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
index 1fa5014..4ddbc8b 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
@@ -52,6 +52,14 @@ public class RestTestHarness extends BaseTestHarness implements Closeable
{
     return serverProvider.getBaseURL();
   }
 
+  public void setServerProvider(RESTfulServerProvider serverProvider) {
+    this.serverProvider = serverProvider;
+  }
+
+  public RESTfulServerProvider getServerProvider() {
+    return this.serverProvider;
+  }
+
   public String getAdminURL() {
     return getBaseURL().replace("/collection1", "");
   }


Mime
View raw message