ExpectedPartitionValueRestController extends HerdBaseController { @RequestMapping(value = EXPECTED_PARTITION_VALUES_URI_PREFIX + "/partitionKeyGroups/{partitionKeyGroupName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_EXPECTED_PARTITION_VALUES_GET) public ExpectedPartitionValuesInformation getExpectedPartitionValues(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName, @RequestParam(value = "startExpectedPartitionValue", required = false) String startExpectedPartitionValue, @RequestParam(value = "endExpectedPartitionValue", required = false) String endExpectedPartitionValue) { PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey(); partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupName); PartitionValueRange partitionValueRange = new PartitionValueRange(); partitionValueRange.setStartPartitionValue(startExpectedPartitionValue); partitionValueRange.setEndPartitionValue(endExpectedPartitionValue); return expectedPartitionValueService.getExpectedPartitionValues(partitionKeyGroupKey, partitionValueRange); }  @RequestMapping(value = EXPECTED_PARTITION_VALUES_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_EXPECTED_PARTITION_VALUES_POST) ExpectedPartitionValuesInformation createExpectedPartitionValues(@RequestBody ExpectedPartitionValuesCreateRequest request); @RequestMapping( value = EXPECTED_PARTITION_VALUES_URI_PREFIX + "/partitionKeyGroups/{partitionKeyGroupName}/expectedPartitionValues/{expectedPartitionValue}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_EXPECTED_PARTITION_VALUES_GET) ExpectedPartitionValueInformation getExpectedPartitionValue(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName,
        @PathVariable("expectedPartitionValue") String expectedPartitionValue, @RequestParam(value = "offset", required = false) Integer offset); @RequestMapping(value = EXPECTED_PARTITION_VALUES_URI_PREFIX + "/partitionKeyGroups/{partitionKeyGroupName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_EXPECTED_PARTITION_VALUES_GET) ExpectedPartitionValuesInformation getExpectedPartitionValues(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName,
        @RequestParam(value = "startExpectedPartitionValue", required = false) String startExpectedPartitionValue,
        @RequestParam(value = "endExpectedPartitionValue", required = false) String endExpectedPartitionValue); @RequestMapping(value = EXPECTED_PARTITION_VALUES_URI_PREFIX, method = RequestMethod.DELETE, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_EXPECTED_PARTITION_VALUES_DELETE) ExpectedPartitionValuesInformation deleteExpectedPartitionValues(@RequestBody ExpectedPartitionValuesDeleteRequest request); static final String EXPECTED_PARTITION_VALUES_URI_PREFIX; }
@Test public void testGetExpectedPartitionValues() { PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey(); partitionKeyGroupKey.setPartitionKeyGroupName(PARTITION_KEY_GROUP); List<String> testSortedExpectedPartitionValues = expectedPartitionValueDaoTestHelper.getTestSortedExpectedPartitionValues(); int startExpectedPartitionValueIndex = 1; int endExpectedPartitionValueIndex = testSortedExpectedPartitionValues.size() - 2; PartitionValueRange partitionValueRange = new PartitionValueRange(); partitionValueRange.setStartPartitionValue(testSortedExpectedPartitionValues.get(startExpectedPartitionValueIndex)); partitionValueRange.setEndPartitionValue(testSortedExpectedPartitionValues.get(endExpectedPartitionValueIndex)); ExpectedPartitionValuesInformation expectedPartitionValuesInformation = new ExpectedPartitionValuesInformation(partitionKeyGroupServiceTestHelper.createPartitionKeyGroupKey(PARTITION_KEY_GROUP), expectedPartitionValueDaoTestHelper.getTestSortedExpectedPartitionValues() .subList(startExpectedPartitionValueIndex, endExpectedPartitionValueIndex)); when(expectedPartitionValueService.getExpectedPartitionValues(partitionKeyGroupKey, partitionValueRange)) .thenReturn(expectedPartitionValuesInformation); ExpectedPartitionValuesInformation resultPartitionValuesInformation = expectedPartitionValueRestController .getExpectedPartitionValues(PARTITION_KEY_GROUP, testSortedExpectedPartitionValues.get(startExpectedPartitionValueIndex), testSortedExpectedPartitionValues.get(endExpectedPartitionValueIndex)); expectedPartitionValueServiceTestHelper.validateExpectedPartitionValuesInformation(PARTITION_KEY_GROUP, testSortedExpectedPartitionValues.subList(startExpectedPartitionValueIndex, endExpectedPartitionValueIndex), resultPartitionValuesInformation); verify(expectedPartitionValueService).getExpectedPartitionValues(partitionKeyGroupKey, partitionValueRange); verifyNoMoreInteractions(expectedPartitionValueService); assertEquals(expectedPartitionValuesInformation, resultPartitionValuesInformation); }