Search in sources :

Example 1 with SetRequest

use of org.sonarqube.ws.client.settings.SetRequest in project sonarlint-core by SonarSource.

the class CommercialAnalyzerTest method prepare.

@BeforeClass
public static void prepare() throws Exception {
    adminWsClient = newAdminWsClient(ORCHESTRATOR);
    adminWsClient.settings().set(new SetRequest().setKey("sonar.forceAuthentication").setValue("true"));
    sonarUserHome = temp.newFolder().toPath();
    removeGroupPermission("anyone", "scan");
    adminWsClient.users().create(new CreateRequest().setLogin(SONARLINT_USER).setPassword(SONARLINT_PWD).setName("SonarLint"));
    ORCHESTRATOR.getServer().provisionProject(PROJECT_KEY_C, "Sample C");
    ORCHESTRATOR.getServer().provisionProject(PROJECT_KEY_COBOL, "Sample Cobol");
    ORCHESTRATOR.getServer().provisionProject(PROJECT_KEY_TSQL, "Sample TSQL");
    ORCHESTRATOR.getServer().provisionProject(PROJECT_KEY_APEX, "Sample APEX");
    ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY_C, "c", "SonarLint IT C");
    ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY_COBOL, "cobol", "SonarLint IT Cobol");
    ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY_TSQL, "tsql", "SonarLint IT TSQL");
    ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY_APEX, "apex", "SonarLint IT APEX");
}
Also used : SetRequest(org.sonarqube.ws.client.settings.SetRequest) CreateRequest(org.sonarqube.ws.client.users.CreateRequest) BeforeClass(org.junit.BeforeClass)

Example 2 with SetRequest

use of org.sonarqube.ws.client.settings.SetRequest in project sonarlint-core by SonarSource.

the class ConnectedModeTest method updateNoAuth.

@Test
public void updateNoAuth() {
    adminWsClient.settings().set(new SetRequest().setKey("sonar.forceAuthentication").setValue("true"));
    try {
        engine.update(endpointParams(ORCHESTRATOR), sqHttpClientNoAuth(), null);
        fail("Exception expected");
    } catch (Exception e) {
        assertThat(e).hasMessage("Not authorized. Please check server credentials.");
    } finally {
        adminWsClient.settings().set(new SetRequest().setKey("sonar.forceAuthentication").setValue("false"));
    }
}
Also used : SetRequest(org.sonarqube.ws.client.settings.SetRequest) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

SetRequest (org.sonarqube.ws.client.settings.SetRequest)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 IOException (java.io.IOException)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 CreateRequest (org.sonarqube.ws.client.users.CreateRequest)1