1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 package org.oran.otf.api;
\r
19 import static com.google.common.collect.Sets.newHashSet;
\r
21 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
\r
22 import io.swagger.v3.oas.annotations.info.Contact;
\r
23 import io.swagger.v3.oas.annotations.info.Info;
\r
24 import org.apache.commons.logging.Log;
\r
25 import org.apache.commons.logging.LogFactory;
\r
26 import org.springframework.boot.SpringApplication;
\r
27 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
\r
28 import org.springframework.boot.autoconfigure.SpringBootApplication;
\r
29 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
\r
30 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
\r
31 import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration;
\r
32 import org.springframework.context.ApplicationContext;
\r
33 import org.springframework.context.annotation.Bean;
\r
34 import org.springframework.context.annotation.ComponentScan;
\r
35 import org.springframework.context.annotation.Configuration;
\r
36 import springfox.documentation.builders.PathSelectors;
\r
37 import springfox.documentation.spi.DocumentationType;
\r
38 import springfox.documentation.spring.web.plugins.Docket;
\r
39 import springfox.documentation.swagger2.annotations.EnableSwagger2;
\r
41 @SpringBootApplication
\r
43 @EnableAutoConfiguration(
\r
45 ErrorMvcAutoConfiguration.class,
\r
46 DataSourceAutoConfiguration.class,
\r
47 HibernateJpaAutoConfiguration.class,
\r
49 @ComponentScan(basePackages = "org.oran.otf")
\r
54 title = "Open Test Framework API",
\r
56 description = "A RESTful API used to communicate with the OTF test control unit.",
\r
57 contact = @Contact(url = "https://localhost:32524", name = "OTF")))
\r
58 public class Application {
\r
59 private static final Log log = LogFactory.getLog(Application.class);
\r
61 public static void main(String[] args) {
\r
62 ApplicationContext ctx = SpringApplication.run(Application.class, args);
\r
66 public Docket testInstanceApi() {
\r
67 return new Docket(DocumentationType.SWAGGER_2)
\r
69 // .apis(testInstancePath())
\r
70 .paths(PathSelectors.any())
\r
72 .protocols(newHashSet("https"));
\r