Search in sources :

Example 1 with BusinessObjectDataDdlCollectionRequest

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

Example 2 with BusinessObjectDataDdlCollectionRequest

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

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

Example 4 with BusinessObjectDataDdlCollectionRequest

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

Example 5 with BusinessObjectDataDdlCollectionRequest

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());
}
Also used : BusinessObjectDataDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest) BusinessObjectDataDdlCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionResponse)

Aggregations

BusinessObjectDataDdlCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest)7 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 BusinessObjectDataDdlRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlRequest)3 HashMap (java.util.HashMap)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 BusinessObjectDataDdlCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionResponse)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)2 BusinessObjectDataAvailabilityCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest)1 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)1 BusinessObjectDataCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest)1 BusinessObjectDataInvalidateUnregisteredRequest (org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest)1 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1 BusinessObjectDataRetryStoragePolicyTransitionRequest (org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest)1 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)1