You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/06/24 15:28:47 UTC
[GitHub] [geode] jinmeiliao commented on a change in pull request #5281: Further rework of the RestoreRedundancy data objects for serialization
jinmeiliao commented on a change in pull request #5281:
URL: https://github.com/apache/geode/pull/5281#discussion_r444981216
##########
File path: geode-core/src/test/java/org/apache/geode/internal/cache/control/SerializableRestoreRedundancyResultsImplTest.java
##########
@@ -153,39 +157,64 @@ public void addRegionResultsAddsToCorrectInternalMapAndAddsPrimaryReassignmentDe
when(regionResults.getSatisfiedRedundancyRegionResults())
.thenReturn(Collections.singletonMap(successfulRegionName, successfulRegionResult));
when(regionResults.getTotalPrimaryTransfersCompleted()).thenReturn(transfersCompleted);
- when(regionResults.getTotalPrimaryTransferTime()).thenReturn(Duration.ofMillis(transferTime));
+ when(regionResults.getTotalPrimaryTransferTime()).thenReturn(transferTime);
results.addRegionResults(regionResults);
Map<String, RegionRedundancyStatus> zeroRedundancyResults =
results.getZeroRedundancyRegionResults();
- assertThat(zeroRedundancyResults.size(), is(1));
- assertThat(zeroRedundancyResults.get(zeroRedundancyRegionName), is(zeroRedundancyRegionResult));
+ assertThat(zeroRedundancyResults.size()).isEqualTo(1);
+ assertThat(zeroRedundancyResults.get(zeroRedundancyRegionName))
+ .isEqualTo(zeroRedundancyRegionResult);
Map<String, RegionRedundancyStatus> underRedundancyResults =
results.getUnderRedundancyRegionResults();
- assertThat(underRedundancyResults.size(), is(1));
- assertThat(underRedundancyResults.get(underRedundancyRegionName),
- is(underRedundancyRegionResult));
+ assertThat(underRedundancyResults.size()).isEqualTo(1);
+ assertThat(underRedundancyResults.get(underRedundancyRegionName))
+ .isEqualTo(underRedundancyRegionResult);
Map<String, RegionRedundancyStatus> successfulRegionResults =
results.getSatisfiedRedundancyRegionResults();
- assertThat(successfulRegionResults.size(), is(1));
- assertThat(successfulRegionResults.get(successfulRegionName), is(successfulRegionResult));
+ assertThat(successfulRegionResults.size()).isEqualTo(1);
+ assertThat(successfulRegionResults.get(successfulRegionName)).isEqualTo(successfulRegionResult);
- assertThat(results.getTotalPrimaryTransfersCompleted(), is(transfersCompleted));
- assertThat(results.getTotalPrimaryTransferTime().toMillis(), is(transferTime));
+ assertThat(results.getTotalPrimaryTransfersCompleted()).isEqualTo(transfersCompleted);
+ assertThat(results.getTotalPrimaryTransferTime()).isEqualTo(transferTime);
}
@Test
public void addPrimaryDetailsUpdatesValue() {
- assertThat(results.getTotalPrimaryTransfersCompleted(), is(0));
- assertThat(results.getTotalPrimaryTransferTime().toMillis(), is(0L));
+ assertThat(results.getTotalPrimaryTransfersCompleted()).isEqualTo(0);
+ assertThat(results.getTotalPrimaryTransferTime()).isEqualTo(0L);
results.addPrimaryReassignmentDetails(details);
- assertThat(results.getTotalPrimaryTransfersCompleted(), is(transfersCompleted));
- assertThat(results.getTotalPrimaryTransferTime().toMillis(), is(transferTime));
+ assertThat(results.getTotalPrimaryTransfersCompleted()).isEqualTo(transfersCompleted);
+ assertThat(results.getTotalPrimaryTransferTime()).isEqualTo(transferTime);
results.addPrimaryReassignmentDetails(details);
- assertThat(results.getTotalPrimaryTransfersCompleted(), is(transfersCompleted * 2));
- assertThat(results.getTotalPrimaryTransferTime().toMillis(), is(transferTime * 2));
+ assertThat(results.getTotalPrimaryTransfersCompleted()).isEqualTo(transfersCompleted * 2);
+ assertThat(results.getTotalPrimaryTransferTime()).isEqualTo(transferTime * 2);
+ }
+
+ @Test
+ public void testSerializable() throws JsonProcessingException {
+
+ RestoreRedundancyResultsImpl restoreRedundancyResults = new RestoreRedundancyResultsImpl();
+ restoreRedundancyResults.setStatusMessage("Test");
+ restoreRedundancyResults.setSuccess(true);
+ restoreRedundancyResults.setTotalPrimaryTransfersCompleted(150);
+ restoreRedundancyResults.setTotalPrimaryTransferTime(250);
+ RegionRedundancyStatusImpl regionRedundancyStatus = new RegionRedundancyStatusImpl();
+ regionRedundancyStatus.setActualRedundancy(1);
+ regionRedundancyStatus.setConfiguredRedundancy(1);
+ regionRedundancyStatus.setRegionName("/foo");
+ regionRedundancyStatus.setStatus(SATISFIED);
+ restoreRedundancyResults.addRegionResult(regionRedundancyStatus);
+ String jsonString = geodeMapper.writeValueAsString(restoreRedundancyResults);
+ // deserialize the class
+ RestoreRedundancyResultsImpl value =
Review comment:
did you forget to push your commit?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org