Skip to content

Commit

Permalink
SDK: renaming java packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangsa committed Jan 31, 2023
1 parent e1007c8 commit f157433
Show file tree
Hide file tree
Showing 258 changed files with 689 additions and 745 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
uses: cicirello/jacoco-badge-sdk@v2
with:
badges-directory: badges
generate-branches-badge: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
uses: cicirello/jacoco-badge-sdk@v2
with:
badges-directory: badges
generate-branches-badge: true
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you plan to use **custom plugins** you will need to use the command in the fo

```shell
jbang alias add --name=zw \
-m=io.zenwave360.generator.Main \
-m=io.zenwave360.sdk\
--repos=mavencentral,snapshots=https://s01.oss.sonatype.org/content/repositories/snapshots \
--deps=\
org.slf4j:slf4j-simple:1.7.36,\
Expand Down Expand Up @@ -149,15 +149,15 @@ $ jbang zw -h -f list
INFO Reflections - Reflections took 428 ms to scan 44 urls, producing 2493 keys and 14406 values
Available plugins:

jsonschema2pojo io.zenwave360.generator.plugins.AsyncApiJsonSchema2PojoPlugin: Generate Plain Old Java Objects from OpenAPI/AsyncAPI schemas or full JSON-Schema files
jdl-backend-application-default io.zenwave360.generator.plugins.JDLBackendApplicationDefaultPlugin: Generates a full backend application using a flexible hexagonal architecture
jdl-to-openapi io.zenwave360.generator.plugins.JDLToOpenAPIPlugin: Generates a full OpenAPI definitions for CRUD operations from JDL models
jdl-openapi-controllers io.zenwave360.generator.plugins.JDLOpenAPIControllersPlugin: Generates implementations based on JDL models and OpenAPI definitions SpringMVC generated OpenAPI interfaces.
openapi-to-jdl io.zenwave360.generator.plugins.OpenAPIToJDLPlugin: Generates JDL model from OpenAPI schemas
spring-cloud-streams3 io.zenwave360.generator.plugins.SpringCloudStreams3Plugin: Generates strongly typed SpringCloudStreams3 producer/consumer classes for AsyncAPI
fork-plugin io.zenwave360.generator.plugins.ForkPlugin: Creates a new standalone maven module cloning an existing plugin
spring-webtestclient io.zenwave360.generator.plugins.SpringWebTestClientPlugin: Generates spring WebTestClient tests from OpenAPI defined endpoints.
rest-assured io.zenwave360.generator.plugins.RestAssuredPlugin: Generates REST-assured tests from OpenAPI defined endpoints.
jsonschema2pojo io.zenwave360.sdkns.AsyncApiJsonSchema2PojoPlugin: Generate Plain Old Java Objects from OpenAPI/AsyncAPI schemas or full JSON-Schema files
jdl-backend-application-default io.zenwave360.sdkns.JDLBackendApplicationDefaultPlugin: Generates a full backend application using a flexible hexagonal architecture
jdl-to-openapi io.zenwave360.sdkns.JDLToOpenAPIPlugin: Generates a full OpenAPI definitions for CRUD operations from JDL models
jdl-openapi-controllers io.zenwave360.sdkns.JDLOpenAPIControllersPlugin: Generates implementations based on JDL models and OpenAPI definitions SpringMVC generated OpenAPI interfaces.
openapi-to-jdl io.zenwave360.sdkns.OpenAPIToJDLPlugin: Generates JDL model from OpenAPI schemas
spring-cloud-streams3 io.zenwave360.sdkns.SpringCloudStreams3Plugin: Generates strongly typed SpringCloudStreams3 producer/consumer classes for AsyncAPI
fork-plugin io.zenwave360.sdkns.ForkPlugin: Creates a new standalone maven module cloning an existing plugin
spring-webtestclient io.zenwave360.sdkns.SpringWebTestClientPlugin: Generates spring WebTestClient tests from OpenAPI defined endpoints.
rest-assured io.zenwave360.sdkns.RestAssuredPlugin: Generates REST-assured tests from OpenAPI defined endpoints.
```

