konveyor / tackle-pathfinder

Tackle Pathfinder application
Apache License 2.0
16 stars 23 forks source link

Tackle-244 Add applicationId to the Landscape report #92

Closed jonathanvila closed 3 years ago

jonathanvila commented 3 years ago

Issue : https://github.com/konveyor/tackle-pathfinder/issues/89

In order to test :

  1. clone the code and cd into it
  2. execute a pathfinder_db and keycloak
podman run -ti --name keycloak --rm \
            -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e KEYCLOAK_IMPORT=/tmp/keycloak/quarkus-realm.json \
            -e DB_VENDOR=h2 -p 8180:8080 -p 8543:8443 -v ./src/main/resources/keycloak:/tmp/keycloak:Z \
            jboss/keycloak:12.0.2
podman run -it \                                 
            --name postgres-pathfinder -e POSTGRES_USER=pathfinder \
            -e POSTGRES_PASSWORD=pathfinder -e POSTGRES_DB=pathfinder_db \
            -p 5433:5432 postgres:10.6
  1. execute the application in dev mode mvn quarkus:dev
  2. there's a convenient SQL script ( db/test-data/V0.0.4_001.1__insert_translations.sql ) that can be executed in the DB
    
    podman exec -it postgres-pathfinder /usr/bin/psql pathfinder_db -U pathfinder -c "$(cat src/main/resources/db/test-data/V0.0.4_001.1__insert_translations.sql)"
5. execute the check_api.sh

.github/scripts/check_api.sh localhost:8085 localhost:8180

6.  obtain the token

export access_token=$(curl -X POST "http://localhost:8180/auth/realms/quarkus/protocol/openid-connect/token" \ --user backend-service:secret \ -H 'content-type: application/x-www-form-urlencoded' \ -d 'username=alice&password=alice&grant_type=password' | jq --raw-output '.access_token')


7. obtain landscape report and check field applicationId is included

curl "http://localhost:8085/pathfinder/assessments/assessment-risk" \ -H 'Accept: application/json' \ -H "Authorization: Bearer $access_token" -w "%{http_code}" \ -d "[{\"applicationId\":325100},{\"applicationId\":998899}]" \ -H 'Content-Type: application/json'