aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--it/it-tests/src/test/java/it/user/OnboardingTest.java7
-rw-r--r--it/it-tests/src/test/java/org/sonarqube/test/Tester.java31
-rw-r--r--it/it-tests/src/test/java/util/ItUtils.java13
-rw-r--r--it/it-tests/src/test/java/util/selenium/Selenese.java7
-rw-r--r--it/it-tests/src/test/java/util/user/GroupManagement.java4
-rw-r--r--it/it-tests/src/test/java/util/user/Groups.java5
-rw-r--r--it/it-tests/src/test/java/util/user/UserRule.java4
7 files changed, 50 insertions, 21 deletions
diff --git a/it/it-tests/src/test/java/it/user/OnboardingTest.java b/it/it-tests/src/test/java/it/user/OnboardingTest.java
index ecc26fbe056..e0a277a812a 100644
--- a/it/it-tests/src/test/java/it/user/OnboardingTest.java
+++ b/it/it-tests/src/test/java/it/user/OnboardingTest.java
@@ -39,13 +39,10 @@ public class OnboardingTest {
private static final String ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS = "sonar.onboardingTutorial.showToNewUsers";
@ClassRule
- public static final Orchestrator orchestrator = Orchestrator.builderEnv()
- .build();
+ public static final Orchestrator orchestrator = Orchestrator.builderEnv().build();
@Rule
- public Tester tester = new Tester(orchestrator)
- .disableOrganizations()
- .enableOnBoardingTutorials();
+ public Tester tester = new Tester(orchestrator).disableOrganizations();
@Before
public void setUp() {
diff --git a/it/it-tests/src/test/java/org/sonarqube/test/Tester.java b/it/it-tests/src/test/java/org/sonarqube/test/Tester.java
index a5b31a4b000..9373e82abd9 100644
--- a/it/it-tests/src/test/java/org/sonarqube/test/Tester.java
+++ b/it/it-tests/src/test/java/org/sonarqube/test/Tester.java
@@ -23,19 +23,32 @@ import com.sonar.orchestrator.Orchestrator;
import javax.annotation.Nullable;
import org.junit.rules.ExternalResource;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.setting.SetRequest;
import pageobjects.Navigation;
import util.selenium.Selenese;
import static util.ItUtils.newUserWsClient;
+/**
+ * This JUnit rule wraps an {@link Orchestrator} instance and provides :
+ * <ul>
+ * <li>enabling the organization feature by default</li>
+ * <li>clean-up of organizations between tests</li>
+ * <li>clean-up of users between tests</li>
+ * <li>clean-up of session when opening a browser (cookies, local storage)</li>
+ * <li>quick access to {@link WsClient} instances</li>
+ * <li>helpers to generate organizations and users</li>
+ * </ul>
+ *
+ * Recommendation is to define a {@code @Rule} instance. If not possible, then
+ * {@code @ClassRule} must be used through a {@link org.junit.rules.RuleChain}
+ * around {@link Orchestrator}.
+ */
public class Tester extends ExternalResource implements Session {
private final Orchestrator orchestrator;
// configuration before startup
private boolean disableOrganizations = false;
- private boolean enableOnBoardingTutorials = false;
// initialized in #before()
private boolean beforeCalled = false;
@@ -51,12 +64,6 @@ public class Tester extends ExternalResource implements Session {
return this;
}
- public Tester enableOnBoardingTutorials() {
- verifyNotStarted();
- enableOnBoardingTutorials = true;
- return this;
- }
-
@Override
protected void before() {
verifyNotStarted();
@@ -66,14 +73,6 @@ public class Tester extends ExternalResource implements Session {
organizations().enableSupport();
}
- if (!enableOnBoardingTutorials) {
- rootSession.wsClient().settings().set(SetRequest.builder()
- .setKey("sonar.onboardingTutorial.showToNewUsers")
- .setValue("false")
- .build());
- rootSession.wsClient().users().skipOnboardingTutorial();
- }
-
beforeCalled = true;
}
diff --git a/it/it-tests/src/test/java/util/ItUtils.java b/it/it-tests/src/test/java/util/ItUtils.java
index e5281dd88b5..a8e5ee495e0 100644
--- a/it/it-tests/src/test/java/util/ItUtils.java
+++ b/it/it-tests/src/test/java/util/ItUtils.java
@@ -61,6 +61,7 @@ import org.junit.Assert;
import org.sonar.wsclient.issue.Issue;
import org.sonar.wsclient.issue.IssueClient;
import org.sonar.wsclient.issue.IssueQuery;
+import org.sonarqube.test.Tester;
import org.sonarqube.ws.WsComponents.Component;
import org.sonarqube.ws.WsMeasures;
import org.sonarqube.ws.WsMeasures.Measure;
@@ -100,14 +101,26 @@ public class ItUtils {
return issueClient.find(IssueQuery.create()).list();
}
+ /**
+ * @deprecated replaced by {@link Tester#wsClient()}
+ */
+ @Deprecated
public static WsClient newAdminWsClient(Orchestrator orchestrator) {
return newUserWsClient(orchestrator, ADMIN_LOGIN, ADMIN_PASSWORD);
}
+ /**
+ * @deprecated replaced by {@link Tester#wsClient()}
+ */
+ @Deprecated
public static WsClient newWsClient(Orchestrator orchestrator) {
return newUserWsClient(orchestrator, null, null);
}
+ /**
+ * @deprecated replaced by {@link Tester#wsClient()}
+ */
+ @Deprecated
public static WsClient newUserWsClient(Orchestrator orchestrator, @Nullable String login, @Nullable String password) {
Server server = orchestrator.getServer();
return WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
diff --git a/it/it-tests/src/test/java/util/selenium/Selenese.java b/it/it-tests/src/test/java/util/selenium/Selenese.java
index 67f0755cacd..4e01674e59b 100644
--- a/it/it-tests/src/test/java/util/selenium/Selenese.java
+++ b/it/it-tests/src/test/java/util/selenium/Selenese.java
@@ -23,10 +23,13 @@ import com.sonar.orchestrator.Orchestrator;
import java.io.File;
import javax.annotation.Nullable;
import org.apache.commons.io.FileUtils;
+import org.sonarqube.test.Tester;
/**
* Selenium HTML tests, generally written with Selenium IDE
+ * @deprecated replaced by {@link Tester}
*/
+@Deprecated
public final class Selenese {
private File[] htmlTests;
@@ -39,6 +42,10 @@ public final class Selenese {
return htmlTests;
}
+ /**
+ * @deprecated replaced by {@link Tester#runHtmlTests(String...)}
+ */
+ @Deprecated
public static void runSelenese(Orchestrator orchestrator, String... htmlFiles) {
Selenese selenese = new Builder()
.setHtmlTests(htmlFiles)
diff --git a/it/it-tests/src/test/java/util/user/GroupManagement.java b/it/it-tests/src/test/java/util/user/GroupManagement.java
index 8ff4d6046a1..17d526456f2 100644
--- a/it/it-tests/src/test/java/util/user/GroupManagement.java
+++ b/it/it-tests/src/test/java/util/user/GroupManagement.java
@@ -23,6 +23,10 @@ import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
+/**
+ * @deprecated replaced by {@link org.sonarqube.test.Tester}
+ */
+@Deprecated
public interface GroupManagement {
void createGroup(String name);
diff --git a/it/it-tests/src/test/java/util/user/Groups.java b/it/it-tests/src/test/java/util/user/Groups.java
index d2834fb63da..5856352a447 100644
--- a/it/it-tests/src/test/java/util/user/Groups.java
+++ b/it/it-tests/src/test/java/util/user/Groups.java
@@ -22,6 +22,11 @@ package util.user;
import com.google.gson.Gson;
import java.util.List;
+/**
+ * @deprecated replaced by {@link org.sonarqube.test.Tester}
+ */
+@Deprecated
+
public class Groups {
private List<Group> groups;
diff --git a/it/it-tests/src/test/java/util/user/UserRule.java b/it/it-tests/src/test/java/util/user/UserRule.java
index 36beb068231..96f67c4a879 100644
--- a/it/it-tests/src/test/java/util/user/UserRule.java
+++ b/it/it-tests/src/test/java/util/user/UserRule.java
@@ -50,6 +50,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.guava.api.Assertions.assertThat;
import static util.ItUtils.newAdminWsClient;
+/**
+ * @deprecated replaced by {@link org.sonarqube.test.Tester}
+ */
+@Deprecated
public class UserRule extends ExternalResource implements GroupManagement {
public static final String ADMIN_LOGIN = "admin";