Skip to content

Commit 8f4aba6

Browse files
Fix endpoints and tests (#274)
1 parent ebe38ba commit 8f4aba6

File tree

7 files changed

+50
-30
lines changed

7 files changed

+50
-30
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.ericsson.ei.frontend;
2+
3+
import org.junit.runner.RunWith;
4+
5+
import cucumber.api.CucumberOptions;
6+
import cucumber.api.junit.Cucumber;
7+
8+
@RunWith(Cucumber.class)
9+
@CucumberOptions(features = "src/integrationtest/resources/features/aggregated-objects.feature", glue = {
10+
"com.ericsson.ei.frontend" }, plugin = {
11+
"html:target/cucumber-reports/AggregatedObjectsRunnerIT" })
12+
public class AggregatedObjectsRunnerIT {
13+
14+
}

src/integrationtest/java/com/ericsson/ei/frontend/QueryRunnerIT.java renamed to src/integrationtest/java/com/ericsson/ei/frontend/FailedNotificationsRunnerIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import cucumber.api.junit.Cucumber;
77

88
@RunWith(Cucumber.class)
9-
@CucumberOptions(features = "src/integrationtest/resources/features/query.feature", glue = {
9+
@CucumberOptions(features = "src/integrationtest/resources/features/failed-notifications.feature", glue = {
1010
"com.ericsson.ei.frontend" }, plugin = {
1111
"html:target/cucumber-reports/QueryRunnerIT" })
12-
public class QueryRunnerIT {
12+
public class FailedNotificationsRunnerIT {
1313

14-
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
@QueryFeature
22
Feature: Query test
33

4-
@QueryMissedNotificationsScenario
5-
Scenario: Query missed notifications
6-
Given frontend is up and running
7-
When a 'GET' request is prepared for REST API '/failed-notifications'
8-
And param key 'subscriptionName' with value 'NonExistingSubscription' is added
9-
And request is sent
10-
Then response code 200 is received
11-
And response body '{"queryResponseEntity":{}}' is received
12-
134
@QueryByIdScenario
145
Scenario: Query aggregated object by ID
156
Given frontend is up and running
167
And an aggregated object is created
17-
When a 'GET' request is prepared for REST API '/queryAggregatedObject'
18-
And param key 'ID' with value '6acc3c87-75e0-4b6d-88f5-b1a5d4e62b43' is added
8+
When a 'GET' request is prepared for REST API '/aggregated-objects'
9+
And '/6acc3c87-75e0-4b6d-88f5-b1a5d4e62b43' is appended to endpoint
1910
And request is sent for 30 seconds until response code no longer matches 204
2011
And response body contains '6acc3c87-75e0-4b6d-88f5-b1a5d4e62b43'
2112

2213
@QueryFreestyleScenario
2314
Scenario: Query aggregated object with freestyle criteria
2415
Given frontend is up and running
2516
And an aggregated object is created
26-
When a 'POST' request is prepared for REST API '/query'
17+
When a 'POST' request is prepared for REST API '/aggregated-objects/query'
2718
And body is set to file 'queryFreestyle.json'
2819
And request is sent for 30 seconds until response code no longer matches 204
2920
And response body contains '6acc3c87-75e0-4b6d-88f5-b1a5d4e62b43'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@FailedNotificationsFeature
2+
Feature: Failed notifications test
3+
4+
@FailedNotificationsScenario
5+
Scenario: Query failed notifications
6+
Given frontend is up and running
7+
When a 'GET' request is prepared for REST API '/failed-notifications'
8+
And param key 'subscriptionNames' with value 'NonExistingSubscription' is added
9+
And request is sent
10+
Then response code 200 is received
11+
And response body '[]' is received

src/integrationtest/resources/integration-test.properties

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ build.version=
88
# port where Eiffel Intelligence will run
99
server.port: 8090
1010

11-
# path to files with rules for aggregating objects
11+
# path to file containing aggregation rules
12+
# if the path is a url it needs to include the http(s) protocol.
1213
rules.path: /rules/ArtifactRules-Eiffel-Agen-Version.json
1314

1415
# logging levels can be set with the flag below for the top packages
@@ -45,6 +46,8 @@ spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedd
4546
# Details for connection to mongoDB
4647
spring.data.mongodb.host: localhost
4748
spring.data.mongodb.port: 27017
49+
#spring.data.mongodb.username:
50+
#spring.data.mongodb.password:
4851
spring.data.mongodb.database: eiffel_intelligence
4952
# we cannot have empty username and password property here
5053
# if these properties are empty, remove or comment them
@@ -87,19 +90,20 @@ threads.corePoolSize: 100
8790
threads.queueCapacity: 5000
8891
threads.maxPoolSize: 150
8992

90-
# name of the collection where missed notifications are stored
91-
missedNotificationCollectionName: Notification
92-
# name of the database where missed notifications are stored
93-
missedNotificationDataBaseName: MissedNotification
94-
# email sender settings for email notifications
95-
email.sender: noreply@ericsson.com
96-
email.subject: Email Subscription Notification
93+
# WaitList-worker and Scheduling task executor thread settings
94+
scheduled.threadpool.size: 100
9795

98-
# number of retries if a notification fail
96+
# name of the collection where failed notifications are stored
97+
failed.notification.collection-name: failed_notification
98+
# number of retries if a notification fails
9999
notification.failAttempt: 3
100-
# time to live in database in seconds for missed notifications
100+
# time to live in database in seconds for failed notifications
101101
notification.ttl.value: 600
102102

103+
# email sender settings for email notifications
104+
email.sender: noreply@ericsson.com
105+
email.subject: Email Subscription Notification
106+
103107
# email server settings to route email notifications
104108
# through
105109
spring.mail.host:
@@ -132,4 +136,4 @@ ldap.server.list: [\
132136
"password": "YWRtaW4=",\
133137
"user.filter": "uid={0}"\
134138
}\
135-
]\
139+
]\

src/main/java/com/ericsson/ei/frontend/EIRequestsController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class EIRequestsController {
7171
@CrossOrigin
7272
@RequestMapping(value = { "/subscriptions", "/subscriptions/*",
7373
"/information", "/templates/*", "/authentication", "/authentication/*",
74-
"/queryAggregatedObject", "/failed-notifications", "/query", "/rules", "/status",
74+
"/aggregated-objects/*", "/failed-notifications", "/aggregated-objects/query", "/rules", "/status",
7575
"/rule-test" }, method = RequestMethod.GET)
7676
public ResponseEntity<String> getRequests(Model model, HttpServletRequest incomingRequest) {
7777
String eiRequestUrl;
@@ -99,7 +99,7 @@ public ResponseEntity<String> getRequests(Model model, HttpServletRequest incomi
9999
*/
100100
@CrossOrigin
101101
@RequestMapping(value = { "/subscriptions", "/rule-test/run-full-aggregation",
102-
"/query" }, method = RequestMethod.POST)
102+
"/aggregated-objects/query" }, method = RequestMethod.POST)
103103
public ResponseEntity<String> postRequests(Model model, HttpServletRequest incomingRequest) {
104104
String eiRequestUrl;
105105
try {

src/test/java/com/ericsson/ei/frontend/EIRequestControllerUtilsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ public void testGetEIRequestURL() throws Exception {
7575
assertEquals("http://NullHost:12345/subscription", url);
7676

7777
// Test name TestName and query string.
78-
when(mockedRequest.getServletPath()).thenReturn("/query");
78+
when(mockedRequest.getServletPath()).thenReturn("/aggregated-objects/query");
7979
when(mockedRequest.getQueryString()).thenReturn("someQuery=Something");
8080
url = eiRequestsControllerUtils.getEIRequestURL(mockedRequest);
81-
assertEquals("http://NullHost:12345/query?someQuery=Something", url);
81+
assertEquals("http://NullHost:12345/aggregated-objects/query?someQuery=Something", url);
8282

8383
// Test url given in input from request.
8484
when(mockedRequest.getServletPath()).thenReturn("/subscription");

0 commit comments

Comments
 (0)