Search in sources :

Example 1 with BusinessObjectFormatDdlCollectionRequest

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);
    });
}
Also used : HashMap(java.util.HashMap) BusinessObjectFormatDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 2 with BusinessObjectFormatDdlCollectionRequest

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);
    });
}
Also used : HashMap(java.util.HashMap) BusinessObjectFormatDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 3 with BusinessObjectFormatDdlCollectionRequest

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);
}
Also used : BusinessObjectFormatDdlCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionResponse) BusinessObjectFormatDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest) Test(org.junit.Test)

Example 4 with BusinessObjectFormatDdlCollectionRequest

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;
}
Also used : BusinessObjectFormatDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest) BusinessObjectFormatDdlRequest(org.finra.herd.model.api.xml.BusinessObjectFormatDdlRequest) ArrayList(java.util.ArrayList)

Example 5 with 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());
}
Also used : BusinessObjectFormatDdlCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionResponse) BusinessObjectFormatDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest)

Aggregations

BusinessObjectFormatDdlCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest)6 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 BusinessObjectFormatDdlCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionResponse)2 BusinessObjectFormatDdlRequest (org.finra.herd.model.api.xml.BusinessObjectFormatDdlRequest)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)1 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1