You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/03/09 17:00:13 UTC
[02/50] [abbrv] lucene-solr git commit: SOLR-8736: schema GET
operations on fields, dynamicFields, fieldTypes,
copyField are reimplemented as a part of the bulk API with less details. The
tests and write implementations are removed
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c281ab/solr/core/src/test/org/apache/solr/rest/schema/TestRemoveLastDynamicCopyField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestRemoveLastDynamicCopyField.java b/solr/core/src/test/org/apache/solr/rest/schema/TestRemoveLastDynamicCopyField.java
deleted file mode 100644
index 4b4ddd3..0000000
--- a/solr/core/src/test/org/apache/solr/rest/schema/TestRemoveLastDynamicCopyField.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.rest.schema;
-
-import java.io.File;
-import java.io.StringReader;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.solr.util.RestTestBase;
-import org.junit.After;
-import org.junit.Before;
-import org.noggit.JSONParser;
-import org.noggit.ObjectBuilder;
-
-public class TestRemoveLastDynamicCopyField extends RestTestBase {
- private static File tmpSolrHome;
-
- @Before
- public void before() throws Exception {
- tmpSolrHome = createTempDir().toFile();
- FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
-
- System.setProperty("managed.schema.mutable", "true");
- System.setProperty("enable.update.log", "false");
-
- createJettyAndHarness(tmpSolrHome.getAbsolutePath(), "solrconfig-managed-schema.xml", "schema-single-dynamic-copy-field.xml",
- "/solr", true, null);
- }
-
- @After
- public void after() throws Exception {
- if (jetty != null) {
- jetty.stop();
- jetty = null;
- }
- client = null;
- if (restTestHarness != null) {
- restTestHarness.close();
- }
- restTestHarness = null;
- }
-
- public void test() throws Exception {
- List copyFields = getCopyFields();
- assertEquals("There is more than one copyField directive", 1, copyFields.size());
- assertEquals("The copyField source is not '*'", "*", ((Map)copyFields.get(0)).get("source"));
- assertEquals("The copyField dest is not 'text'", "text", ((Map)copyFields.get(0)).get("dest"));
-
- String payload = "{ 'delete-copy-field': { 'source': '*', 'dest': 'text' } }";
-
- String response = restTestHarness.post("/schema?wt=json", json(payload));
- Map map = (Map)ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
- assertNull(response, map.get("errors"));
-
- assertEquals(0, getCopyFields().size());
- }
-
- private List getCopyFields() throws Exception {
- String response = restTestHarness.query("/schema?wt=json");
- System.err.println(response);
- Map map = (Map)ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
- return (List)((Map)map.get("schema")).get("copyFields");
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c281ab/solr/core/src/test/org/apache/solr/rest/schema/TestSchemaSimilarityResource.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestSchemaSimilarityResource.java b/solr/core/src/test/org/apache/solr/rest/schema/TestSchemaSimilarityResource.java
index 6b7be71..2016677 100644
--- a/solr/core/src/test/org/apache/solr/rest/schema/TestSchemaSimilarityResource.java
+++ b/solr/core/src/test/org/apache/solr/rest/schema/TestSchemaSimilarityResource.java
@@ -24,7 +24,6 @@ public class TestSchemaSimilarityResource extends SolrRestletTestBase {
* NOTE: schema used by parent class doesn't define a global sim, so we get the implicit default
* which causes the FQN of the class to be returned
*
- * @see TestClassNameShortening#testShortenedGlobalSimilarityStaysShortened
*/
@Test
public void testGetSchemaSimilarity() throws Exception {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c281ab/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
index 242e5b5..be8c394 100644
--- a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
+++ b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
@@ -140,7 +140,7 @@ public class TestManagedStopFilterFactory extends RestTestBase {
"/response/lst[@name='error']/int[@name='code'] = '404'");
// add the new field
- assertJPut("/schema/fields/" + newFieldName, json("{'type':'managed_en'}"),
+ assertJPost("/schema/fields", "{add-field : { name :managed_en_field, type : managed_en}}",
"/responseHeader/status==0");
// make sure the new field exists now
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c281ab/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymFilterFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymFilterFactory.java b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymFilterFactory.java
index 9afaf6f..26fcde1 100644
--- a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymFilterFactory.java
+++ b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymFilterFactory.java
@@ -90,8 +90,8 @@ public class TestManagedSynonymFilterFactory extends RestTestBase {
JSONUtil.toJSON(syns),
"/responseHeader/status==0");
- assertJQ(endpoint,
- "/synonymMappings/managedMap/happy==['cheerful','glad','joyful']");
+ assertJQ(endpoint,
+ "/synonymMappings/managedMap/happy==['cheerful','glad','joyful']");
// request to a specific mapping
assertJQ(endpoint+"/happy",
@@ -146,7 +146,7 @@ public class TestManagedSynonymFilterFactory extends RestTestBase {
"/response/lst[@name='error']/int[@name='code'] = '404'");
// add the new field
- assertJPut("/schema/fields/" + newFieldName, json("{'type':'managed_en'}"),
+ assertJPost("/schema", "{ add-field : { name: managed_en_field, type : managed_en}}",
"/responseHeader/status==0");
// make sure the new field exists now
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c281ab/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java b/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
index 3d0d120..0993ba1 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaConcurrent.java
@@ -37,11 +37,12 @@ import org.apache.solr.util.RestTestHarness;
import org.apache.zookeeper.data.Stat;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.restlet.ext.servlet.ServerServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
+@Ignore
public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String SUCCESS_XPATH = "/response/lst[@name='responseHeader']/int[@name='status'][.='0']";
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c281ab/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
index b723abf..72051b1 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
@@ -575,10 +575,6 @@ public class SchemaTest extends RestTestBase {
assertThat("solr.TextField", is(equalTo(newFieldTypeRepresentation.getAttributes().get("class"))));
assertThat(analyzerDefinition.getTokenizer().get("class"),
is(equalTo(newFieldTypeRepresentation.getAnalyzer().getTokenizer().get("class"))));
- assertTrue(newFieldTypeRepresentation.getFields().size() == 1);
- assertTrue(newFieldTypeRepresentation.getFields().contains(fieldName));
- assertTrue(newFieldTypeRepresentation.getDynamicFields().size() == 1);
- assertTrue(newFieldTypeRepresentation.getDynamicFields().contains(dynamicFieldName));
}
@Test