Search in sources :

Example 1 with ServerProject

use of org.sonarsource.sonarlint.core.serverapi.component.ServerProject in project sonarlint-core by SonarSource.

the class DefaultRemoteProjectTests method testGetters.

@Test
void testGetters() {
    ServerProject project = new DefaultRemoteProject("key", "name");
    assertThat(project.getKey()).isEqualTo("key");
    assertThat(project.getName()).isEqualTo("name");
}
Also used : ServerProject(org.sonarsource.sonarlint.core.serverapi.component.ServerProject) DefaultRemoteProject(org.sonarsource.sonarlint.core.serverapi.component.DefaultRemoteProject) Test(org.junit.jupiter.api.Test)

Example 2 with ServerProject

use of org.sonarsource.sonarlint.core.serverapi.component.ServerProject in project sonarlint-core by SonarSource.

the class ServerProjectsStore method adapt.

private static Map<String, ServerProject> adapt(Sonarlint.ProjectList projectList) {
    Map<String, ServerProject> converted = new HashMap<>();
    var projectsByKey = projectList.getProjectsByKeyMap();
    for (Map.Entry<String, Sonarlint.ProjectList.Project> entry : projectsByKey.entrySet()) {
        var project = entry.getValue();
        converted.put(entry.getKey(), new DefaultRemoteProject(project.getKey(), project.getName()));
    }
    return converted;
}
Also used : DefaultRemoteProject(org.sonarsource.sonarlint.core.serverapi.component.DefaultRemoteProject) ServerProject(org.sonarsource.sonarlint.core.serverapi.component.ServerProject) HashMap(java.util.HashMap) ServerProject(org.sonarsource.sonarlint.core.serverapi.component.ServerProject) DefaultRemoteProject(org.sonarsource.sonarlint.core.serverapi.component.DefaultRemoteProject) Sonarlint(org.sonarsource.sonarlint.core.proto.Sonarlint) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

DefaultRemoteProject (org.sonarsource.sonarlint.core.serverapi.component.DefaultRemoteProject)2 ServerProject (org.sonarsource.sonarlint.core.serverapi.component.ServerProject)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Test (org.junit.jupiter.api.Test)1 Sonarlint (org.sonarsource.sonarlint.core.proto.Sonarlint)1