Skip to content

Commit 5e81585

Browse files
Updated RAML definitions and swagger annotations (#292)
Updated RAML definitions and swagger annotations. Use EI version for swagger API. Change startup of docker environment in travis.
1 parent acbe089 commit 5e81585

37 files changed

+383
-375
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dist: xenial
55
language: java
66

77
services:
8-
- docker
8+
- docker
99

1010
env:
1111
- JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
@@ -23,11 +23,9 @@ before_install:
2323
# This is only run before integrationTests job
2424
# To ensure docker containers are fully up and running we sleep 20s
2525
before_script:
26-
- cd src/main/docker/
27-
- source env.bash
28-
- docker-compose up -d mongodb rabbitmq eiffel-er jenkins mail-server ei-backend
26+
- source src/main/docker/env.bash
27+
- docker-compose -f src/main/docker/docker-compose.yml up -d mongodb rabbitmq eiffel-er jenkins mail-server
2928
- sleep 60
30-
- cd ../../../
3129

3230

3331
# Generate site documentation using mvn site plugin

src/main/java/com/ericsson/ei/config/SwaggerConfig.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package com.ericsson.ei.config;
1919

20+
import com.ericsson.ei.controller.model.ParseInstanceInfoEI;
21+
import org.springframework.beans.factory.annotation.Autowired;
2022
import org.springframework.context.annotation.Bean;
2123
import org.springframework.context.annotation.Configuration;
2224

@@ -30,6 +32,10 @@
3032
@Configuration
3133
@EnableSwagger2
3234
public class SwaggerConfig {
35+
36+
@Autowired
37+
ParseInstanceInfoEI parseInstanceInfoEI;
38+
3339
@Bean
3440
public Docket productApi() {
3541
return new Docket(DocumentationType.SWAGGER_2)
@@ -42,9 +48,9 @@ public Docket productApi() {
4248
@SuppressWarnings("deprecation")
4349
private ApiInfo metaData() {
4450
ApiInfo apiInfo = new ApiInfo(
45-
"Subscription REST API",
46-
"Subscription REST API to store and retrive the subscription.",
47-
"1.0",
51+
"Eiffel Intelligence REST API",
52+
"A real time data aggregation and analysis solution for Eiffel events.",
53+
parseInstanceInfoEI.getVersion(),
4854
"Terms of service","",
4955
"Apache License Version 2.0",
5056
"https://www.apache.org/licenses/LICENSE-2.0");

src/main/java/com/ericsson/ei/controller/AuthController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
/**
12-
* No description
12+
* This class handles requests related to authentication.
1313
* (Generated with springmvc-raml-parser v.2.0.4)
1414
*
1515
*/
@@ -20,21 +20,21 @@ public interface AuthController {
2020

2121

2222
/**
23-
* This call for checking if security is enabled
23+
* This method checks if security is enabled.
2424
*
2525
*/
2626
@RequestMapping(value = "", method = RequestMethod.GET)
2727
public ResponseEntity<?> getAuth();
2828

2929
/**
30-
* This call for getting logged in user
30+
* This method returns a logged in user.
3131
*
3232
*/
3333
@RequestMapping(value = "/login", method = RequestMethod.GET)
3434
public ResponseEntity<?> getAuthLogin();
3535

3636
/**
37-
* This call for checking backend status
37+
* This method checks Eiffel Intelligene backend status.
3838
*
3939
*/
4040
@RequestMapping(value = "/checkStatus", method = RequestMethod.GET)

src/main/java/com/ericsson/ei/controller/AuthControllerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
@Component
3939
@CrossOrigin
40-
@Api(value = "Auth", description = "REST endpoints for authentication and authorization")
40+
@Api(value = "Auth", tags = {"Authentication"})
4141
public class AuthControllerImpl implements AuthController {
4242

4343
private static final Logger LOGGER = LoggerFactory.getLogger(AuthControllerImpl.class);

src/main/java/com/ericsson/ei/controller/DownloadController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
/**
12-
* No description
12+
* This class is responsible for providing templates of rules, Eiffel events and subscriptions.
1313
* (Generated with springmvc-raml-parser v.2.0.4)
1414
*
1515
*/
@@ -20,28 +20,28 @@ public interface DownloadController {
2020

2121

2222
/**
23-
* This call for getting list of available templates
23+
* This method returns a list of endpoints for downloading templates.
2424
*
2525
*/
2626
@RequestMapping(value = "", method = RequestMethod.GET)
2727
public ResponseEntity<?> getDownload();
2828

2929
/**
30-
* This call for getting subscriptions template
30+
* This method returns a subscription template.
3131
*
3232
*/
3333
@RequestMapping(value = "/subscriptionsTemplate", method = RequestMethod.GET)
3434
public ResponseEntity<?> getDownloadSubscriptionsTemplate();
3535

3636
/**
37-
* This call for getting rules template
37+
* This method returns a template for rules.
3838
*
3939
*/
4040
@RequestMapping(value = "/rulesTemplate", method = RequestMethod.GET)
4141
public ResponseEntity<?> getDownloadRulesTemplate();
4242

4343
/**
44-
* This call for getting events template
44+
* This method returns a template for Eiffel events.
4545
*
4646
*/
4747
@RequestMapping(value = "/eventsTemplate", method = RequestMethod.GET)

src/main/java/com/ericsson/ei/controller/DownloadControllerImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.InputStream;
2020

21+
import io.swagger.annotations.ApiOperation;
2122
import org.apache.commons.io.IOUtils;
2223
import org.json.JSONObject;
2324
import org.slf4j.Logger;
@@ -33,12 +34,13 @@
3334

3435
@Component
3536
@CrossOrigin
36-
@Api(value = "Get Templates", description = "REST endpoints for getting templates")
37+
@Api(value = "Download templates", tags = {"Download"})
3738
public class DownloadControllerImpl implements DownloadController {
3839

3940
private static final Logger LOGGER = LoggerFactory.getLogger(DownloadControllerImpl.class);
4041

4142
@Override
43+
@ApiOperation(value = "Retrieve REST endpoints for downloading templates")
4244
public ResponseEntity<?> getDownload() {
4345
try {
4446
JSONObject response = new JSONObject();
@@ -55,6 +57,7 @@ public ResponseEntity<?> getDownload() {
5557
}
5658

5759
@Override
60+
@ApiOperation(value = "Download subscription template")
5861
public ResponseEntity<?> getDownloadSubscriptionsTemplate() {
5962
try {
6063
InputStream is = getClass().getResourceAsStream("/templates/subscriptionsTemplate.json");
@@ -73,6 +76,7 @@ public ResponseEntity<?> getDownloadSubscriptionsTemplate() {
7376
}
7477

7578
@Override
79+
@ApiOperation(value = "Download rules template")
7680
public ResponseEntity<?> getDownloadRulesTemplate() {
7781
try {
7882
InputStream is = getClass().getResourceAsStream("/templates/rulesTemplate.json");
@@ -91,6 +95,7 @@ public ResponseEntity<?> getDownloadRulesTemplate() {
9195
}
9296

9397
@Override
98+
@ApiOperation(value = "Download Eiffel events template")
9499
public ResponseEntity<?> getDownloadEventsTemplate() {
95100
try {
96101
InputStream is = getClass().getResourceAsStream("/templates/eventsTemplate.json");

src/main/java/com/ericsson/ei/controller/EIHomeController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package com.ericsson.ei.controller;
1818

19+
import io.swagger.annotations.ApiOperation;
1920
import org.springframework.stereotype.Controller;
2021
import org.springframework.web.bind.annotation.RequestMapping;
2122
import org.springframework.web.bind.annotation.RequestMethod;
@@ -28,6 +29,7 @@
2829
@Controller
2930
public class EIHomeController {
3031

32+
@ApiOperation(value="", hidden = true)
3133
@RequestMapping(value = "/", method = RequestMethod.GET)
3234
public String home() {
3335
return "redirect:/swagger-ui.html";

src/main/java/com/ericsson/ei/controller/InformationController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010

1111
/**
12-
* Provides interaction with InstanceInfo resource
13-
*
12+
* This class provides information about Eiffel Intelligence backend.
1413
* (Generated with springmvc-raml-parser v.2.0.4)
1514
*
1615
*/
@@ -21,8 +20,7 @@ public interface InformationController {
2120

2221

2322
/**
24-
* List of all instance information
25-
*
23+
* This method retrieves backend instance information.
2624
*
2725
*/
2826
@RequestMapping(value = "", method = RequestMethod.GET)

src/main/java/com/ericsson/ei/controller/InformationControllerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
@Component
3131
@CrossOrigin
32-
@Api(value = "information", description = "The Information about Eiffel Intelligence Backend instance")
32+
@Api(value = "information", tags = {"Information"})
3333
public class InformationControllerImpl implements InformationController {
3434
private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(InformationControllerImpl.class);
3535

@@ -38,7 +38,7 @@ public class InformationControllerImpl implements InformationController {
3838

3939
@Override
4040
@CrossOrigin
41-
@ApiOperation(value = "Parse information")
41+
@ApiOperation(value = "Shows information about Eiffel Intelligence backend")
4242
public ResponseEntity<?> getInformation() {
4343
try {
4444
String info = new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(instanceInfo);

src/main/java/com/ericsson/ei/controller/QueryAggregatedObjectController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
/**
13-
* No description
13+
* This class returns aggregated data given a specific ID of an aggregated object.
1414
* (Generated with springmvc-raml-parser v.2.0.4)
1515
*
1616
*/
@@ -21,7 +21,7 @@ public interface QueryAggregatedObjectController {
2121

2222

2323
/**
24-
* No description
24+
* This method retrieves aggregated data on a specific aggregated object, given an ID.
2525
*
2626
*/
2727
@RequestMapping(value = "", method = RequestMethod.GET)

0 commit comments

Comments
 (0)