-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rebased code changes in EI-2.X to EI-3.X and added TTL indexes automatic updation. #507
Rebased code changes in EI-2.X to EI-3.X and added TTL indexes automatic updation. #507
Conversation
- Reduced the duplicate calls on subscription checks - Introduced ttl for event object map collection - Fixed Null pointer exceptions - Cache implemented for repeat handler collection. - Added log statements to print response time of the mongo and ER queries
…for the REST calls while triggering the notifications. Updated the code to handle the index creation only once.
"notification.httpRequest.timeout"
@@ -88,10 +88,12 @@ | |||
private JenkinsXmlData jenkinsXmlData; | |||
private SubscriptionObject subscriptionObject; | |||
private JSONObject jobStatusData; | |||
public String AggEvent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give a better name instead of AggEvent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow java naming standards for variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, changed AggEvent to aggregatedEvent
LOGGER.debug( | ||
"Sent back the event to queue with un-acknowledgement: " + message.getBody()); | ||
LOGGER.info( | ||
"Sent back the event {} to queue with un-acknowledgement due to {}", id, mdce); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what is this mdce?
EIFFEL_EVENTS_JSON_PATH, eventNamesToSend), | ||
0); | ||
JsonNode parsedJSON = IntegrationTestBase.getJSONFromFile(EIFFEL_EVENTS_JSON_PATH); | ||
for(String eventName : eventNamesToSend) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use forEach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -177,6 +183,8 @@ public void aggregated_object_is_created() throws Throwable { | |||
// verify that aggregated object is created and present in db | |||
LOGGER.debug("Checking presence of aggregated Object"); | |||
List<String> allObjects = mongoDBHandler.getAllDocuments(database, collection); | |||
String id = eventManager.getEventsIdList(EIFFEL_EVENTS_JSON_PATH, getEventNamesToSend()).get(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename the method to getEventIdsList
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -107,6 +107,10 @@ public void get_content(String contentFileName) throws Throwable { | |||
if (expectedResponse instanceof JSONArray) { | |||
JSONArray expectedArray = new JSONArray(responseBody); | |||
JSONArray responseArray = new JSONArray(response.getBody().toString()); | |||
for(int i=0;i<responseArray.length();i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -88,10 +88,12 @@ | |||
private JenkinsXmlData jenkinsXmlData; | |||
private SubscriptionObject subscriptionObject; | |||
private JSONObject jobStatusData; | |||
public String AggEvent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow java naming standards for variables
String queryString = "{\"_id\": " + aggId + "}"; | ||
MongoStringQuery query = new MongoStringQuery(queryString); | ||
documents = mongoDBHandler.find(database, collectionName, query); | ||
JSONObject json = new JSONObject(documents.get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this only be performed for the single event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
JSONObject json = new JSONObject(documents.get(0)); | ||
JSONArray jsonArray = new JSONArray(); | ||
jsonArray.put(json.get("objects")); | ||
String s = json.get("objects").toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper name instead of s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
break; | ||
} | ||
} | ||
if (content.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this check next to "content = read...."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -95,7 +101,9 @@ | |||
private String failedNotificationCollectionName; | |||
@Value("${sessions.collection.name}") | |||
private String sessionsCollectionName; | |||
|
|||
|
|||
List<String> expectedAggId = Stream.of("sb6efi4n-25fb-4d77-b9fd-5f2xrrefe66de47","aacc3c87-75e0-4b6d-88f5-b1a5d4e62b43","e46ef12d-25gb-4d7y-b9fd-8763re66de47").collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ArrayLIst instead of Stream.of and collect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ArrayList is not required, I have removed this line.
…-intelligence # Conflicts: # src/functionaltests/java/com/ericsson/ei/notifications/trigger/SubscriptionNotificationSteps.java
Description of the Change
Rebased the changes that were done on EI2.X to EI3.X. Modified code to handle the missed subscriptions and EI performance improvements and also handled the TTL values and updation of indexes for the collections is done automatically.
Alternate Designs
NA
Benefits
No events are dropped, and the event processing rate is improved which inturn increases the EI performance.
The indexes are updated automatically w.r.t TTL values provided.
Possible Drawbacks
NA
Sign-off
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Raju Beemreddy raju.beemreddy@tcs.com, Gangisetty Alekhya gangisetty.alekhya@tcs.com, Kolli Suryakumari sk.surya@tcs.com