use of org.finra.herd.model.dto.RelationalStorageAttributesDto in project herd by FINRAOS.
the class RelationalTableRegistrationServiceImpl method createRelationalTableRegistrationImpl.
/**
* Creates a new relational table registration.
*
* @param relationalTableRegistrationCreateRequest the relational table registration create request
* @param appendToExistingBusinessObjectDefinition boolean flag that determines if the format should be appended to an existing business object definition
*
* @return the information for the newly created business object data
*/
BusinessObjectData createRelationalTableRegistrationImpl(RelationalTableRegistrationCreateRequest relationalTableRegistrationCreateRequest, Boolean appendToExistingBusinessObjectDefinition) {
// Validate the relational table registration create request.
relationalTableRegistrationHelperService.validateAndTrimRelationalTableRegistrationCreateRequest(relationalTableRegistrationCreateRequest);
// Get storage attributes required to perform relation table registration.
// This method also validates database entities per specified relational table registration create request.
RelationalStorageAttributesDto relationalStorageAttributesDto = relationalTableRegistrationHelperService.getRelationalStorageAttributes(relationalTableRegistrationCreateRequest, appendToExistingBusinessObjectDefinition);
// Retrieve a list of actual schema columns for the specified relational table.
// This method uses actual JDBC connection to retrieve a description of table columns.
List<SchemaColumn> schemaColumns = relationalTableRegistrationHelperService.retrieveRelationalTableColumns(relationalStorageAttributesDto, relationalTableRegistrationCreateRequest.getRelationalSchemaName(), relationalTableRegistrationCreateRequest.getRelationalTableName());
// Create a new relational table registration and return the information for the newly created business object data.
return relationalTableRegistrationHelperService.registerRelationalTable(relationalTableRegistrationCreateRequest, schemaColumns, appendToExistingBusinessObjectDefinition);
}
use of org.finra.herd.model.dto.RelationalStorageAttributesDto in project herd by FINRAOS.
the class RelationalTableRegistrationHelperServiceImplTest method testGetPasswordNoUserCredentialName.
@Test
public void testGetPasswordNoUserCredentialName() {
// Call the method under test.
String result = relationalTableRegistrationHelperServiceImpl.getPassword(new RelationalStorageAttributesDto(JDBC_URL, USERNAME, NO_USER_CREDENTIAL_NAME));
// Verify the external calls.
verifyNoMoreInteractionsHelper();
// Validate the results.
assertNull(result);
}
use of org.finra.herd.model.dto.RelationalStorageAttributesDto in project herd by FINRAOS.
the class RelationalTableRegistrationHelperServiceImplTest method testGetPassword.
@Test
public void testGetPassword() throws Exception {
// Mock the external calls.
when(configurationHelper.getProperty(ConfigurationValue.CREDSTASH_RELATIONAL_STORAGE_ENCRYPTION_CONTEXT)).thenReturn(CREDSTASH_ENCRYPTION_CONTEXT);
when(credStashHelper.getCredentialFromCredStash(CREDSTASH_ENCRYPTION_CONTEXT, USER_CREDENTIAL_NAME)).thenReturn(PASSWORD);
// Call the method under test.
String result = relationalTableRegistrationHelperServiceImpl.getPassword(new RelationalStorageAttributesDto(JDBC_URL, USERNAME, USER_CREDENTIAL_NAME));
// Verify the external calls.
verify(configurationHelper).getProperty(ConfigurationValue.CREDSTASH_RELATIONAL_STORAGE_ENCRYPTION_CONTEXT);
verify(credStashHelper).getCredentialFromCredStash(CREDSTASH_ENCRYPTION_CONTEXT, USER_CREDENTIAL_NAME);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(PASSWORD, result);
}
Aggregations