You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by is...@apache.org on 2023/01/21 19:23:54 UTC
[solr] 02/03: Add a trivial validator for the new CoreAugmenter transformer (#1281)
This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit fc5e79790238634802bc268ffe4b89d47ae9f9d3
Author: Michael Gibney <mi...@michaelgibney.net>
AuthorDate: Mon Jan 9 12:10:20 2023 -0500
Add a trivial validator for the new CoreAugmenter transformer (#1281)
Followup on a2f3f7f33efd765cc6c608c78745d8b9c108b8df
See: #1276
---
.../apache/solr/cloud/TestRandomFlRTGCloud.java | 42 ++++++++++++++++++++++
1 file changed, 42 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 3950de3a43a..e77556936c7 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestRandomFlRTGCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestRandomFlRTGCloud.java
@@ -103,6 +103,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"),
//
@@ -1035,6 +1037,46 @@ 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 String wt) {
+ 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";