From cd450aae2d87128b9f04e0aefdb83f599d3dfe0e Mon Sep 17 00:00:00 2001
From: Rucha Deshpande <deshruch@amazon.com>
Date: Fri, 8 Jan 2021 16:29:08 +0000
Subject: [PATCH] Integrate Schema Service call in Indexer service

commit 836437c9
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Thu Jan 07 2021 16:53:41 GMT-0600 (Central Standard Time)

    Revert renaming of IndexRecord feature


commit 79f05e88
Author: Matt Wise <wsmatth@amazon.com>
Date: Thu Jan 07 2021 13:49:57 GMT-0600 (Central Standard Time)

    add verbose output for report files and cp


commit 43a5dae1
Author: Matt Wise <wsmatth@amazon.com>
Date: Thu Jan 07 2021 13:30:10 GMT-0600 (Central Standard Time)

    update surefire report cp command


commit 39673290
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Thu Jan 07 2021 11:36:01 GMT-0600 (Central Standard Time)

    Copy surefire reports


commit 6c40645b
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Thu Jan 07 2021 10:48:54 GMT-0600 (Central Standard Time)

    fix surefire report path


commit 9ca701ed
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Thu Jan 07 2021 10:19:23 GMT-0600 (Central Standard Time)

    fix report path


commit a4367271
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Thu Jan 07 2021 09:45:19 GMT-0600 (Central Standard Time)

    copy cucumber-reports


commit e0f8ed01
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Thu Jan 07 2021 08:46:07 GMT-0600 (Central Standard Time)

    Copy surefire reports


commit 37e1f3a9
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Wed Jan 06 2021 13:10:47 GMT-0600 (Central Standard Time)

    rename the index record feature for testing


commit 45271f23
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Wed Jan 06 2021 11:30:16 GMT-0600 (Central Standard Time)

    Use SchemaServiceRecordSteps to run the latest integration tests


commit f3037cde
Author: Rucha Deshpande <deshruch@amazon.com>
Date: Tue Jan 05 2021 15:41:17 GMT-0600 (Central Standard Time)

    Updates to integrate schema service
---
 provider/indexer-aws/azure-build.yml          | 50 -------------------
 .../src/main/resources/application.properties |  5 +-
 .../indexer-test-aws/build-aws/run-tests.sh   |  2 +
 .../index/record/RunTest.java                 |  2 +-
 .../step_definitions/index/record/Steps.java  |  4 +-
 5 files changed, 8 insertions(+), 55 deletions(-)
 delete mode 100644 provider/indexer-aws/azure-build.yml

