Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9e5141f
Add MCP server support via POST /mcp endpoint (issue #12)
baubakg Apr 13, 2026
812c137
Fix Node.js 20 deprecation warning in GitHub Actions workflows
baubakg Apr 13, 2026
c39d959
Fix maven.config for Maven 4 compatibility
baubakg Apr 13, 2026
940d74e
Add MCP server documentation to README and ReleaseNotes
baubakg Apr 13, 2026
0f8c83d
Add MCP testing and integration guide (docs/MCP.md)
baubakg Apr 13, 2026
afc0f86
Add meaningful Javadoc to SimpleStaticMethods and ClassWithLogger
baubakg Apr 13, 2026
aea23c6
Surface Javadoc as MCP tool descriptions via therapi-runtime-javadoc
baubakg Apr 13, 2026
a0f6a0d
Document Javadoc embedding for external projects in docs/MCP.md
baubakg Apr 13, 2026
1f3674a
Add assertions that MCP tool descriptions come from Javadoc
baubakg Apr 13, 2026
9081abd
Update MCP.md examples to reflect Javadoc-sourced descriptions
baubakg Apr 13, 2026
640b301
Add Claude Code integration chapter to docs/MCP.md
baubakg Apr 13, 2026
565495d
Add IBS.MCP.REQUIRE_JAVADOC gate and MCP server naming guidance
baubakg Apr 14, 2026
2c57add
Migrate Sonatype publishing from oss.sonatype.org to central.sonatype…
baubakg Apr 14, 2026
226a716
Fix testExternalErrorCall stack trace line number after Javadoc addit…
baubakg Apr 14, 2026
cf9c46f
Pin GitHub Actions to full commit SHAs (Sonar S7637)
baubakg Apr 14, 2026
e591411
Bump major version to 3.11.0-SNAPSHOT
baubakg Apr 14, 2026
b24aaea
Fix snapshot repository URL for Sonatype Central migration
baubakg Apr 14, 2026
23566d5
Add MCP prechain, rich error payloads, and callContent string unwrapping
baubakg Apr 14, 2026
817e794
Add ibs-env-* header injection for MCP environment variables
baubakg Apr 14, 2026
b3a20de
Simplify MCP env var injection in invokeDiscoveredTool
baubakg Apr 15, 2026
985cd19
Apply PRECHAIN to java_call chains and strip keys from result
baubakg Apr 15, 2026
18f6351
Add ibs-env-* header injection, coerceArg string-to-primitive convers…
baubakg Apr 16, 2026
7556edb
Add bridge-service.properties resource filter for version injection
baubakg Apr 16, 2026
cba94e9
Add ibs_diagnostics tool and ibs-prechain header support
baubakg Apr 16, 2026
839e7f7
Add MCP best practices, config reference, and multi-client connection…
baubakg Apr 16, 2026
2fbe688
Add secrets/env-var MCP config section and ibs-env prefix stripping c…
baubakg Apr 16, 2026
eddf326
Add Java naming conventions to CLAUDE.md
baubakg Apr 16, 2026
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
4 changes: 3 additions & 1 deletion .github/workflows/maven-pr-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
# Check out Git repository
- uses: actions/checkout@v4
Expand Down Expand Up @@ -57,7 +59,7 @@ jobs:
OSSRH_ARTIFACTORY_API_TOKEN: ${{ secrets.OSSRH_ARTIFACTORY_API_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=adobe_bridgeService -Dsonar.working.directory=.scannerwork -s .github/workflows/settings.xml
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
uses: sonarsource/sonarqube-quality-gate-action@cb3ed20f9fec62b4c3b8ad9e77656c6adaade913 # master
# Force to fail step after specific time
timeout-minutes: 5
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/maven-publish-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
# Check out Git repository
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/maven-publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on: workflow_dispatch
jobs:
release:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
# Check out Git repository
- uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/onPushSimpleTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

steps:
- uses: actions/checkout@v4
Expand All @@ -46,7 +48,7 @@ jobs:
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"

- name: publish coverage onto codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
with:
file: ./integroBridgeService/target/site/jacoco/jacoco.xml
name: codecov
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
</activation>
<properties>
<releaseRepository-Id>ossrh</releaseRepository-Id>
<releaseRepository-URL>https://oss.sonatype.org/service/local/staging/deploy/maven2/</releaseRepository-URL>
<releaseRepository-URL>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</releaseRepository-URL>
<snapshotRepository-Id>ossrh</snapshotRepository-Id>
<snapshotRepository-URL>https://oss.sonatype.org/content/repositories/snapshots</snapshotRepository-URL>
<snapshotRepository-URL>https://central.sonatype.com/repository/maven-snapshots/</snapshotRepository-URL>
<project.scm.id>github</project.scm.id>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
Expand Down
3 changes: 2 additions & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--settings .mvn/settings.xml
--settings
.mvn/settings.xml
131 changes: 131 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What This Project Does

BridgeService is a REST service that exposes Java code/libraries as HTTP endpoints, enabling any language or framework to invoke Java methods via REST. It is particularly useful in test automation — e.g., Cypress tests calling Java backend logic without rewriting it.

## Build & Common Commands

```bash
# Build entire project
mvn clean install

# Run all tests
mvn test

# Run a specific test class
mvn -Dtest=ClassName test

# Start BridgeService locally on port 8080 (test mode)
mvn -pl integroBridgeService exec:java -Dexec.args="test"

# Start with demo data compiled in
mvn -pl integroBridgeService exec:java -Dexec.args="test" -Ddemo.project.mode=compile

# Add/fix license headers (required before committing new source files)
mvn license:format

# Generate fat JAR with all dependencies
mvn package
```

**Quality gates that must pass before merging:** unit tests pass, no coverage decrease, SonarCloud gate green, license headers present.

## Module Structure

```
parent (pom.xml)
├── integroBridgeService/ ← main service
└── bridgeService-data/ ← test data & demo classes used by the test suite
```

`bridgeService-data` is a dependency of the test scope in `integroBridgeService`. It provides concrete Java classes (under `com.adobe.campaign.tests.bridge.testdata.*`) that the tests call through the REST API.

## Architecture Overview

### Core Request Flow

1. **`IntegroAPI`** (`service/IntegroAPI.java`) — Spark Framework HTTP layer. Three endpoints:
- `GET /test` — health check
- `GET /service-check` — external service connectivity check
- `POST /call` — main invocation endpoint (also accepts multipart for file uploads)

2. **`BridgeServiceFactory`** — deserializes the incoming JSON payload into a `JavaCalls` object.

3. **`JavaCalls`** — orchestrates execution. Handles call chaining, environment variable injection, timeout management (via `ExecutorService`), and Hamcrest-based assertions on results or call duration.

4. **`CallContent`** — represents a single method call (class name, method name, arguments). Uses reflection to invoke the method. Supports instance method calls where a prior call's return value is reused as the object instance.

5. **`IntegroBridgeClassLoader`** — custom class loader that isolates static variable state per call session to prevent cross-call interference. Three modes:
- **Automatic** — loads all accessed classes (small memory cost)
- **Semi-Manual** — loads only statically referenced classes
- **Manual** — loads only explicitly configured packages (most control)

6. **`JavaCallResults`** — aggregates return values, call durations, and assertion outcomes, then serializes to JSON (Jackson).

7. **`IBSPluginManager`** + `IBSDeserializerPlugin` — plugin system that allows custom deserialization of non-JSON-serializable return types. Plugins are discovered by package scan (`IBS.PLUGINS.PACKAGE` env var).

8. **`MetaUtils`** — reflection utilities for method lookup and object property scraping.

9. **`ErrorObject`** — standardized error response with code, message, and stack trace. Error codes: `404` (client error: bad payload, missing class, ambiguous method), `408` (timeout), `500` (server/runtime error).

### Key Environment Variables

| Variable | Purpose | Default |
| -------------------------------------------------------- | ---------------------------------------- | ------------- |
| `IBS.TIMEOUT.DEFAULT` | Global execution timeout (ms) | 10000 |
| `IBS.CLASSLOADER.AUTOMATIC.INTEGRITY.INJECTION` | Class loader mode | AUTO |
| `IBS.CLASSLOADER.STATIC.INTEGRITY.PACKAGES` | Packages to load in static mode | — |
| `IBS.DESERIALIZATION.DEPTH.LIMIT` | Object scraping recursion depth | 1 |
| `IBS.DESERIALIZATION.DATE.FORMAT` | SimpleDateFormat pattern for date fields | — |
| `IBS.PLUGINS.PACKAGE` | Package to scan for deserializer plugins | — |
| `IBS.SECRETS.FILTER.PREFIX` | HTTP header prefix for secrets | `ibs-secret-` |
| `IBS.HEADERS.FILTER.PREFIX` | Restrict which headers enter call-chain cache | `""` (all) |
| `IBS.ENV.HEADER.PREFIX` | HTTP header prefix for env-var injection | `ibs-env-` |
| `IBS.ENVVARS.SETTER.CLASS` / `IBS.ENVVARS.SETTER.METHOD` | Custom env var injection handler | — |

These are managed by `ConfigValueHandlerIBS.java`.

## Testing

- **Framework:** TestNG (`integroBridgeService/src/test/resources/testng.xml`)
- **Coverage:** JaCoCo (reports go to `target/site/jacoco/`)
- **Test REST calls:** REST-assured
- **Assertions:** Hamcrest Matchers
- **Mocking:** Mockito
- Tests live in `integroBridgeService/src/test/java/` and call real service endpoints (not mocked — the service is started in-process before tests).

## Deployment

- Entry point: `MainContainer.java` (accepts `"test"` arg for test mode, or SSL keystore config for production)
- Two Docker images: `DockerfileNoSSL` and `DockerfileSSL` (TLSv1.2)
- Built via `buildScripts/buildImage.sh`
- Port 8080 (test mode), 443 (SSL production)

## Java & Dependency Notes

- Java 11 (source/target) is required. Do not use APIs introduced after Java 11.
- Web framework: Spark Java 2.9.4
- JSON: Jackson 2.18.x
- Logging: Log4j 2 (50MB rotation, 3GB cleanup, 10-day retention per `docs/Technical.md`)

## Java Naming Conventions

Apply these prefixes consistently in all new and modified Java code:

| Prefix | Applies to | Example |
|---|---|---|
| `in_` | Method parameters | `in_serverUrl`, `in_userId` |
| `l_` | Local variables | `l_result`, `l_callContent` |
| `lt_` | Variables scoped to a loop or condition block (do not escape the block) | `lt_entry`, `lt_key` |
| *(none)* | `for` loop counters | `i`, `j` |

## Contribution Rules

- All new source files must have the Adobe license header (`mvn license:format` adds it).
- Coverage must not decrease.
- SonarCloud quality gate must be green.
- A signed CLA is required for external contributors.
- All features need to be documented, if they are functional they go in README, otherwise there is a dedicated document called docs/Technical.md
Loading
Loading