PartitionKeyGroupRestController extends HerdBaseController { @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_POST) public PartitionKeyGroup createPartitionKeyGroup(@RequestBody PartitionKeyGroupCreateRequest request) { return partitionKeyGroupService.createPartitionKeyGroup(request); }  @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 testCreatePartitionKeyGroup() { PartitionKeyGroup partitionKeyGroup = new PartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP)); PartitionKeyGroupCreateRequest request = partitionKeyGroupServiceTestHelper.createPartitionKeyGroupCreateRequest(PARTITION_KEY_GROUP); when(partitionKeyGroupService.createPartitionKeyGroup(request)).thenReturn(partitionKeyGroup); PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupRestController.createPartitionKeyGroup(request); partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP, resultPartitionKeyGroup); verify(partitionKeyGroupService).createPartitionKeyGroup(request); verifyNoMoreInteractions(partitionKeyGroupService); assertEquals(partitionKeyGroup, resultPartitionKeyGroup); }