diff --git a/provider/indexer-aws/azure-build.yml b/provider/indexer-aws/azure-build.yml
deleted file mode 100644
index 8379aecec..000000000
--- a/provider/indexer-aws/azure-build.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-# Maven
-# Build your Java project and run tests with Apache Maven.
-# Add steps that analyze code, save build artifacts, deploy, and more:
-# https://docs.microsoft.com/azure/devops/pipelines/languages/java
-trigger:
-  branches:
-    include:
-      - master
-  paths:
-    exclude:
-      - README.md
-      - .gitignore
-pool:
-  name: dps-build
-  demands: maven
-steps:
-  - task: Maven@3
-    displayName: 'build, test, code coverage'
-    inputs:
-      mavenPomFile: 'pom.xml'
-      options: '--settings ./indexer-core/maven/settings.xml -DVSTS_FEED_TOKEN=$(VSTS_FEED_TOKEN) -U'
-      testResultsFiles: '**/*/TEST-*.xml'
-      codeCoverageToolOption: JaCoCo
-      goals: 'install'
-  - task: Maven@3
-    displayName: 'build, test, code coverage'
-    inputs:
-      mavenPomFile: 'pom.xml'
-      options: '--settings ./provider/indexer-aws/maven/settings.xml -DVSTS_FEED_TOKEN=$(VSTS_FEED_TOKEN) -U -P indexer-aws'
-      testResultsFiles: '**/*/TEST-*.xml'
-      codeCoverageToolOption: JaCoCo
-      goals: 'install'
-  - task: CopyFiles@2
-    displayName: 'Copy AWS artifacts for maven deploy to: $(build.artifactstagingdirectory)'
-    inputs:
-      SourceFolder:
-      Contents: |
-        provider/indexer-aws/CloudFormation
-        provider/indexer-aws/buildspec-post-deploy.yml
-        provider/indexer-aws/buildspec-pre-deploy.yml
-        provider/indexer-aws/target/*-spring-boot.jar
-      TargetFolder: '$(build.artifactstagingdirectory)'
-
-  - task: PublishBuildArtifacts@1
-    displayName: 'Publish Artifact: drop'
-    inputs:
-      PathtoPublish: '$(build.artifactstagingdirectory)'
-      ArtifactName: 'drop'
-      publishLocation: 'Container'
-    condition: succeededOrFailed()
diff --git a/provider/indexer-aws/src/main/resources/application.properties b/provider/indexer-aws/src/main/resources/application.properties
index 25cd99ee9..77f80a34f 100644
--- a/provider/indexer-aws/src/main/resources/application.properties
+++ b/provider/indexer-aws/src/main/resources/application.properties
@@ -22,7 +22,8 @@ aws.es.serviceName=es
 
 GAE_SERVICE=indexer
 
-SCHEMA_HOST=${HOST}/api/schema-service/v1/schema
+#reusing STORAGE_HOST variable here as the base url to point to schema service
+SCHEMA_HOST=${STORAGE_HOST}/api/schema-service/v1/schema
 
 STORAGE_SCHEMA_HOST=${STORAGE_HOST}/api/storage/v2/schemas
 STORAGE_QUERY_RECORD_HOST=${STORAGE_HOST}/api/storage/v2/query/records
@@ -41,7 +42,7 @@ aws.elasticache.cluster.schema.expiration=60
 MAX_CACHE_VALUE_SIZE=1000
 
 ## AWS Lambda configuration
-aws.lambda.get-groups-function-name=${ENVIRONMENT}-os-entitlements-GroupsFunction
+#aws.lambda.get-groups-function-name=${ENVIRONMENT}-os-entitlements-GroupsFunction
 
 
 ## Default DynamoDB Settings
diff --git a/testing/indexer-test-aws/build-aws/run-tests.sh b/testing/indexer-test-aws/build-aws/run-tests.sh
index 5b56779a9..78c727bd4 100755
--- a/testing/indexer-test-aws/build-aws/run-tests.sh
+++ b/testing/indexer-test-aws/build-aws/run-tests.sh
@@ -27,6 +27,7 @@ export DEFAULT_DATA_PARTITION_ID_TENANT2=common
 export ENTITLEMENTS_DOMAIN=testing.com
 export OTHER_RELEVANT_DATA_COUNTRIES=US
 export STORAGE_HOST=$STORAGE_URL
+export HOST=$SCHEMA_URL
 
 #### RUN INTEGRATION TEST #########################################################################
 
@@ -39,6 +40,7 @@ if [ -n "$1" ]
   then
     mkdir -p "$1"
     cp "$SCRIPT_SOURCE_DIR"/../target/junit-report.xml "$1"/os-indexer-junit-report.xml
+    cp  -R "$SCRIPT_SOURCE_DIR"/../target/surefire-reports "$1"
 fi
 
 exit $TEST_EXIT_CODE
diff --git a/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/RunTest.java b/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/RunTest.java
index e6887ea5e..e2ba02423 100644
--- a/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/RunTest.java
+++ b/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/RunTest.java
@@ -20,7 +20,7 @@ import org.junit.runner.RunWith;
 
 @RunWith(Cucumber.class)
 @CucumberOptions(
-        features = "classpath:features/indexrecord/IndexRecord.feature",
+        features = "classpath:features/indexrecord/indexRecord-schema-service.feature",
         glue = {"classpath:org.opengroup.osdu.step_definitions/index/record"},
         plugin = {"pretty", "junit:target/cucumber-reports/TEST-indexrecord.xml"})
 public class RunTest {
diff --git a/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java b/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java
index f68dfa947..7539fe6bf 100644
--- a/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java
+++ b/testing/indexer-test-aws/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java
@@ -15,7 +15,6 @@
 package org.opengroup.osdu.step_definitions.index.record;
 
 import lombok.extern.java.Log;
-import org.opengroup.osdu.common.RecordSteps;
 import org.opengroup.osdu.core.common.model.legal.Legal;
 import org.opengroup.osdu.util.AWSHTTPClient;
 
@@ -27,6 +26,7 @@ import cucumber.api.java.en.Then;
 import cucumber.api.java.en.When;
 import org.opengroup.osdu.util.ElasticUtilsAws;
 import org.opengroup.osdu.util.LegalTagUtilsAws;
+import org.opengroup.osdu.common.SchemaServiceRecordSteps;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -34,7 +34,7 @@ import java.util.Set;
 import static org.opengroup.osdu.util.Config.getOtherRelevantDataCountries;
 
 @Log
-public class Steps extends RecordSteps {
+public class Steps extends SchemaServiceRecordSteps {
 
     protected LegalTagUtilsAws legalTagUtils;
     private String legalTagName;
-- 
GitLab