Search in sources :

Example 1 with Organization

use of org.sonarqube.ws.Organizations.Organization in project sonarqube by SonarSource.

the class CreateActionTest method verifyResponseAndDb.

private void verifyResponseAndDb(CreateWsResponse response, String id, String name, String key, @Nullable String description, @Nullable String url, @Nullable String avatar, long createdAt) {
    Organization organization = response.getOrganization();
    assertThat(organization.getName()).isEqualTo(name);
    assertThat(organization.getKey()).isEqualTo(key);
    if (description == null) {
        assertThat(organization.hasDescription()).isFalse();
    } else {
        assertThat(organization.getDescription()).isEqualTo(description);
    }
    if (url == null) {
        assertThat(organization.hasUrl()).isFalse();
    } else {
        assertThat(organization.getUrl()).isEqualTo(url);
    }
    if (avatar == null) {
        assertThat(organization.hasAvatar()).isFalse();
    } else {
        assertThat(organization.getAvatar()).isEqualTo(avatar);
    }
    OrganizationDto dto = dbClient.organizationDao().selectByUuid(dbTester.getSession(), id).get();
    assertThat(dto.getUuid()).isEqualTo(id);
    assertThat(dto.getKey()).isEqualTo(key);
    assertThat(dto.getName()).isEqualTo(name);
    assertThat(dto.getDescription()).isEqualTo(description);
    assertThat(dto.getUrl()).isEqualTo(url);
    assertThat(dto.getAvatarUrl()).isEqualTo(avatar);
    assertThat(dto.getCreatedAt()).isEqualTo(createdAt);
    assertThat(dto.getUpdatedAt()).isEqualTo(createdAt);
}
Also used : Organization(org.sonarqube.ws.Organizations.Organization) OrganizationDto(org.sonar.db.organization.OrganizationDto)

Example 2 with Organization

use of org.sonarqube.ws.Organizations.Organization in project sonarlint-core by SonarSource.

the class DefaultRemoteOrganizationTest method testRoundTrip.

@Test
public void testRoundTrip() {
    Organization org = Organization.newBuilder().setName("name").setKey("key").setDescription("desc").build();
    RemoteOrganization remoteOrg = new DefaultRemoteOrganization(org);
    assertThat(remoteOrg.getKey()).isEqualTo("key");
    assertThat(remoteOrg.getName()).isEqualTo("name");
    assertThat(remoteOrg.getDescription()).isEqualTo("desc");
}
Also used : Organization(org.sonarqube.ws.Organizations.Organization) RemoteOrganization(org.sonarsource.sonarlint.core.client.api.connected.RemoteOrganization) RemoteOrganization(org.sonarsource.sonarlint.core.client.api.connected.RemoteOrganization) Test(org.junit.Test)

Aggregations

Organization (org.sonarqube.ws.Organizations.Organization)2 Test (org.junit.Test)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1 RemoteOrganization (org.sonarsource.sonarlint.core.client.api.connected.RemoteOrganization)1