diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c386904656ad91c1d7ec65838c70b87ef0a84e5f..9cd10d68a2926e36f601e1619a42b588f2558423 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ variables: OSDU_SECURITY_HTTPS_CERTIFICATE_TRUST: 'true' OSDU_GCP_STORAGE_RECORDS_BATCH_SIZE: 20 OSDU_GCP_DATA_GROUP: osdu - OSDU_GCP_ENV_VARS: AUTHORIZE_API=$OSDU_GCP_ENTITLEMENTS_URL,GOOGLE_CLOUD_PROJECT=$OSDU_GCP_PROJECT,REDIS_SEARCH_HOST=$REDIS_SEARCH_HOST,REDIS_GROUP_HOST=$REDIS_GROUP_HOST,SECURITY_HTTPS_CERTIFICATE_TRUST=$OSDU_SECURITY_HTTPS_CERTIFICATE_TRUST,INDEXER_HOST=$OSDU_GCP_INDEXER_HOST,STORAGE_QUERY_RECORD_HOST=$OSDU_GCP_STORAGE_QUERY_RECORD_HOST,STORAGE_SCHEMA_HOST=$OSDU_GCP_STORAGE_SCHEMA_HOST,STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=$OSDU_GCP_STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST,STORAGE_HOSTNAME=$OSDU_GCP_STORAGE_HOSTNAME,STORAGE_RECORDS_BATCH_SIZE=$OSDU_GCP_STORAGE_RECORDS_BATCH_SIZE,INDEXER_QUEUE_HOST=$OSDU_GCP_INDEXER_QUEUE_HOST,LEGALTAG_API=$OSDU_GCP_LEGALTAG_API,CRS_API=$OSDU_GCP_CRS_API,DATA_GROUP=$OSDU_GCP_DATA_GROUP,GOOGLE_AUDIENCES=$GOOGLE_AUDIENCES,INDEXER_QUE_SERVICE_MAIL=$OSDU_GCP_SERVICE_ACCOUNT --vpc-connector=$OSDU_GCP_VPC_CONNECTOR + OSDU_GCP_ENV_VARS: AUTHORIZE_API=$OSDU_GCP_ENTITLEMENTS_URL,GOOGLE_CLOUD_PROJECT=$OSDU_GCP_PROJECT,REDIS_SEARCH_HOST=$REDIS_SEARCH_HOST,REDIS_GROUP_HOST=$REDIS_GROUP_HOST,SECURITY_HTTPS_CERTIFICATE_TRUST=$OSDU_SECURITY_HTTPS_CERTIFICATE_TRUST,INDEXER_HOST=$OSDU_GCP_INDEXER_HOST,STORAGE_QUERY_RECORD_HOST=$OSDU_GCP_STORAGE_QUERY_RECORD_HOST,STORAGE_SCHEMA_HOST=$OSDU_GCP_STORAGE_SCHEMA_HOST,STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=$OSDU_GCP_STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST,STORAGE_HOSTNAME=$OSDU_GCP_STORAGE_HOSTNAME,STORAGE_RECORDS_BATCH_SIZE=$OSDU_GCP_STORAGE_RECORDS_BATCH_SIZE,INDEXER_QUEUE_HOST=$OSDU_GCP_INDEXER_QUEUE_HOST,LEGALTAG_API=$OSDU_GCP_LEGALTAG_API,CRS_API=$OSDU_GCP_CRS_API,DATA_GROUP=$OSDU_GCP_DATA_GROUP,GOOGLE_AUDIENCES=$GOOGLE_AUDIENCE,INDEXER_QUE_SERVICE_MAIL=$OSDU_GCP_SERVICE_ACCOUNT --vpc-connector=$OSDU_GCP_VPC_CONNECTOR IBM_BUILD_SUBDIR: provider/indexer-ibm IBM_INT_TEST_SUBDIR: testing/indexer-test-ibm @@ -38,7 +38,7 @@ include: file: "build/maven.yml" - project: "osdu/platform/ci-cd-pipelines" - file: "scanners/fossa.yml" + file: "scanners/fossa-maven.yml" - project: "osdu/platform/ci-cd-pipelines" file: "scanners/gitlab-ultimate.yml" diff --git a/NOTICE b/NOTICE index f9d9ba8fd6e152be1d5fd8a1a1153554c2cfac24..5a99a8143ef989906b8ce9ad5b15c77340c18191 100644 --- a/NOTICE +++ b/NOTICE @@ -561,7 +561,6 @@ The following software have components provided under the terms of this license: - Stax2 API (from http://github.com/FasterXML/stax2-api) - jersey-ext-bean-validation (from ) - jersey-spring4 (from ) -- oro (from ) ======================================================================== BSD-3-Clause @@ -625,12 +624,6 @@ CC-BY-2.5 The following software have components provided under the terms of this license: - Checker Qual (from https://checkerframework.org) - -======================================================================== -CC-BY-3.0 -======================================================================== -The following software have components provided under the terms of this license: - - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) ======================================================================== @@ -665,7 +658,6 @@ The following software have components provided under the terms of this license: - HK2 core module (from ) - HK2 module of HK2 itself (from ) - JavaBeans Activation Framework API jar (from ) -- JavaBeans(TM) Activation Framework (from http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp) - Run Level Service (from ) - ServiceLocator Default Implementation (from git://java.net/hk2~git/hk2-locator) - Servlet Specification 2.5 API (from ) @@ -690,6 +682,7 @@ The following software have components provided under the terms of this license: - Java Architecture For XML Binding (from ) - Java Servlet API (from http://servlet-spec.java.net) - JavaBeans Activation Framework (from ) +- JavaBeans(TM) Activation Framework (from http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp) - JavaMail API (from ) - OSGi resource locator (from ) - jersey-ext-bean-validation (from ) @@ -834,7 +827,6 @@ LGPL-2.1-or-later ======================================================================== The following software have components provided under the terms of this license: -- 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/) - SnakeYAML (from http://www.snakeyaml.org) @@ -944,7 +936,6 @@ The following software have components provided under the terms of this license: - jersey-core-common (from ) - jersey-core-server (from git://java.net/jersey~code/jersey-server) - jts-core (from ) -- xml-apis (from ) ======================================================================== SISSL-1.2 @@ -1002,8 +993,10 @@ The following software have components provided under the terms of this license: - Spring Security JWT Library (from http://github.com/spring-projects/spring-security-oauth) - Spring Security JWT Library (from http://github.com/spring-projects/spring-security-oauth) - Spring Web (from https://github.com/spring-projects/spring-framework) +- StAX API (from http://stax.codehaus.org/) - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) - reactive-streams (from http://www.reactive-streams.org/) +- xml-apis (from ) ======================================================================== unknown diff --git a/devops/azure/chart/templates/deployment.yaml b/devops/azure/chart/templates/deployment.yaml index 80c501bb5f79ba14b04b8ef2e83b7bf7f8ea3863..375ba066c83008e54ad81de7e984dfb06fa5af04 100644 --- a/devops/azure/chart/templates/deployment.yaml +++ b/devops/azure/chart/templates/deployment.yaml @@ -68,21 +68,6 @@ spec: configMapKeyRef: name: osdu-svc-properties key: ENV_KEYVAULT - - name: AZURE_CLIENT_ID - valueFrom: - secretKeyRef: - name: active-directory - key: principal-clientid - - name: AZURE_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: active-directory - key: principal-clientpassword - - name: AZURE_TENANT_ID - valueFrom: - secretKeyRef: - name: active-directory - key: tenantid - name: aad_client_id valueFrom: secretKeyRef: diff --git a/indexer-core/src/test/java/org/opengroup/osdu/indexer/util/ElasticClientHandlerTest.java b/indexer-core/src/test/java/org/opengroup/osdu/indexer/util/ElasticClientHandlerTest.java index e5782165553a1efd1a5a39a3ffa6891696371993..effda48aaef31616b6f583844fdadbd31276747a 100644 --- a/indexer-core/src/test/java/org/opengroup/osdu/indexer/util/ElasticClientHandlerTest.java +++ b/indexer-core/src/test/java/org/opengroup/osdu/indexer/util/ElasticClientHandlerTest.java @@ -19,29 +19,30 @@ import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestHighLevelClient; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; +import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.model.indexer.IElasticSettingService; import org.opengroup.osdu.core.common.model.search.ClusterSettings; import org.opengroup.osdu.core.common.model.search.DeploymentEnvironment; import org.opengroup.osdu.indexer.config.IndexerConfigurationProperties; import org.powermock.core.classloader.annotations.PrepareForTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.powermock.modules.junit4.PowerMockRunner; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; +import static org.powermock.api.mockito.PowerMockito.mockStatic; -@Ignore -@RunWith(SpringRunner.class) -@PrepareForTest({RestClientBuilder.class, RestClient.class, RestHighLevelClient.class}) +@RunWith(PowerMockRunner.class) +@PrepareForTest({RestClient.class, RestHighLevelClient.class}) public class ElasticClientHandlerTest { + private static final boolean SECURITY_HTTPS_CERTIFICATE_TRUST = false; + @Mock private IndexerConfigurationProperties configurationProperties; @Mock @@ -62,7 +63,9 @@ public class ElasticClientHandlerTest { public void setup() { initMocks(this); -// mockStatic(RestClient.class); + mockStatic(RestClient.class); + + elasticClientHandler.setSecurityHttpsCertificateTrust(SECURITY_HTTPS_CERTIFICATE_TRUST); } @Test @@ -70,7 +73,7 @@ public class ElasticClientHandlerTest { ClusterSettings clusterSettings = new ClusterSettings("H", 1, "U:P"); when(configurationProperties.getDeploymentEnvironment()).thenReturn(DeploymentEnvironment.CLOUD); when(elasticSettingService.getElasticClusterInformation()).thenReturn(clusterSettings); - when(RestClient.builder(new HttpHost("H", 1, "https"))).thenReturn(builder); + when(RestClient.builder(new HttpHost("H", 1, "https"))).thenAnswer(invocation -> builder); when(builder.setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(5000).setSocketTimeout(60000))).thenReturn(builder); when(builder.build()).thenReturn(restClient); @@ -84,7 +87,7 @@ public class ElasticClientHandlerTest { ClusterSettings clusterSettings = new ClusterSettings("H", 1, "U:P"); when(configurationProperties.getDeploymentEnvironment()).thenReturn(DeploymentEnvironment.CLOUD); when(elasticSettingService.getElasticClusterInformation()).thenReturn(clusterSettings); - when(RestClient.builder(new HttpHost("H", 1, "https"))).thenReturn(builder); + when(RestClient.builder(new HttpHost("H", 1, "https"))).thenAnswer(invocation -> builder); when(builder.build()).thenReturn(null); this.elasticClientHandler.createRestClient(); @@ -94,7 +97,7 @@ public class ElasticClientHandlerTest { public void failed_createRestClientForSaaS_when_getcluster_info_throws_exception() { when(configurationProperties.getDeploymentEnvironment()).thenReturn(DeploymentEnvironment.CLOUD); when(elasticSettingService.getElasticClusterInformation()).thenThrow(new AppException(1, "", "")); - when(RestClient.builder(new HttpHost("H", 1, "https"))).thenReturn(builder); + when(RestClient.builder(new HttpHost("H", 1, "https"))).thenAnswer(invocation -> builder); this.elasticClientHandler.createRestClient(); } diff --git a/pom.xml b/pom.xml index 0bf363b5630407611fdd47070d23aa7fcde57d83..8d6c8317da1c8ef7ddad77b2d371afa6cff7774d 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> - <version>2.1.16.RELEASE</version> + <version>2.1.18.RELEASE</version> <relativePath/> </parent> @@ -30,6 +30,7 @@ <elasticsearch.version>6.8.1</elasticsearch.version> <netty.version>4.1.51.Final</netty.version> <reactor-netty.version>0.8.20.RELEASE</reactor-netty.version> + <woodstox-core.version>6.2.3</woodstox-core.version> <!-- <maven.compiler.target>1.8</maven.compiler.target>--> <!-- <maven.compiler.source>1.8</maven.compiler.source>--> <!-- <maven.war.plugin>2.6</maven.war.plugin>--> @@ -112,6 +113,11 @@ <artifactId>reactor-netty</artifactId> <version>${reactor-netty.version}</version> </dependency> + <dependency> + <groupId>com.fasterxml.woodstox</groupId> + <artifactId>woodstox-core</artifactId> + <version>${woodstox-core.version}</version> + </dependency> </dependencies> </dependencyManagement>