Skip to content
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

Further rework of the RestoreRedundancy data objects for serialization #5281

Merged
merged 2 commits into from
Jun 24, 2020

Conversation

mhansonp
Copy link
Contributor

looking for errors.

@mhansonp mhansonp marked this pull request as ready for review June 23, 2020 22:44
@mhansonp
Copy link
Contributor Author

This code is to fix another serialization issue with the Restore Redundancy code. Basically, it is very painful from what I have seen to json deserialize a Duration object type. So I have converted the field to a long.

Comment on lines 41 to 42
totalPrimaryTransferTime =
totalPrimaryTransferTime.plusMillis(details.getPrimaryTransferTime());
totalPrimaryTransferTime + details.getPrimaryTransferTime();
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be replaced with totalPrimaryTransferTime += details.getPrimaryTransferTime();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

@Test
public void testSerializable() throws JsonProcessingException {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test sets multiple fields but does not verify all of them. Would it be possible to confirm that all data in the object is correctly serialized and deserialized, not just the message and status fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. assertThat(value).isEqualToComparingFieldByField(restoreRedundancyResults);

Comment on lines 87 to 88
totalPrimaryTransferTime =
totalPrimaryTransferTime.plus(results.getTotalPrimaryTransferTime());
totalPrimaryTransferTime + results.getTotalPrimaryTransferTime();
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be replaced with totalPrimaryTransferTime += results.getTotalPrimaryTransferTime();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

restoreRedundancyResults.addRegionResult(regionRedundancyStatus);
String jsonString = geodeMapper.writeValueAsString(restoreRedundancyResults);
// deserialize the class
RestoreRedundancyResultsImpl value =
Copy link
Member

Choose a reason for hiding this comment

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

you can use assertJ's isEqualToComparingFieldByField method to compare all the fields are the same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

did you forget to push your commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope it is failing... It doesn't like the objects in the satisfiedregion lists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry hash maps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

assertThat(value).usingRecursiveComparison().isEqualTo(restoreRedundancyResults);

worked

Copy link
Member

@jinmeiliao jinmeiliao left a comment

Choose a reason for hiding this comment

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

otherwise LGTM

@jinmeiliao jinmeiliao changed the title First clean run of Rest Command for Restore Redundancy Further rework of the RestoreRedundancy data objects for serialization Jun 24, 2020
@mhansonp mhansonp merged commit 5732a1c into apache:develop Jun 24, 2020
@mhansonp mhansonp deleted the GEODE-8095 branch June 24, 2020 21:25
yozaner1324 pushed a commit to yozaner1324/geode that referenced this pull request Jun 26, 2020
…erialization (apache#5281)

* Converting a Duration to a Long because of Serialization
* Changes for per requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants