Skip to content

Commit

Permalink
chore(release): v0.0.24 (#58)
Browse files Browse the repository at this point in the history
* chore(release): 0.0.13

* feat: Normalize method responses (#36)

* chore(release): 0.0.14

* chore: JSON library (#37)

* chore: Add org.json dependency

* chore: Add JSON usage example

* chore(release): 0.0.15

* feat: Config from env vars (#38)

* feat: Get conf from env vars

* docs: Add CLI.md document

* docs: Link docs in README

* feat: Add default ENV vars to Dockerfile for convenience

* fix: Change worker RMI default port

* chore(release): 0.0.16

* feat: adding register implementation and some changes in .gitignore (#35)

* feat: adding register implementation and some changes in .gitignore

* fix: fixing format inconsistencies

* feat: changing and upgrading res in success

* fix: upgrading requests and responses

* fix: changing parameter from pass to password

* fix: changing url format

* fix: clang format

* fix: True on success

* fix: Use Config class for env vars

---------

Co-authored-by: woynert

* chore(release): 0.0.17

* Feat login (#40)

* Feat login without tests

* Apply formatting

* chore(release): 0.0.18

* docs: SOAP OpenAPI specification (#41)

* docs: Add open api specification

* docs: Add API definition to README.md

* docs: Improve CLI.md examples

* refactor: Redesign request / response types

* chore: Update python sample client

* chore: Update submodule

* chore: Use error instead of success

* chore: Apply requested changes

* chore(release): 0.0.19

* feat: Upload File, Tests, Restructure (#42)

* feat: createFile handler

* fix: Use byte primitive

* chore: Remove RMI demo from App.java

* chore: apply clang-format

* feat: Abstract rmi connection

* chore: Update rmi lib

* chore: Utils package

* feat: Auth abstraction

* feat: Authenticate jwt on upload file

* feat: Get user's UUID

* feat: Get file mimetype from bytes

* fix: Make metadata & auth services use a single postgres instance

* feat: Pre declare userUUID

* fix: Get userUUID from token

* docs: Update env vars default values

* feat(upload-file): save metadata

* fix: ManagerRMI interface import

* chore: Remove debug msgs

* refactor: Switch SOAP data types sufix to prefix

* chore: Remove debug msgs

* chore: Update RMI submodule

* refactor: Redesign request / response types

* fix: Adapt current service implementation with new interface design

* docs: Add open api specification

* docs: Add API definition to README.md

* docs: Improve CLI.md examples

* refactor: Redesign request / response types

* chore: Update python sample client

* chore: Update submodule

* chore: update submodule

* fix: Typo in request type

* feat(upload-file): Add file size limits

* chore: Use error instead of success

* fix: Simplify http requests

* refactor: External services: Managers to Services

* refactor: Separate SOAP request handlers as controllers

* chore: Add http codes to auth method

* feat: Add http codes to Metadata save file

* feat: Better http code handling

* feat: Add ResStatus generic downcast support

* feat: Validate field types

* feat: Adapt getUserUUID method to a ResStatus response

* test: Test util to tweak configurations

* fix: controller exit codes

* test: Authorization service abstraction

* test: FileIO upload-file

* docs: Update README & API spec

* test: show realtime std, err on tests execution

* feat: update python client demo

* chore: Update docker compose with worker service & adminer

* docs: Update default MetadataURI env var

* chore: Use worker release image

* ci: Fix workflows: testing, coverage

* fix: Do not assume api sufix

* fix: Exclude tests on Dockerfile build

* chore(release): 0.0.20

* Update login and Add tests (#47)

* Updeate return code and test

* Fixes Implemented

* fix: Update RMI module

* Fix Format

* Fix

* Test: update message

---------

Co-authored-by: woynert <[email protected]>

* chore(release): 0.0.21

* feat: download file (#46)

* feat: createFile handler

* fix: Use byte primitive

* chore: Remove RMI demo from App.java

* chore: apply clang-format

* feat: Abstract rmi connection

* chore: Update rmi lib

* chore: Utils package

* feat: Auth abstraction

* feat: Authenticate jwt on upload file

* feat: Get user's UUID

* feat: Get file mimetype from bytes

* fix: Make metadata & auth services use a single postgres instance

* feat: Pre declare userUUID

* fix: Get userUUID from token

* docs: Update env vars default values

* feat(upload-file): save metadata

* fix: ManagerRMI interface import

* chore: Remove debug msgs

* refactor: Switch SOAP data types sufix to prefix

* chore: Remove debug msgs

* chore: Update RMI submodule

* refactor: Redesign request / response types

* fix: Adapt current service implementation with new interface design

* docs: Add open api specification

* docs: Add API definition to README.md

* docs: Improve CLI.md examples

* refactor: Redesign request / response types

* chore: Update python sample client

* chore: Update submodule

* chore: update submodule

* fix: Typo in request type

* feat(upload-file): Add file size limits

* chore: Use error instead of success

* fix: Simplify http requests

* refactor: External services: Managers to Services

* refactor: Separate SOAP request handlers as controllers

* chore: Add http codes to auth method

* feat: Add http codes to Metadata save file

* feat: Better http code handling

* feat: Add ResStatus generic downcast support

* feat: Validate field types

* feat: Adapt getUserUUID method to a ResStatus response

* test: Test util to tweak configurations

* fix: controller exit codes

* test: Authorization service abstraction

* test: FileIO upload-file

* docs: Update README & API spec

* test: show realtime std, err on tests execution

* feat: update python client demo

* chore: Update docker compose with worker service & adminer

* docs: Update default MetadataURI env var

* chore: Use worker release image

* ci: Fix workflows: testing, coverage

* fix: Do not assume api sufix

* fix: Exclude tests on Dockerfile build

* chore: Update RMI types to use UUID

* feat(ServiceMetadata): canRead wrapper added

* feat(ServiceMetadata): getFileMetadata wrapper added

* chore: update fileDownload res/req types

* feat: fileDownload service implementation

* chore: Add RMI Streaming library

* feat(fileDownload): Add 404 code case

* fix: Login return code

* test: Add new ASCII generator

* test: Update uploadFile test to save relevant data for other tests

* test: Add fileDownload tests

* chore: Remove debug messages & unclutter test output

* fix: Add workaround issue Metadata#74

* chore: increase buffer size for data streaming

* chore: update submodule

* feat: Update demo python SOAP client

* fix: Nullable extension result

* fix: Give time for file to finish uploading before next test

* ci: run test workflows on PRs against main

* chore: Improve cli client (#55)

* refactor: Make cli client reusable
---------

Co-authored-by: woynert <[email protected]>

---------

Co-authored-by: Pedro Andrés Chaparro Quintero <[email protected]>

* chore(release): 0.0.22

* chore(release): 0.0.23

* feat: file check ready (#57)

* fix: Remove duplicated uri chained method

* feat: add file check controller implementation

* test: add file_check tests

* feat: make format script default to write

* feat: use serviceMetadata existing implementation for fileCheck

* test(file check): add tests for case 400 and 401

* style: apply clang-format

* chore(release): 0.0.24

---------

Co-authored-by: Antonio Donis <[email protected]>
Co-authored-by: Silvia Pabón <[email protected]>
Co-authored-by: Andres David Bonilla Higuera <[email protected]>
Co-authored-by: Pedro Andrés Chaparro Quintero <[email protected]>
  • Loading branch information
5 people authored Oct 3, 2023
1 parent 0ba73d1 commit 59506eb
Show file tree
Hide file tree
Showing 45 changed files with 1,448 additions and 220 deletions.
25 changes: 25 additions & 0 deletions .docker-psql-mult-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# source
# - https://github.com/mrts/docker-postgresql-multiple-databases

set -e
set -u

function create_user_and_database() {
local database=$1
echo " Creating user and database '$database'"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER $database;
CREATE DATABASE $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $database;
EOSQL
}

if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
create_user_and_database $db
done
echo "Multiple databases created"
fi
9 changes: 7 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
distribution: "adopt"
java-version: "11"

- name: Set up docker environment
run: docker compose up -d

- name: Test
run: chmod +x ./gradlew && ./gradlew testCodeCoverageReport

- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./app/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
fail_ci_if_error: true

- name: Clean docker environment
run: docker compose down --rmi all -v --remove-orphans
3 changes: 1 addition & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Format

on:
pull_request:
branches: ["dev"]
branches: ["dev", "main"]

jobs:
formatter:
Expand All @@ -14,4 +14,3 @@ jobs:

- name: Clang check
run: chmod +x ./format.sh && ./format.sh clang-check

2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
release_name: Release ${{ needs.versioning.outputs.version }}
draft: false
prerelease: false

build-docker:
runs-on: ubuntu-latest
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tagging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
- name: Changelog
run: 'npx standard-version --message "[ci skip] chore(release): %s"'
- name: Push changes
run: git push --follow-tags --force origin dev
run: git push --follow-tags --force origin dev
20 changes: 13 additions & 7 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
pull_request:
branches: ["dev"]
branches: ["dev", "main"]

jobs:
build:
Expand All @@ -11,26 +11,32 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
distribution: "adopt"
java-version: "11"

- name: Build
run: chmod +x ./gradlew && ./gradlew build
run: chmod +x ./gradlew && ./gradlew build -x test

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
distribution: "adopt"
java-version: "11"

- name: Set up docker environment
run: docker compose up -d

- name: Test
run: chmod +x ./gradlew && ./gradlew test

- name: Clean docker environment
run: docker compose down --rmi all -v --remove-orphans
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,19 @@ node_modules
**bin/

# Ignore internal config staff about some IDEs
**.vscode/
**.vscode/

# python envs
pyenv
venv

# python cache
**/__pycache__

# JDTLS
bin
.settings
.classpath
.project
/workspace
/*/workspace
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 0.0.24 (2023-10-03)


### Features

* file check ready ([#57](https://github.com/hawks-atlanta/gateway-java/issues/57)) ([20f12ba](https://github.com/hawks-atlanta/gateway-java/commit/20f12bad87cd0e1f273c1d0d2d58072ca23803c9))

### 0.0.23 (2023-10-03)

### 0.0.22 (2023-10-03)


### Features

* download file ([#46](https://github.com/hawks-atlanta/gateway-java/issues/46)) ([0d2eaa1](https://github.com/hawks-atlanta/gateway-java/commit/0d2eaa11f2c0149e6cf29a93a5e2b65348f9f2e4)), closes [Metadata#74](https://github.com/hawks-atlanta/Metadata/issues/74) [#55](https://github.com/hawks-atlanta/gateway-java/issues/55)

### 0.0.21 (2023-10-01)

### 0.0.20 (2023-09-28)


### Features

* Upload File, Tests, Restructure ([#42](https://github.com/hawks-atlanta/gateway-java/issues/42)) ([5a80939](https://github.com/hawks-atlanta/gateway-java/commit/5a809393b6107344e020df49cbbbe9677b3d350a))

### 0.0.19 (2023-09-23)

### 0.0.18 (2023-09-23)
Expand Down
12 changes: 6 additions & 6 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ This document describes how to use the service as a CLI tool.

## Environment variables

| Variable | Description | Example |
|--------------------------|-----------------------------|-------------------------|
| `AUTHENTICATION_BASEURL` | Authentication service host | `http://127.0.0.1:8081` |
| `METADATA_BASEURL` | Metadata service host | `http://127.0.0.1:8082` |
| `WORKER_HOST` | Worker service host | `127.0.0.1` |
| `WORKER_PORT` | Worker service RMI port | `1099` |
| Variable | Description | Example |
|--------------------------|-----------------------------|--------------------------------|
| `AUTHENTICATION_BASEURL` | Authentication service host | `http://127.0.0.1:8081/api/v1` |
| `METADATA_BASEURL` | Metadata service host | `http://127.0.0.1:8082` |
| `WORKER_HOST` | Worker service host | `127.0.0.1` |
| `WORKER_PORT` | Worker service RMI port | `1099` |
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM adoptopenjdk/openjdk11:x86_64-alpine-jdk-11.0.20_8-slim as builder
COPY . /src
WORKDIR /src

RUN ./gradlew build
RUN ./gradlew build -x test

# runner

Expand All @@ -14,8 +14,8 @@ FROM adoptopenjdk/openjdk11:x86_64-alpine-jre-11.0.20_8
COPY --from=builder /src/app/build/libs/app-all.jar /opt/app.jar

EXPOSE 8080/tcp
ENV AUTHENTICATION_BASEURL "127.0.0.1"
ENV METADATA_BASEURL "127.0.0.1"
ENV AUTHENTICATION_BASEURL "http://127.0.0.1:8081/api/v1"
ENV METADATA_BASEURL "http://127.0.0.1:8082"
ENV WORKER_HOST "127.0.0.1"
ENV WORKER_PORT "1099"

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ git submodule update --init
- (Optional) Use the **gradle wrapper script** (`./gradlew`) for all `gradle` commands. For example:

```sh
./gradlew build
./gradlew run
```

- (Optional) Use the provided `nix-shell` to get into a shell with all required dependecies [[install Nix](https://nixos.org/download)].
Expand All @@ -53,7 +53,18 @@ gradle run
### Run tests

```sh
gradle test
gradle test # only run tests
gradle testCodeCoverageReport # run tests & generate coverage
# rerun tests
gradle cleanTest test
gradle cleanTest testCodeCoverageReport
```

See test results
```sh
app/build/reports/tests/test/index.html # general
app/build/reports/jacoco/testCodeCoverageReport/html/index.html # coverage
```

### Format
Expand Down
47 changes: 45 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
Expand Down Expand Up @@ -28,6 +31,21 @@ dependencies {
// https://mvnrepository.com/artifact/org.json/json
implementation 'org.json:json:20230618'

// JWT
implementation 'com.auth0:java-jwt:4.4.0'

// RMI remote stream
// https://mvnrepository.com/artifact/com.healthmarketscience.rmiio/rmiio
implementation 'com.healthmarketscience.rmiio:rmiio:2.1.2'

// --- Validator lib ---

// https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator
implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final'

// https://mvnrepository.com/artifact/org.glassfish.expressly/expressly
implementation 'org.glassfish.expressly:expressly:5.0.0'

// --- SOAP service ---

// https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api
Expand All @@ -42,7 +60,7 @@ dependencies {
// ---

// Use subproject
implementation project(':capyfile.rmi.interfaces')
implementation project(':capyfile.rmi')

}

Expand All @@ -59,6 +77,31 @@ application {
}

tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()

testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true

// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
}
1 change: 0 additions & 1 deletion app/src/main/java/gateway/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static void main (String[] args)

// serve SOAP
System.out.println ("Gateway: Starting SOAP");

Endpoint.publish ("http://0.0.0.0:8080/service", new ServiceImp ());
}
}
11 changes: 10 additions & 1 deletion app/src/main/java/gateway/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

public class Config
{
// const

public static final int MAX_FILE_SIZE = 100000000; // 100 MB

private static String authBaseUrl;
private static String metadataBaseUrl;
private static String workerHost;
Expand All @@ -12,12 +16,17 @@ public class Config
public static String getWorkerHost () { return workerHost; }
public static int getWorkerPort () { return workerPort; }

public static void setAuthBaseUrl (String v) { authBaseUrl = v; }
public static void setMetadataBaseUrl (String v) { metadataBaseUrl = v; }
public static void setWorkerHost (String v) { workerHost = v; }
public static void setWorkerPort (int v) { workerPort = v; }

public static void initializeFromEnv ()
{
authBaseUrl =
System.getenv ().getOrDefault ("AUTHENTICATION_BASEURL", "http://127.0.0.1:8081");
metadataBaseUrl =
System.getenv ().getOrDefault ("METADATA_BASEURL", "http://127.0.0.1:8082");
System.getenv ().getOrDefault ("METADATA_BASEURL", "http://127.0.0.1:8082/api/v1");
workerHost = System.getenv ().getOrDefault ("WORKER_HOST", "127.0.0.1");
workerPort = Integer.parseInt (System.getenv ().getOrDefault ("WORKER_PORT", "1099"));
}
Expand Down
Loading

0 comments on commit 59506eb

Please sign in to comment.