aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-tests
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-05-30 09:52:06 +0200
committerEric Hartmann <hartmann.eric@gmail.com>2017-06-14 15:43:12 +0200
commitb376b9da30fea9abeedafe0c30b82f3b3a9f5207 (patch)
treeb5310725fc19d841a8aaafc8b9be02db3bb1dc9d /it/it-tests
parent71987dfa5a6c563b3d8acf86592517a61ade3bc7 (diff)
downloadsonarqube-b376b9da30fea9abeedafe0c30b82f3b3a9f5207.tar.gz
sonarqube-b376b9da30fea9abeedafe0c30b82f3b3a9f5207.zip
SONAR-9302 Add IT to test built-in Quality Profiles
Diffstat (limited to 'it/it-tests')
-rw-r--r--it/it-tests/src/test/java/it/Category6Suite.java2
-rw-r--r--it/it-tests/src/test/java/it/qualityProfile/QualityProfilesBuiltInTest.java79
2 files changed, 81 insertions, 0 deletions
diff --git a/it/it-tests/src/test/java/it/Category6Suite.java b/it/it-tests/src/test/java/it/Category6Suite.java
index 23383060fd2..d3ee5e44e75 100644
--- a/it/it-tests/src/test/java/it/Category6Suite.java
+++ b/it/it-tests/src/test/java/it/Category6Suite.java
@@ -28,6 +28,7 @@ import it.organization.OrganizationTest;
import it.projectSearch.LeakProjectsPageTest;
import it.projectSearch.SearchProjectsTest;
import it.qualityProfile.OrganizationQualityProfilesPageTest;
+import it.qualityProfile.QualityProfilesBuiltInTest;
import it.uiExtension.OrganizationUiExtensionsTest;
import it.user.OrganizationIdentityProviderTest;
import org.junit.BeforeClass;
@@ -50,6 +51,7 @@ import static util.ItUtils.xooPlugin;
OrganizationQualityProfilesPageTest.class,
OrganizationTest.class,
OrganizationUiExtensionsTest.class,
+ QualityProfilesBuiltInTest.class,
BillingTest.class,
IssueTagsTest.class,
LeakProjectsPageTest.class,
diff --git a/it/it-tests/src/test/java/it/qualityProfile/QualityProfilesBuiltInTest.java b/it/it-tests/src/test/java/it/qualityProfile/QualityProfilesBuiltInTest.java
new file mode 100644
index 00000000000..74c74989787
--- /dev/null
+++ b/it/it-tests/src/test/java/it/qualityProfile/QualityProfilesBuiltInTest.java
@@ -0,0 +1,79 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.qualityProfile;
+
+import com.sonar.orchestrator.Orchestrator;
+import it.Category6Suite;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
+import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.client.WsClient;
+import org.sonarqube.ws.client.organization.CreateWsRequest;
+import org.sonarqube.ws.client.qualityprofile.SearchWsRequest;
+
+import static it.Category6Suite.enableOrganizationsSupport;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.tuple;
+import static util.ItUtils.newAdminWsClient;
+import static util.ItUtils.newOrganizationKey;
+
+public class QualityProfilesBuiltInTest {
+
+ private static final String ANOTHER_ORGANIZATION = newOrganizationKey();
+ @ClassRule
+ public static Orchestrator orchestrator = Category6Suite.ORCHESTRATOR;
+ private static WsClient adminWsClient;
+
+ @BeforeClass
+ public static void setUp() {
+ enableOrganizationsSupport();
+ adminWsClient = newAdminWsClient(orchestrator);
+ }
+
+ @Test
+ public void xoo_profiles_provided() {
+ SearchWsResponse result = adminWsClient.qualityProfiles().search(new SearchWsRequest());
+
+ assertThat(result.getProfilesList())
+ .extracting(QualityProfile::getOrganization, QualityProfile::getName, QualityProfile::getLanguage, QualityProfile::getIsBuiltIn, QualityProfile::getIsDefault)
+ .containsExactlyInAnyOrder(
+ tuple("default-organization", "Basic", "xoo", true, true),
+ tuple("default-organization", "empty", "xoo", true, false),
+ tuple("default-organization", "Basic", "xoo2", true, true));
+ }
+
+ @Test
+ public void xoo_profiles_provided_copied_to_new_organization() {
+ adminWsClient.organizations().create(new CreateWsRequest.Builder()
+ .setKey(ANOTHER_ORGANIZATION)
+ .setName(ANOTHER_ORGANIZATION).build());
+ SearchWsResponse result = adminWsClient.qualityProfiles().search(new SearchWsRequest()
+ .setOrganizationKey(ANOTHER_ORGANIZATION));
+
+ assertThat(result.getProfilesList())
+ .extracting(QualityProfile::getOrganization, QualityProfile::getName, QualityProfile::getLanguage, QualityProfile::getIsBuiltIn, QualityProfile::getIsDefault)
+ .containsExactlyInAnyOrder(
+ tuple(ANOTHER_ORGANIZATION, "Basic", "xoo", true, true),
+ tuple(ANOTHER_ORGANIZATION, "empty", "xoo", true, false),
+ tuple(ANOTHER_ORGANIZATION, "Basic", "xoo2", true, true));
+ }
+}