Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.93 KB

README.md

File metadata and controls

42 lines (29 loc) · 1.93 KB

esmf-sdk Demo

Demonstrates various combinations of using the esmf-sdk to access Aspect Model information and Aspect data.

Demo code and generation of artifacts uses the PartAsPlanned 2.0.0 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 to generate:

  • Java classes (POJOs)
  • Static Java classes
  • OpenAPI specification
  • JSON Schema

Additionally, the project uses the openapi-generator 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