use of org.finra.herd.model.api.xml.GlobalAttributeDefinition in project herd by FINRAOS.
the class GlobalAttributeDefinitionServiceImpl method createGlobalAttributeDefinitionFromEntity.
private GlobalAttributeDefinition createGlobalAttributeDefinitionFromEntity(GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity) {
GlobalAttributeDefinition globalAttributeDefinition = new GlobalAttributeDefinition();
globalAttributeDefinition.setId(globalAttributeDefinitionEntity.getId());
GlobalAttributeDefinitionKey globalAttributeDefinitionKey = new GlobalAttributeDefinitionKey();
globalAttributeDefinitionKey.setGlobalAttributeDefinitionLevel(globalAttributeDefinitionEntity.getGlobalAttributeDefinitionLevel().getGlobalAttributeDefinitionLevel());
globalAttributeDefinitionKey.setGlobalAttributeDefinitionName(globalAttributeDefinitionEntity.getGlobalAttributeDefinitionName());
globalAttributeDefinition.setGlobalAttributeDefinitionKey(globalAttributeDefinitionKey);
AttributeValueListEntity attributeValueListEntity = globalAttributeDefinitionEntity.getAttributeValueList();
if (attributeValueListEntity != null) {
globalAttributeDefinition.setAttributeValueList(attributeValueListDaoHelper.createAttributeValueListFromEntity(attributeValueListEntity));
}
return globalAttributeDefinition;
}
use of org.finra.herd.model.api.xml.GlobalAttributeDefinition in project herd by FINRAOS.
the class GlobalAttributeDefinitionRestControllerTest method testCreateGlobalAttributeDefinition.
@Test
public void testCreateGlobalAttributeDefinition() {
// Create a global attribute definition key.
GlobalAttributeDefinitionKey globalAttributeDefinitionKey = new GlobalAttributeDefinitionKey(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Create a global attribute definition create request.
GlobalAttributeDefinitionCreateRequest request = new GlobalAttributeDefinitionCreateRequest(globalAttributeDefinitionKey, attributeValueListKeyNull);
// Create a global attribute definition.
GlobalAttributeDefinition globalAttributeDefinition = new GlobalAttributeDefinition();
// Mock calls to external methods.
when(globalAttributeDefinitionService.createGlobalAttributeDefinition(request)).thenReturn(globalAttributeDefinition);
// Call the method under test.
GlobalAttributeDefinition response = globalAttributeDefinitionRestController.createGlobalAttributeDefinition(request);
// Verify the external calls.
verify(globalAttributeDefinitionService).createGlobalAttributeDefinition(request);
verifyNoMoreInteractions(globalAttributeDefinitionService);
// Validate the response.
assertEquals(globalAttributeDefinition, response);
}
use of org.finra.herd.model.api.xml.GlobalAttributeDefinition in project herd by FINRAOS.
the class GlobalAttributeDefinitionRestControllerTest method testDeleteGlobalAttributeDefinition.
@Test
public void testDeleteGlobalAttributeDefinition() {
// Create a global attribute definition key.
GlobalAttributeDefinitionKey globalAttributeDefinitionKey = new GlobalAttributeDefinitionKey(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Create a global attribute definition.
GlobalAttributeDefinition globalAttributeDefinition = new GlobalAttributeDefinition(INTEGER_VALUE, globalAttributeDefinitionKey, attributeValueListNull);
// Mock calls to external methods.
when(globalAttributeDefinitionService.deleteGlobalAttributeDefinition(globalAttributeDefinitionKey)).thenReturn(globalAttributeDefinition);
// Call the method under test.
GlobalAttributeDefinition response = globalAttributeDefinitionRestController.deleteGlobalAttributeDefinition(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Verify the external calls.
verify(globalAttributeDefinitionService).deleteGlobalAttributeDefinition(globalAttributeDefinitionKey);
verifyNoMoreInteractions(globalAttributeDefinitionService);
// Validate the response.
assertEquals(globalAttributeDefinition, response);
}
use of org.finra.herd.model.api.xml.GlobalAttributeDefinition in project herd by FINRAOS.
the class GlobalAttributeDefinitionRestControllerTest method testGetGlobalAttributeDefinition.
@Test
public void testGetGlobalAttributeDefinition() {
// Create a global attribute definition key.
GlobalAttributeDefinitionKey globalAttributeDefinitionKey = new GlobalAttributeDefinitionKey(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Create a global attribute definition.
GlobalAttributeDefinition globalAttributeDefinition = new GlobalAttributeDefinition(INTEGER_VALUE, globalAttributeDefinitionKey, attributeValueListNull);
// Mock calls to external methods.
when(globalAttributeDefinitionService.getGlobalAttributeDefinition(globalAttributeDefinitionKey)).thenReturn(globalAttributeDefinition);
// Call the method under test.
GlobalAttributeDefinition response = globalAttributeDefinitionRestController.getGlobalAttributeDefinition(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Verify the external calls.
verify(globalAttributeDefinitionService).getGlobalAttributeDefinition(globalAttributeDefinitionKey);
verifyNoMoreInteractions(globalAttributeDefinitionService);
// Validate the response.
assertEquals(globalAttributeDefinition, response);
}
use of org.finra.herd.model.api.xml.GlobalAttributeDefinition in project herd by FINRAOS.
the class GlobalAttributeDefinitionServiceTest method testDeleteGlobalAttributeDefinition.
@Test
public void testDeleteGlobalAttributeDefinition() {
// Create a global attribute definition key.
GlobalAttributeDefinitionKey globalAttributeDefinitionKey = new GlobalAttributeDefinitionKey(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Create a global attribute definition entity.
GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity = globalAttributeDefinitionDaoTestHelper.createGlobalAttributeDefinitionEntity(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
// Mock calls to external methods.
when(globalAttributeDefinitionDaoHelper.getGlobalAttributeDefinitionEntity(globalAttributeDefinitionKey)).thenReturn(globalAttributeDefinitionEntity);
// Call the method under test.
GlobalAttributeDefinition response = globalAttributeDefinitionService.deleteGlobalAttributeDefinition(globalAttributeDefinitionKey);
// Verify the external calls.
verify(globalAttributeDefinitionHelper).validateGlobalAttributeDefinitionKey(globalAttributeDefinitionKey);
verify(globalAttributeDefinitionDaoHelper).getGlobalAttributeDefinitionEntity(globalAttributeDefinitionKey);
verify(globalAttributeDefinitionDao).delete(globalAttributeDefinitionEntity);
verifyNoMoreInteractionsHelper();
// Validate.
assertEquals(new GlobalAttributeDefinition(response.getId(), globalAttributeDefinitionKey, attributeValueListNull), response);
}
Aggregations