NOTE: it will list any available plugin, standard or custom, inside any of these root java packages "io", "com" or "org".
Expand Down Expand Up @@ -196,7 +196,7 @@ One promise of ZenWave Code Generator is to be easily extensible and adaptable t
You can always fork an existing plugin with the following command:

```shell
jbang zw -p io.zenwave360.generator.plugins.ForkPlugin -h
jbang zw -p io.zenwave360.sdkns.ForkPlugin -h
```

| **Option** | **Description** | **Type** | **Default** | **Values** |
Expand All @@ -209,10 +209,10 @@ jbang zw -p io.zenwave360.generator.plugins.ForkPlugin -h
Example:

```shell
jbang zw -p io.zenwave360.generator.plugins.ForkPlugin \
jbang zw -p io.zenwave360.sdkns.ForkPlugin \
targetFolder=target/forked-plugin \
sourcePluginClassName=io.zenwave360.generator.plugins.JDLBackendApplicationDefaultPlugin \
targetPluginClassName=com.myorganization.generator.JDLBackendApplicationDefaultPluginForked
sourcePluginClassName=io.zenwave360.sdkns.JDLBackendApplicationDefaultPlugin \
targetPluginClassName=com.myorganization.sdk.JDLBackendApplicationDefaultPluginForked
cd target/forked-plugin
mvn clean install
```
Expand Down
16 changes: 8 additions & 8 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Default backend generator supports the following @annotations:
### Generate Backend Application

```shell
jbang zw -p io.zenwave360.generator.plugins.JDLBackendApplicationDefaultPlugin \
jbang zw -p io.zenwave360.sdkns.JDLBackendApplicationDefaultPlugin \
specFile=src/main/resources/model/orders-model.jdl \
basePackage=io.zenwave360.example \
persistence=mongodb \
Expand Down Expand Up @@ -329,7 +329,7 @@ Generate a baseline OpenAPI definition from JDL entities:
- CRUD operations and Search for @aggregate entities

```shell
jbang zw -p io.zenwave360.generator.plugins.JDLToOpenAPIPlugin \
jbang zw -p io.zenwave360.sdkns.JDLToOpenAPIPlugin \
specFile=src/main/resources/model/orders-model.jdl \
targetFile=src/main/resources/model/openapi.yml
```
Expand All @@ -342,7 +342,7 @@ Generate AsyncAPI definition from JDL entities:
- Messages and payloads for each entity Create/Update/Delete events (AVRO and AsyncAPI schema)

```shell
jbang zw -p io.zenwave360.generator.plugins.JDLToAsyncAPIPlugin \
jbang zw -p io.zenwave360.sdkns.JDLToAsyncAPIPlugin \
includeCommands=true \
specFile=src/main/resources/model/orders-model.jdl \
targetFile=src/main/resources/model/asyncapi.yml
Expand Down Expand Up @@ -454,7 +454,7 @@ jbang zw -p io.zenwave360.generator.plugins.JDLToAsyncAPIPlugin \
You can generate SpringMVC controllers that implements the interfaces generated by the official OpenAPI generator.

```shell
jbang zw -p io.zenwave360.generator.plugins.JDLOpenAPIControllersPlugin \
jbang zw -p io.zenwave360.sdkns.JDLOpenAPIControllersPlugin \
specFile=src/main/resources/model/openapi.yml \
jdlFile=src/main/resources/model/orders-model.jdl \
basePackage=io.zenwave360.example \
Expand Down Expand Up @@ -482,7 +482,7 @@ src/main/java/io/zenwave360/example/adapters/web/mappers/CustomerOrderDTOsMapper
Generates test for SpringMVC or Spring WebFlux using WebTestClient based on OpenAPI specification.

```shell
jbang zw -p io.zenwave360.generator.plugins.SpringWebTestClientPlugin \
jbang zw -p io.zenwave360.sdkns.SpringWebTestClientPlugin \
specFile=src/main/resources/model/openapi.yml \
jdlFile=src/main/resources/model/orders-model.jdl \
targetFolder=src/test/java \
Expand Down Expand Up @@ -526,15 +526,15 @@ It requires access to your project classpath, so you can just paste the followin

