-
Notifications
You must be signed in to change notification settings - Fork 73
Mongodb uplift #510
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
Mongodb uplift #510
Conversation
pom.xml
Outdated
| <artifactId>android-json</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>org.junit.jupiter</groupId> |
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 format.
pom.xml
Outdated
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-mail</artifactId> | ||
| <version>${springBootVersion}</version> | ||
| <!-- <version>${springBootVersion}</version> --> |
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.
keep the original one. we have added the version in properties and this is not a change.
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.
same in all the places where we have commented out this line.
| MongodForTestsFactory testsFactory = MongodForTestsFactory.with(Version.V3_4_1); | ||
| mongoClient = testsFactory.newMongo(); | ||
| String port = "" + mongoClient.getAddress().getPort(); | ||
| ListDatabasesIterable<Document> list = mongoClient.listDatabases(); |
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.
check the format in this block.
Also make these variables final
| private void setupMailhogMongoDBHandler() { | ||
| MongoClientURI uri = new MongoClientURI(mailHogUri); | ||
| MongoClient mongoClient = new MongoClient(uri); | ||
| MongoClient mongoClient = MongoClients.create(mailHogUri); |
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
| public String aggregatedEvent; | ||
|
|
||
| private SubscriptionObject subscriptionObject; | ||
|
|
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.
There is no change in this file, keep the original one.
| public void runIdRules(RulesObject rulesObject, String event) | ||
| throws MongoDBConnectionException { | ||
| public void runIdRules(RulesObject rulesObject, String event) | ||
| throws MongoDBConnectionException, Exception { |
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.
Why are we throwing Exception here?
| LOGGER.debug("DB locked by {} thread", Thread.currentThread().getId()); | ||
| documentLocked = false; | ||
| return JSON.serialize(result); | ||
| BasicDBObject basicDBObject=new BasicDBObject(result); |
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 can be final,
or do it like
return new BasicDBObject(result).toString();
| } | ||
|
|
||
| rabbitTemplate.setQueue(rmqProperties.getWaitlistQueueName()); | ||
| rabbitTemplate.setDefaultReceiveQueue(rmqProperties.getWaitlistQueueName()); |
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.
check the format properly
| LOGGER.debug("%%%% Response time for upstream query for id: {}: {} ", aggregatedObjectId, stop-start); | ||
| LOGGER.debug("ResponseEntity: " + responseEntity); | ||
|
|
||
| if (responseEntity == null) { |
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.
no change in this file. keep the original file.
| public boolean isMongoDBServerUp() { | ||
| try { | ||
| mongoClient.getAddress(); | ||
| ListDatabasesIterable<Document> list = mongoClient.listDatabases(); |
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.
declare this variable final. Same for the BasicDBObject added above (line 157)
| <version>4.3.2</version><!--$NO-MVN-MAN-VER$--> | ||
| </dependency> | ||
|
|
||
| <dependency> |
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.
No need of mongodb-driver-core dependency explicitly. sync will download the same.
| // all " later on, All get sometihng in mongoDB shoult redurn a JSON object and not a | ||
| // String. | ||
| result.add(JSON.serialize(document)); | ||
| BasicDBObject basicDBObject=new BasicDBObject(document); |
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.
|
|
||
| // Need to set a working client to enable cleanup | ||
| mongoDBHandler.setMongoClient(TestConfigs.getMongoClient()); | ||
| //doThrow(Exception.class).when(cursor.getServerAddress()); |
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 verify other way what the commented lines are doing here.
| mongoClient = testsFactory.newMongo(); | ||
| String port = "" + mongoClient.getAddress().getPort(); | ||
| ListDatabasesIterable<Document> list = mongoClient.listDatabases(); | ||
| MongoCursor<Document> iter = list.iterator(); |
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.
Not properly formatted.
|
|
||
| @BeforeClass | ||
| public static void init() throws Exception { | ||
| //new AnnotationConfigApplicationContext(HttpRequest.class); |
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.
Why these lines are commented. If the client has already created in other places, why dont you move the logic from there to here.
|
|
||
| @MockBean | ||
| private SecurityContext securityContext; | ||
|
|
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.
Remove unnecessary new lines.
RajuBeemreddy1
left a comment
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.
Some environmental issues found for the test cases. Need to fix those after this changes.
Applicable Issues
Since mongodb and spring boot parent has introduced their latest versions with major updates, we also updated to the latest version. Updating to the latest versions will help to fix existing issues with APIs along with more enhancements.
git issue#509
Description of the Change
Updated mongodb and spring boot related APIs versions to the latest, further changes include removing deprecated methods by replacing with latest ones.
Alternate Designs
Application is modified in a way that it is also compatible with older mongodb versions(i.e. 3.4.10). The latest mongodb versions is 4.4.9.
Benefits
Will able to leverage latest features of mongodb and spring-boot APIs.
Possible Drawbacks
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: SHUBHAM KUMAR GUPTA shubhamkumar.gupta1@tcs.com, Dhruvin K dhruvin.kalavadia@tcs.com, Vishal Kumar P vr.panchal@tcs.com