Skip to content
Snippets Groups Projects
  • Rucha Deshpande's avatar
    9e11fb6f
    Add README · 9e11fb6f
    Rucha Deshpande authored
    commit d74b4db2 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Wed Dec 08 2021 11:23:58 GMT-0600 (Central Standard Time) 
    
        fix app properties
    
    
    commit 45011267 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Wed Dec 08 2021 09:58:46 GMT-0600 (Central Standard Time) 
    
        merge with dev
    
    
    commit 1d4610c7 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:47:30 GMT-0600 (Central Standard Time) 
    
        update README
    
    
    commit c21fbe13 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:46:31 GMT-0600 (Central Standard Time) 
    
        update README
    
    
    commit 9818ee1a 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:40:57 GMT-0600 (Central Standard Time) 
    
        update README
    
    
    commit 14849782 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:29:09 GMT-0600 (Central Standard Time) 
    
        fix README
    
    
    commit 1f59768d 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:17:06 GMT-0600 (Central Standard Time) 
    
        add README
    9e11fb6f
    History
    Add README
    Rucha Deshpande authored
    commit d74b4db2 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Wed Dec 08 2021 11:23:58 GMT-0600 (Central Standard Time) 
    
        fix app properties
    
    
    commit 45011267 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Wed Dec 08 2021 09:58:46 GMT-0600 (Central Standard Time) 
    
        merge with dev
    
    
    commit 1d4610c7 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:47:30 GMT-0600 (Central Standard Time) 
    
        update README
    
    
    commit c21fbe13 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:46:31 GMT-0600 (Central Standard Time) 
    
        update README
    
    
    commit 9818ee1a 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:40:57 GMT-0600 (Central Standard Time) 
    
        update README
    
    
    commit 14849782 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:29:09 GMT-0600 (Central Standard Time) 
    
        fix README
    
    
    commit 1f59768d 
    Author: Rucha Deshpande <deshruch@amazon.com> 
    Date: Tue Dec 07 2021 16:17:06 GMT-0600 (Central Standard Time) 
    
        add README
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Register Service

The purpose of Register Service is to register Actions, DDMS (s) and Subscriptions. register-aws is a Spring Boot service that provides a set of APIs to manage Actions, DDMS(s) and Subscriptions

Running Locally

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Pre-requisites

Service Configuration

In order to run the service locally or remotely, you will need to have the following environment variables defined.

