diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f03a7d4989795cac0acbcbbb43dd28911d1e05bd..46503d4175c9ea0920459e8f299edccdf4dbc52f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,13 +14,14 @@ variables: GCP_DOMAIN: cloud.slb-ds.com GCP_STORAGE_URL: https://osdu-indexer-dot-opendes.appspot.com/api/storage/v2/ - OSDU_GCP_BUILD_SUBDIR: provider/indexer-gcp - OSDU_GCP_INT_TEST_SUBDIR: testing/indexer-test-gcp OSDU_GCP_APPLICATION_NAME: os-indexer - OSDU_GCP_PROJECT: nice-etching-277309 - OSDU_GCP_TENANT_NAME: osdu - OSDU_GCP_STORAGE_SCHEMA_HOST: https://os-storage-dot-nice-etching-277309.uc.r.appspot.com/api/storage/v2/schemas + OSDU_GCP_SERVICE: indexer + OSDU_GCP_VENDOR: gcp + OSDU_GCP_SERVICE_ACCOUNT: osdu-gcp-sa@nice-etching-277309.iam.gserviceaccount.com 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 IBM_BUILD_SUBDIR: provider/indexer-ibm IBM_INT_TEST_SUBDIR: testing/indexer-test-ibm @@ -42,22 +43,22 @@ include: - project: "osdu/platform/ci-cd-pipelines" file: "scanners/gitlab-ultimate.yml" - - project: "osdu/platform/ci-cd-pipelines" - file: "cloud-providers/aws.yml" + # - project: "osdu/platform/ci-cd-pipelines" + # file: "cloud-providers/aws.yml" - - project: "osdu/platform/ci-cd-pipelines" - file: "cloud-providers/azure.yml" + # - project: "osdu/platform/ci-cd-pipelines" + # file: "cloud-providers/azure.yml" - - project: "osdu/platform/ci-cd-pipelines" - file: "cloud-providers/ibm.yml" + # - project: "osdu/platform/ci-cd-pipelines" + # file: "cloud-providers/ibm.yml" - project: "osdu/platform/ci-cd-pipelines" file: "publishing/pages.yml" - project: 'osdu/platform/ci-cd-pipelines' - ref: "master" - file: 'cloud-providers/osdu-gcp.yml' + ref: "osdu-gcp-add-vars-for-indexer" + file: 'cloud-providers/osdu-gcp-cloudrun.yml' -aws-test-java: - tags: ['aws-internal-test'] +# aws-test-java: + # tags: ['aws-internal-test'] diff --git a/.mvn/community-maven.settings.xml b/.mvn/community-maven.settings.xml index 3af866cf08df445892d0239db6d6d35235a153df..6fee192c6fb9947ee1fdf03dcf8ef5796d8a5f7f 100644 --- a/.mvn/community-maven.settings.xml +++ b/.mvn/community-maven.settings.xml @@ -7,14 +7,20 @@ <activeByDefault>true</activeByDefault> </activation> <properties> - <gitlab-server>community-maven-via-job-token</gitlab-server> + <repo.releases.id>community-maven-repo</repo.releases.id> + <publish.snapshots.id>community-maven-via-job-token</publish.snapshots.id> + <publish.releases.id>community-maven-via-job-token</publish.releases.id> + + <repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url> + <publish.snapshots.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.snapshots.url> + <publish.releases.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.releases.url> </properties> </profile> <profile> <!-- This profile uses a personal token to authenticate, which is useful for local or manual runs. The - presence of the COMMUNITY_MAVEN_TOKEN variable triggers this and overrides the CI Token - based authentication --> + presence of the COMMUNITY_MAVEN_TOKEN variable triggers this and overrides the CI Token + based authentication --> <id>GitLab-Authenticate-With-Private-Token</id> <activation> <property> @@ -22,7 +28,13 @@ </property> </activation> <properties> - <gitlab-server>community-maven-via-private-token</gitlab-server> + <repo.releases.id>community-maven-repo</repo.releases.id> + <publish.snapshots.id>community-maven-via-private-token</publish.snapshots.id> + <publish.releases.id>community-maven-via-private-token</publish.releases.id> + + <repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url> + <publish.snapshots.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.snapshots.url> + <publish.releases.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.releases.url> </properties> </profile> </profiles> @@ -62,4 +74,5 @@ </configuration> </server> </servers> + </settings> diff --git a/NOTICE b/NOTICE index f525dead152a65cf15c0ea5685eb2ceae718b2a1..9974b06fd9f30361f97b6f192f2bad38c2bb90ab 100644 --- a/NOTICE +++ b/NOTICE @@ -166,17 +166,13 @@ The following software have components provided under the terms of this license: - Apache Commons BeanUtils (from http://commons.apache.org/proper/commons-beanutils/) - Apache Commons CLI (from http://commons.apache.org/proper/commons-cli/) - Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/) -- Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/) -- Apache Commons Collections (from http://commons.apache.org/proper/commons-collections/) - Apache Commons Lang (from http://commons.apache.org/proper/commons-lang/) - Apache Commons Logging (from http://commons.apache.org/proper/commons-logging/) -- Apache Commons Logging (from http://commons.apache.org/proper/commons-logging/) -- Apache Commons Text (from http://commons.apache.org/proper/commons-text/) -- Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/) - Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/) - Apache Geronimo JMS Spec 2.0 (from http://geronimo.apache.org/maven/${siteId}/${version}) - Apache HttpAsyncClient (from http://hc.apache.org/httpcomponents-asyncclient) - Apache HttpClient (from http://hc.apache.org/httpcomponents-client) +- Apache HttpClient Cache (from http://hc.apache.org/httpcomponents-client) - Apache HttpCore (from http://hc.apache.org/httpcomponents-core-ga) - Apache HttpCore NIO (from http://hc.apache.org/httpcomponents-core-ga) - Apache Log4j API (from ) @@ -198,6 +194,8 @@ The following software have components provided under the terms of this license: - Asynchronous Http Client (from ) - Asynchronous Http Client Netty Utils (from ) - AutoValue (from ) +- Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) +- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) - Bean Validation API (from http://beanvalidation.org) - Byte Buddy (without dependencies) (from ) - Byte Buddy Java agent (from ) @@ -206,8 +204,6 @@ The following software have components provided under the terms of this license: - CloudWatch Metrics for AWS Java SDK (from https://aws.amazon.com/sdkforjava) - Cobertura code coverage (from http://cobertura.sourceforge.net) - Commons Digester (from http://commons.apache.org/digester/) -- Commons Digester (from http://commons.apache.org/digester/) -- Commons IO (from http://commons.apache.org/io/) - Commons IO (from http://commons.apache.org/io/) - Commons Lang (from http://commons.apache.org/lang/) - Converter: Jackson (from ) @@ -222,6 +218,7 @@ The following software have components provided under the terms of this license: - Doxia :: XHTML Module (from ) - 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 ) - Google App Engine extensions to the Google HTTP Client Library for Java. (from ) @@ -238,13 +235,19 @@ The following software have components provided under the terms of this license: - Google OAuth Client Library for Java (from ) - Gson (from https://github.com/google/gson) - Gson (from https://github.com/google/gson) +- Gson (from https://github.com/google/gson) - Guava InternalFutureFailureAccess and InternalFutures (from ) - Guava ListenableFuture only (from ) - 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) - 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) +- IBM COS SDK For Java (from https://github.com/ibm/ibm-cos-sdk-java) +- IBM COS SDK for Java - Core (from https://github.com/ibm/ibm-cos-sdk-java) - Identity and Access Management (IAM) API v1-rev247-1.23.0 (from ) +- IntelliJ IDEA Annotations (from http://www.jetbrains.org) - J2ObjC Annotations (from https://github.com/google/j2objc/) - J2ObjC Annotations (from https://github.com/google/j2objc/) - JBoss Logging 3 (from http://www.jboss.org) @@ -260,42 +263,72 @@ The following software have components provided under the terms of this license: - Jackson (from http://jackson.codehaus.org) - Jackson 2 extensions to the Google HTTP Client Library for Java. (from https://github.com/google/google-http-java-client.git/google-http-client-jackson2) - Jackson dataformat: CBOR (from http://github.com/FasterXML/jackson-dataformats-binary) +- Jackson dataformat: CBOR (from http://github.com/FasterXML/jackson-dataformats-binary) +- Jackson datatype: JSR310 (from http://wiki.fasterxml.com/JacksonModuleJSR310) - Jackson datatype: JSR310 (from http://wiki.fasterxml.com/JacksonModuleJSR310) - Jackson extensions to the Google HTTP Client Library for Java. (from ) - Jackson-annotations (from http://github.com/FasterXML/jackson) +- Jackson-annotations (from http://github.com/FasterXML/jackson) - Jackson-core (from https://github.com/FasterXML/jackson-core) - Jackson-dataformat-Smile (from http://github.com/FasterXML/jackson-dataformat-smile) +- Jackson-dataformat-Smile (from http://github.com/FasterXML/jackson-dataformat-smile) - Jackson-dataformat-XML (from http://wiki.fasterxml.com/JacksonExtensionXmlDataBinding) - Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson) +- Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson) - Jackson-datatype-Joda (from http://wiki.fasterxml.com/JacksonModuleJoda) - Jackson-datatype-jdk8 (from ) +- Jackson-datatype-jdk8 (from ) +- Jackson-module-Afterburner (from http://wiki.fasterxml.com/JacksonHome) +- Jackson-module-JAXB-annotations (from http://wiki.fasterxml.com/JacksonJAXBAnnotations) - Jackson-module-JAXB-annotations (from http://wiki.fasterxml.com/JacksonJAXBAnnotations) - Jackson-module-parameter-names (from ) +- Jackson-module-parameter-names (from ) +- Jakarta Bean Validation API (from https://beanvalidation.org) - Java Libraries for Amazon Simple WorkFlow (from https://aws.amazon.com/sdkforjava) - Java Native Access (from https://github.com/java-native-access/jna) - Java Native Access Platform (from https://github.com/java-native-access/jna) - Java Servlet API (from http://servlet-spec.java.net) -- Java UUID Generator (from http://wiki.fasterxml.com/JugHome) - Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/) - Jetty Server (from ) - Jetty Utilities (from ) - Joda-Time (from http://www.joda.org/joda-time/) - Json Path (from https://github.com/jayway/JsonPath) +- KeePassJava2 :: All (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2) +- KeePassJava2 :: DOM (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-dom) +- KeePassJava2 :: JAXB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-jaxb) +- KeePassJava2 :: KDB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdb) +- KeePassJava2 :: KDBX (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdbx) +- KeePassJava2 :: Simple (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-simple) - 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 (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 ) @@ -319,6 +352,7 @@ The following software have components provided under the terms of this license: - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - 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://mockito.org) - Mockito (from http://www.mockito.org) - Mockito (from http://mockito.org) @@ -327,7 +361,6 @@ The following software have components provided under the terms of this license: - Netty Reactive Streams Implementation (from ) - Netty/Buffer (from http://netty.io/) - Netty/Codec (from ) -- Netty/Codec/DNS (from ) - Netty/Codec/HTTP (from ) - Netty/Codec/HTTP2 (from ) - Netty/Codec/Socks (from ) @@ -335,11 +368,11 @@ The following software have components provided under the terms of this license: - Netty/Handler (from ) - Netty/Handler/Proxy (from ) - Netty/Resolver (from ) -- Netty/Resolver/DNS (from ) - Netty/TomcatNative [BoringSSL - Static] (from ) - Netty/Transport (from http://netty.io/) - Netty/Transport/Native/Unix/Common (from ) - Nimbus JOSE+JWT (from https://bitbucket.org/connect2id/nimbus-jose-jwt) +- Nimbus JOSE+JWT (from https://bitbucket.org/connect2id/nimbus-jose-jwt) - Nimbus LangTag (from https://bitbucket.org/connect2id/nimbus-language-tags) - Non-Blocking Reactive Foundation for the JVM (from https://github.com/reactor/reactor) - OAuth 2.0 SDK with OpenID Connect extensions (from https://bitbucket.org/connect2id/oauth-2.0-sdk-with-openid-connect-extensions) @@ -351,12 +384,12 @@ The following software have components provided under the terms of this license: - OkHttp URLConnection (from ) - OkHttp URLConnection (from ) - Okio (from ) -- Okio (from ) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) +- PWDB :: Database (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/database) - Plexus :: Default Container (from ) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) - Plexus Default Interactivity Handler (from ) @@ -403,6 +436,7 @@ The following software have components provided under the terms of this license: - Spring Plugin - Core (from ) - Spring Plugin - Metadata Extension (from ) - 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 TestContext Framework (from https://github.com/spring-projects/spring-framework) - Spring Transaction (from https://github.com/spring-projects/spring-framework) - Spring Web (from https://github.com/spring-projects/spring-framework) @@ -412,7 +446,10 @@ The following software have components provided under the terms of this license: - T-Digest (from https://github.com/tdunning/t-digest) - Woodstox (from https://github.com/FasterXML/woodstox) - 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) +- 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) @@ -423,6 +460,7 @@ The following software have components provided under the terms of this license: - 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) - error-prone annotations (from ) - error-prone annotations (from ) - io.grpc:grpc-alts (from https://github.com/grpc/grpc-java) @@ -436,7 +474,7 @@ The following software have components provided under the terms of this license: - io.grpc:grpc-protobuf-lite (from https://github.com/grpc/grpc-java) - io.grpc:grpc-stub (from https://github.com/grpc/grpc-java) - ion-java (from https://github.com/amznlabs/ion-java/) -- jackson-databind (from http://github.com/FasterXML/jackson) +- ion-java (from https://github.com/amznlabs/ion-java/) - jackson-databind (from http://github.com/FasterXML/jackson) - java-cloudant (from https://cloudant.com) - java-cloudant (from https://cloudant.com) @@ -456,13 +494,14 @@ 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) - micrometer-core (from https://github.com/micrometer-metrics/micrometer) - micrometer-registry-azure-monitor (from https://github.com/micrometer-metrics/micrometer) -- minio (from https://github.com/minio/minio-java) - 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) @@ -470,12 +509,14 @@ The following software have components provided under the terms of this license: - powermock-reflect (from ) - proto-google-cloud-datastore-v1 (from https://github.com/googleapis/api-client-staging) - proton-j (from ) -- 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) -- 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) @@ -497,10 +538,10 @@ The following software have components provided under the terms of this license: - swagger-models (from ) - tomcat-annotations-api (from http://tomcat.apache.org/) - tomcat-embed-core (from http://tomcat.apache.org/) -- tomcat-embed-core (from http://tomcat.apache.org/) - 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 ) ======================================================================== @@ -514,6 +555,7 @@ 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 ) - Plexus :: Default Container (from ) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) - StAX (from http://stax.codehaus.org/) @@ -536,7 +578,6 @@ The following software have components provided under the terms of this license: - ASM Util (from ) - ASM library repackaged as OSGi bundle (from ) - Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/) -- Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/) - GAX (Google Api eXtensions) (from https://github.com/googleapis) - GAX (Google Api eXtensions) (from https://github.com/googleapis) - GAX (Google Api eXtensions) (from https://github.com/googleapis) @@ -546,9 +587,13 @@ The following software have components provided under the terms of this license: - Hamcrest library (from ) - JDOM (from http://www.jdom.org) - 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) @@ -565,6 +610,7 @@ The following software have components provided under the terms of this license: - Stax2 API (from http://github.com/FasterXML/stax2-api) - ThreeTen backport (from https://www.threeten.org/threetenbp) - classworlds (from http://classworlds.codehaus.org/) +- jakarta.xml.bind-api (from ) - jaxen (from http://jaxen.codehaus.org/) - jersey-container-servlet (from git://java.net/jersey~code/project/jersey-container-servlet) - jersey-container-servlet-core (from git://java.net/jersey~code/project/jersey-container-servlet-core) @@ -586,7 +632,6 @@ CC-BY-3.0 ======================================================================== The following software have components provided under the terms of this license: -- "Java Concurrency in Practice" book annotations (from http://jcip.net/) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) ======================================================================== @@ -651,7 +696,6 @@ The following software have components provided under the terms of this license: - jersey-ext-bean-validation (from ) - jersey-spring4 (from ) - tomcat-embed-core (from http://tomcat.apache.org/) -- tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== CPL-1.0 @@ -717,7 +761,6 @@ The following software have components provided under the terms of this license: - jersey-media-json-jackson (from git://java.net/jersey~code/project/jersey-media-json-jackson) - jersey-spring4 (from ) - tomcat-embed-core (from http://tomcat.apache.org/) -- tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== GPL-2.0-or-later @@ -756,7 +799,6 @@ The following software have components provided under the terms of this license: - jersey-media-json-jackson (from git://java.net/jersey~code/project/jersey-media-json-jackson) - jersey-spring4 (from ) - tomcat-embed-core (from http://tomcat.apache.org/) -- tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== GPL-3.0-only @@ -766,16 +808,8 @@ The following software have components provided under the terms of this license: - OSGi resource locator (from ) - Project Lombok (from https://projectlombok.org) - Project Lombok (from https://projectlombok.org) -- SnakeYAML (from http://www.snakeyaml.org) - javax.ws.rs-api (from http://jax-rs-spec.java.net) -======================================================================== -JSON -======================================================================== -The following software have components provided under the terms of this license: - -- JSON in Java (from https://github.com/douglascrockford/JSON-java) - ======================================================================== LGPL-2.1-only ======================================================================== @@ -806,7 +840,6 @@ The following software have components provided under the terms of this license: - Java Native Access Platform (from https://github.com/java-native-access/jna) - Javassist (from http://www.javassist.org/) - SnakeYAML (from http://www.snakeyaml.org) -- SpotBugs Annotations (from https://spotbugs.github.io/) ======================================================================== LGPL-3.0-only @@ -824,12 +857,11 @@ The following software have components provided under the terms of this license: - AWS Java SDK for AWS Lambda (from https://aws.amazon.com/sdkforjava) - Animal Sniffer Annotations (from ) - Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) -- Azure Cosmos DB Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) - Azure Java Client Authentication Library for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Azure Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) - Azure Spring Boot AutoConfigure (from https://github.com/Microsoft/azure-spring-boot) -- Azure Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) +- Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Checker Qual (from https://checkerframework.org) - Checker Qual (from https://checkerframework.org) @@ -840,6 +872,8 @@ The following software have components provided under the terms of this license: - 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 ) - 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) @@ -849,12 +883,12 @@ The following software have components provided under the terms of this license: - Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK annotations (from https://github.com/Microsoft/java-api-annotations) - Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (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) - Microsoft Azure SDK for Service Bus (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure client library for Identity (from https://github.com/Azure/azure-sdk-for-java) - 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://mockito.org) - Mockito (from http://mockito.org) - Mockito (from http://www.mockito.org) @@ -866,11 +900,12 @@ The following software have components provided under the terms of this license: - Project Lombok (from https://projectlombok.org) - Project Lombok (from https://projectlombok.org) - SLF4J API Module (from http://www.slf4j.org) -- Spring Data for Azure Cosmos DB SQL API (from https://github.com/Microsoft/spring-data-cosmosdb) +- Spongy Castle (from http://rtyley.github.io/spongycastle/) +- Spring Data for Azure Cosmos DB SQL API (from https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos) - adal4j (from https://github.com/AzureAD/azure-activedirectory-library-for-java) -- azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/) - micrometer-core (from https://github.com/micrometer-metrics/micrometer) - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) +- msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java) - spring-security-core (from http://spring.io/spring-security) ======================================================================== @@ -890,6 +925,14 @@ The following software have components provided under the terms of this license: - Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/) +======================================================================== +PHP-3.01 +======================================================================== +The following software have components provided under the terms of this license: + +- JavaBeans Activation Framework API jar (from ) +- jakarta.xml.bind-api (from ) + ======================================================================== Public-Domain ======================================================================== @@ -899,6 +942,7 @@ The following software have components provided under the terms of this license: - JTidy (from http://jtidy.sourceforge.net) - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) +- Spongy Castle (from http://rtyley.github.io/spongycastle/) - jersey-core-common (from ) - jersey-core-server (from git://java.net/jersey~code/jersey-server) - jts-core (from ) @@ -944,6 +988,8 @@ The following software have components provided under the terms of this license: - AWS SDK for Java - Models (from https://aws.amazon.com/sdkforjava) - Asynchronous Http Client (from ) - Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs (from http://www.bouncycastle.org/java.html) +- Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs (from http://www.bouncycastle.org/java.html) +- Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - 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) @@ -952,12 +998,13 @@ The following software have components provided under the terms of this license: - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (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) - Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java) - Project Lombok (from https://projectlombok.org) - Project Lombok (from https://projectlombok.org) - 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) +- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) - reactive-streams (from http://www.reactive-streams.org/) ======================================================================== @@ -965,11 +1012,16 @@ unknown ======================================================================== The following software have components provided under the terms of this license: +- Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs (from http://www.bouncycastle.org/java.html) - Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs (from http://www.bouncycastle.org/java.html) - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) +- Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Byte Buddy (without dependencies) (from ) +- JavaBeans Activation Framework API jar (from ) - Servlet Specification 2.5 API (from ) +- Spongy Castle (from http://rtyley.github.io/spongycastle/) - System Rules (from http://stefanbirkner.github.io/system-rules/) +- jakarta.xml.bind-api (from ) - jaxen (from http://jaxen.codehaus.org/) - jersey-container-servlet (from git://java.net/jersey~code/project/jersey-container-servlet) - jersey-container-servlet-core (from git://java.net/jersey~code/project/jersey-container-servlet-core) diff --git a/devops/azure/chart/templates/deployment.yaml b/devops/azure/chart/templates/deployment.yaml index 8dc8c231355238606a10c6a076dc6223ec60f16d..27e69a708dbf24e1470833772af3bb65155ca8ea 100644 --- a/devops/azure/chart/templates/deployment.yaml +++ b/devops/azure/chart/templates/deployment.yaml @@ -41,6 +41,11 @@ spec: imagePullPolicy: Always ports: - containerPort: 80 + resources: + requests: + cpu: "100m" + limits: + cpu: "500m" readinessProbe: httpGet: path: /api/indexer/v2/swagger-ui.html @@ -88,6 +93,11 @@ spec: secretKeyRef: name: central-logging key: appinsights + - name: REDIS_DATABASE + valueFrom: + configMapKeyRef: + name: redis-configmap + key: indexer-service - name: cosmosdb_database value: osdu-db - name: servicebus_topic_name diff --git a/devops/azure/chart/templates/hpa.yaml b/devops/azure/chart/templates/hpa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d9d00bfc65e3df192ca241337772c937dbc1ff9e --- /dev/null +++ b/devops/azure/chart/templates/hpa.yaml @@ -0,0 +1,34 @@ +# Source: indexer-service/templates/hpa.yaml +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Chart.Name }} + namespace: osdu +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Chart.Name }} + minReplicas: {{ .Values.global.replicaCount }} + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 75 diff --git a/indexer-core/pom.xml b/indexer-core/pom.xml index 93252e1e089aaa7d508792ef4a4162720403f1d7..9242903c9118122c639d169c8ac4c5c62fdd9140 100644 --- a/indexer-core/pom.xml +++ b/indexer-core/pom.xml @@ -6,6 +6,7 @@ <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> <version>1.0.4-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>indexer-core</artifactId> @@ -197,7 +198,6 @@ <scope>test</scope> </dependency> - <!-- swagger dependencies --> <dependency> <groupId>io.springfox</groupId> @@ -212,23 +212,6 @@ </dependencies> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> <build> <defaultGoal>test</defaultGoal> <plugins> diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/swagger/SwaggerDocumentationConfig.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/swagger/SwaggerDocumentationConfig.java index 84e4f6b6339212a0a1aca25fa2f17ba111920564..a969e816ea23f08d0f9c1dcba30ebb3ff35318c5 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/swagger/SwaggerDocumentationConfig.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/swagger/SwaggerDocumentationConfig.java @@ -1,5 +1,6 @@ package org.opengroup.osdu.indexer.swagger; +import org.opengroup.osdu.core.common.model.http.DpsHeaders; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ParameterBuilder; @@ -29,7 +30,7 @@ public class SwaggerDocumentationConfig { public Docket api() { ParameterBuilder builder = new ParameterBuilder(); List<Parameter> parameters = new ArrayList<>(); - builder.name("slb-data-partition-id") + builder.name(DpsHeaders.DATA_PARTITION_ID) .description("tenant") .defaultValue("common") .modelRef(new ModelRef("string")) @@ -48,7 +49,7 @@ public class SwaggerDocumentationConfig { return new Docket(DocumentationType.SWAGGER_2) .globalOperationParameters(parameters) .select() - .apis(RequestHandlerSelectors.basePackage("com.slb.storage.api")) + .apis(RequestHandlerSelectors.basePackage("org.opengroup.osdu.indexer.api")) .build() .securityContexts(Collections.singletonList(securityContext())) .securitySchemes(Collections.singletonList(apiKey())); diff --git a/pom.xml b/pom.xml index f666516546b5041cf58913e262477f6a8ec40b94..c666a18e9ee25733866cbef13487413c3e6763f5 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.16.RELEASE</version> - <relativePath/> <!-- lookup parent from repository --> + <relativePath/> </parent> <groupId>org.opengroup.osdu.indexer</groupId> @@ -48,24 +48,6 @@ </license> </licenses> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> - <dependencyManagement> <dependencies> <dependency> @@ -150,4 +132,42 @@ <module>provider/indexer-ibm</module> </modules> + <repositories> + <repository> + <id>${repo.releases.id}</id> + <url>${repo.releases.url}</url> + </repository> + </repositories> + + <distributionManagement> + <repository> + <id>${publish.releases.id}</id> + <url>${publish.releases.url}</url> + </repository> + <snapshotRepository> + <id>${publish.snapshots.id}</id> + <url>${publish.snapshots.url}</url> + </snapshotRepository> + </distributionManagement> + + <profiles> + <profile> + <id>Default</id> + <activation> + <property> + <name>!repo.releases.id</name> + </property> + </activation> + <properties> + <repo.releases.id>community-maven-repo</repo.releases.id> + <publish.snapshots.id>community-maven-via-job-token</publish.snapshots.id> + <publish.releases.id>community-maven-via-job-token</publish.releases.id> + <repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url> + <publish.snapshots.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.snapshots.url> + <publish.releases.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.releases.url> + </properties> + </profile> + </profiles> + + </project> diff --git a/provider/indexer-aws/pom.xml b/provider/indexer-aws/pom.xml index e126e1c8d631ef9e90a6dc580d4501a7bd5288bb..bc756ab12a0c4f87fd4c3f345b46ba274b03b81b 100644 --- a/provider/indexer-aws/pom.xml +++ b/provider/indexer-aws/pom.xml @@ -20,7 +20,7 @@ <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> <version>1.0.4-SNAPSHOT</version> - <relativePath>../..</relativePath> + <relativePath>../../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> @@ -173,26 +173,4 @@ </plugin> </plugins> </build> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - - <repository> - <id>jitpack.io</id> - <url>https://jitpack.io</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> </project> diff --git a/provider/indexer-azure/pom.xml b/provider/indexer-azure/pom.xml index 7f2f938216de5bd65c0970ab648001237ca866a2..8a5f33513d0b6db572b7410418684c8afea0927f 100644 --- a/provider/indexer-azure/pom.xml +++ b/provider/indexer-azure/pom.xml @@ -24,7 +24,7 @@ <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> <version>1.0.4-SNAPSHOT</version> - <relativePath>../..</relativePath> + <relativePath>../../pom.xml</relativePath> </parent> <artifactId>indexer-azure</artifactId> @@ -43,8 +43,35 @@ <nimbus-jose-jwt.version>8.2</nimbus-jose-jwt.version> <indexer-core.version>1.0.6-SNAPSHOT</indexer-core.version> <spring-security-jwt.version>1.1.1.RELEASE</spring-security-jwt.version> + <osdu.corelibazure.version>0.0.42</osdu.corelibazure.version> + <osdu.oscorecommon.version>0.3.12</osdu.oscorecommon.version> + <reactor-netty.version>0.9.12.RELEASE</reactor-netty.version> + <java-jwt.version>3.8.1</java-jwt.version> + <powermock.version>2.0.2</powermock.version> + <mockito.version>3.0.0</mockito.version> + <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version> + <spring-security-oauth2.version>2.3.6.RELEASE</spring-security-oauth2.version> </properties> + <dependencyManagement> + <dependencies> + <!-- Override version defined in parent's POM --> + <dependency> + <groupId>io.projectreactor.netty</groupId> + <artifactId>reactor-netty</artifactId> + <version>${reactor-netty.version}</version> + </dependency> + <!-- Inherit managed dependencies from core-lib-azure --> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>core-lib-azure</artifactId> + <version>${osdu.corelibazure.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> <groupId>org.yaml</groupId> @@ -97,7 +124,12 @@ <dependency> <groupId>com.microsoft.azure</groupId> <artifactId>azure-active-directory-spring-boot-starter</artifactId> - <version>${azure.version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -112,7 +144,7 @@ <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> - <version>2.3.6.RELEASE</version> + <version>${spring-security-oauth2.version}</version> <exclusions> <exclusion> <groupId>org.codehaus.jackson</groupId> @@ -142,18 +174,17 @@ <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>os-core-common</artifactId> - <version>0.3.12</version> + <version>${osdu.oscorecommon.version}</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>core-lib-azure</artifactId> - <version>0.0.33</version> + <version>${osdu.corelibazure.version}</version> </dependency> <dependency> <groupId>com.microsoft.azure</groupId> <artifactId>msal4j</artifactId> - <version>0.5.0-preview</version> </dependency> <dependency> @@ -184,19 +215,18 @@ <dependency> <groupId>com.auth0</groupId> <artifactId>java-jwt</artifactId> - <version>3.8.1</version> + <version>${java-jwt.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.12</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito2 --> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito2</artifactId> - <version>2.0.2</version> + <version>${powermock.version}</version> <scope>test</scope> </dependency> @@ -204,42 +234,24 @@ <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> - <version>2.0.2</version> + <version>${powermock.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>3.0.0</version> + <version>${mockito.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> - <version>2.7</version> + <version>${cobertura-maven-plugin.version}</version> <scope>test</scope> </dependency> </dependencies> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> - <build> <plugins> <plugin> diff --git a/provider/indexer-azure/src/main/resources/application.properties b/provider/indexer-azure/src/main/resources/application.properties index be0110132159d27ca901177bf96ad374fafeb7da..5740f5badd3fa92579b7c50bb2ef14a4bfd56a4d 100644 --- a/provider/indexer-azure/src/main/resources/application.properties +++ b/provider/indexer-azure/src/main/resources/application.properties @@ -13,9 +13,11 @@ # limitations under the License. LOG_PREFIX=indexer +LOG_LEVEL=DEBUG + server.servlet.contextPath=/api/indexer/v2/ REGION=centralus -logging.level.org.opendes.osdu=DEBUG +logging.level.org.opendes.osdu=${LOG_LEVEL} JAVA_OPTS=-Dserver.port=80 DEFAULT_DATA_COUNTRY=US @@ -79,3 +81,6 @@ logging.mdccontext.enabled=true # core-lib-azure configuration tenantFactoryImpl.required=true + +# Disable keyVault for actuator health check +management.health.azure-key-vault.enabled=false \ No newline at end of file diff --git a/provider/indexer-gcp/README.md b/provider/indexer-gcp/README.md index 23c482574d2515459a8f962b197687472e1bba52..373972ee9e4561bab282bb0e84e80954293724f0 100644 --- a/provider/indexer-gcp/README.md +++ b/provider/indexer-gcp/README.md @@ -35,7 +35,7 @@ In order to run the service locally or remotely, you will need to have the follo | `GOOGLE_AUDIENCES` | ex `*****.apps.googleusercontent.com` | Client ID for getting access to cloud resources | yes | https://console.cloud.google.com/apis/credentials | | `GOOGLE_APPLICATION_CREDENTIALS` | ex `/path/to/directory/service-key.json` | Service account credentials, you only need this if running locally | yes | https://console.cloud.google.com/iam-admin/serviceaccounts | | `security.https.certificate.trust` | ex `false` | Elastic client connection uses TrustSelfSignedStrategy(), if it is 'true' | false | output of infrastructure deployment | - +| `indexer.que.service.mail` | ex `default@iam.gserviceaccount.com` | IndexerQue environment service account mail, required if Indexer Que deployed in cloud task mode, to validate token from it | yes | - | ### Run Locally Check that maven is installed: diff --git a/provider/indexer-gcp/cloudbuild/Dockerfile.cloudbuild b/provider/indexer-gcp/cloudbuild/Dockerfile.cloudbuild new file mode 100644 index 0000000000000000000000000000000000000000..59c9b5dafcf6824308be6cf80357a887ac75bd36 --- /dev/null +++ b/provider/indexer-gcp/cloudbuild/Dockerfile.cloudbuild @@ -0,0 +1,13 @@ +# Use the official AdoptOpenJDK for a base image. +# https://hub.docker.com/_/openjdk +FROM openjdk:8-slim +WORKDIR /app +ARG PROVIDER_NAME +ENV PROVIDER_NAME $PROVIDER_NAME +ARG PORT +ENV PORT $PORT +# Copy the jar to the production image from the builder stage. +COPY provider/indexer-${PROVIDER_NAME}/target/indexer-${PROVIDER_NAME}-*-SNAPSHOT-spring-boot.jar indexer-${PROVIDER_NAME}.jar +# Run the web service on container startup. +CMD java -Djava.security.egd=indexer:/dev/./urandom -Dserver.port=${PORT} -jar /app/indexer-${PROVIDER_NAME}.jar + diff --git a/provider/indexer-gcp/cloudbuild/cloudbuild.yaml b/provider/indexer-gcp/cloudbuild/cloudbuild.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7f3b4e18377dffb2635aa65c5cbe5cdc7b2b9a68 --- /dev/null +++ b/provider/indexer-gcp/cloudbuild/cloudbuild.yaml @@ -0,0 +1,31 @@ +# Copyright 2020 Google LLC +# Copyright 2017-2019, Schlumberger +# Copyright 2020 EPAM +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +steps: + - name: 'gcr.io/cloud-builders/docker' + args: [ + 'build', + '--build-arg', 'PROVIDER_NAME=${_PROVIDER_NAME}', + '--build-arg', 'PORT=${_PORT}', + '-t', 'gcr.io/$PROJECT_ID/os-indexer/indexer-${_PROVIDER_NAME}:${_SHORT_SHA}', + '-t', 'gcr.io/$PROJECT_ID/os-indexer/indexer-${_PROVIDER_NAME}:latest', + '-f', 'provider/indexer-${_PROVIDER_NAME}/cloudbuild/Dockerfile.cloudbuild', + '.' + ] + +images: + - 'gcr.io/$PROJECT_ID/os-indexer/indexer-${_PROVIDER_NAME}' + diff --git a/provider/indexer-gcp/pom.xml b/provider/indexer-gcp/pom.xml index fe4e902e8ea3f5a5b829b90ad822637b4a02d465..2b91fa1322e2b54eb010e91ef1af984f70de7ed7 100644 --- a/provider/indexer-gcp/pom.xml +++ b/provider/indexer-gcp/pom.xml @@ -16,23 +16,7 @@ <name>indexer-gcp</name> <description>Indexer Service GCP App Engine</description> <packaging>jar</packaging> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> <dependencies> <dependency> <groupId>org.opengroup.osdu.indexer</groupId> @@ -43,7 +27,7 @@ <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>core-lib-gcp</artifactId> - <version>0.3.21</version> + <version>0.3.23</version> </dependency> <dependency> @@ -83,6 +67,11 @@ <artifactId>google-cloud-pubsub</artifactId> <version>1.60.0</version> </dependency> + <dependency> + <groupId>com.google.api-client</groupId> + <artifactId>google-api-client</artifactId> + <version>1.30.11</version> + </dependency> <dependency> <groupId>org.elasticsearch</groupId> diff --git a/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/DpsHeaderFactoryGcp.java b/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/DpsHeaderFactoryGcp.java index 28884453076f6ee465f876c9a014bdeda0da935b..75b7b744f9e26ce7fb58315ccb14c28b34eef42a 100644 --- a/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/DpsHeaderFactoryGcp.java +++ b/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/DpsHeaderFactoryGcp.java @@ -24,7 +24,7 @@ import javax.inject.Inject; import com.google.common.base.Strings; import org.opengroup.osdu.core.common.model.http.DpsHeaders; -import org.opengroup.osdu.core.gcp.model.AppEngineHeaders; +import org.opengroup.osdu.core.gcp.model.CloudTaskHeaders; import org.opengroup.osdu.core.gcp.util.TraceIdExtractor; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @@ -43,10 +43,10 @@ public class DpsHeaderFactoryGcp extends DpsHeaders { .stream() .collect(Collectors.toMap(h -> h, request::getHeader)); - String traceContext = headers.get(AppEngineHeaders.CLOUD_TRACE_CONTEXT); + String traceContext = headers.get(CloudTaskHeaders.CLOUD_TRACE_CONTEXT); if(!Strings.isNullOrEmpty(traceContext)){ - headers.put(AppEngineHeaders.TRACE_ID, TraceIdExtractor.getTraceId(traceContext)); + headers.put(CloudTaskHeaders.TRACE_ID, TraceIdExtractor.getTraceId(traceContext)); } this.addFromMap(headers); diff --git a/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/RequestInfoImpl.java b/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/RequestInfoImpl.java index 2ad14667d9aa2e47876989d98ab124c79cc2c618..8ab213d952a647db23ae61ab892fd12fbdb72d25 100644 --- a/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/RequestInfoImpl.java +++ b/provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/RequestInfoImpl.java @@ -1,6 +1,14 @@ package org.opengroup.osdu.indexer.util; +import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; +import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; +import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.json.jackson2.JacksonFactory; import com.google.common.base.Strings; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Arrays; +import java.util.logging.Level; import lombok.extern.java.Log; import org.apache.http.HttpStatus; import org.opengroup.osdu.core.common.Constants; @@ -9,8 +17,8 @@ import org.opengroup.osdu.core.common.model.tenant.TenantInfo; import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.model.search.DeploymentEnvironment; import org.opengroup.osdu.core.common.util.IServiceAccountJwtClient; -import org.opengroup.osdu.core.gcp.model.AppEngineHeaders; import org.opengroup.osdu.core.common.provider.interfaces.IRequestInfo; +import org.opengroup.osdu.core.gcp.model.CloudTaskHeaders; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.RequestScope; @@ -38,6 +46,9 @@ public class RequestInfoImpl implements IRequestInfo { @Value("${DEPLOYMENT_ENVIRONMENT}") private String DEPLOYMENT_ENVIRONMENT; + @Value("${indexer.que.service.mail}") + private String indexerQueServiceMail; + private static final String expectedCronHeaderValue = "true"; @Override @@ -70,15 +81,53 @@ public class RequestInfoImpl implements IRequestInfo { @Override public boolean isCronRequest() { - String appEngineCronHeader = this.dpsHeaders.getHeaders().getOrDefault(AppEngineHeaders.CRON_SERVICE, null); + String appEngineCronHeader = this.dpsHeaders.getHeaders().getOrDefault(CloudTaskHeaders.CLOUD_CRON_SERVICE, null); return expectedCronHeaderValue.equalsIgnoreCase(appEngineCronHeader); } @Override public boolean isTaskQueueRequest() { - if (!this.dpsHeaders.getHeaders().containsKey(AppEngineHeaders.TASK_QUEUE_NAME)) return false; + if(this.dpsHeaders.getHeaders().containsKey(CloudTaskHeaders.CLOUD_TASK_QUEUE_NAME)){ + log.log(Level.INFO,"Request acknowledged as Cloud task, proceeding token validation"); + return isCloudTaskRequest(); + } + if(this.dpsHeaders.getHeaders().containsKey(CloudTaskHeaders.APPENGINE_TASK_QUEUE_NAME)){ + log.log(Level.INFO,"Request acknowledged as AppEngine task, proceeding headers validation"); + return isAppEngineTaskRequest(); + } + return false; + } + + private boolean isCloudTaskRequest() { + log.log(Level.INFO,dpsHeaders.getHeaders().toString()); + try { + GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder( + GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance()) + .setIssuers(Arrays.asList( + "accounts.google.com", "https://accounts.google.com", + "googleapis.com", "https://www.googleapis.com/auth/userinfo.profile" + ) + ).build(); + String authorization = dpsHeaders.getAuthorization().replace("Bearer ", ""); + + GoogleIdToken googleIdToken = verifier.verify(authorization); + if(googleIdToken.getPayload().getEmail().equals(indexerQueServiceMail)){ + return true; + } + log.log(Level.WARNING,"Token email doesn't match with variable \"indexer.que.service.mail\""); + return false; - String queueId = this.dpsHeaders.getHeaders().get(AppEngineHeaders.TASK_QUEUE_NAME); + } catch (GeneralSecurityException | IOException e) { + log.log(Level.WARNING,"Not valid or expired cloud task token provided"); + return false; + } + } + + private boolean isAppEngineTaskRequest(){ + if (!this.dpsHeaders.getHeaders().containsKey(CloudTaskHeaders.APPENGINE_TASK_QUEUE_NAME)) { + return false; + } + String queueId = this.dpsHeaders.getHeaders().get(CloudTaskHeaders.APPENGINE_TASK_QUEUE_NAME); return queueId.endsWith(Constants.INDEXER_QUEUE_IDENTIFIER); } diff --git a/provider/indexer-gcp/src/main/resources/application.properties b/provider/indexer-gcp/src/main/resources/application.properties index a0cbce3427ff62ba4d63ffabc17323efc833295b..e4391d77b133e71e5f52b8f39753a746fd85b5d6 100644 --- a/provider/indexer-gcp/src/main/resources/application.properties +++ b/provider/indexer-gcp/src/main/resources/application.properties @@ -34,3 +34,4 @@ ELASTIC_DATASTORE_KIND=SearchSettings ELASTIC_DATASTORE_ID=indexer-service security.https.certificate.trust=false +indexer.que.service.mail=default@iam.gserviceaccount.com diff --git a/provider/indexer-ibm/pom.xml b/provider/indexer-ibm/pom.xml index 07b269a729827466ea59658c95c8e4520e3f0447..af9c027d811b553ce5bb7ca4767ca486d6ea8c21 100644 --- a/provider/indexer-ibm/pom.xml +++ b/provider/indexer-ibm/pom.xml @@ -24,7 +24,7 @@ <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> <version>1.0.4-SNAPSHOT</version> - <relativePath>../..</relativePath> + <relativePath>../../pom.xml</relativePath> </parent> <artifactId>indexer-ibm</artifactId> @@ -150,23 +150,6 @@ </dependencies> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> <build> <plugins> <plugin> diff --git a/testing/indexer-test-aws/build-aws/prepare-dist.sh b/testing/indexer-test-aws/build-aws/prepare-dist.sh index f0451cabc005a3b79eb27c897c294a11fda496b0..86ce9d20889cf1ccdc4c8eac6aab83bb44738b3b 100755 --- a/testing/indexer-test-aws/build-aws/prepare-dist.sh +++ b/testing/indexer-test-aws/build-aws/prepare-dist.sh @@ -29,3 +29,5 @@ chmod +x "${INTEGRATION_TEST_OUTPUT_BIN_DIR}"/install-deps.sh mvn clean -f "$INTEGRATION_TEST_SOURCE_DIR_AWS"/pom.xml cp -R "$INTEGRATION_TEST_SOURCE_DIR_AWS"/* "${INTEGRATION_TEST_OUTPUT_DIR}"/ +#copy testing parent pom to output +cp "$INTEGRATION_TEST_SOURCE_DIR/pom.xml" "${OUTPUT_DIR}/testing" \ No newline at end of file diff --git a/testing/indexer-test-aws/pom.xml b/testing/indexer-test-aws/pom.xml index e8975829f08994dc9e34a72e6a5ab16729d19565..b6f709f74b4fb8bb4e53255838575ed8e4ef8954 100644 --- a/testing/indexer-test-aws/pom.xml +++ b/testing/indexer-test-aws/pom.xml @@ -20,29 +20,18 @@ <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>indexer-test</artifactId> + <version>0.0.5-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-aws</artifactId> <version>0.0.2-SNAPSHOT</version> <packaging>jar</packaging> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> - <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> diff --git a/testing/indexer-test-azure/pom.xml b/testing/indexer-test-azure/pom.xml index 47465e7b58a47e6bada176baede2229227e3b6e5..40ac0301b4b7a76790fca2ba4682fcc93437b309 100644 --- a/testing/indexer-test-azure/pom.xml +++ b/testing/indexer-test-azure/pom.xml @@ -20,6 +20,13 @@ <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>indexer-test</artifactId> + <version>0.0.5-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-azure</artifactId> <version>0.0.1-SNAPSHOT</version> @@ -32,24 +39,7 @@ <azure.keyvault.version>4.1.0</azure.keyvault.version> <junit.jupiter.version>5.6.0</junit.jupiter.version> </properties> - <!-- indexer test core depends on core libraries in OSDU, so the repository needs to be configured --> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> <dependencies> <!-- Internal packages --> diff --git a/testing/indexer-test-core/pom.xml b/testing/indexer-test-core/pom.xml index 44f3dc9bec8878201b23ca0568a72fec9bb8eb04..de873f019a84fbfe918b004acd6be8af02696855 100644 --- a/testing/indexer-test-core/pom.xml +++ b/testing/indexer-test-core/pom.xml @@ -4,6 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>indexer-test</artifactId> + <version>0.0.5-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-core</artifactId> <version>0.0.2-SNAPSHOT</version> @@ -15,24 +22,6 @@ <os-core-common.version>0.3.12</os-core-common.version> </properties> - <!-- testing core depends on core libraries in OSDU, so the repository needs to be configured --> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> <dependencies> <dependency> <groupId>org.opengroup.osdu</groupId> diff --git a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java new file mode 100644 index 0000000000000000000000000000000000000000..b1f4377b50e9fc71d76e064b91bd716dcbc0d5dc --- /dev/null +++ b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java @@ -0,0 +1,187 @@ +/* + Copyright 2020 Google LLC + Copyright 2020 EPAM Systems, Inc + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package org.opengroup.osdu.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.opengroup.osdu.util.Config.getEntitlementsDomain; +import static org.opengroup.osdu.util.Config.getIndexerBaseURL; +import static org.opengroup.osdu.util.Config.getStorageBaseURL; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.sun.jersey.api.client.ClientResponse; +import cucumber.api.DataTable; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.HttpMethod; +import lombok.extern.java.Log; +import org.apache.http.HttpStatus; +import org.opengroup.osdu.core.common.model.entitlements.Acl; +import org.opengroup.osdu.core.common.model.search.RecordChangedMessages; +import org.opengroup.osdu.models.Setup; +import org.opengroup.osdu.models.TestIndex; +import org.opengroup.osdu.util.FileHandler; +import org.opengroup.osdu.util.HTTPClient; + +@Log +public class CleanupIndiciesSteps extends TestsBase { + private final String timeStamp = String.valueOf(System.currentTimeMillis()); + private Map<String, TestIndex> inputIndexMap = new HashMap<>(); + private List<Map<String, Object>> records; + private boolean shutDownHookAdded = false; + private final Map<String, String> headers = httpClient.getCommonHeader(); + + public CleanupIndiciesSteps(HTTPClient httpClient) { + super(httpClient); + } + + public void theSchemaIsCreatedWithTheFollowingKind(DataTable dataTable) { + List<Setup> inputList = dataTable.asList(Setup.class); + for (Setup input : inputList) { + TestIndex testIndex = getTextIndex(); + testIndex.setHttpClient(httpClient); + testIndex.setIndex(generateActualName(input.getIndex(), timeStamp)); + testIndex.setKind(generateActualName(input.getKind(), timeStamp)); + testIndex.setSchemaFile(input.getSchemaFile()); + inputIndexMap.put(testIndex.getKind(), testIndex); + } + + if (!shutDownHookAdded) { + shutDownHookAdded = true; + for (Map.Entry<String, TestIndex> kind : inputIndexMap.entrySet()) { + kind.getValue().setupSchema(); + } + } + } + + public void iIngestRecordsWithTheforAGiven(String record, String dataGroup, String kind) { + String actualKind = generateActualName(kind, timeStamp); + try { + String fileContent = FileHandler.readFile(String.format("%s.%s", record, "json")); + records = new Gson().fromJson(fileContent, new TypeToken<List<Map<String, Object>>>() {}.getType()); + + for (Map<String, Object> testRecord : records) { + testRecord.put("id", generateActualName(testRecord.get("id").toString(), timeStamp)); + testRecord.put("kind", actualKind); + testRecord.put("legal", generateLegalTag()); + String[] x_acl = {generateActualName(dataGroup,timeStamp)+"."+getEntitlementsDomain()}; + Acl acl = Acl.builder().viewers(x_acl).owners(x_acl).build(); + testRecord.put("acl", acl); + } + String payLoad = new Gson().toJson(records); + ClientResponse clientResponse = httpClient.send(HttpMethod.PUT, getStorageBaseURL() + "records", payLoad, headers, httpClient.getAccessToken()); + assertEquals(201, clientResponse.getStatus()); + } catch (Exception ex) { + throw new AssertionError(ex.getMessage()); + } + } + + public void iCheckThatTheIndexForHasBeenCreated(String kind) throws IOException, InterruptedException { + assertTrue(isNewIndexCreated(generateActualName(kind, timeStamp))); + } + + public void iShouldDeleteTheRecordsForICreatedEarlier() { + List<Map<String, Object>> deletedRecords = new ArrayList<>(); + if (records != null && !records.isEmpty()) { + for (Map<String, Object> testRecord : records) { + String id = testRecord.get("id").toString(); + ClientResponse clientResponse = httpClient.send(HttpMethod.DELETE, getStorageBaseURL() + + "records/" + id, null, headers, httpClient.getAccessToken()); + if (clientResponse.getStatus() == 204) { + deletedRecords.add(testRecord); + log.info("Deleted the records with id " + id); + } + } + assertEquals(records.size(), deletedRecords.size()); + } + } + + public void iShouldDeleteTheSchemaForICreatedEarlier(String kind) { + ClientResponse response = httpClient.send(HttpMethod.DELETE, + String.format("%sschemas%s", getStorageBaseURL(), "/" + generateActualName(kind, timeStamp)),null, + headers, httpClient.getAccessToken()); + assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus()); + } + + public void iShouldCheckThetTheIndexforHasNotBeenDeleted(String kind) throws IOException, InterruptedException { + assertTrue(isNewIndexExist(generateActualName(kind, timeStamp))); + } + + public void iShouldToRunCleanupOfIndexesForAnd(String kind, String message) { + + String url = getIndexerBaseURL() + "index-cleanup"; + log.info("URL: " + url); + ClientResponse response = httpClient.send(HttpMethod.POST, url, + convertMessageIntoJson(kind, message), headers, httpClient.getAccessToken()); + assertEquals(HttpStatus.SC_OK, response.getStatus()); + } + + public void iShouldCheckThatTheIndexForHasBeenDeleted(String kind) throws IOException, InterruptedException { + assertFalse(isNewIndexExist(generateActualName(kind, timeStamp))); + } + + private String convertMessageIntoJson(String kind, String message) { + String actualKind = generateActualName(kind, timeStamp); + RecordChangedMessages recordChangedMessages = (new Gson()).fromJson(String.format(message, + actualKind, actualKind, timeStamp), RecordChangedMessages.class); + return new Gson().toJson(recordChangedMessages); + } + + private boolean isNewIndexExist(String index) throws IOException { + return elasticUtils.isIndexExist(index.replace(":", "-")); + } + + private boolean isNewIndexCreated(String index) throws IOException, InterruptedException { + int iterator; + boolean indexExist = false; + + // index.refresh_interval is set to default 30s, wait for 40s initially + Thread.sleep(40000); + + for (iterator = 0; iterator < 20; iterator++) { + indexExist = elasticUtils.isIndexExist(index.replace(":", "-")); + if (indexExist) { + break; + } else { + Thread.sleep(5000); + } + if ((iterator + 1) % 5 == 0) { + elasticUtils.refreshIndex(index.replace(":", "-")); + } + } + if (iterator >= 20) { + fail(String.format("index not created after waiting for %s seconds", ((40000 + iterator * 5000) / 1000))); + } + return indexExist; + } + + @Override + protected String getApi() { + return null; + } + + @Override + protected String getHttpMethod() { + return null; + } +} diff --git a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/util/ElasticUtils.java b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/util/ElasticUtils.java index 4922e8498e5cebe4d59fcc2ac2ba08d8ed43c217..4612f07cf3efd111c178ef607c6d1af2789d60dd 100644 --- a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/util/ElasticUtils.java +++ b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/util/ElasticUtils.java @@ -1,3 +1,20 @@ +/* + Copyright 2020 Google LLC + Copyright 2020 EPAM Systems, Inc + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + package org.opengroup.osdu.util; import com.google.gson.Gson; @@ -11,6 +28,7 @@ import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; +import org.elasticsearch.action.admin.indices.get.GetIndexRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -297,5 +315,24 @@ public class ElasticUtils { return builder; } + public boolean isIndexExist(String index) { + boolean exists = false; + try { + exists = createRestClientAndCheckIndexExist(index); + } catch (ElasticsearchStatusException e) { + log.log(Level.INFO, String.format("Error getting index: %s %s", index, e.getMessage())); + } + return exists; + } + private boolean createRestClientAndCheckIndexExist(String index) { + try (RestHighLevelClient client = this.createClient(username, password, host)) { + GetIndexRequest request = new GetIndexRequest(); + request.indices(index); + return client.indices().exists(request, RequestOptions.DEFAULT); + } catch (IOException e) { + log.log(Level.INFO, String.format("Error getting index: %s %s", index, e.getMessage())); + } + return false; + } } \ No newline at end of file diff --git a/testing/indexer-test-core/src/main/resources/features/indexcleanup/IndexCleanup.feature b/testing/indexer-test-core/src/main/resources/features/indexcleanup/IndexCleanup.feature new file mode 100644 index 0000000000000000000000000000000000000000..610baacea59ae288bf4fa42fe5728f6ec759afcc --- /dev/null +++ b/testing/indexer-test-core/src/main/resources/features/indexcleanup/IndexCleanup.feature @@ -0,0 +1,20 @@ +Feature: Indexing of the documents + This feature deals to check for index deletion after schema deletion. + + Background: + Given the schema is created with the following kind + | kind | index | schemaFile | + | tenant1:testindex<timestamp>:well:1.0.0 | tenant1-testindex<timestamp>-well-1.0.0 | index_records_1 | + + Scenario Outline: Index creation and deletion in the Elastic Search + When I ingest records with the <recordFile> with <acl> for a given <kind> + Then I check that the index for <kind> has been created + Then I should delete the records I created earlier + Then I should delete the schema for <kind> I created earlier + Then I should check that the index for <kind> has not been deleted + Then I should to run cleanup of indexes for <kind> and <message> + Then I should check that the index for <kind> has been deleted + + Examples: + | kind | recordFile | acl | message | + | "tenant1:testindex<timestamp>:well:1.0.0" | "index_records_1" | "data.default.viewers@tenant1" | "{"data":"[{\"id\":\"%s-d9033ae1-fb15-496c-9ba0-880fd1d2b2cf\",\"kind\":\"%s\",\"op\":\"purge_schema\"}]","attributes":{"account-id":"opendes","correlation-id":"b5a281bd-f59d-4db2-9939-b2d85036fc7e"},"messageId":"%s","publishTime":"2018-05-08T21:48:56.131Z"}"| diff --git a/testing/indexer-test-gcp/pom.xml b/testing/indexer-test-gcp/pom.xml index 63544ea5c419cb00db31cd998e7f3e1c44523796..15ad0ca19399f6b6bb07b4eb4c9f41ad9abb0cb9 100644 --- a/testing/indexer-test-gcp/pom.xml +++ b/testing/indexer-test-gcp/pom.xml @@ -5,6 +5,13 @@ <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>indexer-test</artifactId> + <version>0.0.5-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-gcp</artifactId> <version>0.0.2-SNAPSHOT</version> @@ -128,21 +135,4 @@ </dependency> </dependencies> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> </project> \ No newline at end of file diff --git a/testing/indexer-test-gcp/src/test/java/org/opengroup/osdu/step_definitions/index/cleanup/RunTest.java b/testing/indexer-test-gcp/src/test/java/org/opengroup/osdu/step_definitions/index/cleanup/RunTest.java new file mode 100644 index 0000000000000000000000000000000000000000..baa367cab29a6bda105b22654ee69d5850033bec --- /dev/null +++ b/testing/indexer-test-gcp/src/test/java/org/opengroup/osdu/step_definitions/index/cleanup/RunTest.java @@ -0,0 +1,30 @@ +/* + Copyright 2020 Google LLC + Copyright 2020 EPAM Systems, Inc + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package org.opengroup.osdu.step_definitions.index.cleanup; + +import cucumber.api.CucumberOptions; +import cucumber.api.junit.Cucumber; +import org.junit.runner.RunWith; + +@RunWith(Cucumber.class) +@CucumberOptions( + features = "classpath:features/indexcleanup/IndexCleanup.feature", + glue = {"classpath:org.opengroup.osdu.step_definitions/index/cleanup"}, + plugin = {"pretty", "junit:target/cucumber-reports/TEST-indexcleanup.xml"}) +public class RunTest { +} \ No newline at end of file diff --git a/testing/indexer-test-gcp/src/test/java/org/opengroup/osdu/step_definitions/index/cleanup/Steps.java b/testing/indexer-test-gcp/src/test/java/org/opengroup/osdu/step_definitions/index/cleanup/Steps.java new file mode 100644 index 0000000000000000000000000000000000000000..d40b77949c357be505521d5207e176ac4698f5fb --- /dev/null +++ b/testing/indexer-test-gcp/src/test/java/org/opengroup/osdu/step_definitions/index/cleanup/Steps.java @@ -0,0 +1,83 @@ +/* + Copyright 2020 Google LLC + Copyright 2020 EPAM Systems, Inc + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package org.opengroup.osdu.step_definitions.index.cleanup; + +import cucumber.api.DataTable; +import cucumber.api.Scenario; +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import java.io.IOException; +import lombok.extern.java.Log; +import org.opengroup.osdu.common.CleanupIndiciesSteps; +import org.opengroup.osdu.util.GCPHTTPClient; + +@Log +public class Steps extends CleanupIndiciesSteps { + + public Steps() { + super(new GCPHTTPClient()); + } + + @Before + public void before(Scenario scenario) { + this.scenario = scenario; + this.httpClient = new GCPHTTPClient(); + } + + @Given("^the schema is created with the following kind$") + public void theSchemaIsCreatedWithTheFollowingKind(DataTable dataTable) { + super.theSchemaIsCreatedWithTheFollowingKind(dataTable); + } + + @When("^I ingest records with the \"(.*?)\" with \"(.*?)\" for a given \"(.*?)\"$") + public void iIngestRecordsWithTheforAGiven(String record, String dataGroup, String kind) { + super.iIngestRecordsWithTheforAGiven(record, dataGroup, kind); + } + + @Then("^I check that the index for \"(.*?)\" has been created$") + public void iCheckThatTheIndexForHasBeenCreated(String kind) throws IOException, InterruptedException { + super.iCheckThatTheIndexForHasBeenCreated(kind); + } + + @Then("^I should delete the records I created earlier$") + public void iShouldDeleteTheRecordsForICreatedEarlier() { + super.iShouldDeleteTheRecordsForICreatedEarlier(); + } + + @Then("^I should delete the schema for \"(.*?)\" I created earlier$") + public void iShouldDeleteTheSchemaForICreatedEarlier(String kind) { + super.iShouldDeleteTheSchemaForICreatedEarlier(kind); + } + + @Then("^I should check that the index for \"(.*?)\" has not been deleted$") + public void iShouldCheckThetTheIndexforHasNotBeenDeleted(String kind) throws IOException, InterruptedException { + super.iShouldCheckThetTheIndexforHasNotBeenDeleted(kind); + } + + @Then("^I should to run cleanup of indexes for \"(.*?)\" and \"(.*?)\"$") + public void iShouldToRunCleanupOfIndexesForAnd(String kind, String message) { + super.iShouldToRunCleanupOfIndexesForAnd(kind, message); + } + + @Then("^I should check that the index for \"(.*?)\" has been deleted$") + public void iShouldCheckThatTheIndexForHasBeenDeleted(String kind) throws IOException, InterruptedException { + super.iShouldCheckThatTheIndexForHasBeenDeleted(kind); + } +} \ No newline at end of file diff --git a/testing/indexer-test-ibm/pom.xml b/testing/indexer-test-ibm/pom.xml index 62842b147f03f170690d7817314f7c6e0d8f2b0e..110d8aa46ceb0e9082ed733b02f3a0a8d91d5fe2 100644 --- a/testing/indexer-test-ibm/pom.xml +++ b/testing/indexer-test-ibm/pom.xml @@ -5,6 +5,13 @@ <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>indexer-test</artifactId> + <version>0.0.5-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-ibm</artifactId> <version>0.0.2</version> @@ -135,22 +142,4 @@ </dependency> </dependencies> - <repositories> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> - </repository> - </repositories> - - <distributionManagement> - <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </repository> - <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/25/packages/maven</url> - </snapshotRepository> - </distributionManagement> - </project> diff --git a/testing/pom.xml b/testing/pom.xml index 14d9179b9fc89a0849ae71da53b43268d2a7897a..4ffdbe986ba60cdb8923a7ef92f9acd6b974ed2a 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -41,19 +41,39 @@ <repositories> <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url> + <id>${repo.releases.id}</id> + <url>${repo.releases.url}</url> </repository> </repositories> <distributionManagement> <repository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/19/packages/maven</url> + <id>${publish.releases.id}</id> + <url>${publish.releases.url}</url> </repository> <snapshotRepository> - <id>${gitlab-server}</id> - <url>https://community.opengroup.org/api/v4/projects/19/packages/maven</url> + <id>${publish.snapshots.id}</id> + <url>${publish.snapshots.url}</url> </snapshotRepository> </distributionManagement> + + <profiles> + <profile> + <id>Default</id> + <activation> + <property> + <name>!repo.releases.id</name> + </property> + </activation> + <properties> + <repo.releases.id>community-maven-repo</repo.releases.id> + <publish.snapshots.id>community-maven-via-job-token</publish.snapshots.id> + <publish.releases.id>community-maven-via-job-token</publish.releases.id> + <repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url> + <publish.snapshots.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.snapshots.url> + <publish.releases.url>https://community.opengroup.org/api/v4/projects/25/packages/maven</publish.releases.url> + </properties> + </profile> + </profiles> + </project>