```java
String jdl = new JavaToJDLGenerator()
.withPackageName("io.zenwave360.generator.jpa2jdl")
.withPackageName("io.zenwave360.sdk.jpa2jdl")
.withPersistenceType(JavaToJDLGenerator.PersistenceType.JPA)
.generate();
System.out.println(jdl);
```

```java
String jdl = new JavaToJDLGenerator()
.withPackageName("io.zenwave360.generator.mongodb2jdl")
.withPackageName("io.zenwave360.sdk.mongodb2jdl")
.withPersistenceType(JavaToJDLGenerator.PersistenceType.MONGODB)
.generate();
System.out.println(jdl);
Expand All @@ -551,7 +551,7 @@ When your domain java code evolves you may want to regenerate entities back from
Reverse engineer JDL entities from OpenAPI schemas:

```shell
jbang zw -p io.zenwave360.generator.plugins.OpenAPIToJDLPlugin \
jbang zw -p io.zenwave360.sdkns.OpenAPIToJDLPlugin \
specFile=openapi.yml targetFolder=target/out targetFile=entities.jdl
cat target/out/entities.jdl
```
4 changes: 2 additions & 2 deletions plugins/asyncapi-jsonschema2pojo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Generate Plain Old Java Objects from OpenAPI/AsyncAPI schemas or full JSON-Schema files using https://www.jsonschema2pojo.org/ library.

```shell
jbang zw -p io.zenwave360.generator.plugins.AsyncApiJsonSchema2PojoPlugin \
jbang zw -p io.zenwave360.sdkns.AsyncApiJsonSchema2PojoPlugin \
specFile=src/main/resources/model/asyncapi.yml \
modelPackage=io.zenwave360.example.core.domain.events \
jsonschema2pojo.includeTypeInfo=true \
Expand All @@ -34,7 +34,7 @@ jbang zw -p io.zenwave360.generator.plugins.AsyncApiJsonSchema2PojoPlugin \
## Getting Help

```shell
jbang zw -p io.zenwave360.generator.plugins.AsyncApiJsonSchema2PojoPlugin --help
jbang zw -p io.zenwave360.sdkns.AsyncApiJsonSchema2PojoPlugin --help
```

## Maven Plugin Configuration (API-First)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import static org.jsonschema2pojo.SourceType.JSONSCHEMA;
import static org.jsonschema2pojo.SourceType.YAMLSCHEMA;
Expand Down Expand Up @@ -34,13 +34,13 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.sun.codemodel.JCodeModel;

import io.zenwave360.generator.doc.DocumentedOption;
import io.zenwave360.generator.generators.AbstractAsyncapiGenerator;
import io.zenwave360.generator.parsers.Model;
import io.zenwave360.generator.processors.AsyncApiProcessor;
import io.zenwave360.generator.templating.TemplateOutput;
import io.zenwave360.generator.utils.JSONPath;
import io.zenwave360.generator.utils.NamingUtils;
import io.zenwave360.sdk.doc.DocumentedOption;
import io.zenwave360.sdk.generators.AbstractAsyncapiGenerator;
import io.zenwave360.sdk.parsers.Model;
import io.zenwave360.sdk.processors.AsyncApiProcessor;
import io.zenwave360.sdk.templating.TemplateOutput;
import io.zenwave360.sdk.utils.JSONPath;
import io.zenwave360.sdk.utils.NamingUtils;
import io.zenwave360.jsonrefparser.$Ref;

