The main goals of the Spatial Reference Catalog service are to offer
-*Coordinate Reference Systems* (CRSs) to enable end-users to
make a CRS selection.
- Search for CRSs given a number of constraints.
- Download of the entire catalog for local caching and when the cache
has to be refreshed.
- Access to various sub-sets of the catalog.
- Once a CRS is found, produce a persistable reference to be stored with
the data, which fully describes the CRS; this persistable reference string
becomes catalog independent. This means any consumer will be able to
understand the CRS definition even if a different catalog is used in the
future context.
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| `SERVER_SERVLET_CONTEXPATH` | `/api/crs/catalog/` | CRS Catalog service context path | no | - |
| `osdu.entitlement.url` | ex `https://entitlements.com/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment |
| `osdu.crs.catalog.filename` | ex `C:\\osdu-delfi\\os-crs-catalog-service\\data\\crs_catalog_v2.json` | Crs Catalog V2 file | no | output of infrastructure deployment |
| `CRS_CATALOG_HOSTNAME` | ex `os-crs-catalog-dot-opendes.appspot.com` | CRS Catalog host| no | output of infrastructure deployment |
| `AUDIENCES` | ex `*****.apps.googleusercontent.com` | Client ID for getting access to cloud resources | yes | https://console.cloud.google.com/apis/credentials |
| `PROJECT_ID` | ex `opendes` | Google Cloud Project Id| no | output of infrastructure deployment |
<!-- Treat this auth token like a password. Do not share it with anyone, including Microsoft support. -->
<password>${VSTS_FEED_TOKEN}</password>
</server>
</servers>
</settings>
```
* Update the Google cloud SDK to the latest version:
```bash
gcloud components update
```
* Set Google Project Id:
```bash
gcloud config set project <YOUR-PROJECT-ID>
```
* Perform a basic authentication in the selected project:
```bash
gcloud auth application-default login
```
* Navigate to CRS Catalog service root folder and run:
```bash
mvn jetty:run
## Testing
* Navigate to CRS Catalog service root folder and run:
```bash
mvn clean install
```
* If you wish to see the coverage report then go to testing/target/site/jacoco-aggregate and open index.html
* If you wish to build the project without running tests
```bash
mvn clean install -DskipTests
```
After configuring your environment as specified above, you can follow these steps to build and run the application. These steps should be invoked from the *repository root.*
```bash
cd provider/crs-catalog-gcp/crs-catalog-gke/ && mvn spring-boot:run
```
## Testing
Navigate to CRS Catalog service root folder and run all the tests:
```bash
# build + test + install core service code
$ (cd crs-catalog-core/ && mvn clean install)
```
## Test the application
After the service has started it should be accessible via a web browser by visiting [http://localhost:8080/api/crs/catalog/swagger-ui.html](http://localhost:8080/api/crs/catalog/swagger-ui.html). If the request does not fail, you can then run the integration tests.
### Running E2E Tests
This section describes how to run cloud OSDU E2E tests (testing/catalog_test_gcp/jwt_client.py).
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `INTEGRATION_TESTER` | `********` | A base64 encoded google service account json credentials authorization for OSDU services | yes | output of infrastructure deployment |
| `GOOGLE_AUDIENCES` | ex `*****.apps.googleusercontent.com` | Client ID for getting access to cloud resources | yes | https://console.cloud.google.com/apis/credentials |
Execute following command to build code and run all the integration tests:
## Building/running
This integration test uses a swagger generated Python client to test a
deployed crs-catalog service.
The python client code is automatically generated. The latest online version (May 2018)
created incorrect impost statements for cyclic class references. Therefore the current
code is generated using [swagger-codegen-cli-2.2.3.jar](http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar).
cd catalog_test_$PROVIDER_NAME/ # e.g. catalog_test_sauth
```
To set up a virtual environment:
```bash
virtualenv venv
```
To activate the venv:
```bash
venv\Scripts\activate (on Windows)
source venv/bin/activate (on Linux)
```
Install runtime dependencies in venv
```bash
python3 -m pip install -r requirements.txt
```
To run:
```bash
python3 run_test.py
```
**Note:** To simulate a runtime exactly as that of the vsts build agent, you can simply exec into the docker image we use for the build agent, and run the tests from inside it. To know how to do this, please follow [this](https://slb-swt.visualstudio.com/data-at-rest/_git/dps-vsts-build-agent?path=%2FREADME.md&version=GBmaster) documentation.
## Deployment
See Google Documentation: https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-gke