https://github.com/eclipse-esmf/esmf-sdk-demo
Demonstrate usage of esmf-sdk
https://github.com/eclipse-esmf/esmf-sdk-demo
Last synced: 6 months ago
JSON representation
Demonstrate usage of esmf-sdk
- Host: GitHub
- URL: https://github.com/eclipse-esmf/esmf-sdk-demo
- Owner: eclipse-esmf
- Created: 2024-11-04T08:56:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-14T12:14:02.000Z (12 months ago)
- Last Synced: 2025-07-14T16:11:24.987Z (12 months ago)
- Language: Java
- Size: 20.5 KB
- Stars: 0
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# esmf-sdk Demo
Demonstrates various combinations of using the [esmf-sdk](https://github.com/eclipse-esmf/esmf-sdk) to access Aspect Model information and Aspect data.
Demo code and generation of artifacts uses
the [PartAsPlanned 2.0.0](https://github.com/eclipse-tractusx/sldt-semantic-models/blob/main/io.catenax.part_as_planned/2.0.0/PartAsPlanned.ttl)
Aspect Model as defined by the Tractus-X project.
To run all generation steps and tests, run `mvn clean test`.
## Generation of artifacts using the Maven Plugin
In this project, the pom.xml is configured to use the [
`esmf-aspect-model-maven-plugin`](https://eclipse-esmf.github.io/esmf-developer-guide/tooling-guide/maven-plugin.html) to generate:
* Java classes (POJOs)
* Static Java classes
* OpenAPI specification
* JSON Schema
Additionally, the project uses the [openapi-generator](https://openapi-generator.tech/) project with the java-wiremock configuration to generate
a mockserver implementation for the Aspect's OpenAPI specification.
All generated code is located in the `src-gen` folder: After running `mvn clean test` you can have a look at the generated code in `src-gen/main/java`
and the generated OpenAPI specification in `src-gen/main/resources`.
## Demo of Java APIs
In the class `EsmfSdkTest` some functionalities of the Java API are demonstrated:
* Load an Aspect Model from File, InputStream or directly via URN
* Generate JSON sample payload for the Aspect, then use Jackson to parse it to create an instance of the
corresponding generated Java POJO
* Programmatically generate HTML documentation for an Aspect Model
* Usage of the generated static Java classes to navigate the Aspect Model in a type-safe way
* Usage of static Java classes to access deserialized data
In the class `PartAsPlannedApiMockTest`, the generated mockserver implementation is used.
* The mockserver is started for the Aspect's API
* A HTTP request to the mock endpoint is done
* The result is displayed