You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2020/02/18 16:10:54 UTC

[lucene-solr] branch master updated (ce2959f -> 003303a)

This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from ce2959f  LUCENE-9211 Add compression for Binary doc value fields (#1234)
     new 5d32c04  SOLR-13965: StreamHandler class-level javadoc edits
     new f23def6  SOLR-13965: s/StreamHandler/GraphHandler fix GraphHandler.getDescription()
     new 003303a  SOLR-13041: Add hashCode for autoscaling.Condition to accompany the already present equals.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 solr/CHANGES.txt                                   |  3 +
 .../java/org/apache/solr/handler/GraphHandler.java |  2 +-
 .../org/apache/solr/handler/StreamHandler.java     |  4 +-
 .../client/solrj/cloud/autoscaling/Condition.java  |  5 ++
 .../solrj/cloud/autoscaling/ConditionTest.java     | 80 ++++++++++++++++++++++
 5 files changed, 91 insertions(+), 3 deletions(-)
 create mode 100644 solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/ConditionTest.java


[lucene-solr] 02/03: SOLR-13965: s/StreamHandler/GraphHandler fix GraphHandler.getDescription()

Posted by cp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit f23def6b721192f6cf6ebec037fbf0a1a4b0d33c
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Tue Feb 18 14:32:52 2020 +0000

    SOLR-13965: s/StreamHandler/GraphHandler fix GraphHandler.getDescription()
    
    (Eric Pugh via Christine Poerschke)
---
 solr/core/src/java/org/apache/solr/handler/GraphHandler.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
index 621a4db..a50855d 100644
--- a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
@@ -143,7 +143,7 @@ public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, P
   }
 
   public String getDescription() {
-    return "StreamHandler";
+    return "GraphHandler";
   }
 
   public String getSource() {


[lucene-solr] 03/03: SOLR-13041: Add hashCode for autoscaling.Condition to accompany the already present equals.

Posted by cp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 003303a9cc8e1d5471448b538b611984b5e669a7
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Tue Feb 18 14:47:44 2020 +0000

    SOLR-13041: Add hashCode for autoscaling.Condition to accompany the already present equals.
    
    (Zsolt Gyulavari via Christine Poerschke)
---
 solr/CHANGES.txt                                   |  3 +
 .../client/solrj/cloud/autoscaling/Condition.java  |  5 ++
 .../solrj/cloud/autoscaling/ConditionTest.java     | 80 ++++++++++++++++++++++
 3 files changed, 88 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5472bfe..c5b1446 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -156,6 +156,9 @@ Bug Fixes
 * SOLR-14058: Fix IndexOutOfBoundsException in PeerSync that can prevent nodes from recovering
   under certain circumstances. (yonik)
 
+* SOLR-13041: Add hashCode for autoscaling.Condition to accompany the already present equals.
+  (Zsolt Gyulavari via Christine Poerschke)
+
 Other Changes
 ---------------------
 
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Condition.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Condition.java
index 5b60ef0..dd59087 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Condition.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Condition.java
@@ -77,6 +77,11 @@ public class Condition implements MapWriter {
   }
 
   @Override
+  public int hashCode() {
+    return Objects.hash(name, val, op);
+  }
+
+  @Override
   public boolean equals(Object that) {
     if (that instanceof Condition) {
       Condition c = (Condition) that;
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/ConditionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/ConditionTest.java
new file mode 100644
index 0000000..2b455f1
--- /dev/null
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/ConditionTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.client.solrj.cloud.autoscaling;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ConditionTest {
+  @Test
+  public void testEqualsHashCode() {
+    assertHashMatchesEquals("equals should match hash (names are equal)",
+        new Condition("node", null, null, null, null),
+        new Condition("node", null, null, null, null));
+    assertHashMatchesEquals("equals should match hash (names aren't equal)",
+        new Condition("node", null, null, null, null),
+        new Condition("host", null, null, null, null));
+    assertHashMatchesEquals("equals should match hash (values are equal)",
+        new Condition("node", "localhost", null, null, null),
+        new Condition("node", "localhost", null, null, null));
+    assertHashMatchesEquals("equals should match hash (values aren't equal)",
+        new Condition("node", "localhost", null, null, null),
+        new Condition("node", "lucene.apache.org", null, null, null));
+    assertHashMatchesEquals("equals should match hash (operands are equal)",
+        new Condition("node", null, Operand.EQUAL, null, null),
+        new Condition("node", null, Operand.EQUAL, null, null));
+    assertHashMatchesEquals("equals should match hash (operands aren't equal)",
+        new Condition("node", null, Operand.EQUAL, null, null),
+        new Condition("node", null, Operand.NOT_EQUAL, null, null));
+
+    Condition condition = new Condition("host", "localhost", Operand.EQUAL, null, null);
+    assertHashMatchesEquals("equals should match hash when compared to self", condition, condition);
+    assertTrue("equals should be true when compared to self", condition.equals(condition));
+  }
+
+  @Test
+  public void testEqualsInvertible() {
+    assertEqualsInvertible("equals should be invertible (names are equal)",
+        new Condition("node", null, null, null, null),
+        new Condition("node", null, null, null, null));
+    assertEqualsInvertible("equals should be invertible (names aren't equal)",
+        new Condition("node", null, null, null, null),
+        new Condition("host", null, null, null, null));
+    assertEqualsInvertible("equals should be invertible (values are equal)",
+        new Condition("node", "localhost", null, null, null),
+        new Condition("node", "localhost", null, null, null));
+    assertEqualsInvertible("equals should be invertible (values aren't equal)",
+        new Condition("node", "localhost", null, null, null),
+        new Condition("node", "lucene.apache.org", null, null, null));
+    assertEqualsInvertible("equals should be invertible (operands are equal)",
+        new Condition("node", null, Operand.EQUAL, null, null),
+        new Condition("node", null, Operand.EQUAL, null, null));
+    assertEqualsInvertible("equals should be invertible (operands aren't equal)",
+        new Condition("node", null, Operand.EQUAL, null, null),
+        new Condition("node", null, Operand.NOT_EQUAL, null, null));
+  }
+
+  private void assertEqualsInvertible(String message, Condition a, Condition b) {
+    assertEquals(message, a != null && a.equals(b), b != null && b.equals(a));
+  }
+
+  private void assertHashMatchesEquals(String message, Condition a, Condition b) {
+    assertTrue(message, (a.hashCode() == b.hashCode()) || (!a.equals(b) && !b.equals(a)));
+  }
+}


[lucene-solr] 01/03: SOLR-13965: StreamHandler class-level javadoc edits

Posted by cp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 5d32c04096dfdbf0a0e9c3c5fd6f4a787ca153ea
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Tue Feb 18 14:31:44 2020 +0000

    SOLR-13965: StreamHandler class-level javadoc edits
    
    (Eric Pugh via Christine Poerschke)
---
 solr/core/src/java/org/apache/solr/handler/StreamHandler.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
index 41e0b8f..d2d8279 100644
--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
@@ -75,10 +75,10 @@ import static org.apache.solr.common.params.CommonParams.ID;
  * Solr Request Handler for streaming data.
  * </p>
  * <p>
- * It loads a default set of mappings via {@link org.apache.solr.handler.SolrDefaultStreamFactory}.
+ * It loads a Solr specific set of streaming expression functions via {@link org.apache.solr.handler.SolrDefaultStreamFactory}.
  * </p>
  * <p>
- * To add additional mappings, just define them as plugins in solrconfig.xml via
+ * To add additional functions, just define them as plugins in solrconfig.xml via
  * {@code
  * &lt;expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream" /&gt;
  * }