public class AsyncApiJsonSchema2PojoGenerator extends AbstractAsyncapiGenerator {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import java.util.Map;

import io.zenwave360.generator.Plugin;
import io.zenwave360.generator.doc.DocumentedPlugin;
import io.zenwave360.generator.parsers.DefaultYamlParser;
import io.zenwave360.generator.processors.AsyncApiProcessor;
import io.zenwave360.sdk.Plugin;
import io.zenwave360.sdk.doc.DocumentedPlugin;
import io.zenwave360.sdk.parsers.DefaultYamlParser;
import io.zenwave360.sdk.processors.AsyncApiProcessor;

@DocumentedPlugin(value = "Generate Plain Old Java Objects from OpenAPI/AsyncAPI schemas or full JSON-Schema files", shortCode = "jsonschema2pojo")
public class AsyncApiJsonSchema2PojoPlugin extends Plugin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import static org.apache.commons.lang3.ObjectUtils.firstNonNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import java.io.File;
import java.io.IOException;

import io.zenwave360.generator.Plugin;
import io.zenwave360.sdk.Plugin;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.zenwave360.generator.MainGenerator;
import io.zenwave360.sdk.MainGenerator;

public class AsyncApiJsonSchema2PojoGeneratorTest {

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

Expand All @@ -32,9 +32,9 @@ public void test_generator_for_asyncapi_schemas() throws Exception {

@Test
public void test_generator_for_json_schemas() throws Exception {
var url = getClass().getClassLoader().getResource("/io/zenwave360/generator/resources/asyncapi/json-schemas/asyncapi.yml");
var url = getClass().getClassLoader().getResource("/io/zenwave360/sdk/resources/asyncapi/json-schemas/asyncapi.yml");
Plugin plugin = new AsyncApiJsonSchema2PojoPlugin()
.withSpecFile("classpath:io/zenwave360/generator/resources/asyncapi/json-schemas/asyncapi.yml")
.withSpecFile("classpath:io/zenwave360/sdk/resources/asyncapi/json-schemas/asyncapi.yml")
.withTargetFolder("target/zenwave630");

new MainGenerator().generate(plugin);
Expand Down
8 changes: 4 additions & 4 deletions plugins/asyncapi-spring-cloud-streams3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Use the table to understand which section of AsyncAPI (publish or subscribe) to
### Getting Help

```shell
jbang zw -p io.zenwave360.generator.plugins.SpringCloudStreams3Plugin --help
jbang zw -p io.zenwave360.sdkns.SpringCloudStreams3Plugin --help
```

### Options
Expand Down Expand Up @@ -177,7 +177,7 @@ public class ProducerInMemoryContext {


```shell
jbang zw -p io.zenwave360.generator.plugins.SpringCloudStreams3TestsPlugin \
jbang zw -p io.zenwave360.sdkns.SpringCloudStreams3TestsPlugin \
specFile=src/main/resources/model/asyncapi.yml \
role=provider \
style=imperative \
Expand Down Expand Up @@ -243,7 +243,7 @@ public class DoCustomerRequestConsumerServiceIT extends BaseConsumerTest {


```shell
jbang zw -p io.zenwave360.generator.plugins.SpringCloudStreams3AdaptersPlugin \
jbang zw -p io.zenwave360.sdkns.SpringCloudStreams3AdaptersPlugin \
specFile=src/main/resources/model/asyncapi.yml \
jdlFile=src/main/resources/model/orders-model.jdl \
role=provider \
Expand Down Expand Up @@ -350,7 +350,7 @@ You can use ZenWave Maven Plugin to generate code as part of your build process:
</execution>
</executions>

<!-- add any generator plugin (custom or standard) as dependency here -->
<!-- add any sdk plugin (custom or standard) as dependency here -->
<dependencies>
<dependency>
<groupId>io.github.zenwave360.zenwave-sdk.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import static io.zenwave360.generator.templating.OutputFormatType.JAVA;
import static io.zenwave360.sdk.templating.OutputFormatType.JAVA;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.zenwave360.generator.doc.DocumentedOption;
import io.zenwave360.generator.options.ProgrammingStyle;
import io.zenwave360.generator.options.asyncapi.AsyncapiOperationType;
import io.zenwave360.generator.parsers.Model;
import io.zenwave360.generator.templating.TemplateInput;
import io.zenwave360.generator.templating.TemplateOutput;
import io.zenwave360.generator.utils.JSONPath;
import io.zenwave360.generator.utils.Maps;
import io.zenwave360.sdk.doc.DocumentedOption;
import io.zenwave360.sdk.options.ProgrammingStyle;
import io.zenwave360.sdk.options.asyncapi.AsyncapiOperationType;
import io.zenwave360.sdk.parsers.Model;
import io.zenwave360.sdk.templating.TemplateInput;
import io.zenwave360.sdk.templating.TemplateOutput;
import io.zenwave360.sdk.utils.JSONPath;
import io.zenwave360.sdk.utils.Maps;

public class SpringCloudStreams3AdaptersGenerator extends SpringCloudStreams3Generator {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import io.zenwave360.generator.parsers.JDLParser;
import io.zenwave360.generator.processors.*;
import io.zenwave360.sdk.parsers.JDLParser;
import io.zenwave360.sdk.processors.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.zenwave360.generator.Plugin;
import io.zenwave360.generator.doc.DocumentedPlugin;
import io.zenwave360.generator.formatters.JavaFormatter;
import io.zenwave360.generator.parsers.DefaultYamlParser;
import io.zenwave360.generator.writers.TemplateFileWriter;
import io.zenwave360.generator.writers.TemplateStdoutWriter;
import io.zenwave360.sdk.Plugin;
import io.zenwave360.sdk.doc.DocumentedPlugin;
import io.zenwave360.sdk.formatters.JavaFormatter;
import io.zenwave360.sdk.parsers.DefaultYamlParser;
import io.zenwave360.sdk.writers.TemplateFileWriter;
import io.zenwave360.sdk.writers.TemplateStdoutWriter;

@DocumentedPlugin(value = "Generates tests for Spring Cloud Streams Consumers.", shortCode = "spring-cloud-streams3-adapters")
public class SpringCloudStreams3AdaptersPlugin extends Plugin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package io.zenwave360.generator.plugins;
package io.zenwave360.sdk.plugins;

import java.util.*;
import java.util.stream.Collectors;

import io.zenwave360.generator.doc.DocumentedOption;
import io.zenwave360.generator.generators.AbstractAsyncapiGenerator;
import io.zenwave360.generator.options.asyncapi.AsyncapiOperationType;
import io.zenwave360.generator.options.ProgrammingStyle;
import io.zenwave360.generator.parsers.Model;
import io.zenwave360.generator.templating.HandlebarsEngine;
import io.zenwave360.generator.templating.TemplateEngine;
import io.zenwave360.generator.templating.TemplateInput;
import io.zenwave360.generator.templating.TemplateOutput;
import io.zenwave360.generator.utils.JSONPath;
import io.zenwave360.sdk.doc.DocumentedOption;
import io.zenwave360.sdk.generators.AbstractAsyncapiGenerator;
import io.zenwave360.sdk.options.asyncapi.AsyncapiOperationType;
import io.zenwave360.sdk.options.ProgrammingStyle;
import io.zenwave360.sdk.parsers.Model;
import io.zenwave360.sdk.templating.HandlebarsEngine;
import io.zenwave360.sdk.templating.TemplateEngine;
import io.zenwave360.sdk.templating.TemplateInput;
import io.zenwave360.sdk.templating.TemplateOutput;
import io.zenwave360.sdk.utils.JSONPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -129,7 +129,7 @@ public enum TransactionalOutboxType {
});
}

protected String templatesPath = "io/zenwave360/generator/plugins/SpringCloudStream3Generator";
protected String templatesPath = "io/zenwave360/sdk/plugins/SpringCloudStream3Generator";

protected List<TemplateInput> producerTemplates = Arrays.asList(
new TemplateInput(templatesPath + "/producer/IProducer.java", "src/main/java/{{asPackageFolder producerApiPackage}}/I{{apiClassName}}.java"),
Expand Down
Loading

0 comments on commit f157433

Please sign in to comment.