You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/06/21 07:09:16 UTC

[servicecomb-toolkit] branch master created (now 8c1b0f8)

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git.


      at 8c1b0f8  Merge pull request #13 from kakulisen/master

This branch includes the following new commits:

     new 912c57f  Initial commit
     new bfa5bd7  initial version.Support for generating ServiceComb code that used Springmvc model.
     new d16dcd8  configure not generating dependencyreduced temp file.
     new 5aad421  Add unit test
     new fbae606  Fix bug about ServiceComb code model
     new c8658ec  Add feature of contract generating document
     new 138610e  Add plugin to support generating contract by code
     new 50b758c  Remove the redundant file
     new 3ad4486  Code optimization and bugfix
     new 2243107  clean up unwanted files
     new 0f8159e  Optimize mustache template of code generation
     new 0e69c4d  add new programming model POJO
     new 7245304  Support JAX-RS programming model
     new e32ef38  Add SpringBoot programming model
     new d3d7035  Optimize the type of  document format
     new 990ea5e  Support contract verify
     new 451fe88  Add README.md
     new 5db9064  Add todo list
     new e176fff  remove warnings
     new f0c516b  Add English document
     new f2f510d  Optimize document styles and add remote resource reads
     new f9e22e3  Merge pull request #5 from kakulisen/master
     new d48cd0b  add unit test code
     new 584b8de  Merge pull request #6 from kakulisen/master
     new f060c88  optimize logging
     new d865f8c  Merge pull request #7 from kakulisen/master
     new c8b1a70  fix unit test bug
     new dc38559  Merge pull request #8 from kakulisen/master
     new cbff1dd  Update to use spring-boot-maven-plugin to repackage jar
     new 14479e7  Adjust mustache model and bugfixed
     new 94e291d  Change the mainClass value to {{mainClassPackage}} in pom.xml
     new 483d699  Support generating fat jar for consumer service
     new c4b93b1  Add LICENSE
     new ec93cdf  modify default rule of package generation
     new 537c751  Merge pull request #9 from kakulisen/master
     new 0293eb9  Bug fix and warning clear
     new 1aa7e5d  Support generating pojo consumer
     new 9dc1077  add pojo template
     new 2884051  format pojo template
     new 8641598  Merge pull request #10 from kakulisen/master
     new 30e4f00  Support generating SpringBoot consumer code
     new 2e6f595  Merge pull request #11 from kakulisen/master
     new 5e1fa09  code refactor
     new 0dbc4e8  Support generating microservice projects according to service type option
     new eb8980b  Optimizing code
     new 69d7396  Merge pull request #12 from kakulisen/master
     new 93a6b47  Add some new description in README
     new 4884afd  format README
     new 8c1b0f8  Merge pull request #13 from kakulisen/master

The 49 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[servicecomb-toolkit] 04/49: Add unit test

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 5aad421e81e047e078d7c7f6bebfde63b4f2c881
Author: MabinGo <bi...@huawei.com>
AuthorDate: Fri May 17 18:07:01 2019 +0800

    Add unit test
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 code-generator/pom.xml                             |   6 +
 .../servicecomb/toolkit/codegen/GeneratorTest.java |  60 ++
 .../servicecomb/toolkit/codegen/ReflectUtils.java  |  38 ++
 .../codegen/ServiceCombProviderCodegenTest.java    |  33 +
 code-generator/src/test/resources/swagger.yaml     | 707 +++++++++++++++++++++
 toolkit-cli/pom.xml                                |   7 +
 .../apache/servicecomb/toolkit/cli/CliTest.java    | 118 ++++
 .../contracts/CalculatorRestEndpoint.yaml          |  43 ++
 .../test/resources/contracts/HelloEndPoint.yaml    |  74 +++
 .../contracts/pojo/CodeFirstComputeImpl.yaml       | 113 ++++
 toolkit-cli/src/test/resources/swagger.yaml        | 707 +++++++++++++++++++++
 11 files changed, 1906 insertions(+)

diff --git a/code-generator/pom.xml b/code-generator/pom.xml
index 9866719..692f757 100755
--- a/code-generator/pom.xml
+++ b/code-generator/pom.xml
@@ -42,6 +42,12 @@
       <artifactId>swagger-codegen</artifactId>
       <version>${swagger-codegen-version}</version>
     </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
new file mode 100755
index 0000000..638dd96
--- /dev/null
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import io.swagger.codegen.CodegenType;
+import io.swagger.codegen.DefaultGenerator;
+import io.swagger.codegen.config.CodegenConfigurator;
+
+public class GeneratorTest {
+
+  @Test
+  public void generateCode() throws IOException, URISyntaxException {
+
+    Path tempDir = Files.createTempDirectory(null);
+    Path specFilePath = Paths.get(GeneratorTest.class.getClassLoader().getResource("swagger.yaml").toURI());
+    CodegenConfigurator configurator = new CodegenConfigurator();
+
+    configurator.setLang("ServiceCombProvider");
+    configurator.setOutputDir(tempDir.toFile().getCanonicalPath() + "/ServiceCombProvider");
+    configurator.setInputSpec(specFilePath.toFile().getCanonicalPath());
+    DefaultCodeGenerator codeGenerator = new DefaultCodeGenerator();
+    List<File> generatedFiles = codeGenerator.opts(configurator).generate();
+
+    Object internalGenerator = ReflectUtils.getProperty(codeGenerator, "generator");
+    Assert.assertEquals(DefaultGenerator.class, internalGenerator.getClass());
+    Object swaggerCodegenConfig = ReflectUtils.getProperty(internalGenerator, "config");
+    Assert.assertEquals(ServiceCombProviderCodegen.class, swaggerCodegenConfig.getClass());
+    Assert.assertEquals("ServiceCombProvider", ((ServiceCombProviderCodegen) swaggerCodegenConfig).getName());
+    Assert.assertEquals(CodegenType.SERVER, ((ServiceCombProviderCodegen) swaggerCodegenConfig).getTag());
+
+    Assert.assertEquals(16, generatedFiles.size());
+    tempDir.toFile().deleteOnExit();
+  }
+}
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
new file mode 100755
index 0000000..b5892a3
--- /dev/null
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.lang.reflect.Field;
+
+class ReflectUtils {
+
+  static Object getProperty(Object obj, String propName) {
+
+    try {
+      Field propFiled = obj.getClass().getDeclaredField(propName);
+      propFiled.setAccessible(true);
+      return propFiled.get(obj);
+    } catch (NoSuchFieldException e) {
+      e.printStackTrace();
+    } catch (IllegalAccessException e) {
+      e.printStackTrace();
+    }
+
+    return null;
+  }
+}
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java
new file mode 100755
index 0000000..72cd210
--- /dev/null
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import io.swagger.codegen.CodegenConfig;
+import io.swagger.codegen.CodegenConfigLoader;
+
+public class ServiceCombProviderCodegenTest {
+
+  @Test
+  public void loadImpl() {
+    CodegenConfig codegenConfig = CodegenConfigLoader.forName("ServiceCombProvider");
+    Assert.assertEquals(ServiceCombProviderCodegen.class, codegenConfig.getClass());
+  }
+}
diff --git a/code-generator/src/test/resources/swagger.yaml b/code-generator/src/test/resources/swagger.yaml
new file mode 100755
index 0000000..b97799c
--- /dev/null
+++ b/code-generator/src/test/resources/swagger.yaml
@@ -0,0 +1,707 @@
+---
+swagger: "2.0"
+info:
+  description: "This is a sample server Petstore server.  You can find out more about\
+    \ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
+    \  For this sample, you can use the api key `special-key` to test the authorization\
+    \ filters."
+  version: "1.0.0"
+  title: "Swagger Petstore"
+  termsOfService: "http://swagger.io/terms/"
+  contact:
+    email: "apiteam@swagger.io"
+  license:
+    name: "Apache 2.0"
+    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
+host: "petstore.swagger.io"
+basePath: "/v2"
+tags:
+- name: "pet"
+  description: "Everything about your Pets"
+  externalDocs:
+    description: "Find out more"
+    url: "http://swagger.io"
+- name: "store"
+  description: "Access to Petstore orders"
+- name: "user"
+  description: "Operations about user"
+  externalDocs:
+    description: "Find out more about our store"
+    url: "http://swagger.io"
+schemes:
+- "https"
+- "http"
+paths:
+  /pet:
+    post:
+      tags:
+      - "pet"
+      summary: "Add a new pet to the store"
+      description: ""
+      operationId: "addPet"
+      consumes:
+      - "application/json"
+      - "application/xml"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "Pet object that needs to be added to the store"
+        required: true
+        schema:
+          $ref: "#/definitions/Pet"
+      responses:
+        405:
+          description: "Invalid input"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+    put:
+      tags:
+      - "pet"
+      summary: "Update an existing pet"
+      description: ""
+      operationId: "updatePet"
+      consumes:
+      - "application/json"
+      - "application/xml"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "Pet object that needs to be added to the store"
+        required: true
+        schema:
+          $ref: "#/definitions/Pet"
+      responses:
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Pet not found"
+        405:
+          description: "Validation exception"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /pet/findByStatus:
+    get:
+      tags:
+      - "pet"
+      summary: "Finds Pets by status"
+      description: "Multiple status values can be provided with comma separated strings"
+      operationId: "findPetsByStatus"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "status"
+        in: "query"
+        description: "Status values that need to be considered for filter"
+        required: true
+        type: "array"
+        items:
+          type: "string"
+          enum:
+          - "available"
+          - "pending"
+          - "sold"
+          default: "available"
+        collectionFormat: "multi"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "array"
+            items:
+              $ref: "#/definitions/Pet"
+        400:
+          description: "Invalid status value"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /pet/findByTags:
+    get:
+      tags:
+      - "pet"
+      summary: "Finds Pets by tags"
+      description: "Multiple tags can be provided with comma separated strings. Use\
+        \ tag1, tag2, tag3 for testing."
+      operationId: "findPetsByTags"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "tags"
+        in: "query"
+        description: "Tags to filter by"
+        required: true
+        type: "array"
+        items:
+          type: "string"
+        collectionFormat: "multi"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "array"
+            items:
+              $ref: "#/definitions/Pet"
+        400:
+          description: "Invalid tag value"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+      deprecated: true
+  /pet/{petId}:
+    get:
+      tags:
+      - "pet"
+      summary: "Find pet by ID"
+      description: "Returns a single pet"
+      operationId: "getPetById"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "petId"
+        in: "path"
+        description: "ID of pet to return"
+        required: true
+        type: "integer"
+        format: "int64"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/Pet"
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Pet not found"
+      security:
+      - api_key: []
+    post:
+      tags:
+      - "pet"
+      summary: "Updates a pet in the store with form data"
+      description: ""
+      operationId: "updatePetWithForm"
+      consumes:
+      - "application/x-www-form-urlencoded"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "petId"
+        in: "path"
+        description: "ID of pet that needs to be updated"
+        required: true
+        type: "integer"
+        format: "int64"
+      - name: "name"
+        in: "formData"
+        description: "Updated name of the pet"
+        required: false
+        type: "string"
+      - name: "status"
+        in: "formData"
+        description: "Updated status of the pet"
+        required: false
+        type: "string"
+      responses:
+        405:
+          description: "Invalid input"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+    delete:
+      tags:
+      - "pet"
+      summary: "Deletes a pet"
+      description: ""
+      operationId: "deletePet"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "api_key"
+        in: "header"
+        required: false
+        type: "string"
+      - name: "petId"
+        in: "path"
+        description: "Pet id to delete"
+        required: true
+        type: "integer"
+        format: "int64"
+      responses:
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Pet not found"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /pet/{petId}/uploadImage:
+    post:
+      tags:
+      - "pet"
+      summary: "uploads an image"
+      description: ""
+      operationId: "uploadFile"
+      consumes:
+      - "multipart/form-data"
+      produces:
+      - "application/json"
+      parameters:
+      - name: "petId"
+        in: "path"
+        description: "ID of pet to update"
+        required: true
+        type: "integer"
+        format: "int64"
+      - name: "additionalMetadata"
+        in: "formData"
+        description: "Additional data to pass to server"
+        required: false
+        type: "string"
+      - name: "file"
+        in: "formData"
+        description: "file to upload"
+        required: false
+        type: "file"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/ApiResponse"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /store/inventory:
+    get:
+      tags:
+      - "store"
+      summary: "Returns pet inventories by status"
+      description: "Returns a map of status codes to quantities"
+      operationId: "getInventory"
+      produces:
+      - "application/json"
+      parameters: []
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "object"
+            additionalProperties:
+              type: "integer"
+              format: "int32"
+      security:
+      - api_key: []
+  /store/order:
+    post:
+      tags:
+      - "store"
+      summary: "Place an order for a pet"
+      description: ""
+      operationId: "placeOrder"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "order placed for purchasing the pet"
+        required: true
+        schema:
+          $ref: "#/definitions/Order"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/Order"
+        400:
+          description: "Invalid Order"
+  /store/order/{orderId}:
+    get:
+      tags:
+      - "store"
+      summary: "Find purchase order by ID"
+      description: "For valid response try integer IDs with value >= 1 and <= 10.\
+        \ Other values will generated exceptions"
+      operationId: "getOrderById"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "orderId"
+        in: "path"
+        description: "ID of pet that needs to be fetched"
+        required: true
+        type: "integer"
+        maximum: 10.0
+        minimum: 1.0
+        format: "int64"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/Order"
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Order not found"
+    delete:
+      tags:
+      - "store"
+      summary: "Delete purchase order by ID"
+      description: "For valid response try integer IDs with positive integer value.\
+        \ Negative or non-integer values will generate API errors"
+      operationId: "deleteOrder"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "orderId"
+        in: "path"
+        description: "ID of the order that needs to be deleted"
+        required: true
+        type: "integer"
+        minimum: 1.0
+        format: "int64"
+      responses:
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Order not found"
+  /user:
+    post:
+      tags:
+      - "user"
+      summary: "Create user"
+      description: "This can only be done by the logged in user."
+      operationId: "createUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "Created user object"
+        required: true
+        schema:
+          $ref: "#/definitions/User"
+      responses:
+        default:
+          description: "successful operation"
+  /user/createWithArray:
+    post:
+      tags:
+      - "user"
+      summary: "Creates list of users with given input array"
+      description: ""
+      operationId: "createUsersWithArrayInput"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "List of user object"
+        required: true
+        schema:
+          type: "array"
+          items:
+            $ref: "#/definitions/User"
+      responses:
+        default:
+          description: "successful operation"
+  /user/createWithList:
+    post:
+      tags:
+      - "user"
+      summary: "Creates list of users with given input array"
+      description: ""
+      operationId: "createUsersWithListInput"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "List of user object"
+        required: true
+        schema:
+          type: "array"
+          items:
+            $ref: "#/definitions/User"
+      responses:
+        default:
+          description: "successful operation"
+  /user/login:
+    get:
+      tags:
+      - "user"
+      summary: "Logs user into the system"
+      description: ""
+      operationId: "loginUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "query"
+        description: "The user name for login"
+        required: true
+        type: "string"
+      - name: "password"
+        in: "query"
+        description: "The password for login in clear text"
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "string"
+          headers:
+            X-Rate-Limit:
+              type: "integer"
+              format: "int32"
+              description: "calls per hour allowed by the user"
+            X-Expires-After:
+              type: "string"
+              format: "date-time"
+              description: "date in UTC when token expires"
+        400:
+          description: "Invalid username/password supplied"
+  /user/logout:
+    get:
+      tags:
+      - "user"
+      summary: "Logs out current logged in user session"
+      description: ""
+      operationId: "logoutUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters: []
+      responses:
+        default:
+          description: "successful operation"
+  /user/{username}:
+    get:
+      tags:
+      - "user"
+      summary: "Get user by user name"
+      description: ""
+      operationId: "getUserByName"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "path"
+        description: "The name that needs to be fetched. Use user1 for testing. "
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/User"
+        400:
+          description: "Invalid username supplied"
+        404:
+          description: "User not found"
+    put:
+      tags:
+      - "user"
+      summary: "Updated user"
+      description: "This can only be done by the logged in user."
+      operationId: "updateUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "path"
+        description: "name that need to be updated"
+        required: true
+        type: "string"
+      - in: "body"
+        name: "body"
+        description: "Updated user object"
+        required: true
+        schema:
+          $ref: "#/definitions/User"
+      responses:
+        400:
+          description: "Invalid user supplied"
+        404:
+          description: "User not found"
+    delete:
+      tags:
+      - "user"
+      summary: "Delete user"
+      description: "This can only be done by the logged in user."
+      operationId: "deleteUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "path"
+        description: "The name that needs to be deleted"
+        required: true
+        type: "string"
+      responses:
+        400:
+          description: "Invalid username supplied"
+        404:
+          description: "User not found"
+securityDefinitions:
+  petstore_auth:
+    type: "oauth2"
+    authorizationUrl: "https://petstore.swagger.io/oauth/authorize"
+    flow: "implicit"
+    scopes:
+      write:pets: "modify pets in your account"
+      read:pets: "read your pets"
+  api_key:
+    type: "apiKey"
+    name: "api_key"
+    in: "header"
+definitions:
+  Order:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      petId:
+        type: "integer"
+        format: "int64"
+      quantity:
+        type: "integer"
+        format: "int32"
+      shipDate:
+        type: "string"
+        format: "date-time"
+      status:
+        type: "string"
+        description: "Order Status"
+        enum:
+        - "placed"
+        - "approved"
+        - "delivered"
+      complete:
+        type: "boolean"
+        default: false
+    xml:
+      name: "Order"
+  User:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      username:
+        type: "string"
+      firstName:
+        type: "string"
+      lastName:
+        type: "string"
+      email:
+        type: "string"
+      password:
+        type: "string"
+      phone:
+        type: "string"
+      userStatus:
+        type: "integer"
+        format: "int32"
+        description: "User Status"
+    xml:
+      name: "User"
+  Category:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      name:
+        type: "string"
+    xml:
+      name: "Category"
+  Tag:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      name:
+        type: "string"
+    xml:
+      name: "Tag"
+  Pet:
+    type: "object"
+    required:
+    - "name"
+    - "photoUrls"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      category:
+        $ref: "#/definitions/Category"
+      name:
+        type: "string"
+        example: "doggie"
+      photoUrls:
+        type: "array"
+        xml:
+          name: "photoUrl"
+          wrapped: true
+        items:
+          type: "string"
+      tags:
+        type: "array"
+        xml:
+          name: "tag"
+          wrapped: true
+        items:
+          $ref: "#/definitions/Tag"
+      status:
+        type: "string"
+        description: "pet status in the store"
+        enum:
+        - "available"
+        - "pending"
+        - "sold"
+    xml:
+      name: "Pet"
+  ApiResponse:
+    type: "object"
+    properties:
+      code:
+        type: "integer"
+        format: "int32"
+      type:
+        type: "string"
+      message:
+        type: "string"
+externalDocs:
+  description: "Find out more about Swagger"
+  url: "http://swagger.io"
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 1151674..23107f6 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -40,6 +40,13 @@
       <artifactId>code-generator</artifactId>
       <version>${project.version}</version>
     </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
new file mode 100755
index 0000000..9c50338
--- /dev/null
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.cli;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CliTest {
+
+  @Test
+  public void generateServiceCombCodeFromSingleContract() throws IOException {
+
+    String[] programModels = new String[] {"SpringMvc"};
+    Path tempDir = Files.createTempDirectory(null);
+    Arrays.stream(programModels).forEach(model -> {
+      try {
+        Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/" + model + "Server");
+        CliTest.class.getClassLoader().getResource("swagger.yaml");
+        String[] args = new String[] {
+            "generate",
+            "-l",
+            "ServiceCombProvider",
+            "-i",
+            Paths.get("./src/test/resources/swagger.yaml").toFile().getCanonicalPath(),
+            "-o",
+            tempFile.toFile().getCanonicalPath(),
+            "--library",
+            model
+        };
+        Assert.assertTrue(!Files.exists(tempFile));
+        ToolkitMain.main(args);
+        Assert.assertTrue(Files.exists(tempFile));
+        Assert.assertTrue(Files.size(tempFile) > 0);
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+    });
+
+    tempDir.toFile().deleteOnExit();
+  }
+
+  @Test
+  public void generateSpringCloudCodeFromSingleContract() throws IOException {
+
+    Path tempDir = Files.createTempDirectory(null);
+    Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/SpringCloudServer");
+    String[] args = new String[] {
+        "generate",
+        "-l",
+        "spring",
+        "-i",
+        Paths.get("./src/test/resources/swagger.yaml").toFile().getCanonicalPath(),
+        "-o",
+        tempFile.toFile().getCanonicalPath(),
+        "--library",
+        "spring-cloud"
+    };
+    Assert.assertTrue(!Files.exists(tempFile));
+
+    ToolkitMain.main(args);
+    Assert.assertTrue(Files.exists(tempFile));
+    Assert.assertTrue(Files.size(tempFile) > 0);
+
+    tempDir.toFile().deleteOnExit();
+  }
+
+  @Test
+  public void generateCodeFromMultiContract() throws IOException {
+
+    Path tempDir = Files.createTempDirectory(null);
+    Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/ServiceCombProvider");
+    String[] args = new String[] {
+        "generate",
+        "-i",
+        Paths.get("./src/test/resources/contracts").toFile().getCanonicalPath(),
+        "--artifact-id",
+        "ServiceCombProvider",
+        "--group-id",
+        "org.apache.servicecomb.demo",
+        "--artifact-version",
+        "0.0.1",
+        "--programming-model",
+        "SpringMvc",
+        "-o",
+        tempFile.toFile().getCanonicalPath()
+    };
+
+    Assert.assertTrue(!Files.exists(tempFile));
+
+    ToolkitMain.main(args);
+
+    Assert.assertTrue(Files.exists(tempFile));
+    Assert.assertTrue(Files.size(tempFile) > 0);
+
+    tempDir.toFile().deleteOnExit();
+  }
+}
diff --git a/toolkit-cli/src/test/resources/contracts/CalculatorRestEndpoint.yaml b/toolkit-cli/src/test/resources/contracts/CalculatorRestEndpoint.yaml
new file mode 100755
index 0000000..a7540d4
--- /dev/null
+++ b/toolkit-cli/src/test/resources/contracts/CalculatorRestEndpoint.yaml
@@ -0,0 +1,43 @@
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for org.apache.servicecomb.samples.bmi.CalculatorRestEndpoint"
+  x-java-interface: "gen.swagger.CalculatorRestEndpointIntf"
+basePath: "/"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /bmi:
+    get:
+      operationId: "calculate"
+      parameters:
+      - name: "height"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      - name: "weight"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            $ref: "#/definitions/BMIViewObject"
+definitions:
+  BMIViewObject:
+    type: "object"
+    properties:
+      result:
+        type: "number"
+        format: "double"
+      instanceId:
+        type: "string"
+      callTime:
+        type: "string"
+    x-java-class: "org.apache.servicecomb.samples.bmi.BMIViewObject"
diff --git a/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml b/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml
new file mode 100755
index 0000000..14cd7a1
--- /dev/null
+++ b/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml
@@ -0,0 +1,74 @@
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  x-java-interface: "gen.swagger.HelloEndPointIntf"
+basePath: "/hello"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /sayHello:
+    get:
+      operationId: "sayHello"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "result"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      - name: "instanceId"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "callTime"
+        in: "query"
+        required: false
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayHi:
+    get:
+      operationId: "sayHi"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "Authorization"
+        in: "header"
+        description: "aa"
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayNo:
+    get:
+      operationId: "sayNo"
+      parameters:
+        - name: "name"
+          in: "query"
+          required: false
+          type: "string"
+        - name: "Authorization"
+          in: "header"
+          description: "aa"
+          required: true
+          type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
\ No newline at end of file
diff --git a/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstComputeImpl.yaml b/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstComputeImpl.yaml
new file mode 100755
index 0000000..190f579
--- /dev/null
+++ b/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstComputeImpl.yaml
@@ -0,0 +1,113 @@
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for org.apache.servicecomb.samples.pojo.provider.CodeFirstComputeImpl"
+  x-java-interface: "gen.swagger.CodeFirstComputeImplIntf"
+basePath: "/CodeFirstComputeImpl"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /add:
+    post:
+      operationId: "add"
+      parameters:
+      - in: "body"
+        name: "addBody"
+        required: false
+        schema:
+          $ref: "#/definitions/addBody"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "integer"
+            format: "int32"
+  /divide:
+    post:
+      operationId: "divide"
+      parameters:
+      - in: "body"
+        name: "divideBody"
+        required: false
+        schema:
+          $ref: "#/definitions/divideBody"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "integer"
+            format: "int32"
+  /multi:
+    post:
+      operationId: "multi"
+      parameters:
+      - in: "body"
+        name: "multiBody"
+        required: false
+        schema:
+          $ref: "#/definitions/multiBody"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "integer"
+            format: "int32"
+  /sub:
+    post:
+      operationId: "sub"
+      parameters:
+      - in: "body"
+        name: "subBody"
+        required: false
+        schema:
+          $ref: "#/definitions/subBody"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "integer"
+            format: "int32"
+definitions:
+  addBody:
+    type: "object"
+    properties:
+      a:
+        type: "integer"
+        format: "int32"
+      b:
+        type: "integer"
+        format: "int32"
+    x-java-class: "gen.swagger.addBody"
+  divideBody:
+    type: "object"
+    properties:
+      a:
+        type: "integer"
+        format: "int32"
+      b:
+        type: "integer"
+        format: "int32"
+    x-java-class: "gen.swagger.divideBody"
+  multiBody:
+    type: "object"
+    properties:
+      a:
+        type: "integer"
+        format: "int32"
+      b:
+        type: "integer"
+        format: "int32"
+    x-java-class: "gen.swagger.multiBody"
+  subBody:
+    type: "object"
+    properties:
+      a:
+        type: "integer"
+        format: "int32"
+      b:
+        type: "integer"
+        format: "int32"
+    x-java-class: "gen.swagger.subBody"
diff --git a/toolkit-cli/src/test/resources/swagger.yaml b/toolkit-cli/src/test/resources/swagger.yaml
new file mode 100755
index 0000000..b97799c
--- /dev/null
+++ b/toolkit-cli/src/test/resources/swagger.yaml
@@ -0,0 +1,707 @@
+---
+swagger: "2.0"
+info:
+  description: "This is a sample server Petstore server.  You can find out more about\
+    \ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
+    \  For this sample, you can use the api key `special-key` to test the authorization\
+    \ filters."
+  version: "1.0.0"
+  title: "Swagger Petstore"
+  termsOfService: "http://swagger.io/terms/"
+  contact:
+    email: "apiteam@swagger.io"
+  license:
+    name: "Apache 2.0"
+    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
+host: "petstore.swagger.io"
+basePath: "/v2"
+tags:
+- name: "pet"
+  description: "Everything about your Pets"
+  externalDocs:
+    description: "Find out more"
+    url: "http://swagger.io"
+- name: "store"
+  description: "Access to Petstore orders"
+- name: "user"
+  description: "Operations about user"
+  externalDocs:
+    description: "Find out more about our store"
+    url: "http://swagger.io"
+schemes:
+- "https"
+- "http"
+paths:
+  /pet:
+    post:
+      tags:
+      - "pet"
+      summary: "Add a new pet to the store"
+      description: ""
+      operationId: "addPet"
+      consumes:
+      - "application/json"
+      - "application/xml"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "Pet object that needs to be added to the store"
+        required: true
+        schema:
+          $ref: "#/definitions/Pet"
+      responses:
+        405:
+          description: "Invalid input"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+    put:
+      tags:
+      - "pet"
+      summary: "Update an existing pet"
+      description: ""
+      operationId: "updatePet"
+      consumes:
+      - "application/json"
+      - "application/xml"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "Pet object that needs to be added to the store"
+        required: true
+        schema:
+          $ref: "#/definitions/Pet"
+      responses:
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Pet not found"
+        405:
+          description: "Validation exception"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /pet/findByStatus:
+    get:
+      tags:
+      - "pet"
+      summary: "Finds Pets by status"
+      description: "Multiple status values can be provided with comma separated strings"
+      operationId: "findPetsByStatus"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "status"
+        in: "query"
+        description: "Status values that need to be considered for filter"
+        required: true
+        type: "array"
+        items:
+          type: "string"
+          enum:
+          - "available"
+          - "pending"
+          - "sold"
+          default: "available"
+        collectionFormat: "multi"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "array"
+            items:
+              $ref: "#/definitions/Pet"
+        400:
+          description: "Invalid status value"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /pet/findByTags:
+    get:
+      tags:
+      - "pet"
+      summary: "Finds Pets by tags"
+      description: "Multiple tags can be provided with comma separated strings. Use\
+        \ tag1, tag2, tag3 for testing."
+      operationId: "findPetsByTags"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "tags"
+        in: "query"
+        description: "Tags to filter by"
+        required: true
+        type: "array"
+        items:
+          type: "string"
+        collectionFormat: "multi"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "array"
+            items:
+              $ref: "#/definitions/Pet"
+        400:
+          description: "Invalid tag value"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+      deprecated: true
+  /pet/{petId}:
+    get:
+      tags:
+      - "pet"
+      summary: "Find pet by ID"
+      description: "Returns a single pet"
+      operationId: "getPetById"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "petId"
+        in: "path"
+        description: "ID of pet to return"
+        required: true
+        type: "integer"
+        format: "int64"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/Pet"
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Pet not found"
+      security:
+      - api_key: []
+    post:
+      tags:
+      - "pet"
+      summary: "Updates a pet in the store with form data"
+      description: ""
+      operationId: "updatePetWithForm"
+      consumes:
+      - "application/x-www-form-urlencoded"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "petId"
+        in: "path"
+        description: "ID of pet that needs to be updated"
+        required: true
+        type: "integer"
+        format: "int64"
+      - name: "name"
+        in: "formData"
+        description: "Updated name of the pet"
+        required: false
+        type: "string"
+      - name: "status"
+        in: "formData"
+        description: "Updated status of the pet"
+        required: false
+        type: "string"
+      responses:
+        405:
+          description: "Invalid input"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+    delete:
+      tags:
+      - "pet"
+      summary: "Deletes a pet"
+      description: ""
+      operationId: "deletePet"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "api_key"
+        in: "header"
+        required: false
+        type: "string"
+      - name: "petId"
+        in: "path"
+        description: "Pet id to delete"
+        required: true
+        type: "integer"
+        format: "int64"
+      responses:
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Pet not found"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /pet/{petId}/uploadImage:
+    post:
+      tags:
+      - "pet"
+      summary: "uploads an image"
+      description: ""
+      operationId: "uploadFile"
+      consumes:
+      - "multipart/form-data"
+      produces:
+      - "application/json"
+      parameters:
+      - name: "petId"
+        in: "path"
+        description: "ID of pet to update"
+        required: true
+        type: "integer"
+        format: "int64"
+      - name: "additionalMetadata"
+        in: "formData"
+        description: "Additional data to pass to server"
+        required: false
+        type: "string"
+      - name: "file"
+        in: "formData"
+        description: "file to upload"
+        required: false
+        type: "file"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/ApiResponse"
+      security:
+      - petstore_auth:
+        - "write:pets"
+        - "read:pets"
+  /store/inventory:
+    get:
+      tags:
+      - "store"
+      summary: "Returns pet inventories by status"
+      description: "Returns a map of status codes to quantities"
+      operationId: "getInventory"
+      produces:
+      - "application/json"
+      parameters: []
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "object"
+            additionalProperties:
+              type: "integer"
+              format: "int32"
+      security:
+      - api_key: []
+  /store/order:
+    post:
+      tags:
+      - "store"
+      summary: "Place an order for a pet"
+      description: ""
+      operationId: "placeOrder"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "order placed for purchasing the pet"
+        required: true
+        schema:
+          $ref: "#/definitions/Order"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/Order"
+        400:
+          description: "Invalid Order"
+  /store/order/{orderId}:
+    get:
+      tags:
+      - "store"
+      summary: "Find purchase order by ID"
+      description: "For valid response try integer IDs with value >= 1 and <= 10.\
+        \ Other values will generated exceptions"
+      operationId: "getOrderById"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "orderId"
+        in: "path"
+        description: "ID of pet that needs to be fetched"
+        required: true
+        type: "integer"
+        maximum: 10.0
+        minimum: 1.0
+        format: "int64"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/Order"
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Order not found"
+    delete:
+      tags:
+      - "store"
+      summary: "Delete purchase order by ID"
+      description: "For valid response try integer IDs with positive integer value.\
+        \ Negative or non-integer values will generate API errors"
+      operationId: "deleteOrder"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "orderId"
+        in: "path"
+        description: "ID of the order that needs to be deleted"
+        required: true
+        type: "integer"
+        minimum: 1.0
+        format: "int64"
+      responses:
+        400:
+          description: "Invalid ID supplied"
+        404:
+          description: "Order not found"
+  /user:
+    post:
+      tags:
+      - "user"
+      summary: "Create user"
+      description: "This can only be done by the logged in user."
+      operationId: "createUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "Created user object"
+        required: true
+        schema:
+          $ref: "#/definitions/User"
+      responses:
+        default:
+          description: "successful operation"
+  /user/createWithArray:
+    post:
+      tags:
+      - "user"
+      summary: "Creates list of users with given input array"
+      description: ""
+      operationId: "createUsersWithArrayInput"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "List of user object"
+        required: true
+        schema:
+          type: "array"
+          items:
+            $ref: "#/definitions/User"
+      responses:
+        default:
+          description: "successful operation"
+  /user/createWithList:
+    post:
+      tags:
+      - "user"
+      summary: "Creates list of users with given input array"
+      description: ""
+      operationId: "createUsersWithListInput"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - in: "body"
+        name: "body"
+        description: "List of user object"
+        required: true
+        schema:
+          type: "array"
+          items:
+            $ref: "#/definitions/User"
+      responses:
+        default:
+          description: "successful operation"
+  /user/login:
+    get:
+      tags:
+      - "user"
+      summary: "Logs user into the system"
+      description: ""
+      operationId: "loginUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "query"
+        description: "The user name for login"
+        required: true
+        type: "string"
+      - name: "password"
+        in: "query"
+        description: "The password for login in clear text"
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            type: "string"
+          headers:
+            X-Rate-Limit:
+              type: "integer"
+              format: "int32"
+              description: "calls per hour allowed by the user"
+            X-Expires-After:
+              type: "string"
+              format: "date-time"
+              description: "date in UTC when token expires"
+        400:
+          description: "Invalid username/password supplied"
+  /user/logout:
+    get:
+      tags:
+      - "user"
+      summary: "Logs out current logged in user session"
+      description: ""
+      operationId: "logoutUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters: []
+      responses:
+        default:
+          description: "successful operation"
+  /user/{username}:
+    get:
+      tags:
+      - "user"
+      summary: "Get user by user name"
+      description: ""
+      operationId: "getUserByName"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "path"
+        description: "The name that needs to be fetched. Use user1 for testing. "
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/User"
+        400:
+          description: "Invalid username supplied"
+        404:
+          description: "User not found"
+    put:
+      tags:
+      - "user"
+      summary: "Updated user"
+      description: "This can only be done by the logged in user."
+      operationId: "updateUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "path"
+        description: "name that need to be updated"
+        required: true
+        type: "string"
+      - in: "body"
+        name: "body"
+        description: "Updated user object"
+        required: true
+        schema:
+          $ref: "#/definitions/User"
+      responses:
+        400:
+          description: "Invalid user supplied"
+        404:
+          description: "User not found"
+    delete:
+      tags:
+      - "user"
+      summary: "Delete user"
+      description: "This can only be done by the logged in user."
+      operationId: "deleteUser"
+      produces:
+      - "application/xml"
+      - "application/json"
+      parameters:
+      - name: "username"
+        in: "path"
+        description: "The name that needs to be deleted"
+        required: true
+        type: "string"
+      responses:
+        400:
+          description: "Invalid username supplied"
+        404:
+          description: "User not found"
+securityDefinitions:
+  petstore_auth:
+    type: "oauth2"
+    authorizationUrl: "https://petstore.swagger.io/oauth/authorize"
+    flow: "implicit"
+    scopes:
+      write:pets: "modify pets in your account"
+      read:pets: "read your pets"
+  api_key:
+    type: "apiKey"
+    name: "api_key"
+    in: "header"
+definitions:
+  Order:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      petId:
+        type: "integer"
+        format: "int64"
+      quantity:
+        type: "integer"
+        format: "int32"
+      shipDate:
+        type: "string"
+        format: "date-time"
+      status:
+        type: "string"
+        description: "Order Status"
+        enum:
+        - "placed"
+        - "approved"
+        - "delivered"
+      complete:
+        type: "boolean"
+        default: false
+    xml:
+      name: "Order"
+  User:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      username:
+        type: "string"
+      firstName:
+        type: "string"
+      lastName:
+        type: "string"
+      email:
+        type: "string"
+      password:
+        type: "string"
+      phone:
+        type: "string"
+      userStatus:
+        type: "integer"
+        format: "int32"
+        description: "User Status"
+    xml:
+      name: "User"
+  Category:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      name:
+        type: "string"
+    xml:
+      name: "Category"
+  Tag:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      name:
+        type: "string"
+    xml:
+      name: "Tag"
+  Pet:
+    type: "object"
+    required:
+    - "name"
+    - "photoUrls"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      category:
+        $ref: "#/definitions/Category"
+      name:
+        type: "string"
+        example: "doggie"
+      photoUrls:
+        type: "array"
+        xml:
+          name: "photoUrl"
+          wrapped: true
+        items:
+          type: "string"
+      tags:
+        type: "array"
+        xml:
+          name: "tag"
+          wrapped: true
+        items:
+          $ref: "#/definitions/Tag"
+      status:
+        type: "string"
+        description: "pet status in the store"
+        enum:
+        - "available"
+        - "pending"
+        - "sold"
+    xml:
+      name: "Pet"
+  ApiResponse:
+    type: "object"
+    properties:
+      code:
+        type: "integer"
+        format: "int32"
+      type:
+        type: "string"
+      message:
+        type: "string"
+externalDocs:
+  description: "Find out more about Swagger"
+  url: "http://swagger.io"


[servicecomb-toolkit] 05/49: Fix bug about ServiceComb code model

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit fbae606eb70656743af0f605f88ead4f32f8d2a9
Author: MabinGo <bi...@huawei.com>
AuthorDate: Mon May 20 19:33:38 2019 +0800

    Fix bug about ServiceComb code model
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../toolkit/codegen/ServiceCombProviderCodegen.java      | 16 ++++++----------
 .../org/apache/servicecomb/toolkit/cli/CodeGenerate.java |  3 ---
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
index 25b345f..fb6fb34 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
@@ -35,8 +35,6 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C
 
   private String resourcesFolder = projectFolder + File.separator + "resources";
 
-  private String apiVersion = "1.0.0";
-
   private String mainClassPackage;
 
 
@@ -66,14 +64,12 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C
 
     embeddedTemplateDir = templateDir = "ServiceCombProvider";
 
-    apiPackage = "servicecomb.example.controller";
-
-    modelPackage = "servicecomb.example.model";
-
-    mainClassPackage = "servicecomb.example";
-
     groupId = "org.apache.servicecomb";
-    artifactId = "demo";
+    artifactId = "example";
+
+    apiPackage = groupId + ".example.controller";
+    modelPackage = groupId + ".example.model";
+    mainClassPackage = groupId + ".example";
 
     supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
 
@@ -94,7 +90,6 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C
     importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
     additionalProperties.put("dateLibrary", "java8");
     additionalProperties.put("jackson", "true");
-    additionalProperties.put("apiVersion", apiVersion);
     additionalProperties.put("mainClassPackage", mainClassPackage);
     additionalProperties.put("camelcase", new CamelCaseLambda());
 
@@ -107,6 +102,7 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C
         "README.md")
     );
 
+
     supportingFiles.add(new SupportingFile("Application.mustache",
         mainClassFolder(),
         "Application.java")
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index c9506ce..8c06581 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -85,9 +85,7 @@ public class CodeGenerate implements Runnable {
 
       File contractFile = new File(spec);
 
-      // has many contracts
       if (contractFile.isDirectory()) {
-
         try {
           Files.walkFileTree(Paths.get(contractFile.toURI()), new SimpleFileVisitor<Path>() {
             @Override
@@ -105,7 +103,6 @@ public class CodeGenerate implements Runnable {
           e.printStackTrace();
         }
       } else {
-        // one contract
         configurator.setInputSpec(spec);
         new DefaultCodeGenerator().opts(configurator).generate();
       }


[servicecomb-toolkit] 01/49: Initial commit

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 912c57fabadb5dfa7c2aa66120000574c00c4a4d
Author: Mabin <bi...@huawei.com>
AuthorDate: Thu May 16 15:03:17 2019 +0800

    Initial commit
---
 LICENSE   | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 README.md |   2 +
 2 files changed, 203 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a934330
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# toolkit
+microservice development toolkit


[servicecomb-toolkit] 13/49: Support JAX-RS programming model

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 724530468772e99748dc47def6beda76e2eddbcb
Author: MabinGo <bi...@huawei.com>
AuthorDate: Fri May 24 10:38:28 2019 +0800

    Support JAX-RS programming model
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../toolkit/codegen/RemoveImplSuffixLambda.java    |  14 +--
 .../toolkit/codegen/ServiceCombCodegen.java        |  14 +--
 .../src/main/resources/ServiceComb/README.mustache |  20 ----
 .../ServiceComb/consumer/microservice.mustache     |  17 ---
 .../resources/ServiceComb/enumOuterClass.mustache  |   1 -
 .../libraries/JAX-RS/Application.mustache          |  11 ++
 .../ServiceComb/libraries/JAX-RS/api.mustache      |  39 +++++++
 .../ServiceComb/libraries/JAX-RS/api_test.mustache |  39 +++++++
 .../libraries/JAX-RS/bodyParams.mustache           |   1 +
 .../libraries/JAX-RS/formParams.mustache           |   2 +
 .../libraries/JAX-RS/headerParams.mustache         |   1 +
 .../libraries/JAX-RS/pathParams.mustache           |   1 +
 .../ServiceComb/libraries/JAX-RS/pom.mustache      | 126 +++++++++++++++++++++
 .../libraries/JAX-RS/queryParams.mustache          |   1 +
 .../libraries/SpringMVC/Application.mustache       |  17 ---
 .../libraries/SpringMVC/api_test.mustache          |   1 +
 .../src/main/resources/ServiceComb/log4j2.mustache |  18 ---
 .../ServiceComb/provider/microservice.mustache     |  17 ---
 .../servicecomb/toolkit/codegen/GeneratorTest.java |   1 +
 .../toolkit/{ => common}/ContractsUtils.java       |   2 +-
 .../toolkit/{ => common}/ImmediateClassLoader.java |   2 +-
 .../docgen/ContractsAsciidocGenerator.java         |   4 +-
 .../docgen/ContractsSwaggerUIGenerator.java        |   2 +-
 .../{ => toolkit}/docgen/DocGenerator.java         |   2 +-
 .../{ => toolkit}/docgen/DocGeneratorManager.java  |   2 +-
 ...apache.servicecomb.toolkit.docgen.DocGenerator} |   4 +-
 .../servicecomb/toolkit/cli/CodeGenerate.java      |   4 +-
 .../servicecomb/toolkit/cli/DocGenerate.java       |   5 +-
 .../src/main/resources/application.properties      |  17 +++
 .../apache/servicecomb/toolkit/cli/CliTest.java    |   2 +-
 .../toolkit/plugin/ContractGenerator.java          |   2 +-
 .../toolkit/plugin/GenerateContractsDocMojo.java   |   2 +-
 32 files changed, 268 insertions(+), 123 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
index 519a584..c322667 100644
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
@@ -17,23 +17,21 @@
 
 package org.apache.servicecomb.toolkit.codegen;
 
-import com.samskivert.mustache.Mustache;
-import com.samskivert.mustache.Template;
-
 import java.io.IOException;
 import java.io.Writer;
 
-public class RemoveImplSuffixLambda implements Mustache.Lambda  {
+import com.samskivert.mustache.Mustache;
+import com.samskivert.mustache.Template;
+
+public class RemoveImplSuffixLambda implements Mustache.Lambda {
 
   @Override
   public void execute(Template.Fragment fragment, Writer writer) throws IOException {
 
     String text = fragment.execute();
-    if(text.endsWith("Impl")){
-      text = text.substring(0,text.lastIndexOf("Impl"));
+    if (text.endsWith("Impl")) {
+      text = text.substring(0, text.lastIndexOf("Impl"));
     }
     writer.write(text);
-
   }
-
 }
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index 36efe5b..668db24 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -37,6 +37,8 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private static final String POJO_LIBRARY = "POJO";
 
+  private static final String JAX_RS_LIBRARY = "JAX-RS";
+
   private String mainClassPackage;
 
   private String providerProject = "provider";
@@ -101,6 +103,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
     supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
     supportedLibraries.put(POJO_LIBRARY, "ServiceComb Server application using the pojo programming model.");
+    supportedLibraries.put(JAX_RS_LIBRARY, "ServiceComb Server application using the jax-rs programming model.");
 
     setLibrary(DEFAULT_LIBRARY);
 
@@ -129,8 +132,8 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     }
     if (pojoApiInterfaceTemplate.equals(templateName)) {
       String suffix = apiTemplateFiles().get(templateName);
-      String pojoApiInterfaceName =  pojoApiInterfaceFolder() + File.separator +  camelize(tag) + "Api" + suffix;
-      additionalProperties.put("pojoApiInterfaceName",camelize(tag) + "Api");
+      String pojoApiInterfaceName = pojoApiInterfaceFolder() + File.separator + camelize(tag) + "Api" + suffix;
+      additionalProperties.put("pojoApiInterfaceName", camelize(tag) + "Api");
       return pojoApiInterfaceName;
     }
     return super.apiFilename(templateName, tag);
@@ -201,11 +204,6 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
         "pom.xml")
     );
 
-    supportingFiles.add(new SupportingFile("README.mustache",
-        providerProject,
-        "README.md")
-    );
-
     supportingFiles.add(new SupportingFile("Application.mustache",
         mainClassFolder(providerProject),
         "Application.java")
@@ -264,7 +262,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
       return apiName;
     }
 
-    if(POJO_LIBRARY.equals(getLibrary())){
+    if (POJO_LIBRARY.equals(getLibrary())) {
       return initialCaps(name) + "ApiImpl";
     }
 
diff --git a/code-generator/src/main/resources/ServiceComb/README.mustache b/code-generator/src/main/resources/ServiceComb/README.mustache
deleted file mode 100755
index 2258a49..0000000
--- a/code-generator/src/main/resources/ServiceComb/README.mustache
+++ /dev/null
@@ -1,20 +0,0 @@
-## Welcome to use ServiceComb Java Chassis
-This project(module) is generate by *org.apache.servicecomb.archetypes:business-service-springmvc-archetype*, it use **springmvc provider** to develop service producer.
-
-### More works can be done further:
-1. Modify "HelloImpl", add your business service logic, or create some new producers to provide your services. More details can be found : http://servicecomb.apache.org/users/develop-with-springmvc/
-2. Modify "microservice.yaml", change APPLICATION_ID, service_description.name, version, and service center address, endpoints publish address etc. More details can be found : http://servicecomb.apache.org/users/service-definition/
-3. Modify setting value of "mainClass" in pom.xml for package.
-
-### Package your service
-Under project(module) root folder, run
-```bash
-mvn package
-```
-Then you can get outputs in target folder:
-- lib : contains all dependencies jars
-- xxxxxx-{version}.jar
-```bash
-java -jar xxxxxx-{version}.jar
-```
-*Notice: If you need to modify config setting in "microservice.yaml" like service center address but don't want repackage the executable jar, **you can direct place a new "microservice.yaml" file in same folder, then settings will be overridden.***
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache b/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
index 72d38b6..113cb37 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
@@ -1,20 +1,3 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
 #Indicates an application name
 APPLICATION_ID: {{applicationId}}
 service_description:
diff --git a/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache b/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
index a5f0034..6666a6a 100755
--- a/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
+++ b/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
@@ -1,4 +1,3 @@
-
 /**
  * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
  */
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
new file mode 100755
index 0000000..fda8d43
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
@@ -0,0 +1,11 @@
+package {{mainClassPackage}};
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+
+public class Application {
+
+  public static void main(String[] args) throws Exception {
+    System.setProperty("local.registry.file", "notExistJustForceLocal");
+    BeanUtils.init();
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
new file mode 100755
index 0000000..750d5ba
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
@@ -0,0 +1,39 @@
+package {{package}};
+
+{{#models}}import {{modelPackage}}.*;{{/models}}
+import io.swagger.annotations.ApiParam;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+import java.util.Map;
+import java.util.List;
+
+import java.io.InputStream;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.Part;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.*;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+
+@RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+@Path("/")
+{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
+{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
+{{#operations}}
+public class {{classname}}  {
+
+{{#operation}}
+    @Path("{{{path}}}")
+    @{{httpMethod}}
+    {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
+    {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
+    public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) {
+        return null;
+    }
+{{/operation}}
+}
+{{/operations}}
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api_test.mustache
new file mode 100755
index 0000000..8f93bb4
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api_test.mustache
@@ -0,0 +1,39 @@
+package {{package}};
+
+{{#imports}}import {{import}};
+{{/imports}}
+import java.util.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class {{classname}}Test {
+@Autowired
+private {{classname}} api;
+{{#operations}}
+    {{#operation}}
+        @Test
+        public void {{operationId}}Test() throws Exception {
+        {{#allParams}}
+        {{^isFile}}
+            {{{dataType}}} {{paramName}} = {{{example}}};
+        {{/isFile}}
+        {{#isFile}}
+            org.springframework.web.multipart.MultipartFile {{paramName}} = null;
+        {{/isFile}}
+        {{/allParams}}
+            ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+            assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
+        }
+    {{/operation}}
+{{/operations}}
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache
new file mode 100755
index 0000000..bb1d6ff
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache
@@ -0,0 +1 @@
+{{#isBodyParam}} {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
new file mode 100755
index 0000000..5a4ebf2
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
@@ -0,0 +1,2 @@
+{{#isFormParam}}{{#notFile}} {{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}")  {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}")  {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}}
+            Part {{paramName}}{{/isFile}}{{/isFormParam}}
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache
new file mode 100755
index 0000000..25d690c
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache
@@ -0,0 +1 @@
+{{#isHeaderParam}}@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache
new file mode 100755
index 0000000..10c55d6
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache
@@ -0,0 +1 @@
+{{#isPathParam}}@PathParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
new file mode 100755
index 0000000..35ec7b1
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
@@ -0,0 +1,126 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <artifactId>{{artifactId}}</artifactId>
+    <groupId>{{groupId}}</groupId>
+    <version>{{artifactVersion}}</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>provider</artifactId>
+  <packaging>jar</packaging>
+  <name>{{artifactId}}</name>
+
+  <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+      <dependency>
+          <groupId>{{groupId}}</groupId>
+          <artifactId>model</artifactId>
+          <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>handler-bizkeeper</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>handler-loadbalance</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>handler-flowcontrol-qps</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-jaxrs</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-slf4j-impl</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-api</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.logging.log4j</groupId>
+        <artifactId>log4j-core</artifactId>
+      </dependency>
+
+  </dependencies>
+
+  <!--for package and deploy-->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <classpathPrefix>lib/</classpathPrefix>
+              <!--change to your main class-->
+              <mainClass>${package}.Application</mainClass>
+            </manifest>
+            <manifestEntries>
+              <Class-Path>. </Class-Path>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/lib</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache
new file mode 100755
index 0000000..458b8de
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache
@@ -0,0 +1 @@
+{{#isQueryParam}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
index aef3762..fda8d43 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
@@ -1,20 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 package {{mainClassPackage}};
 
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
index 8d2d3a2..3a7bed4 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
@@ -1,4 +1,5 @@
 package {{package}};
+
 {{#imports}}import {{import}};
 {{/imports}}
 import java.util.*;
diff --git a/code-generator/src/main/resources/ServiceComb/log4j2.mustache b/code-generator/src/main/resources/ServiceComb/log4j2.mustache
index e43e15b..8d29bbd 100755
--- a/code-generator/src/main/resources/ServiceComb/log4j2.mustache
+++ b/code-generator/src/main/resources/ServiceComb/log4j2.mustache
@@ -1,21 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
 <!--this is sample configuration, please modify as your wish-->
 <configuration>
   <Properties>
diff --git a/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache b/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
index fba2e77..6846c4a 100755
--- a/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
+++ b/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
@@ -1,20 +1,3 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
 #Indicates an application name
 APPLICATION_ID: {{applicationId}}
 service_description:
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index 3156fae..08f5ae3 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -39,6 +39,7 @@ public class GeneratorTest {
 
     generateCode("SpringMVC");
     generateCode("POJO");
+    generateCode("JAX-RS");
   }
 
   private void generateCode(String programmingModel) throws IOException, URISyntaxException {
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/ContractsUtils.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
similarity index 99%
rename from common/src/main/java/org/apache/servicecomb/toolkit/ContractsUtils.java
rename to common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
index 032e458..01143f0 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/ContractsUtils.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit;
+package org.apache.servicecomb.toolkit.common;
 
 import java.io.File;
 import java.io.IOException;
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/ImmediateClassLoader.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
similarity index 97%
rename from common/src/main/java/org/apache/servicecomb/toolkit/ImmediateClassLoader.java
rename to common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
index 421aa1a..f03314a 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/ImmediateClassLoader.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit;
+package org.apache.servicecomb.toolkit.common;
 
 import java.io.File;
 import java.net.URL;
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsAsciidocGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
similarity index 96%
rename from doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsAsciidocGenerator.java
rename to doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
index 1e28116..a653ee4 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsAsciidocGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
@@ -15,12 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.docgen;
+package org.apache.servicecomb.toolkit.docgen;
 
 import java.io.IOException;
 import java.nio.file.Files;
-import java.nio.file.OpenOption;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Map;
 
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsSwaggerUIGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
similarity index 98%
rename from doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsSwaggerUIGenerator.java
rename to doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
index 2f154b5..26a0aa1 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsSwaggerUIGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.docgen;
+package org.apache.servicecomb.toolkit.docgen;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
similarity index 95%
rename from doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGenerator.java
rename to doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
index 6381e5e..6fb053a 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.docgen;
+package org.apache.servicecomb.toolkit.docgen;
 
 import io.swagger.models.Swagger;
 
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGeneratorManager.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGeneratorManager.java
similarity index 97%
rename from doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGeneratorManager.java
rename to doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGeneratorManager.java
index 17566b8..a2b6bc3 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGeneratorManager.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGeneratorManager.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.docgen;
+package org.apache.servicecomb.toolkit.docgen;
 
 import java.util.ServiceLoader;
 import java.util.concurrent.CopyOnWriteArrayList;
diff --git a/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.docgen.DocGenerator b/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.docgen.DocGenerator
similarity index 85%
rename from doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.docgen.DocGenerator
rename to doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.docgen.DocGenerator
index aa6fb85..5b1bb73 100755
--- a/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.docgen.DocGenerator
+++ b/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.docgen.DocGenerator
@@ -15,5 +15,5 @@
 # limitations under the License.
 #
 
-org.apache.servicecomb.docgen.ContractsAsciidocGenerator
-org.apache.servicecomb.docgen.ContractsSwaggerUIGenerator
\ No newline at end of file
+org.apache.servicecomb.toolkit.docgen.ContractsAsciidocGenerator
+org.apache.servicecomb.toolkit.docgen.ContractsSwaggerUIGenerator
\ No newline at end of file
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index 2e5da64..4034812 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -42,7 +42,7 @@ public class CodeGenerate implements Runnable {
       description = "programming model, as SpringMVC, POJO or JAX-RS")
   private String programmingModel;
 
-  @Option(name = {"-m", "--microservice-framework"}, title = "language",
+  @Option(name = {"-m", "--microservice-framework"}, title = "framework",
       description = "microservice-framework")
   private String framework = "ServiceComb";
 
@@ -59,7 +59,7 @@ public class CodeGenerate implements Runnable {
   private String groupId;
 
   @Option(name = {"--artifact-id"}, title = "artifact id",
-      description = "artifact version in generated microservice project")
+      description = "artifact id in generated microservice project")
   private String artifactId;
 
   @Option(name = {"--artifact-version"}, title = "artifact version",
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index 755abcf..85fc0e6 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -26,7 +26,7 @@ import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 
-import org.apache.servicecomb.docgen.DocGeneratorManager;
+import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
 import org.apache.servicecomb.swagger.SwaggerUtils;
 
 import io.airlift.airline.Command;
@@ -69,7 +69,8 @@ public class DocGenerate implements Runnable {
       } else {
 
         DocGeneratorManager.generate(SwaggerUtils.parseSwagger(new File(specFile).toURI().toURL()),
-            output + File.separator + new File(specFile).getName().substring(0, new File(specFile).getName().indexOf(".")),
+            output + File.separator + new File(specFile).getName()
+                .substring(0, new File(specFile).getName().indexOf(".")),
             format);
       }
     } catch (IOException e) {
diff --git a/toolkit-cli/src/main/resources/application.properties b/toolkit-cli/src/main/resources/application.properties
index e5683df..a278788 100755
--- a/toolkit-cli/src/main/resources/application.properties
+++ b/toolkit-cli/src/main/resources/application.properties
@@ -1 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 version=${project.version}
\ No newline at end of file
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index f8ef465..b2a7664 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -31,7 +31,7 @@ public class CliTest {
   @Test
   public void generateServiceCombCodeFromSingleContract() throws IOException {
 
-    String[] programModels = new String[] {"SpringMVC","POJO"};
+    String[] programModels = new String[] {"SpringMVC", "POJO", "JAX-RS"};
     Path tempDir = Files.createTempDirectory(null);
     Arrays.stream(programModels).forEach(model -> {
       try {
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
index 85bce32..128dcaa 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
@@ -24,7 +24,7 @@ import java.util.List;
 
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.project.MavenProject;
-import org.apache.servicecomb.toolkit.ContractsUtils;
+import org.apache.servicecomb.toolkit.common.ContractsUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
index 200d177..c36cd3a 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
@@ -35,7 +35,7 @@ import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.servicecomb.docgen.DocGeneratorManager;
+import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
 import org.apache.servicecomb.swagger.SwaggerUtils;
 
 @Mojo(name = "generateDoc", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)


[servicecomb-toolkit] 30/49: Adjust mustache model and bugfixed

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 14479e7d444b15f27d4558d3494f5f62d1ff655f
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu May 30 20:29:46 2019 +0800

    Adjust mustache model and bugfixed
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../toolkit/codegen/ServiceCombCodegen.java        |  10 +-
 .../ServiceComb/consumer/Application.mustache      |  24 +---
 .../ServiceComb/consumer/apiConsumer.mustache      |  79 +++++------
 .../consumer/formParamsConsumer.mustache           |   3 +-
 .../resources/ServiceComb/consumer/pom.mustache    | 105 ++++++++-------
 .../main/resources/ServiceComb/enumClass.mustache  |  71 +++++-----
 .../resources/ServiceComb/enumOuterClass.mustache  |  12 +-
 .../libraries/JAX-RS/Application.mustache          |   1 -
 .../ServiceComb/libraries/JAX-RS/api.mustache      |  37 +++--
 .../ServiceComb/libraries/JAX-RS/api_test.mustache |  39 ------
 .../libraries/JAX-RS/formParams.mustache           |   3 +-
 .../ServiceComb/libraries/JAX-RS/pom.mustache      | 150 ++++++++++-----------
 .../libraries/POJO/Application.mustache            |   1 -
 .../ServiceComb/libraries/POJO/api.mustache        |  21 ++-
 .../libraries/POJO/apiInterface.mustache           |  16 +--
 .../ServiceComb/libraries/POJO/formParams.mustache |   3 +-
 .../ServiceComb/libraries/POJO/pom.mustache        |  69 +++++-----
 .../libraries/SpringBoot/Application.mustache      |   1 -
 .../ServiceComb/libraries/SpringBoot/api.mustache  |  13 +-
 .../libraries/SpringBoot/api_test.mustache         |  38 ------
 .../libraries/SpringBoot/formParams.mustache       |   3 +-
 .../libraries/SpringBoot/operationMethod.mustache  |  13 +-
 .../ServiceComb/libraries/SpringBoot/pom.mustache  |  69 +++++-----
 .../libraries/SpringMVC/Application.mustache       |   1 -
 .../ServiceComb/libraries/SpringMVC/api.mustache   |  31 ++---
 .../libraries/SpringMVC/api_test.mustache          | 103 --------------
 .../libraries/SpringMVC/formParams.mustache        |   3 +-
 .../ServiceComb/libraries/SpringMVC/pom.mustache   |  68 +++++-----
 .../resources/ServiceComb/model/model.mustache     |   9 --
 .../main/resources/ServiceComb/model/pom.mustache  |  20 +--
 .../src/main/resources/ServiceComb/pojo.mustache   | 111 ++++-----------
 .../resources/ServiceComb/project/pom.mustache     |  90 +++++--------
 .../toolkit/common/ImmediateClassLoader.java       |   6 +-
 .../toolkit/common/TextCompareTest.java            |  31 +++--
 .../docgen/ContractsSwaggerUIGenerator.java        |   5 +-
 .../src/test/java/docgen/DocGeneratorTest.java     | 122 ++++++++---------
 toolkit-cli/pom.xml                                |  26 +++-
 .../servicecomb/toolkit/cli/CodeGenerate.java      |  15 ++-
 .../servicecomb/toolkit/cli/DocGenerate.java       |  31 ++++-
 .../servicecomb/toolkit/cli/ToolkitMain.java       |   2 +-
 toolkit-cli/src/main/resources/log4j2.xml          |  35 +++++
 .../apache/servicecomb/toolkit/cli/CliTest.java    |   2 +-
 .../java/plugin/GenerateContractsDocMojoTest.java  |  21 ++-
 .../java/plugin/GenerateContractsMojoTest.java     |  26 ++--
 .../projects/project-generateContracts/pom.xml     |  52 +++----
 .../projects/project-generateContractsDoc/pom.xml  |  54 ++++----
 46 files changed, 701 insertions(+), 944 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index 686afaa..957feef 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -106,7 +106,8 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
     supportedLibraries.put(POJO_LIBRARY, "ServiceComb Server application using the pojo programming model.");
     supportedLibraries.put(JAX_RS_LIBRARY, "ServiceComb Server application using the jax-rs programming model.");
-    supportedLibraries.put(SPRING_BOOT_LIBRARY, "ServiceComb Server application using the SpringBoot programming model.");
+    supportedLibraries
+        .put(SPRING_BOOT_LIBRARY, "ServiceComb Server application using the SpringBoot programming model.");
 
     setLibrary(DEFAULT_LIBRARY);
 
@@ -216,10 +217,12 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
         resourcesFolder(providerProject),
         "log4j2.xml")
     );
+
     supportingFiles.add(new SupportingFile(providerTemplateFolder + "/microservice.mustache",
         resourcesFolder(providerProject),
         "microservice.yaml")
     );
+
     apiTemplateFiles.put(apiConsumerTemplate, "Consumer.java");
   }
 
@@ -235,6 +238,11 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
         "Application.java")
     );
 
+    supportingFiles.add(new SupportingFile("log4j2.mustache",
+        resourcesFolder(consumerProject),
+        "log4j2.xml")
+    );
+
     supportingFiles.add(new SupportingFile(consumerTemplateFolder + "/microservice.mustache",
         resourcesFolder(consumerProject),
         "microservice.yaml")
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache b/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache
index 2ee4969..855c97c 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache
@@ -1,28 +1,10 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
 package {{mainClassPackage}};
 
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 
 public class Application {
 
-    public static void main(String[] args) throws Exception {
-        System.setProperty("local.registry.file", "notExistJustForceLocal");
-        BeanUtils.init();
-    }
+  public static void main(String[] args) throws Exception {
+    BeanUtils.init();
+  }
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
index 109d0f9..d23f0b3 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
@@ -1,10 +1,13 @@
 package {{apiPackage}};
 
-import {{modelPackage}}.*;
-
+import static org.springframework.http.MediaType.*;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 {{#imports}}import {{import}};
 {{/imports}}
-
+import {{modelPackage}}.*;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
 import org.springframework.util.MultiValueMap;
 import org.springframework.http.*;
@@ -17,49 +20,47 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestPart;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import static org.springframework.http.MediaType.*;
 
 {{#operations}}
 public class {{classname}}Consumer {
-    {{#operation}}
+{{#operation}}
 
-     public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>consumer/queryParamsConsumer}}{{>consumer/pathParamsConsumer}}{{>consumer/headerParamsConsumer}}{{>consumer/bodyParamsConsumer}}{{>consumer/formParamsConsumer}}{{#hasMore}},
-        {{/hasMore}}{{/allParams}}) {
+  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>consumer/queryParamsConsumer}}{{>consumer/pathParamsConsumer}}{{>consumer/headerParamsConsumer}}{{>consumer/bodyParamsConsumer}}{{>consumer/formParamsConsumer}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
 
-        Map<String, Object> params = new HashMap<>();
-        HttpEntity httpEntity = null;
-        HttpHeaders headers = new HttpHeaders();
- {{#allParams}}
-      {{#isPathParam}}  params.put("{{paramName}}",{{paramName}}); {{/isPathParam}}
-      {{#isQueryParam}} params.put("{{paramName}}",{{paramName}});  {{/isQueryParam}}
-      {{#isHeaderParam}}
-        headers.add("{{paramName}}",{{paramName}});
-      {{/isHeaderParam}}
-      {{#isFormParam}}
-          {{#notFile}}
-        httpEntity =  new HttpEntity<{{{dataType}}}>({{paramName}}, headers);
-          {{/notFile}}
-          {{#isFile}}
-        httpEntity =  new HttpEntity<MultipartFile>({{paramName}}, headers);
-          {{/isFile}}
-          {{/isFormParam}}
-      {{#isBodyParam}}
-        httpEntity =  new HttpEntity<{{{dataType}}}>({{paramName}}, headers);
-      {{/isBodyParam}}
+    Map<String, Object> params = new HashMap<>();
+    HttpEntity httpEntity = null;
+    HttpHeaders headers = new HttpHeaders();
+    {{#allParams}}
+    {{#isPathParam}}
+    params.put("{{paramName}}",{{paramName}});
+    {{/isPathParam}}
+    {{#isQueryParam}}
+    params.put("{{paramName}}",{{paramName}});
+    {{/isQueryParam}}
+    {{#isHeaderParam}}
+    headers.add("{{paramName}}",{{paramName}});
+    {{/isHeaderParam}}
+    {{#isFormParam}}
+    {{#notFile}}
+    httpEntity =  new HttpEntity<{{{dataType}}}>({{paramName}}, headers);
+    {{/notFile}}
+    {{#isFile}}
+    httpEntity =  new HttpEntity<MultipartFile>({{paramName}}, headers);
+    {{/isFile}}
+    {{/isFormParam}}
+    {{#isBodyParam}}
+    httpEntity =  new HttpEntity<{{{dataType}}}>({{paramName}}, headers);
+    {{/isBodyParam}}
+    {{/allParams}}
 
- {{/allParams}}
-        RestTemplate restTemplate = RestTemplateBuilder.create();
+    RestTemplate restTemplate = RestTemplateBuilder.create();
 
-        ResponseEntity<{{>returnTypes}}> result = restTemplate.exchange("cse://{{microserviceName}}/{{path}}",HttpMethod.{{httpMethod}},httpEntity,{{#getGenericClassType}}{{>returnTypes}}{{/getGenericClassType}}.class,params);
+    ResponseEntity<{{>returnTypes}}> result = restTemplate.exchange("cse://{{microserviceName}}/{{path}}",HttpMethod.{{httpMethod}},httpEntity,{{#getGenericClassType}}{{>returnTypes}}{{/getGenericClassType}}.class,params);
 
-        // do something
-        return result;
-    }
+    // do something
 
-    {{/operation}}
-    }
+    return result;
+  }
+{{/operation}}
+}
 {{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
index 6f911b1..5e9bb31 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
@@ -1,2 +1 @@
-{{#isFormParam}}{{#notFile}}
- {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
+{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
index 32991a8..7d1333a 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
   <modelVersion>4.0.0</modelVersion>
   <groupId>{{groupId}}</groupId>
   <artifactId>consumer</artifactId>
@@ -7,8 +9,8 @@
   <version>{{artifactVersion}}</version>
 
   <properties>
-      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-      <java-chassis.version>1.2.0</java-chassis.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
   </properties>
 
   <dependencyManagement>
@@ -24,54 +26,61 @@
   </dependencyManagement>
 
   <dependencies>
+    <dependency>
+      <groupId>{{groupId}}</groupId>
+      <artifactId>model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
-      <dependency>
-          <groupId>{{groupId}}</groupId>
-          <artifactId>model</artifactId>
-          <version>${project.version}</version>
-      </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-bizkeeper</artifactId>
+    </dependency>
 
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>handler-bizkeeper</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>handler-loadbalance</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>transport-highway</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>transport-rest-vertx</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>handler-flowcontrol-qps</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>provider-pojo</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicecomb</groupId>
-          <artifactId>provider-springmvc</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.logging.log4j</groupId>
-          <artifactId>log4j-slf4j-impl</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.logging.log4j</groupId>
-          <artifactId>log4j-api</artifactId>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.logging.log4j</groupId>
-          <artifactId>log4j-core</artifactId>
-      </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-loadbalance</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-highway</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-rest-vertx</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-flowcontrol-qps</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-pojo</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-springmvc</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
 
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/code-generator/src/main/resources/ServiceComb/enumClass.mustache b/code-generator/src/main/resources/ServiceComb/enumClass.mustache
index dfdada5..7c013d8 100755
--- a/code-generator/src/main/resources/ServiceComb/enumClass.mustache
+++ b/code-generator/src/main/resources/ServiceComb/enumClass.mustache
@@ -1,43 +1,40 @@
-  /**
-   * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
-   */
-  public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
+public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
+{{#gson}}
+  {{#allowableValues}}
+  {{#enumVars}}
+  @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
+  {{{name}}}({{{value}}}){{^-last}},
+  {{/-last}}{{#-last}};{{/-last}}
+  {{/enumVars}}
+  {{/allowableValues}}
+{{/gson}}
+{{^gson}}
+  {{#allowableValues}}
+  {{#enumVars}}
+  {{{name}}}({{{value}}}){{^-last}},
+  {{/-last}}{{#-last}};{{/-last}}
+  {{/enumVars}}
+  {{/allowableValues}}
+{{/gson}}
 
-    {{#gson}}
-        {{#allowableValues}}
-            {{#enumVars}}
-    @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
-    {{{name}}}({{{value}}}){{^-last}},
-    {{/-last}}{{#-last}};{{/-last}}
-            {{/enumVars}}
-        {{/allowableValues}}
-    {{/gson}}
-    {{^gson}}
-        {{#allowableValues}}
-            {{#enumVars}}
-    {{{name}}}({{{value}}}){{^-last}},
-    {{/-last}}{{#-last}};{{/-last}}
-            {{/enumVars}}
-        {{/allowableValues}}
-    {{/gson}}
+  private {{{datatype}}} value;
 
-    private {{{datatype}}} value;
+  {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{datatype}}} value) {
+    this.value = value;
+  }
 
-    {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{datatype}}} value) {
-      this.value = value;
-    }
-
-    @Override
-    public String toString() {
-      return String.valueOf(value);
-    }
+  @Override
+  public String toString() {
+    return String.valueOf(value);
+  }
 
-    public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
-      for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
-        if (String.valueOf(b.value).equals(text)) {
-          return b;
-        }
+  public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
+    for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+      if (String.valueOf(b.value).equals(text)) {
+        return b;
       }
-      return null;
     }
-  }
\ No newline at end of file
+
+    return null;
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache b/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
index 6666a6a..7fed969 100755
--- a/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
+++ b/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
@@ -1,18 +1,15 @@
-/**
- * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
- */
 public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
-  {{#gson}}
+{{#gson}}
   {{#allowableValues}}{{#enumVars}}
   @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
   {{{name}}}({{{value}}}){{^-last}},
   {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
-  {{/gson}}
-  {{^gson}}
+{{/gson}}
+{{^gson}}
   {{#allowableValues}}{{#enumVars}}
   {{{name}}}({{{value}}}){{^-last}},
   {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
-  {{/gson}}
+{{/gson}}
 
   private {{{dataType}}} value;
 
@@ -31,6 +28,7 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
         return b;
       }
     }
+
     return null;
   }
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
index fda8d43..7fb2d98 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
@@ -5,7 +5,6 @@ import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 public class Application {
 
   public static void main(String[] args) throws Exception {
-    System.setProperty("local.registry.file", "notExistJustForceLocal");
     BeanUtils.init();
   }
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
index 750d5ba..b4caf82 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
@@ -1,39 +1,38 @@
 package {{package}};
 
-{{#models}}import {{modelPackage}}.*;{{/models}}
-import io.swagger.annotations.ApiParam;
-
-{{#imports}}import {{import}};
-{{/imports}}
-
 import java.util.Map;
 import java.util.List;
-
 import java.io.InputStream;
-
 import javax.servlet.ServletConfig;
 import javax.servlet.http.Part;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.*;
+{{#imports}}import {{import}};
+{{/imports}}
+{{#models}}import {{modelPackage}}.*;{{/models}}
 import org.apache.servicecomb.provider.rest.common.RestSchema;
+import io.swagger.annotations.ApiParam;
 
-@RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
-@Path("/")
 {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
 {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
 {{#operations}}
-public class {{classname}}  {
-
+@RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+@Path("/")
+public class {{classname}} {
 {{#operation}}
-    @Path("{{{path}}}")
-    @{{httpMethod}}
-    {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
-    {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
-    public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) {
-        return null;
-    }
+
+  {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
+  {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
+  @Path("{{{path}}}")
+  @{{httpMethod}}
+  public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) {
+
+    // do something
+
+    return null;
+  }
 {{/operation}}
 }
 {{/operations}}
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api_test.mustache
deleted file mode 100755
index 8f93bb4..0000000
--- a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api_test.mustache
+++ /dev/null
@@ -1,39 +0,0 @@
-package {{package}};
-
-{{#imports}}import {{import}};
-{{/imports}}
-import java.util.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-
-import static org.junit.Assert.assertEquals;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class {{classname}}Test {
-@Autowired
-private {{classname}} api;
-{{#operations}}
-    {{#operation}}
-        @Test
-        public void {{operationId}}Test() throws Exception {
-        {{#allParams}}
-        {{^isFile}}
-            {{{dataType}}} {{paramName}} = {{{example}}};
-        {{/isFile}}
-        {{#isFile}}
-            org.springframework.web.multipart.MultipartFile {{paramName}} = null;
-        {{/isFile}}
-        {{/allParams}}
-            ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
-            assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
-        }
-    {{/operation}}
-{{/operations}}
-}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
index 5a4ebf2..9f5b8ec 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
@@ -1,2 +1 @@
-{{#isFormParam}}{{#notFile}} {{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}")  {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}")  {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}}
-            Part {{paramName}}{{/isFile}}{{/isFormParam}}
+{{#isFormParam}}{{#notFile}} {{#vendorExtensions.x-multipart}} @FormDataParam("{{baseName}}")  {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}")  {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}} Part {{paramName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
index 35ec7b1..63d56f3 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
@@ -1,18 +1,20 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <parent>
     <artifactId>{{artifactId}}</artifactId>
     <groupId>{{groupId}}</groupId>
     <version>{{artifactVersion}}</version>
   </parent>
+
   <modelVersion>4.0.0</modelVersion>
   <artifactId>provider</artifactId>
   <packaging>jar</packaging>
   <name>{{artifactId}}</name>
 
   <properties>
-      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-      <java-chassis.version>1.2.0</java-chassis.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
   </properties>
 
   <dependencyManagement>
@@ -28,98 +30,96 @@
   </dependencyManagement>
 
   <dependencies>
+    <dependency>
+      <groupId>{{groupId}}</groupId>
+      <artifactId>model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
-      <dependency>
-          <groupId>{{groupId}}</groupId>
-          <artifactId>model</artifactId>
-          <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>handler-bizkeeper</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>handler-loadbalance</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>handler-flowcontrol-qps</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>transport-highway</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>transport-rest-vertx</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>provider-jaxrs</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.logging.log4j</groupId>
-        <artifactId>log4j-slf4j-impl</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.logging.log4j</groupId>
-        <artifactId>log4j-api</artifactId>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.logging.log4j</groupId>
-        <artifactId>log4j-core</artifactId>
-      </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-bizkeeper</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-loadbalance</artifactId>
+    </dependency>
 
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-flowcontrol-qps</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-highway</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-rest-vertx</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-jaxrs</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
   </dependencies>
 
-  <!--for package and deploy-->
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.6</version>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
         <configuration>
-          <archive>
-            <manifest>
-              <addClasspath>true</addClasspath>
-              <classpathPrefix>lib/</classpathPrefix>
-              <!--change to your main class-->
-              <mainClass>${package}.Application</mainClass>
-            </manifest>
-            <manifestEntries>
-              <Class-Path>. </Class-Path>
-            </manifestEntries>
-          </archive>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
+        <configuration>
+          <fork>true</fork>
+          <mainClass>${package}.Application</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
+        </configuration>
         <executions>
           <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
             <goals>
-              <goal>copy-dependencies</goal>
+              <goal>repackage</goal>
             </goals>
-            <configuration>
-              <outputDirectory>target/lib</outputDirectory>
-            </configuration>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
-        </configuration>
-      </plugin>
-
     </plugins>
   </build>
 
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
index fda8d43..7fb2d98 100644
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
@@ -5,7 +5,6 @@ import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 public class Application {
 
   public static void main(String[] args) throws Exception {
-    System.setProperty("local.registry.file", "notExistJustForceLocal");
     BeanUtils.init();
   }
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
old mode 100644
new mode 100755
index abb8da0..ea99a96
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
@@ -1,10 +1,12 @@
 package {{apiPackage}};
 
-import {{modelPackage}}.*;
-
+import static org.springframework.http.MediaType.*;
+import java.util.List;
+import java.util.Map;
+import java.io.File;
 {{#imports}}import {{import}};
 {{/imports}}
-
+import {{modelPackage}}.*;
 import org.apache.servicecomb.provider.pojo.RpcSchema;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -16,10 +18,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestPart;
 import org.springframework.web.multipart.MultipartFile;
-import java.util.List;
-import java.util.Map;
-import java.io.File;
-import static org.springframework.http.MediaType.*;
 
 @RpcSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
 {{#operations}}
@@ -27,12 +25,11 @@ public class {{classname}} implements {{#removeImplSuffix}}{{classname}}{{/remov
   {{#operation}}
 
   @Override
-  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
-    {{/hasMore}}{{/allParams}}) {
-      // do some magic!
-      return null;
-  }
+  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
+    // do something
 
+    return null;
+  }
   {{/operation}}
 }
 {{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
old mode 100644
new mode 100755
index d7c5b3e..84cc2c8
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
@@ -1,23 +1,17 @@
 package {{apiPackage}};
 
-import {{modelPackage}}.*;
-
-{{#imports}}import {{import}};
-{{/imports}}
-
 import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 import java.io.File;
-
+{{#imports}}import {{import}};
+{{/imports}}
+import {{modelPackage}}.*;
 
 {{#operations}}
 public interface {{#removeImplSuffix}}{{classname}}{{/removeImplSuffix}} {
     {{#operation}}
-
-     public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
-        {{/hasMore}}{{/allParams}});
-
+     public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
     {{/operation}}
-    }
+}
 {{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
index 96f17c8..22cb5a8 100644
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
@@ -1,2 +1 @@
-{{#isFormParam}}{{#notFile}}
-{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} File {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
+{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} File {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
old mode 100644
new mode 100755
index c2ceb61..4eb5156
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
@@ -1,10 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <parent>
     <artifactId>{{artifactId}}</artifactId>
     <groupId>{{groupId}}</groupId>
     <version>{{artifactVersion}}</version>
   </parent>
+
   <modelVersion>4.0.0</modelVersion>
   <artifactId>provider</artifactId>
   <packaging>jar</packaging>
@@ -28,99 +30,96 @@
   </dependencyManagement>
 
   <dependencies>
-
     <dependency>
       <groupId>{{groupId}}</groupId>
       <artifactId>model</artifactId>
       <version>${project.version}</version>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-bizkeeper</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-loadbalance</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>transport-highway</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>transport-rest-vertx</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-flowcontrol-qps</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>provider-pojo</artifactId>
     </dependency>
-    <!--log4j2-->
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-slf4j-impl</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-core</artifactId>
     </dependency>
-
   </dependencies>
 
-  <!--for package and deploy-->
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.6</version>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
         <configuration>
-          <archive>
-            <manifest>
-              <addClasspath>true</addClasspath>
-              <classpathPrefix>lib/</classpathPrefix>
-              <!--change to your main class-->
-              <mainClass>${package}.Application</mainClass>
-            </manifest>
-            <manifestEntries>
-              <Class-Path>. </Class-Path>
-            </manifestEntries>
-          </archive>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
+        <configuration>
+          <fork>true</fork>
+          <mainClass>${package}.Application</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
+        </configuration>
         <executions>
           <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
             <goals>
-              <goal>copy-dependencies</goal>
+              <goal>repackage</goal>
             </goals>
-            <configuration>
-              <outputDirectory>target/lib</outputDirectory>
-            </configuration>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
-        </configuration>
-      </plugin>
-
     </plugins>
   </build>
 
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
index 2184ccb..0cf7ff0 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
@@ -9,7 +9,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 public class Application {
 
   public static void main(String[] args) throws Exception {
-    System.setProperty("local.registry.file", "notExistJustForceLocal");
     SpringApplication.run(Application.class, args);
   }
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
index 33f5a4b..486641c 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
@@ -1,10 +1,12 @@
 package {{apiPackage}};
 
-import {{modelPackage}}.*;
-
+import static org.springframework.http.MediaType.*;
+import java.util.List;
+import java.util.Map;
 {{#imports}}import {{import}};
 {{/imports}}
-
+import {{modelPackage}}.*;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -15,10 +17,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestPart;
 import org.springframework.web.multipart.MultipartFile;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-import java.util.List;
-import java.util.Map;
-import static org.springframework.http.MediaType.*;
 
 @RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
 @RequestMapping(value = "/", produces = {APPLICATION_JSON_VALUE})
@@ -26,6 +24,5 @@ import static org.springframework.http.MediaType.*;
 public class {{classname}} {
 
   {{>operationMethod}}
-
 }
 {{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api_test.mustache
deleted file mode 100755
index d0444c2..0000000
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api_test.mustache
+++ /dev/null
@@ -1,38 +0,0 @@
-package {{package}};
-{{#imports}}import {{import}};
-{{/imports}}
-import java.util.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-
-import static org.junit.Assert.assertEquals;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class {{classname}}Test {
-@Autowired
-private {{classname}} api;
-{{#operations}}
-    {{#operation}}
-        @Test
-        public void {{operationId}}Test() throws Exception {
-        {{#allParams}}
-        {{^isFile}}
-            {{{dataType}}} {{paramName}} = {{{example}}};
-        {{/isFile}}
-        {{#isFile}}
-            org.springframework.web.multipart.MultipartFile {{paramName}} = null;
-        {{/isFile}}
-        {{/allParams}}
-            ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
-            assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
-        }
-    {{/operation}}
-{{/operations}}
-}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
index 336c14d..794cbfe 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
@@ -1,2 +1 @@
-{{#isFormParam}}{{#notFile}}
-@RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}})  {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
+{{#isFormParam}}{{#notFile}}@RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}})  {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
index 18b598c..948212d 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
@@ -1,13 +1,8 @@
 {{#operation}}
+  @RequestMapping(value = "{{path}}", {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} method = RequestMethod.{{httpMethod}})
+  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
+    // do something
 
-  @RequestMapping(value = "{{path}}",
-    {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}
-    {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}
-    method = RequestMethod.{{httpMethod}})
-  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
-    {{/hasMore}}{{/allParams}}) {
-      // do some magic!
-      return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
+    return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
   }
-
 {{/operation}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
index 3c487c7..23571ee 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
@@ -1,18 +1,20 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <parent>
     <artifactId>{{artifactId}}</artifactId>
     <groupId>{{groupId}}</groupId>
     <version>{{artifactVersion}}</version>
   </parent>
+
   <modelVersion>4.0.0</modelVersion>
   <artifactId>provider</artifactId>
   <packaging>jar</packaging>
   <name>provider</name>
 
   <properties>
-      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-      <java-chassis.version>1.2.0</java-chassis.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
   </properties>
 
   <dependencyManagement>
@@ -28,12 +30,12 @@
   </dependencyManagement>
 
   <dependencies>
-
     <dependency>
       <groupId>{{groupId}}</groupId>
       <artifactId>model</artifactId>
       <version>${project.version}</version>
     </dependency>
+
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter</artifactId>
@@ -48,77 +50,72 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-flowcontrol-qps</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-bizkeeper</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-tracing-zipkin</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>inspector</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.hibernate.validator</groupId>
       <artifactId>hibernate-validator</artifactId>
     </dependency>
+
     <dependency>
       <groupId>javax.validation</groupId>
       <artifactId>validation-api</artifactId>
       <version>2.0.1.Final</version>
     </dependency>
-
   </dependencies>
 
-  <!--for package and deploy-->
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.6</version>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
         <configuration>
-          <archive>
-            <manifest>
-              <addClasspath>true</addClasspath>
-              <classpathPrefix>lib/</classpathPrefix>
-              <!--change to your main class-->
-              <mainClass>${package}.Application</mainClass>
-            </manifest>
-            <manifestEntries>
-              <Class-Path>. </Class-Path>
-            </manifestEntries>
-          </archive>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
+        <configuration>
+          <fork>true</fork>
+          <mainClass>${package}.Application</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
+        </configuration>
         <executions>
           <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
             <goals>
-              <goal>copy-dependencies</goal>
+              <goal>repackage</goal>
             </goals>
-            <configuration>
-              <outputDirectory>target/lib</outputDirectory>
-            </configuration>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
-        </configuration>
-      </plugin>
-
     </plugins>
   </build>
 
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
index fda8d43..7fb2d98 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
@@ -5,7 +5,6 @@ import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 public class Application {
 
   public static void main(String[] args) throws Exception {
-    System.setProperty("local.registry.file", "notExistJustForceLocal");
     BeanUtils.init();
   }
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
index 5ef2b31..49ef6aa 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
@@ -1,10 +1,12 @@
 package {{apiPackage}};
 
-import {{modelPackage}}.*;
-
+import static org.springframework.http.MediaType.*;
+import java.util.List;
+import java.util.Map;
 {{#imports}}import {{import}};
 {{/imports}}
-
+import {{modelPackage}}.*;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -15,28 +17,19 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestPart;
 import org.springframework.web.multipart.MultipartFile;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-import java.util.List;
-import java.util.Map;
-import static org.springframework.http.MediaType.*;
 
 @RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
 @RequestMapping(value = "/", produces = {APPLICATION_JSON_VALUE})
-
 {{#operations}}
 public class {{classname}} {
-  {{#operation}}
+{{#operation}}
 
-  @RequestMapping(value = "{{path}}",
-    {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}
-    {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}
-    method = RequestMethod.{{httpMethod}})
-  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
-    {{/hasMore}}{{/allParams}}) {
-      // do something
-      return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
-  }
+  @RequestMapping(value = "{{path}}", {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}method = RequestMethod.{{httpMethod}})
+  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
+    // do something
 
-  {{/operation}}
+    return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
+  }
+{{/operation}}
 }
 {{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
deleted file mode 100755
index 3a7bed4..0000000
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
+++ /dev/null
@@ -1,103 +0,0 @@
-package {{package}};
-
-{{#imports}}import {{import}};
-{{/imports}}
-import java.util.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-
-import static org.junit.Assert.assertEquals;
-
-public class {{classname}}ContractTest {
-    @Autowired
-    private {{classname}} api;
-
-    private static final String NAME_LARRY_JSON = "{\"name\": \"larry\"}";
-
-    @Rule
-    public TestFailureProviderRule mockTestProvider = new TestFailureProviderRule("{{#camelcase}}{{classname}}{{/camelcase}}Provider", this);
-
-    @Pact(provider="{{#camelcase}}{{classname}}{{/camelcase}}Provider", consumer="{{#camelcase}}{{classname}}{{/camelcase}}Consumer")
-    public RequestResponsePact createFragment(PactDslWithProvider builder) {
-
-{{#operations}}
-    {{#operation}}
-        {{#hasHeaderParams}}
-                Map<String, String> {{operationId}}RequestHeaders = new HashMap<String, String>();
-        {{/hasHeaderParams}}
-    {{/operation}}
-{{/operations}}
-{{#operations}}
-    {{#operation}}
-        {{#responseHeaders}}
-                Map<String, String> {{operationId}}ResponseHeaders = new HashMap<String, String>();
-        {{/responseHeaders}}
-    {{/operation}}
-{{/operations}}
-
-        return builder
-{{#operations}}
-    {{#operation}}
-            .uponReceiving("{{summary}}")
-                .path("{{path}}")
-                .method("{{httpMethod}}")
-                {{#hasHeaderParams}}
-                .headers({{operationId}}RequestHeaders)
-                {{/hasHeaderParams}}
-            .willRespondWith()
-                .status(200)
-                {{#responseHeaders}}
-                .headers({{operationId}}ResponseHeaders)
-                {{/responseHeaders}}
-                .body("{\"responsetest\": true, \"name\": \"harry\"}")
-    {{/operation}}
-{{/operations}}
-            .toPact();
-    }
-
-
-    @Test
-    @PactVerification({"{{#camelcase}}{{classname}}{{/camelcase}}Provider"})
-    public void allPass() throws IOException {
-      mockTestProvider.validateResultWith((result, t) -> {
-        assertThat(t, is(nullValue()));
-        assertThat(result, is(PactVerificationResult.Ok.INSTANCE));
-      });
-      doTest("/", NAME_LARRY_JSON);
-    }
-
-    private void doTest(String path, String json) throws IOException {
-      Consumer consumer = new Consumer(mockTestProvider.getUrl());
-      consumer.options("/second");
-      try {
-        consumer.getAsMap(path, "");
-      } catch (IOException e) {
-      }
-      try {
-        new Consumer(mockTestProvider2.getUrl()).putAsMap("/", json);
-      } catch (IOException e) {
-      }
-    }
-
-/*
-        @Test
-        public void {{operationId}}Test() throws Exception {
-        {{#allParams}}
-        {{^isFile}}
-            {{{dataType}}} {{paramName}} = {{{example}}};
-        {{/isFile}}
-        {{#isFile}}
-            org.springframework.web.multipart.MultipartFile {{paramName}} = null;
-        {{/isFile}}
-        {{/allParams}}
-            ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
-            assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
-        }
-*/
-}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
index 336c14d..794cbfe 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
@@ -1,2 +1 @@
-{{#isFormParam}}{{#notFile}}
-@RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}})  {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
+{{#isFormParam}}{{#notFile}}@RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}})  {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
index c0a4aad..ea04f8c 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
@@ -1,22 +1,23 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <parent>
     <artifactId>{{artifactId}}</artifactId>
     <groupId>{{groupId}}</groupId>
     <version>{{artifactVersion}}</version>
   </parent>
+
   <modelVersion>4.0.0</modelVersion>
   <artifactId>provider</artifactId>
   <packaging>jar</packaging>
   <name>{{artifactId}}</name>
 
   <properties>
-      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-      <java-chassis.version>1.2.0</java-chassis.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
   </properties>
 
   <dependencies>
-
     <dependency>
       <groupId>{{groupId}}</groupId>
       <artifactId>model</artifactId>
@@ -27,76 +28,71 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>transport-rest-vertx</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>transport-highway</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>provider-springmvc</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-slf4j-impl</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-core</artifactId>
     </dependency>
-
   </dependencies>
 
-  <!--for package and deploy-->
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.6</version>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
         <configuration>
-          <archive>
-            <manifest>
-              <addClasspath>true</addClasspath>
-              <classpathPrefix>lib/</classpathPrefix>
-              <!--change to your main class-->
-              <mainClass>${package}.Application</mainClass>
-            </manifest>
-            <manifestEntries>
-              <Class-Path>. </Class-Path>
-            </manifestEntries>
-          </archive>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
+        <configuration>
+          <fork>true</fork>
+          <mainClass>${package}.Application</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
+        </configuration>
         <executions>
           <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
             <goals>
-              <goal>copy-dependencies</goal>
+              <goal>repackage</goal>
             </goals>
-            <configuration>
-              <outputDirectory>target/lib</outputDirectory>
-            </configuration>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
-        </configuration>
-      </plugin>
-
     </plugins>
   </build>
 
diff --git a/code-generator/src/main/resources/ServiceComb/model/model.mustache b/code-generator/src/main/resources/ServiceComb/model/model.mustache
index 1923ac6..4ea9d7a 100755
--- a/code-generator/src/main/resources/ServiceComb/model/model.mustache
+++ b/code-generator/src/main/resources/ServiceComb/model/model.mustache
@@ -1,16 +1,7 @@
 package {{package}};
 
-import java.util.Objects;
 {{#imports}}import {{import}};
 {{/imports}}
-{{#serializableModel}}
-import java.io.Serializable;
-{{/serializableModel}}
-{{#useBeanValidation}}
-import org.springframework.validation.annotation.Validated;
-import javax.validation.Valid;
-import javax.validation.constraints.*;
-{{/useBeanValidation}}
 {{#withXml}}
 import javax.xml.bind.annotation.*;
 {{/withXml}}
diff --git a/code-generator/src/main/resources/ServiceComb/model/pom.mustache b/code-generator/src/main/resources/ServiceComb/model/pom.mustache
index d52c176..15086b9 100755
--- a/code-generator/src/main/resources/ServiceComb/model/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/model/pom.mustache
@@ -1,27 +1,29 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <parent>
     <artifactId>{{artifactId}}</artifactId>
     <groupId>{{groupId}}</groupId>
     <version>{{artifactVersion}}</version>
   </parent>
+
   <modelVersion>4.0.0</modelVersion>
   <artifactId>model</artifactId>
   <packaging>jar</packaging>
   <name>{{artifactId}}</name>
 
   <properties>
-      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-      <java-chassis.version>1.2.0</java-chassis.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
   </properties>
 
   <dependencies>
-      {{^isPOJO}}
-      <dependency>
-          <groupId>org.springframework</groupId>
-          <artifactId>spring-web</artifactId>
-      </dependency>
-      {{/isPOJO}}
+    {{^isPOJO}}
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    {{/isPOJO}}
   </dependencies>
 
   <build>
diff --git a/code-generator/src/main/resources/ServiceComb/pojo.mustache b/code-generator/src/main/resources/ServiceComb/pojo.mustache
index ee0aca9..1bf2369 100755
--- a/code-generator/src/main/resources/ServiceComb/pojo.mustache
+++ b/code-generator/src/main/resources/ServiceComb/pojo.mustache
@@ -1,26 +1,23 @@
-/**
- * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
- */
 {{#useBeanValidation}}@Validated{{/useBeanValidation}}
 {{#discriminator}}{{/discriminator}}
 public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
-{{#serializableModel}}
+  {{#serializableModel}}
   private static final long serialVersionUID = 1L;
+  {{/serializableModel}}
 
-{{/serializableModel}}
   {{#vars}}
-    {{#isEnum}}
-    {{^isContainer}}
-{{>enumClass}}
-    {{/isContainer}}
-    {{/isEnum}}
-    {{#items.isEnum}}
-      {{#items}}
-      {{^isContainer}}
-{{>enumClass}}
-      {{/isContainer}}
-      {{/items}}
-    {{/items.isEnum}}
+  {{#isEnum}}
+  {{^isContainer}}
+  {{>enumClass}}
+  {{/isContainer}}
+  {{/isEnum}}
+  {{#items.isEnum}}
+  {{#items}}
+  {{^isContainer}}
+  {{>enumClass}}
+  {{/isContainer}}
+  {{/items}}
+  {{/items.isEnum}}
   {{#gson}}
   @SerializedName("{{baseName}}")
   {{/gson}}
@@ -31,104 +28,50 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
   {{^isContainer}}
   private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
   {{/isContainer}}
-
   {{/vars}}
+
   {{#vars}}
   public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
     this.{{name}} = {{name}};
     return this;
   }
-  {{#isListContainer}}
 
+  {{#isListContainer}}
   public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
-    {{^required}}
+  {{^required}}
     if (this.{{name}} == null) {
       this.{{name}} = {{{defaultValue}}};
     }
-    {{/required}}
+  {{/required}}
     this.{{name}}.add({{name}}Item);
     return this;
   }
   {{/isListContainer}}
-  {{#isMapContainer}}
 
+  {{#isMapContainer}}
   public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
-    {{^required}}
+  {{^required}}
     if (this.{{name}} == null) {
       this.{{name}} = {{{defaultValue}}};
     }
-    {{/required}}
+  {{/required}}
     this.{{name}}.put(key, {{name}}Item);
     return this;
   }
   {{/isMapContainer}}
 
-  /**
-  {{#description}}
-   * {{{description}}}
-  {{/description}}
-  {{^description}}
-   * Get {{name}}
-  {{/description}}
-  {{#minimum}}
-   * minimum: {{minimum}}
-  {{/minimum}}
-  {{#maximum}}
-   * maximum: {{maximum}}
-  {{/maximum}}
-   * @return {{name}}
-  **/
- {{#vendorExtensions.extraAnnotation}}
+  {{#vendorExtensions.extraAnnotation}}
   {{{vendorExtensions.extraAnnotation}}}
   {{/vendorExtensions.extraAnnotation}}
-{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}  public {{{datatypeWithEnum}}} {{#isBoolean}}is{{/isBoolean}}{{getter}}() {
+  {{#useBeanValidation}}
+  {{>beanValidation}}
+  {{/useBeanValidation}}
+  public {{{datatypeWithEnum}}} {{#isBoolean}}is{{/isBoolean}}{{getter}}() {
     return {{name}};
   }
 
   public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
     this.{{name}} = {{name}};
   }
-
-  {{/vars}}
-
-  @Override
-  public boolean equals(java.lang.Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }{{#hasVars}}
-    {{classname}} {{classVarName}} = ({{classname}}) o;
-    return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
-        {{/hasMore}}{{/vars}}{{#parent}} &&
-        super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
-    return true;{{/hasVars}}
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append("class {{classname}} {\n");
-    {{#parent}}sb.append("    ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
-    {{#vars}}sb.append("    {{name}}: ").append(toIndentedString({{name}})).append("\n");
-    {{/vars}}sb.append("}");
-    return sb.toString();
-  }
-
-  /**
-   * Convert the given object to string with each line indented by 4 spaces
-   * (except the first line).
-   */
-  private String toIndentedString(java.lang.Object o) {
-    if (o == null) {
-      return "null";
-    }
-    return o.toString().replace("\n", "\n    ");
-  }
+{{/vars}}
 }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/project/pom.mustache b/code-generator/src/main/resources/ServiceComb/project/pom.mustache
index bca8ce9..b1acd44 100755
--- a/code-generator/src/main/resources/ServiceComb/project/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/project/pom.mustache
@@ -1,63 +1,43 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>{{groupId}}</groupId>
-    <artifactId>{{artifactId}}</artifactId>
-    <packaging>pom</packaging>
-    <name>{{artifactId}}</name>
-    <version>{{artifactVersion}}</version>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <java-chassis.version>1.2.0</java-chassis.version>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <java.version>1.8</java.version>
-    </properties>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>{{groupId}}</groupId>
+  <artifactId>{{artifactId}}</artifactId>
+  <packaging>pom</packaging>
+  <name>{{artifactId}}</name>
+  <version>{{artifactVersion}}</version>
 
-    <modules>
-        <module>provider</module>
-        <module>consumer</module>
-        <module>model</module>
-    </modules>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <java.version>1.8</java.version>
+  </properties>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.servicecomb</groupId>
-                <artifactId>java-chassis-dependencies</artifactId>
-                <version>${java-chassis.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
+  <modules>
+    <module>provider</module>
+    <module>consumer</module>
+    <module>model</module>
+  </modules>
 
+  <dependencyManagement>
     <dependencies>
-        <dependency>
-            <groupId>org.hibernate.validator</groupId>
-            <artifactId>hibernate-validator</artifactId>
-        </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
     </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.hibernate.validator</groupId>
+      <artifactId>hibernate-validator</artifactId>
+    </dependency>
+  </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <version>0.13</version>
-                <configuration>
-                    <excludes>
-                        <exclude>.travis.yml</exclude>
-                        <exclude>**/*.md</exclude>
-                        <exclude>**/target/*</exclude>
-                        <!-- Skip the ssl configuration files -->
-                        <exculde>**/resources/ssl/**</exculde>
-                        <!-- Skip the protobuf files -->
-                        <exclude>**/*.proto</exclude>
-                        <!-- Skip the idl files -->
-                        <exclude>**/*.idl</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
\ No newline at end of file
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
index 08ccced..5e939e5 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
@@ -17,13 +17,13 @@
 
 package org.apache.servicecomb.toolkit.common;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ImmediateClassLoader extends URLClassLoader {
 
   private final static Logger LOGGER = LoggerFactory.getLogger(ImmediateClassLoader.class);
diff --git a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
old mode 100644
new mode 100755
index 14df512..c8236ab
--- a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
@@ -1,8 +1,10 @@
 package org.apache.servicecomb.toolkit.common;
 
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -13,20 +15,20 @@ import java.util.Collections;
 import java.util.List;
 import java.util.regex.Pattern;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.*;
+import org.junit.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 
 public class TextCompareTest {
 
   Path sourcePath = Paths.get("./src/test/resources/compare/HelloEndPoint.yaml");
+
   Path destPath = Paths.get("./src/test/resources/compare/HelloEndPoint2.yaml");
 
   @Test
   public void contractCompareText() throws IOException {
     ContractComparator contractComparator = new ContractComparator(new String(Files.readAllBytes(sourcePath)),
-            new String(Files.readAllBytes(destPath)));
+        new String(Files.readAllBytes(destPath)));
     assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
 
     List<Comparison> comparisonList = contractComparator.compare();
@@ -37,7 +39,7 @@ public class TextCompareTest {
   @Test
   public void contractCompareResultPrint() throws IOException {
     ContractComparator contractComparator = new ContractComparator(new String(Files.readAllBytes(sourcePath)),
-            new String(Files.readAllBytes(destPath)));
+        new String(Files.readAllBytes(destPath)));
     assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
 
     ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -79,7 +81,7 @@ public class TextCompareTest {
     });
 
     ContractComparator contractComparator = new ContractComparator("source line",
-            "destination line", oneLineAlgorithm);
+        "destination line", oneLineAlgorithm);
 
     ByteArrayOutputStream bout = new ByteArrayOutputStream();
     contractComparator.splitPrint(bout);
@@ -88,10 +90,9 @@ public class TextCompareTest {
 
     bout = new ByteArrayOutputStream();
     contractComparator = new ContractComparator("source line",
-            "source line", oneLineAlgorithm);
+        "source line", oneLineAlgorithm);
     contractComparator.splitPrint(bout);
-    assertEquals(ComparisionType.EQUAL , contractComparator.compare().get(0).type);
-
+    assertEquals(ComparisionType.EQUAL, contractComparator.compare().get(0).type);
   }
 
   private boolean hasNewLine(String s) {
@@ -104,13 +105,11 @@ public class TextCompareTest {
     try (ByteArrayOutputStream bout = new ByteArrayOutputStream()) {
 
       ContractComparator contractComparator = new ContractComparator(null,
-              new String(Files.readAllBytes(destPath)));
+          new String(Files.readAllBytes(destPath)));
       assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
       contractComparator.splitPrint(bout);
-
     } catch (RuntimeException e) {
       assertEquals("source must not be null", e.getMessage());
     }
-
   }
 }
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
index 5a27171..f39cd22 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
@@ -28,11 +28,12 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import io.swagger.models.Swagger;
-import io.swagger.util.Json;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import io.swagger.models.Swagger;
+import io.swagger.util.Json;
+
 public class ContractsSwaggerUIGenerator implements DocGenerator {
 
   private final static Logger LOGGER = LoggerFactory.getLogger(ContractsSwaggerUIGenerator.class);
diff --git a/doc-generator/src/test/java/docgen/DocGeneratorTest.java b/doc-generator/src/test/java/docgen/DocGeneratorTest.java
old mode 100644
new mode 100755
index 0ca5bc9..2fe24b9
--- a/doc-generator/src/test/java/docgen/DocGeneratorTest.java
+++ b/doc-generator/src/test/java/docgen/DocGeneratorTest.java
@@ -1,12 +1,5 @@
 package docgen;
 
-import io.swagger.models.Swagger;
-import io.swagger.parser.Swagger20Parser;
-import org.apache.commons.io.FileUtils;
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
-import org.junit.Assert;
-import org.junit.Test;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -14,83 +7,90 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-public class DocGeneratorTest {
-
+import org.apache.commons.io.FileUtils;
+import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.junit.Assert;
+import org.junit.Test;
 
-    @Test
-    public void contractToAsciidoc() throws IOException {
+import io.swagger.models.Swagger;
+import io.swagger.parser.Swagger20Parser;
 
-        Swagger20Parser swagger20Parser = new Swagger20Parser();
-        InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
+public class DocGeneratorTest {
 
-        StringBuilder sb = new StringBuilder();
-        byte[] bytes = new byte[1024];
-        int len = -1;
-        while ((len = in.read(bytes)) != -1){
-            sb.append(new String(bytes,0,len));
-        }
 
-        Swagger swagger = swagger20Parser.parse(sb.toString());
-        Path tempDir = Files.createTempDirectory(null);
-        Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
-                + File.separator + "asciidoc.html");
+  @Test
+  public void contractToAsciidoc() throws IOException {
 
-        DocGeneratorManager.generate(swagger,outputPath.toFile().getCanonicalPath() , "asciidoc-html");
+    Swagger20Parser swagger20Parser = new Swagger20Parser();
+    InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
 
-        Assert.assertTrue(Files.exists(outputPath));
-        FileUtils.deleteDirectory(tempDir.toFile());
+    StringBuilder sb = new StringBuilder();
+    byte[] bytes = new byte[1024];
+    int len = -1;
+    while ((len = in.read(bytes)) != -1) {
+      sb.append(new String(bytes, 0, len));
     }
 
-    @Test
-    public void contractTransferToSwaggerUI() throws IOException {
+    Swagger swagger = swagger20Parser.parse(sb.toString());
+    Path tempDir = Files.createTempDirectory(null);
+    Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
+        + File.separator + "asciidoc.html");
 
-        Swagger20Parser swagger20Parser = new Swagger20Parser();
+    DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "asciidoc-html");
 
-        InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
+    Assert.assertTrue(Files.exists(outputPath));
+    FileUtils.deleteDirectory(tempDir.toFile());
+  }
 
-        StringBuilder sb = new StringBuilder();
-        byte[] bytes = new byte[1024];
-        int len = -1;
-        while ((len = in.read(bytes)) != -1) {
-            sb.append(new String(bytes, 0, len));
-        }
+  @Test
+  public void contractTransferToSwaggerUI() throws IOException {
 
-        Swagger swagger = swagger20Parser.parse(sb.toString());
+    Swagger20Parser swagger20Parser = new Swagger20Parser();
 
-        Path tempDir = Files.createTempDirectory(null);
-        Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
-                + File.separator + "swagger-ui.html");
-        DocGeneratorManager.generate(swagger,outputPath.toFile().getCanonicalPath() , "swagger-ui");
+    InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
 
-        Assert.assertTrue(Files.exists(outputPath));
-        FileUtils.deleteDirectory(tempDir.toFile());
+    StringBuilder sb = new StringBuilder();
+    byte[] bytes = new byte[1024];
+    int len = -1;
+    while ((len = in.read(bytes)) != -1) {
+      sb.append(new String(bytes, 0, len));
     }
 
-    @Test
-    public void contractTransferToOther() throws IOException {
+    Swagger swagger = swagger20Parser.parse(sb.toString());
 
-        Swagger20Parser swagger20Parser = new Swagger20Parser();
+    Path tempDir = Files.createTempDirectory(null);
+    Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
+        + File.separator + "swagger-ui.html");
+    DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "swagger-ui");
 
-        InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
+    Assert.assertTrue(Files.exists(outputPath));
+    FileUtils.deleteDirectory(tempDir.toFile());
+  }
 
-        StringBuilder sb = new StringBuilder();
-        byte[] bytes = new byte[1024];
-        int len = -1;
-        while ((len = in.read(bytes)) != -1) {
-            sb.append(new String(bytes, 0, len));
-        }
+  @Test
+  public void contractTransferToOther() throws IOException {
 
-        Swagger swagger = swagger20Parser.parse(sb.toString());
+    Swagger20Parser swagger20Parser = new Swagger20Parser();
 
-        Path tempDir = Files.createTempDirectory(null);
-        Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
-                + File.separator + "swagger-ui.html");
+    InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
 
-        DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "other");
+    StringBuilder sb = new StringBuilder();
+    byte[] bytes = new byte[1024];
+    int len = -1;
+    while ((len = in.read(bytes)) != -1) {
+      sb.append(new String(bytes, 0, len));
+    }
 
-        Assert.assertFalse(Files.exists(outputPath));
+    Swagger swagger = swagger20Parser.parse(sb.toString());
 
-        FileUtils.deleteDirectory(tempDir.toFile());
-    }
+    Path tempDir = Files.createTempDirectory(null);
+    Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
+        + File.separator + "swagger-ui.html");
+
+    DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "other");
+
+    Assert.assertFalse(Files.exists(outputPath));
 
+    FileUtils.deleteDirectory(tempDir.toFile());
+  }
 }
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 73de4b3..295ad61 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -30,6 +30,7 @@
 
   <properties>
     <main.class>org.apache.servicecomb.toolkit.cli.ToolkitMain</main.class>
+    <log4j2.version>2.11.0</log4j2.version>
   </properties>
 
   <dependencies>
@@ -57,6 +58,24 @@
       <artifactId>doc-generator</artifactId>
       <version>${project.version}</version>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
   </dependencies>
 
   <build>
@@ -98,12 +117,5 @@
         </executions>
       </plugin>
     </plugins>
-
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>true</filtering>
-      </resource>
-    </resources>
   </build>
 </project>
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index 49f99d1..df01175 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -29,12 +29,12 @@ import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 
 import org.apache.servicecomb.toolkit.codegen.DefaultCodeGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import io.swagger.codegen.config.CodegenConfigurator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Command(name = "codegenerate",
     description = "Generate multiple models of microservice project by OpenAPI specification file")
@@ -96,18 +96,25 @@ public class CodeGenerate implements Runnable {
               configurator.setInputSpec(file.toFile().getCanonicalPath())
                   .addAdditionalProperty("apiName", file.toFile().getName().split("\\.")[0]);
 
-              new DefaultCodeGenerator().opts(configurator).generate();
+              try {
+                new DefaultCodeGenerator().opts(configurator).generate();
+              } catch (RuntimeException e) {
+                throw new RuntimeException("Failed to generate code base on file " + file.toFile().getName());
+              }
 
               return super.visitFile(file, attrs);
             }
           });
-        } catch (IOException e) {
+        } catch (RuntimeException | IOException e) {
           LOGGER.error(e.getMessage());
+          return;
         }
       } else {
         configurator.setInputSpec(specFile);
         new DefaultCodeGenerator().opts(configurator).generate();
       }
+
+      LOGGER.info("Success to generate code, the directory is: {}", output);
     }
   }
 }
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index 988389a..ca007d6 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -27,13 +27,14 @@ import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.servicecomb.swagger.SwaggerUtils;
+import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Command(name = "docgenerate", description = "Generate document by OpenAPI specification file")
 public class DocGenerate implements Runnable {
@@ -59,30 +60,48 @@ public class DocGenerate implements Runnable {
     try {
       Path specPath = Paths.get(specFile);
 
+      String[] retValues = new String[1];
+      String[] fileName = new String[1];
+
       if (Files.isDirectory(specPath)) {
 
         Files.walkFileTree(specPath, new SimpleFileVisitor<Path>() {
           @Override
           public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
 
-            DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
+            retValues[0] = DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
                 output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
                 format);
+            if (StringUtils.isEmpty(retValues[0])) {
+              fileName[0] = file.toFile().getName();
+              return FileVisitResult.TERMINATE;
+            }
+
             return super.visitFile(file, attrs);
           }
         });
       } else if (Files.isRegularFile(specPath)) {
+        fileName[0] = specPath.toFile().getName();
 
-        DocGeneratorManager.generate(SwaggerUtils.parseSwagger(specPath.toUri().toURL()),
+        retValues[0] = DocGeneratorManager.generate(SwaggerUtils.parseSwagger(specPath.toUri().toURL()),
             output + File.separator + new File(specFile).getName()
                 .substring(0, new File(specFile).getName().indexOf(".")),
             format);
       } else {
-        DocGeneratorManager.generate(SwaggerUtils.parseSwagger(URI.create(specFile).toURL()),
+        fileName[0] = specFile;
+
+        retValues[0] = DocGeneratorManager.generate(SwaggerUtils.parseSwagger(URI.create(specFile).toURL()),
             output + File.separator + new File(specFile).getName()
                 .substring(0, new File(specFile).getName().indexOf(".")),
             format);
       }
+
+      if (StringUtils.isEmpty(retValues[0])) {
+        LOGGER.error("Failed to generate document base on file {}", fileName[0]);
+        return;
+      }
+
+      LOGGER.info("Success to generate document, the directory is: {}", output);
     } catch (IOException e) {
       LOGGER.error(e.getMessage());
     }
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
index 7d0f10b..b5da899 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
@@ -35,7 +35,7 @@ public class ToolkitMain {
 
     Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("java -jar toolkit-cli-" + projectVersion + ".jar");
     builder.withDescription("Microservice development toolkit(version " + projectVersion
-        + "). More info on https://github.com/MabinGo/toolkit");
+        + "). ");
     builder.withDefaultCommand(Help.class);
     builder.withCommands(CodeGenerate.class, DocGenerate.class, Help.class);
     Runnable cmd = builder.build().parse(args);
diff --git a/toolkit-cli/src/main/resources/log4j2.xml b/toolkit-cli/src/main/resources/log4j2.xml
new file mode 100755
index 0000000..03ca678
--- /dev/null
+++ b/toolkit-cli/src/main/resources/log4j2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+
+<configuration>
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+    </Root>
+    <Logger name="io.swagger" additivity="false" level="error">
+      <AppenderRef ref="Console"/>
+    </Logger>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index 647be5c..5924444 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -31,7 +31,7 @@ public class CliTest {
   @Test
   public void generateServiceCombCodeFromSingleContract() throws IOException {
 
-    String[] programModels = new String[] {"SpringMVC","POJO","JAX-RS","SpringBoot"};
+    String[] programModels = new String[] {"SpringMVC", "POJO", "JAX-RS", "SpringBoot"};
     Path tempDir = Files.createTempDirectory(null);
     Arrays.stream(programModels).forEach(model -> {
       try {
diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
old mode 100644
new mode 100755
index 1fa05c4..1734236
--- a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
@@ -1,5 +1,14 @@
 package plugin;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.maven.plugin.testing.MojoRule;
 import org.apache.maven.plugin.testing.resources.TestResources;
 import org.apache.maven.project.MavenProject;
@@ -7,15 +16,6 @@ import org.apache.servicecomb.toolkit.plugin.GenerateContractsDocMojo;
 import org.junit.Rule;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.*;
-import static org.mockito.Mockito.mock;
-
 
 public class GenerateContractsDocMojoTest {
 
@@ -46,8 +46,5 @@ public class GenerateContractsDocMojoTest {
     assertEquals(".yaml", this.rule.getVariableValueFromObject(generateContractsDocMojo, "format"));
     rule.executeMojo(project, PLUGIN_GOAL);
     generateContractsDocMojo.execute();
-
   }
-
-
 }
diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
old mode 100644
new mode 100755
index df9d780..7472485
--- a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
@@ -1,5 +1,15 @@
 package plugin;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.testing.MojoRule;
 import org.apache.maven.plugin.testing.resources.TestResources;
@@ -8,18 +18,6 @@ import org.apache.servicecomb.toolkit.plugin.GenerateContractsMojo;
 import org.junit.Rule;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.*;
-import static org.mockito.Mockito.mock;
-
 public class GenerateContractsMojoTest {
 
   private static final String PLUGIN_GOAL = "generateContracts";
@@ -57,12 +55,12 @@ public class GenerateContractsMojoTest {
     rule.setVariableValueToObject(generateContractsMojo, "project", project);
     assertNotNull(this.rule.getVariableValueFromObject(generateContractsMojo, "project"));
 
-    assertEquals("target/test_output_contracts", this.rule.getVariableValueFromObject(generateContractsMojo, "outputDir"));
+    assertEquals("target/test_output_contracts",
+        this.rule.getVariableValueFromObject(generateContractsMojo, "outputDir"));
     assertEquals(".yaml", this.rule.getVariableValueFromObject(generateContractsMojo, "format"));
 
     generateContractsMojo.execute();
 
     assertTrue(new File("target/test_output_contracts").exists());
   }
-
 }
diff --git a/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml b/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml
old mode 100644
new mode 100755
index 9a71eb5..0be2ad0
--- a/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml
+++ b/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml
@@ -14,33 +14,33 @@
   -->
 
 <project
-        xmlns="http://maven.apache.org/POM/4.0.0"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-    <modelVersion>4.0.0</modelVersion>
-    <prerequisites>
-        <maven>3.0.3</maven>
-    </prerequisites>
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.0.3</maven>
+  </prerequisites>
 
-    <groupId>org.apache.servicecomb</groupId>
-    <artifactId>this-is-for-test-only</artifactId>
-    <version>0.1.0-SNAPSHOT</version>
-    <name>This is for Test ONLY</name>
-    <packaging>jar</packaging>
+  <groupId>org.apache.servicecomb</groupId>
+  <artifactId>this-is-for-test-only</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>This is for Test ONLY</name>
+  <packaging>jar</packaging>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.servicecomb</groupId>
-                <artifactId>toolkit-maven-plugin</artifactId>
-                <version>${project.version}</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <outputDir>target/test_output_contracts</outputDir>
-                    <format>.yaml</format>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>toolkit-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <outputDir>target/test_output_contracts</outputDir>
+          <format>.yaml</format>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>
\ No newline at end of file
diff --git a/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml b/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml
old mode 100644
new mode 100755
index 2b05bdf..34187b2
--- a/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml
+++ b/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml
@@ -14,33 +14,33 @@
   -->
 
 <project
-        xmlns="http://maven.apache.org/POM/4.0.0"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-    <modelVersion>4.0.0</modelVersion>
-    <prerequisites>
-        <maven>3.0.3</maven>
-    </prerequisites>
-    <groupId>org.apache.servicecomb</groupId>
-    <artifactId>this-is-for-test-only</artifactId>
-    <version>1.0-SNAPSHOT</version>
-    <name>This is for Test ONLY</name>
-    <packaging>jar</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.0.3</maven>
+  </prerequisites>
+  <groupId>org.apache.servicecomb</groupId>
+  <artifactId>this-is-for-test-only</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>This is for Test ONLY</name>
+  <packaging>jar</packaging>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.servicecomb</groupId>
-                <artifactId>toolkit-maven-plugin</artifactId>
-                <version>${project.version}</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <outputDir>./target/plugin-test-output</outputDir>
-                    <docOutputDir>./target/plugin-test-output</docOutputDir>
-                    <format>.yaml</format>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>toolkit-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <outputDir>./target/plugin-test-output</outputDir>
+          <docOutputDir>./target/plugin-test-output</docOutputDir>
+          <format>.yaml</format>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>
\ No newline at end of file


[servicecomb-toolkit] 12/49: add new programming model POJO

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 0e69c4d1e074049642ddbf189ceab225e9eff3d2
Author: kakulisen <18...@163.com>
AuthorDate: Thu May 23 22:15:14 2019 +0800

    add new programming model POJO
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../toolkit/codegen/RemoveImplSuffixLambda.java    |  39 +++++++
 .../toolkit/codegen/ServiceCombCodegen.java        |  27 +++++
 .../libraries/POJO/Application.mustache            |  11 ++
 .../ServiceComb/libraries/POJO/api.mustache        |  38 ++++++
 .../libraries/POJO/apiInterface.mustache           |  23 ++++
 .../ServiceComb/libraries/POJO/bodyParams.mustache |   1 +
 .../ServiceComb/libraries/POJO/formParams.mustache |   2 +
 .../libraries/POJO/headerParams.mustache           |   1 +
 .../ServiceComb/libraries/POJO/pathParams.mustache |   1 +
 .../ServiceComb/libraries/POJO/pom.mustache        | 127 +++++++++++++++++++++
 .../libraries/POJO/queryParams.mustache            |   1 +
 .../servicecomb/toolkit/codegen/GeneratorTest.java |   1 +
 .../apache/servicecomb/toolkit/cli/CliTest.java    |   2 +-
 13 files changed, 273 insertions(+), 1 deletion(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
new file mode 100644
index 0000000..519a584
--- /dev/null
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import com.samskivert.mustache.Mustache;
+import com.samskivert.mustache.Template;
+
+import java.io.IOException;
+import java.io.Writer;
+
+public class RemoveImplSuffixLambda implements Mustache.Lambda  {
+
+  @Override
+  public void execute(Template.Fragment fragment, Writer writer) throws IOException {
+
+    String text = fragment.execute();
+    if(text.endsWith("Impl")){
+      text = text.substring(0,text.lastIndexOf("Impl"));
+    }
+    writer.write(text);
+
+  }
+
+}
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index c0ded7c..36efe5b 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -35,6 +35,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private static final String DEFAULT_LIBRARY = "SpringMVC";
 
+  private static final String POJO_LIBRARY = "POJO";
 
   private String mainClassPackage;
 
@@ -58,6 +59,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private String modelConsumerTemplate = consumerTemplateFolder + "/model.mustache";
 
+  private String pojoApiInterfaceTemplate = "apiInterface.mustache";
 
   private int modelSwitch = 1;
 
@@ -98,6 +100,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     mainClassPackage = groupId + ".example";
 
     supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
+    supportedLibraries.put(POJO_LIBRARY, "ServiceComb Server application using the pojo programming model.");
 
     setLibrary(DEFAULT_LIBRARY);
 
@@ -124,9 +127,19 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
       String suffix = apiTemplateFiles().get(templateName);
       return apiConsumerFolder() + File.separator + toApiFilename(tag) + suffix;
     }
+    if (pojoApiInterfaceTemplate.equals(templateName)) {
+      String suffix = apiTemplateFiles().get(templateName);
+      String pojoApiInterfaceName =  pojoApiInterfaceFolder() + File.separator +  camelize(tag) + "Api" + suffix;
+      additionalProperties.put("pojoApiInterfaceName",camelize(tag) + "Api");
+      return pojoApiInterfaceName;
+    }
     return super.apiFilename(templateName, tag);
   }
 
+  private String pojoApiInterfaceFolder() {
+    return outputFolder + "/" + modelProject + "/" + sourceFolder + "/" + apiPackage().replace('.', '/');
+  }
+
   private String apiConsumerFolder() {
     return outputFolder + "/" + consumerProject + "/" + sourceFolder + "/" + apiPackage().replace('.', '/');
   }
@@ -141,6 +154,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     additionalProperties.put("mainClassPackage", mainClassPackage);
     additionalProperties.put("camelcase", new CamelCaseLambda());
     additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda());
+    additionalProperties.put("removeImplSuffix", new RemoveImplSuffixLambda());
     additionalProperties.put("applicationId", applicationId);
     additionalProperties.put("microserviceName", microserviceName);
 
@@ -148,6 +162,15 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     processProviderProjectOpts();
     processConsumerOpts();
     processModelProjectOpts();
+    processPojo();
+  }
+
+  private void processPojo() {
+    if (!POJO_LIBRARY.equals(getLibrary())) {
+      return;
+    }
+    apiTemplateFiles.put(pojoApiInterfaceTemplate, ".java");
+    additionalProperties.put("isPOJO", true);
   }
 
   @Override
@@ -241,6 +264,10 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
       return apiName;
     }
 
+    if(POJO_LIBRARY.equals(getLibrary())){
+      return initialCaps(name) + "ApiImpl";
+    }
+
     return initialCaps(name) + "Controller";
   }
 
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
new file mode 100644
index 0000000..fda8d43
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
@@ -0,0 +1,11 @@
+package {{mainClassPackage}};
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+
+public class Application {
+
+  public static void main(String[] args) throws Exception {
+    System.setProperty("local.registry.file", "notExistJustForceLocal");
+    BeanUtils.init();
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
new file mode 100644
index 0000000..abb8da0
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
@@ -0,0 +1,38 @@
+package {{apiPackage}};
+
+import {{modelPackage}}.*;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+import org.apache.servicecomb.provider.pojo.RpcSchema;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+import java.util.List;
+import java.util.Map;
+import java.io.File;
+import static org.springframework.http.MediaType.*;
+
+@RpcSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+{{#operations}}
+public class {{classname}} implements {{#removeImplSuffix}}{{classname}}{{/removeImplSuffix}} {
+  {{#operation}}
+
+  @Override
+  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
+    {{/hasMore}}{{/allParams}}) {
+      // do some magic!
+      return null;
+  }
+
+  {{/operation}}
+}
+{{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
new file mode 100644
index 0000000..d7c5b3e
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
@@ -0,0 +1,23 @@
+package {{apiPackage}};
+
+import {{modelPackage}}.*;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.io.File;
+
+
+{{#operations}}
+public interface {{#removeImplSuffix}}{{classname}}{{/removeImplSuffix}} {
+    {{#operation}}
+
+     public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
+        {{/hasMore}}{{/allParams}});
+
+    {{/operation}}
+    }
+{{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache
new file mode 100644
index 0000000..bb1d6ff
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache
@@ -0,0 +1 @@
+{{#isBodyParam}} {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
new file mode 100644
index 0000000..96f17c8
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
@@ -0,0 +1,2 @@
+{{#isFormParam}}{{#notFile}}
+{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} File {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache
new file mode 100644
index 0000000..edeeb85
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache
@@ -0,0 +1 @@
+{{#isHeaderParam}} {{{dataType}}} {{paramName}}{{/isHeaderParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache
new file mode 100644
index 0000000..9a0630b
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache
@@ -0,0 +1 @@
+{{#isPathParam}} {{{dataType}}} {{paramName}}{{/isPathParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
new file mode 100644
index 0000000..c2ceb61
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
@@ -0,0 +1,127 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <artifactId>{{artifactId}}</artifactId>
+    <groupId>{{groupId}}</groupId>
+    <version>{{artifactVersion}}</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>provider</artifactId>
+  <packaging>jar</packaging>
+  <name>{{artifactId}}</name>
+
+  <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>{{groupId}}</groupId>
+      <artifactId>model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-bizkeeper</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-loadbalance</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-highway</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-rest-vertx</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-flowcontrol-qps</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-pojo</artifactId>
+    </dependency>
+    <!--log4j2-->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
+
+  </dependencies>
+
+  <!--for package and deploy-->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <classpathPrefix>lib/</classpathPrefix>
+              <!--change to your main class-->
+              <mainClass>${package}.Application</mainClass>
+            </manifest>
+            <manifestEntries>
+              <Class-Path>. </Class-Path>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/lib</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache
new file mode 100644
index 0000000..157ad86
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache
@@ -0,0 +1 @@
+{{#isQueryParam}} {{{dataType}}} {{paramName}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index e011c7b..3156fae 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -38,6 +38,7 @@ public class GeneratorTest {
   public void generateProgrammingModels() throws IOException, URISyntaxException {
 
     generateCode("SpringMVC");
+    generateCode("POJO");
   }
 
   private void generateCode(String programmingModel) throws IOException, URISyntaxException {
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index 35885ad..f8ef465 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -31,7 +31,7 @@ public class CliTest {
   @Test
   public void generateServiceCombCodeFromSingleContract() throws IOException {
 
-    String[] programModels = new String[] {"SpringMVC"};
+    String[] programModels = new String[] {"SpringMVC","POJO"};
     Path tempDir = Files.createTempDirectory(null);
     Arrays.stream(programModels).forEach(model -> {
       try {


[servicecomb-toolkit] 48/49: format README

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 4884afdaf51c366e0b72cdc00bdf82713e827f8e
Author: kakulisen <18...@163.com>
AuthorDate: Tue Jun 11 12:09:19 2019 +0800

    format README
    
    Signed-off-by: kakulisen <18...@163.com>
---
 README-ZH.md |  6 +++---
 README.md    | 36 ++++++++++++++++++------------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/README-ZH.md b/README-ZH.md
index 74e8f6c..c48f5f1 100755
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -107,11 +107,11 @@ $ java -jar toolkit-cli-{version}.jar  codegenerate -m ServiceComb -i swagger.ya
 例:--artifact-id springmvc-example
 * --artifact-version : 指定生成的项目的artifact version  
 例:--artifact-version 1.0.0
-* --api-package : 指定生成项目的api package
+* --api-package : 指定生成项目的api package  
 例:--api-package com.demo.api
-* --model-package : 指定生成项目的model package
+* --model-package : 指定生成项目的model package   
 例:--model-package com.demo.model
-* -t, --service-type : 指定生成的微服务项目的微服务类型。可选值为provider,consumer,all               
+* -t, --service-type : 指定生成的微服务项目的微服务类型。可选值为provider,consumer,all                  
 例:--service-type provider  
 
 #### 3.2.2 契约生成文档
diff --git a/README.md b/README.md
index fbf7e56..12ad334 100755
--- a/README.md
+++ b/README.md
@@ -92,26 +92,26 @@ $ java -jar toolkit-cli-{version}.jar help
 $ java -jar toolkit-cli-{version}.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
 ```
 > **codegenerate** Command option
-* -m, --microservice-framework. Specify microservices framework, now supports ServiceComb.
-例:-m ServiceComb
-* -p, --programming-model. Specify programming model, optional JAX-RS, POJO, SpringMVC, SpringBoot.
-例:-p SpringMvc
-* -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
-例:-i http://petstore.swagger.io/v2/swagger.json
+* -m, --microservice-framework. Specify microservices framework, now supports ServiceComb.  
+e.g.:-m ServiceComb
+* -p, --programming-model. Specify programming model, optional JAX-RS, POJO, SpringMVC, SpringBoot.  
+e.g.:-p SpringMvc
+* -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.  
+e.g.:-i http://petstore.swagger.io/v2/swagger.json
 * -o, --output. Generated project code output path.  
-例:-o ./project
-* --group-id. Specify the group id of the generated project.
-例:--group-id com.demo
-* --artifact-id. Specify the artifact id of the generated project.
-例:--artifact-id springmvc-example
-* --artifact-version. Specify the artifact version of the generated project.
-例:--artifact-version 1.0.0
-* --api-package : Specify the api package of the generated project.
-例:--api-package com.demo.api
-* --model-package : Specify the model package of the generated project.
-例:--model-package com.demo.model
+e.g.:-o ./project
+* --group-id. Specify the group id of the generated project.  
+e.g.:--group-id com.demo
+* --artifact-id. Specify the artifact id of the generated project.  
+e.g.:--artifact-id springmvc-example
+* --artifact-version. Specify the artifact version of the generated project.   
+e.g.:--artifact-version 1.0.0
+* --api-package : Specify the api package of the generated project.   
+e.g.:--api-package com.demo.api  
+* --model-package : Specify the model package of the generated project.  
+e.g.:--model-package com.demo.model
 * -t, --service-type : Specify microservice type of generated microservice project. optional value is provider,consumer,all               
-例:--service-type provider  
+e.g.:--service-type provider  
 
 #### 3.2.2 Service contract generation document
 ```shell


[servicecomb-toolkit] 49/49: Merge pull request #13 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 8c1b0f8a24243500082f0fc8ba148e1e9f7fc955
Merge: 69d7396 4884afd
Author: Mabin <bi...@huawei.com>
AuthorDate: Tue Jun 11 14:15:27 2019 +0800

    Merge pull request #13 from kakulisen/master
    
    Add some new description in README

 README-ZH.md |  8 +++++++-
 README.md    | 32 +++++++++++++++++++-------------
 2 files changed, 26 insertions(+), 14 deletions(-)


[servicecomb-toolkit] 02/49: initial version.Support for generating ServiceComb code that used Springmvc model.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit bfa5bd740a5263bffef468eed493fb1a56f7aa87
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu May 16 21:31:32 2019 +0800

    initial version.Support for generating ServiceComb code that used Springmvc model.
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .gitignore                                         |  86 ++++++++++++
 code-generator/pom.xml                             |  69 +++++++++
 .../servicecomb/toolkit/codegen/CodeGenerator.java |  30 ++++
 .../toolkit/codegen/DefaultCodeGenerator.java      |  41 ++++++
 .../codegen/ServiceCombProviderCodegen.java        | 155 +++++++++++++++++++++
 .../services/io.swagger.codegen.CodegenConfig      |  18 +++
 .../resources/ServiceCombProvider/README.mustache  |  20 +++
 .../ServiceCombProvider/enumClass.mustache         |  43 ++++++
 .../ServiceCombProvider/enumOuterClass.mustache    |  37 +++++
 .../generatedAnnotation.mustache                   |   1 +
 .../libraries/SpringMvc/Application.mustache       |  28 ++++
 .../libraries/SpringMvc/api.mustache               |  42 ++++++
 .../libraries/SpringMvc/api_test.mustache          | 102 ++++++++++++++
 .../libraries/SpringMvc/bodyParams.mustache        |   1 +
 .../libraries/SpringMvc/formParams.mustache        |   2 +
 .../libraries/SpringMvc/headerParams.mustache      |   1 +
 .../libraries/SpringMvc/pathParams.mustache        |   1 +
 .../libraries/SpringMvc/pom.mustache               | 104 ++++++++++++++
 .../libraries/SpringMvc/queryParams.mustache       |   1 +
 .../resources/ServiceCombProvider/log4j2.mustache  |  41 ++++++
 .../ServiceCombProvider/microservice.mustache      |  43 ++++++
 .../resources/ServiceCombProvider/model.mustache   |  27 ++++
 .../resources/ServiceCombProvider/pojo.mustache    | 134 ++++++++++++++++++
 .../ServiceCombProvider/returnTypes.mustache       |   1 +
 .../typeInfoAnnotation.mustache                    |   7 +
 .../ServiceCombProvider/xmlAnnotation.mustache     |   6 +
 pom.xml                                            |  40 ++++++
 toolkit-cli/dependency-reduced-pom.xml             |  64 +++++++++
 toolkit-cli/pom.xml                                | 102 ++++++++++++++
 .../servicecomb/toolkit/cli/CodeGenerate.java      | 114 +++++++++++++++
 .../servicecomb/toolkit/cli/ToolkitMain.java       |  58 ++++++++
 .../src/main/resources/application.properties      |   1 +
 32 files changed, 1420 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..e396f22
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,86 @@
+# Output Directory
+target/
+
+# C pre-compile
+*.gch
+*.pch
+
+# C compile
+*.a
+*.o
+*.ko
+*.la
+*.lo
+*.obj
+*.elf
+*.so
+*.so.*
+*.dylib
+*.exe
+*.lib
+*.dll
+*.out
+*.app
+*.hex
+
+# Debug files
+*.dSYM/
+
+# Java
+*.class
+
+# Java Package Files
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# Zip Files
+*.rar
+*.zip
+*.7z
+*.tar
+*.gz
+
+# Ant
+build/
+
+# Compiled Python
+__pycache__/
+*.py[cod]
+*py.class
+
+# Eclipse
+.settings/
+.classpath
+.project
+
+# IntelliJ, based on http://devnet.jetbrains.net/docs/DOC-1186
+.idea/
+*.iml
+*.ipr
+*.iws
+
+# logs and trace
+*.log
+*.trace
+*.dat
+
+# vi swap
+*.swp
+
+# Backup Files
+*.bak
+*.old
+
+# SVN metadata
+.svn/
+
+# Mac
+.DS_Store
+
+# gradle
+.gradle
+
diff --git a/code-generator/pom.xml b/code-generator/pom.xml
new file mode 100755
index 0000000..9866719
--- /dev/null
+++ b/code-generator/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>toolkit</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>0.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>code-generator</artifactId>
+
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <swagger-codegen-version>2.4.3</swagger-codegen-version>
+    <maven-plugin-version>1.0.0</maven-plugin-version>
+    <junit-version>4.8.1</junit-version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>io.swagger</groupId>
+      <artifactId>swagger-codegen</artifactId>
+      <version>${swagger-codegen-version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.6.1</version>
+        <configuration>
+          <source>8</source>
+          <target>8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <includes>
+          <include>**/*.*</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+</project>
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/CodeGenerator.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/CodeGenerator.java
new file mode 100755
index 0000000..2ac18c5
--- /dev/null
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/CodeGenerator.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.io.File;
+import java.util.List;
+
+import io.swagger.codegen.config.CodegenConfigurator;
+
+public interface CodeGenerator {
+
+  CodeGenerator opts(CodegenConfigurator opts);
+
+  List<File> generate();
+}
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
new file mode 100755
index 0000000..459cf56
--- /dev/null
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.io.File;
+import java.util.List;
+
+import io.swagger.codegen.DefaultGenerator;
+import io.swagger.codegen.config.CodegenConfigurator;
+
+public class DefaultCodeGenerator implements CodeGenerator {
+
+  private DefaultGenerator generator = new DefaultGenerator();
+
+  @Override
+  public CodeGenerator opts(CodegenConfigurator opts) {
+
+    generator.opts(opts.toClientOptInput());
+    return this;
+  }
+
+  @Override
+  public List<File> generate() {
+    return generator.generate();
+  }
+}
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
new file mode 100755
index 0000000..25b345f
--- /dev/null
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.io.File;
+import java.util.Map;
+
+import io.swagger.codegen.CliOption;
+import io.swagger.codegen.CodegenConfig;
+import io.swagger.codegen.CodegenConstants;
+import io.swagger.codegen.CodegenType;
+import io.swagger.codegen.SupportingFile;
+import io.swagger.codegen.languages.AbstractJavaCodegen;
+import io.swagger.codegen.languages.SpringCodegen;
+import io.swagger.codegen.mustache.CamelCaseLambda;
+
+public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements CodegenConfig {
+
+  private static final String DEFAULT_LIBRARY = "SpringMvc";
+
+  private String resourcesFolder = projectFolder + File.separator + "resources";
+
+  private String apiVersion = "1.0.0";
+
+  private String mainClassPackage;
+
+
+  @Override
+  public CodegenType getTag() {
+    return CodegenType.SERVER;
+  }
+
+  @Override
+  public String getName() {
+    return "ServiceCombProvider";
+  }
+
+  @Override
+  public String getHelp() {
+    return "Generates a ServiceComb server library.";
+  }
+
+  public ServiceCombProviderCodegen() {
+    super();
+
+    outputFolder = "generated-code/ServiceCombProvider";
+
+    modelDocTemplateFiles.remove("model_doc.mustache");
+    apiDocTemplateFiles.remove("api_doc.mustache");
+    apiTestTemplateFiles.remove("api_test.mustache");
+
+    embeddedTemplateDir = templateDir = "ServiceCombProvider";
+
+    apiPackage = "servicecomb.example.controller";
+
+    modelPackage = "servicecomb.example.model";
+
+    mainClassPackage = "servicecomb.example";
+
+    groupId = "org.apache.servicecomb";
+    artifactId = "demo";
+
+    supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
+
+    setLibrary(DEFAULT_LIBRARY);
+
+    CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
+    library.setDefault(DEFAULT_LIBRARY);
+    library.setEnum(supportedLibraries);
+    library.setDefault(DEFAULT_LIBRARY);
+    cliOptions.add(library);
+  }
+
+  @Override
+  public void processOpts() {
+
+    super.processOpts();
+
+    importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
+    additionalProperties.put("dateLibrary", "java8");
+    additionalProperties.put("jackson", "true");
+    additionalProperties.put("apiVersion", apiVersion);
+    additionalProperties.put("mainClassPackage", mainClassPackage);
+    additionalProperties.put("camelcase", new CamelCaseLambda());
+
+    supportingFiles.add(new SupportingFile("pom.mustache",
+        "",
+        "pom.xml")
+    );
+    supportingFiles.add(new SupportingFile("README.mustache",
+        "",
+        "README.md")
+    );
+
+    supportingFiles.add(new SupportingFile("Application.mustache",
+        mainClassFolder(),
+        "Application.java")
+    );
+
+    supportingFiles.add(new SupportingFile("log4j2.mustache",
+        resourcesFolder,
+        "log4j2.xml")
+    );
+    supportingFiles.add(new SupportingFile("microservice.mustache",
+        resourcesFolder,
+        "microservice.yaml")
+    );
+  }
+
+  @Override
+  public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
+    objs = super.postProcessModelsEnum(objs);
+    SpringCodegen springCodegen = new SpringCodegen();
+    return springCodegen.postProcessModelsEnum(objs);
+  }
+
+  @Override
+  public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
+    SpringCodegen springCodegen = new SpringCodegen();
+    return springCodegen.postProcessOperations(objs);
+  }
+
+  @Override
+  public String toApiName(String name) {
+    if (name.length() == 0) {
+      return "DefaultController";
+    }
+
+    String apiName = (String) additionalProperties.get("apiName");
+    if (apiName != null) {
+      return apiName;
+    }
+
+    return initialCaps(name) + "Controller";
+  }
+
+  private String mainClassFolder() {
+    return sourceFolder + File.separator + mainClassPackage.replace(".", File.separator);
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
new file mode 100755
index 0000000..9e194db
--- /dev/null
+++ b/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.servicecomb.toolkit.codegen.ServiceCombProviderCodegen
diff --git a/code-generator/src/main/resources/ServiceCombProvider/README.mustache b/code-generator/src/main/resources/ServiceCombProvider/README.mustache
new file mode 100755
index 0000000..2258a49
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/README.mustache
@@ -0,0 +1,20 @@
+## Welcome to use ServiceComb Java Chassis
+This project(module) is generate by *org.apache.servicecomb.archetypes:business-service-springmvc-archetype*, it use **springmvc provider** to develop service producer.
+
+### More works can be done further:
+1. Modify "HelloImpl", add your business service logic, or create some new producers to provide your services. More details can be found : http://servicecomb.apache.org/users/develop-with-springmvc/
+2. Modify "microservice.yaml", change APPLICATION_ID, service_description.name, version, and service center address, endpoints publish address etc. More details can be found : http://servicecomb.apache.org/users/service-definition/
+3. Modify setting value of "mainClass" in pom.xml for package.
+
+### Package your service
+Under project(module) root folder, run
+```bash
+mvn package
+```
+Then you can get outputs in target folder:
+- lib : contains all dependencies jars
+- xxxxxx-{version}.jar
+```bash
+java -jar xxxxxx-{version}.jar
+```
+*Notice: If you need to modify config setting in "microservice.yaml" like service center address but don't want repackage the executable jar, **you can direct place a new "microservice.yaml" file in same folder, then settings will be overridden.***
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/enumClass.mustache b/code-generator/src/main/resources/ServiceCombProvider/enumClass.mustache
new file mode 100755
index 0000000..dfdada5
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/enumClass.mustache
@@ -0,0 +1,43 @@
+  /**
+   * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
+   */
+  public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
+
+    {{#gson}}
+        {{#allowableValues}}
+            {{#enumVars}}
+    @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
+    {{{name}}}({{{value}}}){{^-last}},
+    {{/-last}}{{#-last}};{{/-last}}
+            {{/enumVars}}
+        {{/allowableValues}}
+    {{/gson}}
+    {{^gson}}
+        {{#allowableValues}}
+            {{#enumVars}}
+    {{{name}}}({{{value}}}){{^-last}},
+    {{/-last}}{{#-last}};{{/-last}}
+            {{/enumVars}}
+        {{/allowableValues}}
+    {{/gson}}
+
+    private {{{datatype}}} value;
+
+    {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{datatype}}} value) {
+      this.value = value;
+    }
+
+    @Override
+    public String toString() {
+      return String.valueOf(value);
+    }
+
+    public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
+      for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+        if (String.valueOf(b.value).equals(text)) {
+          return b;
+        }
+      }
+      return null;
+    }
+  }
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/enumOuterClass.mustache b/code-generator/src/main/resources/ServiceCombProvider/enumOuterClass.mustache
new file mode 100755
index 0000000..a5f0034
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/enumOuterClass.mustache
@@ -0,0 +1,37 @@
+
+/**
+ * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
+ */
+public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
+  {{#gson}}
+  {{#allowableValues}}{{#enumVars}}
+  @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
+  {{{name}}}({{{value}}}){{^-last}},
+  {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
+  {{/gson}}
+  {{^gson}}
+  {{#allowableValues}}{{#enumVars}}
+  {{{name}}}({{{value}}}){{^-last}},
+  {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
+  {{/gson}}
+
+  private {{{dataType}}} value;
+
+  {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) {
+    this.value = value;
+  }
+
+  @Override
+  public String toString() {
+    return String.valueOf(value);
+  }
+
+  public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
+    for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+      if (String.valueOf(b.value).equals(text)) {
+        return b;
+      }
+    }
+    return null;
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/generatedAnnotation.mustache b/code-generator/src/main/resources/ServiceCombProvider/generatedAnnotation.mustache
new file mode 100755
index 0000000..49110fc
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/generatedAnnotation.mustache
@@ -0,0 +1 @@
+@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/Application.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/Application.mustache
new file mode 100755
index 0000000..aef3762
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/Application.mustache
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {{mainClassPackage}};
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+
+public class Application {
+
+  public static void main(String[] args) throws Exception {
+    System.setProperty("local.registry.file", "notExistJustForceLocal");
+    BeanUtils.init();
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api.mustache
new file mode 100755
index 0000000..d303827
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api.mustache
@@ -0,0 +1,42 @@
+package {{apiPackage}};
+
+import {{modelPackage}}.*;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import java.util.List;
+import java.util.Map;
+import static org.springframework.http.MediaType.*;
+
+@RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+@RequestMapping(value = "/", produces = {APPLICATION_JSON_VALUE})
+{{>generatedAnnotation}}
+{{#operations}}
+public class {{classname}} {
+  {{#operation}}
+
+  @RequestMapping(value = "{{path}}",
+    {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}
+    {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}
+    method = RequestMethod.{{httpMethod}})
+  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
+    {{/hasMore}}{{/allParams}}) {
+      // do some magic!
+      return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
+  }
+
+  {{/operation}}
+}
+{{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api_test.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api_test.mustache
new file mode 100755
index 0000000..1633203
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api_test.mustache
@@ -0,0 +1,102 @@
+package {{package}};
+{{#imports}}import {{import}};
+{{/imports}}
+import java.util.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import static org.junit.Assert.assertEquals;
+
+public class {{classname}}ContractTest {
+    @Autowired
+    private {{classname}} api;
+
+    private static final String NAME_LARRY_JSON = "{\"name\": \"larry\"}";
+
+    @Rule
+    public TestFailureProviderRule mockTestProvider = new TestFailureProviderRule("{{#camelcase}}{{classname}}{{/camelcase}}Provider", this);
+
+    @Pact(provider="{{#camelcase}}{{classname}}{{/camelcase}}Provider", consumer="{{#camelcase}}{{classname}}{{/camelcase}}Consumer")
+    public RequestResponsePact createFragment(PactDslWithProvider builder) {
+
+{{#operations}}
+    {{#operation}}
+        {{#hasHeaderParams}}
+                Map<String, String> {{operationId}}RequestHeaders = new HashMap<String, String>();
+        {{/hasHeaderParams}}
+    {{/operation}}
+{{/operations}}
+{{#operations}}
+    {{#operation}}
+        {{#responseHeaders}}
+                Map<String, String> {{operationId}}ResponseHeaders = new HashMap<String, String>();
+        {{/responseHeaders}}
+    {{/operation}}
+{{/operations}}
+
+        return builder
+{{#operations}}
+    {{#operation}}
+            .uponReceiving("{{summary}}")
+                .path("{{path}}")
+                .method("{{httpMethod}}")
+                {{#hasHeaderParams}}
+                .headers({{operationId}}RequestHeaders)
+                {{/hasHeaderParams}}
+            .willRespondWith()
+                .status(200)
+                {{#responseHeaders}}
+                .headers({{operationId}}ResponseHeaders)
+                {{/responseHeaders}}
+                .body("{\"responsetest\": true, \"name\": \"harry\"}")
+    {{/operation}}
+{{/operations}}
+            .toPact();
+    }
+
+
+    @Test
+    @PactVerification({"{{#camelcase}}{{classname}}{{/camelcase}}Provider"})
+    public void allPass() throws IOException {
+      mockTestProvider.validateResultWith((result, t) -> {
+        assertThat(t, is(nullValue()));
+        assertThat(result, is(PactVerificationResult.Ok.INSTANCE));
+      });
+      doTest("/", NAME_LARRY_JSON);
+    }
+
+    private void doTest(String path, String json) throws IOException {
+      ConsumerClient consumerClient = new ConsumerClient(mockTestProvider.getUrl());
+      consumerClient.options("/second");
+      try {
+        consumerClient.getAsMap(path, "");
+      } catch (IOException e) {
+      }
+      try {
+        new ConsumerClient(mockTestProvider2.getUrl()).putAsMap("/", json);
+      } catch (IOException e) {
+      }
+    }
+
+/*
+        @Test
+        public void {{operationId}}Test() throws Exception {
+        {{#allParams}}
+        {{^isFile}}
+            {{{dataType}}} {{paramName}} = {{{example}}};
+        {{/isFile}}
+        {{#isFile}}
+            org.springframework.web.multipart.MultipartFile {{paramName}} = null;
+        {{/isFile}}
+        {{/allParams}}
+            ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+            assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
+        }
+*/
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/bodyParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/bodyParams.mustache
new file mode 100755
index 0000000..5932bd1
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/bodyParams.mustache
@@ -0,0 +1 @@
+{{#isBodyParam}}@RequestBody {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/formParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/formParams.mustache
new file mode 100755
index 0000000..336c14d
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/formParams.mustache
@@ -0,0 +1,2 @@
+{{#isFormParam}}{{#notFile}}
+@RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}})  {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/headerParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/headerParams.mustache
new file mode 100755
index 0000000..7c3018b
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/headerParams.mustache
@@ -0,0 +1 @@
+{{#isHeaderParam}}@RequestHeader(value="{{paramName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pathParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pathParams.mustache
new file mode 100755
index 0000000..5152be0
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pathParams.mustache
@@ -0,0 +1 @@
+{{#isPathParam}}@PathVariable("{{paramName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pom.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pom.mustache
new file mode 100755
index 0000000..c119ee1
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pom.mustache
@@ -0,0 +1,104 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>{{groupId}}</groupId>
+  <artifactId>{{artifactId}}</artifactId>
+  <packaging>jar</packaging>
+  <name>{{artifactId}}</name>
+  <version>{{artifactVersion}}</version>
+
+  <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-rest-vertx</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>transport-highway</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-springmvc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
+
+  </dependencies>
+
+  <!--for package and deploy-->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <classpathPrefix>lib/</classpathPrefix>
+              <!--change to your main class-->
+              <mainClass>${package}.Application</mainClass>
+            </manifest>
+            <manifestEntries>
+              <Class-Path>. </Class-Path>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/lib</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/queryParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/queryParams.mustache
new file mode 100755
index 0000000..6ce8e14
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/queryParams.mustache
@@ -0,0 +1 @@
+{{#isQueryParam}}@RequestParam(value = "{{paramName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/log4j2.mustache b/code-generator/src/main/resources/ServiceCombProvider/log4j2.mustache
new file mode 100755
index 0000000..e43e15b
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/log4j2.mustache
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+<configuration>
+  <Properties>
+    <Property name="log_path">./target/log</Property>
+  </Properties>
+
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
+      filePattern="${log_path}/%d{yyyy-MM-dd}.log">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+      <TimeBasedTriggeringPolicy interval="1"/>
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+      <AppenderRef ref="DailyRollingFile"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache b/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache
new file mode 100755
index 0000000..67ad88a
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache
@@ -0,0 +1,43 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#More details can be found :
+# 1.http://servicecomb.apache.org/users/service-definition/
+# 2.http://servicecomb.apache.org/users/service-configurations/
+# 3.http://servicecomb.apache.org/users/communicate-protocol/
+
+#Indicates an application name
+APPLICATION_ID: business
+service_description:
+#Indicates a microservice name
+#The microservice name should be unique within an application.
+#The name can contain digits, uppercase and lowercase letters, hyphens(-), underscores(_), and periods(.); and can neither start nor end with punctuations.
+#The naming rule is as follows: ^[a-zA-Z0-9]+$|^[a-zA-Z0-9][a-zA-Z0-9_-.]*[a-zA-Z0-9]$.
+  name: business-service
+#Indicates a service version
+  version: 1.0.0
+servicecomb:
+  service:
+  #Specifies the service center IP address.
+    registry:
+      address: http://127.0.0.1:30100
+  #Specifies the rest transport listening IP address.
+  rest:
+    address: 0.0.0.0:8080
+  #Specifies the highway transport listening IP address.
+  highway:
+    address: 0.0.0.0:7070
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/model.mustache b/code-generator/src/main/resources/ServiceCombProvider/model.mustache
new file mode 100755
index 0000000..1923ac6
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/model.mustache
@@ -0,0 +1,27 @@
+package {{package}};
+
+import java.util.Objects;
+{{#imports}}import {{import}};
+{{/imports}}
+{{#serializableModel}}
+import java.io.Serializable;
+{{/serializableModel}}
+{{#useBeanValidation}}
+import org.springframework.validation.annotation.Validated;
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+{{/useBeanValidation}}
+{{#withXml}}
+import javax.xml.bind.annotation.*;
+{{/withXml}}
+
+{{#models}}
+{{#model}}
+{{#isEnum}}
+{{>enumOuterClass}}
+{{/isEnum}}
+{{^isEnum}}
+{{>pojo}}
+{{/isEnum}}
+{{/model}}
+{{/models}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/pojo.mustache b/code-generator/src/main/resources/ServiceCombProvider/pojo.mustache
new file mode 100755
index 0000000..5c3f7f3
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/pojo.mustache
@@ -0,0 +1,134 @@
+/**
+ * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
+ */
+{{#useBeanValidation}}@Validated{{/useBeanValidation}}
+{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
+public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
+{{#serializableModel}}
+  private static final long serialVersionUID = 1L;
+
+{{/serializableModel}}
+  {{#vars}}
+    {{#isEnum}}
+    {{^isContainer}}
+{{>enumClass}}
+    {{/isContainer}}
+    {{/isEnum}}
+    {{#items.isEnum}}
+      {{#items}}
+      {{^isContainer}}
+{{>enumClass}}
+      {{/isContainer}}
+      {{/items}}
+    {{/items.isEnum}}
+  {{#gson}}
+  @SerializedName("{{baseName}}")
+  {{/gson}}
+  {{#isContainer}}
+  {{#useBeanValidation}}@Valid{{/useBeanValidation}}
+  private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
+  {{/isContainer}}
+  {{^isContainer}}
+  private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
+  {{/isContainer}}
+
+  {{/vars}}
+  {{#vars}}
+  public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
+    this.{{name}} = {{name}};
+    return this;
+  }
+  {{#isListContainer}}
+
+  public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
+    {{^required}}
+    if (this.{{name}} == null) {
+      this.{{name}} = {{{defaultValue}}};
+    }
+    {{/required}}
+    this.{{name}}.add({{name}}Item);
+    return this;
+  }
+  {{/isListContainer}}
+  {{#isMapContainer}}
+
+  public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
+    {{^required}}
+    if (this.{{name}} == null) {
+      this.{{name}} = {{{defaultValue}}};
+    }
+    {{/required}}
+    this.{{name}}.put(key, {{name}}Item);
+    return this;
+  }
+  {{/isMapContainer}}
+
+  /**
+  {{#description}}
+   * {{{description}}}
+  {{/description}}
+  {{^description}}
+   * Get {{name}}
+  {{/description}}
+  {{#minimum}}
+   * minimum: {{minimum}}
+  {{/minimum}}
+  {{#maximum}}
+   * maximum: {{maximum}}
+  {{/maximum}}
+   * @return {{name}}
+  **/
+ {{#vendorExtensions.extraAnnotation}}
+  {{{vendorExtensions.extraAnnotation}}}
+  {{/vendorExtensions.extraAnnotation}}
+{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}  public {{{datatypeWithEnum}}} {{#isBoolean}}is{{/isBoolean}}{{getter}}() {
+    return {{name}};
+  }
+
+  public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
+    this.{{name}} = {{name}};
+  }
+
+  {{/vars}}
+
+  @Override
+  public boolean equals(java.lang.Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }{{#hasVars}}
+    {{classname}} {{classVarName}} = ({{classname}}) o;
+    return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
+        {{/hasMore}}{{/vars}}{{#parent}} &&
+        super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
+    return true;{{/hasVars}}
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class {{classname}} {\n");
+    {{#parent}}sb.append("    ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
+    {{#vars}}sb.append("    {{name}}: ").append(toIndentedString({{name}})).append("\n");
+    {{/vars}}sb.append("}");
+    return sb.toString();
+  }
+
+  /**
+   * Convert the given object to string with each line indented by 4 spaces
+   * (except the first line).
+   */
+  private String toIndentedString(java.lang.Object o) {
+    if (o == null) {
+      return "null";
+    }
+    return o.toString().replace("\n", "\n    ");
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/returnTypes.mustache b/code-generator/src/main/resources/ServiceCombProvider/returnTypes.mustache
new file mode 100755
index 0000000..63acd6f
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/returnTypes.mustache
@@ -0,0 +1 @@
+{{#returnContainer}}{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}List<{{returnType}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/typeInfoAnnotation.mustache b/code-generator/src/main/resources/ServiceCombProvider/typeInfoAnnotation.mustache
new file mode 100755
index 0000000..09be1ca
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/typeInfoAnnotation.mustache
@@ -0,0 +1,7 @@
+{{#jackson}}
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{discriminator}}", visible = true )
+@JsonSubTypes({
+  {{#children}}
+  @JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
+  {{/children}}
+}){{/jackson}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/xmlAnnotation.mustache b/code-generator/src/main/resources/ServiceCombProvider/xmlAnnotation.mustache
new file mode 100755
index 0000000..03586da
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceCombProvider/xmlAnnotation.mustache
@@ -0,0 +1,6 @@
+{{#withXml}}
+{{#jackson}}
+@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
+{{/jackson}}
+@XmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
+@XmlAccessorType(XmlAccessType.FIELD){{/withXml}}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100755
index 0000000..ca48b94
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.servicecomb</groupId>
+  <artifactId>toolkit</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>Microservice development toolkit</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <modules>
+    <module>code-generator</module>
+    <module>toolkit-cli</module>
+  </modules>
+
+</project>
diff --git a/toolkit-cli/dependency-reduced-pom.xml b/toolkit-cli/dependency-reduced-pom.xml
new file mode 100644
index 0000000..33bd7aa
--- /dev/null
+++ b/toolkit-cli/dependency-reduced-pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>toolkit</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>0.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>toolkit-cli</artifactId>
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>2.4.1</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <filters>
+                <filter>
+                  <artifact>*:*</artifact>
+                  <excludes>
+                    <exclude>META-INF/*.SF</exclude>
+                    <exclude>META-INF/*.DSA</exclude>
+                    <exclude>META-INF/*.RSA</exclude>
+                  </excludes>
+                </filter>
+              </filters>
+              <transformers>
+                <transformer>
+                  <mainClass>org.apache.servicecomb.toolkit.cli.ToolkitMain</mainClass>
+                </transformer>
+                <transformer>
+                  <resource>META-INF/spring.handlers</resource>
+                </transformer>
+                <transformer>
+                  <resource>META-INF/spring.schemas</resource>
+                </transformer>
+              </transformers>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
+
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
new file mode 100755
index 0000000..570dde4
--- /dev/null
+++ b/toolkit-cli/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>toolkit</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>0.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>toolkit-cli</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>io.airlift</groupId>
+      <artifactId>airline</artifactId>
+      <version>0.7</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>code-generator</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>2.4.1</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <filters>
+                <filter>
+                  <artifact>*:*</artifact>
+                  <excludes>
+                    <exclude>META-INF/*.SF</exclude>
+                    <exclude>META-INF/*.DSA</exclude>
+                    <exclude>META-INF/*.RSA</exclude>
+                  </excludes>
+                </filter>
+              </filters>
+              <transformers>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                  <mainClass>org.apache.servicecomb.toolkit.cli.ToolkitMain</mainClass>
+                </transformer>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                  <resource>META-INF/spring.handlers</resource>
+                </transformer>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                  <resource>META-INF/spring.schemas</resource>
+                </transformer>
+              </transformers>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+  </build>
+</project>
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
new file mode 100755
index 0000000..c9506ce
--- /dev/null
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.cli;
+
+import static org.apache.commons.lang3.StringUtils.isNotEmpty;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import org.apache.servicecomb.toolkit.codegen.DefaultCodeGenerator;
+
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+import io.swagger.codegen.config.CodegenConfigurator;
+
+@Command(name = "generate", description = "CodeGenerate code with chosen lang")
+public class CodeGenerate implements Runnable {
+
+  @Option(name = {"--programming-model"}, title = "programming model", required = false,
+      description = "programming model, equals to --library")
+  private String programmingModel;
+
+  @Option(name = {"-i", "--input-spec"}, title = "spec file", required = true,
+      description = "location of the swagger spec, as URL or file (required)")
+  private String spec;
+
+  @Option(name = {"-o", "--output"}, title = "output directory",
+      description = "where to write the generated files (current dir by default)")
+  private String output = "";
+
+  @Option(name = {"--group-id"}, title = "group id", description = "groupId in generated pom.xml")
+  private String groupId;
+
+  @Option(name = {"--artifact-id"}, title = "artifact id",
+      description = "artifact version in generated pom.xml")
+  private String artifactId;
+
+  @Option(name = {"--artifact-version"}, title = "artifact version",
+      description = "artifact version in generated pom.xml")
+  private String artifactVersion;
+
+  @Option(name = {"--library"}, title = "library", description = "library template (sub-template)")
+  private String library;
+
+  @Option(name = {"-l", "--lang"}, title = "language",
+      description = "client language to generate (maybe class name in classpath, required)")
+  private String lang = "ServiceCombProvider";
+
+
+  @Override
+  public void run() {
+
+    CodegenConfigurator configurator = new CodegenConfigurator();
+
+    configurator.setOutputDir(output)
+        .setGroupId(groupId)
+        .setArtifactId(artifactId)
+        .setArtifactVersion(artifactVersion)
+        .setLibrary(library)
+        .setLibrary(programmingModel)
+        .setLang(lang);
+
+    if (isNotEmpty(spec)) {
+
+      File contractFile = new File(spec);
+
+      // has many contracts
+      if (contractFile.isDirectory()) {
+
+        try {
+          Files.walkFileTree(Paths.get(contractFile.toURI()), new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+
+              configurator.setInputSpec(file.toFile().getCanonicalPath())
+                  .addAdditionalProperty("apiName", file.toFile().getName().split("\\.")[0]);
+
+              new DefaultCodeGenerator().opts(configurator).generate();
+
+              return super.visitFile(file, attrs);
+            }
+          });
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+      } else {
+        // one contract
+        configurator.setInputSpec(spec);
+        new DefaultCodeGenerator().opts(configurator).generate();
+      }
+    }
+  }
+}
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
new file mode 100755
index 0000000..32795ef
--- /dev/null
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.cli;
+
+import java.io.IOException;
+import java.util.Optional;
+import java.util.Properties;
+
+import io.airlift.airline.Cli;
+import io.airlift.airline.Help;
+
+public class ToolkitMain {
+
+  private static String projectVersion;
+
+  @SuppressWarnings("unchecked")
+  public static void main(String[] args) {
+
+    initialProjectVersion();
+
+    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("java -jar assistant-cli-" + projectVersion + ".jar");
+    builder.withDescription(
+        "ServiceComb code generator CLI (version " + projectVersion + "). More info on servicecomb.apache.org");
+    builder.withDefaultCommand(Help.class);
+    builder.withCommands(CodeGenerate.class, Help.class);
+    Runnable cmd = builder.build().parse(args);
+
+    cmd.run();
+  }
+
+  private static void initialProjectVersion() {
+
+    Properties properties = new Properties();
+    try {
+      properties.load(ToolkitMain.class.getClassLoader().getResourceAsStream("application.properties"));
+
+      projectVersion = Optional.ofNullable(properties.getProperty("version"))
+          .orElse("unknown");
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
+}
diff --git a/toolkit-cli/src/main/resources/application.properties b/toolkit-cli/src/main/resources/application.properties
new file mode 100755
index 0000000..e5683df
--- /dev/null
+++ b/toolkit-cli/src/main/resources/application.properties
@@ -0,0 +1 @@
+version=${project.version}
\ No newline at end of file


[servicecomb-toolkit] 33/49: Add LICENSE

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit c4b93b1c58f6ba2ac27786ffd87273ba3c93a9e5
Author: MabinGo <bi...@huawei.com>
AuthorDate: Fri May 31 16:37:26 2019 +0800

    Add LICENSE
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 LICENSE                                            |   8 +
 code-generator/pom.xml                             |  10 +
 .../toolkit/common/TextCompareTest.java            |  17 +
 .../src/test/resources/compare/HelloEndPoint.yaml  |  36 +-
 .../src/test/resources/compare/HelloEndPoint2.yaml |  37 +-
 doc-generator/pom.xml                              |  10 +
 .../src/main/resources/webroot/swagger-ui.html     |  17 +
 .../src/test/java/docgen/DocGeneratorTest.java     |  33 +-
 .../src/test/resources/HelloEndPoint.yaml          |  19 +-
 pom.xml                                            |  37 +
 toolkit-cli/pom.xml                                |  13 +
 .../resources/contracts/CalculateEndpoint.yaml     |  60 ++
 .../contracts/CalculatorRestEndpoint.yaml          |  43 --
 .../test/resources/contracts/HelloEndPoint.yaml    |  37 +-
 .../contracts/pojo/CodeFirstComputeImpl.yaml       | 113 ---
 .../contracts/pojo/CodeFirstHelloEndPoint.yaml     |  73 ++
 toolkit-distribution/release/LICENSE               | 550 +++++++++++++++
 toolkit-distribution/release/NOTICE                |  73 ++
 .../release/licenses/LICCENSE-mockito              |  21 +
 toolkit-distribution/release/licenses/LICENSE-asm  |  27 +
 .../release/licenses/LICENSE-bouncycastle          |   9 +
 .../release/licenses/LICENSE-cal10n                |  21 +
 toolkit-distribution/release/licenses/LICENSE-cddl | 759 +++++++++++++++++++++
 .../release/licenses/LICENSE-classworlds           |  47 ++
 .../release/licenses/LICENSE-commonmark            |  23 +
 toolkit-distribution/release/licenses/LICENSE-edl  |  12 +
 .../release/licenses/LICENSE-epl-v10               |  86 +++
 .../release/licenses/LICENSE-epl-v20               |  81 +++
 .../release/licenses/LICENSE-hamcrest              |  27 +
 .../release/licenses/LICENSE-jcodings              |  18 +
 toolkit-distribution/release/licenses/LICENSE-joni |  21 +
 toolkit-distribution/release/licenses/LICENSE-jopt |  22 +
 toolkit-distribution/release/licenses/LICENSE-jsch |  30 +
 .../release/licenses/LICENSE-jsoup                 |  21 +
 .../release/licenses/LICENSE-jzlib                 |  29 +
 .../release/licenses/LICENSE-mozilla-v20           | 151 ++++
 .../release/licenses/LICENSE-slf4j                 |  21 +
 .../release/licenses/LICENSE-woodstox-stax2-api    |  13 +
 .../release/licenses/NOTICE-airline                |   2 +
 .../release/licenses/NOTICE-apache-commons-cli     |   5 +
 .../release/licenses/NOTICE-apache-commons-codec   |  17 +
 .../release/licenses/NOTICE-bytebuddy              |  13 +
 .../release/licenses/NOTICE-eclipse-aether         |  45 ++
 toolkit-distribution/release/licenses/NOTICE-maven |   5 +
 .../release/licenses/NOTICE-maven-aether-provider  |   6 +
 toolkit-distribution/release/licenses/NOTICE-netty | 222 ++++++
 .../release/licenses/NOTICE-plexus-cipher          |   7 +
 .../release/licenses/NOTICE-plexus-utils           |   2 +
 .../licenses/NOTICE-servicecomb-java-chassis       |   5 +
 toolkit-maven-plugin/pom.xml                       |  12 +-
 .../java/plugin/GenerateContractsDocMojoTest.java  |  17 +
 .../java/plugin/GenerateContractsMojoTest.java     |  17 +
 52 files changed, 2772 insertions(+), 228 deletions(-)

diff --git a/LICENSE b/LICENSE
old mode 100644
new mode 100755
index 261eeb9..3d03b1b
--- a/LICENSE
+++ b/LICENSE
@@ -199,3 +199,11 @@
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
+
+================================================================
+For code-generator/src/main/resources/ServiceComb/*
+For toolkit-cli/src/test/resources/swagger.yaml
+For code-generator/src/test/resources/swagger.yaml
+================================================================
+This product bundles files from swagger-codegen which is licensed under the Apache License v2.
+For details, see https://github.com/swagger-api/swagger-codegen
diff --git a/code-generator/pom.xml b/code-generator/pom.xml
index 05ebd16..ae53cd5 100755
--- a/code-generator/pom.xml
+++ b/code-generator/pom.xml
@@ -41,6 +41,16 @@
       <groupId>io.swagger</groupId>
       <artifactId>swagger-codegen</artifactId>
       <version>${swagger-codegen-version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.checkerframework</groupId>
+          <artifactId>checker-compat-qual</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.google.guava</groupId>
+          <artifactId>listenablefuture</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
diff --git a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
index c8236ab..e1a0d98 100755
--- a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.servicecomb.toolkit.common;
 
 import static org.junit.Assert.assertEquals;
diff --git a/common/src/test/resources/compare/HelloEndPoint.yaml b/common/src/test/resources/compare/HelloEndPoint.yaml
old mode 100644
new mode 100755
index c67fb51..b0f4a05
--- a/common/src/test/resources/compare/HelloEndPoint.yaml
+++ b/common/src/test/resources/compare/HelloEndPoint.yaml
@@ -1,9 +1,25 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
 
 ---
 swagger: "2.0"
 info:
   version: "1.0.0"
-  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  title: "swagger definition for HelloEndPoint"
   x-java-interface: "gen.swagger.HelloEndPointIntf"
 basePath: "/hello"
 consumes:
@@ -55,21 +71,3 @@ paths:
           description: "response of 200"
           schema:
             type: "string"
-  /sayNo:
-    get:
-      operationId: "sayNo"
-      parameters:
-        - name: "name"
-          in: "query"
-          required: false
-          type: "string"
-        - name: "Authorization"
-          in: "header"
-          description: "aa"
-          required: true
-          type: "string"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            type: "string"
\ No newline at end of file
diff --git a/common/src/test/resources/compare/HelloEndPoint2.yaml b/common/src/test/resources/compare/HelloEndPoint2.yaml
old mode 100644
new mode 100755
index be821f5..b849778
--- a/common/src/test/resources/compare/HelloEndPoint2.yaml
+++ b/common/src/test/resources/compare/HelloEndPoint2.yaml
@@ -1,9 +1,26 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 ---
 aaswagfger: "2.066"
 ccc
 info:
   version: "1.0.02"
-  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  title: "swagger definition for HelloEndPoint"
   x-java-interface: "gen.swagger.HelloEndPointIntf"
 basePath: "/hello"
 consumes:
@@ -55,21 +72,3 @@ paths:
           description: "response of 200"
           schema:
             type: "string"
-  /sayNo:
-    get:
-      operationId: "sayNo"
-      parameters:
-        - name: "name"
-          in: "query"
-          required: false
-          type: "string"
-        - name: "Authorization"
-          in: "header"
-          description: "aa"
-          required: true
-          type: "string"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            type: "string"
\ No newline at end of file
diff --git a/doc-generator/pom.xml b/doc-generator/pom.xml
index 4942890..0b7db64 100755
--- a/doc-generator/pom.xml
+++ b/doc-generator/pom.xml
@@ -68,6 +68,16 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>swagger-generator-core</artifactId>
       <version>1.2.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.checkerframework</groupId>
+          <artifactId>checker-compat-qual</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.google.guava</groupId>
+          <artifactId>listenablefuture</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
diff --git a/doc-generator/src/main/resources/webroot/swagger-ui.html b/doc-generator/src/main/resources/webroot/swagger-ui.html
index 6718b91..19d4060 100755
--- a/doc-generator/src/main/resources/webroot/swagger-ui.html
+++ b/doc-generator/src/main/resources/webroot/swagger-ui.html
@@ -1,3 +1,20 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <!DOCTYPE html>
 <html lang="en">
 <head>
diff --git a/doc-generator/src/test/java/docgen/DocGeneratorTest.java b/doc-generator/src/test/java/docgen/DocGeneratorTest.java
index 2fe24b9..c4dbb64 100755
--- a/doc-generator/src/test/java/docgen/DocGeneratorTest.java
+++ b/doc-generator/src/test/java/docgen/DocGeneratorTest.java
@@ -1,19 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package docgen;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+import io.swagger.models.Swagger;
+import io.swagger.parser.Swagger20Parser;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
 import org.junit.Assert;
 import org.junit.Test;
 
-import io.swagger.models.Swagger;
-import io.swagger.parser.Swagger20Parser;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 public class DocGeneratorTest {
 
diff --git a/doc-generator/src/test/resources/HelloEndPoint.yaml b/doc-generator/src/test/resources/HelloEndPoint.yaml
old mode 100644
new mode 100755
index a42df27..3ceb2f5
--- a/doc-generator/src/test/resources/HelloEndPoint.yaml
+++ b/doc-generator/src/test/resources/HelloEndPoint.yaml
@@ -1,8 +1,25 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 ---
 swagger: "2.0"
 info:
   version: "1.0.0"
-  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  title: "swagger definition for HelloEndPoint"
   x-java-interface: "gen.swagger.HelloEndPointIntf"
 basePath: "/hello"
 consumes:
diff --git a/pom.xml b/pom.xml
index 9943324..e457098 100755
--- a/pom.xml
+++ b/pom.xml
@@ -40,4 +40,41 @@
     <module>toolkit-maven-plugin</module>
   </modules>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>DISCLAIMER</exclude>
+            <exclude>.travis.yml</exclude>
+            <exclude>**/*.md</exclude>
+            <excldue>**/*.MD</excldue>
+            <exclude>**/target/*</exclude>
+            <!-- Skip the code style configuration file -->
+            <exclude>**/etc/eclipse-java-google-style.xml</exclude>
+            <exclude>**/etc/intellij-java-google-style.xml</exclude>
+            <!-- Skip the ssl configuration files -->
+            <exculde>**/resources/ssl/**</exculde>
+            <!-- SKip the licenses files -->
+            <exclude>**/release/licenses/**</exclude>
+            <!-- Skip the demo log files -->
+            <exclude>**/logs/**.log</exclude>
+            <exclude>**/**.log</exclude>
+            <!-- Skip the IDE file -->
+            <exclude>**/**.iml</exclude>
+            <!-- Skip web resource files -->
+            <exclude>**/images/*.png</exclude>
+            <exclude>**/images/*.jpg</exclude>
+            <!-- Skip template files -->
+            <exclude>**/**.mustache</exclude>
+            <!-- Skip test template files -->
+            <exclude>**/swagger.yaml</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 295ad61..dc8ac81 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -37,6 +37,12 @@
     <dependency>
       <groupId>io.airlift</groupId>
       <artifactId>airline</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>com.google.code.findbugs</groupId>
+          <artifactId>annotations</artifactId>
+        </exclusion>
+      </exclusions>
       <version>0.7</version>
     </dependency>
 
@@ -117,5 +123,12 @@
         </executions>
       </plugin>
     </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
   </build>
 </project>
diff --git a/toolkit-cli/src/test/resources/contracts/CalculateEndpoint.yaml b/toolkit-cli/src/test/resources/contracts/CalculateEndpoint.yaml
new file mode 100755
index 0000000..86c3d7a
--- /dev/null
+++ b/toolkit-cli/src/test/resources/contracts/CalculateEndpoint.yaml
@@ -0,0 +1,60 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for CalculateEndpoint"
+  x-java-interface: "gen.swagger.CalculateEndpointIntf"
+basePath: "/"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /bmi:
+    get:
+      operationId: "calculate"
+      parameters:
+      - name: "number1"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      - name: "number2"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            $ref: "#/definitions/CalculateViewObject"
+definitions:
+  CalculateViewObject:
+    type: "object"
+    properties:
+      result:
+        type: "number"
+        format: "double"
+      instanceId:
+        type: "string"
+      callTime:
+        type: "string"
+    x-java-class: "CalculateViewObject"
diff --git a/toolkit-cli/src/test/resources/contracts/CalculatorRestEndpoint.yaml b/toolkit-cli/src/test/resources/contracts/CalculatorRestEndpoint.yaml
deleted file mode 100755
index a7540d4..0000000
--- a/toolkit-cli/src/test/resources/contracts/CalculatorRestEndpoint.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
----
-swagger: "2.0"
-info:
-  version: "1.0.0"
-  title: "swagger definition for org.apache.servicecomb.samples.bmi.CalculatorRestEndpoint"
-  x-java-interface: "gen.swagger.CalculatorRestEndpointIntf"
-basePath: "/"
-consumes:
-- "application/json"
-produces:
-- "application/json"
-paths:
-  /bmi:
-    get:
-      operationId: "calculate"
-      parameters:
-      - name: "height"
-        in: "query"
-        required: false
-        type: "number"
-        format: "double"
-      - name: "weight"
-        in: "query"
-        required: false
-        type: "number"
-        format: "double"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            $ref: "#/definitions/BMIViewObject"
-definitions:
-  BMIViewObject:
-    type: "object"
-    properties:
-      result:
-        type: "number"
-        format: "double"
-      instanceId:
-        type: "string"
-      callTime:
-        type: "string"
-    x-java-class: "org.apache.servicecomb.samples.bmi.BMIViewObject"
diff --git a/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml b/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml
index 14cd7a1..09137ce 100755
--- a/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml
+++ b/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml
@@ -1,8 +1,25 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 ---
 swagger: "2.0"
 info:
   version: "1.0.0"
-  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  title: "swagger definition for HelloEndPoint"
   x-java-interface: "gen.swagger.HelloEndPointIntf"
 basePath: "/hello"
 consumes:
@@ -53,22 +70,4 @@ paths:
         200:
           description: "response of 200"
           schema:
-            type: "string"
-  /sayNo:
-    get:
-      operationId: "sayNo"
-      parameters:
-        - name: "name"
-          in: "query"
-          required: false
-          type: "string"
-        - name: "Authorization"
-          in: "header"
-          description: "aa"
-          required: true
-          type: "string"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
             type: "string"
\ No newline at end of file
diff --git a/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstComputeImpl.yaml b/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstComputeImpl.yaml
deleted file mode 100755
index 190f579..0000000
--- a/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstComputeImpl.yaml
+++ /dev/null
@@ -1,113 +0,0 @@
----
-swagger: "2.0"
-info:
-  version: "1.0.0"
-  title: "swagger definition for org.apache.servicecomb.samples.pojo.provider.CodeFirstComputeImpl"
-  x-java-interface: "gen.swagger.CodeFirstComputeImplIntf"
-basePath: "/CodeFirstComputeImpl"
-consumes:
-- "application/json"
-produces:
-- "application/json"
-paths:
-  /add:
-    post:
-      operationId: "add"
-      parameters:
-      - in: "body"
-        name: "addBody"
-        required: false
-        schema:
-          $ref: "#/definitions/addBody"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            type: "integer"
-            format: "int32"
-  /divide:
-    post:
-      operationId: "divide"
-      parameters:
-      - in: "body"
-        name: "divideBody"
-        required: false
-        schema:
-          $ref: "#/definitions/divideBody"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            type: "integer"
-            format: "int32"
-  /multi:
-    post:
-      operationId: "multi"
-      parameters:
-      - in: "body"
-        name: "multiBody"
-        required: false
-        schema:
-          $ref: "#/definitions/multiBody"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            type: "integer"
-            format: "int32"
-  /sub:
-    post:
-      operationId: "sub"
-      parameters:
-      - in: "body"
-        name: "subBody"
-        required: false
-        schema:
-          $ref: "#/definitions/subBody"
-      responses:
-        200:
-          description: "response of 200"
-          schema:
-            type: "integer"
-            format: "int32"
-definitions:
-  addBody:
-    type: "object"
-    properties:
-      a:
-        type: "integer"
-        format: "int32"
-      b:
-        type: "integer"
-        format: "int32"
-    x-java-class: "gen.swagger.addBody"
-  divideBody:
-    type: "object"
-    properties:
-      a:
-        type: "integer"
-        format: "int32"
-      b:
-        type: "integer"
-        format: "int32"
-    x-java-class: "gen.swagger.divideBody"
-  multiBody:
-    type: "object"
-    properties:
-      a:
-        type: "integer"
-        format: "int32"
-      b:
-        type: "integer"
-        format: "int32"
-    x-java-class: "gen.swagger.multiBody"
-  subBody:
-    type: "object"
-    properties:
-      a:
-        type: "integer"
-        format: "int32"
-      b:
-        type: "integer"
-        format: "int32"
-    x-java-class: "gen.swagger.subBody"
diff --git a/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml b/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml
new file mode 100755
index 0000000..963a4c6
--- /dev/null
+++ b/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml
@@ -0,0 +1,73 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for CodeFirstHelloEndPoint"
+  x-java-interface: "gen.swagger.CodeFirstHelloEndPointIntf"
+basePath: "/codeFirstHello"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /sayHello:
+    post:
+      operationId: "sayHello"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "result"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      - name: "instanceId"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "callTime"
+        in: "query"
+        required: false
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayHi:
+    post:
+      operationId: "sayHi"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "Authorization"
+        in: "header"
+        description: "aa"
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
\ No newline at end of file
diff --git a/toolkit-distribution/release/LICENSE b/toolkit-distribution/release/LICENSE
new file mode 100755
index 0000000..6e2cb2b
--- /dev/null
+++ b/toolkit-distribution/release/LICENSE
@@ -0,0 +1,550 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+=======================================================================
+Apache ServiceComb Toolkit Subcomponents:
+
+The Apache ServiceComb Java Chassis project contains subcomponents with
+separate copyright notices and license terms. Your use of these
+subcomponents is subject to the terms and conditions of the
+following licenses.
+
+================================================================
+This product bundles mockito which is licensed under the
+MIT license.
+For details, see https://site.mockito.org/
+You can find a copy of the License at licenses/LICENSE-mockito
+
+* mockito-core (org.mockito:mockito-core:2.25.0 - https://site.mockito.org/)
+
+================================================================
+This product bundles libraries which are licensed under the
+Eclipse Public License v1.0.
+You can find a copy of the License at licenses/LICENSE-epl-v10
+
+* JUnit (junit:junit:4.12 - http://junit.org)
+* Dirgra (org.jruby:dirgra:0.3 - https://github.com/jruby/dirgra)
+* Eclipse Sisu Plexu (org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.3 - https://github.com/eclipse/sisu.plexus)
+* Eclipse Sisu Inject (org.eclipse.sisu:org.eclipse.sisu.inject:0.3.3 - https://github.com/eclipse/sisu.inject)
+* Aether API (org.eclipse.aether:aether-api:0.9.0.M2 - https://github.com/eclipse/aether-core)
+* Aether SPI (org.eclipse.aether:aether-spi:0.9.0.M2 - https://github.com/eclipse/aether-core)
+* Aether Utilities (org.eclipse.aether:aether-util:0.9.0.M2 - https://github.com/eclipse/aether-core)
+* Aether Implementation (org.eclipse.aether:aether-impl:0.9.0.M2 - https://github.com/eclipse/aether-core)
+
+================================================================
+This product bundles libraries which are licensed under the
+Mozilla Public License, Version 2.0
+You can find a copy of the License at licenses/LICENSE-mozilla-v20
+
+* Mozilla Rhino (org.mozilla:rhino:1.7R4 - https://developer.mozilla.org/en/Rhino)
+
+================================================================
+This product bundles library which is licensed under the
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1.
+You can find a copy of the License at licenses/LICENSE-cddl
+
+* JavaMail API jar (javax.mail:mailapi:1.4.3 - http://java.sun.com/projects/javamail/mailapi)
+* Java Servlet API (javax.servlet:javax.servlet-api:4.0.1 - http://servlet-spec.java.net)
+* JavaBeans(TM) Activation Framework (javax.activation:activation:1.1 - http://java.sun.com/products/javabeans/jaf/index.jsp)
+* JSR 250 Common Annotations For The JavaTM Platform (javax.annotation:jsr250-api:1.0 - https://jcp.org/aboutJava/communityprocess/final/jsr250/index.html)
+
+================================================================
+This product bundles jopt libraries which is licensed under the
+MIT license.
+You can find a copy of the License at licenses/LICENSE-jopt
+
+* JOpt Simple (net.sf.jopt-simple:jopt-simple:5.0.3 - http://pholser.github.io/jopt-simple)
+
+================================================================
+This product bundles slf4j libraries which is licensed under the
+MIT license.
+For details, see http://www.slf4j.org
+You can find a copy of the License at licenses/LICENSE-slf4j
+
+* JCL 1.2 implemented over SLF4J (org.slf4j:jcl-over-slf4j:1.7.25 - http://www.slf4j.org)
+* JUL to SLF4J bridge (org.slf4j:jul-to-slf4j:1.7.25 - http://www.slf4j.org)
+* SLF4J API Module (org.slf4j:slf4j-api:1.7.12 - http://www.slf4j.org)
+* SLF4J Extensions Module (org.slf4j:slf4j-ext:1.7.12 - http://www.slf4j.org)
+* SLF4J Simple Binding (org.slf4j:slf4j-simple:1.7.12 - http://www.slf4j.org)
+
+================================================================
+This product bundles animal-sniffer-annotations which is licensed under the
+MIT license.
+You can find a copy of the License at licenses/LICENSE-animalsniffer
+
+* Animal Sniffer Annotations (org.codehaus.mojo:animal-sniffer-annotations:1.17 - http://mojo.codehaus.org/animal-sniffer/animal-sniffer-annotations)
+
+===========================================================================
+This product bundles of Hamcrest which is licensed under BSD 3-Clause License
+For details, see https://github.com/hamcrest/JavaHamcrest/blob/master/LICENSE.txt
+You can find a copy of the License at licenses/LICENSE-hamcrest
+
+* Hamcrest All (org.hamcrest:hamcrest-all:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-all)
+* Hamcrest Core (org.hamcrest:hamcrest-core:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-core)
+* Hamcrest library (org.hamcrest:hamcrest-library:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-library)
+
+================================================================
+This product bundles libraries which are licensed under the
+Eclipse Public License v2.0.
+You can find a copy of the License at licenses/LICENSE-epl-v20
+
+* jnr-posix (com.github.jnr:jnr-posix:3.0.49 - http://nexus.sonatype.org/oss-repository-hosting.html/jnr-posix)
+* JRuby Complete (org.jruby:jruby-complete:9.2.6.0 - https://github.com/jruby/jruby/tree/master/maven/jruby-complete)
+* JRuby Core (org.jruby:jruby-core:9.2.6.0 - https://github.com/jruby/jruby/jruby-core)
+* JRuby Lib Setup (org.jruby:jruby-stdlib:9.2.6.0 - https://github.com/jruby/jruby/jruby-stdlib)
+* JRuby Main Maven Artifact (org.jruby:jruby:9.2.6.0 - https://github.com/jruby/jruby/jruby-artifacts/jruby)
+* Vert.x Core (io.vertx:vertx-core:3.6.2 - http://nexus.sonatype.org/oss-repository-hosting.html/vertx-parent/vertx-core)
+* vertx-web (io.vertx:vertx-web:3.6.3 - http://nexus.sonatype.org/oss-repository-hosting.html/vertx-parent/vertx-ext/vertx-ext-parent/vertx-web-parent/vertx-web)
+
+================================================================
+This product bundles jopt libraries which is licensed under the
+MIT license.
+You can find a copy of the License at licenses/LICENSE-joni
+
+* Joni (org.jruby.joni:joni:2.1.25 - http://nexus.sonatype.org/oss-repository-hosting.html/joni)
+
+================================================================
+This product bundles jcodings which is licensed under the
+MIT license.
+You can find a copy of the License at licenses/LICENSE-jcodings
+
+* JCodings (org.jruby.jcodings:jcodings:1.0.41 - http://nexus.sonatype.org/oss-repository-hosting.html/jcodings)
+
+================================================================
+This product bundles jsch which is licensed under the
+BSD license.
+You can find a copy of the License at licenses/LICENSE-jsch
+
+* jsch (com.jcraft:jsch:0.1.54 - http://www.jcraft.com/jsch/)
+
+================================================================
+This product bundles jsch which is licensed under the
+BSD license.
+You can find a copy of the License at licenses/LICENSE-jzlib
+
+* JZlib (com.jcraft:jzlib:1.1.1 - http://www.jcraft.com/jzlib/)
+
+================================================================
+This product bundles files from stax2 which is licensed under the
+2-Clause BSD license.
+For details, see http://wiki.fasterxml.com/WoodstoxStax2
+You can find a copy of the License at licenses/LICENSE-woodstox-stax2-api
+
+* Stax2 API (org.codehaus.woodstox:stax2-api:3.1.4 - http://wiki.fasterxml.com/WoodstoxStax2)
+
+================================================================
+This product bundles commonmark which is licensed under the
+2-Clause BSD license.
+For details, see https://github.com/atlassian/commonmark-java
+You can find a copy of the License at licenses/LICENSE-commonmark
+
+* CommonMark Java Core (com.atlassian.commonmark:commonmark:0.9.0 - https://github.com/atlassian/commonmark-java)
+
+================================================================
+This product bundles aopalliance which is licensed under the
+public domain.
+For details, see http://aopalliance.sourceforge.net/
+
+* AOP alliance (aopalliance:aopalliance:1.0 - http://aopalliance.sourceforge.net)
+
+
+================================================================
+This product bundles classworlds which is licensed under the
+public domain.
+For details, see https://github.com/codehaus/classworlds,
+
+* classworlds (classworlds:classworlds:jar:1.1-alpha-2 - https://github.com/codehaus/classworlds)
+
+
+================================================================
+This product bundles asm which is licensed under the
+3-Clause BSD license.
+For details, see http://asm.ow2.org/
+You can find a copy of the License at licenses/LICENSE-asm
+
+* ASM Analysis (org.ow2.asm:asm-analysis:4.1 - http://asm.objectweb.org/asm-analysis/)
+* ASM Core (org.ow2.asm:asm:4.1 - http://asm.objectweb.org/asm/)
+* ASM Tree (org.ow2.asm:asm-tree:4.1 - http://asm.objectweb.org/asm-tree/)
+* ASM Util (org.ow2.asm:asm-util:4.1 - http://asm.objectweb.org/asm-util/)
+
+================================================================
+This product bundles bouncycastle which is licensed under the
+Apache 1.1 license and BouncyCastle license.
+For details, see http://www.apache.org/licenses/LICENSE-1.1 and http://www.bouncycastle.org/licence.html
+You can find a copy of the License at licenses/LICENSE-bouncycastle
+
+* Bouncy Castle OpenPGP API (org.bouncycastle:bcpg-jdk15on:1.60 - http://www.bouncycastle.org/java.html)
+* Bouncy Castle Provider (org.bouncycastle:bcprov-jdk15on:1.60 - http://www.bouncycastle.org/java.html)
+* Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs (org.bouncycastle:bcpkix-jdk15on:1.60 - http://www.bouncycastle.org/java.html)
+
+================================================================
+This product bundles jsoup which is licensed under the
+MIT license.
+You can find a copy of the License at licenses/LICENSE-jsoup
+
+* jsoup (org.jsoup:jsoup:1.8.1 - http://jsoup.org/)
+
+================================================================
+This product bundles jsoup which is licensed under the
+MIT license.
+You can find a copy of the License at licenses/LICENSE-cal10n
+
+* cal10n-api (ch.qos.cal10n:cal10n-api:0.8.1 - https://github.com/qos-ch/cal10n)
+
+================================================================
+This product bundles jgit which is licensed under the
+EDL license.
+You can find a copy of the License at licenses/LICENSE-edl
+
+* jgit (org.eclipse.jgit:org.eclipse.jgit:jar:5.3.0.201903130848-r - https://www.eclipse.org/jgit/)
+
+================================================================
+This product bundles the following libraries which are licensed
+under the Apache License v2.
+For details, see their respective project links.
+
+* swagger-codegen (io.swagger:swagger-codegen:2.4.3 - https://github.com/swagger-api/swagger-codegen/)
+* swagger-parser (io.swagger:swagger-parser:1.0.43 - http://nexus.sonatype.org/oss-repository-hosting.html/swagger-parser-project/modules/swagger-parser)
+* swagger-compat-spec-parser (io.swagger:swagger-compat-spec-parser:1.0.35 - http://nexus.sonatype.org/oss-repository-hosting.html/swagger-parser-project/modules/swagger-compat-spec-parser)
+* swagger-core (io.swagger:swagger-core:1.5.22 - https://github.com/swagger-api/swagger-core/modules/swagger-core)
+* json-schema-validator (com.github.java-json-tools:json-schema-validator:2.2.8 - https://github.com/box-metadata/json-schema-validator)
+* json-schema-core (com.github.java-json-tools:json-schema-core:1.2.8 - https://github.com/java-json-tools/json-schema-core)
+* uri-template (com.github.fge:uri-template:0.9 - https://github.com/fge/uri-template)
+* Joda-Time (joda-time:joda-time:2.9.9 - http://www.joda.org/joda-time/)
+* libphonenumber (com.googlecode.libphonenumber:libphonenumber:8.0.0 - https://github.com/googlei18n/libphonenumber/)
+* FindBugs-jsr305 (com.google.code.findbugs:jsr305:3.0.1 - http://findbugs.sourceforge.net/)
+* json-patch (com.github.fge:json-patch:1.6 - https://github.com/fge/json-patch)
+* jackson-coreutils (com.github.fge:jackson-coreutils:1.6 - https://github.com/fge/jackson-coreutils)
+* msg-simple (com.github.fge:msg-simple:1.1 - https://github.com/fge/msg-simple)
+* btf (com.github.fge:btf:1.2 - https://github.com/fge/btf)
+* Apache HttpClient (org.apache.httpcomponents:httpclient:4.5.2 - http://hc.apache.org/httpcomponents-client)
+* Apache HttpCore (org.apache.httpcomponents:httpcore:4.4.4 - http://hc.apache.org/httpcomponents-core-ga)
+* Apache Commons Logging (commons-logging:commons-logging:1.2 - http://commons.apache.org/proper/commons-logging/)
+* Apache Commons Codec (commons-codec:commons-codec:1.10 - http://commons.apache.org/proper/commons-codec/)
+* Apache Commons BeanUtils (commons-beanutils:commons-beanutils:1.9.3 - https://commons.apache.org/proper/commons-beanutils/)
+* Apache Commons Collections (commons-collections:commons-collections:3.2.2 - http://commons.apache.org/collections/)
+* Apache Commons Collections (org.apache.commons:commons-collections4:4.1 - http://commons.apache.org/proper/commons-collections/)
+* Apache Commons Configuration (commons-configuration:commons-configuration:1.10 - http://commons.apache.org/configuration/)
+* Vavr (io.vavr:vavr:0.9.1 - http://vavr.io)
+* Vavr Match (io.vavr:vavr-match:0.9.1 - http://vavr.io)
+* paleo-core (ch.netzwerg:paleo-core:0.11.0 - no url defined)
+* Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations:2.9.8 - http://github.com/FasterXML/jackson)
+* jackson-databind (com.fasterxml.jackson.core:jackson-databind:2.9.8 - http://github.com/FasterXML/jackson)
+* Jackson-core (com.fasterxml.jackson.core:jackson-core:2.9.8 - https://github.com/FasterXML/jackson-core)
+* Jackson-dataformat-YAML (com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8 - https://github.com/FasterXML/jackson-dataformats-text)
+* SnakeYAML (org.yaml:snakeyaml:1.23 - http://www.snakeyaml.org)
+* swagger-models (io.swagger:swagger-models:1.5.22 - https://github.com/swagger-api/swagger-core/modules/swagger-models)
+* swagger-annotations (io.swagger:swagger-annotations:1.5.22 - https://github.com/swagger-api/swagger-core/modules/swagger-annotations)
+* Guava: Google Core Libraries for Java (com.google.guava:guava:27.0.1-android - https://github.com/google/guava/guava)
+* error-prone annotations (com.google.errorprone:error_prone_annotations:2.2.0 - http://nexus.sonatype.org/oss-repository-hosting.html/error_prone_parent/error_prone_annotations)
+* J2ObjC Annotations (com.google.j2objc:j2objc-annotations:1.1 - https://github.com/google/j2objc/)
+* Bean Validation API (javax.validation:validation-api:1.1.0.Final - http://beanvalidation.org)
+* Apache Commons IO (commons-io:commons-io:2.4 - http://commons.apache.org/proper/commons-io/)
+* Apache Commons Lang (org.apache.commons:commons-lang3:3.4 - http://commons.apache.org/proper/commons-lang/)
+* asciidoctorj (org.asciidoctor:asciidoctorj:1.6.2 - https://github.com/asciidoctor/asciidoctorj)
+* asciidoctorj-api (org.asciidoctor:asciidoctorj-api:1.6.2 - https://github.com/asciidoctor/asciidoctorj)
+* asciidoctorj-pdf (org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15 - https://github.com/asciidoctor/asciidoctorj-pdf)
+* jnr-constants (com.github.jnr:jnr-constants:0.9.12 - http://github.com/jnr/jnr-constants)
+* jnr-enxio (com.github.jnr:jnr-enxio:0.19 - http://github.com/jnr/jnr-enxio)
+* jnr-netdb (com.github.jnr:jnr-netdb:1.1.6 - http://github.com/jnr/jnr-netdb)
+* jnr-unixsocket (com.github.jnr:jnr-unixsocket:0.20 - http://github.com/jnr/jnr-unixsocket)
+* jffi (com.github.jnr:jffi:1.2.18 - http://github.com/jnr/jffi)
+* invokebinder (com.headius:invokebinder:1.11 - http://maven.apache.org)
+* options (com.headius:options:1.4 - https://github.com/headius/options)
+* nailgun-server (com.martiansoftware:nailgun-server:0.9.1 - http://martiansoftware.com/nailgun)
+* modulator (com.headius:modulator:1.0 - http://nexus.sonatype.org/oss-repository-hosting.html/modulator)
+* backport9 (com.headius:backport9:1.1 - http://nexus.sonatype.org/oss-repository-hosting.html/backport9)
+* JCommander (com.beust:jcommander:1.35 - http://beust.com/jcommander)
+* Jackson-dataformat-XML (com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8 - http://wiki.fasterxml.com/JacksonExtensionXmlDataBinding)
+* Jackson module: JAXB-annotations (com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.9.8 - http://github.com/FasterXML/jackson-module-jaxb-annotations)
+* Woodstox (com.fasterxml.woodstox:woodstox-core:5.0.3 - https://github.com/FasterXML/woodstox)
+* Spring Context (org.springframework:spring-context:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Spring AOP (org.springframework:spring-aop:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Spring Beans (org.springframework:spring-beans:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Spring Core (org.springframework:spring-core:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Spring Expression Language (SpEL) (org.springframework:spring-expression:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Spring Web (org.springframework:spring-web:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Spring Web MVC (org.springframework:spring-webmvc:4.3.20.RELEASE - https://github.com/spring-projects/spring-framework)
+* Netty/Resolver/DNS (io.netty:netty-resolver-dns:4.1.30.Final - http://netty.io/netty-resolver-dns/)
+* Netty/Codec/DNS (io.netty:netty-codec-dns:4.1.30.Final - http://netty.io/netty-codec-dns/)
+* Netty/TomcatNative [BoringSSL - Static] (io.netty:netty-tcnative-boringssl-static:2.0.14.Final - https://github.com/netty/netty-tcnative/netty-tcnative-boringssl-static/)
+* Netty/Codec (io.netty:netty-codec:4.1.28.Final - http://netty.io/netty-codec/)
+* Netty/Codec/HTTP (io.netty:netty-codec-http:4.1.28.Final - http://netty.io/netty-codec-http/)
+* Netty/Codec/HTTP2 (io.netty:netty-codec-http2:4.1.28.Final - http://netty.io/netty-codec-http2/)
+* Netty/Common (io.netty:netty-common:4.1.28.Final - http://netty.io/netty-common/)
+* Netty/Handler (io.netty:netty-handler:4.1.28.Final - http://netty.io/netty-handler/)
+* Netty/Buffer (io.netty:netty-buffer:4.1.28.Final - http://netty.io/netty-buffer/)
+* Netty/Codec/Socks (io.netty:netty-codec-socks:4.1.28.Final - http://netty.io/netty-codec-socks/)
+* Netty/Handler/Proxy (io.netty:netty-handler-proxy:4.1.28.Final - http://netty.io/netty-handler-proxy/)
+* Netty/Resolver (io.netty:netty-resolver:4.1.28.Final - http://netty.io/netty-resolver/)
+* Netty/Transport (io.netty:netty-transport:4.1.28.Final - http://netty.io/netty-transport/)
+* vertx-web-common (io.vertx:vertx-web-common:3.6.2 - http://nexus.sonatype.org/oss-repository-hosting.html/vertx-parent/vertx-ext/vertx-ext-parent/vertx-web-parent/vertx-web-common)
+* Vert.x Bridge Common (io.vertx:vertx-bridge-common:3.6.2 - http://nexus.sonatype.org/oss-repository-hosting.html/vertx-parent/vertx-ext/vertx-ext-parent/vertx-bridge-common)
+* vertx-auth-common (io.vertx:vertx-auth-common:3.6.2 - http://nexus.sonatype.org/oss-repository-hosting.html/vertx-parent/vertx-ext/vertx-ext-parent/vertx-auth/vertx-auth-common)
+* Brave (io.zipkin.brave:brave:5.6.0 - https://github.com/openzipkin/brave/brave)
+* Zipkin v2 (io.zipkin.zipkin2:zipkin:2.11.10 - https://github.com/openzipkin/zipkin/zipkin)
+* Zipkin Reporter: Core (io.zipkin.reporter2:zipkin-reporter:2.7.13 - https://github.com/openzipkin/zipkin-reporter-java/zipkin-reporter)
+* Objenesis (org.objenesis:objenesis:2.6 - http://objenesis.org)
+* archaius-core (com.netflix.archaius:archaius-core:0.7.3 - https://github.com/Netflix/archaius)
+* Apache Log4j (log4j:log4j:1.2.17 - http://logging.apache.org/log4j/1.2/)
+* javax.ws.rs-api (javax.ws.rs:javax.ws.rs-api:2.0.1 - http://jax-rs-spec.java.net)
+* Javassist (org.javassist:javassist:3.18.1-GA - http://www.javassist.org/)
+* Apache Commons IO (commons-io:commons-io:2.4 - http://commons.apache.org/proper/commons-io/)
+* Google Guice - Core Library (com.google.inject:guice:4.1.0 - https://github.com/google/guice/guice)
+* javax.inject (javax.inject:javax.inject:1 - http://code.google.com/p/atinject/)
+* markup-document-builder (io.github.swagger2markup:markup-document-builder:1.1.2 - https://github.com/Swagger2Markup/markup-document-builder)
+* markdown_to_asciidoc (nl.jworks.markdown_to_asciidoc:markdown_to_asciidoc:1.0 - no url defined)
+* pegdown (org.pegdown:pegdown:1.4.2 - http://pegdown.org)
+* parboiled-core (org.parboiled:parboiled-core:1.1.6 - http://parboiled.org)
+* parboiled-java (org.parboiled:parboiled-java:1.1.6 - http://parboiled.org)
+* swagger2markup (org.mockito:swagger2markup:1.3.2 - https://github.com/Swagger2Markup/swagger2markup)
+* maven-plugin-api (org.apache.maven:maven-plugin-api:3.6.0 - https://github.com/apache/maven/tree/master/maven-plugin-api)
+* maven-plugin-annotations (org.apache.maven.plugin-tools:maven-plugin-annotations:3.6.0 - https://github.com/apache/maven-plugin-tools/tree/master/maven-plugin-annotations)
+* maven-core (org.apache.maven:maven-core:3.6.0 - https://github.com/apache/maven/tree/master/maven-core)
+* plexus-archiver (org.codehaus.plexus:plexus-archiver:2.1 - https://github.com/sonatype/plexus-archiver)
+* maven-plugin-testing-harness (org.apache.maven.plugin-testing:maven-plugin-testing-harness:3.3.0 - https://github.com/apache/maven-plugin-testing/tree/master/maven-plugin-testing-harness)
+* maven-aether-provider (org.apache.maven:maven-aether-provider:3.2.2 - https://github.com/Tibor17/maven/tree/master/maven-aether-provider)
+* maven-compat (org.apache.maven:maven-compat:3.2.2 - https://github.com/apache/maven/tree/master/maven-compat)
+* provider-rest-common (org.apache.servicecomb:provider-rest-common:1.2.0 - https://github.com/apache/servicecomb-java-chassis/tree/master/providers/provider-rest-common)
+* provider-pojo (org.apache.servicecomb:provider-pojo:1.2.0 - https://github.com/apache/servicecomb-java-chassis/tree/master/providers/provider-pojo)
+* swagger-generator-springmvc (org.apache.servicecomb:swagger-generator-springmvc:1.2.0 - https://github.com/apache/servicecomb-java-chassis/tree/master/swagger/swagger-generator/generator-springmvc)
+* swagger-generator-jaxrs (org.apache.servicecomb:swagger-generator-jaxrs:1.2.0 - https://github.com/apache/servicecomb-java-chassis/tree/master/swagger/swagger-generator/generator-jaxrs)
+* swagger-generator-core (org.apache.servicecomb:swagger-generator-core:1.2.0 - https://github.com/apache/servicecomb-java-chassis/tree/master/swagger/swagger-generator/generator-core)
+* Foundation Common (org.apache.servicecomb:foundation-common:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* common-javassist (org.apache.servicecomb:common-javassist:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* java-chassis-core (org.apache.servicecomb:java-chassis-core:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* service-registry (org.apache.servicecomb:service-registry:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* deployment (org.apache.servicecomb:deployment:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* foundation-vertx (org.apache.servicecomb:foundation-vertx:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* foundation-ssl (org.apache.servicecomb:foundation-ssl:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* foundation-config (org.apache.servicecomb:foundation-config:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* swagger-invocation-core (org.apache.servicecomb:swagger-invocation-core:1.2.0 - https://github.com/apache/servicecomb-java-chassis)
+* Guava InternalFutureFailureAccess and InternalFutures (com.google.guava:failureaccess:1.0.1 - https://github.com/google/guava/tree/master/futures/failureaccess)
+* Guava ListenableFuture Only (com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava - https://github.com/google/guava)
+* jmustache (com.samskivert:jmustache:1.12:compile - https://github.com/samskivert/jmustache)
+* commons-cli (commons-cli:commons-cli:1.2 - http://commons.apache.org/cli/)
+* JavaEWAH (com.googlecode.javaewah:JavaEWAH:1.1.6 - https://github.com/lemire/javaewah)
+* Airline (io.airlift:airline:0.7 - https://github.com/airlift/airline)
+* Guava: Google Core Libraries For Java (com.google.guava:guava:18.0 - https://github.com/google/guava)
+* Byte Buddy (without Dependencies) (net.bytebuddy:byte-buddy:1.9.7 - https://bytebuddy.net/)
+* Byte Buddy Java Agent (net.bytebuddy:byte-buddy-agent:1.9.7 - https://bytebuddy.net/)
+* Maven Model (org.apache.maven:maven-model:3.6.0 - https://github.com/apache/maven)
+* Maven Artifact (org.apache.maven:maven-artifact:3.6.0 - https://github.com/apache/maven)
+* CDI APIs (javax.enterprise:cdi-api:1.0 - http://weld.cdi-spec.org/)
+* Plexus Common Utilities (org.codehaus.plexus:plexus-utils:3.1.0 - https://codehaus-plexus.github.io/plexus-utils/)
+* Plexus Classworlds (org.codehaus.plexus:plexus-classworlds - https://codehaus-plexus.github.io/plexus-classworlds/)
+* Maven Settings (org.apache.maven:maven-settings:3.6.0 - https://github.com/apache/maven)
+* maven-settings-builder (org.apache.maven:maven-settings-builder:3.6.0 - https://github.com/apache/maven)
+* Plexus Security Dispatcher Component (org.sonatype.plexus:plexus-sec-dispatcher:1.4 - http://spice.sonatype.org/plexus-sec-dispatcher)
+* Plexus Cipher: Encryption/decryption Component (org.sonatype.plexus:plexus-cipher:1.4 - http://spice.sonatype.org/plexus-cipher)
+* Maven Builder Support (org.apache.maven:maven-builder-support:3.6.0 - https://github.com/apache/maven)
+* Maven Repository Metadata Model (org.apache.maven:maven-repository-metadata:3.6.0 - https://github.com/apache/maven)
+* Maven Model Builder (org.apache.maven:maven-model-builder:3.6.0 - https://github.com/apache/maven)
+* Maven Artifact Resolver Provider (org.apache.maven:maven-resolver-provider:3.6.0 - https://github.com/apache/maven)
+* Maven Artifact Resolver Implementation (org.apache.maven.resolver:maven-resolver-impl:1.3.1 - https://github.com/apache/maven-resolver)
+* Maven Artifact Resolver API (org.apache.maven.resolver:maven-resolver-api:1.3.1 - https://github.com/apache/maven-resolver)
+* Maven Artifact Resolver SPI (org.apache.maven.resolver:maven-resolver-spi:1.3.1 - https://github.com/apache/maven-resolver)
+* Maven Artifact Resolver Utilities (org.apache.maven.resolver:maven-resolver-util:1.3.1 - https://github.com/apache/maven-resolver)
+* Apache Maven Shared Utils (org.apache.maven.shared:maven-shared-utils:3.2.1 - https://github.com/apache/maven-shared)
+* Plexus :: Component Annotations (org.codehaus.plexus:plexus-component-annotations:1.7.1 - https://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/)
+* Plexus :: Default Container (org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1 - https://codehaus-plexus.github.io/plexus-containers/plexus-container-default/)
+* Plexus IO Components (org.codehaus.plexus:plexus-io:2.0.2 - https://codehaus-plexus.github.io/plexus-io/)
diff --git a/toolkit-distribution/release/NOTICE b/toolkit-distribution/release/NOTICE
new file mode 100755
index 0000000..8f2d451
--- /dev/null
+++ b/toolkit-distribution/release/NOTICE
@@ -0,0 +1,73 @@
+Apache ServiceComb Toolkit
+Copyright 2017-2019 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+================================================================
+Notice for Apache Commons Codec
+
+See licenses/NOTICE-apache-commons-codec
+
+================================================================
+Notice for Apache Commons Lang(Version 3)
+
+Apache Commons Lang
+Copyright 2001-2014 The Apache Software Foundation
+
+This product includes software from the Spring Framework,
+under the Apache License 2.0 (see: StringUtils.containsWhitespace())
+
+================================================================
+Notice for Netty
+
+See licenses/NOTICE-netty
+
+================================================================
+Notice for Eclipse aether
+
+See licenses/NOTICE-eclipse-aether
+
+================================================================
+Notice for Apache maven
+
+See licenses/NOTICE-maven
+
+================================================================
+Notice for plexus-cipher
+
+See licenses/NOTICE-plexus-cipher
+
+================================================================
+Notice for plexus-utils
+
+See licenses/NOTICE-plexus-utils
+
+================================================================
+Notice for Byte Buddy
+
+See licenses/NOTICE-bytebuddy
+
+================================================================
+Notice for Airline
+
+See licenses/NOTICE-airline
+
+================================================================
+Notice for Apache Commons CLI
+
+See licenses/NOTICE-apache-commons-cli
+
+================================================================
+Notice for Apache ServiceComb Java Chassis
+
+See licenses/NOTICE-servicecomb-java-chassis
+
+================================================================
+Notice for maven-aether-provider
+
+See licenses/NOTICE-maven-aether-provider
+
+
+
+
diff --git a/toolkit-distribution/release/licenses/LICCENSE-mockito b/toolkit-distribution/release/licenses/LICCENSE-mockito
new file mode 100755
index 0000000..e0840a4
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICCENSE-mockito
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2007 Mockito contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-asm b/toolkit-distribution/release/licenses/LICENSE-asm
new file mode 100755
index 0000000..8806c7d
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-asm
@@ -0,0 +1,27 @@
+ ASM: a very small and fast Java bytecode manipulation framework
+ Copyright (c) 2000-2011 INRIA, France Telecom
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/toolkit-distribution/release/licenses/LICENSE-bouncycastle b/toolkit-distribution/release/licenses/LICENSE-bouncycastle
new file mode 100755
index 0000000..388ba79
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-bouncycastle
@@ -0,0 +1,9 @@
+LICENSE
+
+Copyright (c) 2000 - 2019 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-cal10n b/toolkit-distribution/release/licenses/LICENSE-cal10n
new file mode 100755
index 0000000..06b6e27
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-cal10n
@@ -0,0 +1,21 @@
+Copyright (c) 2009 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free  of charge, to any person obtaining
+a  copy  of this  software  and  associated  documentation files  (the
+"Software"), to  deal in  the Software without  restriction, including
+without limitation  the rights to  use, copy, modify,  merge, publish,
+distribute,  sublicense, and/or sell  copies of  the Software,  and to
+permit persons to whom the Software  is furnished to do so, subject to
+the following conditions:
+
+The  above  copyright  notice  and  this permission  notice  shall  be
+included in all copies or substantial portions of the Software.
+
+THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-cddl b/toolkit-distribution/release/licenses/LICENSE-cddl
new file mode 100755
index 0000000..b1c74f9
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-cddl
@@ -0,0 +1,759 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+    1.1. "Contributor" means each individual or entity that creates or
+    contributes to the creation of Modifications.
+
+    1.2. "Contributor Version" means the combination of the Original
+    Software, prior Modifications used by a Contributor (if any), and
+    the Modifications made by that particular Contributor.
+
+    1.3. "Covered Software" means (a) the Original Software, or (b)
+    Modifications, or (c) the combination of files containing Original
+    Software with files containing Modifications, in each case including
+    portions thereof.
+
+    1.4. "Executable" means the Covered Software in any form other than
+    Source Code.
+
+    1.5. "Initial Developer" means the individual or entity that first
+    makes Original Software available under this License.
+
+    1.6. "Larger Work" means a work which combines Covered Software or
+    portions thereof with code not governed by the terms of this License.
+
+    1.7. "License" means this document.
+
+    1.8. "Licensable" means having the right to grant, to the maximum
+    extent possible, whether at the time of the initial grant or
+    subsequently acquired, any and all of the rights conveyed herein.
+
+    1.9. "Modifications" means the Source Code and Executable form of
+    any of the following:
+
+    A. Any file that results from an addition to, deletion from or
+    modification of the contents of a file containing Original Software
+    or previous Modifications;
+
+    B. Any new file that contains any part of the Original Software or
+    previous Modification; or
+
+    C. Any new file that is contributed or otherwise made available
+    under the terms of this License.
+
+    1.10. "Original Software" means the Source Code and Executable form
+    of computer software code that is originally released under this
+    License.
+
+    1.11. "Patent Claims" means any patent claim(s), now owned or
+    hereafter acquired, including without limitation, method, process,
+    and apparatus claims, in any patent Licensable by grantor.
+
+    1.12. "Source Code" means (a) the common form of computer software
+    code in which modifications are made and (b) associated
+    documentation included in or with such code.
+
+    1.13. "You" (or "Your") means an individual or a legal entity
+    exercising rights under, and complying with all of the terms of,
+    this License. For legal entities, "You" includes any entity which
+    controls, is controlled by, or is under common control with You. For
+    purposes of this definition, "control" means (a) the power, direct
+    or indirect, to cause the direction or management of such entity,
+    whether by contract or otherwise, or (b) ownership of more than
+    fifty percent (50%) of the outstanding shares or beneficial
+    ownership of such entity.
+
+2. License Grants.
+
+    2.1. The Initial Developer Grant.
+
+    Conditioned upon Your compliance with Section 3.1 below and subject
+    to third party intellectual property claims, the Initial Developer
+    hereby grants You a world-wide, royalty-free, non-exclusive license:
+
+    (a) under intellectual property rights (other than patent or
+    trademark) Licensable by Initial Developer, to use, reproduce,
+    modify, display, perform, sublicense and distribute the Original
+    Software (or portions thereof), with or without Modifications,
+    and/or as part of a Larger Work; and
+
+    (b) under Patent Claims infringed by the making, using or selling of
+    Original Software, to make, have made, use, practice, sell, and
+    offer for sale, and/or otherwise dispose of the Original Software
+    (or portions thereof).
+
+    (c) The licenses granted in Sections 2.1(a) and (b) are effective on
+    the date Initial Developer first distributes or otherwise makes the
+    Original Software available to a third party under the terms of this
+    License.
+
+    (d) Notwithstanding Section 2.1(b) above, no patent license is
+    granted: (1) for code that You delete from the Original Software, or
+    (2) for infringements caused by: (i) the modification of the
+    Original Software, or (ii) the combination of the Original Software
+    with other software or devices.
+
+    2.2. Contributor Grant.
+
+    Conditioned upon Your compliance with Section 3.1 below and subject
+    to third party intellectual property claims, each Contributor hereby
+    grants You a world-wide, royalty-free, non-exclusive license:
+
+    (a) under intellectual property rights (other than patent or
+    trademark) Licensable by Contributor to use, reproduce, modify,
+    display, perform, sublicense and distribute the Modifications
+    created by such Contributor (or portions thereof), either on an
+    unmodified basis, with other Modifications, as Covered Software
+    and/or as part of a Larger Work; and
+
+    (b) under Patent Claims infringed by the making, using, or selling
+    of Modifications made by that Contributor either alone and/or in
+    combination with its Contributor Version (or portions of such
+    combination), to make, use, sell, offer for sale, have made, and/or
+    otherwise dispose of: (1) Modifications made by that Contributor (or
+    portions thereof); and (2) the combination of Modifications made by
+    that Contributor with its Contributor Version (or portions of such
+    combination).
+
+    (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective
+    on the date Contributor first distributes or otherwise makes the
+    Modifications available to a third party.
+
+    (d) Notwithstanding Section 2.2(b) above, no patent license is
+    granted: (1) for any code that Contributor has deleted from the
+    Contributor Version; (2) for infringements caused by: (i) third
+    party modifications of Contributor Version, or (ii) the combination
+    of Modifications made by that Contributor with other software
+    (except as part of the Contributor Version) or other devices; or (3)
+    under Patent Claims infringed by Covered Software in the absence of
+    Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+    3.1. Availability of Source Code.
+
+    Any Covered Software that You distribute or otherwise make available
+    in Executable form must also be made available in Source Code form
+    and that Source Code form must be distributed only under the terms
+    of this License. You must include a copy of this License with every
+    copy of the Source Code form of the Covered Software You distribute
+    or otherwise make available. You must inform recipients of any such
+    Covered Software in Executable form as to how they can obtain such
+    Covered Software in Source Code form in a reasonable manner on or
+    through a medium customarily used for software exchange.
+
+    3.2. Modifications.
+
+    The Modifications that You create or to which You contribute are
+    governed by the terms of this License. You represent that You
+    believe Your Modifications are Your original creation(s) and/or You
+    have sufficient rights to grant the rights conveyed by this License.
+
+    3.3. Required Notices.
+
+    You must include a notice in each of Your Modifications that
+    identifies You as the Contributor of the Modification. You may not
+    remove or alter any copyright, patent or trademark notices contained
+    within the Covered Software, or any notices of licensing or any
+    descriptive text giving attribution to any Contributor or the
+    Initial Developer.
+
+    3.4. Application of Additional Terms.
+
+    You may not offer or impose any terms on any Covered Software in
+    Source Code form that alters or restricts the applicable version of
+    this License or the recipients' rights hereunder. You may choose to
+    offer, and to charge a fee for, warranty, support, indemnity or
+    liability obligations to one or more recipients of Covered Software.
+    However, you may do so only on Your own behalf, and not on behalf of
+    the Initial Developer or any Contributor. You must make it
+    absolutely clear that any such warranty, support, indemnity or
+    liability obligation is offered by You alone, and You hereby agree
+    to indemnify the Initial Developer and every Contributor for any
+    liability incurred by the Initial Developer or such Contributor as a
+    result of warranty, support, indemnity or liability terms You offer.
+
+    3.5. Distribution of Executable Versions.
+
+    You may distribute the Executable form of the Covered Software under
+    the terms of this License or under the terms of a license of Your
+    choice, which may contain terms different from this License,
+    provided that You are in compliance with the terms of this License
+    and that the license for the Executable form does not attempt to
+    limit or alter the recipient's rights in the Source Code form from
+    the rights set forth in this License. If You distribute the Covered
+    Software in Executable form under a different license, You must make
+    it absolutely clear that any terms which differ from this License
+    are offered by You alone, not by the Initial Developer or
+    Contributor. You hereby agree to indemnify the Initial Developer and
+    every Contributor for any liability incurred by the Initial
+    Developer or such Contributor as a result of any such terms You offer.
+
+    3.6. Larger Works.
+
+    You may create a Larger Work by combining Covered Software with
+    other code not governed by the terms of this License and distribute
+    the Larger Work as a single product. In such a case, You must make
+    sure the requirements of this License are fulfilled for the Covered
+    Software.
+
+4. Versions of the License.
+
+    4.1. New Versions.
+
+    Oracle is the initial license steward and may publish revised and/or
+    new versions of this License from time to time. Each version will be
+    given a distinguishing version number. Except as provided in Section
+    4.3, no one other than the license steward has the right to modify
+    this License.
+
+    4.2. Effect of New Versions.
+
+    You may always continue to use, distribute or otherwise make the
+    Covered Software available under the terms of the version of the
+    License under which You originally received the Covered Software. If
+    the Initial Developer includes a notice in the Original Software
+    prohibiting it from being distributed or otherwise made available
+    under any subsequent version of the License, You must distribute and
+    make the Covered Software available under the terms of the version
+    of the License under which You originally received the Covered
+    Software. Otherwise, You may also choose to use, distribute or
+    otherwise make the Covered Software available under the terms of any
+    subsequent version of the License published by the license steward.
+
+    4.3. Modified Versions.
+
+    When You are an Initial Developer and You want to create a new
+    license for Your Original Software, You may create and use a
+    modified version of this License if You: (a) rename the license and
+    remove any references to the name of the license steward (except to
+    note that the license differs from this License); and (b) otherwise
+    make it clear that the license contains terms which differ from this
+    License.
+
+5. DISCLAIMER OF WARRANTY.
+
+    COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+    WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+    INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE
+    IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
+    NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
+    THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE
+    DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+    OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
+    REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+    ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS
+    AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+6. TERMINATION.
+
+    6.1. This License and the rights granted hereunder will terminate
+    automatically if You fail to comply with terms herein and fail to
+    cure such breach within 30 days of becoming aware of the breach.
+    Provisions which, by their nature, must remain in effect beyond the
+    termination of this License shall survive.
+
+    6.2. If You assert a patent infringement claim (excluding
+    declaratory judgment actions) against Initial Developer or a
+    Contributor (the Initial Developer or Contributor against whom You
+    assert such claim is referred to as "Participant") alleging that the
+    Participant Software (meaning the Contributor Version where the
+    Participant is a Contributor or the Original Software where the
+    Participant is the Initial Developer) directly or indirectly
+    infringes any patent, then any and all rights granted directly or
+    indirectly to You by such Participant, the Initial Developer (if the
+    Initial Developer is not the Participant) and all Contributors under
+    Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+    from Participant terminate prospectively and automatically at the
+    expiration of such 60 day notice period, unless if within such 60
+    day period You withdraw Your claim with respect to the Participant
+    Software against such Participant either unilaterally or pursuant to
+    a written agreement with Participant.
+
+    6.3. If You assert a patent infringement claim against Participant
+    alleging that the Participant Software directly or indirectly
+    infringes any patent where such claim is resolved (such as by
+    license or settlement) prior to the initiation of patent
+    infringement litigation, then the reasonable value of the licenses
+    granted by such Participant under Sections 2.1 or 2.2 shall be taken
+    into account in determining the amount or value of any payment or
+    license.
+
+    6.4. In the event of termination under Sections 6.1 or 6.2 above,
+    all end user licenses that have been validly granted by You or any
+    distributor hereunder prior to termination (excluding licenses
+    granted to You by any distributor) shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+    UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+    (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+    INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+    COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE
+    TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+    CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+    LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+    FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR
+    LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE
+    POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT
+    APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
+    PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
+    LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
+    LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION
+    AND LIMITATION MAY NOT APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+    The Covered Software is a "commercial item," as that term is defined
+    in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+    software" (as that term is defined at 48 C.F.R. §
+    252.227-7014(a)(1)) and "commercial computer software documentation"
+    as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent
+    with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
+    (June 1995), all U.S. Government End Users acquire Covered Software
+    with only those rights set forth herein. This U.S. Government Rights
+    clause is in lieu of, and supersedes, any other FAR, DFAR, or other
+    clause or provision that addresses Government rights in computer
+    software under this License.
+
+9. MISCELLANEOUS.
+
+    This License represents the complete agreement concerning subject
+    matter hereof. If any provision of this License is held to be
+    unenforceable, such provision shall be reformed only to the extent
+    necessary to make it enforceable. This License shall be governed by
+    the law of the jurisdiction specified in a notice contained within
+    the Original Software (except to the extent applicable law, if any,
+    provides otherwise), excluding such jurisdiction's conflict-of-law
+    provisions. Any litigation relating to this License shall be subject
+    to the jurisdiction of the courts located in the jurisdiction and
+    venue specified in a notice contained within the Original Software,
+    with the losing party responsible for costs, including, without
+    limitation, court costs and reasonable attorneys' fees and expenses.
+    The application of the United Nations Convention on Contracts for
+    the International Sale of Goods is expressly excluded. Any law or
+    regulation which provides that the language of a contract shall be
+    construed against the drafter shall not apply to this License. You
+    agree that You alone are responsible for compliance with the United
+    States export administration regulations (and the export control
+    laws and regulation of any other countries) when You use, distribute
+    or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+    As between Initial Developer and the Contributors, each party is
+    responsible for claims and damages arising, directly or indirectly,
+    out of its utilization of rights under this License and You agree to
+    work with Initial Developer and Contributors to distribute such
+    responsibility on an equitable basis. Nothing herein is intended or
+    shall be deemed to constitute any admission of liability.
+
+------------------------------------------------------------------------
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION
+LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws of the
+State of California (excluding conflict-of-law provisions). Any
+litigation relating to this License shall be subject to the jurisdiction
+of the Federal Courts of the Northern District of California and the
+state courts of the State of California, with venue lying in Santa Clara
+County, California.
+
+
+
+  The GNU General Public License (GPL) Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor
+Boston, MA 02110-1335
+USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to
+share and change it. By contrast, the GNU General Public License is
+intended to guarantee your freedom to share and change free software--to
+make sure the software is free for all its users. This General Public
+License applies to most of the Free Software Foundation's software and
+to any other program whose authors commit to using it. (Some other Free
+Software Foundation software is covered by the GNU Library General
+Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.
+Our General Public Licenses are designed to make sure that you have the
+freedom to distribute copies of free software (and charge for this
+service if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone
+to deny you these rights or to ask you to surrender the rights. These
+restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis
+or for a fee, you must give the recipients all the rights that you have.
+You must make sure that they, too, receive or can get the source code.
+And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.
+We wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program
+proprietary. To prevent this, we have made it clear that any patent must
+be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a
+notice placed by the copyright holder saying it may be distributed under
+the terms of this General Public License. The "Program", below, refers
+to any such program or work, and a "work based on the Program" means
+either the Program or any derivative work under copyright law: that is
+to say, a work containing the Program or a portion of it, either
+verbatim or with modifications and/or translated into another language.
+(Hereinafter, translation is included without limitation in the term
+"modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+the Program is not restricted, and the output from the Program is
+covered only if its contents constitute a work based on the Program
+(independent of having been made by running the Program). Whether that
+is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously
+and appropriately publish on each copy an appropriate copyright notice
+and disclaimer of warranty; keep intact all the notices that refer to
+this License and to the absence of any warranty; and give any other
+recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of
+it, thus forming a work based on the Program, and copy and distribute
+such modifications or work under the terms of Section 1 above, provided
+that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any part
+    thereof, to be licensed as a whole at no charge to all third parties
+    under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a notice
+    that there is no warranty (or else, saying that you provide a
+    warranty) and that users may redistribute the program under these
+    conditions, and telling the user how to view a copy of this License.
+    (Exception: if the Program itself is interactive but does not
+    normally print such an announcement, your work based on the Program
+    is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program, and
+can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based on
+the Program, the distribution of the whole must be on the terms of this
+License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of a
+storage or distribution medium does not bring the other work under the
+scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections 1
+    and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your cost
+    of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer to
+    distribute corresponding source code. (This alternative is allowed
+    only for noncommercial distribution and only if you received the
+    program in object code or executable form with such an offer, in
+    accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source code
+means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to control
+compilation and installation of the executable. However, as a special
+exception, the source code distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies the
+executable.
+
+If distribution of executable or object code is made by offering access
+to copy from a designated place, then offering equivalent access to copy
+the source code from the same place counts as distribution of the source
+code, even though third parties are not compelled to copy the source
+along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt otherwise
+to copy, modify, sublicense or distribute the Program is void, and will
+automatically terminate your rights under this License. However, parties
+who have received copies, or rights, from you under this License will
+not have their licenses terminated so long as such parties remain in
+full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and all
+its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further restrictions
+on the recipients' exercise of the rights granted herein. You are not
+responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot distribute
+so as to satisfy simultaneously your obligations under this License and
+any other pertinent obligations, then as a consequence you may not
+distribute the Program at all. For example, if a patent license would
+not permit royalty-free redistribution of the Program by all those who
+receive copies directly or indirectly through you, then the only way you
+could satisfy both it and this License would be to refrain entirely from
+distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is implemented
+by public license practices. Many people have made generous
+contributions to the wide range of software distributed through that
+system in reliance on consistent application of that system; it is up to
+the author/donor to decide if he or she is willing to distribute
+software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be
+a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License may
+add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among countries
+not thus excluded. In such case, this License incorporates the
+limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new
+versions of the General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Program does not specify a version
+number of this License, you may choose any version ever published by the
+Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the
+author to ask for permission. For software which is copyrighted by the
+Free Software Foundation, write to the Free Software Foundation; we
+sometimes make exceptions for this. Our decision will be guided by the
+two goals of preserving the free status of all derivatives of our free
+software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
+YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
+DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
+DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
+THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
+OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    One line to give the program's name and a brief idea of what it does.
+    Copyright (C) <year> <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type
+    `show w'. This is free software, and you are welcome to redistribute
+    it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the commands
+you use may be called something other than `show w' and `show c'; they
+could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the
+    program `Gnomovision' (which makes passes at compilers) written by
+    James Hacker.
+
+    signature of Ty Coon, 1 April 1989
+    Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications
+with the library. If this is what you want to do, use the GNU Library
+General Public License instead of this License.
+
+#
+
+Certain source files distributed by Oracle America, Inc. and/or its
+affiliates are subject to the following clarification and special
+exception to the GPLv2, based on the GNU Project exception for its
+Classpath libraries, known as the GNU Classpath Exception, but only
+where Oracle has expressly included in the particular source file's
+header the words "Oracle designates this particular file as subject to
+the "Classpath" exception as provided by Oracle in the LICENSE file
+that accompanied this code."
+
+You should also note that Oracle includes multiple, independent
+programs in this software package. Some of those programs are provided
+under licenses deemed incompatible with the GPLv2 by the Free Software
+Foundation and others.  For example, the package includes programs
+licensed under the Apache License, Version 2.0.  Such programs are
+licensed to you under their original licenses.
+
+Oracle facilitates your further distribution of this package by adding
+the Classpath Exception to the necessary parts of its GPLv2 code, which
+permits you to use that code in combination with other independent
+modules not licensed under the GPLv2.  However, note that this would
+not permit you to commingle code under an incompatible license with
+Oracle's GPLv2 licensed code by, for example, cutting and pasting such
+code into a file also containing Oracle's GPLv2 licensed code and then
+distributing the result.  Additionally, if you were to remove the
+Classpath Exception from any of the files to which it applies and
+distribute the result, you would likely be required to license some or
+all of the other code in that distribution under the GPLv2 as well, and
+since the GPLv2 is incompatible with the license terms of some items
+included in the distribution by Oracle, removing the Classpath
+Exception could therefore effectively compromise your ability to
+further distribute the package.
+
+Proceed with caution and we recommend that you obtain the advice of a
+lawyer skilled in open source matters before removing the Classpath
+Exception or making modifications to this package which may
+subsequently be redistributed and/or involve the use of third party
+software.
+
+CLASSPATH EXCEPTION
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License version 2 cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from or
+based on this library.  If you modify this library, you may extend this
+exception to your version of the library, but you are not obligated to
+do so.  If you do not wish to do so, delete this exception statement
+from your version.
diff --git a/toolkit-distribution/release/licenses/LICENSE-classworlds b/toolkit-distribution/release/licenses/LICENSE-classworlds
new file mode 100755
index 0000000..47adcc2
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-classworlds
@@ -0,0 +1,47 @@
+
+
+/*
+ $Id$
+
+ Copyright 2002 (C) The Codehaus. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+    statements and notices.  Redistributions must also contain a
+    copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+    above copyright notice, this list of conditions and the
+    following disclaimer in the documentation and/or other
+    materials provided with the distribution.
+
+ 3. The name "classworlds" must not be used to endorse or promote
+    products derived from this Software without prior written
+    permission of The Codehaus.  For written permission, please
+    contact bob@codehaus.org.
+
+ 4. Products derived from this Software may not be called "classworlds"
+    nor may "classworlds" appear in their names without prior written
+    permission of The Codehaus. "classworlds" is a registered
+    trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus.
+    (http://classworlds.codehaus.org/).
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-commonmark b/toolkit-distribution/release/licenses/LICENSE-commonmark
new file mode 100755
index 0000000..8845c71
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-commonmark
@@ -0,0 +1,23 @@
+Copyright (c) 2015-2016, Atlassian Pty Ltd
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-edl b/toolkit-distribution/release/licenses/LICENSE-edl
new file mode 100755
index 0000000..a4a267e
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-edl
@@ -0,0 +1,12 @@
+Eclipse Distribution License - v 1.0
+
+Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI [...]
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-epl-v10 b/toolkit-distribution/release/licenses/LICENSE-epl-v10
new file mode 100755
index 0000000..3fa0083
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-epl-v10
@@ -0,0 +1,86 @@
+Eclipse Public License - v 1.0
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contributio [...]
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted here [...]
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Con [...]
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims  [...]
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Ag [...]
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF [...]
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Reci [...]
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the respons [...]
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-epl-v20 b/toolkit-distribution/release/licenses/LICENSE-epl-v20
new file mode 100755
index 0000000..cc0fb94
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-epl-v20
@@ -0,0 +1,81 @@
+Eclipse Public License - v 2.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+“Contribution” means:
+
+a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+i) changes to the Program, and
+ii) additions to the Program;
+where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works.
+“Contributor” means any person or entity that Distributes the Program.
+
+“Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+“Program” means the Contributions Distributed in accordance with this Agreement.
+
+“Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors.
+
+“Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.
+
+“Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or M [...]
+
+“Distribute” means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy.
+
+“Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+“Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor.
+
+2. GRANT OF RIGHTS
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works.
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution cause [...]
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted here [...]
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3).
+3. REQUIREMENTS
+3.1 If a Contributor Distributes the Program in any form, then:
+
+a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and
+b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license:
+i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and
+iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3.
+3.2 When the Program is Distributed as Source Code:
+
+a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and
+b) a copy of this Agreement must be included with each copy of the Program.
+3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices.
+
+4. COMMERCIAL DISTRIBUTION
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Con [...]
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims  [...]
+
+5. NO WARRANTY
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks assoc [...]
+
+6. DISCLAIMER OF LIABILITY
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EX [...]
+
+7. GENERAL
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Reci [...]
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the respons [...]
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A – Form of Secondary Licenses Notice
+“This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.”
+
+Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses.
+
+If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
+
+You may add additional accurate notices of copyright ownership.
diff --git a/toolkit-distribution/release/licenses/LICENSE-hamcrest b/toolkit-distribution/release/licenses/LICENSE-hamcrest
new file mode 100755
index 0000000..4933bda
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-hamcrest
@@ -0,0 +1,27 @@
+BSD License
+
+Copyright (c) 2000-2015 www.hamcrest.org
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer. Redistributions in binary form must reproduce
+the above copyright notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+Neither the name of Hamcrest nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
diff --git a/toolkit-distribution/release/licenses/LICENSE-jcodings b/toolkit-distribution/release/licenses/LICENSE-jcodings
new file mode 100755
index 0000000..f803194
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-jcodings
@@ -0,0 +1,18 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/toolkit-distribution/release/licenses/LICENSE-joni b/toolkit-distribution/release/licenses/LICENSE-joni
new file mode 100755
index 0000000..9341f05
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-joni
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 JRuby Team
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/toolkit-distribution/release/licenses/LICENSE-jopt b/toolkit-distribution/release/licenses/LICENSE-jopt
new file mode 100755
index 0000000..6b6553b
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-jopt
@@ -0,0 +1,22 @@
+The MIT License
+
+ Copyright (c) 2004-2016 Paul R. Holser, Jr.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/toolkit-distribution/release/licenses/LICENSE-jsch b/toolkit-distribution/release/licenses/LICENSE-jsch
new file mode 100755
index 0000000..641d4f4
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-jsch
@@ -0,0 +1,30 @@
+JSch 0.0.* was released under the GNU LGPL license.  Later, we have switched
+over to a BSD-style license.
+
+------------------------------------------------------------------------------
+Copyright (c) 2002-2015 Atsuhiko Yamanaka, JCraft,Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  1. Redistributions of source code must retain the above copyright notice,
+     this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the distribution.
+
+  3. The names of the authors may not be used to endorse or promote products
+     derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-jsoup b/toolkit-distribution/release/licenses/LICENSE-jsoup
new file mode 100755
index 0000000..6ae61c0
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-jsoup
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2009-2018 Jonathan Hedley <jo...@hedley.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/toolkit-distribution/release/licenses/LICENSE-jzlib b/toolkit-distribution/release/licenses/LICENSE-jzlib
new file mode 100755
index 0000000..068bcf1
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-jzlib
@@ -0,0 +1,29 @@
+JZlib 0.0.* were released under the GNU LGPL license.  Later, we have switched
+over to a BSD-style license.
+
+------------------------------------------------------------------------------
+Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  1. Redistributions of source code must retain the above copyright notice,
+     this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the distribution.
+
+  3. The names of the authors may not be used to endorse or promote products
+     derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/LICENSE-mozilla-v20 b/toolkit-distribution/release/licenses/LICENSE-mozilla-v20
new file mode 100755
index 0000000..b3b8d93
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-mozilla-v20
@@ -0,0 +1,151 @@
+Mozilla Public License
+Version 2.0
+1. Definitions
+1.1. “Contributor”
+means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.
+
+1.2. “Contributor Version”
+means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution.
+
+1.3. “Contribution”
+means Covered Software of a particular Contributor.
+
+1.4. “Covered Software”
+means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof.
+
+1.5. “Incompatible With Secondary Licenses”
+means
+
+that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or
+
+that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License.
+
+1.6. “Executable Form”
+means any form of the work other than Source Code Form.
+
+1.7. “Larger Work”
+means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software.
+
+1.8. “License”
+means this document.
+
+1.9. “Licensable”
+means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License.
+
+1.10. “Modifications”
+means any of the following:
+
+any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or
+
+any new file in Source Code Form that contains any Covered Software.
+
+1.11. “Patent Claims” of a Contributor
+means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version.
+
+1.12. “Secondary License”
+means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses.
+
+1.13. “Source Code Form”
+means the form of the work preferred for making modifications.
+
+1.14. “You” (or “Your”)
+means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
+
+2. License Grants and Conditions
+2.1. Grants
+Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
+
+under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and
+
+under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version.
+
+2.2. Effective Date
+The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor:
+
+for any code that a Contributor has removed from Covered Software; or
+
+for infringements caused by: (i) Your and any other third party’s modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or
+
+under Patent Claims infringed by Covered Software in the absence of its Contributions.
+
+This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3).
+
+2.5. Representation
+Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents.
+
+2.7. Conditions
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1.
+
+3. Responsibilities
+3.1. Distribution of Source Form
+All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form.
+
+3.2. Distribution of Executable Form
+If You distribute Covered Software in Executable Form then:
+
+such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and
+
+You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients’ rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of [...]
+
+3.4. Notices
+You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, supp [...]
+
+4. Inability to Comply Due to Statute or Regulation
+If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or r [...]
+
+5. Termination
+5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come  [...]
+
+5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination.
+
+6. Disclaimer of Warranty
+Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necess [...]
+
+7. Limitation of Liability
+Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such pa [...]
+
+8. Litigation
+Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims.
+
+9. Miscellaneous
+This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+10.1. New Versions
+Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number.
+
+10.2. Effect of New Versions
+You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward.
+
+10.3. Modified Versions
+If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
+If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - “Incompatible With Secondary Licenses” Notice
+This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
diff --git a/toolkit-distribution/release/licenses/LICENSE-slf4j b/toolkit-distribution/release/licenses/LICENSE-slf4j
new file mode 100755
index 0000000..744377c
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-slf4j
@@ -0,0 +1,21 @@
+Copyright (c) 2004-2017 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free  of charge, to any person obtaining
+a  copy  of this  software  and  associated  documentation files  (the
+"Software"), to  deal in  the Software without  restriction, including
+without limitation  the rights to  use, copy, modify,  merge, publish,
+distribute,  sublicense, and/or sell  copies of  the Software,  and to
+permit persons to whom the Software  is furnished to do so, subject to
+the following conditions:
+
+The  above  copyright  notice  and  this permission  notice  shall  be
+included in all copies or substantial portions of the Software.
+
+THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/toolkit-distribution/release/licenses/LICENSE-woodstox-stax2-api b/toolkit-distribution/release/licenses/LICENSE-woodstox-stax2-api
new file mode 100755
index 0000000..7c44536
--- /dev/null
+++ b/toolkit-distribution/release/licenses/LICENSE-woodstox-stax2-api
@@ -0,0 +1,13 @@
+This copy of Stax2 API is licensed under the
+Simplified BSF License (also known as "2-clause BSD", or "FreeBSD License")
+See the License for details about distribution rights, and the
+specific rights regarding derivate works.
+
+You may obtain a copy of the License at:
+
+http://www.opensource.org/licenses/bsd-license.php
+
+with details of:
+
+<OWNER> = FasterXML.com
+<YEAR> = 2010-
diff --git a/toolkit-distribution/release/licenses/NOTICE-airline b/toolkit-distribution/release/licenses/NOTICE-airline
new file mode 100755
index 0000000..e237b91
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-airline
@@ -0,0 +1,2 @@
+Copyright Notices
+Copyright 2011 Dain Sundstrom dain@iq80.com Copyright 2010 Cedric Beust cedric@beust.com
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/NOTICE-apache-commons-cli b/toolkit-distribution/release/licenses/NOTICE-apache-commons-cli
new file mode 100755
index 0000000..fb3ec3c
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-apache-commons-cli
@@ -0,0 +1,5 @@
+Apache Commons CLI
+Copyright 2001-2019 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/NOTICE-apache-commons-codec b/toolkit-distribution/release/licenses/NOTICE-apache-commons-codec
new file mode 100755
index 0000000..950f3db
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-apache-commons-codec
@@ -0,0 +1,17 @@
+Apache Commons Codec
+Copyright 2002-2017 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
+contains test data from http://aspell.net/test/orig/batch0.tab.
+Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org)
+
+===============================================================================
+
+The content of package org.apache.commons.codec.language.bm has been translated
+from the original php source code available at http://stevemorse.org/phoneticinfo.htm
+with permission from the original authors.
+Original source copyright:
+Copyright (c) 2008 Alexander Beider & Stephen P. Morse.
diff --git a/toolkit-distribution/release/licenses/NOTICE-bytebuddy b/toolkit-distribution/release/licenses/NOTICE-bytebuddy
new file mode 100755
index 0000000..4bd4887
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-bytebuddy
@@ -0,0 +1,13 @@
+Copyright ${project.inceptionYear} - ${current.year} ${copyright.holder}
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/NOTICE-eclipse-aether b/toolkit-distribution/release/licenses/NOTICE-eclipse-aether
new file mode 100755
index 0000000..708ef5d
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-eclipse-aether
@@ -0,0 +1,45 @@
+Eclipse Foundation Software User Agreement
+April 9, 2014
+
+Usage Of Content
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICE [...]
+
+Applicable Licenses
+Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.
+
+Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").
+
+Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
+Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
+A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins and/or Fragments associated with that Feature.
+Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
+The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module including, but not limited to the following locations:
+
+The top-level (root) directory
+Plug-in and Fragment directories
+Inside Plug-ins and Fragments packaged as JARs
+Sub-directories of the directory named "src" of certain Plug-ins
+Feature directories
+Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named  [...]
+
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):
+
+Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)
+Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
+Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)
+Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)
+Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.
+
+Use of Provisioning Technology
+The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to install, extend and update Eclipse-based products. Information about packaging Installable Software is  [...]
+
+You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the Specification, you further acknowledge your agreement to, and the acquisition  [...]
+
+A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based product.
+During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be accessed and copied to the Target Machine.
+Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Insta [...]
+Cryptography
+Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted.
+
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/NOTICE-maven b/toolkit-distribution/release/licenses/NOTICE-maven
new file mode 100755
index 0000000..ec3164a
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-maven
@@ -0,0 +1,5 @@
+Apache Maven
+Copyright 2001-2018 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/NOTICE-maven-aether-provider b/toolkit-distribution/release/licenses/NOTICE-maven-aether-provider
new file mode 100755
index 0000000..38c0dfd
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-maven-aether-provider
@@ -0,0 +1,6 @@
+
+Maven Aether Provider
+Copyright 2001-2014 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/toolkit-distribution/release/licenses/NOTICE-netty b/toolkit-distribution/release/licenses/NOTICE-netty
new file mode 100755
index 0000000..8e31ccc
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-netty
@@ -0,0 +1,222 @@
+                            The Netty Project
+                            =================
+
+Please visit the Netty web site for more information:
+
+  * http://netty.io/
+
+Copyright 2014 The Netty Project
+
+The Netty Project licenses this file to you under the Apache License,
+version 2.0 (the "License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations
+under the License.
+
+Also, please refer to each LICENSE.<component>.txt file, which is located in
+the 'license' directory of the distribution file, for the license terms of the
+components that this product depends on.
+
+-------------------------------------------------------------------------------
+This product contains the extensions to Java Collections Framework which has
+been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene:
+
+  * LICENSE:
+    * license/LICENSE.jsr166y.txt (Public Domain)
+  * HOMEPAGE:
+    * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/
+    * http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/
+
+This product contains a modified version of Robert Harder's Public Domain
+Base64 Encoder and Decoder, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.base64.txt (Public Domain)
+  * HOMEPAGE:
+    * http://iharder.sourceforge.net/current/java/base64/
+
+This product contains a modified portion of 'Webbit', an event based
+WebSocket and HTTP server, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.webbit.txt (BSD License)
+  * HOMEPAGE:
+    * https://github.com/joewalnes/webbit
+
+This product contains a modified portion of 'SLF4J', a simple logging
+facade for Java, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.slf4j.txt (MIT License)
+  * HOMEPAGE:
+    * http://www.slf4j.org/
+
+This product contains a modified portion of 'Apache Harmony', an open source
+Java SE, which can be obtained at:
+
+  * NOTICE:
+    * license/NOTICE.harmony.txt
+  * LICENSE:
+    * license/LICENSE.harmony.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * http://archive.apache.org/dist/harmony/
+
+This product contains a modified portion of 'jbzip2', a Java bzip2 compression
+and decompression library written by Matthew J. Francis. It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.jbzip2.txt (MIT License)
+  * HOMEPAGE:
+    * https://code.google.com/p/jbzip2/
+
+This product contains a modified portion of 'libdivsufsort', a C API library to construct
+the suffix array and the Burrows-Wheeler transformed string for any input string of
+a constant-size alphabet written by Yuta Mori. It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.libdivsufsort.txt (MIT License)
+  * HOMEPAGE:
+    * https://github.com/y-256/libdivsufsort
+
+This product contains a modified portion of Nitsan Wakart's 'JCTools', Java Concurrency Tools for the JVM,
+ which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.jctools.txt (ASL2 License)
+  * HOMEPAGE:
+    * https://github.com/JCTools/JCTools
+
+This product optionally depends on 'JZlib', a re-implementation of zlib in
+pure Java, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.jzlib.txt (BSD style License)
+  * HOMEPAGE:
+    * http://www.jcraft.com/jzlib/
+
+This product optionally depends on 'Compress-LZF', a Java library for encoding and
+decoding data in LZF format, written by Tatu Saloranta. It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.compress-lzf.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://github.com/ning/compress
+
+This product optionally depends on 'lz4', a LZ4 Java compression
+and decompression library written by Adrien Grand. It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.lz4.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://github.com/jpountz/lz4-java
+
+This product optionally depends on 'lzma-java', a LZMA Java compression
+and decompression library, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.lzma-java.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://github.com/jponge/lzma-java
+
+This product contains a modified portion of 'jfastlz', a Java port of FastLZ compression
+and decompression library written by William Kinney. It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.jfastlz.txt (MIT License)
+  * HOMEPAGE:
+    * https://code.google.com/p/jfastlz/
+
+This product contains a modified portion of and optionally depends on 'Protocol Buffers', Google's data
+interchange format, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.protobuf.txt (New BSD License)
+  * HOMEPAGE:
+    * https://github.com/google/protobuf
+
+This product optionally depends on 'Bouncy Castle Crypto APIs' to generate
+a temporary self-signed X.509 certificate when the JVM does not provide the
+equivalent functionality.  It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.bouncycastle.txt (MIT License)
+  * HOMEPAGE:
+    * http://www.bouncycastle.org/
+
+This product optionally depends on 'Snappy', a compression library produced
+by Google Inc, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.snappy.txt (New BSD License)
+  * HOMEPAGE:
+    * https://github.com/google/snappy
+
+This product optionally depends on 'JBoss Marshalling', an alternative Java
+serialization API, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.jboss-marshalling.txt (GNU LGPL 2.1)
+  * HOMEPAGE:
+    * http://www.jboss.org/jbossmarshalling
+
+This product optionally depends on 'Caliper', Google's micro-
+benchmarking framework, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.caliper.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://github.com/google/caliper
+
+This product optionally depends on 'Apache Commons Logging', a logging
+framework, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.commons-logging.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * http://commons.apache.org/logging/
+
+This product optionally depends on 'Apache Log4J', a logging framework, which
+can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.log4j.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * http://logging.apache.org/log4j/
+
+This product optionally depends on 'Aalto XML', an ultra-high performance
+non-blocking XML processor, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.aalto-xml.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * http://wiki.fasterxml.com/AaltoHome
+
+This product contains a modified version of 'HPACK', a Java implementation of
+the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.hpack.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://github.com/twitter/hpack
+
+This product contains a modified portion of 'Apache Commons Lang', a Java library
+provides utilities for the java.lang API, which can be obtained at:
+
+  * LICENSE:
+    * license/LICENSE.commons-lang.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://commons.apache.org/proper/commons-lang/
+
+
+This product contains the Maven wrapper scripts from 'Maven Wrapper', that provides an easy way to ensure a user has everything necessary to run the Maven build.
+
+  * LICENSE:
+    * license/LICENSE.mvn-wrapper.txt (Apache License 2.0)
+  * HOMEPAGE:
+    * https://github.com/takari/maven-wrapper
diff --git a/toolkit-distribution/release/licenses/NOTICE-plexus-cipher b/toolkit-distribution/release/licenses/NOTICE-plexus-cipher
new file mode 100755
index 0000000..a972b8f
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-plexus-cipher
@@ -0,0 +1,7 @@
+
+The code in this component contains a class - Base64 taken from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/Base64.java
+which is Apache license: http://www.apache.org/licenses/LICENSE-2.0
+
+The PBE key processing routine PBECipher.createCipher() is adopted from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/OpenSSL.java
+ which is also Apache APL-2.0 license: http://www.apache.org/licenses/LICENSE-2.0
+
diff --git a/toolkit-distribution/release/licenses/NOTICE-plexus-utils b/toolkit-distribution/release/licenses/NOTICE-plexus-utils
new file mode 100755
index 0000000..7196130
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-plexus-utils
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/toolkit-distribution/release/licenses/NOTICE-servicecomb-java-chassis b/toolkit-distribution/release/licenses/NOTICE-servicecomb-java-chassis
new file mode 100755
index 0000000..f6bebf8
--- /dev/null
+++ b/toolkit-distribution/release/licenses/NOTICE-servicecomb-java-chassis
@@ -0,0 +1,5 @@
+Apache ServiceComb Java Chassis
+Copyright 2017-2019 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/toolkit-maven-plugin/pom.xml b/toolkit-maven-plugin/pom.xml
index 5bb48ef..37661fb 100755
--- a/toolkit-maven-plugin/pom.xml
+++ b/toolkit-maven-plugin/pom.xml
@@ -51,12 +51,12 @@
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
       <version>3.6.0</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-archiver</artifactId>
-      <version>2.1</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.checkerframework</groupId>
+          <artifactId>checker-compat-qual</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
index 1734236..aedcb1c 100755
--- a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package plugin;
 
 import static org.junit.Assert.assertEquals;
diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
index 7472485..97c8273 100755
--- a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package plugin;
 
 import static org.junit.Assert.assertEquals;


[servicecomb-toolkit] 25/49: optimize logging

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit f060c88dab6787f62ed3d880ae681644ab953072
Author: kakulisen <18...@163.com>
AuthorDate: Tue May 28 14:18:29 2019 +0800

    optimize logging
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../apache/servicecomb/toolkit/common/ImmediateClassLoader.java    | 7 ++++++-
 .../servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java    | 6 +++++-
 .../main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java | 6 +++++-
 .../main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java  | 7 +++++--
 .../org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java | 5 ++++-
 5 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
index f03314a..08ccced 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ImmediateClassLoader.java
@@ -17,12 +17,17 @@
 
 package org.apache.servicecomb.toolkit.common;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
 
 public class ImmediateClassLoader extends URLClassLoader {
 
+  private final static Logger LOGGER = LoggerFactory.getLogger(ImmediateClassLoader.class);
+
   private String classPath;
 
   public ImmediateClassLoader(URL[] urls, ClassLoader parent) {
@@ -45,7 +50,7 @@ public class ImmediateClassLoader extends URLClassLoader {
               .replace(".class", "");
           loadClass(className);
         } catch (ClassNotFoundException e) {
-          e.printStackTrace();
+          LOGGER.error(e.getMessage());
         }
       } else if (file.isDirectory()) {
         for (File f : file.listFiles()) {
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
index 8d16173..5a27171 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
@@ -30,9 +30,13 @@ import java.util.regex.Pattern;
 
 import io.swagger.models.Swagger;
 import io.swagger.util.Json;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ContractsSwaggerUIGenerator implements DocGenerator {
 
+  private final static Logger LOGGER = LoggerFactory.getLogger(ContractsSwaggerUIGenerator.class);
+
   private static Pattern variablePattern = Pattern.compile("(?<=\\{\\{)[a-zA-Z0-9_-]*(?=\\}\\})");
 
   private final static String DOC_FORMAT = "swagger-ui";
@@ -65,7 +69,7 @@ public class ContractsSwaggerUIGenerator implements DocGenerator {
 
       Files.write(outputFile, swaggerUiHtml.getBytes());
     } catch (IOException e) {
-      e.printStackTrace();
+      LOGGER.error(e.getMessage());
     }
 
     return swaggerUiHtml;
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index 074f7f9..49f99d1 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -33,11 +33,15 @@ import org.apache.servicecomb.toolkit.codegen.DefaultCodeGenerator;
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import io.swagger.codegen.config.CodegenConfigurator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Command(name = "codegenerate",
     description = "Generate multiple models of microservice project by OpenAPI specification file")
 public class CodeGenerate implements Runnable {
 
+  private final static Logger LOGGER = LoggerFactory.getLogger(CodeGenerate.class);
+
   @Option(name = {"-p", "--programming-model"}, title = "programming model", required = false,
       description = "programming model, as SpringMVC, POJO, JAX-RS, and SpringBoot")
   private String programmingModel;
@@ -98,7 +102,7 @@ public class CodeGenerate implements Runnable {
             }
           });
         } catch (IOException e) {
-          e.printStackTrace();
+          LOGGER.error(e.getMessage());
         }
       } else {
         configurator.setInputSpec(specFile);
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index 7113b9c..988389a 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -32,10 +32,14 @@ import org.apache.servicecomb.swagger.SwaggerUtils;
 
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Command(name = "docgenerate", description = "Generate document by OpenAPI specification file")
 public class DocGenerate implements Runnable {
 
+  private final static Logger LOGGER = LoggerFactory.getLogger(CodeGenerate.class);
+
   @Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
       description = "location of the OpenAPI specification file, as URL or file (required)")
   private String specFile;
@@ -80,8 +84,7 @@ public class DocGenerate implements Runnable {
             format);
       }
     } catch (IOException e) {
-      // command line , direct print to screen
-      e.printStackTrace();
+      LOGGER.error(e.getMessage());
     }
   }
 }
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
index 0ef19c4..c548d62 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
@@ -31,6 +31,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.servicecomb.toolkit.common.ContractComparator;
 import org.apache.servicecomb.toolkit.common.ContractsUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Mojo(name = "verifyContracts", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
 @Execute(goal = "verifyContracts",
@@ -38,6 +40,7 @@ import org.apache.servicecomb.toolkit.common.ContractsUtils;
 )
 public class VerifyContractsMojo extends AbstractMojo {
 
+  private final static Logger LOGGER = LoggerFactory.getLogger(VerifyContractsMojo.class);
 
   @Parameter(defaultValue = "${project}", required = true, readonly = true)
   private MavenProject project;
@@ -81,7 +84,7 @@ public class VerifyContractsMojo extends AbstractMojo {
         }
       });
     } catch (IOException e) {
-      e.printStackTrace();
+      LOGGER.error(e.getMessage());
     }
   }
 }


[servicecomb-toolkit] 34/49: modify default rule of package generation

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit ec93cdff32107be02abc6ff8267a53d08ad30fc9
Author: kakulisen <18...@163.com>
AuthorDate: Fri May 31 19:37:03 2019 +0800

    modify default rule of package generation
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index 957feef..d6b4fd2 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -97,11 +97,11 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     modelTemplateFiles.remove("model.mustache");
 
     groupId = "org.apache.servicecomb";
-    artifactId = "example";
+    artifactId = "app";
 
-    apiPackage = groupId + ".example.controller";
-    modelPackage = groupId + ".example.model";
-    mainClassPackage = groupId + ".example";
+    apiPackage = groupId + "." + artifactId + ".api";
+    modelPackage = groupId + "." + artifactId + ".model";
+    mainClassPackage = groupId + "." + artifactId;
 
     supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
     supportedLibraries.put(POJO_LIBRARY, "ServiceComb Server application using the pojo programming model.");


[servicecomb-toolkit] 20/49: Add English document

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit f0c516b0a86b09757da06f7c9b35f134a46108c4
Author: MabinGo <bi...@huawei.com>
AuthorDate: Mon May 27 15:39:22 2019 +0800

    Add English document
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 README.md => README-ZH.md                        |  42 +++---
 README.md                                        | 171 ++++++++++++-----------
 images/{architecture.png => architecture-en.png} | Bin
 images/architecture-zh.png                       | Bin 0 -> 9821 bytes
 images/workingprinciple-en.png                   | Bin 0 -> 52892 bytes
 images/workingprinciple-zh.png                   | Bin 0 -> 48813 bytes
 images/workingprinciple.png                      | Bin 50070 -> 0 bytes
 7 files changed, 108 insertions(+), 105 deletions(-)

diff --git a/README.md b/README-ZH.md
similarity index 82%
copy from README.md
copy to README-ZH.md
index b140cc9..ea3eee9 100755
--- a/README.md
+++ b/README-ZH.md
@@ -2,6 +2,8 @@
 
 基于契约的微服务开发工具套件
 
+[Introduction to English](./README.md)
+
 ## 1 简介
 
 ### 1.1 目标
@@ -56,11 +58,11 @@
 
 ### 2.1 主体架构
 
-![image](./images/architecture.png)
+![image](./images/architecture-zh.png)
 
 ### 2.2 工作原理
 
-![image](./images/workingprinciple.png)
+![image](./images/workingprinciple-zh.png)
 
 ## 3 快速入门
 ### 3.1 从源码构建工具和插件
@@ -88,7 +90,7 @@ $ java -jar toolkit-cli.jar help
 ```shell
 $ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
 ```
-> codegenerate命令选项说明:
+> **codegenerate** 命令选项说明:
 * -m, --microservice-framework : 指定微服务框架,现支持ServiceComb  
 例:-m ServiceComb
 * -p, --programming-model : 指定编程模型,可选JAX-RS,POJO,SpringMVC,SpringBoot  
@@ -108,7 +110,7 @@ $ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./pr
 ```shell
 $ java -jar toolkit-cli.jar  docgenerate -i swagger.yaml -o ./document
 ```
-> docGenerate命令选项说明:
+> **docGenerate** 命令选项说明:
 * -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
 例:-i http://petstore.swagger.io/v2/swagger.json
 * -o, --output : 文档输出路径   
@@ -125,12 +127,12 @@ $ java -jar toolkit-cli.jar  docgenerate -i swagger.yaml -o ./document
     <artifactId>toolkit-maven-plugin</artifactId>
     <version>0.1.0-SNAPSHOT</version>
     <configuration>
-        <!-- 契约生成目录,默认contracts -->
-        <outputDir>contracts</outputDir>
-        <!-- 标准的契约放置的目录,默认sourceContracts  -->
-        <sourceContractsDir>sourceContracts</sourceContractsDir>  
-        <!-- 文档生成目录,默认build/doc -->
-        <docOutputDir>build/doc</docOutputDir>
+        <!-- 契约生成目录 -->
+        <outputDir>./contracts</outputDir>
+        <!-- 标准的契约放置的目录  -->
+        <sourceContractsDir>./sourceContracts</sourceContractsDir>  
+        <!-- 文档生成目录 -->
+        <docOutputDir>./documents</docOutputDir>
     </configuration>
 </plugin>
 ```
@@ -142,10 +144,10 @@ mvn toolkit:generateContracts
 ```
 
 配置项
-* outputDir : 生成的契约文件输出路径,默认contracts  
+* outputDir : 生成的契约文件输出路径
 例:
 ```xml
-<outputDir>contracts</outputDir>
+<outputDir>./contracts</outputDir>
 ```
 
 #### 3.3.3 从代码生成文档
@@ -156,13 +158,13 @@ mvn toolkit:generateDoc
 ```
 
 配置项
-* outputDir : 生成的契约文件输出路径,默认contracts
-* docOutputDir : 生成的契约文档输出路径,默认build/doc
+* outputDir : 生成的契约文件输出路径
+* docOutputDir : 生成的契约文档输出路径
 
 例:
 ```xml
-<outputDir>contracts</outputDir>
-<docOutputDir>build/doc</docOutputDir>
+<outputDir>./contracts</outputDir>
+<docOutputDir>./documents</docOutputDir>
 ```
 
 #### 3.3.4 契约校验
@@ -173,12 +175,12 @@ mvn toolkit:verifyContracts
 ```
 
 配置项
-* outputDir : 生成的契约文件输出路径,默认当前目录下contracts目录
-* sourceContractsDir : 共识契约存放路径,默认当前目录下sourceContracts目录
+* outputDir : 生成的契约文件输出路径
+* sourceContractsDir : 共识契约存放路径
 例:
 ```xml
-<outputDir>contracts</outputDir>
-<sourceContractsDir>sourceContracts</sourceContractsDir>
+<outputDir>./contracts</outputDir>
+<sourceContractsDir>./sourceContracts</sourceContractsDir>
 ```
 
 ## 4 反馈问题
diff --git a/README.md b/README.md
index b140cc9..dd42918 100755
--- a/README.md
+++ b/README.md
@@ -1,190 +1,191 @@
 # toolkit
 
-基于契约的微服务开发工具套件
+Contract-based microservice development toolkit
 
-## 1 简介
+[中文简介](./README-ZH.md)
 
-### 1.1 目标
+## 1 Introduction
 
-* 快速构建基于流行微服务框架和编程模型的微服务工程,并提供服务契约、代码、文档的一体化制作能力,帮助基于服务契约开发的用户在微服务转型阶段,降低微服务入门成本,聚焦业务开发,提升遗留系统重构、开发效率。
+### 1.1 Conceptions
 
-### 1.2 特性
+* A contract-based microservice development toolkit with the goal of rapidly building microservices projects based on popular microservices frameworks and programming models, and supporting the automatic generation of contracts,code and documentation to help users reduce micro-service entry costs, focus on business development, and improve legacy system reconfiguration and development efficiency during the microservice transformation phase.
 
-* 代码提取服务契约
+### 1.2 Features
 
-  在基于SpringMVC/POJO/JAX-RS模型开发的应用中,一键生成符合OpenAPI规范的服务契约文件。
+* Code extraction service contract
 
-* 服务契约生成微服务工程
+  In applications developed based on the SpringMVC/POJO/JAX-RS model, one-click generation of service contract files conforming to the OpenAPI specification.
 
-  输入符合OpenAPI规范的服务契约,一键生成以ServiceComb/SpringCloud/Swagger为底座,以及以SpringMVC/POJO/JAX-RS或SpringBoot为开发模型的微服务项目。
+* Service contract generation microservice project
 
-* 服务契约与代码一致性校验
+  Enter a service contract that conforms to the OpenAPI specification, one-click generation of a microservice project with ServiceComb/SpringCloud/Swagger as the base microservice framework and SpringMVC/POJO/JAX-RS or SpringBoot as programming model.
 
-  校验应用的实际实现(如数据和服务API)是否与达成共识的服务契约描述一致。
+* Service contract and code consistency check
 
-* 服务契约/代码生成文档
+  Verify that the actual implementation of the application (such as the data and service API) is consistent with the agreed service contract description.
 
-  输入符合OpenAPI规范的服务契约,一键生成html/word/pdf格式的文档。
+* Service contract/code generation document
+
+  Enter a service contract that conforms to the OpenAPI specification, one-click generation of a document in html/word/pdf format.
 
 * Todo List
 
-  * 支持契约一键制作以SpringCloud等流行微服务框架为底座的微服务工程。
+  * Support contract one-click production microservice engineering based on popular microservice framework such as SpringCloud.
 
-  * 支持基于gradle的契约开发插件。
+  * Support gradle-based contract development plugin.
 
-  * 支持插件埋入eclipse。
+  * Support plugins to embed eclipse.
 
-  * 支持word、pdf等流行格式文档。
+  * Support for generating popular format documents such as word, pdf.
 
-  * 支持契约增量生成代码。
+  * Support contract incremental generation code.
 
-### 1.3 适用场景
+### 1.3 Applicable Scene
 
-* 集成多厂商应用的企业
+* For users who integrate multi-vendor applications
 
-  问题:厂商数据、服务标准不一致,开发语言、习惯、框架不一致,集成商难集成,企业难管控。
+  Scene: the development languages, habits, and frameworks of different vendors are different, the entire system data and service standards are inconsistent, users are difficult to integrate, and it is difficult to manage and control the final delivery quality.
 
-  措施:通过统一定义的接口描述标准(服务契约),使用工具套件一键生成基于指定微服务框架的微服务工程,并且通过服务契约校验手段协同维护整体系统的一致性。以此协调多个开发团队,降低沟通成本且避免后期的混乱。
+  Solution:Through a uniformly defined interface description standard (service contract), a toolkit is used to generate a microservice project based on a specified microservices framework, and the consistency of the whole system is coordinated through service contract verification. Coordinate multiple development teams to reduce communication costs and avoid post-chaos.
 
-* 遗留系统微服务化快速改造
+* For users who have evolved from legacy systems to microservices
 
-  问题:用户需要额外学习和理解微服务及相关框架后,再设计微服务工程,学习成本高。
+  Scene: additional learning and understanding of the microservices-related framework details is required before the microservices project can be designed, built, and developed according to the selected microservices framework. For users, Need to be distracted to focus on things outside the business.
 
-  措施:使用工具套件分析遗留应用提取服务契约,再一键生成基于指定微服务框架的微服务工程后,即可聚焦业务开发,减少用户对微服务框架的学习成本。
+  Solution: Using the toolkit to analyze the legacy application extraction service contract, and then generate the microservices project based on the specified microservices framework, you can focus on business development and reduce the learning cost of the microservices framework.
 
-## 2 设计
+## 2 Design
 
-### 2.1 主体架构
+### 2.1 Architecture
 
-![image](./images/architecture.png)
+![image](./images/architecture-en.png)
 
-### 2.2 工作原理
+### 2.2 Working Principle
 
-![image](./images/workingprinciple.png)
+![image](./images/workingprinciple-en.png)
 
-## 3 快速入门
-### 3.1 从源码构建工具和插件
-构建环境要求:
+## 3 Quick Start
+### 3.1 Build tool and plugins from source
 
+> Build environment requirements
 * [Java 8](http://java.oracle.com)
-
 * [Apache maven 3.5.0 or greater](http://maven.apache.org/)
 
 ```shell
-# 从github获取toolkit最新源码
+# Get the latest source code for toolkit from github
 $ git clone https://github.com/MabinGo/toolkit.git
 $ cd toolkit
 
-# 构建打包
+# Build package
 $ mvn clean install
 ```
 
-### 3.2 使用toolkit-cli工具
-可执行jar包位于toolkit/toolkit-cli/target目录下
+### 3.2 Use the toolkit-cli
+The executable jar package is located in the toolkit/toolkit-cli/target directory
 ```shell
 $ java -jar toolkit-cli.jar help
 ```
-#### 3.2.1 契约生成微服务工程
+#### 3.2.1 Service contract generation microservice project
 ```shell
 $ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
 ```
-> codegenerate命令选项说明:
-* -m, --microservice-framework : 指定微服务框架,现支持ServiceComb  
+> **codegenerate** Command option
+* -m, --microservice-framework. Specify microservices framework, now supports ServiceComb.
 例:-m ServiceComb
-* -p, --programming-model : 指定编程模型,可选JAX-RS,POJO,SpringMVC,SpringBoot  
+* -p, --programming-model. Specify programming model, optional JAX-RS, POJO, SpringMVC, SpringBoot.
 例:-p SpringMvc
-* -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
+* -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
 例:-i http://petstore.swagger.io/v2/swagger.json
-* -o, --output : 生成的项目代码输出路径  
+* -o, --output. Generated project code output path.  
 例:-o ./project
-* --group-id : 指定生成的项目的group id  
+* --group-id. Specify the group id of the generated project.
 例:--group-id com.demo
-* --artifact-id : 指定生成的项目的artifact id     
+* --artifact-id. Specify the artifact id of the generated project.
 例:--artifact-id springmvc-example
-* --artifact-version : 指定生成的项目的artifact version  
+* --artifact-version. Specify the artifact version of the generated project.
 例:--artifact-version 1.0.0
 
-#### 3.2.2 契约生成文档
+#### 3.2.2 Service contract generation document
 ```shell
 $ java -jar toolkit-cli.jar  docgenerate -i swagger.yaml -o ./document
 ```
-> docGenerate命令选项说明:
-* -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
+> **docgenerate** Command option
+* -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
 例:-i http://petstore.swagger.io/v2/swagger.json
-* -o, --output : 文档输出路径   
+* -o, --output. Document output path.
 例:-o ./document
-* -f, --format : 指定输出文档风格,现支持swagger-ui和asciidoc-html  
+* -f, --format. Specifies the output document format, now supports swagger-ui and asciidoc-html
 例:-f swagger-ui
 
-### 3.3 使用toolkit-maven-plugin插件
-#### 3.3.1 配置
-在maven项目的pom文件中配置
+### 3.3 Use the toolkit-maven-plugin plugin
+#### 3.3.1 configuration
+Configured in the pom file of the maven project
 ```xml
 <plugin>
     <groupId>org.apache.servicecomb</groupId>
     <artifactId>toolkit-maven-plugin</artifactId>
     <version>0.1.0-SNAPSHOT</version>
     <configuration>
-        <!-- 契约生成目录,默认contracts -->
-        <outputDir>contracts</outputDir>
-        <!-- 标准的契约放置的目录,默认sourceContracts  -->
-        <sourceContractsDir>sourceContracts</sourceContractsDir>  
-        <!-- 文档生成目录,默认build/doc -->
-        <docOutputDir>build/doc</docOutputDir>
+        <!-- Contracts generation directory -->
+        <outputDir>./contracts</outputDir>
+        <!-- SourceContracts placement directory -->
+        <sourceContractsDir>./sourceContracts</sourceContractsDir>  
+        <!-- Document generation directory -->
+        <docOutputDir>./documents</docOutputDir>
     </configuration>
 </plugin>
 ```
-#### 3.3.2 从代码提取契约
+#### 3.3.2 Extract the contract from the code
 
-运行
+Run in shell
 ```shell
 mvn toolkit:generateContracts
 ```
 
-配置项
-* outputDir : 生成的契约文件输出路径,默认contracts  
-例:
+Configuration
+* outputDir: contract generation directory
+example
 ```xml
-<outputDir>contracts</outputDir>
+<outputDir>./contracts</outputDir>
 ```
 
-#### 3.3.3 从代码生成文档
+#### 3.3.3 Generate documentation from code
 
-运行
+Run in shell
 ```shell
 mvn toolkit:generateDoc
 ```
 
-配置项
-* outputDir : 生成的契约文件输出路径,默认contracts
-* docOutputDir : 生成的契约文档输出路径,默认build/doc
+Configuration
+* outputDir : Contract generation directory
+* docOutputDir : Generated contract document output path
 
-例:
+example
 ```xml
-<outputDir>contracts</outputDir>
-<docOutputDir>build/doc</docOutputDir>
+<outputDir>./contracts</outputDir>
+<docOutputDir>./documents</docOutputDir>
 ```
 
-#### 3.3.4 契约校验
+#### 3.3.4 Contract verify
 
-运行
+Run in shell
 ```shell
 mvn toolkit:verifyContracts
 ```
 
-配置项
-* outputDir : 生成的契约文件输出路径,默认当前目录下contracts目录
-* sourceContractsDir : 共识契约存放路径,默认当前目录下sourceContracts目录
-例:
+Configuration
+* outputDir - The generated contract file output path.
+* sourceContractsDir - Consensus contract storage path.
+example
 ```xml
-<outputDir>contracts</outputDir>
-<sourceContractsDir>sourceContracts</sourceContractsDir>
+<outputDir>./contracts</outputDir>
+<sourceContractsDir>./sourceContracts</sourceContractsDir>
 ```
 
-## 4 反馈问题
+## 4 Contact
 
 Bugs: [issues](https://github.com/MabinGo/toolkit/issues)
 
-## 5 参与开发
+## 5 Contribute
 
 PR: [Pull request](https://github.com/MabinGo/toolkit/pulls)
diff --git a/images/architecture.png b/images/architecture-en.png
similarity index 100%
rename from images/architecture.png
rename to images/architecture-en.png
diff --git a/images/architecture-zh.png b/images/architecture-zh.png
new file mode 100755
index 0000000..180baa7
Binary files /dev/null and b/images/architecture-zh.png differ
diff --git a/images/workingprinciple-en.png b/images/workingprinciple-en.png
new file mode 100755
index 0000000..463fb3d
Binary files /dev/null and b/images/workingprinciple-en.png differ
diff --git a/images/workingprinciple-zh.png b/images/workingprinciple-zh.png
new file mode 100755
index 0000000..7766b83
Binary files /dev/null and b/images/workingprinciple-zh.png differ
diff --git a/images/workingprinciple.png b/images/workingprinciple.png
deleted file mode 100755
index 6da3af3..0000000
Binary files a/images/workingprinciple.png and /dev/null differ


[servicecomb-toolkit] 28/49: Merge pull request #8 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit dc38559f75f6d45e2ae99f9d640b21909f9c07b5
Merge: d865f8c c8b1a70
Author: Mabin <bi...@huawei.com>
AuthorDate: Wed May 29 11:05:11 2019 +0800

    Merge pull request #8 from kakulisen/master
    
    fix unit test bug

 .../src/test/java/plugin/GenerateContractsMojoTest.java  |   2 +-
 .../classes/demo/Application.class                       | Bin 0 -> 745 bytes
 .../classes/demo/HelloEndPoint.class                     | Bin 0 -> 1243 bytes
 3 files changed, 1 insertion(+), 1 deletion(-)


[servicecomb-toolkit] 03/49: configure not generating dependencyreduced temp file.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit d16dcd8a8c17898606a97043e31176fabab6cf61
Author: MabinGo <bi...@huawei.com>
AuthorDate: Fri May 17 16:45:30 2019 +0800

    configure not generating dependencyreduced temp file.
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 toolkit-cli/dependency-reduced-pom.xml | 64 ----------------------------------
 toolkit-cli/pom.xml                    |  1 +
 2 files changed, 1 insertion(+), 64 deletions(-)

diff --git a/toolkit-cli/dependency-reduced-pom.xml b/toolkit-cli/dependency-reduced-pom.xml
deleted file mode 100644
index 33bd7aa..0000000
--- a/toolkit-cli/dependency-reduced-pom.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <artifactId>toolkit</artifactId>
-    <groupId>org.apache.servicecomb</groupId>
-    <version>0.1.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>toolkit-cli</artifactId>
-  <build>
-    <resources>
-      <resource>
-        <filtering>true</filtering>
-        <directory>src/main/resources</directory>
-      </resource>
-    </resources>
-    <plugins>
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>2.4.1</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <filters>
-                <filter>
-                  <artifact>*:*</artifact>
-                  <excludes>
-                    <exclude>META-INF/*.SF</exclude>
-                    <exclude>META-INF/*.DSA</exclude>
-                    <exclude>META-INF/*.RSA</exclude>
-                  </excludes>
-                </filter>
-              </filters>
-              <transformers>
-                <transformer>
-                  <mainClass>org.apache.servicecomb.toolkit.cli.ToolkitMain</mainClass>
-                </transformer>
-                <transformer>
-                  <resource>META-INF/spring.handlers</resource>
-                </transformer>
-                <transformer>
-                  <resource>META-INF/spring.schemas</resource>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>
-
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 570dde4..1151674 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -65,6 +65,7 @@
               <goal>shade</goal>
             </goals>
             <configuration>
+              <createDependencyReducedPom>false</createDependencyReducedPom>
               <filters>
                 <filter>
                   <artifact>*:*</artifact>


[servicecomb-toolkit] 32/49: Support generating fat jar for consumer service

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 483d6994e19dd64dd11715902c625171253ef444
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu May 30 21:06:11 2019 +0800

    Support generating fat jar for consumer service
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../resources/ServiceComb/consumer/pom.mustache    | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
index 7d1333a..9a1e531 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
@@ -94,6 +94,33 @@
           <target>1.8</target>
         </configuration>
       </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
+        <configuration>
+          <fork>true</fork>
+          <mainClass>{{mainClassPackage}}.Application</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 


[servicecomb-toolkit] 08/49: Remove the redundant file

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 50b758c58110b025bfa2048759a0632f73a7c0a7
Author: MabinGo <bi...@huawei.com>
AuthorDate: Tue May 21 08:50:12 2019 +0800

    Remove the redundant file
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 swagger-ui.html | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/swagger-ui.html b/swagger-ui.html
deleted file mode 100755
index 282a229..0000000
--- a/swagger-ui.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-
-    <meta charset="UTF-8">
-    <title>Title</title>
-
-    <link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui.css">
-    <script src="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui-standalone-preset.js"></script>
-    <script src="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui-bundle.js"></script>
-</head>
-<body>
-
-<div id="swagger-ui"></div>
-
-</body>
-
-
-<script>
-    const ui = SwaggerUIBundle({
-        spec: JSON.parse('{"swagger":"2.0","info":{"description":"ThisisasampleserverPetstoreserver.YoucanfindoutmoreaboutSwaggerat[http://swagger.io](http://swagger.io)oron[irc.freenode.net,#swagger](http://swagger.io/irc/).Forthissample,youcanusetheapikey`special-key`totesttheauthorizationfilters.","version":"1.0.0","title":"SwaggerPetstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache2.0","url":"http://www.apache.org/li [...]
-        dom_id: '#swagger-ui',
-        deepLinking: true,
-        presets: [
-            SwaggerUIBundle.presets.apis,
-            SwaggerUIStandalonePreset
-        ],
-        layout: "StandaloneLayout"
-    })
-</script>
-
-</html>
\ No newline at end of file


[servicecomb-toolkit] 35/49: Merge pull request #9 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 537c7513c9455434d1db10b4fcaa0a42b7895bca
Merge: c4b93b1 ec93cdf
Author: Mabin <bi...@huawei.com>
AuthorDate: Fri May 31 19:45:26 2019 +0800

    Merge pull request #9 from kakulisen/master
    
    modify default rule of package generation

 .../apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


[servicecomb-toolkit] 15/49: Optimize the type of document format

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit d3d7035200a47ab759dd92f35c07be40193b7e0c
Author: MabinGo <bi...@huawei.com>
AuthorDate: Fri May 24 15:33:28 2019 +0800

    Optimize the type of  document format
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../toolkit/docgen/ContractsAsciidocGenerator.java         | 14 +++++++++++++-
 .../toolkit/docgen/ContractsSwaggerUIGenerator.java        |  8 +++++---
 .../org/apache/servicecomb/toolkit/cli/DocGenerate.java    |  6 +++---
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
index a653ee4..7009653 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
@@ -42,7 +42,9 @@ public class ContractsAsciidocGenerator implements DocGenerator {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(ContractsAsciidocGenerator.class);
 
-  private final static String DOC_FORMAT = "asciidoc";
+  private final static String DOC_FORMAT = "asciidoc-html";
+
+  private final static String DOC_SUFFIX = ".html";
 
   @Override
   public boolean canProcess(String type) {
@@ -75,6 +77,7 @@ public class ContractsAsciidocGenerator implements DocGenerator {
         .asMap();
     String asciidocResult = asciidoctor.convert(markup, optionsMap);
     try {
+      outputPath = correctPath(outputPath);
       Files.write(Paths.get(outputPath), asciidocResult.getBytes());
     } catch (IOException e) {
       LOGGER.error(e.getMessage());
@@ -82,4 +85,13 @@ public class ContractsAsciidocGenerator implements DocGenerator {
 
     return asciidocResult;
   }
+
+  private String correctPath(String filepath) {
+
+    if (!filepath.endsWith(DOC_SUFFIX)) {
+      return filepath + "-" + DOC_FORMAT + DOC_SUFFIX;
+    }
+
+    return filepath;
+  }
 }
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
index 26a0aa1..8d16173 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
@@ -35,7 +35,9 @@ public class ContractsSwaggerUIGenerator implements DocGenerator {
 
   private static Pattern variablePattern = Pattern.compile("(?<=\\{\\{)[a-zA-Z0-9_-]*(?=\\}\\})");
 
-  private final static String DOC_FORMAT = "html";
+  private final static String DOC_FORMAT = "swagger-ui";
+
+  private final static String DOC_SUFFIX = ".html";
 
   @Override
 
@@ -71,8 +73,8 @@ public class ContractsSwaggerUIGenerator implements DocGenerator {
 
   private String correctPath(String filepath) {
 
-    if (!filepath.endsWith("." + DOC_FORMAT)) {
-      return filepath + DOC_FORMAT;
+    if (!filepath.endsWith(DOC_SUFFIX)) {
+      return filepath + "-" + DOC_FORMAT + DOC_SUFFIX;
     }
 
     return filepath;
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index 85fc0e6..f3089e9 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -41,8 +41,8 @@ public class DocGenerate implements Runnable {
 
 
   @Option(name = {"-f", "--format"}, title = "document format", required = false,
-      description = "format of document, as html or asciidoc (html by default)")
-  private String format = "html";
+      description = "format of document, as swagger-ui or asciidoc-html (swagger-ui by default)")
+  private String format = "swagger-ui";
 
   @Option(name = {"-o", "--output"}, title = "output directory",
       description = "location of the generated document (current dir by default)")
@@ -62,7 +62,7 @@ public class DocGenerate implements Runnable {
 
             DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
                 output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
-                "html");
+                    format);
             return super.visitFile(file, attrs);
           }
         });


[servicecomb-toolkit] 10/49: clean up unwanted files

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 2243107a3e4d45a478fa26013d73cb2daf282de9
Author: kakulisen <18...@163.com>
AuthorDate: Thu May 23 09:06:54 2019 +0800

    clean up unwanted files
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java    | 1 +
 .../test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
index 459cf56..04f14d3 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
@@ -30,6 +30,7 @@ public class DefaultCodeGenerator implements CodeGenerator {
   @Override
   public CodeGenerator opts(CodegenConfigurator opts) {
 
+    generator.setGenerateSwaggerMetadata(false);
     generator.opts(opts.toClientOptInput());
     return this;
   }
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index 638dd96..e94cea4 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -54,7 +54,7 @@ public class GeneratorTest {
     Assert.assertEquals("ServiceCombProvider", ((ServiceCombProviderCodegen) swaggerCodegenConfig).getName());
     Assert.assertEquals(CodegenType.SERVER, ((ServiceCombProviderCodegen) swaggerCodegenConfig).getTag());
 
-    Assert.assertEquals(16, generatedFiles.size());
+    Assert.assertEquals(14, generatedFiles.size());
     tempDir.toFile().deleteOnExit();
   }
 }


[servicecomb-toolkit] 45/49: Optimizing code

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit eb8980b74420d654201cce043f769dede0a9f43f
Author: kakulisen <18...@163.com>
AuthorDate: Thu Jun 6 19:08:13 2019 +0800

    Optimizing code
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java  | 2 +-
 .../org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index ddecb36..b91bf95 100755
--- a/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -81,7 +81,7 @@ public class CodeGenerate implements Runnable {
       description = "model package in generated microservice project")
   private String modelPackage;
 
-  @Option(name = {"--service-type"}, title = "service type",
+  @Option(name = {"-t", "--service-type"}, title = "service type",
       description = "microservice type of generated microservice project. optional value is provider,consumer,all")
   private String serviceType;
 
diff --git a/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index ebecd71..30dd208 100755
--- a/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -188,7 +188,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
         processPojoProvider();
         break;
       case "consumer":
-        processConsumerOpts();
+        processConsumerProjectOpts();
         processPojoConsumer();
         apiTemplateFiles().remove("api.mustache");
         break;
@@ -196,7 +196,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
       default:
         processProviderProjectOpts();
         processPojoProvider();
-        processConsumerOpts();
+        processConsumerProjectOpts();
         processPojoConsumer();
     }
     processModelProjectOpts();
@@ -263,7 +263,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     );
   }
 
-  private void processConsumerOpts() {
+  private void processConsumerProjectOpts() {
 
     String newConsumerTemplateFolder = consumerTemplateFolder;
 


[servicecomb-toolkit] 23/49: add unit test code

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit d48cd0bbb12f4efc5074261ecec601a4979235ac
Author: kakulisen <18...@163.com>
AuthorDate: Tue May 28 12:03:37 2019 +0800

    add unit test code
    
    Signed-off-by: kakulisen <18...@163.com>
---
 common/pom.xml                                     |   7 ++
 .../toolkit/common/TextCompareTest.java            | 116 +++++++++++++++++++++
 .../src/test/resources/compare/HelloEndPoint.yaml  |  75 +++++++++++++
 .../src/test/resources/compare/HelloEndPoint2.yaml |  75 +++++++++++++
 .../src/test/java/docgen/DocGeneratorTest.java     |  96 +++++++++++++++++
 .../src/test/resources/HelloEndPoint.yaml          |  38 +++++++
 toolkit-maven-plugin/pom.xml                       |  36 +++++++
 .../java/plugin/GenerateContractsDocMojoTest.java  |  53 ++++++++++
 .../java/plugin/GenerateContractsMojoTest.java     |  68 ++++++++++++
 .../projects/project-generateContracts/pom.xml     |  46 ++++++++
 .../projects/project-generateContractsDoc/pom.xml  |  46 ++++++++
 11 files changed, 656 insertions(+)

diff --git a/common/pom.xml b/common/pom.xml
index 3324cb2..9a718c0 100755
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -71,6 +71,13 @@
       <version>4.12</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>2.25.0</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
new file mode 100644
index 0000000..14df512
--- /dev/null
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
@@ -0,0 +1,116 @@
+package org.apache.servicecomb.toolkit.common;
+
+import org.junit.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.*;
+
+public class TextCompareTest {
+
+  Path sourcePath = Paths.get("./src/test/resources/compare/HelloEndPoint.yaml");
+  Path destPath = Paths.get("./src/test/resources/compare/HelloEndPoint2.yaml");
+
+  @Test
+  public void contractCompareText() throws IOException {
+    ContractComparator contractComparator = new ContractComparator(new String(Files.readAllBytes(sourcePath)),
+            new String(Files.readAllBytes(destPath)));
+    assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
+
+    List<Comparison> comparisonList = contractComparator.compare();
+
+    assertEquals(3, comparisonList.size());
+  }
+
+  @Test
+  public void contractCompareResultPrint() throws IOException {
+    ContractComparator contractComparator = new ContractComparator(new String(Files.readAllBytes(sourcePath)),
+            new String(Files.readAllBytes(destPath)));
+    assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
+
+    ByteArrayOutputStream bout = new ByteArrayOutputStream();
+    contractComparator.splitPrint(bout);
+
+    assertTrue(0 < bout.toByteArray().length);
+  }
+
+  @Test
+  public void contractCompareAnotherAlgorithm() throws IOException {
+
+    CompareAlgorithm oneLineAlgorithm = mock(CompareAlgorithm.class);
+    when(oneLineAlgorithm.compare(anyString(), anyString())).then(new Answer<Object>() {
+      @Override
+      public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
+        Object[] args = invocationOnMock.getArguments();
+        String source = (String) args[0];
+        String dest = (String) args[1];
+        if ((source == null || "".equals(source.trim())) && dest != null) {
+          Comparison comparison = new Comparison(ComparisionType.INSERT, 0, 0, 1, 0);
+          return Collections.singletonList(comparison);
+        }
+
+        if (source != null && (dest == null || "".equals(dest.trim()))) {
+          Comparison comparison = new Comparison(ComparisionType.DELETE, 0, 0, 0, 0);
+          return Collections.singletonList(comparison);
+        }
+
+        if (hasNewLine(source) || hasNewLine(dest)) {
+          return null;
+        }
+
+        if ((dest).equals(source)) {
+          return Collections.singletonList(new Comparison(ComparisionType.EQUAL, 0, 0, 0, 0));
+        }
+        Comparison comparison = new Comparison(ComparisionType.REPLACE, 0, 1, 0, 1);
+        return Collections.singletonList(comparison);
+      }
+    });
+
+    ContractComparator contractComparator = new ContractComparator("source line",
+            "destination line", oneLineAlgorithm);
+
+    ByteArrayOutputStream bout = new ByteArrayOutputStream();
+    contractComparator.splitPrint(bout);
+    bout.flush();
+    assertTrue(0 < bout.toByteArray().length);
+
+    bout = new ByteArrayOutputStream();
+    contractComparator = new ContractComparator("source line",
+            "source line", oneLineAlgorithm);
+    contractComparator.splitPrint(bout);
+    assertEquals(ComparisionType.EQUAL , contractComparator.compare().get(0).type);
+
+  }
+
+  private boolean hasNewLine(String s) {
+    return Pattern.compile("\\r?\\n").matcher(s).find();
+  }
+
+  @Test
+  public void contractCompareException() throws IOException {
+
+    try (ByteArrayOutputStream bout = new ByteArrayOutputStream()) {
+
+      ContractComparator contractComparator = new ContractComparator(null,
+              new String(Files.readAllBytes(destPath)));
+      assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
+      contractComparator.splitPrint(bout);
+
+    } catch (RuntimeException e) {
+      assertEquals("source must not be null", e.getMessage());
+    }
+
+  }
+}
diff --git a/common/src/test/resources/compare/HelloEndPoint.yaml b/common/src/test/resources/compare/HelloEndPoint.yaml
new file mode 100644
index 0000000..c67fb51
--- /dev/null
+++ b/common/src/test/resources/compare/HelloEndPoint.yaml
@@ -0,0 +1,75 @@
+
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  x-java-interface: "gen.swagger.HelloEndPointIntf"
+basePath: "/hello"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /sayHello:
+    get:
+      operationId: "sayHello"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "result"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      - name: "instanceId"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "callTime"
+        in: "query"
+        required: false
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayHi:
+    get:
+      operationId: "sayHi"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "Authorization"
+        in: "header"
+        description: "aa"
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayNo:
+    get:
+      operationId: "sayNo"
+      parameters:
+        - name: "name"
+          in: "query"
+          required: false
+          type: "string"
+        - name: "Authorization"
+          in: "header"
+          description: "aa"
+          required: true
+          type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
\ No newline at end of file
diff --git a/common/src/test/resources/compare/HelloEndPoint2.yaml b/common/src/test/resources/compare/HelloEndPoint2.yaml
new file mode 100644
index 0000000..be821f5
--- /dev/null
+++ b/common/src/test/resources/compare/HelloEndPoint2.yaml
@@ -0,0 +1,75 @@
+---
+aaswagfger: "2.066"
+ccc
+info:
+  version: "1.0.02"
+  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  x-java-interface: "gen.swagger.HelloEndPointIntf"
+basePath: "/hello"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /sayHello:
+    get:
+      operationId: "sayHello"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "result"
+        in: "query"
+        required: false
+        type: "number"
+        format: "double"
+      - name: "instanceId"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "callTime"
+        in: "query"
+        required: false
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayHi:
+    get:
+      operationId: "sayHi"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      - name: "Authorization"
+        in: "header"
+        description: "aa"
+        required: true
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayNo:
+    get:
+      operationId: "sayNo"
+      parameters:
+        - name: "name"
+          in: "query"
+          required: false
+          type: "string"
+        - name: "Authorization"
+          in: "header"
+          description: "aa"
+          required: true
+          type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
\ No newline at end of file
diff --git a/doc-generator/src/test/java/docgen/DocGeneratorTest.java b/doc-generator/src/test/java/docgen/DocGeneratorTest.java
new file mode 100644
index 0000000..0ca5bc9
--- /dev/null
+++ b/doc-generator/src/test/java/docgen/DocGeneratorTest.java
@@ -0,0 +1,96 @@
+package docgen;
+
+import io.swagger.models.Swagger;
+import io.swagger.parser.Swagger20Parser;
+import org.apache.commons.io.FileUtils;
+import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class DocGeneratorTest {
+
+
+    @Test
+    public void contractToAsciidoc() throws IOException {
+
+        Swagger20Parser swagger20Parser = new Swagger20Parser();
+        InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
+
+        StringBuilder sb = new StringBuilder();
+        byte[] bytes = new byte[1024];
+        int len = -1;
+        while ((len = in.read(bytes)) != -1){
+            sb.append(new String(bytes,0,len));
+        }
+
+        Swagger swagger = swagger20Parser.parse(sb.toString());
+        Path tempDir = Files.createTempDirectory(null);
+        Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
+                + File.separator + "asciidoc.html");
+
+        DocGeneratorManager.generate(swagger,outputPath.toFile().getCanonicalPath() , "asciidoc-html");
+
+        Assert.assertTrue(Files.exists(outputPath));
+        FileUtils.deleteDirectory(tempDir.toFile());
+    }
+
+    @Test
+    public void contractTransferToSwaggerUI() throws IOException {
+
+        Swagger20Parser swagger20Parser = new Swagger20Parser();
+
+        InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
+
+        StringBuilder sb = new StringBuilder();
+        byte[] bytes = new byte[1024];
+        int len = -1;
+        while ((len = in.read(bytes)) != -1) {
+            sb.append(new String(bytes, 0, len));
+        }
+
+        Swagger swagger = swagger20Parser.parse(sb.toString());
+
+        Path tempDir = Files.createTempDirectory(null);
+        Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
+                + File.separator + "swagger-ui.html");
+        DocGeneratorManager.generate(swagger,outputPath.toFile().getCanonicalPath() , "swagger-ui");
+
+        Assert.assertTrue(Files.exists(outputPath));
+        FileUtils.deleteDirectory(tempDir.toFile());
+    }
+
+    @Test
+    public void contractTransferToOther() throws IOException {
+
+        Swagger20Parser swagger20Parser = new Swagger20Parser();
+
+        InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
+
+        StringBuilder sb = new StringBuilder();
+        byte[] bytes = new byte[1024];
+        int len = -1;
+        while ((len = in.read(bytes)) != -1) {
+            sb.append(new String(bytes, 0, len));
+        }
+
+        Swagger swagger = swagger20Parser.parse(sb.toString());
+
+        Path tempDir = Files.createTempDirectory(null);
+        Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
+                + File.separator + "swagger-ui.html");
+
+        DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "other");
+
+        Assert.assertFalse(Files.exists(outputPath));
+
+        FileUtils.deleteDirectory(tempDir.toFile());
+    }
+
+}
diff --git a/doc-generator/src/test/resources/HelloEndPoint.yaml b/doc-generator/src/test/resources/HelloEndPoint.yaml
new file mode 100644
index 0000000..a42df27
--- /dev/null
+++ b/doc-generator/src/test/resources/HelloEndPoint.yaml
@@ -0,0 +1,38 @@
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for org.apache.servicecomb.samples.bmi.HelloEndPoint"
+  x-java-interface: "gen.swagger.HelloEndPointIntf"
+basePath: "/hello"
+consumes:
+- "application/json"
+produces:
+- "application/json"
+paths:
+  /sayHello:
+    get:
+      operationId: "sayHello"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
+  /sayHi:
+    get:
+      operationId: "sayHi"
+      parameters:
+      - name: "name"
+        in: "query"
+        required: false
+        type: "string"
+      responses:
+        200:
+          description: "response of 200"
+          schema:
+            type: "string"
diff --git a/toolkit-maven-plugin/pom.xml b/toolkit-maven-plugin/pom.xml
index 9574db1..5bb48ef 100755
--- a/toolkit-maven-plugin/pom.xml
+++ b/toolkit-maven-plugin/pom.xml
@@ -64,6 +64,42 @@
       <artifactId>toolkit-common</artifactId>
       <version>${project.version}</version>
     </dependency>
+
+    <!-- for test -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.plugin-testing</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>3.3.0</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-aether-provider</artifactId>
+      <version>3.2.2</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-compat</artifactId>
+      <version>3.2.2</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>2.25.0</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
new file mode 100644
index 0000000..1fa05c4
--- /dev/null
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsDocMojoTest.java
@@ -0,0 +1,53 @@
+package plugin;
+
+import org.apache.maven.plugin.testing.MojoRule;
+import org.apache.maven.plugin.testing.resources.TestResources;
+import org.apache.maven.project.MavenProject;
+import org.apache.servicecomb.toolkit.plugin.GenerateContractsDocMojo;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+
+
+public class GenerateContractsDocMojoTest {
+
+  private static final String PLUGIN_GOAL = "generateDoc";
+
+  private static final String TEST_PROJECT = "project-generateContractsDoc";
+
+  @Rule
+  public MojoRule rule = new MojoRule();
+
+  @Rule
+  public TestResources resources = new TestResources();
+
+
+  @Test
+  public void testGenerateContractsDoc() throws Exception {
+    File baseDir = this.resources.getBasedir(TEST_PROJECT);
+    GenerateContractsDocMojo generateContractsDocMojo = mock(GenerateContractsDocMojo.class);
+    List<String> runtimeUrlPath = new ArrayList<>();
+    runtimeUrlPath.add(baseDir + "/target/classes");
+    final MavenProject project = mock(MavenProject.class);
+    given(project.getRuntimeClasspathElements()).willReturn(runtimeUrlPath);
+
+    assertNotNull(generateContractsDocMojo);
+    rule.setVariableValueToObject(generateContractsDocMojo, "project", project);
+    rule.setVariableValueToObject(generateContractsDocMojo, "format", ".yaml");
+    assertNotNull(this.rule.getVariableValueFromObject(generateContractsDocMojo, "project"));
+    assertEquals(".yaml", this.rule.getVariableValueFromObject(generateContractsDocMojo, "format"));
+    rule.executeMojo(project, PLUGIN_GOAL);
+    generateContractsDocMojo.execute();
+
+  }
+
+
+}
diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
new file mode 100644
index 0000000..f69c312
--- /dev/null
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
@@ -0,0 +1,68 @@
+package plugin;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.testing.MojoRule;
+import org.apache.maven.plugin.testing.resources.TestResources;
+import org.apache.maven.project.MavenProject;
+import org.apache.servicecomb.toolkit.plugin.GenerateContractsMojo;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+
+public class GenerateContractsMojoTest {
+
+  private static final String PLUGIN_GOAL = "generateContracts";
+
+  @Rule
+  public MojoRule rule = new MojoRule();
+
+  @Rule
+  public TestResources resources = new TestResources();
+
+  @Test
+  public void testGenerateContracts() throws Exception {
+    executeMojo("project-generateContracts", PLUGIN_GOAL);
+  }
+
+  protected void executeMojo(String projectName, String goalName) throws Exception {
+
+    File baseDir = this.resources.getBasedir(projectName);
+    assertNotNull(baseDir);
+    assertTrue(baseDir.exists());
+    assertTrue(baseDir.isDirectory());
+
+    File pom = new File(baseDir, "pom.xml");
+    AbstractMojo generateContractsMojo = (AbstractMojo) this.rule.lookupMojo(goalName, pom);
+
+    assertNotNull(generateContractsMojo);
+    assertEquals(GenerateContractsMojo.class, generateContractsMojo.getClass());
+
+    final MavenProject project = mock(MavenProject.class);
+    given(project.getFile()).willReturn(pom);
+    List<String> runtimeUrlPath = new ArrayList<>();
+    runtimeUrlPath.add(baseDir + "/target/classes");
+    given(project.getRuntimeClasspathElements()).willReturn(runtimeUrlPath);
+
+    rule.setVariableValueToObject(generateContractsMojo, "project", project);
+    assertNotNull(this.rule.getVariableValueFromObject(generateContractsMojo, "project"));
+
+    assertEquals("target/test_output_contracts", this.rule.getVariableValueFromObject(generateContractsMojo, "outputDir"));
+    assertEquals(".yaml", this.rule.getVariableValueFromObject(generateContractsMojo, "format"));
+
+    generateContractsMojo.execute();
+
+    assertTrue(new File("target/test_output_contracts").exists());
+  }
+
+}
diff --git a/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml b/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml
new file mode 100644
index 0000000..9a71eb5
--- /dev/null
+++ b/toolkit-maven-plugin/src/test/projects/project-generateContracts/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Copyright 2014 Linagora, Université Joseph Fourier
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+       http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<project
+        xmlns="http://maven.apache.org/POM/4.0.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <prerequisites>
+        <maven>3.0.3</maven>
+    </prerequisites>
+
+    <groupId>org.apache.servicecomb</groupId>
+    <artifactId>this-is-for-test-only</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <name>This is for Test ONLY</name>
+    <packaging>jar</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.servicecomb</groupId>
+                <artifactId>toolkit-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <outputDir>target/test_output_contracts</outputDir>
+                    <format>.yaml</format>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml b/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml
new file mode 100644
index 0000000..2b05bdf
--- /dev/null
+++ b/toolkit-maven-plugin/src/test/projects/project-generateContractsDoc/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Copyright 2014 Linagora, Université Joseph Fourier
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+       http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<project
+        xmlns="http://maven.apache.org/POM/4.0.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <prerequisites>
+        <maven>3.0.3</maven>
+    </prerequisites>
+    <groupId>org.apache.servicecomb</groupId>
+    <artifactId>this-is-for-test-only</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>This is for Test ONLY</name>
+    <packaging>jar</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.servicecomb</groupId>
+                <artifactId>toolkit-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <outputDir>./target/plugin-test-output</outputDir>
+                    <docOutputDir>./target/plugin-test-output</docOutputDir>
+                    <format>.yaml</format>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file


[servicecomb-toolkit] 38/49: add pojo template

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 9dc1077536c6627178ba918701c2ee807d2e7b5d
Author: kakulisen <18...@163.com>
AuthorDate: Mon Jun 3 15:00:01 2019 +0800

    add pojo template
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../ServiceComb/consumer/pojo/apiConsumer.mustache | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
new file mode 100755
index 0000000..0465fc4
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
@@ -0,0 +1,24 @@
+package {{apiPackage}};
+
+import java.util.List;
+{{#imports}}import {{import}};
+{{/imports}}
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
+
+{{#operations}}
+@Component
+public class {{classname}}Consumer implements {{classname}}{
+
+  @RpcReference(microserviceName = "{{microserviceName}}", schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+  private {{classname}} api;
+
+{{#operation}}
+  @Override
+  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>consumer/queryParamsConsumer}}{{>consumer/pathParamsConsumer}}{{>consumer/headerParamsConsumer}}{{>consumer/bodyParamsConsumer}}{{>consumer/formParamsConsumer}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
+
+    return api.{{operationId}}({{#allParams}}{{#isQueryParam}}{{paramName}}{{/isQueryParam}}{{#isPathParam}}{{paramName}}{{/isPathParam}}{{#isHeaderParam}}{{paramName}}{{/isHeaderParam}}{{#isBodyParam}}{{paramName}}{{/isBodyParam}}{{#isFormParam}}{{paramName}}{{/isFormParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+  }
+{{/operation}}
+}
+{{/operations}}
\ No newline at end of file


[servicecomb-toolkit] 06/49: Add feature of contract generating document

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit c8658ec773a72e96f84138279253cd70a7d6949d
Author: MabinGo <bi...@huawei.com>
AuthorDate: Mon May 20 20:20:24 2019 +0800

    Add feature of contract generating document
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 doc-generator/pom.xml                              | 118 +++++++++++++++++++++
 .../docgen/ContractsAsciidocGenerator.java         |  87 +++++++++++++++
 .../docgen/ContractsSwaggerUIGenerator.java        | 109 +++++++++++++++++++
 .../apache/servicecomb/docgen/DocGenerator.java    |  27 +++++
 .../servicecomb/docgen/DocGeneratorManager.java    |  48 +++++++++
 .../org.apache.servicecomb.docgen.DocGenerator     |  19 ++++
 .../src/main/resources/webroot/swagger-ui.html     |  32 ++++++
 pom.xml                                            |   1 +
 swagger-ui.html                                    |  32 ++++++
 9 files changed, 473 insertions(+)

diff --git a/doc-generator/pom.xml b/doc-generator/pom.xml
new file mode 100755
index 0000000..bf5ba09
--- /dev/null
+++ b/doc-generator/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>toolkit</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>0.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>doc-generator</artifactId>
+
+  <repositories>
+    <repository>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <id>jcenter-releases</id>
+      <name>jcenter</name>
+      <url>http://jcenter.bintray.com</url>
+    </repository>
+  </repositories>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.asciidoctor</groupId>
+      <artifactId>asciidoctorj</artifactId>
+      <version>1.6.2</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.asciidoctor</groupId>
+      <artifactId>asciidoctorj-pdf</artifactId>
+      <version>1.5.0-alpha.15</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jruby</groupId>
+          <artifactId>jruby-complete</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jruby</groupId>
+      <artifactId>jruby-complete</artifactId>
+      <version>9.2.6.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>swagger-generator-core</artifactId>
+      <version>1.2.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>io.github.swagger2markup</groupId>
+      <artifactId>swagger2markup</artifactId>
+      <version>1.3.2</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.4</version>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit</artifactId>
+      <version>5.3.0.201903130848-r</version>
+    </dependency>
+
+    <!--<dependency>-->
+    <!--<groupId>org.apache.servicecomb</groupId>-->
+    <!--<artifactId>toolkit-common</artifactId>-->
+    <!--<version>${project.version}</version>-->
+    <!--</dependency>-->
+
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsAsciidocGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsAsciidocGenerator.java
new file mode 100755
index 0000000..1e28116
--- /dev/null
+++ b/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsAsciidocGenerator.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.docgen;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.OpenOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.Attributes;
+import org.asciidoctor.AttributesBuilder;
+import org.asciidoctor.OptionsBuilder;
+import org.asciidoctor.SafeMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Ordering;
+
+import io.github.swagger2markup.Swagger2MarkupConverter;
+import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
+import io.swagger.models.Swagger;
+import io.swagger.models.parameters.Parameter;
+
+
+public class ContractsAsciidocGenerator implements DocGenerator {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(ContractsAsciidocGenerator.class);
+
+  private final static String DOC_FORMAT = "asciidoc";
+
+  @Override
+  public boolean canProcess(String type) {
+    return type != null && DOC_FORMAT.equals(type.toLowerCase());
+  }
+
+  @Override
+  public String generate(Swagger contractContent, String outputPath) {
+
+    Asciidoctor asciidoctor = Asciidoctor.Factory.create();
+    Swagger2MarkupConverter.Builder markupBuilder = Swagger2MarkupConverter.from(contractContent);
+    Swagger2MarkupConfigBuilder swagger2MarkupConfigBuilder = new Swagger2MarkupConfigBuilder()
+        .withParameterOrdering(Ordering
+            .explicit("path", "query", "header", "cookie", "formData", "body")
+            .onResultOf(Parameter::getIn));
+    String markup = markupBuilder.withConfig(swagger2MarkupConfigBuilder.build()).build().toString();
+
+    final Map<String, Object> optionsMap = OptionsBuilder.options()
+        .docType("book")
+        .backend("html5")
+        .headerFooter(true)
+        .safe(SafeMode.UNSAFE)
+        .attributes(AttributesBuilder.attributes()
+            .attribute("toclevels", 3)
+            .attribute(Attributes.TOC_2, true)
+            .attribute(Attributes.TOC_POSITION, "left")
+            .attribute(Attributes.LINK_CSS, true)
+            .attribute(Attributes.SECTION_NUMBERS, true)
+            .attribute(Attributes.SECT_NUM_LEVELS, 4))
+        .asMap();
+    String asciidocResult = asciidoctor.convert(markup, optionsMap);
+    try {
+      Files.write(Paths.get(outputPath), asciidocResult.getBytes());
+    } catch (IOException e) {
+      LOGGER.error(e.getMessage());
+    }
+
+    return asciidocResult;
+  }
+}
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsSwaggerUIGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsSwaggerUIGenerator.java
new file mode 100755
index 0000000..2f154b5
--- /dev/null
+++ b/doc-generator/src/main/java/org/apache/servicecomb/docgen/ContractsSwaggerUIGenerator.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.docgen;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import io.swagger.models.Swagger;
+import io.swagger.util.Json;
+
+public class ContractsSwaggerUIGenerator implements DocGenerator {
+
+  private static Pattern variablePattern = Pattern.compile("(?<=\\{\\{)[a-zA-Z0-9_-]*(?=\\}\\})");
+
+  private final static String DOC_FORMAT = "html";
+
+  @Override
+
+  public boolean canProcess(String type) {
+    return DOC_FORMAT.equals(type);
+  }
+
+  @Override
+  public String generate(Swagger contractContent, String outputPath) {
+
+    String swaggerUiHtml = null;
+    try {
+      String swaggerJson = Json.mapper().writeValueAsString(contractContent);
+      swaggerUiHtml = renderHtml(getSwaggerUiHtml(), Collections.singletonMap("spec", swaggerJson));
+
+      outputPath = correctPath(outputPath);
+      Path outputFile = Paths.get(outputPath);
+
+      if (!Files.exists(outputFile)) {
+        if (outputFile.getParent() != null) {
+          Files.createDirectories(outputFile.getParent());
+        }
+        Files.createFile(outputFile);
+      }
+
+      Files.write(outputFile, swaggerUiHtml.getBytes());
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+
+    return swaggerUiHtml;
+  }
+
+  private String correctPath(String filepath) {
+
+    if (!filepath.endsWith("." + DOC_FORMAT)) {
+      return filepath + DOC_FORMAT;
+    }
+
+    return filepath;
+  }
+
+  private String renderHtml(String html, Map<String, String> args) {
+
+    Matcher variableMatcher = variablePattern.matcher(html);
+    while (variableMatcher.find()) {
+      String variableStr = variableMatcher.group();
+      String variableValue = args.get(variableStr);
+
+      html = html.replace("{{" + variableStr + "}}", variableValue);
+    }
+
+    return html;
+  }
+
+  private String getSwaggerUiHtml() throws IOException {
+    int len;
+
+    ByteArrayOutputStream bout = new ByteArrayOutputStream();
+    InputStream in = this.getClass().getClassLoader().getResourceAsStream("webroot/swagger-ui.html");
+
+    byte[] buf = new byte[1024];
+    while ((len = in.read(buf)) != -1) {
+      bout.write(buf, 0, len);
+    }
+    bout.close();
+    in.close();
+
+    return new String(bout.toByteArray());
+  }
+}
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGenerator.java
new file mode 100755
index 0000000..6381e5e
--- /dev/null
+++ b/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGenerator.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.docgen;
+
+import io.swagger.models.Swagger;
+
+public interface DocGenerator {
+
+  boolean canProcess(String type);
+
+  String generate(Swagger source, String outputPath);
+}
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGeneratorManager.java b/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGeneratorManager.java
new file mode 100755
index 0000000..17566b8
--- /dev/null
+++ b/doc-generator/src/main/java/org/apache/servicecomb/docgen/DocGeneratorManager.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.docgen;
+
+import java.util.ServiceLoader;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import io.swagger.models.Swagger;
+
+public class DocGeneratorManager {
+
+  private final static CopyOnWriteArrayList<DocGenerator> registeredGenerators = new CopyOnWriteArrayList<>();
+
+  static {
+    loadInitialDocGenerators();
+  }
+
+  private static void loadInitialDocGenerators() {
+
+    ServiceLoader.load(DocGenerator.class).forEach(registeredGenerators::add);
+  }
+
+  public static String generate(Swagger source, String outputPath, String outputType) {
+
+    for (DocGenerator docGenerator : registeredGenerators) {
+      if (docGenerator.canProcess(outputType)) {
+        return docGenerator.generate(source, outputPath);
+      }
+    }
+
+    return null;
+  }
+}
diff --git a/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.docgen.DocGenerator b/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.docgen.DocGenerator
new file mode 100755
index 0000000..aa6fb85
--- /dev/null
+++ b/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.docgen.DocGenerator
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.servicecomb.docgen.ContractsAsciidocGenerator
+org.apache.servicecomb.docgen.ContractsSwaggerUIGenerator
\ No newline at end of file
diff --git a/doc-generator/src/main/resources/webroot/swagger-ui.html b/doc-generator/src/main/resources/webroot/swagger-ui.html
new file mode 100755
index 0000000..6718b91
--- /dev/null
+++ b/doc-generator/src/main/resources/webroot/swagger-ui.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+
+    <meta charset="UTF-8">
+    <title>Title</title>
+
+    <link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui.css">
+    <script src="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui-standalone-preset.js"></script>
+    <script src="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui-bundle.js"></script>
+</head>
+<body>
+
+<div id="swagger-ui"></div>
+
+</body>
+
+
+<script>
+    const ui = SwaggerUIBundle({
+        spec: JSON.parse('{{spec}}'),
+        dom_id: '#swagger-ui',
+        deepLinking: true,
+        presets: [
+            SwaggerUIBundle.presets.apis,
+            SwaggerUIStandalonePreset
+        ],
+        layout: "StandaloneLayout"
+    })
+</script>
+
+</html>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ca48b94..d97307d 100755
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,7 @@
   <modules>
     <module>code-generator</module>
     <module>toolkit-cli</module>
+    <module>doc-generator</module>
   </modules>
 
 </project>
diff --git a/swagger-ui.html b/swagger-ui.html
new file mode 100755
index 0000000..282a229
--- /dev/null
+++ b/swagger-ui.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+
+    <meta charset="UTF-8">
+    <title>Title</title>
+
+    <link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui.css">
+    <script src="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui-standalone-preset.js"></script>
+    <script src="https://unpkg.com/swagger-ui-dist@3.22.1/swagger-ui-bundle.js"></script>
+</head>
+<body>
+
+<div id="swagger-ui"></div>
+
+</body>
+
+
+<script>
+    const ui = SwaggerUIBundle({
+        spec: JSON.parse('{"swagger":"2.0","info":{"description":"ThisisasampleserverPetstoreserver.YoucanfindoutmoreaboutSwaggerat[http://swagger.io](http://swagger.io)oron[irc.freenode.net,#swagger](http://swagger.io/irc/).Forthissample,youcanusetheapikey`special-key`totesttheauthorizationfilters.","version":"1.0.0","title":"SwaggerPetstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache2.0","url":"http://www.apache.org/li [...]
+        dom_id: '#swagger-ui',
+        deepLinking: true,
+        presets: [
+            SwaggerUIBundle.presets.apis,
+            SwaggerUIStandalonePreset
+        ],
+        layout: "StandaloneLayout"
+    })
+</script>
+
+</html>
\ No newline at end of file


[servicecomb-toolkit] 21/49: Optimize document styles and add remote resource reads

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit f2f510db0e660266b8435e558d0346abf29001c3
Author: kakulisen <18...@163.com>
AuthorDate: Mon May 27 16:44:56 2019 +0800

    Optimize document styles and add remote resource reads
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../toolkit/docgen/ContractsAsciidocGenerator.java           |  1 -
 .../java/org/apache/servicecomb/toolkit/cli/DocGenerate.java | 12 +++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
index 7009653..42133f7 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
+++ b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
@@ -71,7 +71,6 @@ public class ContractsAsciidocGenerator implements DocGenerator {
             .attribute("toclevels", 3)
             .attribute(Attributes.TOC_2, true)
             .attribute(Attributes.TOC_POSITION, "left")
-            .attribute(Attributes.LINK_CSS, true)
             .attribute(Attributes.SECTION_NUMBERS, true)
             .attribute(Attributes.SECT_NUM_LEVELS, 4))
         .asMap();
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index e468973..7113b9c 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -19,6 +19,7 @@ package org.apache.servicecomb.toolkit.cli;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URI;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -62,13 +63,18 @@ public class DocGenerate implements Runnable {
 
             DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
                 output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
-                    format);
+                format);
             return super.visitFile(file, attrs);
           }
         });
-      } else {
+      } else if (Files.isRegularFile(specPath)) {
 
-        DocGeneratorManager.generate(SwaggerUtils.parseSwagger(new File(specFile).toURI().toURL()),
+        DocGeneratorManager.generate(SwaggerUtils.parseSwagger(specPath.toUri().toURL()),
+            output + File.separator + new File(specFile).getName()
+                .substring(0, new File(specFile).getName().indexOf(".")),
+            format);
+      } else {
+        DocGeneratorManager.generate(SwaggerUtils.parseSwagger(URI.create(specFile).toURL()),
             output + File.separator + new File(specFile).getName()
                 .substring(0, new File(specFile).getName().indexOf(".")),
             format);


[servicecomb-toolkit] 40/49: Merge pull request #10 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 86415985909d927409d03ec0e4b959a2571d9811
Merge: 0293eb9 2884051
Author: Mabin <bi...@huawei.com>
AuthorDate: Mon Jun 3 16:46:53 2019 +0800

    Merge pull request #10 from kakulisen/master
    
    Support generating pojo consumer

 .../toolkit/codegen/ServiceCombCodegen.java        | 44 +++++++++++++++-------
 .../consumer/formParamsConsumer.mustache           |  2 +-
 .../ServiceComb/consumer/pojo/apiConsumer.mustache | 25 ++++++++++++
 .../ServiceComb/libraries/POJO/api.mustache        | 27 +++----------
 .../POJO/{api.mustache => apiImpl.mustache}        |  2 +-
 .../libraries/POJO/apiInterface.mustache           | 17 ---------
 6 files changed, 62 insertions(+), 55 deletions(-)


[servicecomb-toolkit] 14/49: Add SpringBoot programming model

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit e32ef38ea107c1947d2fa016307e576d6220e15e
Author: kakulisen <18...@163.com>
AuthorDate: Fri May 24 11:21:19 2019 +0800

    Add SpringBoot programming model
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../toolkit/codegen/ServiceCombCodegen.java        |   3 +
 .../libraries/SpringBoot/Application.mustache      |  15 +++
 .../ServiceComb/libraries/SpringBoot/api.mustache  |  31 +++++
 .../libraries/SpringBoot/api_test.mustache         |  38 +++++++
 .../libraries/SpringBoot/bodyParams.mustache       |   1 +
 .../libraries/SpringBoot/formParams.mustache       |   2 +
 .../libraries/SpringBoot/headerParams.mustache     |   1 +
 .../libraries/SpringBoot/operationMethod.mustache  |  13 +++
 .../libraries/SpringBoot/pathParams.mustache       |   1 +
 .../ServiceComb/libraries/SpringBoot/pom.mustache  | 125 +++++++++++++++++++++
 .../libraries/SpringBoot/queryParams.mustache      |   1 +
 .../servicecomb/toolkit/codegen/GeneratorTest.java |   1 +
 .../servicecomb/toolkit/cli/CodeGenerate.java      |   2 +-
 .../apache/servicecomb/toolkit/cli/CliTest.java    |   2 +-
 14 files changed, 234 insertions(+), 2 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index 668db24..686afaa 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -39,6 +39,8 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private static final String JAX_RS_LIBRARY = "JAX-RS";
 
+  private static final String SPRING_BOOT_LIBRARY = "SpringBoot";
+
   private String mainClassPackage;
 
   private String providerProject = "provider";
@@ -104,6 +106,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
     supportedLibraries.put(POJO_LIBRARY, "ServiceComb Server application using the pojo programming model.");
     supportedLibraries.put(JAX_RS_LIBRARY, "ServiceComb Server application using the jax-rs programming model.");
+    supportedLibraries.put(SPRING_BOOT_LIBRARY, "ServiceComb Server application using the SpringBoot programming model.");
 
     setLibrary(DEFAULT_LIBRARY);
 
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
new file mode 100755
index 0000000..2184ccb
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
@@ -0,0 +1,15 @@
+package {{mainClassPackage}};
+
+import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableServiceComb
+public class Application {
+
+  public static void main(String[] args) throws Exception {
+    System.setProperty("local.registry.file", "notExistJustForceLocal");
+    SpringApplication.run(Application.class, args);
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
new file mode 100755
index 0000000..33f5a4b
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
@@ -0,0 +1,31 @@
+package {{apiPackage}};
+
+import {{modelPackage}}.*;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import java.util.List;
+import java.util.Map;
+import static org.springframework.http.MediaType.*;
+
+@RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
+@RequestMapping(value = "/", produces = {APPLICATION_JSON_VALUE})
+{{#operations}}
+public class {{classname}} {
+
+  {{>operationMethod}}
+
+}
+{{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api_test.mustache
new file mode 100755
index 0000000..d0444c2
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api_test.mustache
@@ -0,0 +1,38 @@
+package {{package}};
+{{#imports}}import {{import}};
+{{/imports}}
+import java.util.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class {{classname}}Test {
+@Autowired
+private {{classname}} api;
+{{#operations}}
+    {{#operation}}
+        @Test
+        public void {{operationId}}Test() throws Exception {
+        {{#allParams}}
+        {{^isFile}}
+            {{{dataType}}} {{paramName}} = {{{example}}};
+        {{/isFile}}
+        {{#isFile}}
+            org.springframework.web.multipart.MultipartFile {{paramName}} = null;
+        {{/isFile}}
+        {{/allParams}}
+            ResponseEntity<{{>returnTypes}}> responseEntity = api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+            assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
+        }
+    {{/operation}}
+{{/operations}}
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache
new file mode 100755
index 0000000..5932bd1
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache
@@ -0,0 +1 @@
+{{#isBodyParam}}@RequestBody {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
new file mode 100755
index 0000000..336c14d
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
@@ -0,0 +1,2 @@
+{{#isFormParam}}{{#notFile}}
+@RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}})  {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache
new file mode 100755
index 0000000..7c3018b
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache
@@ -0,0 +1 @@
+{{#isHeaderParam}}@RequestHeader(value="{{paramName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
new file mode 100755
index 0000000..18b598c
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
@@ -0,0 +1,13 @@
+{{#operation}}
+
+  @RequestMapping(value = "{{path}}",
+    {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}
+    {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}
+    method = RequestMethod.{{httpMethod}})
+  public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
+    {{/hasMore}}{{/allParams}}) {
+      // do some magic!
+      return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
+  }
+
+{{/operation}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache
new file mode 100755
index 0000000..5152be0
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache
@@ -0,0 +1 @@
+{{#isPathParam}}@PathVariable("{{paramName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
new file mode 100755
index 0000000..3c487c7
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
@@ -0,0 +1,125 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <artifactId>{{artifactId}}</artifactId>
+    <groupId>{{groupId}}</groupId>
+    <version>{{artifactVersion}}</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>provider</artifactId>
+  <packaging>jar</packaging>
+  <name>provider</name>
+
+  <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>{{groupId}}</groupId>
+      <artifactId>model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>spring-boot-starter-provider</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-flowcontrol-qps</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-bizkeeper</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-tracing-zipkin</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>inspector</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate.validator</groupId>
+      <artifactId>hibernate-validator</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.validation</groupId>
+      <artifactId>validation-api</artifactId>
+      <version>2.0.1.Final</version>
+    </dependency>
+
+  </dependencies>
+
+  <!--for package and deploy-->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <classpathPrefix>lib/</classpathPrefix>
+              <!--change to your main class-->
+              <mainClass>${package}.Application</mainClass>
+            </manifest>
+            <manifestEntries>
+              <Class-Path>. </Class-Path>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/lib</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache
new file mode 100755
index 0000000..6ce8e14
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache
@@ -0,0 +1 @@
+{{#isQueryParam}}@RequestParam(value = "{{paramName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index 08f5ae3..e7ae3d4 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -40,6 +40,7 @@ public class GeneratorTest {
     generateCode("SpringMVC");
     generateCode("POJO");
     generateCode("JAX-RS");
+    generateCode("SpringBoot");
   }
 
   private void generateCode(String programmingModel) throws IOException, URISyntaxException {
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index 4034812..6700110 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -39,7 +39,7 @@ import io.swagger.codegen.config.CodegenConfigurator;
 public class CodeGenerate implements Runnable {
 
   @Option(name = {"-p", "--programming-model"}, title = "programming model", required = false,
-      description = "programming model, as SpringMVC, POJO or JAX-RS")
+      description = "programming model, as SpringMVC, POJO, JAX-RS, and SpringBoot")
   private String programmingModel;
 
   @Option(name = {"-m", "--microservice-framework"}, title = "framework",
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index b2a7664..cf0d047 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -31,7 +31,7 @@ public class CliTest {
   @Test
   public void generateServiceCombCodeFromSingleContract() throws IOException {
 
-    String[] programModels = new String[] {"SpringMVC", "POJO", "JAX-RS"};
+    String[] programModels = new String[] {"SpringMVC","POJO","JAX-RS","SpringBoot"};
     Path tempDir = Files.createTempDirectory(null);
     Arrays.stream(programModels).forEach(model -> {
       try {


[servicecomb-toolkit] 39/49: format pojo template

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 28840512143d950c9b94caf116a29bf35435e847
Author: kakulisen <18...@163.com>
AuthorDate: Mon Jun 3 15:20:49 2019 +0800

    format pojo template
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache  | 1 +
 .../src/main/resources/ServiceComb/libraries/POJO/api.mustache     | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
index 0465fc4..ab2d665 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
@@ -14,6 +14,7 @@ public class {{classname}}Consumer implements {{classname}}{
   private {{classname}} api;
 
 {{#operation}}
+
   @Override
   public {{>returnTypes}} {{operationId}}({{#allParams}}{{>consumer/queryParamsConsumer}}{{>consumer/pathParamsConsumer}}{{>consumer/headerParamsConsumer}}{{>consumer/bodyParamsConsumer}}{{>consumer/formParamsConsumer}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
 
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
index fad66ca..2a076fc 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
@@ -10,8 +10,9 @@ import {{modelPackage}}.*;
 
 {{#operations}}
 public interface {{classname}} {
-    {{#operation}}
-     public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
-    {{/operation}}
+ {{#operation}}
+
+  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+ {{/operation}}
 }
 {{/operations}}
\ No newline at end of file


[servicecomb-toolkit] 44/49: Support generating microservice projects according to service type option

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 0dbc4e8e50b80c8de55b0f0f63a13bdb696e575a
Author: kakulisen <18...@163.com>
AuthorDate: Thu Jun 6 18:47:24 2019 +0800

    Support generating microservice projects according to service type option
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../servicecomb/toolkit/cli/CodeGenerate.java      | 13 ++++++--
 .../toolkit/codegen/ProjectMetaConstant.java       | 23 ++++++++++++++
 .../toolkit/codegen/ServiceCombCodegen.java        | 37 ++++++++++++++++------
 3 files changed, 61 insertions(+), 12 deletions(-)

diff --git a/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index b46b67e..ddecb36 100755
--- a/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -31,6 +31,7 @@ import java.util.Collections;
 
 import org.apache.servicecomb.toolkit.GeneratorFactory;
 import org.apache.servicecomb.toolkit.CodeGenerator;
+import org.apache.servicecomb.toolkit.codegen.ProjectMetaConstant;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,11 +81,15 @@ public class CodeGenerate implements Runnable {
       description = "model package in generated microservice project")
   private String modelPackage;
 
+  @Option(name = {"--service-type"}, title = "service type",
+      description = "microservice type of generated microservice project. optional value is provider,consumer,all")
+  private String serviceType;
+
   @Override
   public void run() {
 
     CodegenConfigurator configurator = new CodegenConfigurator();
-    CodeGenerator codegenerator = GeneratorFactory.getGenerator(CodeGenerator.class,"default");
+    CodeGenerator codegenerator = GeneratorFactory.getGenerator(CodeGenerator.class, "default");
 
     configurator.setOutputDir(output)
         .setGroupId(groupId)
@@ -95,6 +100,8 @@ public class CodeGenerate implements Runnable {
         .setApiPackage(apiPackage)
         .setModelPackage(modelPackage);
 
+    configurator.addAdditionalProperty(ProjectMetaConstant.SERVICE_TYPE, serviceType);
+
     if (isNotEmpty(specFile)) {
 
       File contractFile = new File(specFile);
@@ -109,7 +116,7 @@ public class CodeGenerate implements Runnable {
                   .addAdditionalProperty("apiName", file.toFile().getName().split("\\.")[0]);
 
               try {
-                codegenerator.configure(Collections.singletonMap("configurator",configurator));
+                codegenerator.configure(Collections.singletonMap("configurator", configurator));
                 codegenerator.generate();
               } catch (RuntimeException e) {
                 throw new RuntimeException("Failed to generate code base on file " + file.toFile().getName());
@@ -124,7 +131,7 @@ public class CodeGenerate implements Runnable {
         }
       } else {
         configurator.setInputSpec(specFile);
-        codegenerator.configure(Collections.singletonMap("configurator",configurator));
+        codegenerator.configure(Collections.singletonMap("configurator", configurator));
         codegenerator.generate();
       }
 
diff --git a/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ProjectMetaConstant.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ProjectMetaConstant.java
new file mode 100644
index 0000000..748600f
--- /dev/null
+++ b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ProjectMetaConstant.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+public class ProjectMetaConstant {
+
+  public static final String SERVICE_TYPE = "serviceType";
+}
diff --git a/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index cbfbb46..ebecd71 100755
--- a/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -20,6 +20,7 @@ package org.apache.servicecomb.toolkit.codegen;
 import java.io.File;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 
 import io.swagger.codegen.CliOption;
 import io.swagger.codegen.CodegenConfig;
@@ -68,9 +69,6 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private String pojoApiImplTemplate = "apiImpl.mustache";
 
-  private int modelSwitch = 1;
-
-
   @Override
   public CodegenType getTag() {
     return CodegenType.SERVER;
@@ -184,17 +182,38 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     additionalProperties.put("microserviceName", microserviceName);
 
     processParentProjectOpts();
-    processProviderProjectOpts();
-    processConsumerOpts();
+    switch ((String) Optional.ofNullable(additionalProperties.get(ProjectMetaConstant.SERVICE_TYPE)).orElse("")) {
+      case "provider":
+        processProviderProjectOpts();
+        processPojoProvider();
+        break;
+      case "consumer":
+        processConsumerOpts();
+        processPojoConsumer();
+        apiTemplateFiles().remove("api.mustache");
+        break;
+      case "all":
+      default:
+        processProviderProjectOpts();
+        processPojoProvider();
+        processConsumerOpts();
+        processPojoConsumer();
+    }
     processModelProjectOpts();
-    processPojo();
   }
 
-  private void processPojo() {
+  private void processPojoProvider() {
     if (!POJO_LIBRARY.equals(getLibrary())) {
       return;
     }
     apiTemplateFiles.put(pojoApiImplTemplate, ".java");
+    additionalProperties.put("isPOJO", true);
+  }
+
+  private void processPojoConsumer() {
+    if (!POJO_LIBRARY.equals(getLibrary())) {
+      return;
+    }
     apiTemplateFiles.remove(apiConsumerTemplate);
     apiTemplateFiles.put(apiConsumerTemplateForPojo, "Consumer.java");
     additionalProperties.put("isPOJO", true);
@@ -242,8 +261,6 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
         resourcesFolder(providerProject),
         "microservice.yaml")
     );
-
-    apiTemplateFiles.put(apiConsumerTemplate, "Consumer.java");
   }
 
   private void processConsumerOpts() {
@@ -273,6 +290,8 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
         resourcesFolder(consumerProject),
         "microservice.yaml")
     );
+
+    apiTemplateFiles.put(apiConsumerTemplate, "Consumer.java");
   }
 
   @Override


[servicecomb-toolkit] 17/49: Add README.md

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 451fe886a9d284caa38bc56d8bf20c9f66df2e70
Author: MabinGo <bi...@huawei.com>
AuthorDate: Sat May 25 18:04:11 2019 +0800

    Add README.md
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 README.md                                          | 178 ++++++++++++++++++++-
 images/architecture.png                            | Bin 0 -> 11377 bytes
 images/workingprinciple.png                        | Bin 0 -> 50070 bytes
 .../toolkit/plugin/VerifyContractsMojo.java        |   4 +-
 4 files changed, 179 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index a934330..7b4a73d
--- a/README.md
+++ b/README.md
@@ -1,2 +1,178 @@
 # toolkit
-microservice development toolkit
+
+基于契约的微服务开发工具套件
+
+## 1 简介
+
+### 1.1 目标
+
+* 快速构建基于流行微服务框架和编程模型的微服务工程,并提供服务契约、代码、文档的一体化制作能力,帮助基于服务契约开发的用户在微服务转型阶段,降低微服务入门成本,聚焦业务开发,提升遗留系统重构、开发效率。
+
+### 1.2 功能
+
+* 代码提取服务契约
+
+  在基于SpringMVC/POJO/JAX-RS模型开发的应用中,一键生成符合OpenAPI规范的服务契约文件。
+
+* 服务契约生成微服务工程
+
+  输入符合OpenAPI规范的服务契约,一键生成以ServiceComb/SpringCloud/Swagger为底座,以及以SpringMVC/POJO/JAX-RS或SpringBoot为开发模型的微服务项目。
+
+* 服务契约与代码一致性校验
+
+  校验应用的实际实现(如数据和服务API)是否与达成共识的服务契约描述一致。
+
+* 服务契约/代码生成文档
+
+  输入符合OpenAPI规范的服务契约,一键生成html/word/pdf格式的文档。
+
+### 1.3 适用场景
+
+* 集成多厂商应用的企业
+
+  问题:厂商数据、服务标准不一致,开发语言、习惯、框架不一致,集成商难集成,企业难管控。
+
+  措施:通过统一定义的接口描述标准(服务契约),使用工具套件一键生成基于指定微服务框架的微服务工程,并且通过服务契约校验手段协同维护整体系统的一致性。以此协调多个开发团队,降低沟通成本且避免后期的混乱。
+
+* 遗留系统微服务化快速改造
+
+  问题:用户需要额外学习和理解微服务及相关框架后,再设计微服务工程,学习成本高。
+
+  措施:使用工具套件分析遗留应用提取服务契约,再一键生成基于指定微服务框架的微服务工程后,即可聚焦业务开发,减少用户对微服务框架的学习成本。
+
+## 2 设计
+
+### 2.1 主体架构
+
+![image](./images/architecture.png)
+
+### 2.2 工作原理
+
+![image](./images/workingprinciple.png)
+
+## 3 快速入门
+### 3.1 从源码构建工具和插件
+构建环境要求:
+
+* [Java 8](http://java.oracle.com)
+
+* [Apache maven 3.5.0 or greater](http://maven.apache.org/)
+
+```shell
+# 从github获取toolkit最新源码
+$ git clone https://github.com/MabinGo/toolkit.git
+$ cd toolkit
+
+# 构建打包
+$ mvn clean install
+```
+
+### 3.2 使用toolkit-cli工具
+可执行jar包位于toolkit/toolkit-cli/target目录下
+```shell
+$ java -jar toolkit-cli.jar help
+```
+#### 3.2.1 契约生成微服务工程
+```shell
+$ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
+```
+> codegenerate命令选项说明:
+* -m, --microservice-framework : 指定微服务框架,现支持ServiceComb  
+例:-m ServiceComb
+* -p, --programming-model : 指定编程模型,可选JAX-RS,POJO,SpringMVC,SpringBoot  
+例:-p SpringMvc
+* -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
+例:-i http://petstore.swagger.io/v2/swagger.json
+* -o, --output : 生成的项目代码输出路径  
+例:-o ./project
+* --group-id : 指定生成的项目的group id  
+例:--group-id com.demo
+* --artifact-id : 指定生成的项目的artifact id     
+例:--artifact-id springmvc-example
+* --artifact-version : 指定生成的项目的artifact version  
+例:--artifact-version 1.0.0
+
+#### 3.2.2 契约生成文档
+```shell
+$ java -jar toolkit-cli.jar  docgenerate -i swagger.yaml -o ./document
+```
+> docGenerate命令选项说明:
+* -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
+例:-i http://petstore.swagger.io/v2/swagger.json
+* -o, --output : 文档输出路径   
+例:-o ./document
+* -f, --format : 指定输出文档风格,现支持swagger-ui和asciidoc-html  
+例:-f swagger-ui
+
+### 3.3 使用toolkit-maven-plugin插件
+#### 3.3.1 配置
+在maven项目的pom文件中配置
+```xml
+<plugin>
+    <groupId>org.apache.servicecomb</groupId>
+    <artifactId>toolkit-maven-plugin</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <configuration>
+        <!-- 契约生成目录,默认contracts -->
+        <outputDir>contracts</outputDir>
+        <!-- 标准的契约放置的目录,默认sourceContracts  -->
+        <sourceContractsDir>sourceContracts</sourceContractsDir>  
+        <!-- 文档生成目录,默认build/doc -->
+        <docOutputDir>build/doc</docOutputDir>
+    </configuration>
+</plugin>
+```
+#### 3.3.2 从代码提取契约
+
+运行
+```shell
+mvn toolkit:generateContracts
+```
+
+配置项
+* outputDir : 生成的契约文件输出路径,默认contracts  
+例:
+```shell
+<outputDir>contracts</outputDir>
+```
+
+#### 3.3.3 从代码生成文档
+
+运行
+```shell
+mvn toolkit:generateDoc
+```
+
+配置项
+* outputDir : 生成的契约文件输出路径,默认contracts
+* docOutputDir : 生成的契约文档输出路径,默认build/doc
+
+例:
+```shell
+<outputDir>contracts</outputDir>
+<docOutputDir>build/doc</docOutputDir>
+```
+
+#### 3.3.4 契约校验
+
+运行
+```shell
+mvn toolkit:verifyContracts
+```
+
+配置项
+* outputDir : 生成的契约文件输出路径,默认当前目录下contracts目录
+* sourceContractsDir : 共识契约存放路径,默认当前目录下sourceContracts目录
+例:
+```xml
+<outputDir>contracts</outputDir>
+<sourceContractsDir>sourceContracts</sourceContractsDir>
+```
+
+## 4 反馈问题
+
+Bugs: [issues](https://github.com/MabinGo/toolkit/issues)
+
+## 5 参与开发
+
+PR: [Pull request](https://github.com/MabinGo/toolkit/pulls)
diff --git a/images/architecture.png b/images/architecture.png
new file mode 100755
index 0000000..edd2320
Binary files /dev/null and b/images/architecture.png differ
diff --git a/images/workingprinciple.png b/images/workingprinciple.png
new file mode 100755
index 0000000..6da3af3
Binary files /dev/null and b/images/workingprinciple.png differ
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
index 1617034..0ef19c4 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
@@ -73,11 +73,11 @@ public class VerifyContractsMojo extends AbstractMojo {
         ContractComparator contractComparator = new ContractComparator(new String(sourceSwagger), new String(swagger));
 
         if (!contractComparator.equals()) {
-          getLog().info("契约文件不匹配,差异如下");
+          getLog().info("contract is not matched, difference is as follows");
           getLog().info(sourceContractsDir + "/" + contractName + " vs " + outputDir + "/" + contractName);
           contractComparator.splitPrintToScreen();
         } else {
-          getLog().info("恭喜你,契约校验通过");
+          getLog().info("succee, contract verification passed");
         }
       });
     } catch (IOException e) {


[servicecomb-toolkit] 18/49: Add todo list

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 5db906488ddccff20702f3ff977196ac3e7a9aa5
Author: MabinGo <bi...@huawei.com>
AuthorDate: Sat May 25 19:45:37 2019 +0800

    Add todo list
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 README.md | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 7b4a73d..b140cc9 100755
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
 
 * 快速构建基于流行微服务框架和编程模型的微服务工程,并提供服务契约、代码、文档的一体化制作能力,帮助基于服务契约开发的用户在微服务转型阶段,降低微服务入门成本,聚焦业务开发,提升遗留系统重构、开发效率。
 
-### 1.2 功能
+### 1.2 特性
 
 * 代码提取服务契约
 
@@ -26,6 +26,18 @@
 
   输入符合OpenAPI规范的服务契约,一键生成html/word/pdf格式的文档。
 
+* Todo List
+
+  * 支持契约一键制作以SpringCloud等流行微服务框架为底座的微服务工程。
+
+  * 支持基于gradle的契约开发插件。
+
+  * 支持插件埋入eclipse。
+
+  * 支持word、pdf等流行格式文档。
+
+  * 支持契约增量生成代码。
+
 ### 1.3 适用场景
 
 * 集成多厂商应用的企业
@@ -132,7 +144,7 @@ mvn toolkit:generateContracts
 配置项
 * outputDir : 生成的契约文件输出路径,默认contracts  
 例:
-```shell
+```xml
 <outputDir>contracts</outputDir>
 ```
 
@@ -148,7 +160,7 @@ mvn toolkit:generateDoc
 * docOutputDir : 生成的契约文档输出路径,默认build/doc
 
 例:
-```shell
+```xml
 <outputDir>contracts</outputDir>
 <docOutputDir>build/doc</docOutputDir>
 ```


[servicecomb-toolkit] 19/49: remove warnings

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit e176fff398dd5f5cdbe93af4cab67fda2308d066
Author: kakulisen <18...@163.com>
AuthorDate: Mon May 27 15:02:42 2019 +0800

    remove warnings
    
    Signed-off-by: kakulisen <18...@163.com>
---
 toolkit-cli/pom.xml | 41 ++++++++++++++---------------------------
 1 file changed, 14 insertions(+), 27 deletions(-)

diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 0cc4219..8c6cb5b 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -69,38 +69,25 @@
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>2.4.1</version>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.5.5</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>org.apache.servicecomb.toolkit.cli.ToolkitMain</mainClass>
+            </manifest>
+          </archive>
+          <descriptorRefs>
+            <descriptorRef>jar-with-dependencies</descriptorRef>
+          </descriptorRefs>
+        </configuration>
         <executions>
           <execution>
+            <id>make-assembly</id>
             <phase>package</phase>
             <goals>
-              <goal>shade</goal>
+              <goal>single</goal>
             </goals>
-            <configuration>
-              <createDependencyReducedPom>false</createDependencyReducedPom>
-              <filters>
-                <filter>
-                  <artifact>*:*</artifact>
-                  <excludes>
-                    <exclude>META-INF/*.SF</exclude>
-                    <exclude>META-INF/*.DSA</exclude>
-                    <exclude>META-INF/*.RSA</exclude>
-                  </excludes>
-                </filter>
-              </filters>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.apache.servicecomb.toolkit.cli.ToolkitMain</mainClass>
-                </transformer>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
-                  <resource>META-INF/spring.handlers</resource>
-                </transformer>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
-                  <resource>META-INF/spring.schemas</resource>
-                </transformer>
-              </transformers>
-            </configuration>
           </execution>
         </executions>
       </plugin>


[servicecomb-toolkit] 27/49: fix unit test bug

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit c8b1a70b792be58e66f2f08085d79db02565ed13
Author: kakulisen <18...@163.com>
AuthorDate: Wed May 29 10:56:52 2019 +0800

    fix unit test bug
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../src/test/java/plugin/GenerateContractsMojoTest.java  |   2 +-
 .../classes/demo/Application.class                       | Bin 0 -> 745 bytes
 .../classes/demo/HelloEndPoint.class                     | Bin 0 -> 1243 bytes
 3 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
index f69c312..df9d780 100644
--- a/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/plugin/GenerateContractsMojoTest.java
@@ -51,7 +51,7 @@ public class GenerateContractsMojoTest {
     final MavenProject project = mock(MavenProject.class);
     given(project.getFile()).willReturn(pom);
     List<String> runtimeUrlPath = new ArrayList<>();
-    runtimeUrlPath.add(baseDir + "/target/classes");
+    runtimeUrlPath.add(baseDir + "/classes");
     given(project.getRuntimeClasspathElements()).willReturn(runtimeUrlPath);
 
     rule.setVariableValueToObject(generateContractsMojo, "project", project);
diff --git a/toolkit-maven-plugin/src/test/projects/project-generateContracts/classes/demo/Application.class b/toolkit-maven-plugin/src/test/projects/project-generateContracts/classes/demo/Application.class
new file mode 100644
index 0000000..df126b8
Binary files /dev/null and b/toolkit-maven-plugin/src/test/projects/project-generateContracts/classes/demo/Application.class differ
diff --git a/toolkit-maven-plugin/src/test/projects/project-generateContracts/classes/demo/HelloEndPoint.class b/toolkit-maven-plugin/src/test/projects/project-generateContracts/classes/demo/HelloEndPoint.class
new file mode 100644
index 0000000..c90473d
Binary files /dev/null and b/toolkit-maven-plugin/src/test/projects/project-generateContracts/classes/demo/HelloEndPoint.class differ


[servicecomb-toolkit] 26/49: Merge pull request #7 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit d865f8cb281c9c1b413ecb7fdc76c4dc0741f5c1
Merge: 584b8de f060c88
Author: Mabin <bi...@huawei.com>
AuthorDate: Tue May 28 16:11:45 2019 +0800

    Merge pull request #7 from kakulisen/master
    
    optimize logging

 .../apache/servicecomb/toolkit/common/ImmediateClassLoader.java    | 7 ++++++-
 .../servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java    | 6 +++++-
 .../main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java | 6 +++++-
 .../main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java  | 7 +++++--
 .../org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java | 5 ++++-
 5 files changed, 25 insertions(+), 6 deletions(-)


[servicecomb-toolkit] 42/49: Merge pull request #11 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 2e6f595e6909983845839467a4198f3159eaef4f
Merge: 8641598 30e4f00
Author: Mabin <bi...@huawei.com>
AuthorDate: Mon Jun 3 19:10:03 2019 +0800

    Merge pull request #11 from kakulisen/master
    
    Support generating SpringBoot consumer code

 .../toolkit/codegen/ServiceCombCodegen.java        |  10 +-
 .../consumer/springboot/Application.mustache       |  14 +++
 .../ServiceComb/consumer/springboot/pom.mustache   | 132 +++++++++++++++++++++
 .../libraries/SpringBoot/operationMethod.mustache  |   1 +
 4 files changed, 155 insertions(+), 2 deletions(-)


[servicecomb-toolkit] 24/49: Merge pull request #6 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 584b8de50bc480aa3d60c30bd1c7d475c1633774
Merge: f9e22e3 d48cd0b
Author: Mabin <bi...@huawei.com>
AuthorDate: Tue May 28 14:09:09 2019 +0800

    Merge pull request #6 from kakulisen/master
    
    add unit test code

 common/pom.xml                                     |   7 ++
 .../toolkit/common/TextCompareTest.java            | 116 +++++++++++++++++++++
 .../src/test/resources/compare/HelloEndPoint.yaml  |  75 +++++++++++++
 .../src/test/resources/compare/HelloEndPoint2.yaml |  75 +++++++++++++
 .../src/test/java/docgen/DocGeneratorTest.java     |  96 +++++++++++++++++
 .../src/test/resources/HelloEndPoint.yaml          |  38 +++++++
 toolkit-maven-plugin/pom.xml                       |  36 +++++++
 .../java/plugin/GenerateContractsDocMojoTest.java  |  53 ++++++++++
 .../java/plugin/GenerateContractsMojoTest.java     |  68 ++++++++++++
 .../projects/project-generateContracts/pom.xml     |  46 ++++++++
 .../projects/project-generateContractsDoc/pom.xml  |  46 ++++++++
 11 files changed, 656 insertions(+)


[servicecomb-toolkit] 47/49: Add some new description in README

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 93a6b4793bce9b6739b139ce6b9577b4a7335a8b
Author: kakulisen <18...@163.com>
AuthorDate: Tue Jun 11 11:41:09 2019 +0800

    Add some new description in README
    
    Signed-off-by: kakulisen <18...@163.com>
---
 README-ZH.md | 8 +++++++-
 README.md    | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/README-ZH.md b/README-ZH.md
index 4e961f6..74e8f6c 100755
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -107,12 +107,18 @@ $ java -jar toolkit-cli-{version}.jar  codegenerate -m ServiceComb -i swagger.ya
 例:--artifact-id springmvc-example
 * --artifact-version : 指定生成的项目的artifact version  
 例:--artifact-version 1.0.0
+* --api-package : 指定生成项目的api package
+例:--api-package com.demo.api
+* --model-package : 指定生成项目的model package
+例:--model-package com.demo.model
+* -t, --service-type : 指定生成的微服务项目的微服务类型。可选值为provider,consumer,all               
+例:--service-type provider  
 
 #### 3.2.2 契约生成文档
 ```shell
 $ java -jar toolkit-cli-{version}.jar docgenerate -i swagger.yaml -o ./document
 ```
-> **docGenerate** 命令选项说明:
+> **docgenerate** 命令选项说明:
 * -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
 例:-i http://petstore.swagger.io/v2/swagger.json
 * -o, --output : 文档输出路径   
diff --git a/README.md b/README.md
index 86558ba..fbf7e56 100755
--- a/README.md
+++ b/README.md
@@ -106,6 +106,12 @@ $ java -jar toolkit-cli-{version}.jar  codegenerate -m ServiceComb -i swagger.ya
 例:--artifact-id springmvc-example
 * --artifact-version. Specify the artifact version of the generated project.
 例:--artifact-version 1.0.0
+* --api-package : Specify the api package of the generated project.
+例:--api-package com.demo.api
+* --model-package : Specify the model package of the generated project.
+例:--model-package com.demo.model
+* -t, --service-type : Specify microservice type of generated microservice project. optional value is provider,consumer,all               
+例:--service-type provider  
 
 #### 3.2.2 Service contract generation document
 ```shell


[servicecomb-toolkit] 11/49: Optimize mustache template of code generation

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 0f8159efe63b67ef5703e1f06ca4a2e02ce94c17
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu May 23 21:11:46 2019 +0800

    Optimize mustache template of code generation
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../codegen/GetGenericClassTypeLambda.java}        |  70 +++---
 .../toolkit/codegen/ServiceCombCodegen.java        | 254 +++++++++++++++++++++
 .../codegen/ServiceCombProviderCodegen.java        | 151 ------------
 .../services/io.swagger.codegen.CodegenConfig      |   2 +-
 .../README.mustache                                |   0
 .../ServiceComb/consumer/Application.mustache      |  28 +++
 .../ServiceComb/consumer/apiConsumer.mustache      |  65 ++++++
 .../consumer/bodyParamsConsumer.mustache           |   1 +
 .../consumer/formParamsConsumer.mustache           |   2 +
 .../consumer/headerParamsConsumer.mustache         |   1 +
 .../consumer}/microservice.mustache                |  17 +-
 .../consumer/pathParamsConsumer.mustache           |   1 +
 .../resources/ServiceComb/consumer/pom.mustache    |  91 ++++++++
 .../consumer/queryParamsConsumer.mustache          |   1 +
 .../enumClass.mustache                             |   0
 .../enumOuterClass.mustache                        |   0
 .../libraries/SpringMVC/Application.mustache       |   0
 .../libraries/SpringMVC/api.mustache               |   4 +-
 .../libraries/SpringMVC/api_test.mustache          |   8 +-
 .../libraries/SpringMVC/bodyParams.mustache        |   0
 .../libraries/SpringMVC/formParams.mustache        |   0
 .../libraries/SpringMVC/headerParams.mustache      |   0
 .../libraries/SpringMVC/pathParams.mustache        |   0
 .../libraries/SpringMVC/pom.mustache               |  29 ++-
 .../libraries/SpringMVC/queryParams.mustache       |   0
 .../log4j2.mustache                                |   0
 .../model}/model.mustache                          |   0
 .../main/resources/ServiceComb/model/pom.mustache  |  41 ++++
 .../pojo.mustache                                  |   2 +-
 .../resources/ServiceComb/project/pom.mustache     |  63 +++++
 .../provider}/microservice.mustache                |   9 +-
 .../returnTypes.mustache                           |   0
 .../generatedAnnotation.mustache                   |   1 -
 .../typeInfoAnnotation.mustache                    |   7 -
 .../ServiceCombProvider/xmlAnnotation.mustache     |   6 -
 .../servicecomb/toolkit/codegen/GeneratorTest.java |  20 +-
 ...odegenTest.java => ServiceCombCodegenTest.java} |   6 +-
 .../servicecomb/toolkit/cli/CodeGenerate.java      |   2 +-
 .../apache/servicecomb/toolkit/cli/CliTest.java    |   6 +-
 39 files changed, 632 insertions(+), 256 deletions(-)

diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java
similarity index 60%
copy from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java
copy to code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java
index 72cd210..73cdb04 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java
@@ -1,33 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.codegen;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import io.swagger.codegen.CodegenConfig;
-import io.swagger.codegen.CodegenConfigLoader;
-
-public class ServiceCombProviderCodegenTest {
-
-  @Test
-  public void loadImpl() {
-    CodegenConfig codegenConfig = CodegenConfigLoader.forName("ServiceCombProvider");
-    Assert.assertEquals(ServiceCombProviderCodegen.class, codegenConfig.getClass());
-  }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import com.samskivert.mustache.Mustache;
+import com.samskivert.mustache.Template;
+
+
+public class GetGenericClassTypeLambda implements Mustache.Lambda {
+  @Override
+  public void execute(Template.Fragment fragment, Writer writer) throws IOException {
+    String text = fragment.execute();
+    if (text.contains("<")) {
+      String className = text.substring(0, text.indexOf("<"));
+      text = "(Class<" + text + ">)(Class)" + className;
+    }
+    writer.write(text);
+  }
+}
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
new file mode 100755
index 0000000..c0ded7c
--- /dev/null
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.codegen;
+
+import java.io.File;
+import java.util.Map;
+
+import io.swagger.codegen.CliOption;
+import io.swagger.codegen.CodegenConfig;
+import io.swagger.codegen.CodegenConstants;
+import io.swagger.codegen.CodegenModel;
+import io.swagger.codegen.CodegenProperty;
+import io.swagger.codegen.CodegenType;
+import io.swagger.codegen.SupportingFile;
+import io.swagger.codegen.languages.AbstractJavaCodegen;
+import io.swagger.codegen.languages.SpringCodegen;
+import io.swagger.codegen.mustache.CamelCaseLambda;
+
+public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenConfig {
+
+  private static final String DEFAULT_LIBRARY = "SpringMVC";
+
+
+  private String mainClassPackage;
+
+  private String providerProject = "provider";
+
+  private String consumerProject = "consumer";
+
+  private String modelProject = "model";
+
+  private String applicationId = "defaultApp";
+
+  private String microserviceName = "defaultService";
+
+  private String consumerTemplateFolder = "consumer";
+
+  private String providerTemplateFolder = "provider";
+
+  private String modelTemplateFolder = "model";
+
+  private String apiConsumerTemplate = consumerTemplateFolder + "/apiConsumer.mustache";
+
+  private String modelConsumerTemplate = consumerTemplateFolder + "/model.mustache";
+
+
+  private int modelSwitch = 1;
+
+
+  @Override
+  public CodegenType getTag() {
+    return CodegenType.SERVER;
+  }
+
+  @Override
+  public String getName() {
+    return "ServiceComb";
+  }
+
+  @Override
+  public String getHelp() {
+    return "Generates a ServiceComb server library.";
+  }
+
+  public ServiceCombCodegen() {
+    super();
+
+    outputFolder = "generated-code/ServiceComb";
+
+    modelDocTemplateFiles.remove("model_doc.mustache");
+    apiDocTemplateFiles.remove("api_doc.mustache");
+    apiTestTemplateFiles.remove("api_test.mustache");
+
+    embeddedTemplateDir = templateDir = "ServiceComb";
+    modelTemplateFiles.put(modelTemplateFolder + "/model.mustache", ".java");
+    modelTemplateFiles.remove("model.mustache");
+
+    groupId = "org.apache.servicecomb";
+    artifactId = "example";
+
+    apiPackage = groupId + ".example.controller";
+    modelPackage = groupId + ".example.model";
+    mainClassPackage = groupId + ".example";
+
+    supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
+
+    setLibrary(DEFAULT_LIBRARY);
+
+    CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
+    library.setDefault(DEFAULT_LIBRARY);
+    library.setEnum(supportedLibraries);
+    library.setDefault(DEFAULT_LIBRARY);
+    cliOptions.add(library);
+  }
+
+  @Override
+  public String modelFileFolder() {
+    return outputFolder + "/" + modelProject + "/" + sourceFolder + "/" + modelPackage().replace('.', '/');
+  }
+
+  @Override
+  public String apiFileFolder() {
+    return outputFolder + "/" + providerProject + "/" + sourceFolder + "/" + apiPackage().replace('.', '/');
+  }
+
+  @Override
+  public String apiFilename(String templateName, String tag) {
+    if (apiConsumerTemplate.equals(templateName)) {
+      String suffix = apiTemplateFiles().get(templateName);
+      return apiConsumerFolder() + File.separator + toApiFilename(tag) + suffix;
+    }
+    return super.apiFilename(templateName, tag);
+  }
+
+  private String apiConsumerFolder() {
+    return outputFolder + "/" + consumerProject + "/" + sourceFolder + "/" + apiPackage().replace('.', '/');
+  }
+
+  @Override
+  public void processOpts() {
+
+    super.processOpts();
+
+    importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
+    additionalProperties.put("dateLibrary", "java8");
+    additionalProperties.put("mainClassPackage", mainClassPackage);
+    additionalProperties.put("camelcase", new CamelCaseLambda());
+    additionalProperties.put("getGenericClassType", new GetGenericClassTypeLambda());
+    additionalProperties.put("applicationId", applicationId);
+    additionalProperties.put("microserviceName", microserviceName);
+
+    processParentProjectOpts();
+    processProviderProjectOpts();
+    processConsumerOpts();
+    processModelProjectOpts();
+  }
+
+  @Override
+  public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
+    super.postProcessModelProperty(model, property);
+    model.imports.remove("ApiModelProperty");
+    model.imports.remove("ApiModel");
+  }
+
+  private void processModelProjectOpts() {
+    supportingFiles.add(new SupportingFile("model/pom.mustache",
+        modelProject,
+        "pom.xml")
+    );
+  }
+
+  private void processParentProjectOpts() {
+
+    supportingFiles.add(new SupportingFile("project/pom.mustache",
+        "",
+        "pom.xml")
+    );
+  }
+
+  private void processProviderProjectOpts() {
+    supportingFiles.add(new SupportingFile("pom.mustache",
+        providerProject,
+        "pom.xml")
+    );
+
+    supportingFiles.add(new SupportingFile("README.mustache",
+        providerProject,
+        "README.md")
+    );
+
+    supportingFiles.add(new SupportingFile("Application.mustache",
+        mainClassFolder(providerProject),
+        "Application.java")
+    );
+
+    supportingFiles.add(new SupportingFile("log4j2.mustache",
+        resourcesFolder(providerProject),
+        "log4j2.xml")
+    );
+    supportingFiles.add(new SupportingFile(providerTemplateFolder + "/microservice.mustache",
+        resourcesFolder(providerProject),
+        "microservice.yaml")
+    );
+    apiTemplateFiles.put(apiConsumerTemplate, "Consumer.java");
+  }
+
+  private void processConsumerOpts() {
+
+    supportingFiles.add(new SupportingFile(consumerTemplateFolder + "/pom.mustache",
+        consumerProject,
+        "pom.xml")
+    );
+
+    supportingFiles.add(new SupportingFile(consumerTemplateFolder + "/Application.mustache",
+        mainClassFolder(consumerProject),
+        "Application.java")
+    );
+
+    supportingFiles.add(new SupportingFile(consumerTemplateFolder + "/microservice.mustache",
+        resourcesFolder(consumerProject),
+        "microservice.yaml")
+    );
+  }
+
+  @Override
+  public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
+    objs = super.postProcessModelsEnum(objs);
+    SpringCodegen springCodegen = new SpringCodegen();
+    return springCodegen.postProcessModelsEnum(objs);
+  }
+
+  @Override
+  public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
+    SpringCodegen springCodegen = new SpringCodegen();
+    return springCodegen.postProcessOperations(objs);
+  }
+
+  @Override
+  public String toApiName(String name) {
+    if (name.length() == 0) {
+      return "DefaultController";
+    }
+
+    String apiName = (String) additionalProperties.get("apiName");
+    if (apiName != null) {
+      return apiName;
+    }
+
+    return initialCaps(name) + "Controller";
+  }
+
+  private String mainClassFolder(String projectPath) {
+    return projectPath + File.separator + sourceFolder + File.separator + mainClassPackage.replace(".", File.separator);
+  }
+
+  private String resourcesFolder(String projectPath) {
+    return projectPath + File.separator + projectFolder + File.separator + "resources";
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
deleted file mode 100755
index 4a39fc0..0000000
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.codegen;
-
-import java.io.File;
-import java.util.Map;
-
-import io.swagger.codegen.CliOption;
-import io.swagger.codegen.CodegenConfig;
-import io.swagger.codegen.CodegenConstants;
-import io.swagger.codegen.CodegenType;
-import io.swagger.codegen.SupportingFile;
-import io.swagger.codegen.languages.AbstractJavaCodegen;
-import io.swagger.codegen.languages.SpringCodegen;
-import io.swagger.codegen.mustache.CamelCaseLambda;
-
-public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements CodegenConfig {
-
-  private static final String DEFAULT_LIBRARY = "SpringMVC";
-
-  private String resourcesFolder = projectFolder + File.separator + "resources";
-
-  private String mainClassPackage;
-
-
-  @Override
-  public CodegenType getTag() {
-    return CodegenType.SERVER;
-  }
-
-  @Override
-  public String getName() {
-    return "ServiceCombProvider";
-  }
-
-  @Override
-  public String getHelp() {
-    return "Generates a ServiceComb server library.";
-  }
-
-  public ServiceCombProviderCodegen() {
-    super();
-
-    outputFolder = "generated-code/ServiceCombProvider";
-
-    modelDocTemplateFiles.remove("model_doc.mustache");
-    apiDocTemplateFiles.remove("api_doc.mustache");
-    apiTestTemplateFiles.remove("api_test.mustache");
-
-    embeddedTemplateDir = templateDir = "ServiceCombProvider";
-
-    groupId = "org.apache.servicecomb";
-    artifactId = "example";
-
-    apiPackage = groupId + ".example.controller";
-    modelPackage = groupId + ".example.model";
-    mainClassPackage = groupId + ".example";
-
-    supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model.");
-
-    setLibrary(DEFAULT_LIBRARY);
-
-    CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
-    library.setDefault(DEFAULT_LIBRARY);
-    library.setEnum(supportedLibraries);
-    library.setDefault(DEFAULT_LIBRARY);
-    cliOptions.add(library);
-  }
-
-  @Override
-  public void processOpts() {
-
-    super.processOpts();
-
-    importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
-    additionalProperties.put("dateLibrary", "java8");
-    additionalProperties.put("jackson", "true");
-    additionalProperties.put("mainClassPackage", mainClassPackage);
-    additionalProperties.put("camelcase", new CamelCaseLambda());
-
-    supportingFiles.add(new SupportingFile("pom.mustache",
-        "",
-        "pom.xml")
-    );
-    supportingFiles.add(new SupportingFile("README.mustache",
-        "",
-        "README.md")
-    );
-
-
-    supportingFiles.add(new SupportingFile("Application.mustache",
-        mainClassFolder(),
-        "Application.java")
-    );
-
-    supportingFiles.add(new SupportingFile("log4j2.mustache",
-        resourcesFolder,
-        "log4j2.xml")
-    );
-    supportingFiles.add(new SupportingFile("microservice.mustache",
-        resourcesFolder,
-        "microservice.yaml")
-    );
-  }
-
-  @Override
-  public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
-    objs = super.postProcessModelsEnum(objs);
-    SpringCodegen springCodegen = new SpringCodegen();
-    return springCodegen.postProcessModelsEnum(objs);
-  }
-
-  @Override
-  public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
-    SpringCodegen springCodegen = new SpringCodegen();
-    return springCodegen.postProcessOperations(objs);
-  }
-
-  @Override
-  public String toApiName(String name) {
-    if (name.length() == 0) {
-      return "DefaultController";
-    }
-
-    String apiName = (String) additionalProperties.get("apiName");
-    if (apiName != null) {
-      return apiName;
-    }
-
-    return initialCaps(name) + "Controller";
-  }
-
-  private String mainClassFolder() {
-    return sourceFolder + File.separator + mainClassPackage.replace(".", File.separator);
-  }
-}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
index 9e194db..75798aa 100755
--- a/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
+++ b/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.servicecomb.toolkit.codegen.ServiceCombProviderCodegen
+org.apache.servicecomb.toolkit.codegen.ServiceCombCodegen
diff --git a/code-generator/src/main/resources/ServiceCombProvider/README.mustache b/code-generator/src/main/resources/ServiceComb/README.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/README.mustache
rename to code-generator/src/main/resources/ServiceComb/README.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache b/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache
new file mode 100755
index 0000000..2ee4969
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache
@@ -0,0 +1,28 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package {{mainClassPackage}};
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+
+public class Application {
+
+    public static void main(String[] args) throws Exception {
+        System.setProperty("local.registry.file", "notExistJustForceLocal");
+        BeanUtils.init();
+    }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
new file mode 100755
index 0000000..109d0f9
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
@@ -0,0 +1,65 @@
+package {{apiPackage}};
+
+import {{modelPackage}}.*;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
+import org.springframework.util.MultiValueMap;
+import org.springframework.http.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import static org.springframework.http.MediaType.*;
+
+{{#operations}}
+public class {{classname}}Consumer {
+    {{#operation}}
+
+     public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>consumer/queryParamsConsumer}}{{>consumer/pathParamsConsumer}}{{>consumer/headerParamsConsumer}}{{>consumer/bodyParamsConsumer}}{{>consumer/formParamsConsumer}}{{#hasMore}},
+        {{/hasMore}}{{/allParams}}) {
+
+        Map<String, Object> params = new HashMap<>();
+        HttpEntity httpEntity = null;
+        HttpHeaders headers = new HttpHeaders();
+ {{#allParams}}
+      {{#isPathParam}}  params.put("{{paramName}}",{{paramName}}); {{/isPathParam}}
+      {{#isQueryParam}} params.put("{{paramName}}",{{paramName}});  {{/isQueryParam}}
+      {{#isHeaderParam}}
+        headers.add("{{paramName}}",{{paramName}});
+      {{/isHeaderParam}}
+      {{#isFormParam}}
+          {{#notFile}}
+        httpEntity =  new HttpEntity<{{{dataType}}}>({{paramName}}, headers);
+          {{/notFile}}
+          {{#isFile}}
+        httpEntity =  new HttpEntity<MultipartFile>({{paramName}}, headers);
+          {{/isFile}}
+          {{/isFormParam}}
+      {{#isBodyParam}}
+        httpEntity =  new HttpEntity<{{{dataType}}}>({{paramName}}, headers);
+      {{/isBodyParam}}
+
+ {{/allParams}}
+        RestTemplate restTemplate = RestTemplateBuilder.create();
+
+        ResponseEntity<{{>returnTypes}}> result = restTemplate.exchange("cse://{{microserviceName}}/{{path}}",HttpMethod.{{httpMethod}},httpEntity,{{#getGenericClassType}}{{>returnTypes}}{{/getGenericClassType}}.class,params);
+
+        // do something
+        return result;
+    }
+
+    {{/operation}}
+    }
+{{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache
new file mode 100755
index 0000000..bb1d6ff
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache
@@ -0,0 +1 @@
+{{#isBodyParam}} {{{dataType}}} {{paramName}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
new file mode 100755
index 0000000..6f911b1
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
@@ -0,0 +1,2 @@
+{{#isFormParam}}{{#notFile}}
+ {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache
new file mode 100755
index 0000000..edeeb85
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache
@@ -0,0 +1 @@
+{{#isHeaderParam}} {{{dataType}}} {{paramName}}{{/isHeaderParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache b/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
similarity index 73%
copy from code-generator/src/main/resources/ServiceCombProvider/microservice.mustache
copy to code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
index 67ad88a..72d38b6 100755
--- a/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
@@ -15,29 +15,18 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-#More details can be found :
-# 1.http://servicecomb.apache.org/users/service-definition/
-# 2.http://servicecomb.apache.org/users/service-configurations/
-# 3.http://servicecomb.apache.org/users/communicate-protocol/
-
 #Indicates an application name
-APPLICATION_ID: business
+APPLICATION_ID: {{applicationId}}
 service_description:
 #Indicates a microservice name
 #The microservice name should be unique within an application.
 #The name can contain digits, uppercase and lowercase letters, hyphens(-), underscores(_), and periods(.); and can neither start nor end with punctuations.
 #The naming rule is as follows: ^[a-zA-Z0-9]+$|^[a-zA-Z0-9][a-zA-Z0-9_-.]*[a-zA-Z0-9]$.
-  name: business-service
+  name: {{microserviceName}}-consumer
 #Indicates a service version
   version: 1.0.0
 servicecomb:
   service:
   #Specifies the service center IP address.
     registry:
-      address: http://127.0.0.1:30100
-  #Specifies the rest transport listening IP address.
-  rest:
-    address: 0.0.0.0:8080
-  #Specifies the highway transport listening IP address.
-  highway:
-    address: 0.0.0.0:7070
\ No newline at end of file
+      address: http://127.0.0.1:30100
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache
new file mode 100755
index 0000000..9a0630b
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache
@@ -0,0 +1 @@
+{{#isPathParam}} {{{dataType}}} {{paramName}}{{/isPathParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache b/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
new file mode 100755
index 0000000..32991a8
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
@@ -0,0 +1,91 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>{{groupId}}</groupId>
+  <artifactId>consumer</artifactId>
+  <packaging>jar</packaging>
+  <name>{{artifactId}}</name>
+  <version>{{artifactVersion}}</version>
+
+  <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+      <dependency>
+          <groupId>{{groupId}}</groupId>
+          <artifactId>model</artifactId>
+          <version>${project.version}</version>
+      </dependency>
+
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>handler-bizkeeper</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>handler-loadbalance</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>handler-flowcontrol-qps</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>provider-pojo</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicecomb</groupId>
+          <artifactId>provider-springmvc</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-slf4j-impl</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-api</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-core</artifactId>
+      </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache
new file mode 100755
index 0000000..ff79730
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache
@@ -0,0 +1 @@
+{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/enumClass.mustache b/code-generator/src/main/resources/ServiceComb/enumClass.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/enumClass.mustache
rename to code-generator/src/main/resources/ServiceComb/enumClass.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/enumOuterClass.mustache b/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/enumOuterClass.mustache
rename to code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/Application.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/Application.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
similarity index 96%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
index d303827..5ef2b31 100755
--- a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
@@ -22,7 +22,7 @@ import static org.springframework.http.MediaType.*;
 
 @RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
 @RequestMapping(value = "/", produces = {APPLICATION_JSON_VALUE})
-{{>generatedAnnotation}}
+
 {{#operations}}
 public class {{classname}} {
   {{#operation}}
@@ -33,7 +33,7 @@ public class {{classname}} {
     method = RequestMethod.{{httpMethod}})
   public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
     {{/hasMore}}{{/allParams}}) {
-      // do some magic!
+      // do something
       return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
   }
 
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api_test.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
similarity index 92%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api_test.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
index 1633203..8d2d3a2 100755
--- a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api_test.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api_test.mustache
@@ -72,14 +72,14 @@ public class {{classname}}ContractTest {
     }
 
     private void doTest(String path, String json) throws IOException {
-      ConsumerClient consumerClient = new ConsumerClient(mockTestProvider.getUrl());
-      consumerClient.options("/second");
+      Consumer consumer = new Consumer(mockTestProvider.getUrl());
+      consumer.options("/second");
       try {
-        consumerClient.getAsMap(path, "");
+        consumer.getAsMap(path, "");
       } catch (IOException e) {
       }
       try {
-        new ConsumerClient(mockTestProvider2.getUrl()).putAsMap("/", json);
+        new Consumer(mockTestProvider2.getUrl()).putAsMap("/", json);
       } catch (IOException e) {
       }
     }
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/bodyParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/bodyParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/bodyParams.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/bodyParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/formParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/formParams.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/headerParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/headerParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/headerParams.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/headerParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pathParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pathParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pathParams.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pathParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
similarity index 82%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pom.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
index c119ee1..c0a4aad 100755
--- a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
@@ -1,29 +1,28 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <artifactId>{{artifactId}}</artifactId>
+    <groupId>{{groupId}}</groupId>
+    <version>{{artifactVersion}}</version>
+  </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>{{groupId}}</groupId>
-  <artifactId>{{artifactId}}</artifactId>
+  <artifactId>provider</artifactId>
   <packaging>jar</packaging>
   <name>{{artifactId}}</name>
-  <version>{{artifactVersion}}</version>
 
   <properties>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       <java-chassis.version>1.2.0</java-chassis.version>
   </properties>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.apache.servicecomb</groupId>
-        <artifactId>java-chassis-dependencies</artifactId>
-        <version>${java-chassis.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
+
+    <dependency>
+      <groupId>{{groupId}}</groupId>
+      <artifactId>model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>transport-rest-vertx</artifactId>
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/queryParams.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/queryParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/queryParams.mustache
rename to code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/queryParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/log4j2.mustache b/code-generator/src/main/resources/ServiceComb/log4j2.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/log4j2.mustache
rename to code-generator/src/main/resources/ServiceComb/log4j2.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/model.mustache b/code-generator/src/main/resources/ServiceComb/model/model.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/model.mustache
rename to code-generator/src/main/resources/ServiceComb/model/model.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/model/pom.mustache b/code-generator/src/main/resources/ServiceComb/model/pom.mustache
new file mode 100755
index 0000000..d52c176
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/model/pom.mustache
@@ -0,0 +1,41 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <artifactId>{{artifactId}}</artifactId>
+    <groupId>{{groupId}}</groupId>
+    <version>{{artifactVersion}}</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>model</artifactId>
+  <packaging>jar</packaging>
+  <name>{{artifactId}}</name>
+
+  <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencies>
+      {{^isPOJO}}
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-web</artifactId>
+      </dependency>
+      {{/isPOJO}}
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/pojo.mustache b/code-generator/src/main/resources/ServiceComb/pojo.mustache
similarity index 94%
rename from code-generator/src/main/resources/ServiceCombProvider/pojo.mustache
rename to code-generator/src/main/resources/ServiceComb/pojo.mustache
index 5c3f7f3..ee0aca9 100755
--- a/code-generator/src/main/resources/ServiceCombProvider/pojo.mustache
+++ b/code-generator/src/main/resources/ServiceComb/pojo.mustache
@@ -2,7 +2,7 @@
  * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
  */
 {{#useBeanValidation}}@Validated{{/useBeanValidation}}
-{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
+{{#discriminator}}{{/discriminator}}
 public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
 {{#serializableModel}}
   private static final long serialVersionUID = 1L;
diff --git a/code-generator/src/main/resources/ServiceComb/project/pom.mustache b/code-generator/src/main/resources/ServiceComb/project/pom.mustache
new file mode 100755
index 0000000..bca8ce9
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/project/pom.mustache
@@ -0,0 +1,63 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>{{groupId}}</groupId>
+    <artifactId>{{artifactId}}</artifactId>
+    <packaging>pom</packaging>
+    <name>{{artifactId}}</name>
+    <version>{{artifactVersion}}</version>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <java-chassis.version>1.2.0</java-chassis.version>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <modules>
+        <module>provider</module>
+        <module>consumer</module>
+        <module>model</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.servicecomb</groupId>
+                <artifactId>java-chassis-dependencies</artifactId>
+                <version>${java-chassis.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <version>0.13</version>
+                <configuration>
+                    <excludes>
+                        <exclude>.travis.yml</exclude>
+                        <exclude>**/*.md</exclude>
+                        <exclude>**/target/*</exclude>
+                        <!-- Skip the ssl configuration files -->
+                        <exculde>**/resources/ssl/**</exculde>
+                        <!-- Skip the protobuf files -->
+                        <exclude>**/*.proto</exclude>
+                        <!-- Skip the idl files -->
+                        <exclude>**/*.idl</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache b/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
similarity index 83%
rename from code-generator/src/main/resources/ServiceCombProvider/microservice.mustache
rename to code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
index 67ad88a..fba2e77 100755
--- a/code-generator/src/main/resources/ServiceCombProvider/microservice.mustache
+++ b/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
@@ -15,19 +15,14 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-#More details can be found :
-# 1.http://servicecomb.apache.org/users/service-definition/
-# 2.http://servicecomb.apache.org/users/service-configurations/
-# 3.http://servicecomb.apache.org/users/communicate-protocol/
-
 #Indicates an application name
-APPLICATION_ID: business
+APPLICATION_ID: {{applicationId}}
 service_description:
 #Indicates a microservice name
 #The microservice name should be unique within an application.
 #The name can contain digits, uppercase and lowercase letters, hyphens(-), underscores(_), and periods(.); and can neither start nor end with punctuations.
 #The naming rule is as follows: ^[a-zA-Z0-9]+$|^[a-zA-Z0-9][a-zA-Z0-9_-.]*[a-zA-Z0-9]$.
-  name: business-service
+  name: {{microserviceName}}
 #Indicates a service version
   version: 1.0.0
 servicecomb:
diff --git a/code-generator/src/main/resources/ServiceCombProvider/returnTypes.mustache b/code-generator/src/main/resources/ServiceComb/returnTypes.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/returnTypes.mustache
rename to code-generator/src/main/resources/ServiceComb/returnTypes.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/generatedAnnotation.mustache b/code-generator/src/main/resources/ServiceCombProvider/generatedAnnotation.mustache
deleted file mode 100755
index 49110fc..0000000
--- a/code-generator/src/main/resources/ServiceCombProvider/generatedAnnotation.mustache
+++ /dev/null
@@ -1 +0,0 @@
-@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/typeInfoAnnotation.mustache b/code-generator/src/main/resources/ServiceCombProvider/typeInfoAnnotation.mustache
deleted file mode 100755
index 09be1ca..0000000
--- a/code-generator/src/main/resources/ServiceCombProvider/typeInfoAnnotation.mustache
+++ /dev/null
@@ -1,7 +0,0 @@
-{{#jackson}}
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{discriminator}}", visible = true )
-@JsonSubTypes({
-  {{#children}}
-  @JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
-  {{/children}}
-}){{/jackson}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceCombProvider/xmlAnnotation.mustache b/code-generator/src/main/resources/ServiceCombProvider/xmlAnnotation.mustache
deleted file mode 100755
index 03586da..0000000
--- a/code-generator/src/main/resources/ServiceCombProvider/xmlAnnotation.mustache
+++ /dev/null
@@ -1,6 +0,0 @@
-{{#withXml}}
-{{#jackson}}
-@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
-{{/jackson}}
-@XmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
-@XmlAccessorType(XmlAccessType.FIELD){{/withXml}}
\ No newline at end of file
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index e94cea4..e011c7b 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -35,14 +35,20 @@ import io.swagger.codegen.config.CodegenConfigurator;
 public class GeneratorTest {
 
   @Test
-  public void generateCode() throws IOException, URISyntaxException {
+  public void generateProgrammingModels() throws IOException, URISyntaxException {
+
+    generateCode("SpringMVC");
+  }
+
+  private void generateCode(String programmingModel) throws IOException, URISyntaxException {
 
     Path tempDir = Files.createTempDirectory(null);
     Path specFilePath = Paths.get(GeneratorTest.class.getClassLoader().getResource("swagger.yaml").toURI());
     CodegenConfigurator configurator = new CodegenConfigurator();
 
-    configurator.setLang("ServiceCombProvider");
-    configurator.setOutputDir(tempDir.toFile().getCanonicalPath() + "/ServiceCombProvider");
+    configurator.setLang("ServiceComb");
+    configurator.setLibrary(programmingModel);
+    configurator.setOutputDir(tempDir.toFile().getCanonicalPath() + "/ServiceComb");
     configurator.setInputSpec(specFilePath.toFile().getCanonicalPath());
     DefaultCodeGenerator codeGenerator = new DefaultCodeGenerator();
     List<File> generatedFiles = codeGenerator.opts(configurator).generate();
@@ -50,11 +56,11 @@ public class GeneratorTest {
     Object internalGenerator = ReflectUtils.getProperty(codeGenerator, "generator");
     Assert.assertEquals(DefaultGenerator.class, internalGenerator.getClass());
     Object swaggerCodegenConfig = ReflectUtils.getProperty(internalGenerator, "config");
-    Assert.assertEquals(ServiceCombProviderCodegen.class, swaggerCodegenConfig.getClass());
-    Assert.assertEquals("ServiceCombProvider", ((ServiceCombProviderCodegen) swaggerCodegenConfig).getName());
-    Assert.assertEquals(CodegenType.SERVER, ((ServiceCombProviderCodegen) swaggerCodegenConfig).getTag());
+    Assert.assertEquals(ServiceCombCodegen.class, swaggerCodegenConfig.getClass());
+    Assert.assertEquals("ServiceComb", ((ServiceCombCodegen) swaggerCodegenConfig).getName());
+    Assert.assertEquals(CodegenType.SERVER, ((ServiceCombCodegen) swaggerCodegenConfig).getTag());
 
-    Assert.assertEquals(14, generatedFiles.size());
+    Assert.assertTrue(0 < generatedFiles.size());
     tempDir.toFile().deleteOnExit();
   }
 }
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
similarity index 87%
rename from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java
rename to code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
index 72cd210..5846136 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegenTest.java
+++ b/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
@@ -23,11 +23,11 @@ import org.junit.Test;
 import io.swagger.codegen.CodegenConfig;
 import io.swagger.codegen.CodegenConfigLoader;
 
-public class ServiceCombProviderCodegenTest {
+public class ServiceCombCodegenTest {
 
   @Test
   public void loadImpl() {
-    CodegenConfig codegenConfig = CodegenConfigLoader.forName("ServiceCombProvider");
-    Assert.assertEquals(ServiceCombProviderCodegen.class, codegenConfig.getClass());
+    CodegenConfig codegenConfig = CodegenConfigLoader.forName("ServiceComb");
+    Assert.assertEquals(ServiceCombCodegen.class, codegenConfig.getClass());
   }
 }
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index c9bb03b..2e5da64 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -44,7 +44,7 @@ public class CodeGenerate implements Runnable {
 
   @Option(name = {"-m", "--microservice-framework"}, title = "language",
       description = "microservice-framework")
-  private String framework = "ServiceCombProvider";
+  private String framework = "ServiceComb";
 
   @Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
       description = "location of the OpenAPI specification file, as URL or file (required)")
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index c49b5d3..35885ad 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -40,7 +40,7 @@ public class CliTest {
         String[] args = new String[] {
             "generate",
             "-m",
-            "ServiceCombProvider",
+            "ServiceComb",
             "-i",
             Paths.get("./src/test/resources/swagger.yaml").toFile().getCanonicalPath(),
             "-o",
@@ -91,13 +91,13 @@ public class CliTest {
   public void generateCodeFromMultiContract() throws IOException {
 
     Path tempDir = Files.createTempDirectory(null);
-    Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/ServiceCombProvider");
+    Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/ServiceComb");
     String[] args = new String[] {
         "generate",
         "-i",
         Paths.get("./src/test/resources/contracts").toFile().getCanonicalPath(),
         "--artifact-id",
-        "ServiceCombProvider",
+        "ServiceComb",
         "--group-id",
         "org.apache.servicecomb.demo",
         "--artifact-version",


[servicecomb-toolkit] 29/49: Update to use spring-boot-maven-plugin to repackage jar

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit cbff1dd177a916f27a5bb59f626338c0f47dc46d
Author: MabinGo <bi...@huawei.com>
AuthorDate: Wed May 29 11:10:22 2019 +0800

    Update to use spring-boot-maven-plugin to repackage jar
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 README-ZH.md        | 10 ++++++----
 README.md           | 10 ++++++----
 toolkit-cli/pom.xml | 32 +++++++++++++++++++-------------
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/README-ZH.md b/README-ZH.md
index ea3eee9..2a97256 100755
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -40,6 +40,8 @@
 
   * 支持契约增量生成代码。
 
+  * 支持生成“Hello World”微服务演示项目。
+
 ### 1.3 适用场景
 
 * 集成多厂商应用的企业
@@ -82,13 +84,13 @@ $ mvn clean install
 ```
 
 ### 3.2 使用toolkit-cli工具
-可执行jar包位于toolkit/toolkit-cli/target目录下
+可执行jar包位于toolkit/toolkit-cli/target/bin目录下
 ```shell
-$ java -jar toolkit-cli.jar help
+$ java -jar toolkit-cli-{version}.jar help
 ```
 #### 3.2.1 契约生成微服务工程
 ```shell
-$ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
+$ java -jar toolkit-cli-{version}.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
 ```
 > **codegenerate** 命令选项说明:
 * -m, --microservice-framework : 指定微服务框架,现支持ServiceComb  
@@ -108,7 +110,7 @@ $ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./pr
 
 #### 3.2.2 契约生成文档
 ```shell
-$ java -jar toolkit-cli.jar  docgenerate -i swagger.yaml -o ./document
+$ java -jar toolkit-cli-{version}.jar docgenerate -i swagger.yaml -o ./document
 ```
 > **docGenerate** 命令选项说明:
 * -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件  
diff --git a/README.md b/README.md
index dd42918..af77348 100755
--- a/README.md
+++ b/README.md
@@ -40,6 +40,8 @@ Contract-based microservice development toolkit
 
   * Support contract incremental generation code.
 
+  * Support for generating "Hello World" microservice demo project.
+
 ### 1.3 Applicable Scene
 
 * For users who integrate multi-vendor applications
@@ -81,13 +83,13 @@ $ mvn clean install
 ```
 
 ### 3.2 Use the toolkit-cli
-The executable jar package is located in the toolkit/toolkit-cli/target directory
+The executable jar package is located in the toolkit/toolkit-cli/target/bin directory
 ```shell
-$ java -jar toolkit-cli.jar help
+$ java -jar toolkit-cli-{version}.jar help
 ```
 #### 3.2.1 Service contract generation microservice project
 ```shell
-$ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
+$ java -jar toolkit-cli-{version}.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
 ```
 > **codegenerate** Command option
 * -m, --microservice-framework. Specify microservices framework, now supports ServiceComb.
@@ -107,7 +109,7 @@ $ java -jar toolkit-cli.jar  codegenerate -m ServiceComb -i swagger.yaml -o ./pr
 
 #### 3.2.2 Service contract generation document
 ```shell
-$ java -jar toolkit-cli.jar  docgenerate -i swagger.yaml -o ./document
+$ java -jar toolkit-cli-{version}.jar docgenerate -i swagger.yaml -o ./document
 ```
 > **docgenerate** Command option
 * -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 8c6cb5b..73de4b3 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -28,6 +28,10 @@
 
   <artifactId>toolkit-cli</artifactId>
 
+  <properties>
+    <main.class>org.apache.servicecomb.toolkit.cli.ToolkitMain</main.class>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>io.airlift</groupId>
@@ -69,24 +73,26 @@
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <version>2.5.5</version>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
         <configuration>
-          <archive>
-            <manifest>
-              <mainClass>org.apache.servicecomb.toolkit.cli.ToolkitMain</mainClass>
-            </manifest>
-          </archive>
-          <descriptorRefs>
-            <descriptorRef>jar-with-dependencies</descriptorRef>
-          </descriptorRefs>
+          <fork>true</fork>
+          <mainClass>${main.class}</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
         </configuration>
         <executions>
           <execution>
-            <id>make-assembly</id>
-            <phase>package</phase>
             <goals>
-              <goal>single</goal>
+              <goal>repackage</goal>
             </goals>
           </execution>
         </executions>


[servicecomb-toolkit] 07/49: Add plugin to support generating contract by code

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 138610e7aadce35c2b92064f55cc9612f577296f
Author: MabinGo <bi...@huawei.com>
AuthorDate: Tue May 21 08:37:19 2019 +0800

    Add plugin to support generating contract by code
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 common/pom.xml                                     |  93 ++++++++++++
 .../apache/servicecomb/toolkit/ContractsUtils.java | 167 +++++++++++++++++++++
 .../servicecomb/toolkit/ImmediateClassLoader.java  |  57 +++++++
 pom.xml                                            |   2 +
 toolkit-maven-plugin/pom.xml                       | 107 +++++++++++++
 .../toolkit/plugin/ContractGenerator.java          |  61 ++++++++
 .../toolkit/plugin/GenerateContractsDocMojo.java   |  83 ++++++++++
 .../toolkit/plugin/GenerateContractsMojo.java      |  59 ++++++++
 8 files changed, 629 insertions(+)

diff --git a/common/pom.xml b/common/pom.xml
new file mode 100755
index 0000000..4b9bbd9
--- /dev/null
+++ b/common/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>toolkit</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>0.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>toolkit-common</artifactId>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit</artifactId>
+      <version>5.3.0.201903130848-r</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>swagger-generator-springmvc</artifactId>
+      <version>1.2.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>swagger-generator-jaxrs</artifactId>
+      <version>1.2.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-rest-common</artifactId>
+      <version>1.2.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-pojo</artifactId>
+      <version>1.2.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/ContractsUtils.java b/common/src/main/java/org/apache/servicecomb/toolkit/ContractsUtils.java
new file mode 100755
index 0000000..032e458
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/ContractsUtils.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.URL;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.servicecomb.provider.pojo.RpcSchema;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.swagger.SwaggerUtils;
+import org.apache.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext;
+import org.apache.servicecomb.swagger.generator.core.SwaggerGenerator;
+import org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import io.swagger.models.Swagger;
+
+public class ContractsUtils {
+
+  private static CompositeSwaggerGeneratorContext compositeSwaggerGeneratorContext = new CompositeSwaggerGeneratorContext();
+
+  private static Logger LOGGER = LoggerFactory.getLogger(ContractsUtils.class);
+
+  public static Map<String, Swagger> getContractsFromFileSystem(String dir) throws IOException {
+
+    Map<String, Swagger> contracts = new HashMap<>();
+    File outputDir = new File(dir);
+
+    Files.walkFileTree(Paths.get(outputDir.toURI()), new SimpleFileVisitor<Path>() {
+      @Override
+      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+        contracts.put(file.toFile().getName(), SwaggerUtils.parseSwagger(file.toUri().toURL()));
+        return super.visitFile(file, attrs);
+      }
+    });
+
+    return contracts;
+  }
+
+  public static Map<String, byte[]> getFilesGroupByFilename(String dir) throws IOException {
+
+    Map<String, byte[]> contracts = new HashMap<>();
+    File outputDir = new File(dir);
+
+    Files.walkFileTree(Paths.get(outputDir.toURI()), new SimpleFileVisitor<Path>() {
+      @Override
+      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+        contracts.put(file.toFile().getName(), Files.readAllBytes(file));
+        return super.visitFile(file, attrs);
+      }
+    });
+
+    return contracts;
+  }
+
+  public static void generateAndOutputContracts(String outputDir, String format, URL[] classpathUrls) {
+
+    ImmediateClassLoader immediateClassLoader = new ImmediateClassLoader(classpathUrls,
+        Thread.currentThread().getContextClassLoader());
+
+    try {
+
+      Vector allClass = getAllClass(immediateClassLoader);
+
+      for (int i = 0; i < allClass.size(); i++) {
+
+        Class loadClass = (Class) allClass.get(i);
+        if (!canProcess(loadClass)) {
+          continue;
+        }
+
+        SwaggerGeneratorContext generatorContext =
+            compositeSwaggerGeneratorContext.selectContext(loadClass);
+
+        SwaggerGenerator generator = new SwaggerGenerator(generatorContext, loadClass);
+
+        String swaggerString = SwaggerUtils.swaggerToString(generator.generate());
+
+        File outputFile = new File(outputDir + File.separator + loadClass.getSimpleName() + format);
+
+        if (!outputFile.exists()) {
+          if (!outputFile.getParentFile().exists()) {
+            outputFile.getParentFile().mkdirs();
+          }
+          outputFile.createNewFile();
+        }
+
+        Files.write(Paths.get(outputFile.toURI()), swaggerString.getBytes());
+      }
+    } catch (IOException e) {
+      LOGGER.error(e.getMessage());
+    }
+  }
+
+  private static boolean canProcess(Class<?> loadClass) {
+
+    if (loadClass == null) {
+      return false;
+    }
+    RestSchema restSchema = loadClass.getAnnotation(RestSchema.class);
+    if (restSchema != null) {
+      return true;
+    }
+
+    RestController controller = loadClass.getAnnotation(RestController.class);
+    if (controller != null) {
+      return true;
+    }
+
+    RpcSchema rpcSchema = loadClass.getAnnotation(RpcSchema.class);
+    if (rpcSchema != null) {
+      return true;
+    }
+
+    RequestMapping requestMapping = loadClass.getAnnotation(RequestMapping.class);
+    if (requestMapping != null) {
+      return true;
+    }
+
+    return false;
+  }
+
+
+  private static Vector getAllClass(ClassLoader classLoader) {
+    Field classesField;
+    try {
+      classesField = ClassLoader.class.getDeclaredField("classes");
+      classesField.setAccessible(true);
+
+      if (classesField.get(classLoader) instanceof Vector) {
+        return (Vector) classesField.get(classLoader);
+      }
+    } catch (Exception e) {
+      LOGGER.warn("cannot get all class from ClassLoader " + classLoader.getClass());
+    }
+    return new Vector<>();
+  }
+}
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/ImmediateClassLoader.java b/common/src/main/java/org/apache/servicecomb/toolkit/ImmediateClassLoader.java
new file mode 100755
index 0000000..421aa1a
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/ImmediateClassLoader.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class ImmediateClassLoader extends URLClassLoader {
+
+  private String classPath;
+
+  public ImmediateClassLoader(URL[] urls, ClassLoader parent) {
+    super(urls, parent);
+    for (URL url : urls) {
+      if (url != null) {
+        File file = new File(url.getPath());
+        classPath = file.getAbsolutePath();
+        scanClassFile(file);
+      }
+    }
+  }
+
+  private void scanClassFile(File file) {
+    if (file.exists()) {
+      if (file.isFile() && file.getName().endsWith(".class")) {
+        try {
+          String className = file.getAbsolutePath().replace(classPath + File.separator, "")
+              .replace(File.separator, ".")
+              .replace(".class", "");
+          loadClass(className);
+        } catch (ClassNotFoundException e) {
+          e.printStackTrace();
+        }
+      } else if (file.isDirectory()) {
+        for (File f : file.listFiles()) {
+          scanClassFile(f);
+        }
+      }
+    }
+  }
+}
diff --git a/pom.xml b/pom.xml
index d97307d..9943324 100755
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,8 @@
     <module>code-generator</module>
     <module>toolkit-cli</module>
     <module>doc-generator</module>
+    <module>common</module>
+    <module>toolkit-maven-plugin</module>
   </modules>
 
 </project>
diff --git a/toolkit-maven-plugin/pom.xml b/toolkit-maven-plugin/pom.xml
new file mode 100755
index 0000000..b51f335
--- /dev/null
+++ b/toolkit-maven-plugin/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>toolkit</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>0.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>maven-plugin</packaging>
+  <artifactId>toolkit-maven-plugin</artifactId>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>doc-generator</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>3.6.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>3.6.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>3.6.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-archiver</artifactId>
+      <version>2.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>toolkit-common</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>3.5</version>
+        <configuration>
+          <goalPrefix>toolkit</goalPrefix>
+          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+        </configuration>
+        <executions>
+          <execution>
+            <id>generate-descriptor</id>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>generated-helpmojo</id>
+            <goals>
+              <goal>helpmojo</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+
+</project>
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
new file mode 100755
index 0000000..85bce32
--- /dev/null
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.plugin;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.project.MavenProject;
+import org.apache.servicecomb.toolkit.ContractsUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ContractGenerator {
+
+  private static Logger LOGGER = LoggerFactory.getLogger(ContractGenerator.class);
+
+  private MavenProject project;
+
+  public ContractGenerator(MavenProject project) {
+    this.project = project;
+  }
+
+  public void generateAndOutput(String outputDir, String format) {
+
+    List runtimeClasspaths = null;
+    try {
+      runtimeClasspaths = project.getRuntimeClasspathElements();
+    } catch (DependencyResolutionRequiredException e) {
+      LOGGER.error(e.getMessage());
+    }
+    URL[] runtimeUrls = new URL[runtimeClasspaths.size()];
+    for (int i = 0; i < runtimeClasspaths.size(); i++) {
+      String element = (String) runtimeClasspaths.get(i);
+      try {
+        runtimeUrls[i] = new File(element).toURI().toURL();
+      } catch (MalformedURLException e) {
+        LOGGER.error(e.getMessage());
+      }
+    }
+
+    ContractsUtils.generateAndOutputContracts(outputDir, format, runtimeUrls);
+  }
+}
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
new file mode 100755
index 0000000..200d177
--- /dev/null
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+import org.apache.servicecomb.docgen.DocGeneratorManager;
+import org.apache.servicecomb.swagger.SwaggerUtils;
+
+@Mojo(name = "generateDoc", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
+@Execute(goal = "generateDoc",
+    phase = LifecyclePhase.COMPILE
+)
+public class GenerateContractsDocMojo extends AbstractMojo {
+
+  @Parameter(defaultValue = "${project}", required = true, readonly = true)
+  private MavenProject project;
+
+  @Parameter(defaultValue = "contracts")
+  private String outputDir;
+
+  @Parameter(defaultValue = ".yaml")
+  private String format;
+
+  @Parameter(defaultValue = "build/doc")
+  private String docOutputDir;
+
+  @Override
+  public void execute() throws MojoExecutionException, MojoFailureException {
+
+    ContractGenerator contractGenerator = new ContractGenerator(project);
+    contractGenerator.generateAndOutput(outputDir, format);
+
+    try {
+
+      Files.walkFileTree(Paths.get(outputDir), new SimpleFileVisitor<Path>() {
+
+        @Override
+        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+
+          DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
+              docOutputDir + File.separator
+                  + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")) + ".html",
+              "html");
+          return super.visitFile(file, attrs);
+        }
+      });
+    } catch (IOException e) {
+      getLog().error(e.getMessage());
+    }
+  }
+}
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsMojo.java
new file mode 100755
index 0000000..9d1b599
--- /dev/null
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsMojo.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.plugin;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+
+@Mojo(name = "generateContracts", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.RUNTIME)
+@Execute(goal = "generateContracts",
+    phase = LifecyclePhase.COMPILE
+)
+public class GenerateContractsMojo
+    extends AbstractMojo {
+
+  @Parameter(defaultValue = "${project}", required = true, readonly = true)
+  private MavenProject project;
+
+  @Parameter(defaultValue = "contracts")
+  private String outputDir;
+
+  @Parameter(defaultValue = ".yaml")
+  private String format;
+
+  @Override
+  public void execute()
+      throws MojoExecutionException {
+
+    ContractGenerator contractGenerator = new ContractGenerator(project);
+    contractGenerator.generateAndOutput(outputDir, format);
+  }
+
+  /**
+   * @param project the project to set
+   */
+  public void setProject(MavenProject project) {
+    this.project = project;
+  }
+}


[servicecomb-toolkit] 36/49: Bug fix and warning clear

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 0293eb990409b6241b879775a47150b077329e44
Author: MabinGo <bi...@huawei.com>
AuthorDate: Sun Jun 2 02:01:26 2019 +0800

    Bug fix and warning clear
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../org/apache/servicecomb/toolkit/common/MyersAlgorithm.java  | 10 +++-------
 .../org/apache/servicecomb/toolkit/common/TextCompareTest.java |  2 +-
 common/src/test/resources/compare/HelloEndPoint2.yaml          |  9 ++++-----
 pom.xml                                                        |  1 +
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java
index 6300b38..17ff7d1 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java
@@ -34,13 +34,9 @@ public class MyersAlgorithm implements CompareAlgorithm {
   @Override
   public List<Comparison> compare(String source, String dest) {
 
-    if (source == null) {
-      LOGGER.error("source must not be null");
-      throw new RuntimeException("source must not be null");
-    }
-    if (source == null) {
-      LOGGER.error("dest must not be null");
-      throw new RuntimeException("dest must not be null");
+    if ((source == null) || (dest == null)) {
+      LOGGER.error("source is {} and dest is {}", source, dest);
+      throw new RuntimeException("source and dest must not be null");
     }
 
     EditList diffList = new EditList();
diff --git a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
index e1a0d98..4a8ebbc 100755
--- a/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/TextCompareTest.java
@@ -126,7 +126,7 @@ public class TextCompareTest {
       assertEquals(MyersAlgorithm.class, contractComparator.getAlgorithm().getClass());
       contractComparator.splitPrint(bout);
     } catch (RuntimeException e) {
-      assertEquals("source must not be null", e.getMessage());
+      assertEquals("source and dest must not be null", e.getMessage());
     }
   }
 }
diff --git a/common/src/test/resources/compare/HelloEndPoint2.yaml b/common/src/test/resources/compare/HelloEndPoint2.yaml
index b849778..66b2866 100755
--- a/common/src/test/resources/compare/HelloEndPoint2.yaml
+++ b/common/src/test/resources/compare/HelloEndPoint2.yaml
@@ -16,10 +16,9 @@
 ## ---------------------------------------------------------------------------
 
 ---
-aaswagfger: "2.066"
-ccc
+swagger: "2.0"
 info:
-  version: "1.0.02"
+  version: "1.0.1"
   title: "swagger definition for HelloEndPoint"
   x-java-interface: "gen.swagger.HelloEndPointIntf"
 basePath: "/hello"
@@ -40,7 +39,7 @@ paths:
         in: "query"
         required: false
         type: "number"
-        format: "double"
+        format: "int"
       - name: "instanceId"
         in: "query"
         required: false
@@ -64,7 +63,7 @@ paths:
         type: "string"
       - name: "Authorization"
         in: "header"
-        description: "aa"
+        description: "abc"
         required: true
         type: "string"
       responses:
diff --git a/pom.xml b/pom.xml
index e457098..1ec4144 100755
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@
       <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
+        <version>0.13</version>
         <configuration>
           <excludes>
             <exclude>DISCLAIMER</exclude>


[servicecomb-toolkit] 43/49: code refactor

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 5e1fa09b126b93dfc0add65bf677e51c5f23daf5
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu Jun 6 16:55:06 2019 +0800

    code refactor
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 LICENSE                                            |  6 +-
 README-ZH.md                                       |  4 +-
 README.md                                          |  4 +-
 {toolkit-cli => cli}/pom.xml                       |  7 +-
 .../servicecomb/toolkit/cli/CodeGenerate.java      | 22 ++++-
 .../servicecomb/toolkit/cli/DocGenerate.java       | 41 ++++++----
 .../servicecomb/toolkit/cli/ToolkitMain.java       |  0
 .../src/main/resources/application.properties      |  0
 {toolkit-cli => cli}/src/main/resources/log4j2.xml |  0
 .../apache/servicecomb/toolkit/cli/CliTest.java    |  0
 .../resources/contracts/CalculateEndpoint.yaml     |  0
 .../test/resources/contracts/HelloEndPoint.yaml    |  0
 .../contracts/pojo/CodeFirstHelloEndPoint.yaml     |  0
 .../src/test/resources/swagger.yaml                |  0
 {code-generator => codegen}/pom.xml                |  8 +-
 .../toolkit/codegen/DefaultCodeGenerator.java      | 22 +++--
 .../toolkit/codegen/GetGenericClassTypeLambda.java |  0
 .../toolkit/codegen/RemoveImplSuffixLambda.java    |  0
 .../toolkit/codegen/ServiceCombCodegen.java        |  0
 .../services/io.swagger.codegen.CodegenConfig      |  0
 .../org.apache.servicecomb.toolkit.CodeGenerator   |  2 +-
 .../ServiceComb/consumer/Application.mustache      |  0
 .../ServiceComb/consumer/apiConsumer.mustache      |  0
 .../consumer/bodyParamsConsumer.mustache           |  0
 .../consumer/formParamsConsumer.mustache           |  0
 .../consumer/headerParamsConsumer.mustache         |  0
 .../ServiceComb/consumer/microservice.mustache     |  0
 .../consumer/pathParamsConsumer.mustache           |  0
 .../ServiceComb/consumer/pojo/apiConsumer.mustache |  0
 .../resources/ServiceComb/consumer/pom.mustache    |  0
 .../consumer/queryParamsConsumer.mustache          |  0
 .../consumer/springboot}/Application.mustache      |  0
 .../ServiceComb/consumer/springboot/pom.mustache   |  0
 .../main/resources/ServiceComb/enumClass.mustache  |  0
 .../resources/ServiceComb/enumOuterClass.mustache  |  0
 .../libraries/JAX-RS}/Application.mustache         |  0
 .../ServiceComb/libraries/JAX-RS/api.mustache      |  0
 .../libraries/JAX-RS}/bodyParams.mustache          |  0
 .../libraries/JAX-RS/formParams.mustache           |  0
 .../libraries/JAX-RS/headerParams.mustache         |  0
 .../libraries/JAX-RS/pathParams.mustache           |  0
 .../ServiceComb/libraries/JAX-RS/pom.mustache      |  0
 .../libraries/JAX-RS/queryParams.mustache          |  0
 .../libraries/POJO/Application.mustache            |  0
 .../ServiceComb/libraries/POJO/api.mustache        |  0
 .../ServiceComb/libraries/POJO/apiImpl.mustache    |  0
 .../libraries/POJO}/bodyParams.mustache            |  0
 .../ServiceComb/libraries/POJO/formParams.mustache |  0
 .../libraries/POJO/headerParams.mustache           |  0
 .../ServiceComb/libraries/POJO/pathParams.mustache |  0
 .../ServiceComb/libraries/POJO/pom.mustache        |  0
 .../libraries/POJO/queryParams.mustache            |  0
 .../libraries/SpringBoot}/Application.mustache     |  0
 .../ServiceComb/libraries/SpringBoot/api.mustache  |  0
 .../libraries/SpringBoot}/bodyParams.mustache      |  0
 .../libraries/SpringBoot}/formParams.mustache      |  0
 .../libraries/SpringBoot}/headerParams.mustache    |  0
 .../libraries/SpringBoot/operationMethod.mustache  |  0
 .../libraries/SpringBoot}/pathParams.mustache      |  0
 .../ServiceComb/libraries/SpringBoot/pom.mustache  |  0
 .../libraries/SpringBoot}/queryParams.mustache     |  0
 .../libraries/SpringMVC}/Application.mustache      |  0
 .../ServiceComb/libraries/SpringMVC/api.mustache   |  0
 .../libraries/SpringMVC}/bodyParams.mustache       |  0
 .../libraries/SpringMVC}/formParams.mustache       |  0
 .../libraries/SpringMVC}/headerParams.mustache     |  0
 .../libraries/SpringMVC}/pathParams.mustache       |  0
 .../ServiceComb/libraries/SpringMVC/pom.mustache   |  0
 .../libraries/SpringMVC}/queryParams.mustache      |  0
 .../src/main/resources/ServiceComb/log4j2.mustache |  0
 .../resources/ServiceComb/model/model.mustache     |  0
 .../main/resources/ServiceComb/model/pom.mustache  |  0
 .../src/main/resources/ServiceComb/pojo.mustache   |  0
 .../resources/ServiceComb/project/pom.mustache     |  0
 .../ServiceComb/provider/microservice.mustache     |  0
 .../resources/ServiceComb/returnTypes.mustache     |  0
 .../servicecomb/toolkit/codegen/GeneratorTest.java | 22 ++++-
 .../servicecomb/toolkit/codegen/ReflectUtils.java  |  0
 .../toolkit/codegen/ServiceCombCodegenTest.java    |  0
 .../src/test/resources/swagger.yaml                |  0
 common/pom.xml                                     |  6 ++
 .../servicecomb/toolkit/common/ContractsUtils.java | 95 ----------------------
 ...tsUtils.java => DefaultContractsGenerator.java} | 76 +++++++++--------
 ...g.apache.servicecomb.toolkit.ContractsGenerator |  2 +-
 .../toolkit/common/ContractsGeneratorTest.java     | 26 ++++--
 .../toolkit/common/OtherContractsGenerator.java    | 33 ++++----
 ...g.apache.servicecomb.toolkit.ContractsGenerator |  2 +-
 {code-generator => core}/pom.xml                   | 31 ++-----
 .../apache/servicecomb/toolkit}/CodeGenerator.java | 13 +--
 .../servicecomb/toolkit/ContractsGenerator.java    | 10 +--
 .../apache/servicecomb/toolkit}/DocGenerator.java  | 10 +--
 .../org/apache/servicecomb/toolkit/Generator.java  | 10 ++-
 .../servicecomb/toolkit/GeneratorFactory.java      | 61 ++++++++++++++
 .../toolkit/docgen/DocGeneratorManager.java        | 48 -----------
 {doc-generator => docgen}/pom.xml                  |  8 +-
 .../toolkit/docgen/ContractsAsciidocGenerator.java | 28 ++++++-
 .../docgen/ContractsSwaggerUIGenerator.java        | 27 +++++-
 .../org.apache.servicecomb.toolkit.DocGenerator    |  0
 .../src/main/resources/webroot/swagger-ui.html     |  0
 .../src/test/java/docgen/DocGeneratorTest.java     | 45 +++++-----
 .../src/test/resources/HelloEndPoint.yaml          |  0
 pom.xml                                            |  7 +-
 toolkit-maven-plugin/pom.xml                       |  2 +-
 .../toolkit/plugin/ContractGenerator.java          | 12 ++-
 .../toolkit/plugin/GenerateContractsDocMojo.java   | 17 ++--
 105 files changed, 367 insertions(+), 340 deletions(-)

diff --git a/LICENSE b/LICENSE
index 3d03b1b..7769b07 100755
--- a/LICENSE
+++ b/LICENSE
@@ -201,9 +201,9 @@
    limitations under the License.
 
 ================================================================
-For code-generator/src/main/resources/ServiceComb/*
-For toolkit-cli/src/test/resources/swagger.yaml
-For code-generator/src/test/resources/swagger.yaml
+For codegen/src/main/resources/ServiceComb/*
+For cli/src/test/resources/swagger.yaml
+For codegen/src/test/resources/swagger.yaml
 ================================================================
 This product bundles files from swagger-codegen which is licensed under the Apache License v2.
 For details, see https://github.com/swagger-api/swagger-codegen
diff --git a/README-ZH.md b/README-ZH.md
index 2a97256..4e961f6 100755
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -83,8 +83,8 @@ $ cd toolkit
 $ mvn clean install
 ```
 
-### 3.2 使用toolkit-cli工具
-可执行jar包位于toolkit/toolkit-cli/target/bin目录下
+### 3.2 使用toolkit cli工具
+可执行jar包位于toolkit/cli/target/bin目录下
 ```shell
 $ java -jar toolkit-cli-{version}.jar help
 ```
diff --git a/README.md b/README.md
index af77348..86558ba 100755
--- a/README.md
+++ b/README.md
@@ -82,8 +82,8 @@ $ cd toolkit
 $ mvn clean install
 ```
 
-### 3.2 Use the toolkit-cli
-The executable jar package is located in the toolkit/toolkit-cli/target/bin directory
+### 3.2 Use the toolkit cli
+The executable jar package is located in the toolkit/cli/target/bin directory
 ```shell
 $ java -jar toolkit-cli-{version}.jar help
 ```
diff --git a/toolkit-cli/pom.xml b/cli/pom.xml
similarity index 95%
rename from toolkit-cli/pom.xml
rename to cli/pom.xml
index dc8ac81..474e22c 100755
--- a/toolkit-cli/pom.xml
+++ b/cli/pom.xml
@@ -26,7 +26,7 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
-  <artifactId>toolkit-cli</artifactId>
+  <artifactId>cli</artifactId>
 
   <properties>
     <main.class>org.apache.servicecomb.toolkit.cli.ToolkitMain</main.class>
@@ -48,7 +48,7 @@
 
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
-      <artifactId>code-generator</artifactId>
+      <artifactId>codegen</artifactId>
       <version>${project.version}</version>
     </dependency>
 
@@ -61,7 +61,7 @@
 
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
-      <artifactId>doc-generator</artifactId>
+      <artifactId>docgen</artifactId>
       <version>${project.version}</version>
     </dependency>
 
@@ -113,6 +113,7 @@
           <fork>true</fork>
           <mainClass>${main.class}</mainClass>
           <outputDirectory>target/bin</outputDirectory>
+          <finalName>toolkit-cli-${project.version}</finalName>
         </configuration>
         <executions>
           <execution>
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
similarity index 82%
rename from toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
rename to cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index df01175..b46b67e 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -27,8 +27,10 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Collections;
 
-import org.apache.servicecomb.toolkit.codegen.DefaultCodeGenerator;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
+import org.apache.servicecomb.toolkit.CodeGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,18 +72,28 @@ public class CodeGenerate implements Runnable {
       description = "artifact version in generated microservice project")
   private String artifactVersion;
 
+  @Option(name = {"--api-package"}, title = "api package",
+      description = "api package in generated microservice project")
+  private String apiPackage;
+
+  @Option(name = {"--model-package"}, title = "model package",
+      description = "model package in generated microservice project")
+  private String modelPackage;
 
   @Override
   public void run() {
 
     CodegenConfigurator configurator = new CodegenConfigurator();
+    CodeGenerator codegenerator = GeneratorFactory.getGenerator(CodeGenerator.class,"default");
 
     configurator.setOutputDir(output)
         .setGroupId(groupId)
         .setArtifactId(artifactId)
         .setArtifactVersion(artifactVersion)
         .setLibrary(programmingModel)
-        .setLang(framework);
+        .setLang(framework)
+        .setApiPackage(apiPackage)
+        .setModelPackage(modelPackage);
 
     if (isNotEmpty(specFile)) {
 
@@ -97,7 +109,8 @@ public class CodeGenerate implements Runnable {
                   .addAdditionalProperty("apiName", file.toFile().getName().split("\\.")[0]);
 
               try {
-                new DefaultCodeGenerator().opts(configurator).generate();
+                codegenerator.configure(Collections.singletonMap("configurator",configurator));
+                codegenerator.generate();
               } catch (RuntimeException e) {
                 throw new RuntimeException("Failed to generate code base on file " + file.toFile().getName());
               }
@@ -111,7 +124,8 @@ public class CodeGenerate implements Runnable {
         }
       } else {
         configurator.setInputSpec(specFile);
-        new DefaultCodeGenerator().opts(configurator).generate();
+        codegenerator.configure(Collections.singletonMap("configurator",configurator));
+        codegenerator.generate();
       }
 
       LOGGER.info("Success to generate code, the directory is: {}", output);
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
similarity index 67%
rename from toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
rename to cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index ca007d6..290feea 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -26,10 +26,12 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.servicecomb.swagger.SwaggerUtils;
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
+import org.apache.servicecomb.toolkit.DocGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,19 +62,23 @@ public class DocGenerate implements Runnable {
     try {
       Path specPath = Paths.get(specFile);
 
-      String[] retValues = new String[1];
+      boolean[] retValues = new boolean[1];
       String[] fileName = new String[1];
 
+      DocGenerator docGenerator = GeneratorFactory.getGenerator(DocGenerator.class, format);
+      Map<String, Object> docGeneratorConfig = new HashMap<>();
+
       if (Files.isDirectory(specPath)) {
 
         Files.walkFileTree(specPath, new SimpleFileVisitor<Path>() {
           @Override
           public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
 
-            retValues[0] = DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
-                output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
-                format);
-            if (StringUtils.isEmpty(retValues[0])) {
+            docGeneratorConfig.put("contractContent", SwaggerUtils.parseSwagger(file.toUri().toURL()));
+            docGeneratorConfig.put("outputPath", output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")));
+            docGenerator.configure(docGeneratorConfig);
+            retValues[0] = docGenerator.generate();
+            if (retValues[0]) {
               fileName[0] = file.toFile().getName();
               return FileVisitResult.TERMINATE;
             }
@@ -83,20 +89,23 @@ public class DocGenerate implements Runnable {
       } else if (Files.isRegularFile(specPath)) {
         fileName[0] = specPath.toFile().getName();
 
-        retValues[0] = DocGeneratorManager.generate(SwaggerUtils.parseSwagger(specPath.toUri().toURL()),
-            output + File.separator + new File(specFile).getName()
-                .substring(0, new File(specFile).getName().indexOf(".")),
-            format);
+        docGeneratorConfig.put("contractContent", SwaggerUtils.parseSwagger(specPath.toUri().toURL()));
+        docGeneratorConfig.put("outputPath", output + File.separator + new File(specFile).getName()
+            .substring(0, new File(specFile).getName().indexOf(".")));
+        docGenerator.configure(docGeneratorConfig);
+        retValues[0] = docGenerator.generate();
+
       } else {
         fileName[0] = specFile;
 
-        retValues[0] = DocGeneratorManager.generate(SwaggerUtils.parseSwagger(URI.create(specFile).toURL()),
-            output + File.separator + new File(specFile).getName()
-                .substring(0, new File(specFile).getName().indexOf(".")),
-            format);
+        docGeneratorConfig.put("contractContent", SwaggerUtils.parseSwagger(URI.create(specFile).toURL()));
+        docGeneratorConfig.put("outputPath",output + File.separator + new File(specFile).getName()
+            .substring(0, new File(specFile).getName().indexOf(".")));
+        docGenerator.configure(docGeneratorConfig);
+        retValues[0] = docGenerator.generate();
       }
 
-      if (StringUtils.isEmpty(retValues[0])) {
+      if (retValues[0]) {
         LOGGER.error("Failed to generate document base on file {}", fileName[0]);
         return;
       }
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java b/cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
similarity index 100%
rename from toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
rename to cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
diff --git a/toolkit-cli/src/main/resources/application.properties b/cli/src/main/resources/application.properties
similarity index 100%
copy from toolkit-cli/src/main/resources/application.properties
copy to cli/src/main/resources/application.properties
diff --git a/toolkit-cli/src/main/resources/log4j2.xml b/cli/src/main/resources/log4j2.xml
similarity index 100%
rename from toolkit-cli/src/main/resources/log4j2.xml
rename to cli/src/main/resources/log4j2.xml
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
similarity index 100%
rename from toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
rename to cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
diff --git a/toolkit-cli/src/test/resources/contracts/CalculateEndpoint.yaml b/cli/src/test/resources/contracts/CalculateEndpoint.yaml
similarity index 100%
rename from toolkit-cli/src/test/resources/contracts/CalculateEndpoint.yaml
rename to cli/src/test/resources/contracts/CalculateEndpoint.yaml
diff --git a/toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml b/cli/src/test/resources/contracts/HelloEndPoint.yaml
similarity index 100%
rename from toolkit-cli/src/test/resources/contracts/HelloEndPoint.yaml
rename to cli/src/test/resources/contracts/HelloEndPoint.yaml
diff --git a/toolkit-cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml b/cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml
similarity index 100%
rename from toolkit-cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml
rename to cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml
diff --git a/toolkit-cli/src/test/resources/swagger.yaml b/cli/src/test/resources/swagger.yaml
similarity index 100%
rename from toolkit-cli/src/test/resources/swagger.yaml
rename to cli/src/test/resources/swagger.yaml
diff --git a/code-generator/pom.xml b/codegen/pom.xml
similarity index 93%
copy from code-generator/pom.xml
copy to codegen/pom.xml
index ae53cd5..0a9348a 100755
--- a/code-generator/pom.xml
+++ b/codegen/pom.xml
@@ -26,7 +26,7 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
-  <artifactId>code-generator</artifactId>
+  <artifactId>codegen</artifactId>
 
 
   <properties>
@@ -38,6 +38,12 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>io.swagger</groupId>
       <artifactId>swagger-codegen</artifactId>
       <version>${swagger-codegen-version}</version>
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
similarity index 74%
rename from code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
rename to codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
index 04f14d3..05760c5 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
+++ b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/DefaultCodeGenerator.java
@@ -17,8 +17,9 @@
 
 package org.apache.servicecomb.toolkit.codegen;
 
-import java.io.File;
-import java.util.List;
+import java.util.Map;
+
+import org.apache.servicecomb.toolkit.CodeGenerator;
 
 import io.swagger.codegen.DefaultGenerator;
 import io.swagger.codegen.config.CodegenConfigurator;
@@ -28,15 +29,24 @@ public class DefaultCodeGenerator implements CodeGenerator {
   private DefaultGenerator generator = new DefaultGenerator();
 
   @Override
-  public CodeGenerator opts(CodegenConfigurator opts) {
+  public boolean canProcess(String type) {
+    return "default".equals(type);
+  }
 
+  @Override
+  public void configure(Map<String, Object> config) {
+    CodegenConfigurator opts = (CodegenConfigurator) config.get("configurator");
     generator.setGenerateSwaggerMetadata(false);
     generator.opts(opts.toClientOptInput());
-    return this;
   }
 
   @Override
-  public List<File> generate() {
-    return generator.generate();
+  public boolean generate() {
+
+    if (generator.generate().size() > 0) {
+      return true;
+    }
+
+    return false;
   }
 }
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java
similarity index 100%
rename from code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java
rename to codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/GetGenericClassTypeLambda.java
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
similarity index 100%
rename from code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
rename to codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/RemoveImplSuffixLambda.java
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
similarity index 100%
rename from code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
rename to codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
diff --git a/code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
similarity index 100%
rename from code-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
rename to codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig
diff --git a/toolkit-cli/src/main/resources/application.properties b/codegen/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.CodeGenerator
similarity index 93%
copy from toolkit-cli/src/main/resources/application.properties
copy to codegen/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.CodeGenerator
index a278788..1216792 100755
--- a/toolkit-cli/src/main/resources/application.properties
+++ b/codegen/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.CodeGenerator
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-version=${project.version}
\ No newline at end of file
+org.apache.servicecomb.toolkit.codegen.DefaultCodeGenerator
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/Application.mustache b/codegen/src/main/resources/ServiceComb/consumer/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/Application.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/apiConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/bodyParamsConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/headerParamsConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache b/codegen/src/main/resources/ServiceComb/consumer/microservice.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/microservice.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/microservice.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/pathParamsConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/pojo/apiConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/pom.mustache b/codegen/src/main/resources/ServiceComb/consumer/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/pom.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache b/codegen/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/queryParamsConsumer.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache b/codegen/src/main/resources/ServiceComb/consumer/springboot/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/springboot/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/springboot/pom.mustache b/codegen/src/main/resources/ServiceComb/consumer/springboot/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/springboot/pom.mustache
rename to codegen/src/main/resources/ServiceComb/consumer/springboot/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/enumClass.mustache b/codegen/src/main/resources/ServiceComb/enumClass.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/enumClass.mustache
rename to codegen/src/main/resources/ServiceComb/enumClass.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache b/codegen/src/main/resources/ServiceComb/enumOuterClass.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/enumOuterClass.mustache
rename to codegen/src/main/resources/ServiceComb/enumOuterClass.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/api.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache
old mode 100644
new mode 100755
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/formParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/headerParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/pathParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/JAX-RS/queryParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/api.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/api.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache
old mode 100755
new mode 100644
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/bodyParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/bodyParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/formParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/headerParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/pathParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/POJO/queryParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/springboot/Application.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/consumer/springboot/Application.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/api.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/bodyParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/bodyParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/headerParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/headerParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pathParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pathParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/queryParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/queryParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/Application.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/api.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/bodyParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/bodyParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/bodyParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/formParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/formParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/headerParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/headerParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/headerParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/pathParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pathParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/pathParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache b/codegen/src/main/resources/ServiceComb/libraries/SpringMVC/queryParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/queryParams.mustache
rename to codegen/src/main/resources/ServiceComb/libraries/SpringMVC/queryParams.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/log4j2.mustache b/codegen/src/main/resources/ServiceComb/log4j2.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/log4j2.mustache
rename to codegen/src/main/resources/ServiceComb/log4j2.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/model/model.mustache b/codegen/src/main/resources/ServiceComb/model/model.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/model/model.mustache
rename to codegen/src/main/resources/ServiceComb/model/model.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/model/pom.mustache b/codegen/src/main/resources/ServiceComb/model/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/model/pom.mustache
rename to codegen/src/main/resources/ServiceComb/model/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/pojo.mustache b/codegen/src/main/resources/ServiceComb/pojo.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/pojo.mustache
rename to codegen/src/main/resources/ServiceComb/pojo.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/project/pom.mustache b/codegen/src/main/resources/ServiceComb/project/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/project/pom.mustache
rename to codegen/src/main/resources/ServiceComb/project/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/provider/microservice.mustache b/codegen/src/main/resources/ServiceComb/provider/microservice.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/provider/microservice.mustache
rename to codegen/src/main/resources/ServiceComb/provider/microservice.mustache
diff --git a/code-generator/src/main/resources/ServiceComb/returnTypes.mustache b/codegen/src/main/resources/ServiceComb/returnTypes.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceComb/returnTypes.mustache
rename to codegen/src/main/resources/ServiceComb/returnTypes.mustache
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
similarity index 78%
rename from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
rename to codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index e7ae3d4..2e4a7db 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -17,14 +17,15 @@
 
 package org.apache.servicecomb.toolkit.codegen;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.List;
+import java.util.Collections;
 
+import org.apache.servicecomb.toolkit.CodeGenerator;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -54,7 +55,8 @@ public class GeneratorTest {
     configurator.setOutputDir(tempDir.toFile().getCanonicalPath() + "/ServiceComb");
     configurator.setInputSpec(specFilePath.toFile().getCanonicalPath());
     DefaultCodeGenerator codeGenerator = new DefaultCodeGenerator();
-    List<File> generatedFiles = codeGenerator.opts(configurator).generate();
+    codeGenerator.configure(Collections.singletonMap("configurator",configurator));
+    boolean generateResult = codeGenerator.generate();
 
     Object internalGenerator = ReflectUtils.getProperty(codeGenerator, "generator");
     Assert.assertEquals(DefaultGenerator.class, internalGenerator.getClass());
@@ -63,7 +65,19 @@ public class GeneratorTest {
     Assert.assertEquals("ServiceComb", ((ServiceCombCodegen) swaggerCodegenConfig).getName());
     Assert.assertEquals(CodegenType.SERVER, ((ServiceCombCodegen) swaggerCodegenConfig).getTag());
 
-    Assert.assertTrue(0 < generatedFiles.size());
+    Assert.assertTrue(generateResult);
     tempDir.toFile().deleteOnExit();
   }
+
+  @Test
+  public void getCodeGeneratorInstanse() {
+
+    CodeGenerator defaultCodeGenerator = GeneratorFactory.getGenerator(CodeGenerator.class,"default");
+    Assert.assertNotNull(defaultCodeGenerator);
+    Assert.assertTrue(defaultCodeGenerator.canProcess("default"));
+
+    CodeGenerator unknownCodeGenerator = GeneratorFactory.getGenerator(CodeGenerator.class,"unknown");
+    Assert.assertNull(unknownCodeGenerator);
+  }
 }
+
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java b/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
similarity index 100%
copy from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
copy to codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java b/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
similarity index 100%
copy from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
copy to codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
diff --git a/code-generator/src/test/resources/swagger.yaml b/codegen/src/test/resources/swagger.yaml
similarity index 100%
rename from code-generator/src/test/resources/swagger.yaml
rename to codegen/src/test/resources/swagger.yaml
diff --git a/common/pom.xml b/common/pom.xml
index 9a718c0..87a7655 100755
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -30,6 +30,12 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.eclipse.jgit</groupId>
       <artifactId>org.eclipse.jgit</artifactId>
       <version>5.3.0.201903130848-r</version>
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
index 01143f0..3dabb7b 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
@@ -19,8 +19,6 @@ package org.apache.servicecomb.toolkit.common;
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.URL;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -29,25 +27,15 @@ import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Vector;
 
-import org.apache.servicecomb.provider.pojo.RpcSchema;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.apache.servicecomb.swagger.SwaggerUtils;
-import org.apache.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext;
-import org.apache.servicecomb.swagger.generator.core.SwaggerGenerator;
-import org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 
 import io.swagger.models.Swagger;
 
 public class ContractsUtils {
 
-  private static CompositeSwaggerGeneratorContext compositeSwaggerGeneratorContext = new CompositeSwaggerGeneratorContext();
-
   private static Logger LOGGER = LoggerFactory.getLogger(ContractsUtils.class);
 
   public static Map<String, Swagger> getContractsFromFileSystem(String dir) throws IOException {
@@ -81,87 +69,4 @@ public class ContractsUtils {
 
     return contracts;
   }
-
-  public static void generateAndOutputContracts(String outputDir, String format, URL[] classpathUrls) {
-
-    ImmediateClassLoader immediateClassLoader = new ImmediateClassLoader(classpathUrls,
-        Thread.currentThread().getContextClassLoader());
-
-    try {
-
-      Vector allClass = getAllClass(immediateClassLoader);
-
-      for (int i = 0; i < allClass.size(); i++) {
-
-        Class loadClass = (Class) allClass.get(i);
-        if (!canProcess(loadClass)) {
-          continue;
-        }
-
-        SwaggerGeneratorContext generatorContext =
-            compositeSwaggerGeneratorContext.selectContext(loadClass);
-
-        SwaggerGenerator generator = new SwaggerGenerator(generatorContext, loadClass);
-
-        String swaggerString = SwaggerUtils.swaggerToString(generator.generate());
-
-        File outputFile = new File(outputDir + File.separator + loadClass.getSimpleName() + format);
-
-        if (!outputFile.exists()) {
-          if (!outputFile.getParentFile().exists()) {
-            outputFile.getParentFile().mkdirs();
-          }
-          outputFile.createNewFile();
-        }
-
-        Files.write(Paths.get(outputFile.toURI()), swaggerString.getBytes());
-      }
-    } catch (IOException e) {
-      LOGGER.error(e.getMessage());
-    }
-  }
-
-  private static boolean canProcess(Class<?> loadClass) {
-
-    if (loadClass == null) {
-      return false;
-    }
-    RestSchema restSchema = loadClass.getAnnotation(RestSchema.class);
-    if (restSchema != null) {
-      return true;
-    }
-
-    RestController controller = loadClass.getAnnotation(RestController.class);
-    if (controller != null) {
-      return true;
-    }
-
-    RpcSchema rpcSchema = loadClass.getAnnotation(RpcSchema.class);
-    if (rpcSchema != null) {
-      return true;
-    }
-
-    RequestMapping requestMapping = loadClass.getAnnotation(RequestMapping.class);
-    if (requestMapping != null) {
-      return true;
-    }
-
-    return false;
-  }
-
-
-  private static Vector getAllClass(ClassLoader classLoader) {
-    Field classesField;
-    try {
-      classesField = ClassLoader.class.getDeclaredField("classes");
-      classesField.setAccessible(true);
-
-      if (classesField.get(classLoader) instanceof Vector) {
-        return (Vector) classesField.get(classLoader);
-      }
-    } catch (Exception e) {
-      LOGGER.warn("cannot get all class from ClassLoader " + classLoader.getClass());
-    }
-    return new Vector<>();
-  }
 }
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/DefaultContractsGenerator.java
similarity index 74%
copy from common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
copy to common/src/main/java/org/apache/servicecomb/toolkit/common/DefaultContractsGenerator.java
index 01143f0..590020f 100755
--- a/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractsUtils.java
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/DefaultContractsGenerator.java
@@ -21,13 +21,8 @@ import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.net.URL;
-import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Vector;
 
@@ -37,53 +32,56 @@ import org.apache.servicecomb.swagger.SwaggerUtils;
 import org.apache.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext;
 import org.apache.servicecomb.swagger.generator.core.SwaggerGenerator;
 import org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext;
+import org.apache.servicecomb.toolkit.ContractsGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import io.swagger.models.Swagger;
+public class DefaultContractsGenerator implements ContractsGenerator {
 
-public class ContractsUtils {
+  private static Logger LOGGER = LoggerFactory.getLogger(ContractsUtils.class);
 
   private static CompositeSwaggerGeneratorContext compositeSwaggerGeneratorContext = new CompositeSwaggerGeneratorContext();
 
-  private static Logger LOGGER = LoggerFactory.getLogger(ContractsUtils.class);
+  private Map<String, Object> config;
 
-  public static Map<String, Swagger> getContractsFromFileSystem(String dir) throws IOException {
+  private URL[] classpathUrls;
 
-    Map<String, Swagger> contracts = new HashMap<>();
-    File outputDir = new File(dir);
+  private String outputDir = ".";
 
-    Files.walkFileTree(Paths.get(outputDir.toURI()), new SimpleFileVisitor<Path>() {
-      @Override
-      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-        contracts.put(file.toFile().getName(), SwaggerUtils.parseSwagger(file.toUri().toURL()));
-        return super.visitFile(file, attrs);
-      }
-    });
+  private String format = "yaml";
 
-    return contracts;
+  @Override
+  public boolean canProcess(String type) {
+    return "default".equals(type);
   }
 
-  public static Map<String, byte[]> getFilesGroupByFilename(String dir) throws IOException {
+  @Override
+  public void configure(Map<String, Object> config) {
+    this.config = config;
 
-    Map<String, byte[]> contracts = new HashMap<>();
-    File outputDir = new File(dir);
+    if (config == null) {
+      return;
+    }
 
-    Files.walkFileTree(Paths.get(outputDir.toURI()), new SimpleFileVisitor<Path>() {
-      @Override
-      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-        contracts.put(file.toFile().getName(), Files.readAllBytes(file));
-        return super.visitFile(file, attrs);
-      }
-    });
+    Object classpathUrlsObj = config.get("classpathUrls");
+    if (classpathUrlsObj instanceof URL[]) {
+      classpathUrls = (URL[]) classpathUrlsObj;
+    }
 
-    return contracts;
+    Object outputDirObj = config.get("outputDir");
+    if (outputDirObj instanceof String) {
+      outputDir = (String) outputDirObj;
+    }
   }
 
-  public static void generateAndOutputContracts(String outputDir, String format, URL[] classpathUrls) {
+  @Override
+  public boolean generate() {
 
+    if (!checkConfig()) {
+      return false;
+    }
     ImmediateClassLoader immediateClassLoader = new ImmediateClassLoader(classpathUrls,
         Thread.currentThread().getContextClassLoader());
 
@@ -118,7 +116,22 @@ public class ContractsUtils {
       }
     } catch (IOException e) {
       LOGGER.error(e.getMessage());
+      return false;
     }
+
+    return true;
+  }
+
+  private boolean checkConfig() {
+    if (config == null) {
+      return false;
+    }
+
+    if (classpathUrls == null) {
+      return false;
+    }
+
+    return true;
   }
 
   private static boolean canProcess(Class<?> loadClass) {
@@ -149,7 +162,6 @@ public class ContractsUtils {
     return false;
   }
 
-
   private static Vector getAllClass(ClassLoader classLoader) {
     Field classesField;
     try {
diff --git a/toolkit-cli/src/main/resources/application.properties b/common/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.ContractsGenerator
similarity index 92%
copy from toolkit-cli/src/main/resources/application.properties
copy to common/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.ContractsGenerator
index a278788..e465598 100755
--- a/toolkit-cli/src/main/resources/application.properties
+++ b/common/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.ContractsGenerator
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-version=${project.version}
\ No newline at end of file
+org.apache.servicecomb.toolkit.common.DefaultContractsGenerator
\ No newline at end of file
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/ContractsGeneratorTest.java
similarity index 53%
rename from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
rename to common/src/test/java/org/apache/servicecomb/toolkit/common/ContractsGeneratorTest.java
index 5846136..d5ed5e6 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegenTest.java
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/ContractsGeneratorTest.java
@@ -15,19 +15,27 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit.codegen;
+package org.apache.servicecomb.toolkit.common;
 
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.Assert.*;
 
-import io.swagger.codegen.CodegenConfig;
-import io.swagger.codegen.CodegenConfigLoader;
+import org.apache.servicecomb.toolkit.ContractsGenerator;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
+import org.junit.Test;
 
-public class ServiceCombCodegenTest {
+public class ContractsGeneratorTest {
 
   @Test
-  public void loadImpl() {
-    CodegenConfig codegenConfig = CodegenConfigLoader.forName("ServiceComb");
-    Assert.assertEquals(ServiceCombCodegen.class, codegenConfig.getClass());
+  public void getContractsGeneratorInstance() {
+
+    ContractsGenerator defaultGenerator = GeneratorFactory.getGenerator(ContractsGenerator.class,"default");
+    assertNotNull(defaultGenerator);
+
+    ContractsGenerator unknownGenerator = GeneratorFactory.getGenerator(ContractsGenerator.class,"unknown");
+    assertNull(unknownGenerator);
+
+    ContractsGenerator other = GeneratorFactory.getGenerator(ContractsGenerator.class,"other");
+    assertNotNull(other);
+    assertTrue(other.canProcess("other"));
   }
 }
diff --git a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/OtherContractsGenerator.java
similarity index 63%
rename from code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
rename to common/src/test/java/org/apache/servicecomb/toolkit/common/OtherContractsGenerator.java
index b5892a3..ef8eb34 100755
--- a/code-generator/src/test/java/org/apache/servicecomb/toolkit/codegen/ReflectUtils.java
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/OtherContractsGenerator.java
@@ -15,24 +15,29 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit.codegen;
+package org.apache.servicecomb.toolkit.common;
 
-import java.lang.reflect.Field;
+import java.util.Map;
 
-class ReflectUtils {
+import org.apache.servicecomb.toolkit.ContractsGenerator;
 
-  static Object getProperty(Object obj, String propName) {
+public class OtherContractsGenerator implements ContractsGenerator {
 
-    try {
-      Field propFiled = obj.getClass().getDeclaredField(propName);
-      propFiled.setAccessible(true);
-      return propFiled.get(obj);
-    } catch (NoSuchFieldException e) {
-      e.printStackTrace();
-    } catch (IllegalAccessException e) {
-      e.printStackTrace();
+  @Override
+  public boolean canProcess(String type) {
+    if ("other".equals(type)) {
+      return true;
     }
+    return false;
+  }
+
+  @Override
+  public void configure(Map<String, Object> config) {
+    return;
+  }
 
-    return null;
+  @Override
+  public boolean generate() {
+    return false;
   }
-}
+}
\ No newline at end of file
diff --git a/toolkit-cli/src/main/resources/application.properties b/common/src/test/resources/META-INF/services/org.apache.servicecomb.toolkit.ContractsGenerator
similarity index 92%
rename from toolkit-cli/src/main/resources/application.properties
rename to common/src/test/resources/META-INF/services/org.apache.servicecomb.toolkit.ContractsGenerator
index a278788..0bbcaee 100755
--- a/toolkit-cli/src/main/resources/application.properties
+++ b/common/src/test/resources/META-INF/services/org.apache.servicecomb.toolkit.ContractsGenerator
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-version=${project.version}
\ No newline at end of file
+org.apache.servicecomb.toolkit.common.OtherContractsGenerator
\ No newline at end of file
diff --git a/code-generator/pom.xml b/core/pom.xml
similarity index 76%
rename from code-generator/pom.xml
rename to core/pom.xml
index ae53cd5..290baeb 100755
--- a/code-generator/pom.xml
+++ b/core/pom.xml
@@ -26,14 +26,10 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
-  <artifactId>code-generator</artifactId>
-
+  <artifactId>core</artifactId>
 
   <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <swagger-codegen-version>2.4.3</swagger-codegen-version>
-    <maven-plugin-version>1.0.0</maven-plugin-version>
-    <junit-version>4.8.1</junit-version>
   </properties>
 
   <dependencies>
@@ -52,13 +48,6 @@
         </exclusion>
       </exclusions>
     </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
@@ -66,21 +55,13 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.6.1</version>
+        <version>3.1</version>
         <configuration>
-          <source>8</source>
-          <target>8</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
     </plugins>
-
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <includes>
-          <include>**/*.*</include>
-        </includes>
-      </resource>
-    </resources>
   </build>
-</project>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/CodeGenerator.java b/core/src/main/java/org/apache/servicecomb/toolkit/CodeGenerator.java
similarity index 75%
rename from code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/CodeGenerator.java
rename to core/src/main/java/org/apache/servicecomb/toolkit/CodeGenerator.java
index 2ac18c5..f1f7078 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/CodeGenerator.java
+++ b/core/src/main/java/org/apache/servicecomb/toolkit/CodeGenerator.java
@@ -15,16 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit.codegen;
+package org.apache.servicecomb.toolkit;
 
-import java.io.File;
-import java.util.List;
-
-import io.swagger.codegen.config.CodegenConfigurator;
-
-public interface CodeGenerator {
-
-  CodeGenerator opts(CodegenConfigurator opts);
-
-  List<File> generate();
+public interface CodeGenerator extends Generator {
 }
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java b/core/src/main/java/org/apache/servicecomb/toolkit/ContractsGenerator.java
similarity index 79%
copy from doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
copy to core/src/main/java/org/apache/servicecomb/toolkit/ContractsGenerator.java
index 6fb053a..ad6bbea 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
+++ b/core/src/main/java/org/apache/servicecomb/toolkit/ContractsGenerator.java
@@ -15,13 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit.docgen;
+package org.apache.servicecomb.toolkit;
 
-import io.swagger.models.Swagger;
-
-public interface DocGenerator {
-
-  boolean canProcess(String type);
-
-  String generate(Swagger source, String outputPath);
+public interface ContractsGenerator extends Generator {
 }
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java b/core/src/main/java/org/apache/servicecomb/toolkit/DocGenerator.java
similarity index 79%
copy from doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
copy to core/src/main/java/org/apache/servicecomb/toolkit/DocGenerator.java
index 6fb053a..812c448 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
+++ b/core/src/main/java/org/apache/servicecomb/toolkit/DocGenerator.java
@@ -15,13 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit.docgen;
+package org.apache.servicecomb.toolkit;
 
-import io.swagger.models.Swagger;
-
-public interface DocGenerator {
-
-  boolean canProcess(String type);
-
-  String generate(Swagger source, String outputPath);
+public interface DocGenerator extends Generator {
 }
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java b/core/src/main/java/org/apache/servicecomb/toolkit/Generator.java
similarity index 83%
rename from doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
rename to core/src/main/java/org/apache/servicecomb/toolkit/Generator.java
index 6fb053a..7941d3a 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGenerator.java
+++ b/core/src/main/java/org/apache/servicecomb/toolkit/Generator.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.toolkit.docgen;
+package org.apache.servicecomb.toolkit;
 
-import io.swagger.models.Swagger;
+import java.util.Map;
 
-public interface DocGenerator {
+public interface Generator {
 
   boolean canProcess(String type);
 
-  String generate(Swagger source, String outputPath);
+  void configure(Map<String, Object> config);
+
+  boolean generate();
 }
diff --git a/core/src/main/java/org/apache/servicecomb/toolkit/GeneratorFactory.java b/core/src/main/java/org/apache/servicecomb/toolkit/GeneratorFactory.java
new file mode 100755
index 0000000..fef3fbb
--- /dev/null
+++ b/core/src/main/java/org/apache/servicecomb/toolkit/GeneratorFactory.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class GeneratorFactory {
+
+  private final static Map<String, List> interfaceMap = new ConcurrentHashMap<>();
+
+  static {
+    addGeneratorType(CodeGenerator.class);
+    addGeneratorType(DocGenerator.class);
+    addGeneratorType(ContractsGenerator.class);
+  }
+
+  public static void addGeneratorType(Class<? extends Generator> generatorClass) {
+
+    if (interfaceMap.get(generatorClass.getName()) == null) {
+      interfaceMap.put(generatorClass.getName(), loadInitialCodeGenerators(generatorClass));
+    }
+  }
+
+  private static List<Generator> loadInitialCodeGenerators(Class<? extends Generator> generatorClass) {
+    List<Generator> registeredGenerators = new ArrayList<>();
+    ServiceLoader.load(generatorClass).forEach(registeredGenerators::add);
+    return registeredGenerators;
+  }
+
+  public static <T extends Generator> T getGenerator(Class<? extends T> generatorClass, String type) {
+
+    @SuppressWarnings("unchecked")
+    List<T> registeredList = (List<T>) interfaceMap.get(generatorClass.getName());
+    for (T generator : registeredList) {
+      if (generator.canProcess(type)) {
+        return generator;
+      }
+    }
+
+    return null;
+  }
+}
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGeneratorManager.java b/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGeneratorManager.java
deleted file mode 100755
index a2b6bc3..0000000
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/DocGeneratorManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.toolkit.docgen;
-
-import java.util.ServiceLoader;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import io.swagger.models.Swagger;
-
-public class DocGeneratorManager {
-
-  private final static CopyOnWriteArrayList<DocGenerator> registeredGenerators = new CopyOnWriteArrayList<>();
-
-  static {
-    loadInitialDocGenerators();
-  }
-
-  private static void loadInitialDocGenerators() {
-
-    ServiceLoader.load(DocGenerator.class).forEach(registeredGenerators::add);
-  }
-
-  public static String generate(Swagger source, String outputPath, String outputType) {
-
-    for (DocGenerator docGenerator : registeredGenerators) {
-      if (docGenerator.canProcess(outputType)) {
-        return docGenerator.generate(source, outputPath);
-      }
-    }
-
-    return null;
-  }
-}
diff --git a/doc-generator/pom.xml b/docgen/pom.xml
similarity index 94%
rename from doc-generator/pom.xml
rename to docgen/pom.xml
index 0b7db64..d5fda74 100755
--- a/doc-generator/pom.xml
+++ b/docgen/pom.xml
@@ -26,7 +26,7 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
-  <artifactId>doc-generator</artifactId>
+  <artifactId>docgen</artifactId>
 
   <repositories>
     <repository>
@@ -41,6 +41,12 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.asciidoctor</groupId>
       <artifactId>asciidoctorj</artifactId>
       <version>1.6.2</version>
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java b/docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
similarity index 85%
rename from doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
rename to docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
index 42133f7..a082d98 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
+++ b/docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsAsciidocGenerator.java
@@ -22,6 +22,7 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.Map;
 
+import org.apache.servicecomb.toolkit.DocGenerator;
 import org.asciidoctor.Asciidoctor;
 import org.asciidoctor.Attributes;
 import org.asciidoctor.AttributesBuilder;
@@ -46,13 +47,35 @@ public class ContractsAsciidocGenerator implements DocGenerator {
 
   private final static String DOC_SUFFIX = ".html";
 
+  private Swagger contractContent;
+
+  private String outputPath = ".";
+
   @Override
   public boolean canProcess(String type) {
     return type != null && DOC_FORMAT.equals(type.toLowerCase());
   }
 
   @Override
-  public String generate(Swagger contractContent, String outputPath) {
+  public void configure(Map<String, Object> config) {
+
+    this.contractContent = (Swagger) config.get("contractContent");
+    this.outputPath = (String) config.get("outputPath");
+  }
+
+  private boolean checkConfig() {
+    if (contractContent == null) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public boolean generate() {
+
+    if (!checkConfig()) {
+      return false;
+    }
 
     Asciidoctor asciidoctor = Asciidoctor.Factory.create();
     Swagger2MarkupConverter.Builder markupBuilder = Swagger2MarkupConverter.from(contractContent);
@@ -80,9 +103,10 @@ public class ContractsAsciidocGenerator implements DocGenerator {
       Files.write(Paths.get(outputPath), asciidocResult.getBytes());
     } catch (IOException e) {
       LOGGER.error(e.getMessage());
+      return false;
     }
 
-    return asciidocResult;
+    return true;
   }
 
   private String correctPath(String filepath) {
diff --git a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java b/docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
similarity index 85%
rename from doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
rename to docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
index f39cd22..6926cdb 100755
--- a/doc-generator/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
+++ b/docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.servicecomb.toolkit.DocGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,6 +45,10 @@ public class ContractsSwaggerUIGenerator implements DocGenerator {
 
   private final static String DOC_SUFFIX = ".html";
 
+  private Swagger contractContent;
+
+  private String outputPath = ".";
+
   @Override
 
   public boolean canProcess(String type) {
@@ -51,7 +56,24 @@ public class ContractsSwaggerUIGenerator implements DocGenerator {
   }
 
   @Override
-  public String generate(Swagger contractContent, String outputPath) {
+  public void configure(Map<String, Object> config) {
+    this.contractContent = (Swagger) config.get("contractContent");
+    this.outputPath = (String) config.get("outputPath");
+  }
+
+  private boolean checkConfig() {
+    if (contractContent == null) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public boolean generate() {
+
+    if (!checkConfig()) {
+      return false;
+    }
 
     String swaggerUiHtml = null;
     try {
@@ -71,9 +93,10 @@ public class ContractsSwaggerUIGenerator implements DocGenerator {
       Files.write(outputFile, swaggerUiHtml.getBytes());
     } catch (IOException e) {
       LOGGER.error(e.getMessage());
+      return false;
     }
 
-    return swaggerUiHtml;
+    return true;
   }
 
   private String correctPath(String filepath) {
diff --git a/doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.docgen.DocGenerator b/docgen/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.DocGenerator
similarity index 100%
rename from doc-generator/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.docgen.DocGenerator
rename to docgen/src/main/resources/META-INF/services/org.apache.servicecomb.toolkit.DocGenerator
diff --git a/doc-generator/src/main/resources/webroot/swagger-ui.html b/docgen/src/main/resources/webroot/swagger-ui.html
similarity index 100%
rename from doc-generator/src/main/resources/webroot/swagger-ui.html
rename to docgen/src/main/resources/webroot/swagger-ui.html
diff --git a/doc-generator/src/test/java/docgen/DocGeneratorTest.java b/docgen/src/test/java/docgen/DocGeneratorTest.java
similarity index 71%
rename from doc-generator/src/test/java/docgen/DocGeneratorTest.java
rename to docgen/src/test/java/docgen/DocGeneratorTest.java
index c4dbb64..278766c 100755
--- a/doc-generator/src/test/java/docgen/DocGeneratorTest.java
+++ b/docgen/src/test/java/docgen/DocGeneratorTest.java
@@ -21,7 +21,8 @@ import io.swagger.models.Swagger;
 import io.swagger.parser.Swagger20Parser;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
+import org.apache.servicecomb.toolkit.DocGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -31,6 +32,8 @@ import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
 
 public class DocGeneratorTest {
 
@@ -53,7 +56,12 @@ public class DocGeneratorTest {
     Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
         + File.separator + "asciidoc.html");
 
-    DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "asciidoc-html");
+    DocGenerator docGenerator = GeneratorFactory.getGenerator(DocGenerator.class, "asciidoc-html");
+    Map<String, Object> docGeneratorConfig = new HashMap<>();
+    docGeneratorConfig.put("contractContent", swagger);
+    docGeneratorConfig.put("outputPath", outputPath.toFile().getCanonicalPath());
+    docGenerator.configure(docGeneratorConfig);
+    docGenerator.generate();
 
     Assert.assertTrue(Files.exists(outputPath));
     FileUtils.deleteDirectory(tempDir.toFile());
@@ -78,36 +86,21 @@ public class DocGeneratorTest {
     Path tempDir = Files.createTempDirectory(null);
     Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
         + File.separator + "swagger-ui.html");
-    DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "swagger-ui");
+    DocGenerator docGenerator = GeneratorFactory.getGenerator(DocGenerator.class, "swagger-ui");
+    Map<String, Object> docGeneratorConfig = new HashMap<>();
+    docGeneratorConfig.put("contractContent", swagger);
+    docGeneratorConfig.put("outputPath", outputPath.toFile().getCanonicalPath());
+    docGenerator.configure(docGeneratorConfig);
+    docGenerator.generate();
 
     Assert.assertTrue(Files.exists(outputPath));
     FileUtils.deleteDirectory(tempDir.toFile());
   }
 
   @Test
-  public void contractTransferToOther() throws IOException {
+  public void contractTransferToOther() {
 
-    Swagger20Parser swagger20Parser = new Swagger20Parser();
-
-    InputStream in = DocGeneratorTest.class.getClassLoader().getResourceAsStream("HelloEndPoint.yaml");
-
-    StringBuilder sb = new StringBuilder();
-    byte[] bytes = new byte[1024];
-    int len = -1;
-    while ((len = in.read(bytes)) != -1) {
-      sb.append(new String(bytes, 0, len));
-    }
-
-    Swagger swagger = swagger20Parser.parse(sb.toString());
-
-    Path tempDir = Files.createTempDirectory(null);
-    Path outputPath = Paths.get(tempDir.toFile().getAbsolutePath()
-        + File.separator + "swagger-ui.html");
-
-    DocGeneratorManager.generate(swagger, outputPath.toFile().getCanonicalPath(), "other");
-
-    Assert.assertFalse(Files.exists(outputPath));
-
-    FileUtils.deleteDirectory(tempDir.toFile());
+    DocGenerator docGenerator = GeneratorFactory.getGenerator(DocGenerator.class, "other");
+    Assert.assertNull(docGenerator);
   }
 }
diff --git a/doc-generator/src/test/resources/HelloEndPoint.yaml b/docgen/src/test/resources/HelloEndPoint.yaml
similarity index 100%
rename from doc-generator/src/test/resources/HelloEndPoint.yaml
rename to docgen/src/test/resources/HelloEndPoint.yaml
diff --git a/pom.xml b/pom.xml
index 1ec4144..a93f31c 100755
--- a/pom.xml
+++ b/pom.xml
@@ -33,11 +33,12 @@
   </properties>
 
   <modules>
-    <module>code-generator</module>
-    <module>toolkit-cli</module>
-    <module>doc-generator</module>
+    <module>codegen</module>
+    <module>cli</module>
+    <module>docgen</module>
     <module>common</module>
     <module>toolkit-maven-plugin</module>
+    <module>core</module>
   </modules>
 
   <build>
diff --git a/toolkit-maven-plugin/pom.xml b/toolkit-maven-plugin/pom.xml
index 37661fb..8eb2f86 100755
--- a/toolkit-maven-plugin/pom.xml
+++ b/toolkit-maven-plugin/pom.xml
@@ -31,7 +31,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
-      <artifactId>doc-generator</artifactId>
+      <artifactId>docgen</artifactId>
       <version>${project.version}</version>
     </dependency>
 
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
index 128dcaa..227899f 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/ContractGenerator.java
@@ -20,11 +20,14 @@ package org.apache.servicecomb.toolkit.plugin;
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.project.MavenProject;
-import org.apache.servicecomb.toolkit.common.ContractsUtils;
+import org.apache.servicecomb.toolkit.ContractsGenerator;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,6 +59,11 @@ public class ContractGenerator {
       }
     }
 
-    ContractsUtils.generateAndOutputContracts(outputDir, format, runtimeUrls);
+    ContractsGenerator contractGenerator = GeneratorFactory.getGenerator(ContractsGenerator.class,"default");
+    Map<String,Object> contractConfig = new HashMap<>();
+    contractConfig.put("classpathUrls",runtimeUrls);
+    contractConfig.put("outputDir",outputDir);
+    contractGenerator.configure(contractConfig);
+    contractGenerator.generate();
   }
 }
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
index 3c5d975..ba46c53 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
@@ -25,6 +25,8 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -36,7 +38,8 @@ import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.servicecomb.swagger.SwaggerUtils;
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
+import org.apache.servicecomb.toolkit.GeneratorFactory;
+import org.apache.servicecomb.toolkit.DocGenerator;
 
 @Mojo(name = "generateDoc", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
 @Execute(goal = "generateDoc",
@@ -69,10 +72,14 @@ public class GenerateContractsDocMojo extends AbstractMojo {
         @Override
         public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
 
-          DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
-              docOutputDir + File.separator
-                  + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
-              format);
+          DocGenerator docGenerator = GeneratorFactory.getGenerator(DocGenerator.class, format);
+          Map<String, Object> docGeneratorConfig = new HashMap<>();
+          docGeneratorConfig.put("contractContent", SwaggerUtils.parseSwagger(file.toUri().toURL()));
+          docGeneratorConfig.put("outputPath",docOutputDir + File.separator
+              + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")));
+          docGenerator.configure(docGeneratorConfig);
+          docGenerator.generate();
+
           return super.visitFile(file, attrs);
         }
       });


[servicecomb-toolkit] 22/49: Merge pull request #5 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit f9e22e3a3674255ff17434e64a820b175c667f9f
Merge: f0c516b f2f510d
Author: Mabin <bi...@huawei.com>
AuthorDate: Mon May 27 18:46:40 2019 +0800

    Merge pull request #5 from kakulisen/master
    
    Optimize document styles and add remote resource reads

 .../toolkit/docgen/ContractsAsciidocGenerator.java           |  1 -
 .../java/org/apache/servicecomb/toolkit/cli/DocGenerate.java | 12 +++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)


[servicecomb-toolkit] 46/49: Merge pull request #12 from kakulisen/master

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 69d73967f2185d231076af307f9d3ec26325a2a9
Merge: 5e1fa09 eb8980b
Author: Mabin <bi...@huawei.com>
AuthorDate: Thu Jun 6 19:12:38 2019 +0800

    Merge pull request #12 from kakulisen/master
    
    Support generating microservice projects according to service type op…

 .../servicecomb/toolkit/cli/CodeGenerate.java      | 13 ++++++--
 .../toolkit/codegen/ProjectMetaConstant.java       | 23 +++++++++++++
 .../toolkit/codegen/ServiceCombCodegen.java        | 39 ++++++++++++++++------
 3 files changed, 62 insertions(+), 13 deletions(-)


[servicecomb-toolkit] 09/49: Code optimization and bugfix

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 3ad4486135d330a1b1881eeea4cfa840b57e82d3
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu May 23 00:58:56 2019 +0800

    Code optimization and bugfix
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 code-generator/pom.xml                             |  1 +
 .../codegen/ServiceCombProviderCodegen.java        |  2 +-
 .../{SpringMvc => SpringMVC}/Application.mustache  |  0
 .../{SpringMvc => SpringMVC}/api.mustache          |  0
 .../{SpringMvc => SpringMVC}/api_test.mustache     |  0
 .../{SpringMvc => SpringMVC}/bodyParams.mustache   |  0
 .../{SpringMvc => SpringMVC}/formParams.mustache   |  0
 .../{SpringMvc => SpringMVC}/headerParams.mustache |  0
 .../{SpringMvc => SpringMVC}/pathParams.mustache   |  0
 .../{SpringMvc => SpringMVC}/pom.mustache          |  0
 .../{SpringMvc => SpringMVC}/queryParams.mustache  |  0
 common/pom.xml                                     |  3 -
 doc-generator/pom.xml                              |  7 --
 toolkit-cli/pom.xml                                |  6 ++
 .../servicecomb/toolkit/cli/CodeGenerate.java      | 42 ++++++------
 .../servicecomb/toolkit/cli/DocGenerate.java       | 80 ++++++++++++++++++++++
 .../servicecomb/toolkit/cli/ToolkitMain.java       | 11 ++-
 .../apache/servicecomb/toolkit/cli/CliTest.java    | 10 +--
 toolkit-maven-plugin/pom.xml                       |  3 +-
 19 files changed, 121 insertions(+), 44 deletions(-)

diff --git a/code-generator/pom.xml b/code-generator/pom.xml
index 692f757..05ebd16 100755
--- a/code-generator/pom.xml
+++ b/code-generator/pom.xml
@@ -42,6 +42,7 @@
       <artifactId>swagger-codegen</artifactId>
       <version>${swagger-codegen-version}</version>
     </dependency>
+
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
index fb6fb34..4a39fc0 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java
@@ -31,7 +31,7 @@ import io.swagger.codegen.mustache.CamelCaseLambda;
 
 public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements CodegenConfig {
 
-  private static final String DEFAULT_LIBRARY = "SpringMvc";
+  private static final String DEFAULT_LIBRARY = "SpringMVC";
 
   private String resourcesFolder = projectFolder + File.separator + "resources";
 
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/Application.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/Application.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/Application.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/Application.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api_test.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api_test.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/api_test.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/api_test.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/bodyParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/bodyParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/bodyParams.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/bodyParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/formParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/formParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/formParams.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/formParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/headerParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/headerParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/headerParams.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/headerParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pathParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pathParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pathParams.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pathParams.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pom.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pom.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/pom.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/pom.mustache
diff --git a/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/queryParams.mustache b/code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/queryParams.mustache
similarity index 100%
rename from code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMvc/queryParams.mustache
rename to code-generator/src/main/resources/ServiceCombProvider/libraries/SpringMVC/queryParams.mustache
diff --git a/common/pom.xml b/common/pom.xml
index 4b9bbd9..3324cb2 100755
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -29,7 +29,6 @@
   <artifactId>toolkit-common</artifactId>
 
   <dependencies>
-
     <dependency>
       <groupId>org.eclipse.jgit</groupId>
       <artifactId>org.eclipse.jgit</artifactId>
@@ -72,8 +71,6 @@
       <version>4.12</version>
       <scope>test</scope>
     </dependency>
-
-
   </dependencies>
 
   <build>
diff --git a/doc-generator/pom.xml b/doc-generator/pom.xml
index bf5ba09..4942890 100755
--- a/doc-generator/pom.xml
+++ b/doc-generator/pom.xml
@@ -94,13 +94,6 @@
       <artifactId>org.eclipse.jgit</artifactId>
       <version>5.3.0.201903130848-r</version>
     </dependency>
-
-    <!--<dependency>-->
-    <!--<groupId>org.apache.servicecomb</groupId>-->
-    <!--<artifactId>toolkit-common</artifactId>-->
-    <!--<version>${project.version}</version>-->
-    <!--</dependency>-->
-
   </dependencies>
   <build>
     <plugins>
diff --git a/toolkit-cli/pom.xml b/toolkit-cli/pom.xml
index 23107f6..0cc4219 100755
--- a/toolkit-cli/pom.xml
+++ b/toolkit-cli/pom.xml
@@ -47,6 +47,12 @@
       <version>4.12</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>doc-generator</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index 8c06581..c9bb03b 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -34,39 +34,38 @@ import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import io.swagger.codegen.config.CodegenConfigurator;
 
-@Command(name = "generate", description = "CodeGenerate code with chosen lang")
+@Command(name = "generate",
+    description = "Generate multiple models of microservice project by OpenAPI specification file")
 public class CodeGenerate implements Runnable {
 
-  @Option(name = {"--programming-model"}, title = "programming model", required = false,
-      description = "programming model, equals to --library")
+  @Option(name = {"-p", "--programming-model"}, title = "programming model", required = false,
+      description = "programming model, as SpringMVC, POJO or JAX-RS")
   private String programmingModel;
 
-  @Option(name = {"-i", "--input-spec"}, title = "spec file", required = true,
-      description = "location of the swagger spec, as URL or file (required)")
-  private String spec;
+  @Option(name = {"-m", "--microservice-framework"}, title = "language",
+      description = "microservice-framework")
+  private String framework = "ServiceCombProvider";
+
+  @Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
+      description = "location of the OpenAPI specification file, as URL or file (required)")
+  private String specFile;
 
   @Option(name = {"-o", "--output"}, title = "output directory",
-      description = "where to write the generated files (current dir by default)")
+      description = "location of the generated document (current dir by default)")
   private String output = "";
 
-  @Option(name = {"--group-id"}, title = "group id", description = "groupId in generated pom.xml")
+  @Option(name = {"--group-id"}, title = "group id",
+      description = "groupId in generated microservice project")
   private String groupId;
 
   @Option(name = {"--artifact-id"}, title = "artifact id",
-      description = "artifact version in generated pom.xml")
+      description = "artifact version in generated microservice project")
   private String artifactId;
 
   @Option(name = {"--artifact-version"}, title = "artifact version",
-      description = "artifact version in generated pom.xml")
+      description = "artifact version in generated microservice project")
   private String artifactVersion;
 
-  @Option(name = {"--library"}, title = "library", description = "library template (sub-template)")
-  private String library;
-
-  @Option(name = {"-l", "--lang"}, title = "language",
-      description = "client language to generate (maybe class name in classpath, required)")
-  private String lang = "ServiceCombProvider";
-
 
   @Override
   public void run() {
@@ -77,13 +76,12 @@ public class CodeGenerate implements Runnable {
         .setGroupId(groupId)
         .setArtifactId(artifactId)
         .setArtifactVersion(artifactVersion)
-        .setLibrary(library)
         .setLibrary(programmingModel)
-        .setLang(lang);
+        .setLang(framework);
 
-    if (isNotEmpty(spec)) {
+    if (isNotEmpty(specFile)) {
 
-      File contractFile = new File(spec);
+      File contractFile = new File(specFile);
 
       if (contractFile.isDirectory()) {
         try {
@@ -103,7 +101,7 @@ public class CodeGenerate implements Runnable {
           e.printStackTrace();
         }
       } else {
-        configurator.setInputSpec(spec);
+        configurator.setInputSpec(specFile);
         new DefaultCodeGenerator().opts(configurator).generate();
       }
     }
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
new file mode 100755
index 0000000..755abcf
--- /dev/null
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.cli;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import org.apache.servicecomb.docgen.DocGeneratorManager;
+import org.apache.servicecomb.swagger.SwaggerUtils;
+
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+
+@Command(name = "docGenerate", description = "Generate document by OpenAPI specification file")
+public class DocGenerate implements Runnable {
+
+  @Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
+      description = "location of the OpenAPI specification file, as URL or file (required)")
+  private String specFile;
+
+
+  @Option(name = {"-f", "--format"}, title = "document format", required = false,
+      description = "format of document, as html or asciidoc (html by default)")
+  private String format = "html";
+
+  @Option(name = {"-o", "--output"}, title = "output directory",
+      description = "location of the generated document (current dir by default)")
+  private String output = "";
+
+  @Override
+  public void run() {
+
+    try {
+      Path specPath = Paths.get(specFile);
+
+      if (Files.isDirectory(specPath)) {
+
+        Files.walkFileTree(specPath, new SimpleFileVisitor<Path>() {
+          @Override
+          public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+
+            DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
+                output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
+                "html");
+            return super.visitFile(file, attrs);
+          }
+        });
+      } else {
+
+        DocGeneratorManager.generate(SwaggerUtils.parseSwagger(new File(specFile).toURI().toURL()),
+            output + File.separator + new File(specFile).getName().substring(0, new File(specFile).getName().indexOf(".")),
+            format);
+      }
+    } catch (IOException e) {
+      // command line , direct print to screen
+      e.printStackTrace();
+    }
+  }
+}
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
index 32795ef..7d0f10b 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
@@ -33,11 +33,11 @@ public class ToolkitMain {
 
     initialProjectVersion();
 
-    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("java -jar assistant-cli-" + projectVersion + ".jar");
-    builder.withDescription(
-        "ServiceComb code generator CLI (version " + projectVersion + "). More info on servicecomb.apache.org");
+    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("java -jar toolkit-cli-" + projectVersion + ".jar");
+    builder.withDescription("Microservice development toolkit(version " + projectVersion
+        + "). More info on https://github.com/MabinGo/toolkit");
     builder.withDefaultCommand(Help.class);
-    builder.withCommands(CodeGenerate.class, Help.class);
+    builder.withCommands(CodeGenerate.class, DocGenerate.class, Help.class);
     Runnable cmd = builder.build().parse(args);
 
     cmd.run();
@@ -49,8 +49,7 @@ public class ToolkitMain {
     try {
       properties.load(ToolkitMain.class.getClassLoader().getResourceAsStream("application.properties"));
 
-      projectVersion = Optional.ofNullable(properties.getProperty("version"))
-          .orElse("unknown");
+      projectVersion = Optional.ofNullable(properties.getProperty("version")).orElse("unknown");
     } catch (IOException e) {
       e.printStackTrace();
     }
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index 9c50338..c49b5d3 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -31,7 +31,7 @@ public class CliTest {
   @Test
   public void generateServiceCombCodeFromSingleContract() throws IOException {
 
-    String[] programModels = new String[] {"SpringMvc"};
+    String[] programModels = new String[] {"SpringMVC"};
     Path tempDir = Files.createTempDirectory(null);
     Arrays.stream(programModels).forEach(model -> {
       try {
@@ -39,13 +39,13 @@ public class CliTest {
         CliTest.class.getClassLoader().getResource("swagger.yaml");
         String[] args = new String[] {
             "generate",
-            "-l",
+            "-m",
             "ServiceCombProvider",
             "-i",
             Paths.get("./src/test/resources/swagger.yaml").toFile().getCanonicalPath(),
             "-o",
             tempFile.toFile().getCanonicalPath(),
-            "--library",
+            "-p",
             model
         };
         Assert.assertTrue(!Files.exists(tempFile));
@@ -59,6 +59,7 @@ public class CliTest {
 
     tempDir.toFile().deleteOnExit();
   }
+/*
 
   @Test
   public void generateSpringCloudCodeFromSingleContract() throws IOException {
@@ -84,6 +85,7 @@ public class CliTest {
 
     tempDir.toFile().deleteOnExit();
   }
+*/
 
   @Test
   public void generateCodeFromMultiContract() throws IOException {
@@ -101,7 +103,7 @@ public class CliTest {
         "--artifact-version",
         "0.0.1",
         "--programming-model",
-        "SpringMvc",
+        "SpringMVC",
         "-o",
         tempFile.toFile().getCanonicalPath()
     };
diff --git a/toolkit-maven-plugin/pom.xml b/toolkit-maven-plugin/pom.xml
index b51f335..9574db1 100755
--- a/toolkit-maven-plugin/pom.xml
+++ b/toolkit-maven-plugin/pom.xml
@@ -29,7 +29,6 @@
   <artifactId>toolkit-maven-plugin</artifactId>
 
   <dependencies>
-
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>doc-generator</artifactId>
@@ -47,6 +46,7 @@
       <artifactId>maven-plugin-annotations</artifactId>
       <version>3.6.0</version>
     </dependency>
+
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
@@ -58,6 +58,7 @@
       <artifactId>plexus-archiver</artifactId>
       <version>2.1</version>
     </dependency>
+
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>toolkit-common</artifactId>


[servicecomb-toolkit] 37/49: Support generating pojo consumer

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 1aa7e5d21af830d891532a4fdbaf2165dbbce91c
Author: kakulisen <18...@163.com>
AuthorDate: Mon Jun 3 11:26:31 2019 +0800

    Support generating pojo consumer
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../toolkit/codegen/ServiceCombCodegen.java        | 44 +++++++++++++++-------
 .../consumer/formParamsConsumer.mustache           |  2 +-
 .../ServiceComb/libraries/POJO/api.mustache        | 28 +++-----------
 .../POJO/{api.mustache => apiImpl.mustache}        |  2 +-
 .../libraries/POJO/apiInterface.mustache           | 17 ---------
 5 files changed, 37 insertions(+), 56 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index d6b4fd2..ee1c004 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -18,6 +18,7 @@
 package org.apache.servicecomb.toolkit.codegen;
 
 import java.io.File;
+import java.util.List;
 import java.util.Map;
 
 import io.swagger.codegen.CliOption;
@@ -61,9 +62,11 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private String apiConsumerTemplate = consumerTemplateFolder + "/apiConsumer.mustache";
 
+  private String apiConsumerTemplateForPojo = consumerTemplateFolder + "/pojo/apiConsumer.mustache";
+
   private String modelConsumerTemplate = consumerTemplateFolder + "/model.mustache";
 
-  private String pojoApiInterfaceTemplate = "apiInterface.mustache";
+  private String pojoApiImplTemplate = "apiImpl.mustache";
 
   private int modelSwitch = 1;
 
@@ -130,15 +133,20 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   @Override
   public String apiFilename(String templateName, String tag) {
-    if (apiConsumerTemplate.equals(templateName)) {
+    if (apiConsumerTemplate.equals(templateName) || apiConsumerTemplateForPojo.equals(templateName)) {
       String suffix = apiTemplateFiles().get(templateName);
       return apiConsumerFolder() + File.separator + toApiFilename(tag) + suffix;
     }
-    if (pojoApiInterfaceTemplate.equals(templateName)) {
-      String suffix = apiTemplateFiles().get(templateName);
-      String pojoApiInterfaceName = pojoApiInterfaceFolder() + File.separator + camelize(tag) + "Api" + suffix;
-      additionalProperties.put("pojoApiInterfaceName", camelize(tag) + "Api");
-      return pojoApiInterfaceName;
+
+    if (POJO_LIBRARY.equals(getLibrary())) {
+      if ("apiImpl.mustache".equals(templateName)) {
+        String suffix = apiTemplateFiles().get(templateName);
+        return apiFileFolder() + File.separator + additionalProperties.get("classnameImpl") + suffix;
+      }
+      if ("api.mustache".equals(templateName)) {
+        String suffix = apiTemplateFiles().get(templateName);
+        return pojoApiInterfaceFolder() + File.separator + camelize(tag) + "Api" + suffix;
+      }
     }
     return super.apiFilename(templateName, tag);
   }
@@ -152,6 +160,16 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
   }
 
   @Override
+  public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
+
+    Map operations = (Map) objs.get("operations");
+    String classnameImpl = (String) operations.get("classname") + "Impl";
+    operations.put("classnameImpl", classnameImpl);
+    additionalProperties.put("classnameImpl", classnameImpl);
+    return super.postProcessOperationsWithModels(objs, allModels);
+  }
+
+  @Override
   public void processOpts() {
 
     super.processOpts();
@@ -176,7 +194,9 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
     if (!POJO_LIBRARY.equals(getLibrary())) {
       return;
     }
-    apiTemplateFiles.put(pojoApiInterfaceTemplate, ".java");
+    apiTemplateFiles.put(pojoApiImplTemplate, ".java");
+    apiTemplateFiles.remove(apiConsumerTemplate);
+    apiTemplateFiles.put(apiConsumerTemplateForPojo, "Consumer.java");
     additionalProperties.put("isPOJO", true);
   }
 
@@ -265,7 +285,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
   @Override
   public String toApiName(String name) {
     if (name.length() == 0) {
-      return "DefaultController";
+      return "DefaultApi";
     }
 
     String apiName = (String) additionalProperties.get("apiName");
@@ -273,11 +293,7 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
       return apiName;
     }
 
-    if (POJO_LIBRARY.equals(getLibrary())) {
-      return initialCaps(name) + "ApiImpl";
-    }
-
-    return initialCaps(name) + "Controller";
+    return initialCaps(name) + "Api";
   }
 
   private String mainClassFolder(String projectPath) {
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache b/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
index 5e9bb31..3aad37d 100755
--- a/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
+++ b/code-generator/src/main/resources/ServiceComb/consumer/formParamsConsumer.mustache
@@ -1 +1 @@
-{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
+{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} {{#isPOJO}}File{{/isPOJO}}{{^isPOJO}}MultipartFile{{/isPOJO}} {{baseName}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
index ea99a96..fad66ca 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
@@ -1,35 +1,17 @@
 package {{apiPackage}};
 
-import static org.springframework.http.MediaType.*;
 import java.util.List;
 import java.util.Map;
+import java.util.HashMap;
 import java.io.File;
 {{#imports}}import {{import}};
 {{/imports}}
 import {{modelPackage}}.*;
-import org.apache.servicecomb.provider.pojo.RpcSchema;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestPart;
-import org.springframework.web.multipart.MultipartFile;
 
-@RpcSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
 {{#operations}}
-public class {{classname}} implements {{#removeImplSuffix}}{{classname}}{{/removeImplSuffix}} {
-  {{#operation}}
-
-  @Override
-  public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
-    // do something
-
-    return null;
-  }
-  {{/operation}}
+public interface {{classname}} {
+    {{#operation}}
+     public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+    {{/operation}}
 }
 {{/operations}}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache
similarity index 91%
copy from code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
copy to code-generator/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache
index ea99a96..7e15375 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/api.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiImpl.mustache
@@ -21,7 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 @RpcSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}")
 {{#operations}}
-public class {{classname}} implements {{#removeImplSuffix}}{{classname}}{{/removeImplSuffix}} {
+public class {{classnameImpl}} implements {{classname}} {
   {{#operation}}
 
   @Override
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
deleted file mode 100755
index 84cc2c8..0000000
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/apiInterface.mustache
+++ /dev/null
@@ -1,17 +0,0 @@
-package {{apiPackage}};
-
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.io.File;
-{{#imports}}import {{import}};
-{{/imports}}
-import {{modelPackage}}.*;
-
-{{#operations}}
-public interface {{#removeImplSuffix}}{{classname}}{{/removeImplSuffix}} {
-    {{#operation}}
-     public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
-    {{/operation}}
-}
-{{/operations}}
\ No newline at end of file


[servicecomb-toolkit] 31/49: Change the mainClass value to {{mainClassPackage}} in pom.xml

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 94e291d1b02ea05a8ce3efd009e38b82d3adfcb3
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu May 30 20:50:43 2019 +0800

    Change the mainClass value to {{mainClassPackage}} in pom.xml
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache        | 2 +-
 .../src/main/resources/ServiceComb/libraries/POJO/pom.mustache          | 2 +-
 .../src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache    | 2 +-
 .../src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
index 63d56f3..5e66f46 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/JAX-RS/pom.mustache
@@ -109,7 +109,7 @@
         <version>1.5.12.RELEASE</version>
         <configuration>
           <fork>true</fork>
-          <mainClass>${package}.Application</mainClass>
+          <mainClass>{{mainClassPackage}}.Application</mainClass>
           <outputDirectory>target/bin</outputDirectory>
         </configuration>
         <executions>
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
index 4eb5156..48b6611 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/POJO/pom.mustache
@@ -109,7 +109,7 @@
         <version>1.5.12.RELEASE</version>
         <configuration>
           <fork>true</fork>
-          <mainClass>${package}.Application</mainClass>
+          <mainClass>{{mainClassPackage}}.Application</mainClass>
           <outputDirectory>target/bin</outputDirectory>
         </configuration>
         <executions>
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
index 23571ee..5e3ae14 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/pom.mustache
@@ -105,7 +105,7 @@
         <version>1.5.12.RELEASE</version>
         <configuration>
           <fork>true</fork>
-          <mainClass>${package}.Application</mainClass>
+          <mainClass>{{mainClassPackage}}.Application</mainClass>
           <outputDirectory>target/bin</outputDirectory>
         </configuration>
         <executions>
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
index ea04f8c..353a2ba 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringMVC/pom.mustache
@@ -82,7 +82,7 @@
         <version>1.5.12.RELEASE</version>
         <configuration>
           <fork>true</fork>
-          <mainClass>${package}.Application</mainClass>
+          <mainClass>{{mainClassPackage}}.Application</mainClass>
           <outputDirectory>target/bin</outputDirectory>
         </configuration>
         <executions>


[servicecomb-toolkit] 16/49: Support contract verify

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 990ea5e67968817eeb8e18c423710c6912bce3c0
Author: MabinGo <bi...@huawei.com>
AuthorDate: Sat May 25 00:52:34 2019 +0800

    Support contract verify
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../toolkit/common/CompareAlgorithm.java           |  25 ++++
 .../toolkit/common/ComparisionType.java            |  33 +++++
 .../servicecomb/toolkit/common/Comparison.java     |  40 +++++
 .../toolkit/common/ContractComparator.java         |  81 ++++++++++
 .../servicecomb/toolkit/common/MyersAlgorithm.java |  73 +++++++++
 .../toolkit/common/SplitDiffFormatter.java         | 163 +++++++++++++++++++++
 .../servicecomb/toolkit/cli/CodeGenerate.java      |   2 +-
 .../servicecomb/toolkit/cli/DocGenerate.java       |   2 +-
 .../apache/servicecomb/toolkit/cli/CliTest.java    |   4 +-
 .../toolkit/plugin/GenerateContractsDocMojo.java   |   6 +-
 ...tractsDocMojo.java => VerifyContractsMojo.java} |  50 ++++---
 11 files changed, 449 insertions(+), 30 deletions(-)

diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/CompareAlgorithm.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/CompareAlgorithm.java
new file mode 100755
index 0000000..b049054
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/CompareAlgorithm.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.common;
+
+import java.util.List;
+
+public interface CompareAlgorithm {
+
+  List<Comparison> compare(String source, String dest);
+}
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/ComparisionType.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ComparisionType.java
new file mode 100755
index 0000000..eae9c3e
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ComparisionType.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.common;
+
+public enum ComparisionType {
+
+  /** insert new content */
+  INSERT,
+
+  /** delete content */
+  DELETE,
+
+  /** replace old content */
+  REPLACE,
+
+  /** not change */
+  EQUAL;
+}
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/Comparison.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/Comparison.java
new file mode 100755
index 0000000..6708669
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/Comparison.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.common;
+
+public class Comparison {
+
+  public final ComparisionType type;
+
+  public final int originalPointBegin;
+
+  public final int originalPointEnd;
+
+  public final int destinationPointBegin;
+
+  public final int destinationPointEnd;
+
+  public Comparison(ComparisionType type, int originalPointBegin, int originalPointEnd, int destinationPointBegin,
+      int destinationPointEnd) {
+    this.type = type;
+    this.originalPointBegin = originalPointBegin;
+    this.originalPointEnd = originalPointEnd;
+    this.destinationPointBegin = destinationPointBegin;
+    this.destinationPointEnd = destinationPointEnd;
+  }
+}
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractComparator.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractComparator.java
new file mode 100755
index 0000000..dba8dd9
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/ContractComparator.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.common;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ContractComparator {
+
+  private final static Logger LOGGER = LoggerFactory.getLogger(ContractComparator.class);
+
+  private CompareAlgorithm algorithm;
+
+  private String source;
+
+  private String dest;
+
+  private List<Comparison> comparisonList;
+
+  public ContractComparator(String source, String dest) {
+    this(source, dest, new MyersAlgorithm());
+  }
+
+  public ContractComparator(String source, String dest, CompareAlgorithm algorithm) {
+    this.source = source;
+    this.dest = dest;
+    this.algorithm = algorithm;
+    this.comparisonList = compare();
+  }
+
+  public void setAlgorithm(CompareAlgorithm algorithm) {
+    this.algorithm = algorithm;
+  }
+
+  public CompareAlgorithm getAlgorithm() {
+    return algorithm;
+  }
+
+  public List<Comparison> compare() {
+    return algorithm.compare(source, dest);
+  }
+
+  public boolean equals() {
+    if (comparisonList.size() > 0) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  public void splitPrintToScreen() {
+    splitPrint(System.out);
+  }
+
+  public void splitPrint(OutputStream outputStream) {
+    try {
+      new SplitDiffFormatter(outputStream).format(comparisonList, source, dest);
+    } catch (IOException e) {
+      LOGGER.error(e.getMessage());
+    }
+  }
+}
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java
new file mode 100755
index 0000000..6300b38
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/MyersAlgorithm.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jgit.diff.EditList;
+import org.eclipse.jgit.diff.MyersDiff;
+import org.eclipse.jgit.diff.RawText;
+import org.eclipse.jgit.diff.RawTextComparator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MyersAlgorithm implements CompareAlgorithm {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(MyersAlgorithm.class);
+
+  @Override
+  public List<Comparison> compare(String source, String dest) {
+
+    if (source == null) {
+      LOGGER.error("source must not be null");
+      throw new RuntimeException("source must not be null");
+    }
+    if (source == null) {
+      LOGGER.error("dest must not be null");
+      throw new RuntimeException("dest must not be null");
+    }
+
+    EditList diffList = new EditList();
+    diffList.addAll(MyersDiff.INSTANCE.diff(RawTextComparator.DEFAULT,
+        new RawText(source.getBytes()), new RawText(dest.getBytes())));
+
+    List<Comparison> comparisonList = new ArrayList<>();
+
+    diffList.stream().forEachOrdered(edit -> {
+      ComparisionType comparisionType;
+      switch (edit.getType()) {
+        case INSERT:
+          comparisionType = ComparisionType.INSERT;
+          break;
+        case DELETE:
+          comparisionType = ComparisionType.DELETE;
+          break;
+        case REPLACE:
+          comparisionType = ComparisionType.REPLACE;
+          break;
+        default:
+          comparisionType = ComparisionType.EQUAL;
+          break;
+      }
+      comparisonList
+          .add(new Comparison(comparisionType, edit.getBeginA(), edit.getEndA(), edit.getBeginB(), edit.getEndB()));
+    });
+    return comparisonList;
+  }
+}
diff --git a/common/src/main/java/org/apache/servicecomb/toolkit/common/SplitDiffFormatter.java b/common/src/main/java/org/apache/servicecomb/toolkit/common/SplitDiffFormatter.java
new file mode 100755
index 0000000..b72384d
--- /dev/null
+++ b/common/src/main/java/org/apache/servicecomb/toolkit/common/SplitDiffFormatter.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.common;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jgit.diff.DiffFormatter;
+
+public class SplitDiffFormatter extends DiffFormatter {
+
+  private int radius = 3;
+
+  private final OutputStream out;
+
+  private static final String noNewLine = "\nthis is end of compare\n";
+
+  private static String outputFormat = "%-20s";
+
+  private static String numberFormat = "%-4s";
+
+  public SplitDiffFormatter(OutputStream out) {
+    super(out);
+    this.out = out;
+  }
+
+  public void format(List<Comparison> comparisons, String source, String dest) throws IOException {
+
+    outputFormat = "%-" + (getMaxLineSize(source) + 10) + "s";
+
+    List<String> sourceLines = readStringAsLines(source);
+    List<String> destLines = readStringAsLines(dest);
+
+    for (int currentIndex = 0; currentIndex < comparisons.size(); ) {
+      Comparison currentComparison = comparisons.get(currentIndex);
+      final int endIndex = findOutputEndIndex(comparisons, currentIndex);
+      final Comparison endComparison = comparisons.get(endIndex);
+
+      int originalBegin = (int) Math.max(0, (long) currentComparison.originalPointBegin - radius);
+      int destinationBegin = (int) Math.max(0, (long) currentComparison.destinationPointBegin - radius);
+      int originalEnd = (int) Math.min(sourceLines.size(), (long) endComparison.originalPointEnd + radius);
+      int destinationEnd = (int) Math.min(destLines.size(), (long) endComparison.destinationPointEnd + radius);
+
+      writeHunkHeader(originalBegin, originalEnd, destinationBegin, destinationEnd);
+
+      while (originalBegin < originalEnd || destinationBegin < destinationEnd) {
+
+        if (originalBegin < currentComparison.originalPointBegin || endIndex + 1 < currentIndex) {
+          writeContextLine(sourceLines, originalBegin, destLines, destinationBegin);
+          originalBegin++;
+          destinationBegin++;
+        } else if (originalBegin < currentComparison.originalPointEnd) {
+
+          if (destinationBegin < currentComparison.destinationPointEnd) {
+            writeReplaceLine(sourceLines, originalBegin, destLines, destinationBegin);
+            destinationBegin++;
+          } else {
+            writeRemovedLine(sourceLines, originalBegin, destLines, destinationBegin);
+          }
+          originalBegin++;
+        } else if (destinationBegin < currentComparison.destinationPointEnd) {
+
+          writeAddedLine(sourceLines, originalBegin, destLines, destinationBegin);
+          destinationBegin++;
+        }
+
+        if (end(currentComparison, originalBegin, destinationBegin) && ++currentIndex < comparisons.size()) {
+          currentComparison = comparisons.get(currentIndex);
+        }
+      }
+
+      writeLine(noNewLine);
+    }
+  }
+
+  public int getMaxLineSize(String text) {
+    final int[] maxLen = {0};
+    readStringAsLines(text).forEach(line -> {
+      int temp = line.length();
+      if (temp > maxLen[0]) {
+        maxLen[0] = temp;
+      }
+    });
+    return maxLen[0];
+  }
+
+  private List<String> readStringAsLines(String text) {
+    return Arrays.asList(text.split("\\r?\\n"));
+  }
+
+  protected void writeReplaceLine(List<String> text, int line, List<String> textB, int bCur) throws IOException {
+    writeLine(buildFormatLineLeft(text, line, " -") + buildFormatLineRight(textB, bCur, " +") + "\n");
+  }
+
+  protected void writeContextLine(List<String> text, int line, List<String> textB, int bCur) throws IOException {
+    writeLine(buildFormatLineLeft(text, line, "  ") + buildFormatLineRight(textB, bCur, "  ") + "\n");
+  }
+
+  protected void writeRemovedLine(List<String> text, int line, List<String> textB, int bCur) throws IOException {
+    writeLine(buildFormatLineLeft(text, line, " -") + "\n");
+  }
+
+  protected void writeAddedLine(List<String> text, int line, List<String> textB, int bCur) throws IOException {
+    writeLine(
+        String.format(numberFormat, " ") + String.format(outputFormat, " ") + buildFormatLineRight(textB, bCur, " +")
+            + "\n");
+  }
+
+  protected void writeLine(final String content) throws IOException {
+    out.write(content.getBytes());
+  }
+
+  private String buildFormatLineLeft(List<String> text, int line, String prefix) {
+    return String.format(numberFormat, (line + 1)) + String.format(outputFormat, prefix + text.get(line));
+  }
+
+  private String buildFormatLineRight(List<String> text, int line, String prefix) {
+    return String.format(numberFormat, (line + 1)) + String
+        .format(getOutputFormat(text.get(line).length()), prefix + text.get(line));
+  }
+
+  private String getOutputFormat(int len) {
+    return "%-" + len + "s";
+  }
+
+  private static boolean end(Comparison edit, int a, int b) {
+    return edit.originalPointEnd <= a && edit.destinationPointEnd <= b;
+  }
+
+  private int findOutputEndIndex(List<Comparison> edits, int i) {
+    int end = i + 1;
+    while (end < edits.size()
+        && (isOriginalEnd(edits, end) || isDestinationEnd(edits, end))) {
+      end++;
+    }
+    return end - 1;
+  }
+
+  private boolean isOriginalEnd(List<Comparison> e, int i) {
+    return e.get(i).originalPointBegin - e.get(i - 1).originalPointEnd <= 2 * radius;
+  }
+
+  private boolean isDestinationEnd(List<Comparison> e, int i) {
+    return e.get(i).destinationPointBegin - e.get(i - 1).destinationPointEnd <= 2 * radius;
+  }
+}
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
index 6700110..074f7f9 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
@@ -34,7 +34,7 @@ import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import io.swagger.codegen.config.CodegenConfigurator;
 
-@Command(name = "generate",
+@Command(name = "codegenerate",
     description = "Generate multiple models of microservice project by OpenAPI specification file")
 public class CodeGenerate implements Runnable {
 
diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
index f3089e9..e468973 100755
--- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
+++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
@@ -32,7 +32,7 @@ import org.apache.servicecomb.swagger.SwaggerUtils;
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 
-@Command(name = "docGenerate", description = "Generate document by OpenAPI specification file")
+@Command(name = "docgenerate", description = "Generate document by OpenAPI specification file")
 public class DocGenerate implements Runnable {
 
   @Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
diff --git a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
index cf0d047..647be5c 100755
--- a/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
+++ b/toolkit-cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
@@ -38,7 +38,7 @@ public class CliTest {
         Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/" + model + "Server");
         CliTest.class.getClassLoader().getResource("swagger.yaml");
         String[] args = new String[] {
-            "generate",
+            "codegenerate",
             "-m",
             "ServiceComb",
             "-i",
@@ -93,7 +93,7 @@ public class CliTest {
     Path tempDir = Files.createTempDirectory(null);
     Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/ServiceComb");
     String[] args = new String[] {
-        "generate",
+        "codegenerate",
         "-i",
         Paths.get("./src/test/resources/contracts").toFile().getCanonicalPath(),
         "--artifact-id",
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
index c36cd3a..3c5d975 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
@@ -35,8 +35,8 @@ import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
 import org.apache.servicecomb.swagger.SwaggerUtils;
+import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
 
 @Mojo(name = "generateDoc", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
 @Execute(goal = "generateDoc",
@@ -71,8 +71,8 @@ public class GenerateContractsDocMojo extends AbstractMojo {
 
           DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
               docOutputDir + File.separator
-                  + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")) + ".html",
-              "html");
+                  + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")),
+              format);
           return super.visitFile(file, attrs);
         }
       });
diff --git a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
similarity index 59%
copy from toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
copy to toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
index c36cd3a..1617034 100755
--- a/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/GenerateContractsDocMojo.java
+++ b/toolkit-maven-plugin/src/main/java/org/apache/servicecomb/toolkit/plugin/VerifyContractsMojo.java
@@ -17,14 +17,8 @@
 
 package org.apache.servicecomb.toolkit.plugin;
 
-import java.io.File;
 import java.io.IOException;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Map;
 
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -35,14 +29,15 @@ import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.servicecomb.toolkit.docgen.DocGeneratorManager;
-import org.apache.servicecomb.swagger.SwaggerUtils;
+import org.apache.servicecomb.toolkit.common.ContractComparator;
+import org.apache.servicecomb.toolkit.common.ContractsUtils;
 
-@Mojo(name = "generateDoc", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
-@Execute(goal = "generateDoc",
+@Mojo(name = "verifyContracts", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
+@Execute(goal = "verifyContracts",
     phase = LifecyclePhase.COMPILE
 )
-public class GenerateContractsDocMojo extends AbstractMojo {
+public class VerifyContractsMojo extends AbstractMojo {
+
 
   @Parameter(defaultValue = "${project}", required = true, readonly = true)
   private MavenProject project;
@@ -53,31 +48,40 @@ public class GenerateContractsDocMojo extends AbstractMojo {
   @Parameter(defaultValue = ".yaml")
   private String format;
 
-  @Parameter(defaultValue = "build/doc")
-  private String docOutputDir;
+  @Parameter(defaultValue = "sourceContracts")
+  private String sourceContractsDir;
+
 
   @Override
   public void execute() throws MojoExecutionException, MojoFailureException {
 
+    getLog().info("outputDir : " + outputDir);
+
     ContractGenerator contractGenerator = new ContractGenerator(project);
+
     contractGenerator.generateAndOutput(outputDir, format);
 
     try {
 
-      Files.walkFileTree(Paths.get(outputDir), new SimpleFileVisitor<Path>() {
+      Map<String, byte[]> currentContracts = ContractsUtils.getFilesGroupByFilename(outputDir);
+      Map<String, byte[]> sourceContracts = ContractsUtils.getFilesGroupByFilename(sourceContractsDir);
+
+      currentContracts.forEach((contractName, swagger) -> {
+
+        byte[] sourceSwagger = sourceContracts.get(contractName);
 
-        @Override
-        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+        ContractComparator contractComparator = new ContractComparator(new String(sourceSwagger), new String(swagger));
 
-          DocGeneratorManager.generate(SwaggerUtils.parseSwagger(file.toUri().toURL()),
-              docOutputDir + File.separator
-                  + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")) + ".html",
-              "html");
-          return super.visitFile(file, attrs);
+        if (!contractComparator.equals()) {
+          getLog().info("契约文件不匹配,差异如下");
+          getLog().info(sourceContractsDir + "/" + contractName + " vs " + outputDir + "/" + contractName);
+          contractComparator.splitPrintToScreen();
+        } else {
+          getLog().info("恭喜你,契约校验通过");
         }
       });
     } catch (IOException e) {
-      getLog().error(e.getMessage());
+      e.printStackTrace();
     }
   }
 }


[servicecomb-toolkit] 41/49: Support generating SpringBoot consumer code

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git

commit 30e4f0014c3a9b5360188224d88ef7ca73a478c3
Author: kakulisen <18...@163.com>
AuthorDate: Mon Jun 3 17:35:02 2019 +0800

    Support generating SpringBoot consumer code
    
    Signed-off-by: kakulisen <18...@163.com>
---
 .../toolkit/codegen/ServiceCombCodegen.java        |  10 +-
 .../consumer/springboot/Application.mustache       |  14 +++
 .../ServiceComb/consumer/springboot/pom.mustache   | 132 +++++++++++++++++++++
 .../libraries/SpringBoot/operationMethod.mustache  |   1 +
 4 files changed, 155 insertions(+), 2 deletions(-)

diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
index ee1c004..cbfbb46 100755
--- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
+++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombCodegen.java
@@ -248,12 +248,18 @@ public class ServiceCombCodegen extends AbstractJavaCodegen implements CodegenCo
 
   private void processConsumerOpts() {
 
-    supportingFiles.add(new SupportingFile(consumerTemplateFolder + "/pom.mustache",
+    String newConsumerTemplateFolder = consumerTemplateFolder;
+
+    if (SPRING_BOOT_LIBRARY.equals(getLibrary())) {
+      newConsumerTemplateFolder += "/springboot";
+    }
+
+    supportingFiles.add(new SupportingFile(newConsumerTemplateFolder + "/pom.mustache",
         consumerProject,
         "pom.xml")
     );
 
-    supportingFiles.add(new SupportingFile(consumerTemplateFolder + "/Application.mustache",
+    supportingFiles.add(new SupportingFile(newConsumerTemplateFolder + "/Application.mustache",
         mainClassFolder(consumerProject),
         "Application.java")
     );
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/springboot/Application.mustache b/code-generator/src/main/resources/ServiceComb/consumer/springboot/Application.mustache
new file mode 100755
index 0000000..0cf7ff0
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/springboot/Application.mustache
@@ -0,0 +1,14 @@
+package {{mainClassPackage}};
+
+import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableServiceComb
+public class Application {
+
+  public static void main(String[] args) throws Exception {
+    SpringApplication.run(Application.class, args);
+  }
+}
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/consumer/springboot/pom.mustache b/code-generator/src/main/resources/ServiceComb/consumer/springboot/pom.mustache
new file mode 100755
index 0000000..dbeb038
--- /dev/null
+++ b/code-generator/src/main/resources/ServiceComb/consumer/springboot/pom.mustache
@@ -0,0 +1,132 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <artifactId>{{artifactId}}</artifactId>
+    <groupId>{{groupId}}</groupId>
+    <version>{{artifactVersion}}</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>consumer</artifactId>
+  <packaging>jar</packaging>
+  <name>consumer</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java-chassis.version>1.2.0</java-chassis.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>${java-chassis.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>{{groupId}}</groupId>
+      <artifactId>model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>spring-boot-starter-provider</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>spring-boot-starter-provider</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-flowcontrol-qps</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-bizkeeper</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-tracing-zipkin</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>inspector</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.hibernate.validator</groupId>
+      <artifactId>hibernate-validator</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.validation</groupId>
+      <artifactId>validation-api</artifactId>
+      <version>2.0.1.Final</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.12.RELEASE</version>
+        <configuration>
+          <fork>true</fork>
+          <mainClass>{{mainClassPackage}}.Application</mainClass>
+          <outputDirectory>target/bin</outputDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
index 948212d..f6c2ef9 100755
--- a/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
+++ b/code-generator/src/main/resources/ServiceComb/libraries/SpringBoot/operationMethod.mustache
@@ -1,4 +1,5 @@
 {{#operation}}
+
   @RequestMapping(value = "{{path}}", {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} method = RequestMethod.{{httpMethod}})
   public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
     // do something