Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ test.txt
.vscode
authentication-demo-ui/keys/

# Local / IDE (Eclipse, STS, IntelliJ)
# Local run artifacts (run-local) and IDEs (Eclipse, STS, IntelliJ)
.local/
.local
**/.local/
.idea/
.idea
**/.idea/
.classpath
.project
.settings/
*/.classpath
*/.project
*/.settings/
**/.classpath
**/.project
**/.settings/
.sts4-cache/
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ mosip-ref-impl/
│ ├── kernel-smsserviceprovider-msg91/ SMS SPI → AGENTS.md
│ └── kernel-virusscanner-clamav/ VirusScanner → AGENTS.md
├── keycloak/ login FTL → AGENTS.md
├── pre-registration-booking-service/ /appointment/** → AGENTS.md
├── pre-registration-booking-service/ /appointment/** run-local → AGENTS.md
├── registration-processor/ registration-processor-ref-parent → AGENTS.md
│ ├── registration-processor-external-stage/ Vert.x → EIS → AGENTS.md
│ └── registration-processor-external-integration-service/ EIS stub REST → AGENTS.md
│ ├── registration-processor-external-stage/ Vert.x → EIS run-local → AGENTS.md
│ └── registration-processor-external-integration-service/ EIS stub REST run-local → AGENTS.md
├── helm/prereg-booking/ javaOpts → JDK_JAVA_OPTIONS → AGENTS.md
├── licenses/ NOTICE texts
├── .github/ CI; never read keys/ → AGENTS.md
Expand Down
136 changes: 133 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ There is **no repo-root POM** and **no `kernel-bom`**. Standalone modules parent
- [Prerequisites](#prerequisites)
- [Shared facts](#shared-facts)
- [Build](#build)
- [Local testing (run-local)](#local-testing-run-local)
- [Tests and coverage](#tests-and-coverage)
- [Configuration](#configuration)
- [Swagger UI (Authorize)](#swagger-ui-authorize)
Expand Down Expand Up @@ -92,7 +93,7 @@ Each module has its own `README.md` with artifact id, build, config, and (where
| Docker | latest stable (optional) |
| PostgreSQL | **16.0** (booking / MOSIP stack) |
| Keycloak | [mosip/keycloak](https://github.com/mosip/keycloak/tree/master) |
| Spring Cloud Config | required for services (see [Configuration](#configuration)) |
| Spring Cloud Config | required **on cluster** (see [Configuration](#configuration)). Laptop smoke uses profile `local` — see [Local testing (run-local)](#local-testing-run-local) |

### Runtime JARs for services

Expand Down Expand Up @@ -137,12 +138,141 @@ Run a single test class:
mvn test -Dtest=ClassName[#method]
```

Start a Boot service from the IDE (`BookingApplication`, `ExternalIntegrationServiceApplication`) or:
For a laptop process **without** config-server, use the module `run-local` scripts (next section). Cluster / Docker still starts the JAR with the Dockerfile config-server flags and **does not** activate profile `local`.

## Local testing (run-local)

The three runnable services ship the same command shape as commons `kernel-notification-service`: `init`, `start`, `smoke`, `stop`, `test`, `all`. Each module keeps laptop-only settings in `src/main/resources/application-local.properties` and activates them with **`-Dspring.profiles.active=local`**. Packaged `bootstrap.properties` is unchanged. Dockerfiles still pass `spring_config_url_env` / `active_profile_env` / config label — they never set profile `local`, so a cluster node does not read these files.

Artifacts, PIDs, and logs go under each module’s `.local/` (gitignored).

### Prerequisites

- JDK **21** and Maven **3.9.6** on `PATH`
- `curl` on Windows `smoke` (Git for Windows / Windows 10+). Linux/macOS smoke also accepts `python3`
- Unpublished MOSIP SNAPSHOTs installed locally if they are not on Central (booking: `pre-registration-core`; external-stage: `registration-processor-core`, status-service-impl, rest-client)

### Commands (same on every module)

| Command | What it does |
|---|---|
| `init` | Stops a leftover process, then `mvn clean package` (skip tests, skip GPG/Javadoc) |
| `test` | `mvn test` for that module |
| `start` | `java -jar` with profile `local`, waits until ready, prints URLs |
| `smoke` | HTTP checks (health + OpenAPI for Boot services) |
| `stop` | Kills the PID recorded under `.local/pids/` |
| `all` | `init` + `test` + `start` + `smoke` |

Windows **cmd** (not PowerShell as the entrypoint): `run-local.bat <command>`. Linux / macOS / Git Bash: `chmod +x run-local.sh` once, then `./run-local.sh <command>`.

### pre-registration-booking-service

Standalone Boot app (run Maven **in this folder**). In-memory **H2**; masterdata / demographic / notification URLs are stubs. Method security is off; tokens are not validated against IAM.

```text
cd pre-registration-booking-service
run-local.bat all
```

```text
cd pre-registration-booking-service
./run-local.sh all
```

| | |
|---|---|
| Port | **9095** (`BOOKING_PORT`) |
| Context | `/preregistration/v1` |
| Health | `http://127.0.0.1:9095/preregistration/v1/actuator/health` |
| Swagger | `http://127.0.0.1:9095/preregistration/v1/appointment/booking-service/swagger-ui.html` |
| OpenAPI | `http://127.0.0.1:9095/preregistration/v1/appointment/booking-service/v3/api-docs` |
| Properties | `src/main/resources/application-local.properties` |
| Logs / PID | `.local/logs/booking.log`, `.local/pids/booking.pid` |

Step by step: `run-local.bat init` then `start` then `smoke`. `stop` when finished. Override the port with `set BOOKING_PORT=9195` (cmd) or `BOOKING_PORT=9195 ./run-local.sh start`.

### registration-processor-external-integration-service

Country EIS stub. Maven runs from `registration-processor/` with `-pl registration-processor-external-integration-service`.

```text
cd registration-processor/registration-processor-external-integration-service
run-local.bat all
```

```text
cd registration-processor/registration-processor-external-integration-service
./run-local.sh all
```

| | |
|---|---|
| Port | **8201** (`EIS_PORT`) |
| Servlet path | `/registrationprocessor/v1/eis` |
| Health | `http://127.0.0.1:8201/registrationprocessor/v1/eis/actuator/health` |
| Swagger | `http://127.0.0.1:8201/registrationprocessor/v1/eis/swagger-ui.html` |
| OpenAPI | `http://127.0.0.1:8201/registrationprocessor/v1/eis/v3/api-docs` |
| Stub POST | `http://127.0.0.1:8201/registrationprocessor/v1/eis/registration-processor/external-integration-service/v1.0` |
| Properties | `src/main/resources/application-local.properties` |
| Logs / PID | `.local/logs/eis.log`, `.local/pids/eis.pid` |

`smoke` checks health and OpenAPI. To hit the stub yourself:

```text
curl -sS -H "Content-Type: application/json" -d "{\"id\":\"io.mosip.registrationprocessor\",\"version\":\"1.0\",\"request\":[\"10002100770001520240708000001\"]}" http://127.0.0.1:8201/registrationprocessor/v1/eis/registration-processor/external-integration-service/v1.0
```

A non-null `request` body returns `true`.

### registration-processor-external-stage

Vert.x stage (`ExternalStageApplication`), not a servlet Boot app. Maven runs from `registration-processor/` with `-pl registration-processor-external-stage -am`. `start` loads `application-local.properties` only when profile `local` is set (the main class registers that file because there is no `SpringApplication`).

```text
cd registration-processor/registration-processor-external-stage
run-local.bat init
run-local.bat test
run-local.bat start
run-local.bat smoke
run-local.bat stop
```

```text
java -jar target/<artifact>-1.4.1-SNAPSHOT.jar
cd registration-processor/registration-processor-external-stage
./run-local.sh init
./run-local.sh test
./run-local.sh start
./run-local.sh smoke
./run-local.sh stop
```

`run-local.bat all` is init + test + start + smoke.

| | |
|---|---|
| HTTP port | **8095** (`STAGE_PORT`) |
| Eventbus | **5736** |
| Servlet path | `/registrationprocessor/v1/external` |
| Health | `http://127.0.0.1:8095/registrationprocessor/v1/external/actuator/health` |
| Properties | `src/main/resources/application-local.properties` |
| Logs / PID | `.local/logs/external-stage.log`, `.local/pids/external-stage.pid` |

**`init` and `test`** are the reliable laptop checks (unit tests mock Vert.x / EIS). **`start` / `smoke` / `all`** try to boot the real stage without config-server (`ConfigPropertyReader` / Vert.x SpringConfigServerStore are skipped). Packet processing still needs Kafka, registration-status DB, and a running EIS. If MOSIP status beans cannot load, the process prints `EXTERNAL_STAGE_STARTUP_FAILED` and exits (scripts no longer wait 120s). Use `test` for CI-style verification.

`smoke` accepts Actuator 200 if present, otherwise a listening HTTP port or the `Started ExternalStageApplication` log line (this stage does not publish Springdoc).

### What local vs cluster uses

| | Laptop `run-local` | Cluster / Docker |
|---|---|---|
| Profile | `local` | `active_profile_env` (typically `default` / env name) |
| Config | `application-local.properties` + `-Dspring.cloud.config.enabled=false` | Config server URI/label/name from the Dockerfile `CMD` |
| Booking DB | H2 in-memory | PostgreSQL from MOSIP config |
| IAM / issuer | Offline token validation; no Eureka lookup of IAM | Config-server IAM URLs |
| Artifacts | `.local/` | container logs |

Do not copy `application-local.properties` keys into `bootstrap.properties`. Do not activate profile `local` in Helm or the Dockerfile.

## Tests and coverage

`mvn clean verify` runs tests, writes JaCoCo HTML at `target/site/jacoco/index.html`, and enforces **LINE covered ratio 0.90** (`jacoco-check`), using the same package excludes as `sonar.coverage.exclusions`.
Expand Down
4 changes: 2 additions & 2 deletions pre-registration-booking-service/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```
pre-registration-booking-service/
├── pom.xml Dockerfile README.md AGENTS.md
├── pom.xml Dockerfile README.md AGENTS.md run-local.bat run-local.sh
└── src/
├── main/java/io/mosip/preregistration/booking/
│ ├── BookingApplication.java
Expand All @@ -19,7 +19,7 @@ pre-registration-booking-service/
│ ├── errorcodes/ErrorCodes.java ErrorMessages.java
│ ├── dto/
│ └── exception/ util/BookingExceptionCatcher.java BookingExceptionHandler.java
├── main/resources/ bootstrap.properties logback.xml
├── main/resources/ bootstrap.properties application-local.properties logback.xml
└── test/
├── java/.../booking/config/BookingApplicationComponentScanTest.java BookingConfigOpenApiTest.java
├── java/.../booking/test/BookingApplicationTest.java
Expand Down
33 changes: 30 additions & 3 deletions pre-registration-booking-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,33 @@ Refer to the required released tagged version [SQL scripts](https://github.com/m

- JDK **21.0.3**
- Maven **3.9.6**
- Spring Cloud Config server (see Configuration)
- PostgreSQL 16 (typical MOSIP stack)
- Cluster: Spring Cloud Config + PostgreSQL 16. Laptop: `run-local` (H2, no config-server)

## Local testing (run-local)

Laptop runner (same commands as commons `kernel-notification-service`). Profile **`local`** reads `src/main/resources/application-local.properties` (H2, config-server off). Cluster Docker does **not** set this profile.

Windows cmd:

```text
cd pre-registration-booking-service
run-local.bat init
run-local.bat test
run-local.bat start
run-local.bat smoke
run-local.bat stop
```

`run-local.bat all` is init + test + start + smoke. Linux / macOS / Git Bash: `./run-local.sh <command>`.

| | |
|---|---|
| Port | `9095` (`BOOKING_PORT`) |
| Health | `http://127.0.0.1:9095/preregistration/v1/actuator/health` |
| Swagger | `http://127.0.0.1:9095/preregistration/v1/appointment/booking-service/swagger-ui.html` |
| Logs | `.local/logs/booking.log` (gitignored) |

Full command table: [repo README — Local testing](../README.md#local-testing-run-local).

## Build & run (for developers)

Expand All @@ -31,12 +56,14 @@ cd pre-registration-booking-service
mvn clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true
```

Run `BookingApplication` from the IDE or:
Cluster-style JAR (expects config-server via `bootstrap.properties` / Docker env):

```text
java -jar target/pre-registration-booking-service-1.4.1-SNAPSHOT.jar
```

Or run `BookingApplication` from the IDE. For a laptop process without config-server, use `run-local` above.

### Docker

```text
Expand Down
2 changes: 1 addition & 1 deletion pre-registration-booking-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
<scope>runtime</scope>
</dependency>
<!--
h2: In-memory DB for tests. Version from Boot parent.
h2: Tests and profile local (run-local). Version from Boot parent.
-->
<dependency>
<groupId>com.h2database</groupId>
Expand Down
Loading
Loading