fabriziofortino commented on a change in pull request #524:
URL: https://github.com/apache/jackrabbit-oak/pull/524#discussion_r831289792
##########
File path:
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticFunctionIndexCommonTest.java
##########
@@ -16,42 +16,61 @@
*/
package org.apache.jackrabbit.oak.plugins.index.elastic;
+import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
+import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
+import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_PROPERTY_NAME;
+import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
+
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.oak.InitialContentHelper;
import org.apache.jackrabbit.oak.api.ContentRepository;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.index.FunctionIndexCommonTest;
+import
org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditor;
import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
import org.junit.ClassRule;
-import org.junit.Ignore;
-
-import java.util.Set;
-import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
-import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
-import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_PROPERTY_NAME;
-import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
-
-@Ignore
public class ElasticFunctionIndexCommonTest extends FunctionIndexCommonTest {
@ClassRule
- public static final ElasticConnectionRule elasticRule =
- new
ElasticConnectionRule(ElasticTestUtils.ELASTIC_CONNECTION_STRING);
+ public static final ElasticConnectionRule elasticRule = new
ElasticConnectionRule(
+ ElasticTestUtils.ELASTIC_CONNECTION_STRING);
public ElasticFunctionIndexCommonTest() {
indexOptions = new ElasticIndexOptions();
}
+ @Override
+ protected String getIndexProvider() {
+ return "elasticsearch:";
+ }
+
+ @Override
+ protected void postCommitHook() {
+ try {
+ TimeUnit.SECONDS.sleep(2);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
Review comment:
We should not use this approach. We were using something similar in the
past but tests were flaky.
As an alternative, I would remove the `postCommitHook` method and use
`TestUtils.assertEventually` in the tests (see `IndexSuggestionCommonTest` for
an example).
##########
File path:
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexDefinition.java
##########
@@ -18,21 +18,23 @@
*/
package org.apache.jackrabbit.oak.plugins.index.elastic;
-import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition;
-import org.apache.jackrabbit.oak.plugins.index.search.PropertyDefinition;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.jetbrains.annotations.NotNull;
+import static
org.apache.jackrabbit.oak.plugins.index.search.util.ConfigUtil.getOptionalValue;
+import static
org.apache.jackrabbit.oak.plugins.index.search.util.ConfigUtil.getOptionalValues;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import java.util.stream.StreamSupport;
-import static
org.apache.jackrabbit.oak.plugins.index.search.util.ConfigUtil.getOptionalValue;
-import static
org.apache.jackrabbit.oak.plugins.index.search.util.ConfigUtil.getOptionalValues;
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.plugins.index.search.FieldNames;
Review comment:
unused import
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]