use of org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest in project herd by FINRAOS.
the class BusinessObjectDataRestControllerTest method testGenerateBusinessObjectDataDdlCollection.
@Test
public void testGenerateBusinessObjectDataDdlCollection() {
// Create a business object data ddl collection request.
BusinessObjectDataDdlCollectionRequest businessObjectDataDdlCollectionRequest = new BusinessObjectDataDdlCollectionRequest();
// Create a business object data ddl collection response.
BusinessObjectDataDdlCollectionResponse businessObjectDataDdlCollectionResponse = new BusinessObjectDataDdlCollectionResponse();
// Mock the external calls.
when(businessObjectDataService.generateBusinessObjectDataDdlCollection(businessObjectDataDdlCollectionRequest)).thenReturn(businessObjectDataDdlCollectionResponse);
// Call the method under test.
BusinessObjectDataDdlCollectionResponse result = businessObjectDataRestController.generateBusinessObjectDataDdlCollection(businessObjectDataDdlCollectionRequest);
// Verify the external calls.
verify(businessObjectDataService).generateBusinessObjectDataDdlCollection(businessObjectDataDdlCollectionRequest);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataDdlCollectionResponse, result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest in project herd by FINRAOS.
the class BusinessObjectDataServiceTestHelper method getTestBusinessObjectDataDdlCollectionRequest.
/**
* Creates a generate business object data ddl collection request using hard coded test values.
*
* @return the business object data ddl collection request
*/
public BusinessObjectDataDdlCollectionRequest getTestBusinessObjectDataDdlCollectionRequest() {
// Create a generate business object data ddl collection request.
BusinessObjectDataDdlCollectionRequest businessObjectDataDdlCollectionRequest = new BusinessObjectDataDdlCollectionRequest();
// Create a list of generate business object data ddl requests.
List<BusinessObjectDataDdlRequest> businessObjectDataDdlRequests = new ArrayList<>();
businessObjectDataDdlCollectionRequest.setBusinessObjectDataDdlRequests(businessObjectDataDdlRequests);
// Create a generate business object data ddl request.
BusinessObjectDataDdlRequest businessObjectDataDdlRequest = new BusinessObjectDataDdlRequest(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, FileTypeEntity.TXT_FILE_TYPE, AbstractServiceTest.FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(AbstractServiceTest.FIRST_PARTITION_COLUMN_NAME, Arrays.asList(AbstractServiceTest.PARTITION_VALUE), AbstractServiceTest.NO_PARTITION_VALUE_RANGE, AbstractServiceTest.NO_LATEST_BEFORE_PARTITION_VALUE, AbstractServiceTest.NO_LATEST_AFTER_PARTITION_VALUE)), AbstractServiceTest.NO_STANDALONE_PARTITION_VALUE_FILTER, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.NO_STORAGE_NAMES, AbstractServiceTest.STORAGE_NAME, BusinessObjectDataDdlOutputFormatEnum.HIVE_13_DDL, AbstractServiceTest.TABLE_NAME, AbstractServiceTest.NO_CUSTOM_DDL_NAME, AbstractServiceTest.INCLUDE_DROP_TABLE_STATEMENT, AbstractServiceTest.INCLUDE_IF_NOT_EXISTS_OPTION, AbstractServiceTest.INCLUDE_DROP_PARTITIONS, AbstractServiceTest.NO_ALLOW_MISSING_DATA, AbstractServiceTest.NO_INCLUDE_ALL_REGISTERED_SUBPARTITIONS, AbstractServiceTest.NO_SUPPRESS_SCAN_FOR_UNREGISTERED_SUBPARTITIONS);
// Add two business object ddl requests to the collection request.
businessObjectDataDdlRequests.add(businessObjectDataDdlRequest);
businessObjectDataDdlRequests.add(businessObjectDataDdlRequest);
return businessObjectDataDdlCollectionRequest;
}
use of org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest in project herd by FINRAOS.
the class GenerateBusinessObjectDataDdlCollectionTest method testGenerateBusinessObjectDataDdlCollectionJson.
@Test
public void testGenerateBusinessObjectDataDdlCollectionJson() throws Exception {
// Prepare database entities required for testing.
businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataDdlTesting(AbstractServiceTest.PARTITION_VALUE);
// Prepare the request.
BusinessObjectDataDdlCollectionRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataDdlCollectionRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataDdlCollectionRequest", "${businessObjectDataDdlCollectionRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "json"));
parameters.add(buildParameter("businessObjectDataDdlCollectionRequest", jsonHelper.objectToJson(request)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GenerateBusinessObjectDataDdlCollection.VARIABLE_DDL_COLLECTION, businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataDdlCollectionResponse().getDdlCollection());
executeWithoutLogging(LogVariables.class, () -> {
testActivitiServiceTaskSuccess(GenerateBusinessObjectDataDdlCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
});
}
use of org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest in project herd by FINRAOS.
the class GenerateBusinessObjectDataDdlCollectionTest method testGenerateBusinessObjectDataDdlCollectionXml.
@Test
public void testGenerateBusinessObjectDataDdlCollectionXml() throws Exception {
// Prepare database entities required for testing.
businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataDdlTesting(AbstractServiceTest.PARTITION_VALUE);
// Prepare the request.
BusinessObjectDataDdlCollectionRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataDdlCollectionRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataDdlCollectionRequest", "${businessObjectDataDdlCollectionRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "xml"));
parameters.add(buildParameter("businessObjectDataDdlCollectionRequest", xmlHelper.objectToXml(request)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GenerateBusinessObjectDataDdlCollection.VARIABLE_DDL_COLLECTION, businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataDdlCollectionResponse().getDdlCollection());
executeWithoutLogging(LogVariables.class, () -> {
testActivitiServiceTaskSuccess(GenerateBusinessObjectDataDdlCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
});
}
use of org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest in project herd by FINRAOS.
the class GenerateBusinessObjectDataDdlCollection method executeImpl.
@Override
public void executeImpl(DelegateExecution execution) throws Exception {
String contentTypeString = activitiHelper.getRequiredExpressionVariableAsString(contentType, execution, "ContentType").trim();
String requestString = activitiHelper.getRequiredExpressionVariableAsString(businessObjectDataDdlCollectionRequest, execution, "BusinessObjectDataDdlCollectionRequest").trim();
BusinessObjectDataDdlCollectionRequest request = getRequestObject(contentTypeString, requestString, BusinessObjectDataDdlCollectionRequest.class);
// Call the business object data service to generate DDL for a collection of business object data.
BusinessObjectDataDdlCollectionResponse businessObjectDataDdlCollectionResponse = businessObjectDataService.generateBusinessObjectDataDdlCollection(request);
// Set workflow variable for generated DDL collection.
setTaskWorkflowVariable(execution, VARIABLE_DDL_COLLECTION, businessObjectDataDdlCollectionResponse.getDdlCollection());
}
Aggregations