use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupRestControllerTest method testCreatePartitionKeyGroup.
@Test
public void testCreatePartitionKeyGroup() {
// Create a partition key group.
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);
// Validate the returned object.
partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP, resultPartitionKeyGroup);
// Verify the external calls.
verify(partitionKeyGroupService).createPartitionKeyGroup(request);
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 ExpectedPartitionValueServiceImpl method createExpectedPartitionValuesInformationFromEntities.
/**
* Creates the expected partition values information from the persisted entities.
*
* @param partitionKeyGroupEntity the partition key group entity
* @param expectedPartitionValueEntities the list of expected partition value entities
*
* @return the expected partition values information
*/
private ExpectedPartitionValuesInformation createExpectedPartitionValuesInformationFromEntities(PartitionKeyGroupEntity partitionKeyGroupEntity, Collection<ExpectedPartitionValueEntity> expectedPartitionValueEntities) {
// Create an expected partition values information instance.
ExpectedPartitionValuesInformation expectedPartitionValuesInformation = new ExpectedPartitionValuesInformation();
// Add the partition key group key.
PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey();
expectedPartitionValuesInformation.setPartitionKeyGroupKey(partitionKeyGroupKey);
partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupEntity.getPartitionKeyGroupName());
// Add the expected partition values.
List<String> expectedPartitionValues = new ArrayList<>();
expectedPartitionValuesInformation.setExpectedPartitionValues(expectedPartitionValues);
for (ExpectedPartitionValueEntity expectedPartitionValueEntity : expectedPartitionValueEntities) {
expectedPartitionValues.add(expectedPartitionValueEntity.getPartitionValue());
}
return expectedPartitionValuesInformation;
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupDaoTest method testGetPartitionKeyGroupByKey.
@Test
public void testGetPartitionKeyGroupByKey() {
// Create relative database entities.
partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
// Retrieve partition key group entity.
PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDao.getPartitionKeyGroupByKey(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
// Validate the results.
assertNotNull(partitionKeyGroupEntity);
assertTrue(partitionKeyGroupEntity.getPartitionKeyGroupName().equals(PARTITION_KEY_GROUP));
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupServiceTest method testGetPartitionKeyGroup.
@Test
public void testGetPartitionKeyGroup() {
// Create and persist a partition key group entity.
partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
// Retrieve the partition key group.
PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
// Validate the returned object.
partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP, resultPartitionKeyGroup);
}
use of org.finra.herd.model.api.xml.PartitionKeyGroupKey in project herd by FINRAOS.
the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroupLowerCaseParameters.
@Test
public void testDeletePartitionKeyGroupLowerCaseParameters() {
// Create and persist a partition key group entity with an uppercase name.
partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toUpperCase());
// Validate that this partition key group exists.
partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP.toUpperCase()));
// Retrieve the partition key group by passing partition key group name in lower case.
PartitionKeyGroup deletedPartitionKeyGroup = partitionKeyGroupService.deletePartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP.toLowerCase()));
// Validate the returned object.
partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP.toUpperCase(), deletedPartitionKeyGroup);
// Ensure that this partition key group is no longer there.
assertNull(partitionKeyGroupDao.getPartitionKeyGroupByKey(partitionKeyGroupServiceTestHelper.createPartitionKeyGroupKey(PARTITION_KEY_GROUP.toUpperCase())));
}
Aggregations