PartitionKeyGroupRestController extends HerdBaseController { @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_ALL_GET) public PartitionKeyGroupKeys getPartitionKeyGroups() { return partitionKeyGroupService.getPartitionKeyGroups(); }  @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_POST) PartitionKeyGroup createPartitionKeyGroup(@RequestBody PartitionKeyGroupCreateRequest request); @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_GET) PartitionKeyGroup getPartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName); @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_DELETE) PartitionKeyGroup deletePartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName); @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_ALL_GET) PartitionKeyGroupKeys getPartitionKeyGroups(); static final String PARTITION_KEY_GROUPS_URI_PREFIX; }
@Test public void testGetPartitionKeyGroups() { PartitionKeyGroupKeys partitionKeyGroupKeys = new PartitionKeyGroupKeys(Arrays.asList(new PartitionKeyGroupKey(PARTITION_KEY_GROUP), new PartitionKeyGroupKey(PARTITION_KEY_GROUP_2))); when(partitionKeyGroupService.getPartitionKeyGroups()).thenReturn(partitionKeyGroupKeys); PartitionKeyGroupKeys resultPartitionKeyGroupKeys = partitionKeyGroupRestController.getPartitionKeyGroups(); assertTrue(resultPartitionKeyGroupKeys.getPartitionKeyGroupKeys().size() >= 2); assertTrue(resultPartitionKeyGroupKeys.getPartitionKeyGroupKeys() .contains(partitionKeyGroupServiceTestHelper.createPartitionKeyGroupKey(PARTITION_KEY_GROUP))); assertTrue(resultPartitionKeyGroupKeys.getPartitionKeyGroupKeys() .contains(partitionKeyGroupServiceTestHelper.createPartitionKeyGroupKey(PARTITION_KEY_GROUP_2))); verify(partitionKeyGroupService).getPartitionKeyGroups(); verifyNoMoreInteractions(partitionKeyGroupService); assertEquals(partitionKeyGroupKeys, resultPartitionKeyGroupKeys); }