From 41d8ff7b8796491cb3d85d098257811767616782 Mon Sep 17 00:00:00 2001 From: avigaffa Date: Mon, 4 Jun 2018 14:02:24 +0300 Subject: create basic application infra for workflow Change-Id: Iedc617a626317a7f1a5b1389fe1666ccae2c43f3 Issue-ID: SDC-1369 Signed-off-by: avigaffa --- workflow-designer-be/pom.xml | 82 ++++++++++++++++++++++ .../sdc/workflow/SpringBootWebApplication.java | 21 ++++++ .../onap/sdc/workflow/api/WorkflowsController.java | 23 ++++++ .../onap/sdc/workflow/config/SwaggerConfig.java | 38 ++++++++++ .../src/main/resources/application.properties | 2 + 5 files changed, 166 insertions(+) create mode 100644 workflow-designer-be/pom.xml create mode 100644 workflow-designer-be/src/main/java/org/onap/sdc/workflow/SpringBootWebApplication.java create mode 100644 workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowsController.java create mode 100644 workflow-designer-be/src/main/java/org/onap/sdc/workflow/config/SwaggerConfig.java create mode 100644 workflow-designer-be/src/main/resources/application.properties (limited to 'workflow-designer-be') diff --git a/workflow-designer-be/pom.xml b/workflow-designer-be/pom.xml new file mode 100644 index 00000000..ddcb9c63 --- /dev/null +++ b/workflow-designer-be/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + org.onap.sdc.workflow + workflow-be + 1.3.0-SNAPSHOT + + org.springframework.boot + spring-boot-starter-parent + 2.0.2.RELEASE + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-jetty + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-devtools + + + io.springfox + springfox-swagger-ui + 2.8.0 + compile + + + io.springfox + springfox-swagger2 + 2.8.0 + compile + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + \ No newline at end of file diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/SpringBootWebApplication.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/SpringBootWebApplication.java new file mode 100644 index 00000000..e1bd8eac --- /dev/null +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/SpringBootWebApplication.java @@ -0,0 +1,21 @@ +package org.onap.sdc.workflow; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; + + +@SpringBootApplication +public class SpringBootWebApplication { + public static void main(String[] args) { + SpringApplication.run(SpringBootWebApplication.class, args); + } + + @Bean + public ConfigurableServletWebServerFactory webServerFactory() { + JettyServletWebServerFactory factory = new JettyServletWebServerFactory(); + return factory; + } +} diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowsController.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowsController.java new file mode 100644 index 00000000..229bc8c1 --- /dev/null +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowsController.java @@ -0,0 +1,23 @@ +package org.onap.sdc.workflow.api; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.Collection; + +@RestController +@RequestMapping("/workflows") +@Api(value = "Workflows kalsjkaj") +public class WorkflowsController { + + @GetMapping + @ApiOperation(value = "List workflows", response = Collection.class) + public Collection list() { + return Arrays.asList("a", "c"); + } + +} diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/config/SwaggerConfig.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/config/SwaggerConfig.java new file mode 100644 index 00000000..ed317f4b --- /dev/null +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/config/SwaggerConfig.java @@ -0,0 +1,38 @@ +package org.onap.sdc.workflow.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; +import static springfox.documentation.builders.PathSelectors.regex; + +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + + /*@Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); + }*/ + + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.basePackage("org.onap.sdc.workflow.api")) + .paths(regex("/workflows.*")) + .build(); + } +} \ No newline at end of file diff --git a/workflow-designer-be/src/main/resources/application.properties b/workflow-designer-be/src/main/resources/application.properties new file mode 100644 index 00000000..5df521b5 --- /dev/null +++ b/workflow-designer-be/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.servlet.context-path=/wf +server.port=8080 \ No newline at end of file -- cgit 1.2.3-korg