Skip to content

Commit

Permalink
LPD-24555 portal-search-elasticsearch7-impl: Remove type usages from …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
gustavolimav authored and brianchandotcom committed May 20, 2024
1 parent 083cf77 commit 00806bf
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.liferay.portal.search.elasticsearch7.internal.connection.ElasticsearchConnectionFixture;
import com.liferay.portal.search.elasticsearch7.internal.index.FieldMappingAssert;
import com.liferay.portal.search.elasticsearch7.internal.index.constants.LiferayTypeMappingsConstants;
import com.liferay.portal.search.elasticsearch7.internal.search.engine.ElasticsearchSearchEngineFixture;
import com.liferay.portal.search.test.util.background.task.BaseReindexSingleIndexerBackgroundTaskExecutorTestCase;
import com.liferay.portal.test.rule.LiferayUnitTestRule;
Expand Down Expand Up @@ -53,8 +52,7 @@ protected void assertFieldType(String fieldName, String fieldType)
_elasticsearchConnectionFixture.getRestHighLevelClient();

FieldMappingAssert.assertType(
fieldType, fieldName,
LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE, getIndexName(),
fieldType, fieldName, getIndexName(),
restHighLevelClient.indices());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
public class SingleFieldFixture {

public SingleFieldFixture(
RestHighLevelClient restHighLevelClient, IndexName indexName,
String type) {
RestHighLevelClient restHighLevelClient, IndexName indexName) {

_restHighLevelClient = restHighLevelClient;
_type = type;

_index = indexName.getName();
}
Expand Down Expand Up @@ -73,6 +71,5 @@ private QueryBuilder _createQueryBuilder(String text) {
private final String _index;
private QueryBuilderFactory _queryBuilderFactory;
private final RestHighLevelClient _restHighLevelClient;
private final String _type;

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.liferay.portal.search.elasticsearch7.internal.connection.ElasticsearchFixture;
import com.liferay.portal.search.elasticsearch7.internal.connection.IndexName;
import com.liferay.portal.search.elasticsearch7.internal.document.SingleFieldFixture;
import com.liferay.portal.search.elasticsearch7.internal.index.constants.LiferayTypeMappingsConstants;
import com.liferay.portal.search.elasticsearch7.internal.query.QueryBuilderFactories;
import com.liferay.portal.search.elasticsearch7.internal.util.ResourceUtil;
import com.liferay.portal.search.spi.index.listener.CompanyIndexListener;
Expand Down Expand Up @@ -122,8 +121,7 @@ public void setUp() throws Exception {

_singleFieldFixture = new SingleFieldFixture(
_elasticsearchFixture.getRestHighLevelClient(),
new IndexName(_companyIndexFactoryFixture.getIndexName()),
LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE);
new IndexName(_companyIndexFactoryFixture.getIndexName()));

_singleFieldFixture.setQueryBuilderFactory(QueryBuilderFactories.MATCH);
}
Expand Down Expand Up @@ -574,8 +572,7 @@ protected void assertAnalyzer(String field, String analyzer)
_elasticsearchFixture.getRestHighLevelClient();

FieldMappingAssert.assertAnalyzer(
analyzer, field, LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE,
_companyIndexFactoryFixture.getIndexName(),
analyzer, field, _companyIndexFactoryFixture.getIndexName(),
restHighLevelClient.indices());
}

