use of org.finra.herd.model.api.xml.NamespaceIamRoleAuthorization in project herd by FINRAOS.
the class NamespaceIamRoleAuthorizationServiceImpl method deleteNamespaceIamRoleAuthorization.
@NamespacePermission(fields = "#namespace", permissions = NamespacePermissionEnum.GRANT)
@Override
public NamespaceIamRoleAuthorization deleteNamespaceIamRoleAuthorization(String namespace) {
Assert.hasText(namespace, "Namespace must be specified");
NamespaceEntity namespaceEntity = namespaceDaoHelper.getNamespaceEntity(namespace.trim());
List<NamespaceIamRoleAuthorizationEntity> namespaceIamRoleAuthorizationEntities = getNamespaeIamRoleAuthorizationEntities(namespaceEntity);
NamespaceIamRoleAuthorization result = new NamespaceIamRoleAuthorization(namespaceEntity.getCode(), new ArrayList<>());
for (NamespaceIamRoleAuthorizationEntity namespaceIamRoleAuthorizationEntity : namespaceIamRoleAuthorizationEntities) {
namespaceIamRoleAuthorizationDao.delete(namespaceIamRoleAuthorizationEntity);
result.getIamRoles().add(new IamRole(namespaceIamRoleAuthorizationEntity.getIamRoleName(), namespaceIamRoleAuthorizationEntity.getDescription()));
}
return result;
}
use of org.finra.herd.model.api.xml.NamespaceIamRoleAuthorization in project herd by FINRAOS.
the class NamespaceIamRoleAuthorizationServiceImpl method getNamespaceIamRoleAuthorization.
@NamespacePermission(fields = "#namespace", permissions = NamespacePermissionEnum.READ)
@Override
public NamespaceIamRoleAuthorization getNamespaceIamRoleAuthorization(String namespace) {
Assert.hasText(namespace, "Namespace must be specified");
NamespaceEntity namespaceEntity = namespaceDaoHelper.getNamespaceEntity(namespace.trim());
List<NamespaceIamRoleAuthorizationEntity> namespaceIamRoleAuthorizationEntities = getNamespaeIamRoleAuthorizationEntities(namespaceEntity);
NamespaceIamRoleAuthorization result = new NamespaceIamRoleAuthorization(namespaceEntity.getCode(), new ArrayList<>());
for (NamespaceIamRoleAuthorizationEntity namespaceIamRoleAuthorizationEntity : namespaceIamRoleAuthorizationEntities) {
result.getIamRoles().add(new IamRole(namespaceIamRoleAuthorizationEntity.getIamRoleName(), namespaceIamRoleAuthorizationEntity.getDescription()));
}
return result;
}
use of org.finra.herd.model.api.xml.NamespaceIamRoleAuthorization in project herd by FINRAOS.
the class NamespaceIamRoleAuthorizationRestControllerTest method deleteNamespaceIamRoleAuthorizationAssertCallsService.
/**
* Asserts that deleteNamespaceIamRoleAuthorization() calls service with correct parameters, and returns whatever the service returns.
*/
@Test
public void deleteNamespaceIamRoleAuthorizationAssertCallsService() {
String expectedNamespace = "namespace";
NamespaceIamRoleAuthorization expectedResult = new NamespaceIamRoleAuthorization();
when(namespaceIamRoleAuthorizationService.deleteNamespaceIamRoleAuthorization(any())).thenReturn(expectedResult);
NamespaceIamRoleAuthorization actualResult = namespaceIamRoleAuthorizationRestController.deleteNamespaceIamRoleAuthorization(expectedNamespace);
verify(namespaceIamRoleAuthorizationService).deleteNamespaceIamRoleAuthorization(expectedNamespace);
verifyNoMoreInteractions(namespaceIamRoleAuthorizationService);
assertEquals(expectedResult, actualResult);
}
use of org.finra.herd.model.api.xml.NamespaceIamRoleAuthorization in project herd by FINRAOS.
the class NamespaceIamRoleAuthorizationRestControllerTest method createNamespaceIamRoleAuthorizationAssertCallsService.
/**
* Asserts that createNamespaceIamRoleAuthorization() calls service with correct parameters, and returns whatever the service returns.
*/
@Test
public void createNamespaceIamRoleAuthorizationAssertCallsService() {
NamespaceIamRoleAuthorizationCreateRequest expectedRequest = new NamespaceIamRoleAuthorizationCreateRequest();
NamespaceIamRoleAuthorization expectedResult = new NamespaceIamRoleAuthorization();
when(namespaceIamRoleAuthorizationService.createNamespaceIamRoleAuthorization(any())).thenReturn(expectedResult);
NamespaceIamRoleAuthorization actualResult = namespaceIamRoleAuthorizationRestController.createNamespaceIamRoleAuthorization(expectedRequest);
verify(namespaceIamRoleAuthorizationService).createNamespaceIamRoleAuthorization(expectedRequest);
verifyNoMoreInteractions(namespaceIamRoleAuthorizationService);
assertEquals(expectedResult, actualResult);
}
use of org.finra.herd.model.api.xml.NamespaceIamRoleAuthorization in project herd by FINRAOS.
the class NamespaceIamRoleAuthorizationRestControllerTest method getNamespaceIamRoleAuthorizationAssertCallsService.
/**
* Asserts that getNamespaceIamRoleAuthorization() calls service with correct parameters, and returns whatever the service returns.
*/
@Test
public void getNamespaceIamRoleAuthorizationAssertCallsService() {
String expectedNamespace = "namespace";
NamespaceIamRoleAuthorization expectedResult = new NamespaceIamRoleAuthorization();
when(namespaceIamRoleAuthorizationService.getNamespaceIamRoleAuthorization(any())).thenReturn(expectedResult);
NamespaceIamRoleAuthorization actualResult = namespaceIamRoleAuthorizationRestController.getNamespaceIamRoleAuthorization(expectedNamespace);
verify(namespaceIamRoleAuthorizationService).getNamespaceIamRoleAuthorization(expectedNamespace);
verifyNoMoreInteractions(namespaceIamRoleAuthorizationService);
assertEquals(expectedResult, actualResult);
}
Aggregations