diff --git a/NOTICE b/NOTICE index 313c46e4e329833ef5b24cb514cbf17b0456f536..cbd4bf4a82a797ceb9a2f1bec0bd42363cd633ec 100644 --- a/NOTICE +++ b/NOTICE @@ -231,8 +231,6 @@ The following software have components provided under the terms of this license: - Doxia :: XDoc Module (from ) - Doxia :: XHTML Module (from ) - Elastic JNA Distribution (from https://github.com/java-native-access/jna) -- Elastic JNA Distribution (from https://github.com/java-native-access/jna) -- Elasticsearch: 5.0.0-alpha5 (from https://github.com/elastic/elasticsearch) - Elasticsearch: 5.0.0-alpha5 (from https://github.com/elastic/elasticsearch) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) - Google APIs Client Library for Java (from ) @@ -255,7 +253,6 @@ The following software have components provided under the terms of this license: - Guava: Google Core Libraries for Java (from https://github.com/google/guava.git) - Guava: Google Core Libraries for Java (from https://github.com/google/guava.git) - HPPC Collections (from http://labs.carrotsearch.com) -- HPPC Collections (from http://labs.carrotsearch.com) - Hibernate Validator Engine (from ) - IBM COS Java SDK for Amazon S3 (from https://github.com/ibm/ibm-cos-sdk-java) - IBM COS Java SDK for COS KMS (from https://github.com/ibm/ibm-cos-sdk-java) @@ -319,33 +316,18 @@ The following software have components provided under the terms of this license: - Logback Contrib :: JSON :: Core (from ) - Logback Contrib :: Jackson (from ) - Lucene Common Analyzers (from ) -- Lucene Common Analyzers (from ) -- Lucene Core (from ) - Lucene Core (from ) - Lucene Grouping (from ) -- Lucene Grouping (from ) -- Lucene Highlighter (from ) - Lucene Highlighter (from ) - Lucene Join (from ) -- Lucene Join (from ) -- Lucene Memory (from ) -- Lucene Memory (from ) - Lucene Memory (from ) - Lucene Memory (from ) - Lucene Miscellaneous (from ) -- Lucene Miscellaneous (from ) -- Lucene Queries (from ) - Lucene Queries (from ) - Lucene QueryParsers (from ) -- Lucene QueryParsers (from ) - Lucene Sandbox (from ) -- Lucene Sandbox (from ) -- Lucene Spatial (from ) -- Lucene Spatial 3D (from ) - Lucene Spatial 3D (from ) - Lucene Spatial Extras (from ) -- Lucene Spatial Extras (from ) -- Lucene Suggest (from ) - Lucene Suggest (from ) - MapStruct Core (from ) - Maven Artifact (from ) @@ -370,9 +352,9 @@ The following software have components provided under the terms of this license: - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java) +- Mockito (from http://www.mockito.org) - Mockito (from http://mockito.org) - Mockito (from http://mockito.org) -- Mockito (from http://www.mockito.org) - Mockito (from http://mockito.org) - Mojo's Maven plugin for Cobertura (from http://mojo.codehaus.org/cobertura-maven-plugin/) - Netty Reactive Streams HTTP support (from ) @@ -470,10 +452,8 @@ The following software have components provided under the terms of this license: - Xerces2-j (from https://xerces.apache.org/xerces2-j/) - aalto-xml (from ) - aggs-matrix-stats (from https://github.com/elastic/elasticsearch) -- aggs-matrix-stats (from https://github.com/elastic/elasticsearch) - aws-ssm-java-caching-client (from https://github.com/awslabs/aws-ssm-java-caching-client) - cli (from https://github.com/elastic/elasticsearch) -- cli (from https://github.com/elastic/elasticsearch) - com.google.api.grpc:grpc-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis) - com.google.api.grpc:proto-google-cloud-logging-v2 (from https://github.com/googleapis/googleapis) - com.google.api.grpc:proto-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis) @@ -481,10 +461,8 @@ The following software have components provided under the terms of this license: - com.google.api.grpc:proto-google-iam-v1 (from https://github.com/googleapis/googleapis) - commons-collections (from ) - compiler (from http://github.com/spullara/mustache.java) -- compiler (from http://github.com/spullara/mustache.java) - datastore-v1-proto-client (from ) - elasticsearch-core (from https://github.com/elastic/elasticsearch) -- elasticsearch-core (from https://github.com/elastic/elasticsearch) - elasticsearch-geo (from https://github.com/elastic/elasticsearch) - error-prone annotations (from ) - error-prone annotations (from ) @@ -519,7 +497,6 @@ The following software have components provided under the terms of this license: - jersey-spring4 (from ) - jose4j (from https://bitbucket.org/b_c/jose4j/) - lang-mustache (from https://github.com/elastic/elasticsearch) -- lang-mustache (from https://github.com/elastic/elasticsearch) - lettuce (from http://github.com/mp911de/lettuce/wiki) - mapper-extras (from https://github.com/elastic/elasticsearch) - micrometer-core (from https://github.com/micrometer-metrics/micrometer) @@ -527,7 +504,6 @@ The following software have components provided under the terms of this license: - org.xmlunit:xmlunit-core (from http://www.xmlunit.org/) - oro (from ) - parent-join (from https://github.com/elastic/elasticsearch) -- parent-join (from https://github.com/elastic/elasticsearch) - powermock-api-support (from ) - powermock-core (from http://www.powermock.org) - powermock-module-junit4 (from http://www.powermock.org) @@ -536,14 +512,10 @@ The following software have components provided under the terms of this license: - proto-google-cloud-datastore-v1 (from https://github.com/googleapis/api-client-staging) - proton-j (from ) - rank-eval (from https://github.com/elastic/elasticsearch) -- rank-eval (from https://github.com/elastic/elasticsearch) -- rest (from https://github.com/elastic/elasticsearch) - rest (from https://github.com/elastic/elasticsearch) - rest-high-level (from https://github.com/elastic/elasticsearch) -- rest-high-level (from https://github.com/elastic/elasticsearch) - rxjava (from https://github.com/ReactiveX/RxJava) - secure-sm (from https://github.com/elastic/elasticsearch) -- secure-sm (from https://github.com/elastic/elasticsearch) - spring-security-config (from http://spring.io/spring-security) - spring-security-core (from http://spring.io/spring-security) - spring-security-oauth2-client (from http://spring.io/spring-security) @@ -567,7 +539,6 @@ The following software have components provided under the terms of this license: - tomcat-embed-el (from http://tomcat.apache.org/) - tomcat-embed-websocket (from http://tomcat.apache.org/) - x-content (from https://github.com/elastic/elasticsearch) -- x-content (from https://github.com/elastic/elasticsearch) - xml-apis (from ) ======================================================================== @@ -581,7 +552,6 @@ The following software have components provided under the terms of this license: - GAX (Google Api eXtensions) (from https://github.com/googleapis) - Hamcrest Core (from http://hamcrest.org/) - Lucene Common Analyzers (from ) -- Lucene Common Analyzers (from ) - Lucene Core (from ) - Plexus :: Default Container (from ) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) @@ -615,11 +585,8 @@ The following software have components provided under the terms of this license: - JSch (from http://www.jcraft.com/jsch/) - JavaBeans Activation Framework API jar (from ) - Lucene Common Analyzers (from ) -- Lucene Common Analyzers (from ) -- Lucene Core (from ) - Lucene Core (from ) - Lucene Suggest (from ) -- Lucene Suggest (from ) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -840,7 +807,6 @@ The following software have components provided under the terms of this license: - Cobertura code coverage (from http://cobertura.sourceforge.net) - Commons Lang (from http://commons.apache.org/lang/) - Elastic JNA Distribution (from https://github.com/java-native-access/jna) -- Elastic JNA Distribution (from https://github.com/java-native-access/jna) - Java Native Access (from https://github.com/java-native-access/jna) - Java Native Access Platform (from https://github.com/java-native-access/jna) - Javassist (from http://www.javassist.org/) @@ -889,15 +855,12 @@ The following software have components provided under the terms of this license: - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Checker Qual (from https://checkerframework.org) - Checker Qual (from https://checkerframework.org) -- Elasticsearch: 5.0.0-alpha5 (from https://github.com/elastic/elasticsearch) - Extensions on Apache Proton-J library (from https://github.com/Azure/qpid-proton-j-extensions) - JOpt Simple (from http://pholser.github.io/jopt-simple) - JUL to SLF4J bridge (from http://www.slf4j.org) - Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Java JWT (from http://www.jwt.io) - Lucene Core (from ) -- Lucene Core (from ) -- Lucene Sandbox (from ) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -912,10 +875,10 @@ The following software have components provided under the terms of this license: - Microsoft Azure client library for KeyVault Secrets (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure common module for Storage (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure internal Avro module for Storage (from https://github.com/Azure/azure-sdk-for-java) +- Mockito (from http://www.mockito.org) - Mockito (from http://mockito.org) - Mockito (from http://mockito.org) - Mockito (from http://mockito.org) -- Mockito (from http://www.mockito.org) - Netty/Codec/HTTP (from ) - Netty/Common (from ) - Plexus :: Default Container (from ) diff --git a/provider/indexer-ibm/pom.xml b/provider/indexer-ibm/pom.xml index a8ef4cf4cb9bc3d439b114778adc2cad62fc4fc6..f0a0c5f9249d3faba1e8b92e25fd97aced2ff4e8 100644 --- a/provider/indexer-ibm/pom.xml +++ b/provider/indexer-ibm/pom.xml @@ -89,17 +89,14 @@ <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> - <version>6.6.2</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> - <version>6.6.2</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> - <version>6.6.2</version> </dependency> <!-- Test Dependencies --> diff --git a/provider/indexer-ibm/src/test/java/org/opengroup/osdu/indexer/ibm/service/IndexerMappingServiceTest.java b/provider/indexer-ibm/src/test/java/org/opengroup/osdu/indexer/ibm/service/IndexerMappingServiceTest.java index 7a6447711dda6b83ba8ba520c2480c45a276647f..d6982c113fc059e87626d2f931e4f2288f7fd3fd 100644 --- a/provider/indexer-ibm/src/test/java/org/opengroup/osdu/indexer/ibm/service/IndexerMappingServiceTest.java +++ b/provider/indexer-ibm/src/test/java/org/opengroup/osdu/indexer/ibm/service/IndexerMappingServiceTest.java @@ -1,12 +1,12 @@ /* Licensed Materials - Property of IBM */ /* (c) Copyright IBM Corp. 2020. All Rights Reserved.*/ - package org.opengroup.osdu.indexer.ibm.service; import org.apache.http.StatusLine; import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData; +import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.action.bulk.BulkItemResponse.Failure; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.*; @@ -106,8 +106,7 @@ public class IndexerMappingServiceTest { public void should_returnValidMapping_givenTrueMerge_createMappingTest() { try { doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); - + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); String mapping = this.sut.createMapping(this.restHighLevelClient, this.indexSchema, this.index, true); assertEquals(this.mappingValid, mapping); } catch (Exception e) { @@ -119,8 +118,7 @@ public class IndexerMappingServiceTest { public void should_returnValidMapping_givenExistType_createMappingTest() { try { doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); - + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); IndexerMappingServiceImpl indexerMappingServiceLocal = PowerMockito.spy(new IndexerMappingServiceImpl()); doReturn(false).when(indexerMappingServiceLocal).isTypeExist(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any()); String mapping = this.sut.createMapping(this.restHighLevelClient, this.indexSchema, this.index, true); @@ -129,7 +127,7 @@ public class IndexerMappingServiceTest { fail("Should not throw this exception" + e.getMessage()); } } - + @Test public void should_update_indices_field_with_keyword_when_valid_indices() throws Exception { try { @@ -137,33 +135,33 @@ public class IndexerMappingServiceTest { indices.add("indices 1"); GetFieldMappingsResponse getFieldMappingsResponse = mock(GetFieldMappingsResponse.class); doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); + when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(GetFieldMappingsRequest.class), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); builder.field("any field", new HashMap()); builder.endObject(); BytesReference bytesReference = BytesReference.bytes(builder); - FieldMappingMetaData mappingMetaData = new FieldMappingMetaData(index, bytesReference); - Map<String, FieldMappingMetaData> mapBuilder = new HashMap<>(); + GetFieldMappingsResponse.FieldMappingMetadata mappingMetaData = new GetFieldMappingsResponse.FieldMappingMetadata(index, bytesReference); + Map<String, GetFieldMappingsResponse.FieldMappingMetadata> mapBuilder = new HashMap<>(); mapBuilder.put("data.any field", mappingMetaData); - Map<String, Map<String, FieldMappingMetaData>> mappingBuilder = new HashMap<>(); + Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>> mappingBuilder = new HashMap<>(); mappingBuilder.put("any index 1", mapBuilder); mappingBuilder.put("any index 2", mapBuilder); - Map<String, Map<String, Map<String, FieldMappingMetaData>>> mapping = new HashMap<>(); + Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>>> mapping = new HashMap<>(); mapping.put("indices 1", mappingBuilder); when(getFieldMappingsResponse.mappings()).thenReturn(mapping); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); BulkByScrollResponse response = mock(BulkByScrollResponse.class); doReturn(response).when(this.restHighLevelClient).updateByQuery(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); when(response.getBulkFailures()).thenReturn(new ArrayList<Failure>()); when(elasticClientHandler.createRestClient()).thenReturn(restHighLevelClient); - + this.sut.updateIndexMappingForIndicesOfSameType( indices,"any field"); } catch (Exception e) { fail("Should not throw this exception" + e.getMessage()); } } - + @Test(expected = AppException.class) public void should_throw_exception_if_someIndex_is_invalid_andWeIndexfield_with_keyword() throws Exception { try { @@ -171,28 +169,28 @@ public class IndexerMappingServiceTest { indices.add("invalid 1"); GetFieldMappingsResponse getFieldMappingsResponse = mock(GetFieldMappingsResponse.class); doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); + when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(GetFieldMappingsRequest.class), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); builder.field("any field", new HashMap()); builder.endObject(); BytesReference bytesReference = BytesReference.bytes(builder); - FieldMappingMetaData mappingMetaData = new FieldMappingMetaData(index, bytesReference); - Map<String, FieldMappingMetaData> mapBuilder = new HashMap<>(); + GetFieldMappingsResponse.FieldMappingMetadata mappingMetaData = new GetFieldMappingsResponse.FieldMappingMetadata(index, bytesReference); + Map<String, GetFieldMappingsResponse.FieldMappingMetadata> mapBuilder = new HashMap<>(); mapBuilder.put("data.any field", mappingMetaData); - Map<String, Map<String, FieldMappingMetaData>> mappingBuilder = new HashMap<>(); + Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>> mappingBuilder = new HashMap<>(); mappingBuilder.put("any index 1", mapBuilder); mappingBuilder.put("any index 2", mapBuilder); - Map<String, Map<String, Map<String, FieldMappingMetaData>>> mapping = new HashMap<>(); + Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>>> mapping = new HashMap<>(); mapping.put("indices 1", mappingBuilder); when(getFieldMappingsResponse.mappings()).thenReturn(mapping); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); BulkByScrollResponse response = mock(BulkByScrollResponse.class); doReturn(response).when(this.restHighLevelClient).updateByQuery(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); when(response.getBulkFailures()).thenReturn(new ArrayList<Failure>()); when(elasticClientHandler.createRestClient()).thenReturn(restHighLevelClient); - - this.sut.updateIndexMappingForIndicesOfSameType(indices,"any field"); + + this.sut.updateIndexMappingForIndicesOfSameType(indices,"any field"); } catch (Exception e) { throw e; } @@ -205,22 +203,22 @@ public class IndexerMappingServiceTest { indices.add("indices 1"); GetFieldMappingsResponse getFieldMappingsResponse = mock(GetFieldMappingsResponse.class); doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); + when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(GetFieldMappingsRequest.class), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); builder.field("any field", new HashMap()); builder.endObject(); BytesReference bytesReference = BytesReference.bytes(builder); - FieldMappingMetaData mappingMetaData = new FieldMappingMetaData(index, bytesReference); - Map<String, FieldMappingMetaData> mapBuilder = new HashMap<>(); + GetFieldMappingsResponse.FieldMappingMetadata mappingMetaData = new GetFieldMappingsResponse.FieldMappingMetadata(index, bytesReference); + Map<String, GetFieldMappingsResponse.FieldMappingMetadata> mapBuilder = new HashMap<>(); mapBuilder.put("data.any field", mappingMetaData); - Map<String, Map<String, FieldMappingMetaData>> mappingBuilder = new HashMap<>(); + Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>> mappingBuilder = new HashMap<>(); mappingBuilder.put("any index 1", mapBuilder); mappingBuilder.put("any index 2", mapBuilder); - Map<String, Map<String, Map<String, FieldMappingMetaData>>> mapping = new HashMap<>(); + Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>>> mapping = new HashMap<>(); mapping.put("indices 1", mappingBuilder); when(getFieldMappingsResponse.mappings()).thenReturn(mapping); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); BulkByScrollResponse response = mock(BulkByScrollResponse.class); doReturn(response).when(this.restHighLevelClient).updateByQuery(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); when(response.getBulkFailures()).thenReturn(new ArrayList<Failure>()); @@ -240,22 +238,22 @@ public class IndexerMappingServiceTest { indices.add("indices Invalid"); GetFieldMappingsResponse getFieldMappingsResponse = mock(GetFieldMappingsResponse.class); doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(), ArgumentMatchers.any())).thenThrow(new ElasticsearchException("")); + when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(GetFieldMappingsRequest.class), ArgumentMatchers.any())).thenThrow(new ElasticsearchException("")); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); builder.field("any field", new HashMap()); builder.endObject(); BytesReference bytesReference = BytesReference.bytes(builder); - FieldMappingMetaData mappingMetaData = new FieldMappingMetaData(index, bytesReference); - Map<String, FieldMappingMetaData> mapBuilder = new HashMap<>(); + GetFieldMappingsResponse.FieldMappingMetadata mappingMetaData = new GetFieldMappingsResponse.FieldMappingMetadata(index, bytesReference); + Map<String, GetFieldMappingsResponse.FieldMappingMetadata> mapBuilder = new HashMap<>(); mapBuilder.put("data.any field", mappingMetaData); - Map<String, Map<String, FieldMappingMetaData>> mappingBuilder = new HashMap<>(); + Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>> mappingBuilder = new HashMap<>(); mappingBuilder.put("any index 1", mapBuilder); mappingBuilder.put("any index 2", mapBuilder); - Map<String, Map<String, Map<String, FieldMappingMetaData>>> mapping = new HashMap<>(); + Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>>> mapping = new HashMap<>(); mapping.put("indices 1", mappingBuilder); when(getFieldMappingsResponse.mappings()).thenReturn(mapping); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); BulkByScrollResponse response = mock(BulkByScrollResponse.class); doReturn(response).when(this.restHighLevelClient).updateByQuery(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); when(response.getBulkFailures()).thenReturn(new ArrayList<Failure>()); @@ -274,26 +272,26 @@ public class IndexerMappingServiceTest { indices.add("indices Invalid"); GetFieldMappingsResponse getFieldMappingsResponse = mock(GetFieldMappingsResponse.class); doReturn(this.indicesClient).when(this.restHighLevelClient).indices(); - when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); + when(this.indicesClient.getFieldMapping(ArgumentMatchers.any(GetFieldMappingsRequest.class), ArgumentMatchers.any())).thenReturn(getFieldMappingsResponse); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); builder.field("any field", new HashMap()); builder.endObject(); BytesReference bytesReference = BytesReference.bytes(builder); - FieldMappingMetaData mappingMetaData = new FieldMappingMetaData(index, bytesReference); - Map<String, FieldMappingMetaData> mapBuilder = new HashMap<>(); + GetFieldMappingsResponse.FieldMappingMetadata mappingMetaData = new GetFieldMappingsResponse.FieldMappingMetadata(index, bytesReference); + Map<String, GetFieldMappingsResponse.FieldMappingMetadata> mapBuilder = new HashMap<>(); mapBuilder.put("data.any field", mappingMetaData); - Map<String, Map<String, FieldMappingMetaData>> mappingBuilder = new HashMap<>(); + Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>> mappingBuilder = new HashMap<>(); mappingBuilder.put("any index 1", mapBuilder); mappingBuilder.put("any index 2", mapBuilder); - Map<String, Map<String, Map<String, FieldMappingMetaData>>> mapping = new HashMap<>(); + Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetadata>>> mapping = new HashMap<>(); mapping.put("indices 1", mappingBuilder); when(getFieldMappingsResponse.mappings()).thenReturn(mapping); - doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); + doReturn(mappingResponse).when(this.indicesClient).putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class)); BulkByScrollResponse response = mock(BulkByScrollResponse.class); doReturn(response).when(this.restHighLevelClient).updateByQuery(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class)); when(response.getBulkFailures()).thenReturn(new ArrayList<Failure>()); - when(this.indicesClient.putMapping(ArgumentMatchers.any(), ArgumentMatchers.any(RequestOptions.class))).thenThrow(new ElasticsearchException("")); + when(this.indicesClient.putMapping(ArgumentMatchers.any(PutMappingRequest.class), ArgumentMatchers.any(RequestOptions.class))).thenThrow(new ElasticsearchException("")); when(elasticClientHandler.createRestClient()).thenReturn(restHighLevelClient); this.sut.updateIndexMappingForIndicesOfSameType(indices,"any field"); } catch (AppException e) { @@ -303,3 +301,4 @@ public class IndexerMappingServiceTest { } } } + diff --git a/testing/indexer-test-ibm/pom.xml b/testing/indexer-test-ibm/pom.xml index 1d0ec6267671426190b4f425241b0993597c5f75..f85b8b8ad1a2d3216ac246e5fe580596d3cf6e35 100644 --- a/testing/indexer-test-ibm/pom.xml +++ b/testing/indexer-test-ibm/pom.xml @@ -114,17 +114,17 @@ <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> - <version>6.6.2</version> + <version>7.8.1</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> - <version>6.6.2</version> + <version>7.8.1</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> - <version>6.6.2</version> + <version>7.8.1</version> </dependency> <!--Logging-->