Search in sources :

Example 31 with PartitionKeyGroupKey

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);
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 32 with PartitionKeyGroupKey

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);
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 33 with PartitionKeyGroupKey

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);
}
Also used : PartitionKeyGroupKeys(org.finra.herd.model.api.xml.PartitionKeyGroupKeys) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 34 with PartitionKeyGroupKey

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);
}
Also used : PartitionValueRange(org.finra.herd.model.api.xml.PartitionValueRange) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 35 with PartitionKeyGroupKey

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);
}
Also used : PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PartitionKeyGroupKey (org.finra.herd.model.api.xml.PartitionKeyGroupKey)36 Test (org.junit.Test)29 PartitionKeyGroup (org.finra.herd.model.api.xml.PartitionKeyGroup)13 PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)12 ExpectedPartitionValuesInformation (org.finra.herd.model.api.xml.ExpectedPartitionValuesInformation)9 PartitionKeyGroupEntity (org.finra.herd.model.jpa.PartitionKeyGroupEntity)9 Secured (org.springframework.security.access.annotation.Secured)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ArrayList (java.util.ArrayList)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1 ExpectedPartitionValueInformation (org.finra.herd.model.api.xml.ExpectedPartitionValueInformation)1 ExpectedPartitionValueKey (org.finra.herd.model.api.xml.ExpectedPartitionValueKey)1 ExpectedPartitionValuesCreateRequest (org.finra.herd.model.api.xml.ExpectedPartitionValuesCreateRequest)1 ExpectedPartitionValuesDeleteRequest (org.finra.herd.model.api.xml.ExpectedPartitionValuesDeleteRequest)1 PartitionKeyGroupCreateRequest (org.finra.herd.model.api.xml.PartitionKeyGroupCreateRequest)1 PartitionKeyGroupKeys (org.finra.herd.model.api.xml.PartitionKeyGroupKeys)1 ExpectedPartitionValueEntity (org.finra.herd.model.jpa.ExpectedPartitionValueEntity)1