use of org.sonar.db.permission.template.PermissionTemplateCharacteristicDto in project sonarqube by SonarSource.
the class AddProjectCreatorToTemplateActionTest method update_row_when_existing_template_permission.
@Test
public void update_row_when_existing_template_permission() {
loginAsAdmin();
PermissionTemplateCharacteristicDto characteristic = db.getDbClient().permissionTemplateCharacteristicDao().insert(db.getSession(), new PermissionTemplateCharacteristicDto().setUuid(Uuids.createFast()).setTemplateUuid(template.getUuid()).setPermission(UserRole.USER).setWithProjectCreator(false).setCreatedAt(1_000_000_000L).setUpdatedAt(1_000_000_000L), template.getName());
db.commit();
when(system.now()).thenReturn(3_000_000_000L);
newRequest().setParam(PARAM_PERMISSION, UserRole.USER).setParam(PARAM_TEMPLATE_NAME, template.getName()).execute();
assertThatProjectCreatorIsPresentFor(UserRole.USER, template.getUuid());
PermissionTemplateCharacteristicDto reloaded = reload(characteristic);
assertThat(reloaded.getCreatedAt()).isEqualTo(1_000_000_000L);
assertThat(reloaded.getUpdatedAt()).isEqualTo(3_000_000_000L);
}
use of org.sonar.db.permission.template.PermissionTemplateCharacteristicDto in project sonarqube by SonarSource.
the class RemoveProjectCreatorFromTemplateActionTest method update_template_permission.
@Test
public void update_template_permission() {
PermissionTemplateCharacteristicDto characteristic = db.getDbClient().permissionTemplateCharacteristicDao().insert(db.getSession(), new PermissionTemplateCharacteristicDto().setUuid(Uuids.createFast()).setTemplateUuid(template.getUuid()).setPermission(UserRole.USER).setWithProjectCreator(false).setCreatedAt(1_000_000_000L).setUpdatedAt(1_000_000_000L), template.getName());
db.commit();
when(system.now()).thenReturn(3_000_000_000L);
newRequest().setParam(PARAM_PERMISSION, UserRole.USER).setParam(PARAM_TEMPLATE_NAME, template.getName()).execute();
assertWithoutProjectCreatorFor(UserRole.USER);
PermissionTemplateCharacteristicDto reloaded = reload(characteristic);
assertThat(reloaded.getCreatedAt()).isEqualTo(1_000_000_000L);
assertThat(reloaded.getUpdatedAt()).isEqualTo(3_000_000_000L);
}
Aggregations