use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupRestControllerTest method testGetPartitionKeyGroup.
@Test
public void testGetPartitionKeyGroup() {
PartitionKeyGroup partitionKeyGroup = new PartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey(PARTITION_KEY_GROUP);
when(partitionKeyGroupService.getPartitionKeyGroup(partitionKeyGroupKey)).thenReturn(partitionKeyGroup);
// Retrieve the partition key group.
PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupRestController.getPartitionKeyGroup(PARTITION_KEY_GROUP);
// Verify the external calls.
verify(partitionKeyGroupService).getPartitionKeyGroup(partitionKeyGroupKey);
verifyNoMoreInteractions(partitionKeyGroupService);
// Validate the returned object.
assertEquals(partitionKeyGroup, resultPartitionKeyGroup);
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupRestControllerTest method testDeletePartitionKeyGroup.
@Test
public void testDeletePartitionKeyGroup() {
PartitionKeyGroup partitionKeyGroup = new PartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey(PARTITION_KEY_GROUP);
when(partitionKeyGroupService.deletePartitionKeyGroup(partitionKeyGroupKey)).thenReturn(partitionKeyGroup);
// Delete this partition key group.
PartitionKeyGroup deletedPartitionKeyGroup = partitionKeyGroupRestController.deletePartitionKeyGroup(PARTITION_KEY_GROUP);
// Verify the external calls.
verify(partitionKeyGroupService).deletePartitionKeyGroup(partitionKeyGroupKey);
verifyNoMoreInteractions(partitionKeyGroupService);
// Validate the returned object.
assertEquals(partitionKeyGroup, deletedPartitionKeyGroup);
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupRestControllerTest method testGetPartitionKeyGroups.
@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);
// Get the list of partition key groups.
PartitionKeyGroupKeys resultPartitionKeyGroupKeys = partitionKeyGroupRestController.getPartitionKeyGroups();
// Validate the returned object.
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 the external calls.
verify(partitionKeyGroupService).getPartitionKeyGroups();
verifyNoMoreInteractions(partitionKeyGroupService);
// Validate the returned object.
assertEquals(partitionKeyGroupKeys, resultPartitionKeyGroupKeys);
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class ExpectedPartitionValueRestController method getExpectedPartitionValues.
/**
* Retrieves a range of existing expected partition values.
*
* @param partitionKeyGroupName the partition key group name
* @param startExpectedPartitionValue the start expected partition value for the expected partition value range
* @param endExpectedPartitionValue the end expected partition value for the expected partition value range
*
* @return the expected partition values
*/
@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);
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupRestController method getPartitionKeyGroup.
/**
* Gets an existing partition key group by name.
*
* @param partitionKeyGroupName the partition key group name
*
* @return the partition key group information
*/
@RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.GET)
@Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_GET)
public PartitionKeyGroup getPartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName) {
PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey();
partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupName);
return partitionKeyGroupService.getPartitionKeyGroup(partitionKeyGroupKey);
}
Aggregations