REST API to support CALS Digital Service
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
config
docker-tests
docker
gradle/wrapper
jdl
jmeter
legal
mocks/tracking
release-notes
src
.gitignore
Dockerfile
Jenkinsfile-autotag.groovy
Jenkinsfile-cals-api-tests
Jenkinsfile-complete.groovy
Jenkinsfile-pull-request.groovy
LICENSE
README.md
build.gradle
entrypoint.sh
env.sample
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

CWDS CALS API

The CWDS CALS API provides RESTful services for the CWDS CALS Digital Service.

Wiki

The development team is actively using the Github Wiki.

Documentation

The development team uses Swagger for documenting the API. NOTE : At this time there is not a publicy available link to the documentation, a link will be provided as soon as one is available.

Configuration

Application Configuration Parameters

  • APP_VERSION -- Version of application

SSL Configuration Parameters

  • KEY_STORE_FILE -- Path to keystore file
  • KEY_STORE_PASSWORD -- Keystore password

Data Stores Configuration Parameters

The CWDS API currently utilizes four persistent stores:

In order for the CALS API successfully connect to the above databases the following environment variables are required to be set:

DB2 - CMS database

  • DB_CMS_USER -- the CMS database username

  • DB_CMS_PASSWORD -- the CMS database password

  • DB_CMS_JDBC_URL -- the CMS database URL in Java Database Connectivity format

  • DB_CMS_SCHEMA -- the CMS database schema the tables belong to.

  • DB_CMS_CP_MAX_SIZE -- the CMS connections pool maximum size (default: 8)

  • DB_CMS_RS_USER - the CMS RS database username

  • DB_CMS_RS_PASSWORD - the CMS RS database password

  • DB_CMS_RS_JDBC_URL - JDBC URL for CWS RS database

  • DB_CMS_RS_SCHEMA - schema name for CWS RS

  • DB_CMS_RS_CP_MAX_SIZE - the CMS connections pool maximum size (default: 8)

Postgres - NS database

Add to postgresql.conf on PostgeSQL server parameter max_prepared_connections to nonzero value, this property need to be set for XATransactions

  • DB_NS_USER -- the NS database username
  • DB_NS_PASSWORD -- the NS database password
  • DB_NS_JDBC_URL -- the NS database URL in Java Database Connectivity format
  • DB_NS_CP_MAX_SIZE -- the NS connections pool maximum size (default: 8)

CONNX - LIS database

Set environment variable CALS_API_CONFIG to cals-api-lis-connx.yml to run docker container with CONNX connection to LIS datasource

  • DB_LIS_USER -- the LIS datasource username
  • DB_LIS_PASSWORD -- the LIS datasource password
  • DB_LIS_JDBC_URL -- the LIS datasource URL in Java Database Connectivity format
  • DB_LIS_CP_MAX_SIZE -- the LIS connections pool maximum size (default: 8)

Postgres - FAS Legacy database

  • DB_FAS_USER -- the FAS datasource username
  • DB_FAS_PASSWORD -- the FAS datasource password
  • DB_FAS_JDBC_URL -- the FAS datasource URL in Java Database Connectivity format
  • DB_FAS_CP_MAX_SIZE -- the FAS connections pool maximum size (default: 8)
  • DB_FAS_DEFAULT_SCHEMA -- the FAS default database schema (default: public)

Upgarde Data Base on Start

  • UPGRADE_DB_ON_START -- if "true" then application starts Liquibase Scripts for upgrading DB to the latest state (default true)

DMS configuration

  • DMS_URI -- is URI to the Document Management System REST API.
  • PRELOAD_DMS_ON_START -- if "true" will try to load templates and mappings to dms on start ("false" by default)
  • DMS_TEMPLATES_BASE_DIR -- Base directory for templates and mappings files
  • CMIS_URL -- is URL to CMIS server
  • CMIS_USER -- cmis user name
  • CMIS_PASSWORD -- cmis user password
  • CMIS_REPOSITORY -- cmis repository name

Swagger Configuration Parameters**

Shiro Configuration Parameters

  • SHIRO_CONFIG_PATH -- path to Shiro configuration file
  • PERRY_VALIDATION_URL -- url of token validation endpoint of Perry

The Docker env-file option provides a convenient method to supply these variables. These instructions assume an env file called .env located in the current directory. The repository contains a sample env file called env.sample.

Further configuration options are available in the file config/cals-api.yml.

Testing

Integration testing

To run Integration tests set property cals.api.url to point to environment host. Use gradle integrationTest task. In this case token will be generated for default test user, so it's possible to test environment with Perry running in dev mode.

Smoke Testing

Smoke test suite is part of integration tests. Set cals.api.url, use gradle smokeTestSuite task. Smoke test endpoint is not protected by Perry.

Performance/Load testing (JMeter)

JMeter tests are part of the CALS-API project as jmx files

To run the tests use gradle command: gradlew jmRun -DJM_PROPERTY_1=VALUE_1 -DJM_PROPERTY_2=VALUE_2 ...

List of supported properties:

  • JM_IDP -- Type of identity provider may be perryDevMode or cognito

Perry properties

  • JM_PERRY_PROTOCOL -- Perry protocol, default - https
  • JM_PERRY_HOST -- Perry host, no default value
  • JM_PERRY_PORT -- Perry port, default - 443

Credentials for IDP (do not use for perryDevMode)

  • JM_USER_NAME -- User name
  • JM_USER_PASSWORD -- User password

Cals-API properties

  • JM_CALS_API_PROTOCOL -- Cals-API protocol, default - https
  • JM_CALS_API_HOST -- Cals-API host, no default value
  • JM_CALS_API_PORT -- Cals-API port, default - 443

Path to file which contains list of IDs for the test

  • JM_IDS_FILE -- default value - facilities_ids.csv

jmeter/config.properties can be used for configuration.