create basic application infra for workflow 03/50103/1
authoravigaffa <avi.gaffa@amdocs.com>
Mon, 4 Jun 2018 11:02:24 +0000 (14:02 +0300)
committeravigaffa <avi.gaffa@amdocs.com>
Mon, 4 Jun 2018 11:17:06 +0000 (14:17 +0300)
Change-Id: Iedc617a626317a7f1a5b1389fe1666ccae2c43f3
Issue-ID: SDC-1369
Signed-off-by: avigaffa <avi.gaffa@amdocs.com>
.gitignore
workflow-designer-be/pom.xml [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/SpringBootWebApplication.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowsController.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/config/SwaggerConfig.java [new file with mode: 0644]
workflow-designer-be/src/main/resources/application.properties [new file with mode: 0644]

index 9d96998..26a6c96 100644 (file)
@@ -1,3 +1,5 @@
+.idea/
+*.iml
 .classpath
 .project
 .settings/
diff --git a/workflow-designer-be/pom.xml b/workflow-designer-be/pom.xml
new file mode 100644 (file)
index 0000000..ddcb9c6
--- /dev/null
@@ -0,0 +1,82 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.onap.sdc.workflow</groupId>
+    <artifactId>workflow-be</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.0.2.RELEASE</version>
+    </parent>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jetty</artifactId>
+        </dependency>
+
+        <!--
+                <dependency>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-data-cassandra</artifactId>
+                </dependency>
+        -->
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.8.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.8.0</version>
+            <scope>compile</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
\ 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 (file)
index 0000000..e1bd8ea
--- /dev/null
@@ -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 (file)
index 0000000..229bc8c
--- /dev/null
@@ -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<String> 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 (file)
index 0000000..ed317f4
--- /dev/null
@@ -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 (file)
index 0000000..5df521b
--- /dev/null
@@ -0,0 +1,2 @@
+server.servlet.context-path=/wf
+server.port=8080
\ No newline at end of file