Search in sources :

Example 1 with PartitionKeyGroup

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

Example 2 with PartitionKeyGroup

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

Example 3 with PartitionKeyGroup

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

Example 4 with PartitionKeyGroup

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

the class PartitionKeyGroupServiceTest method testCreatePartitionKeyGroup.

@Test
public void testCreatePartitionKeyGroup() {
    // Create a partition key group.
    PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupServiceTestHelper.createPartitionKeyGroup(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 5 with PartitionKeyGroup

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

the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroupExpectedPartitionValuesPresent.

@Test
public void testDeletePartitionKeyGroupExpectedPartitionValuesPresent() {
    // Create and persist a partition key group entity.
    PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Add expected partition values to this partition key group.
    expectedPartitionValueDaoTestHelper.createExpectedPartitionValueProcessDatesForApril2014(PARTITION_KEY_GROUP);
    herdDao.saveAndRefresh(partitionKeyGroupEntity);
    // Delete this partition key group.
    PartitionKeyGroup deletedPartitionKeyGroup = partitionKeyGroupService.deletePartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
    // Validate the returned object.
    partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP, deletedPartitionKeyGroup);
    // Ensure that this partition key group is no longer there.
    assertNull(partitionKeyGroupDao.getPartitionKeyGroupByKey(partitionKeyGroupServiceTestHelper.createPartitionKeyGroupKey(PARTITION_KEY_GROUP)));
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupEntity(org.finra.herd.model.jpa.PartitionKeyGroupEntity) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

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