Expand All @@ -584,8 +581,7 @@ protected void assertType(String field, String type) throws Exception {
_elasticsearchFixture.getRestHighLevelClient();

FieldMappingAssert.assertType(
type, field, LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE,
_companyIndexFactoryFixture.getIndexName(),
type, field, _companyIndexFactoryFixture.getIndexName(),
restHighLevelClient.indices());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
public class FieldMappingAssert {

public static void assertAnalyzer(
String expectedValue, String field, String type, String index,
String expectedValue, String field, String index,
IndicesClient indicesClient)
throws Exception {

assertFieldMappingMetadata(
expectedValue, "analyzer", field, type, index, indicesClient);
expectedValue, "analyzer", field, index, indicesClient);
}

public static void assertFieldMappingMetadata(
String expectedValue, String key, String field, String type,
String index, IndicesClient indicesClient)
String expectedValue, String key, String field, String index,
IndicesClient indicesClient)
throws Exception {

IdempotentRetryAssert.retryAssert(
Expand All @@ -47,12 +47,12 @@ public static void assertFieldMappingMetadata(
}

public static void assertType(
String expectedValue, String field, String type, String index,
String expectedValue, String field, String index,
IndicesClient indicesClient)
throws Exception {

assertFieldMappingMetadata(
expectedValue, "type", field, type, index, indicesClient);
expectedValue, "type", field, index, indicesClient);
}

private static void _assertFieldMappingMetadata(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.liferay.portal.search.elasticsearch7.internal.connection.ElasticsearchFixture;
import com.liferay.portal.search.elasticsearch7.internal.connection.IndexCreator;
import com.liferay.portal.search.elasticsearch7.internal.connection.IndexName;
import com.liferay.portal.search.elasticsearch7.internal.index.constants.LiferayTypeMappingsConstants;

import java.io.IOException;

Expand Down Expand Up @@ -43,16 +42,15 @@ public void assertAnalyzer(String field, String analyzer) throws Exception {
RestHighLevelClient restHighLevelClient = getRestHighLevelClient();

FieldMappingAssert.assertAnalyzer(
analyzer, field, LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE,
_indexName.getName(), restHighLevelClient.indices());
analyzer, field, _indexName.getName(),
restHighLevelClient.indices());
}

public void assertType(String field, String type) throws Exception {
RestHighLevelClient restHighLevelClient = getRestHighLevelClient();

FieldMappingAssert.assertType(
type, field, LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE,
_indexName.getName(), restHighLevelClient.indices());
type, field, _indexName.getName(), restHighLevelClient.indices());
}

public RestHighLevelClient getRestHighLevelClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.liferay.portal.search.elasticsearch7.internal.connection.IndexName;
import com.liferay.portal.search.elasticsearch7.internal.document.SingleFieldFixture;
import com.liferay.portal.search.elasticsearch7.internal.index.constants.LiferayTypeMappingsConstants;
import com.liferay.portal.search.elasticsearch7.internal.query.QueryBuilderFactories;
import com.liferay.portal.test.rule.LiferayUnitTestRule;

Expand Down Expand Up @@ -36,8 +35,7 @@ public void setUp() throws Exception {
_liferayIndexFixture.setUp();

_singleFieldFixture = new SingleFieldFixture(
_liferayIndexFixture.getRestHighLevelClient(), indexName,
LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE);
_liferayIndexFixture.getRestHighLevelClient(), indexName);

_singleFieldFixture.setField(_PREFIX + "_ja");
_singleFieldFixture.setQueryBuilderFactory(QueryBuilderFactories.MATCH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.liferay.portal.search.elasticsearch7.internal.connection.IndexName;
import com.liferay.portal.search.elasticsearch7.internal.document.SingleFieldFixture;
import com.liferay.portal.search.elasticsearch7.internal.index.constants.LiferayTypeMappingsConstants;
import com.liferay.portal.search.elasticsearch7.internal.query.QueryBuilderFactories;
import com.liferay.portal.test.rule.LiferayUnitTestRule;

Expand Down Expand Up @@ -36,8 +35,7 @@ public void setUp() throws Exception {
_liferayIndexFixture.setUp();

_singleFieldFixture = new SingleFieldFixture(
_liferayIndexFixture.getRestHighLevelClient(), indexName,
LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE);
_liferayIndexFixture.getRestHighLevelClient(), indexName);

_singleFieldFixture.setQueryBuilderFactory(
QueryBuilderFactories.MATCH_PHRASE_PREFIX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.liferay.portal.search.elasticsearch7.internal.connection.ElasticsearchFixture;
import com.liferay.portal.search.elasticsearch7.internal.connection.IndexName;
import com.liferay.portal.search.elasticsearch7.internal.document.SingleFieldFixture;
import com.liferay.portal.search.elasticsearch7.internal.index.constants.LiferayTypeMappingsConstants;
import com.liferay.portal.search.elasticsearch7.internal.query.QueryBuilderFactories;
import com.liferay.portal.search.elasticsearch7.internal.query.SearchAssert;
import com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter.ElasticsearchSearchEngineAdapterImpl;
Expand Down Expand Up @@ -56,8 +55,7 @@ public static void setUpClass() throws Exception {

_singleFieldFixture = new SingleFieldFixture(
_elasticsearchFixture.getRestHighLevelClient(),
new IndexName(_INDEX_NAME),
LiferayTypeMappingsConstants.LIFERAY_DOCUMENT_TYPE);
new IndexName(_INDEX_NAME));

_singleFieldFixture.setField(_FIELD_NAME);
_singleFieldFixture.setQueryBuilderFactory(QueryBuilderFactories.MATCH);
Expand Down

0 comments on commit 00806bf

Please sign in to comment.