Search in sources :

Example 11 with PartitionKeyGroup

use of org.finra.herd.model.api.xml.PartitionKeyGroup in project herd by FINRAOS.

the class PartitionKeyGroupServiceTest method testCreatePartitionKeyGroupTrimParameters.

@Test
public void testCreatePartitionKeyGroupTrimParameters() {
    // Create a partition key group by passing partition key group name with leading and trailing whitespace characters.
    PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupServiceTestHelper.createPartitionKeyGroup(addWhitespace(PARTITION_KEY_GROUP));
    // Validate the returned object.
    partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP, resultPartitionKeyGroup);
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) Test(org.junit.Test)

Example 12 with PartitionKeyGroup

use of org.finra.herd.model.api.xml.PartitionKeyGroup in project herd by FINRAOS.

the class PartitionKeyGroupServiceTest method testGetPartitionKeyGroupLowerCaseParameters.

@Test
public void testGetPartitionKeyGroupLowerCaseParameters() {
    // Create and persist a partition key group with an uppercase name.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toUpperCase());
    // Retrieve the partition key group by passing partition key group name in lower case.
    PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP.toLowerCase()));
    // Validate the returned object.
    partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP.toUpperCase(), resultPartitionKeyGroup);
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 13 with PartitionKeyGroup

use of org.finra.herd.model.api.xml.PartitionKeyGroup 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 14 with PartitionKeyGroup

use of org.finra.herd.model.api.xml.PartitionKeyGroup 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 15 with PartitionKeyGroup

use of org.finra.herd.model.api.xml.PartitionKeyGroup in project herd by FINRAOS.

the class PartitionKeyGroupServiceImpl method createPartitionKeyGroupFromEntity.

/**
 * Creates the partition key group from the persisted entity.
 *
 * @param partitionKeyGroupEntity the partition key group entity
 *
 * @return the partition key group
 */
private PartitionKeyGroup createPartitionKeyGroupFromEntity(PartitionKeyGroupEntity partitionKeyGroupEntity) {
    // Create the partition key group.
    PartitionKeyGroup partitionKeyGroup = new PartitionKeyGroup();
    PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey();
    partitionKeyGroup.setPartitionKeyGroupKey(partitionKeyGroupKey);
    partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupEntity.getPartitionKeyGroupName());
    return partitionKeyGroup;
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey)

Aggregations

PartitionKeyGroup (org.finra.herd.model.api.xml.PartitionKeyGroup)15 Test (org.junit.Test)14 PartitionKeyGroupKey (org.finra.herd.model.api.xml.PartitionKeyGroupKey)13 PartitionKeyGroupCreateRequest (org.finra.herd.model.api.xml.PartitionKeyGroupCreateRequest)1 PartitionKeyGroupEntity (org.finra.herd.model.jpa.PartitionKeyGroupEntity)1