You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2023/10/25 06:21:53 UTC

[lucene-solr] branch branch_8_11 updated: Fixed test for CoreAugmenterFactory

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

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


The following commit(s) were added to refs/heads/branch_8_11 by this push:
     new 5a55340f6e6 Fixed test for CoreAugmenterFactory
5a55340f6e6 is described below

commit 5a55340f6e6b035112de954a6157251daaa2320d
Author: noblepaul <no...@gmail.com>
AuthorDate: Wed Oct 25 09:30:06 2023 +1100

    Fixed test for CoreAugmenterFactory
---
 .../apache/solr/cloud/TestRandomFlRTGCloud.java    | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRandomFlRTGCloud.java b/solr/core/src/test/org/apache/solr/cloud/TestRandomFlRTGCloud.java
index b20f3dfd14d..b0d114ad501 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestRandomFlRTGCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestRandomFlRTGCloud.java
@@ -89,6 +89,8 @@ public class TestRandomFlRTGCloud extends SolrCloudTestCase {
       new DocIdValidator("my_docid_alias"),
       new ShardValidator(),
       new ShardValidator("my_shard_alias"),
+      new CoreValidator(),
+      new CoreValidator("my_core_alias"),
       new ValueAugmenterValidator(42),
       new ValueAugmenterValidator(1976, "val_alias"),
       //
@@ -676,6 +678,45 @@ public class TestRandomFlRTGCloud extends SolrCloudTestCase {
     }
   }
 
+  /** Trivial validator of CoreAugmenterFactory */
+  private static class CoreValidator implements FlValidator {
+    private static final String NAME = "core";
+    private static final String USAGE = "[" + NAME + "]";
+    private final String resultKey;
+
+    public CoreValidator(final String resultKey) {
+      this.resultKey = resultKey;
+    }
+
+    public CoreValidator() {
+      this(USAGE);
+    }
+
+    @Override
+    public String getDefaultTransformerFactoryName() {
+      return NAME;
+    }
+
+    @Override
+    public String getFlParam() {
+      return USAGE.equals(resultKey) ? resultKey : resultKey + ":" + USAGE;
+    }
+
+    @Override
+    public Collection<String> assertRTGResults(
+        final Collection<FlValidator> validators,
+        final SolrInputDocument expected,
+        final SolrDocument actual) {
+      final Object value = actual.getFirstValue(resultKey);
+      assertNotNull(getFlParam() + " => no value in actual doc", value);
+      assertTrue(USAGE + " must be a String: " + value, value instanceof String);
+
+      // trivial sanity check
+      assertFalse(USAGE + " => blank string", value.toString().trim().isEmpty());
+      return Collections.singleton(resultKey);
+    }
+  }
+
   /** Trivial validator of ValueAugmenter */
   private static class ValueAugmenterValidator implements FlValidator {
     private static final String NAME = "value";