@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getSegmentsCount() > 0) { hash = (37 * hash) + SEGMENTS_FIELD_NUMBER; hash = (53 * hash) + getSegmentsList().hashCode(); } hash = (37 * hash) + DELEGATIONTOKEN_FIELD_NUMBER; hash = (53 * hash) + getDelegationToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Test public void createSuccessorResponse() { Controller.SegmentRange segmentRange = createSegmentRange(0.1, 0.5); Map<Controller.SegmentRange, List<Long>> inputMap = new HashMap<>(1); inputMap.put(segmentRange, Arrays.asList(1L)); Controller.SuccessorResponse successorResponse = ModelHelper.createSuccessorResponse(inputMap).build(); Assert.assertEquals(1, successorResponse.getSegmentsCount()); final SegmentId resultSegmentID = successorResponse.getSegments(0).getSegment().getSegmentId(); assertEquals("testScope", resultSegmentID.getStreamInfo().getScope()); assertEquals("testStream", resultSegmentID.getStreamInfo().getStream()); }
@Test public void getSegmentsImmediatlyFollowingTest() { scaleTest(); ResultObserver<SuccessorResponse> result = new ResultObserver<>(); this.controllerService.getSegmentsImmediatlyFollowing(ModelHelper.createSegmentId(SCOPE1, STREAM1, 1), result); final SuccessorResponse successorResponse = result.get(); Assert.assertEquals(2, successorResponse.getSegmentsCount()); ResultObserver<SuccessorResponse> result2 = new ResultObserver<>(); this.controllerService.getSegmentsImmediatlyFollowing(ModelHelper.createSegmentId(SCOPE1, STREAM1, 0), result2); final SuccessorResponse successorResponse2 = result2.get(); Assert.assertEquals(0, successorResponse2.getSegmentsCount()); }