name example value required description sensitive?
APPLICATION_PORT 8080 yes The port the service will be hosted on. no
AWS_REGION us-east-1 yes The region where resources needed by the service are deployed no
AWS_ACCESS_KEY_ID ASIAXXXXXXXXXXXXXX yes The AWS Access Key for a user with access to Backend Resources required by the service yes
AWS_SECRET_ACCESS_KEY super-secret-key== yes The AWS Secret Key for a user with access to Backend Resources required by the service yes
AWS_SESSION_TOKEN session-token-xxxxxxxxxx no AWS Session token needed if using an SSO user session to authenticate yes
RESOURCE_PREFIX osdu-prefix yes The Resource Prefix defined during deployment no
LOG_LEVEL DEBUG yes The Log Level severity to use (https://www.tutorialspoint.com/log4j/log4j_logging_levels.htm) no
SSM_ENABLED true yes Set to 'true' to use SSM to resolve config properties, otherwise use env vars no
SSL_ENABLED false no Set to 'false' to disable SSL for local development no
ENTITLEMENTS_BASE_URL http://localhost:8081 or https://some-hosted-url yes Specify the base url for an entitlements service instance. Can be run locally or remote no

Run Locally

Check that maven is installed:

example:

$ mvn --version
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /usr/local/Cellar/maven/3.8.3/libexec
Java version: 1.8.0_312, vendor: Amazon.com Inc., runtime: /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre
...

You may need to configure access to the remote maven repository that holds the OSDU dependencies. Copy one of the below files' content to your .m2 folder

  • For development against the OSDU GitLab environment, leverage: <REPO_ROOT>~/.mvn/community-maven.settings.xml

  • For development in an AWS Environment, leverage: <REPO_ROOT>/provider/register-aws/maven/settings.xml

  • Navigate to the service's root folder and run:

mvn clean package -pl register-core,provider/register-aws
  • If you wish to build the project without running tests
mvn clean package -pl register-core,provider/register-aws -DskipTests

After configuring your environment as specified above, you can follow these steps to run the application. These steps should be invoked from the repository root.

NOTE: If not on osx/linux: Replace * with version numbers as defined in the provider/storage-aws/pom.xml file

java -jar provider/register-aws/target/register-aws-*.*.*-SNAPSHOT-spring-boot.jar

Testing

Running Integration Tests

This section describes how to run OSDU Integration tests (testing/register-test-aws).

You will need to have the following environment variables defined.

name example value description sensitive?
AWS_ACCESS_KEY_ID ASIAXXXXXXXXXXXXXX The AWS Access Key for a user with access to Backend Resources required by the service yes
AWS_SECRET_ACCESS_KEY super-secret-key== The AWS Secret Key for a user with access to Backend Resources required by the service yes
AWS_SESSION_TOKEN session-token-xxxxxxxxx AWS Session token needed if using an SSO user session to authenticate yes
AWS_COGNITO_USER_POOL_ID us-east-1_xxxxxxxx User Pool Id for the reference cognito no
AWS_COGNITO_CLIENT_ID xxxxxxxxxxxx Client ID for the Auth Flow integrated with the Cognito User Pool no
AWS_COGNITO_AUTH_FLOW USER_PASSWORD_AUTH Auth flow used by reference cognito deployment no
AWS_COGNITO_AUTH_PARAMS_USER int-test-user@testing.com Int Test Username no
AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS no-access-user@testing.com Int Test No Access Username no
AWS_COGNITO_AUTH_PARAMS_PASSWORD some-secure-password Int Test User/NoAccessUser Password yes
ENVIRONMENT DEV or LOCAL set to DEV for deployed service testing or local for local testing no
SUBSCRIBER_SECRET 02030********** sensitive secret to run HMAC tests yes
REGISTER_BASE_URL http://localhost:8080/ or https:deployed-url specify url of register service. no
REGISTER_CUSTOM_PUSH_PATH api/register/v1/awstest/aws/challenge Custom Push Path for subscription testing no
REGISTER_CUSTOM_PUSH_PATH1 api/register/v1/awstest/aws/challenge/1 Custom Push Path for subscription testing no
REGISTER_CUSTOM_PUSH_URL value of $REGISTER_BASE_URL$REGISTER_CUSTOM_PUSH_PATH Custom Push url for subscription testing no
REGISTER_CUSTOM_PUSH_URL1 value of $REGISTER_BASE_URL$REGISTER_CUSTOM_PUSH_PATH Custom Push url for subscription testing no

Creating a new user to use for integration tests

aws cognito-idp admin-create-user --user-pool-id ${AWS_COGNITO_USER_POOL_ID} --username ${AWS_COGNITO_AUTH_PARAMS_USER} --user-attributes Name=email,Value=${AWS_COGNITO_AUTH_PARAMS_USER} Name=email_verified,Value=True --message-action SUPPRESS

aws cognito-idp initiate-auth --auth-flow ${AWS_COGNITO_AUTH_FLOW} --client-id ${AWS_COGNITO_CLIENT_ID} --auth-parameters USERNAME=${AWS_COGNITO_AUTH_PARAMS_USER},PASSWORD=${AWS_COGNITO_AUTH_PARAMS_PASSWORD}

Entitlements group configuration for integration accounts
In order to add user entitlements, run entitlements bootstrap scripts in the entitlements project

AWS_COGNITO_AUTH_PARAMS_USER AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS
service.entitlements.user service.entitlements.user
users.datalake.viewers
users.datalake.editors
users.datalake.admins
users.datalake.ops
cron.job

Execute following command to build code and run all the integration tests:

Run Tests simulating Pipeline

  • Prior to running tests, scripts must be executed locally to generate pipeline env vars
testing/register-test-aws/build-aws/prepare-dist.sh

#Set Neccessary ENV Vars here as defined in run-tests.sh

dist/testing/integration/build-aws/run-tests.sh 

Run Tests using mvn

Set required env vars and execute the following:

mvn clean package -f testing/pom.xml -pl register-test-core,register-test-aws -DskipTests
mvn test -f testing/register-test-aws/pom.xml

License

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

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.