Skip to content

Conversation

@shubhamkumarguptaTCS
Copy link
Contributor

@shubhamkumarguptaTCS shubhamkumarguptaTCS commented Oct 22, 2021

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

@SantoshNC68 SantoshNC68 marked this pull request as ready for review October 25, 2021 04:21
pom.xml Outdated
<artifactId>android-json</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.jupiter</groupId>
Copy link
Member

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> -->
Copy link
Member

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.

Copy link
Member

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();
Copy link
Member

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);
Copy link
Member

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;

Copy link
Member

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 {
Copy link
Member

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);
Copy link
Member

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());
Copy link
Member

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) {
Copy link
Member

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();
Copy link
Member

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>
Copy link
Member

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);
Copy link
Member

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());
Copy link
Member

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();
Copy link
Member

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);
Copy link
Member

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;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary new lines.

Copy link
Member

@RajuBeemreddy1 RajuBeemreddy1 left a 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.

@SantoshNC68 SantoshNC68 merged commit 548cf8b into eiffel-community:master Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants