Skip to content

Commit 306cf06

Browse files
authored
Update rule check endpoints (#273)
- Backend rule check endpoints has been changed to rule-test with a bit different structure to fit REST better.
1 parent a5ad7f0 commit 306cf06

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/functionaltest/java/com/ericsson/ei/frontend/SeleniumBaseClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected void initBaseMocks(CloseableHttpClient mockedHttpClient) throws Client
8282
.execute(Mockito.argThat(request -> (request).getURI().toString().contains("/subscriptions")));
8383

8484
Mockito.doReturn(responseData).when(mockedHttpClient).execute(Mockito
85-
.argThat(request -> (request).getURI().toString().contains("/rules/rule-check/testRulePageEnabled")));
85+
.argThat(request -> (request).getURI().toString().contains("/rule-test")));
8686

8787
}
8888

src/functionaltest/java/com/ericsson/ei/frontend/TestRulesFunctionality.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void tearDownMocks() throws IOException {
8787

8888
private void verifyAggregatedObjectButton() throws IOException {
8989
String findAggregatedObjectResponse = getJSONStringFromFile(AGGREGATED_OBJECT_FILE_PATH);
90-
mockClient.when(request().withMethod("POST").withPath("/rules/rule-check/aggregation"))
90+
mockClient.when(request().withMethod("POST").withPath("/rule-test/run-full-aggregation"))
9191
.respond(response().withStatusCode(200).withBody(findAggregatedObjectResponse));
9292

9393
testRulesPage.clickFindAggregatedObject();

src/integrationtest/resources/features/rules.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ Feature: Rules test
44
@RulesPageEnabledScenario
55
Scenario: Rules page enabled
66
Given frontend is up and running
7-
When a 'GET' request is prepared for REST API '/rules/rule-check/testRulePageEnabled'
7+
When a 'GET' request is prepared for REST API '/rule-test'
88
And request is sent
99
Then response code 200 is received
1010
And response body '{"status":true}' is received
1111

1212
@RulesAggregationScenario
1313
Scenario: Rules aggregation
1414
Given frontend is up and running
15-
When a 'POST' request is prepared for REST API '/rules/rule-check/aggregation'
15+
When a 'POST' request is prepared for REST API '/rule-test/run-full-aggregation'
1616
And aggregation is prepared with rules file 'listRules.json' and events file 'listEvents.json'
1717
And request is sent
1818
Then response code 200 is received

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class EIRequestsController {
7272
@RequestMapping(value = { "/subscriptions", "/subscriptions/*",
7373
"/information", "/templates/*", "/authentication", "/authentication/*",
7474
"/queryAggregatedObject", "/failed-notifications", "/query", "/rules", "/status",
75-
"/rules/rule-check/testRulePageEnabled" }, method = RequestMethod.GET)
75+
"/rule-test" }, method = RequestMethod.GET)
7676
public ResponseEntity<String> getRequests(Model model, HttpServletRequest incomingRequest) {
7777
String eiRequestUrl;
7878
try {
@@ -98,7 +98,7 @@ public ResponseEntity<String> getRequests(Model model, HttpServletRequest incomi
9898
* @return
9999
*/
100100
@CrossOrigin
101-
@RequestMapping(value = { "/subscriptions", "/rules/rule-check/aggregation",
101+
@RequestMapping(value = { "/subscriptions", "/rule-test/run-full-aggregation",
102102
"/query" }, method = RequestMethod.POST)
103103
public ResponseEntity<String> postRequests(Model model, HttpServletRequest incomingRequest) {
104104
String eiRequestUrl;

src/main/resources/static/js/global-variables.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ var backendEndpoints = {
1919
DOWNLOAD_SUBSCRIPTIONS_TEMPLATE: "/templates/subscriptions",
2020
INFORMATION: "/information",
2121
RULES: "/rules",
22-
TEST_RULES_PAGE_ENABLED: "/rules/rule-check/testRulePageEnabled",
23-
CHECK_AGGREGATION: "/rules/rule-check/aggregation"
22+
TEST_RULES_PAGE_ENABLED: "/rule-test",
23+
CHECK_AGGREGATION: "/rule-test/run-full-aggregation"
2424
};
2525

2626
var PAGES_FOR_STATUS_INDICATION = "subscriptions test-rules ei-info login";

wiki/markdown/curl-examples.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,12 @@ Example curl commands to these endpoints [can be found here](https://github.com/
305305
<td>Get the current rules content</td>
306306
</tr>
307307
<tr>
308-
<td>/rules/rule-check/testRulePageEnabled</td>
308+
<td>/rule-test</td>
309309
<td>GET</td>
310310
<td>Check if TestRules is enabled in the back-end</td>
311311
</tr>
312312
<tr>
313-
<td>/rules/rule-check/aggregation</td>
313+
<td>/rule-test/run-full-aggregation</td>
314314
<td>POST</td>
315315
<td>Takes rules and events from an object and returns an aggregated object</td>
316316
</tr>
@@ -319,7 +319,7 @@ Example curl commands to these endpoints [can be found here](https://github.com/
319319
For these endpoints to be reachable the Eiffel Intelligence back-end [needs to be configured](https://github.com/eiffel-community/eiffel-intelligence/blob/master/src/main/resources/application.properties) with `testaggregated.enabled: true`.
320320
The below command would result in a json response of `{"status":true}` if this functionality is enabled.
321321

322-
curl -X GET -H "Content-type: application/json" localhost:8080/rules/rule-check/testRulePageEnabled
322+
curl -X GET -H "Content-type: application/json" localhost:8080/rule-test
323323

324324
Example curl commands to these endpoints [can be found here](https://github.com/eiffel-community/eiffel-intelligence/blob/master/wiki/markdown/running-rules-on-objects.md)
325325

wiki/markdown/test-rules.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Test Rules User Guide
22

33
Clicking on the Test Rules element in the navigator window opens an
4-
interface in the work window and interacts with the `/rules/rule-check`
4+
interface in the work window and interacts with the `/rule-test/run-single-rule`
55
end point of Eiffel Intelligence. This interface can be used to test
66
rules on events.
77

@@ -82,7 +82,7 @@ It is possible to use curl to get required information. To get information
8282
about test rules status, if this functionality is enabled in back-end or
8383
not, you can execute command below.
8484

85-
curl -X GET http://<host>:8080/rules/rule-check/testRulePageEnabled?backendurl="http://127.0.0.1:8090/"
85+
curl -X GET http://<host>:8080/rule-test?backendurl="http://127.0.0.1:8090/"
8686

8787
To execute rules on specific events with curl, you need to create a JSON
8888
file with rules and events. File should contain:
@@ -102,7 +102,7 @@ file with rules and events. File should contain:
102102

103103
And then run curl command below.
104104

105-
curl -X POST -d "@<path to file>" -H "Content-Type: application/json" http://<host>:8080/rules/rule-check/aggregation?backendurl="http://127.0.0.1:8090/"
105+
curl -X POST -d "@<path to file>" -H "Content-Type: application/json" http://<host>:8080/rule-test/run-full-aggregation?backendurl="http://127.0.0.1:8090/"
106106

107107
---
108108
**_More information about how to write rules can be found [here](https://github.com/eiffel-community/eiffel-intelligence/blob/master/wiki/markdown/rules.md)._**

0 commit comments

Comments
 (0)