use of org.finra.herd.model.jpa.UserNamespaceAuthorizationEntity in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testUpdateUserNamespaceAuthorizationUpperCaseParameters.
@Test
public void testUpdateUserNamespaceAuthorizationUpperCaseParameters() {
// 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, Arrays.asList(NamespacePermissionEnum.READ, NamespacePermissionEnum.WRITE));
// Update a user namespace authorization using uppercase input parameters.
UserNamespaceAuthorization resultUserNamespaceAuthorization = userNamespaceAuthorizationService.updateUserNamespaceAuthorization(new UserNamespaceAuthorizationKey(key.getUserId().toUpperCase(), key.getNamespace().toUpperCase()), new UserNamespaceAuthorizationUpdateRequest(SUPPORTED_NAMESPACE_PERMISSIONS));
// Validate the returned object.
assertEquals(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS), resultUserNamespaceAuthorization);
}
use of org.finra.herd.model.jpa.UserNamespaceAuthorizationEntity in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByUserIdUpperCaseParameters.
@Test
public void testGetUserNamespaceAuthorizationsByUserIdUpperCaseParameters() 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 uppercase user id value.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(key.getUserId().toUpperCase());
// Validate the returned object.
assertEquals(new UserNamespaceAuthorizations(Arrays.asList(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS))), resultUserNamespaceAuthorizations);
}
use of org.finra.herd.model.jpa.UserNamespaceAuthorizationEntity in project herd by FINRAOS.
the class UserNamespaceAuthorizationServiceTest method testGetUserNamespaceAuthorizationsByNamespaceUpperCaseParameters.
@Test
public void testGetUserNamespaceAuthorizationsByNamespaceUpperCaseParameters() 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 uppercase namespace code.
UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByNamespace(key.getNamespace().toUpperCase());
// Validate the returned object.
assertEquals(new UserNamespaceAuthorizations(Arrays.asList(new UserNamespaceAuthorization(userNamespaceAuthorizationEntity.getId(), key, SUPPORTED_NAMESPACE_PERMISSIONS))), resultUserNamespaceAuthorizations);
}
use of org.finra.herd.model.jpa.UserNamespaceAuthorizationEntity 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.jpa.UserNamespaceAuthorizationEntity 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));
}
Aggregations