Skip to content

Commit

Permalink
Merge pull request #40 from ZenWave360/develop
Browse files Browse the repository at this point in the history
Mergin to develop for release 1.6.5
  • Loading branch information
ivangsa authored Nov 26, 2024
2 parents 53b6887 + cbefd56 commit 523e32e
Show file tree
Hide file tree
Showing 74 changed files with 468 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import io.zenwave360.sdk.MainGenerator;
import io.zenwave360.sdk.Plugin;
Expand Down Expand Up @@ -41,15 +39,15 @@ public void testCustomerAddressPostgresJson() throws Exception {
int exitCode = 0;

plugin = new ZDLToOpenAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("idType", "integer")
.withOption("idTypeFormat", "int64")
.withOption("targetFile", "/src/main/resources/apis/openapi.yml")
.withTargetFolder(targetFolder);
new MainGenerator().generate(plugin);

plugin = new ZDLToAsyncAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("asyncapiVersion", "v3")
.withOption("idType", "integer")
.withOption("idTypeFormat", "int64")
Expand All @@ -58,7 +56,7 @@ public void testCustomerAddressPostgresJson() throws Exception {
new MainGenerator().generate(plugin);

plugin = new BackendApplicationDefaultPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withTargetFolder(targetFolder)
.withOption("basePackage", basePackage)
.withOption("persistence", PersistenceType.jpa)
Expand All @@ -82,7 +80,7 @@ public void testCustomerAddressPostgresJson() throws Exception {
Assertions.assertEquals(0, exitCode);

plugin = new OpenAPIControllersPlugin()
.withSpecFile(targetFolder + "/src/main/resources/apis/openapi.yml")
.withApiFile(targetFolder + "/src/main/resources/apis/openapi.yml")
.withOption("zdlFile", zdlFile)
.withOption("basePackage", basePackage)
.withOption("controllersPackage", "{{basePackage}}.adapters.web")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testCustomerAddressRelational(String flavor) throws Exception {
int exitCode = 0;

plugin = new ZDLToOpenAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("idType", "integer")
.withOption("idTypeFormat", "int64")
.withOption("targetFile", "/src/main/resources/apis/openapi.yml")
Expand All @@ -60,7 +60,7 @@ public void testCustomerAddressRelational(String flavor) throws Exception {
// TextUtils.replaceInFile(new File(targetFolder + "/src/main/resources/apis/openapi.yml"), replace, replacement);

plugin = new ZDLToAsyncAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("asyncapiVersion", "v3")
.withOption("idType", "integer")
.withOption("idTypeFormat", "int64")
Expand All @@ -69,7 +69,7 @@ public void testCustomerAddressRelational(String flavor) throws Exception {
new MainGenerator().generate(plugin);

plugin = new BackendApplicationDefaultPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withTargetFolder(targetFolder)
.withOption("basePackage", basePackage)
.withOption("persistence", PersistenceType.jpa)
Expand All @@ -86,7 +86,7 @@ public void testCustomerAddressRelational(String flavor) throws Exception {
Assertions.assertEquals(0, exitCode);

plugin = new OpenAPIControllersPlugin()
.withSpecFile(targetFolder + "/src/main/resources/apis/openapi.yml")
.withApiFile(targetFolder + "/src/main/resources/apis/openapi.yml")
.withOption("zdlFile", zdlFile)
.withOption("basePackage", basePackage)
.withOption("controllersPackage", "{{basePackage}}.adapters.web")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.zenwave360.sdk.e2e;

import java.io.File;
import java.util.List;

import io.zenwave360.sdk.plugins.BackendApplicationDefaultPlugin;
import io.zenwave360.sdk.plugins.OpenAPIControllersPlugin;
Expand Down Expand Up @@ -44,7 +43,7 @@ public void test() throws Exception {
var zdlFile = targetFolder + "models/" + module + ".zdl";

Plugin plugin = new BackendApplicationDefaultPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withTargetFolder(moduleFolder)
.withOption("basePackage", modulePackage)
.withOption("persistence", PersistenceType.mongodb)
Expand All @@ -71,14 +70,14 @@ public void generateApis(String module) throws Exception {
Plugin plugin = null;

plugin = new ZDLToOpenAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("idType", "string")
.withOption("targetFile", "/src/main/resources/apis/openapi.yml")
.withTargetFolder(moduleFolder);
new MainGenerator().generate(plugin);

plugin = new ZDLToAsyncAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("asyncapiVersion", "v3")
.withOption("idType", "string")
.withOption("targetFile", "/src/main/resources/apis/asyncapi.yml")
Expand Down Expand Up @@ -108,7 +107,7 @@ public void generateModule(String module) throws Exception {
int exitCode = 0;

plugin = new BackendApplicationDefaultPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withTargetFolder(moduleFolder)
.withOption("basePackage", modulePackage)
.withOption("persistence", PersistenceType.mongodb)
Expand All @@ -124,8 +123,8 @@ public void generateModule(String module) throws Exception {
Assertions.assertEquals(0, exitCode);

plugin = new OpenAPIControllersPlugin()
.withSpecFile(moduleFolder + "/src/main/resources/apis/openapi.yml")
.withOption("zdlFile", zdlFile)
.withApiFile(moduleFolder + "/src/main/resources/apis/openapi.yml")
.withZdlFile(zdlFile)
.withOption("basePackage", modulePackage)
.withOption("controllersPackage", "{{basePackage}}.adapters.web")
.withOption("openApiApiPackage", "{{basePackage}}.adapters.web")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public void testCustomerAddressPostgresJson() throws Exception {
int exitCode = 0;

plugin = new ZDLToOpenAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("idType", "integer")
.withOption("idTypeFormat", "int64")
.withOption("targetFile", "/src/main/resources/apis/openapi.yml")
.withTargetFolder(targetFolder);
new MainGenerator().generate(plugin);

plugin = new ZDLToAsyncAPIPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withOption("asyncapiVersion", "v3")
.withOption("idType", "integer")
.withOption("idTypeFormat", "int64")
Expand All @@ -56,7 +56,7 @@ public void testCustomerAddressPostgresJson() throws Exception {
new MainGenerator().generate(plugin);

plugin = new BackendApplicationDefaultPlugin()
.withSpecFile(zdlFile)
.withZdlFile(zdlFile)
.withTargetFolder(targetFolder)

.withOption("simpleDomainPackaging", true)
Expand All @@ -76,7 +76,7 @@ public void testCustomerAddressPostgresJson() throws Exception {
Assertions.assertEquals(0, exitCode);

plugin = new OpenAPIControllersPlugin()
.withSpecFile(targetFolder + "/src/main/resources/apis/openapi.yml")
.withApiFile(targetFolder + "/src/main/resources/apis/openapi.yml")
.withOption("zdlFile", zdlFile)
.withOption("basePackage", basePackage)
.withOption("controllersPackage", "{{basePackage}}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ config {
title "ZenWave Playground Customer-Address MariaDB"
basePackage "io.zenwave360.example"
persistence jpa
databaseType mariadb
databaseType postgresql
// haltOnFailFormatting false

plugins {
Expand All @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<spring-boot.version>${project.parent.version}</spring-boot.version>
<spring-cloud.version>2022.0.4</spring-cloud.version>

<zenwave.version>1.6.0</zenwave.version>
<zenwave.version>1.7.0-SNAPSHOT</zenwave.version>

<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<spring-boot.version>${project.parent.version}</spring-boot.version>
<spring-cloud.version>2022.0.4</spring-cloud.version>

<zenwave.version>1.6.0</zenwave.version>
<zenwave.version>1.7.0-SNAPSHOT</zenwave.version>

<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
// TODO fix this: specFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
specFile "modules/customers/src/main/resources/apis/openapi.yml"
zdlFile "models/customers.zdl"
// TODO fix this: apiFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
apiFile "modules/customers/src/main/resources/apis/openapi.yml"

// these should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ config {
OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
// TODO fix this: specFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
specFile "modules/delivery/src/main/resources/apis/openapi.yml"
zdlFile "models/delivery.zdl"
apiFile "modules/delivery/src/main/resources/apis/openapi.yml"

// these should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand All @@ -42,7 +41,7 @@ config {
SpringCloudStreams3AdaptersPlugin {
apiId "orders"
role client
specFile "modules/orders/src/main/resources/apis/asyncapi.yml"
apiFile "modules/orders/src/main/resources/apis/asyncapi.yml"
modelPackage "{{basePackage}}.client.{{apiId}}.events.dtos"
consumerApiPackage "{{basePackage}}.client.{{apiId}}.events.consumer"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
// TODO fix this: specFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
specFile "modules/orders/src/main/resources/apis/openapi.yml"
zdlFile "models/orders.zdl"
// TODO fix this: apiFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
apiFile "modules/orders/src/main/resources/apis/openapi.yml"

// these should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
// TODO fix this: specFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
specFile "modules/restaurants/src/main/resources/apis/openapi.yml"
zdlFile "models/restaurants.zdl"
// TODO fix this: apiFile "{{targetFolder}}/src/main/resources/apis/openapi.yml"
apiFile "modules/restaurants/src/main/resources/apis/openapi.yml"

// these should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand All @@ -43,7 +42,7 @@ config {
SpringCloudStreams3AdaptersPlugin {
apiId "orders"
role client
specFile "modules/orders/src/main/resources/apis/asyncapi.yml"
apiFile "modules/orders/src/main/resources/apis/asyncapi.yml"
modelPackage "{{basePackage}}.client.{{apiId}}.events.dtos"
consumerApiPackage "{{basePackage}}.client.{{apiId}}.events.consumer"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<spring-cloud.version>2022.0.4</spring-cloud.version>
<spring-modulith-bom.version>1.1.1</spring-modulith-bom.version>

<zenwave.version>1.6.0</zenwave.version>
<zenwave.version>1.7.0-SNAPSHOT</zenwave.version>

<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ config {

OpenAPIControllersPlugin {
formatter google // comments in one line are better for demos
specFile "src/main/resources/apis/openapi.yml"
zdlFile "customer-address-relational.zdl"
apiFile "src/main/resources/apis/openapi.yml"

// thse should match the values of openapi-generator-maven-plugin
openApiApiPackage "{{basePackage}}.adapters.web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<spring-boot.version>${project.parent.version}</spring-boot.version>
<spring-cloud.version>2022.0.4</spring-cloud.version>

<zenwave.version>1.6.0</zenwave.version>
<zenwave.version>1.7.0-SNAPSHOT</zenwave.version>

<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void setup() throws IOException {
@Test
public void test_generator_for_asyncapi_v3() throws Exception {
Plugin plugin = new AsyncApiJsonSchema2PojoPlugin()
.withSpecFile("classpath:asyncapi-v3.yml")
.withApiFile("classpath:asyncapi-v3.yml")
.withTargetFolder("target/zenwave630")
.withOption("modelPackage", "io.example.v3.domain.events");

Expand All @@ -34,7 +34,7 @@ public void test_generator_for_asyncapi_v3() throws Exception {
@Test
public void test_generator_for_asyncapi_v3_filter_messages() throws Exception {
Plugin plugin = new AsyncApiJsonSchema2PojoPlugin()
.withSpecFile("classpath:asyncapi-v3.yml")
.withApiFile("classpath:asyncapi-v3.yml")
.withTargetFolder("target/zenwave630")
.withOption("messageNames", List.of("CustomerInputMessage"))
.withOption("modelPackage", "io.example.v3.domain.byMessage");
Expand All @@ -47,7 +47,7 @@ public void test_generator_for_asyncapi_v3_filter_messages() throws Exception {
@Test
public void test_generator_for_asyncapi_repeated_enum() throws Exception {
Plugin plugin = new AsyncApiJsonSchema2PojoPlugin()
.withSpecFile("classpath:asyncapi.yml")
.withApiFile("classpath:asyncapi.yml")
.withTargetFolder("target/zenwave630")
.withOption("modelPackage", "io.example.integration.test.with_schemas.model");

Expand All @@ -60,7 +60,7 @@ public void test_generator_for_asyncapi_repeated_enum() throws Exception {
@Test
public void test_generator_for_asyncapi_schemas() throws Exception {
Plugin plugin = new AsyncApiJsonSchema2PojoPlugin()
.withSpecFile("classpath:io/zenwave360/sdk/resources/asyncapi/v2/asyncapi-events.yml")
.withApiFile("classpath:io/zenwave360/sdk/resources/asyncapi/v2/asyncapi-events.yml")
.withTargetFolder("target/zenwave630")
.withOption("modelPackage", "io.example.integration.test.with_schemas.model");

Expand All @@ -73,7 +73,7 @@ public void test_generator_for_asyncapi_schemas() throws Exception {
public void test_generator_for_json_schemas() throws Exception {
var url = getClass().getClassLoader().getResource("/io/zenwave360/sdk/resources/asyncapi/v2/json-schemas/asyncapi.yml");
Plugin plugin = new AsyncApiJsonSchema2PojoPlugin()
.withSpecFile("classpath:io/zenwave360/sdk/resources/asyncapi/v2/json-schemas/asyncapi.yml")
.withApiFile("classpath:io/zenwave360/sdk/resources/asyncapi/v2/json-schemas/asyncapi.yml")
.withTargetFolder("target/zenwave630");

new MainGenerator().generate(plugin);
Expand Down
Loading

0 comments on commit 523e32e

Please sign in to comment.