use of org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest in project herd by FINRAOS.
the class GenerateBusinessObjectFormatDdlCollectionTest method testGenerateBusinessObjectFormatDdlCollectionJson.
@Test
public void testGenerateBusinessObjectFormatDdlCollectionJson() throws Exception {
// Prepare database entities required for testing.
businessObjectFormatServiceTestHelper.createDatabaseEntitiesForBusinessObjectFormatDdlCollectionTesting();
// Prepare the request.
BusinessObjectFormatDdlCollectionRequest request = businessObjectFormatServiceTestHelper.getTestBusinessObjectFormatDdlCollectionRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatDdlCollectionRequest", "${businessObjectFormatDdlCollectionRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "json"));
parameters.add(buildParameter("businessObjectFormatDdlCollectionRequest", jsonHelper.objectToJson(request)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GenerateBusinessObjectFormatDdlCollection.VARIABLE_DDL_COLLECTION, businessObjectFormatServiceTestHelper.getExpectedBusinessObjectFormatDdlCollectionResponse().getDdlCollection());
executeWithoutLogging(LogVariables.class, () -> {
testActivitiServiceTaskSuccess(GenerateBusinessObjectFormatDdlCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
});
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest in project herd by FINRAOS.
the class GenerateBusinessObjectFormatDdlCollectionTest method testGenerateBusinessObjectFormatDdlCollectionXml.
@Test
public void testGenerateBusinessObjectFormatDdlCollectionXml() throws Exception {
// Prepare database entities required for testing.
businessObjectFormatServiceTestHelper.createDatabaseEntitiesForBusinessObjectFormatDdlCollectionTesting();
// Prepare the request.
BusinessObjectFormatDdlCollectionRequest request = businessObjectFormatServiceTestHelper.getTestBusinessObjectFormatDdlCollectionRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatDdlCollectionRequest", "${businessObjectFormatDdlCollectionRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "xml"));
parameters.add(buildParameter("businessObjectFormatDdlCollectionRequest", xmlHelper.objectToXml(request)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GenerateBusinessObjectFormatDdlCollection.VARIABLE_DDL_COLLECTION, businessObjectFormatServiceTestHelper.getExpectedBusinessObjectFormatDdlCollectionResponse().getDdlCollection());
executeWithoutLogging(LogVariables.class, () -> {
testActivitiServiceTaskSuccess(GenerateBusinessObjectFormatDdlCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
});
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest in project herd by FINRAOS.
the class BusinessObjectFormatRestControllerTest method testGenerateBusinessObjectFormatDdlCollection.
@Test
public void testGenerateBusinessObjectFormatDdlCollection() {
BusinessObjectFormatDdlCollectionRequest request = businessObjectFormatServiceTestHelper.getTestBusinessObjectFormatDdlCollectionRequest();
BusinessObjectFormatDdlCollectionResponse businessObjectFormatDdlCollectionResponse = businessObjectFormatServiceTestHelper.getExpectedBusinessObjectFormatDdlCollectionResponse();
when(businessObjectFormatService.generateBusinessObjectFormatDdlCollection(request)).thenReturn(businessObjectFormatDdlCollectionResponse);
// Generate DDL for a collection of business object formats.
BusinessObjectFormatDdlCollectionResponse resultBusinessObjectFormatDdlCollectionResponse = businessObjectFormatRestController.generateBusinessObjectFormatDdlCollection(request);
// Verify the external calls.
verify(businessObjectFormatService).generateBusinessObjectFormatDdlCollection(request);
verifyNoMoreInteractions(businessObjectFormatService);
// Validate the returned object.
assertEquals(businessObjectFormatDdlCollectionResponse, resultBusinessObjectFormatDdlCollectionResponse);
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest in project herd by FINRAOS.
the class BusinessObjectFormatServiceTestHelper method getTestBusinessObjectFormatDdlCollectionRequest.
/**
* Creates a generate business object format ddl collection request using hard coded test values.
*
* @return the business object format ddl collection request
*/
public BusinessObjectFormatDdlCollectionRequest getTestBusinessObjectFormatDdlCollectionRequest() {
// Create a generate business object format ddl collection request.
BusinessObjectFormatDdlCollectionRequest businessObjectFormatDdlCollectionRequest = new BusinessObjectFormatDdlCollectionRequest();
// Create a list of generate business object format ddl requests.
List<BusinessObjectFormatDdlRequest> businessObjectFormatDdlRequests = new ArrayList<>();
businessObjectFormatDdlCollectionRequest.setBusinessObjectFormatDdlRequests(businessObjectFormatDdlRequests);
// Create a generate business object format ddl request.
BusinessObjectFormatDdlRequest businessObjectFormatDdlRequest = new BusinessObjectFormatDdlRequest(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, FileTypeEntity.TXT_FILE_TYPE, AbstractServiceTest.FORMAT_VERSION, BusinessObjectDataDdlOutputFormatEnum.HIVE_13_DDL, AbstractServiceTest.TABLE_NAME, AbstractServiceTest.NO_CUSTOM_DDL_NAME, AbstractServiceTest.INCLUDE_DROP_TABLE_STATEMENT, AbstractServiceTest.INCLUDE_IF_NOT_EXISTS_OPTION, null);
// Add two business object ddl requests to the collection request.
businessObjectFormatDdlRequests.add(businessObjectFormatDdlRequest);
businessObjectFormatDdlRequests.add(businessObjectFormatDdlRequest);
return businessObjectFormatDdlCollectionRequest;
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest in project herd by FINRAOS.
the class GenerateBusinessObjectFormatDdlCollection method executeImpl.
@Override
public void executeImpl(DelegateExecution execution) throws Exception {
String contentTypeString = activitiHelper.getRequiredExpressionVariableAsString(contentType, execution, "ContentType").trim();
String requestString = activitiHelper.getRequiredExpressionVariableAsString(businessObjectFormatDdlCollectionRequest, execution, "BusinessObjectFormatDdlCollectionRequest").trim();
BusinessObjectFormatDdlCollectionRequest request = getRequestObject(contentTypeString, requestString, BusinessObjectFormatDdlCollectionRequest.class);
// Call the business object format service to generate DDL for a collection of business object formats.
BusinessObjectFormatDdlCollectionResponse businessObjectFormatDdlCollectionResponse = businessObjectFormatService.generateBusinessObjectFormatDdlCollection(request);
// Set workflow variable for generated DDL collection.
setTaskWorkflowVariable(execution, VARIABLE_DDL_COLLECTION, businessObjectFormatDdlCollectionResponse.getDdlCollection());
}
Aggregations