use of org.finra.herd.model.api.xml.UserNamespaceAuthorization in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testDeleteUserNamespaceAuthorizationUpperCaseParameters.
@Test
public void testDeleteUserNamespaceAuthorizationUpperCaseParameters() {
// 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);
// Validate that this user namespace authorization exists.
assertNotNull(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(key));
// Delete a user namespace authorization using uppercase input parameters.
UserNamespaceAuthorization resultUserNamespaceAuthorization = userNamespaceAuthorizationService.deleteUserNamespaceAuthorization(new UserNamespaceAuthorizationKey(key.getUserId().toUpperCase(), key.getNamespace().toUpperCase()));
// Validate the returned object.
assertEquals(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS), resultUserNamespaceAuthorization);
// Ensure that this user namespace authorization is no longer there.
assertNull(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(key));
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorization in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testDeleteUserNamespaceAuthorizationLowerCaseParameters.
@Test
public void testDeleteUserNamespaceAuthorizationLowerCaseParameters() {
// 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);
// Validate that this user namespace authorization exists.
assertNotNull(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(key));
// Delete a user namespace authorization using lowercase input parameters.
UserNamespaceAuthorization resultUserNamespaceAuthorization = userNamespaceAuthorizationService.deleteUserNamespaceAuthorization(new UserNamespaceAuthorizationKey(key.getUserId().toLowerCase(), key.getNamespace().toLowerCase()));
// Validate the returned object.
assertEquals(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS), resultUserNamespaceAuthorization);
// Ensure that this user namespace authorization is no longer there.
assertNull(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(key));
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorization in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByUserIdLowerCaseParameters.
@Test
public void testGetUserNamespaceAuthorizationsByUserIdLowerCaseParameters() 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 user id using lowercase user id value.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(key.getUserId().toLowerCase());
// 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.UserNamespaceAuthorization in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testDeleteUserNamespaceAuthorization.
// Unit tests for deleteUserNamespaceAuthorization().
@Test
public void testDeleteUserNamespaceAuthorization() {
// 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);
// Validate that this user namespace authorization exists.
assertNotNull(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(key));
// Delete this user namespace authorization.
UserNamespaceAuthorization deletedUserNamespaceAuthorization = userNamespaceAuthorizationService.deleteUserNamespaceAuthorization(key);
// Validate the returned object.
assertEquals(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS), deletedUserNamespaceAuthorization);
// Ensure that this user namespace authorization is no longer there.
assertNull(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(key));
}
use of org.finra.herd.model.api.xml.UserNamespaceAuthorization in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByUserIdTrimParameters.
@Test
public void testGetUserNamespaceAuthorizationsByUserIdTrimParameters() 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 user id using user id value with leading and trailing empty spaces.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(addWhitespace(key.getUserId()));
// Validate the returned object.
assertEquals(new UserNamespaceAuthorizations(Arrays.asList(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS))), resultUserNamespaceAuthorizations);
}
Aggregations