use of org.finra.herd.model.api.xml.UserNamespaceAuthorizations in project herd by FINRAOS.
the class UserNamespaceAuthorizationRestControllerTest method testGetUserNamespaceAuthorizationsByNamespace.
@Test
public void testGetUserNamespaceAuthorizationsByNamespace() throws Exception {
UserNamespaceAuthorizations userNamespaceAuthorizations = new UserNamespaceAuthorizations();
when(userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByNamespace(USER_ID)).thenReturn(userNamespaceAuthorizations);
// Get user namespace authorizations for the specified user id.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationRestController.getUserNamespaceAuthorizationsByNamespace(USER_ID);
// Verify the external calls.
verify(userNamespaceAuthorizationService).getUserNamespaceAuthorizationsByNamespace(USER_ID);
verifyNoMoreInteractions(userNamespaceAuthorizationService);
// Validate the returned object.
assertEquals(resultUserNamespaceAuthorizations, userNamespaceAuthorizations);
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorizations in project herd by FINRAOS.
the class UserNamespaceAuthorizationRestControllerTest method testGetUserNamespaceAuthorizationsByUserId.
@Test
public void testGetUserNamespaceAuthorizationsByUserId() throws Exception {
UserNamespaceAuthorizations userNamespaceAuthorizations = new UserNamespaceAuthorizations();
when(userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(USER_ID)).thenReturn(userNamespaceAuthorizations);
// Get user namespace authorizations for the specified user id.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationRestController.getUserNamespaceAuthorizationsByUserId(USER_ID);
// Verify the external calls.
verify(userNamespaceAuthorizationService).getUserNamespaceAuthorizationsByUserId(USER_ID);
verifyNoMoreInteractions(userNamespaceAuthorizationService);
// Validate the returned object.
assertEquals(resultUserNamespaceAuthorizations, userNamespaceAuthorizations);
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorizations in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByNamespaceTrimParameters.
@Test
public void testGetUserNamespaceAuthorizationsByNamespaceTrimParameters() throws Exception {
// Create a user namespace authorization key.
UserNamespaceAuthorizationKey key = new UserNamespaceAuthorizationKey(USER_ID, NAMESPACE);
// Create and persist the relative database entities.
UserNamespaceAuthorizationEntity userNamespaceAuthorizationEntity = userNamespaceAuthorizationDaoTestHelper.createUserNamespaceAuthorizationEntity(key, SUPPORTED_NAMESPACE_PERMISSIONS);
// Get user namespace authorizations for the specified namespace using namespace code with leading and trailing empty spaces.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByNamespace(addWhitespace(key.getNamespace()));
// Validate the returned object.
assertEquals(new UserNamespaceAuthorizations(Arrays.asList(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS))), resultUserNamespaceAuthorizations);
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorizations in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByUserId.
// Unit tests for getUserNamespaceAuthorizationsByUserId().
@Test
public void testGetUserNamespaceAuthorizationsByUserId() throws Exception {
// Create user namespace authorization keys. The keys are listed out of order to validate the order by logic.
List<UserNamespaceAuthorizationKey> keys = Arrays.asList(new UserNamespaceAuthorizationKey(USER_ID_2, NAMESPACE_2), new UserNamespaceAuthorizationKey(USER_ID_2, NAMESPACE), new UserNamespaceAuthorizationKey(USER_ID, NAMESPACE_2), new UserNamespaceAuthorizationKey(USER_ID, NAMESPACE));
// Create and persist the relative database entities.
for (UserNamespaceAuthorizationKey key : keys) {
userNamespaceAuthorizationDaoTestHelper.createUserNamespaceAuthorizationEntity(key, SUPPORTED_NAMESPACE_PERMISSIONS);
}
// Get user namespace authorizations for the specified user id.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(USER_ID);
// Validate the returned object.
assertEquals(new UserNamespaceAuthorizations(Arrays.asList(new UserNamespaceAuthorization(resultUserNamespaceAuthorizations.getUserNamespaceAuthorizations().get(0).getId(), keys.get(3), SUPPORTED_NAMESPACE_PERMISSIONS), new UserNamespaceAuthorization(resultUserNamespaceAuthorizations.getUserNamespaceAuthorizations().get(1).getId(), keys.get(2), SUPPORTED_NAMESPACE_PERMISSIONS))), resultUserNamespaceAuthorizations);
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorizations in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByNamespace.
// Unit tests for getUserNamespaceAuthorizationsByNamespace().
@Test
public void testGetUserNamespaceAuthorizationsByNamespace() throws Exception {
// Create user namespace authorization keys. The keys are listed out of order to validate the order by logic.
List<UserNamespaceAuthorizationKey> keys = Arrays.asList(new UserNamespaceAuthorizationKey(USER_ID_2, NAMESPACE_2), new UserNamespaceAuthorizationKey(USER_ID_2, NAMESPACE), new UserNamespaceAuthorizationKey(USER_ID, NAMESPACE_2), new UserNamespaceAuthorizationKey(USER_ID, NAMESPACE));
// Create and persist the relative database entities.
for (UserNamespaceAuthorizationKey key : keys) {
userNamespaceAuthorizationDaoTestHelper.createUserNamespaceAuthorizationEntity(key, SUPPORTED_NAMESPACE_PERMISSIONS);
}
// Get user namespace authorizations for the specified namespace.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByNamespace(NAMESPACE);
// Validate the returned object.
assertEquals(new UserNamespaceAuthorizations(Arrays.asList(new UserNamespaceAuthorization(resultUserNamespaceAuthorizations.getUserNamespaceAuthorizations().get(0).getId(), keys.get(3), SUPPORTED_NAMESPACE_PERMISSIONS), new UserNamespaceAuthorization(resultUserNamespaceAuthorizations.getUserNamespaceAuthorizations().get(1).getId(), keys.get(1), SUPPORTED_NAMESPACE_PERMISSIONS))), resultUserNamespaceAuthorizations);
}
Aggregations