import util.user.UserRule;
import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.resetEmailSettings;
import static util.ItUtils.runProjectAnalysis;
import static util.ItUtils.setServerProperty;
System.out.println("SMTP Server port: " + smtpServer.getServer().getPort());
// Configure Sonar
+ resetEmailSettings(ORCHESTRATOR);
setServerProperty(ORCHESTRATOR, "email.smtp_host.secured", "localhost");
setServerProperty(ORCHESTRATOR, "email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()));
}
userRule.deactivateUsers(USER_LOGIN);
setServerProperty(ORCHESTRATOR, "sonar.issues.defaultAssigneeLogin", null);
+ resetEmailSettings(ORCHESTRATOR);
}
@Before
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.projectDir;
+import static util.ItUtils.resetEmailSettings;
import static util.ItUtils.setServerProperty;
public class QualityGateNotificationTest {
setServerProperty(orchestrator, "sonar.timemachine.period2", "30");
setServerProperty(orchestrator, "sonar.timemachine.period3", "previous_version");
DEFAULT_QUALITY_GATE = qgClient().list().defaultGate().id();
+ resetEmailSettings(orchestrator);
}
@AfterClass
public static void resetData() throws Exception {
ItUtils.resetPeriods(orchestrator);
qgClient().setDefault(DEFAULT_QUALITY_GATE);
+ resetEmailSettings(orchestrator);
}
@Before
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.tuple;
import static util.ItUtils.newAdminWsClient;
-import static util.ItUtils.resetSettings;
+import static util.ItUtils.resetEmailSettings;
public class EmailsTest {
public static void before() throws Exception {
ADMIN_WS_CLIENT = newAdminWsClient(orchestrator);
SETTINGS = ADMIN_WS_CLIENT.settingsService();
+ resetEmailSettings(orchestrator);
SMTP_SERVER = new Wiser(0);
SMTP_SERVER.start();
if (SMTP_SERVER != null) {
SMTP_SERVER.stop();
}
- resetSettings(orchestrator, null, "email.smtp_host.secured", "email.smtp_port.secured", "email.smtp_secure_connection.secured", "email.smtp_username.secured",
- "email.smtp_password.secured", "email.from", "email.prefix");
+ resetEmailSettings(orchestrator);
}
@Before
import org.sonar.wsclient.services.PropertyDeleteQuery;
import org.sonar.wsclient.services.PropertyUpdateQuery;
import org.sonarqube.ws.client.HttpConnector;
+import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.WsClientFactories;
import org.sonarqube.ws.client.setting.ResetRequest;
newAdminWsClient(orchestrator).settingsService().reset(ResetRequest.builder().setKeys(keys).setComponentKey(componentKey).build());
}
+ public static void resetEmailSettings(Orchestrator orchestrator) {
+ newAdminWsClient(orchestrator).wsConnector().call(new PostRequest("/api/emails/update_configuration")).failIfNotSuccessful();
+ }
+
public static void resetPeriods(Orchestrator orchestrator) {
setServerProperty(orchestrator, "sonar.timemachine.period1", null);
setServerProperty(orchestrator, "sonar.timemachine.period2", null);