use of org.finra.herd.model.api.xml.ExpectedPartitionValueInformation in project herd by FINRAOS.
the class GetExpectedPartitionValue method executeImpl.
@Override
public void executeImpl(DelegateExecution execution) throws Exception {
String partitionKeyGroupName = activitiHelper.getExpressionVariableAsString(this.partitionKeyGroupName, execution);
String expectedPartitionValue = activitiHelper.getExpressionVariableAsString(this.expectedPartitionValue, execution);
Integer offset = activitiHelper.getExpressionVariableAsInteger(this.offset, execution, VARIABLE_OFFSET, false);
ExpectedPartitionValueInformation expectedPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(partitionKeyGroupName, expectedPartitionValue), offset);
// Set workflow variables based on the result expected partition value information.
setTaskWorkflowVariable(execution, VARIABLE_PARTITION_KEY_GROUP_NAME, expectedPartitionValueInformation.getExpectedPartitionValueKey().getPartitionKeyGroupName());
setTaskWorkflowVariable(execution, VARIABLE_EXPECTED_PARTITION_VALUE, expectedPartitionValueInformation.getExpectedPartitionValueKey().getExpectedPartitionValue());
}
use of org.finra.herd.model.api.xml.ExpectedPartitionValueInformation in project herd by FINRAOS.
the class ExpectedPartitionValueServiceImpl method createExpectedPartitionValueInformationFromEntity.
/**
* Creates the expected partition value information from the persisted entity.
*
* @param expectedPartitionValueEntity the expected partition value entity
*
* @return the expected partition value information
*/
private ExpectedPartitionValueInformation createExpectedPartitionValueInformationFromEntity(ExpectedPartitionValueEntity expectedPartitionValueEntity) {
// Create an expected partition values information instance.
ExpectedPartitionValueInformation expectedPartitionValueInformation = new ExpectedPartitionValueInformation();
// Add the expected partition value key.
ExpectedPartitionValueKey expectedPartitionValueKey = new ExpectedPartitionValueKey();
expectedPartitionValueInformation.setExpectedPartitionValueKey(expectedPartitionValueKey);
expectedPartitionValueKey.setPartitionKeyGroupName(expectedPartitionValueEntity.getPartitionKeyGroup().getPartitionKeyGroupName());
expectedPartitionValueKey.setExpectedPartitionValue(expectedPartitionValueEntity.getPartitionValue());
return expectedPartitionValueInformation;
}
use of org.finra.herd.model.api.xml.ExpectedPartitionValueInformation in project herd by FINRAOS.
the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValueLowerCaseParameters.
@Test
public void testGetExpectedPartitionValueLowerCaseParameters() {
// Create and persist a partition key group entity.
PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toUpperCase());
// Create and persist a single test expected partition value.
expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, Arrays.asList(PARTITION_VALUE.toUpperCase()));
// Get expected partition value with offset set to null using relative input parameters in lower case.
ExpectedPartitionValueInformation resultPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(PARTITION_KEY_GROUP.toLowerCase(), PARTITION_VALUE.toUpperCase()), null);
// Validate the returned object.
expectedPartitionValueServiceTestHelper.validateExpectedPartitionValueInformation(PARTITION_KEY_GROUP.toUpperCase(), PARTITION_VALUE.toUpperCase(), resultPartitionValueInformation);
}
use of org.finra.herd.model.api.xml.ExpectedPartitionValueInformation in project herd by FINRAOS.
the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValueUpperCaseParameters.
@Test
public void testGetExpectedPartitionValueUpperCaseParameters() {
// Create and persist a partition key group entity.
PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toLowerCase());
// Create and persist a single test expected partition value.
expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, Arrays.asList(PARTITION_VALUE.toLowerCase()));
// Get expected partition value with offset set to null using relative input parameters in upper case.
ExpectedPartitionValueInformation resultPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(PARTITION_KEY_GROUP.toUpperCase(), PARTITION_VALUE.toLowerCase()), null);
// Validate the returned object.
expectedPartitionValueServiceTestHelper.validateExpectedPartitionValueInformation(PARTITION_KEY_GROUP.toLowerCase(), PARTITION_VALUE.toLowerCase(), resultPartitionValueInformation);
}
use of org.finra.herd.model.api.xml.ExpectedPartitionValueInformation in project herd by FINRAOS.
the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValueTrimParameters.
@Test
public void testGetExpectedPartitionValueTrimParameters() {
// Create and persist a partition key group entity.
PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
// Create and persist a list of test expected partition values.
expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, expectedPartitionValueDaoTestHelper.getTestUnsortedExpectedPartitionValues());
// Get expected partition value with offset set to 0 and with request parameters padded with whitespace characters.
List<String> testSortedExpectedPartitionValues = expectedPartitionValueDaoTestHelper.getTestSortedExpectedPartitionValues();
int testExpectedPartitionValueIndex = 3;
ExpectedPartitionValueInformation resultPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(addWhitespace(PARTITION_KEY_GROUP), addWhitespace(testSortedExpectedPartitionValues.get(testExpectedPartitionValueIndex))), 0);
// Validate the returned object.
expectedPartitionValueServiceTestHelper.validateExpectedPartitionValueInformation(PARTITION_KEY_GROUP, testSortedExpectedPartitionValues.get(testExpectedPartitionValueIndex), resultPartitionValueInformation);
}
Aggregations