use of org.sonar.server.qualityprofile.BulkChangeResult in project sonarqube by SonarSource.
the class BulkRuleActivationActions method bulkDeactivate.
private void bulkDeactivate(Request request, Response response) {
BulkChangeResult result = profileService.bulkDeactivate(ruleQueryFactory.createRuleQuery(request), request.mandatoryParam(PROFILE_KEY));
writeResponse(result, response);
}
use of org.sonar.server.qualityprofile.BulkChangeResult in project sonarqube by SonarSource.
the class OldRestoreAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
qProfileWsSupport.checkQProfileAdminPermission();
InputStream backup = request.paramAsInputStream(PARAM_BACKUP);
InputStreamReader reader = null;
try {
checkArgument(backup != null, "A backup file must be provided");
reader = new InputStreamReader(backup, StandardCharsets.UTF_8);
BulkChangeResult result = backuper.restore(reader, null);
writeResponse(response.newJsonWriter(), result);
} finally {
IOUtils.closeQuietly(reader);
IOUtils.closeQuietly(backup);
}
}
use of org.sonar.server.qualityprofile.BulkChangeResult in project sonarqube by SonarSource.
the class RestoreAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
qProfileWsSupport.checkQProfileAdminPermission();
InputStream backup = request.paramAsInputStream(PARAM_BACKUP);
InputStreamReader reader = null;
try {
checkArgument(backup != null, "A backup file must be provided");
reader = new InputStreamReader(backup, StandardCharsets.UTF_8);
BulkChangeResult result = backuper.restore(reader, null);
writeResponse(response.newJsonWriter(), result);
} finally {
IOUtils.closeQuietly(reader);
IOUtils.closeQuietly(backup);
}
}
use of org.sonar.server.qualityprofile.BulkChangeResult in project sonarqube by SonarSource.
the class BulkRuleActivationActions method bulkActivate.
private void bulkActivate(Request request, Response response) {
BulkChangeResult result = profileService.bulkActivate(ruleQueryFactory.createRuleQuery(request), request.mandatoryParam(PROFILE_KEY), request.param(SEVERITY));
writeResponse(result, response);
}
use of org.sonar.server.qualityprofile.BulkChangeResult in project sonarqube by SonarSource.
the class RestoreActionTest method restore_profile.
@Test
public void restore_profile() throws Exception {
logInAsQProfileAdministrator();
QualityProfileDto profile = QualityProfileDto.createFor("xoo-sonar-way-12345").setDefault(false).setLanguage("xoo").setName("Sonar way");
BulkChangeResult restoreResult = new BulkChangeResult(profile);
when(backuper.restore(any(Reader.class), (QProfileName) eq(null))).thenReturn(restoreResult);
tester.newPostRequest("api/qualityprofiles", "restore").setParam("backup", "<polop><palap/></polop>").execute().assertJson(getClass(), "restore_profile.json");
verify(backuper).restore(any(Reader.class), (QProfileName) eq(null));
}
Aggregations