webappContext = new TomcatContexts().configure(tomcat, props);
try {
tomcat.start();
- new TomcatStartupLogs(props, Loggers.get(getClass())).log(tomcat);
+ new TomcatStartupLogs(Loggers.get(getClass())).log(tomcat);
} catch (LifecycleException e) {
Throwables.propagate(e);
}
import org.apache.catalina.startup.Tomcat;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.utils.log.Logger;
-import org.sonar.process.Props;
class TomcatStartupLogs {
private final Logger log;
- private final Props props;
- TomcatStartupLogs(Props props, Logger log) {
- this.props = props;
+ TomcatStartupLogs(Logger log) {
this.log = log;
}
Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS);
Logger logger = mock(Logger.class);
- Props props = new Props(new Properties());
- TomcatStartupLogs underTest = new TomcatStartupLogs(props, logger);
+ TomcatStartupLogs underTest = new TomcatStartupLogs(logger);
@Test
public void logAjp() {
*/
@Beta
public class PostProjectAnalysisTaskTester {
- private static final String DATE_CAN_NOT_BE_NULL = "date can not be null";
- private static final String PROJECT_CAN_NOT_BE_NULL = "project can not be null";
- private static final String CE_TASK_CAN_NOT_BE_NULL = "ceTask can not be null";
+ private static final String DATE_CAN_NOT_BE_NULL = "date cannot be null";
+ private static final String PROJECT_CAN_NOT_BE_NULL = "project cannot be null";
+ private static final String CE_TASK_CAN_NOT_BE_NULL = "ceTask cannot be null";
+ private static final String STATUS_CAN_NOT_BE_NULL = "status cannot be null";
private final PostProjectAnalysisTask underTest;
@CheckForNull
private QualityGate qualityGate;
private PostProjectAnalysisTaskTester(PostProjectAnalysisTask underTest) {
- this.underTest = requireNonNull(underTest, "PostProjectAnalysisTask instance can not be null");
+ this.underTest = requireNonNull(underTest, "PostProjectAnalysisTask instance cannot be null");
}
public static PostProjectAnalysisTaskTester of(PostProjectAnalysisTask underTest) {
@Beta
public static final class CeTaskBuilder {
- private static final String ID_CAN_NOT_BE_NULL = "id can not be null";
- private static final String STATUS_CAN_NOT_BE_NULL = "status can not be null";
+ private static final String ID_CAN_NOT_BE_NULL = "id cannot be null";
@CheckForNull
private String id;
@Beta
public static final class ProjectBuilder {
- private static final String UUID_CAN_NOT_BE_NULL = "uuid can not be null";
- private static final String KEY_CAN_NOT_BE_NULL = "key can not be null";
- private static final String NAME_CAN_NOT_BE_NULL = "name can not be null";
+ private static final String UUID_CAN_NOT_BE_NULL = "uuid cannot be null";
+ private static final String KEY_CAN_NOT_BE_NULL = "key cannot be null";
+ private static final String NAME_CAN_NOT_BE_NULL = "name cannot be null";
private String uuid;
private String key;
private String name;
@Beta
public static final class QualityGateBuilder {
- private static final String ID_CAN_NOT_BE_NULL = "id can not be null";
- private static final String NAME_CAN_NOT_BE_NULL = "name can not be null";
- private static final String STATUS_CAN_NOT_BE_NULL = "status can not be null";
+ private static final String ID_CAN_NOT_BE_NULL = "id cannot be null";
+ private static final String NAME_CAN_NOT_BE_NULL = "name cannot be null";
private String id;
private String name;
}
public QualityGateBuilder add(QualityGate.Condition condition) {
- conditions.add(requireNonNull(condition, "condition can not be null"));
+ conditions.add(requireNonNull(condition, "condition cannot be null"));
return this;
}
@Beta
public static final class ConditionBuilder {
- private static final String METRIC_KEY_CAN_NOT_BE_NULL = "metricKey can not be null";
- private static final String OPERATOR_CAN_NOT_BE_NULL = "operator can not be null";
+ private static final String METRIC_KEY_CAN_NOT_BE_NULL = "metricKey cannot be null";
+ private static final String OPERATOR_CAN_NOT_BE_NULL = "operator cannot be null";
private String metricKey;
private QualityGate.Operator operator;
public QualityGate.Condition build(final QualityGate.EvaluationStatus status, final String value) {
checkCommonProperties();
- requireNonNull(status, "status can not be null");
- checkArgument(status != QualityGate.EvaluationStatus.NO_VALUE, "status can not be NO_VALUE, use method buildNoValue() instead");
- requireNonNull(value, "value can not be null, use method buildNoValue() instead");
+ requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
+ checkArgument(status != QualityGate.EvaluationStatus.NO_VALUE, "status cannot be NO_VALUE, use method buildNoValue() instead");
+ requireNonNull(value, "value cannot be null, use method buildNoValue() instead");
return new QualityGate.Condition() {
@Override
public QualityGate.EvaluationStatus getStatus() {
@Test
public void setId_throws_NPE_if_id_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.setId(null);
}
@Test
public void setStatus_throws_NPE_if_status_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.setStatus(null);
}
underTest.setStatus(SOME_STATUS);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.build();
}
underTest.setId(SOME_ID);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.build();
}
@Test
public void setMetricKey_throws_NPE_if_operator_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("metricKey can not be null");
+ expectedException.expectMessage("metricKey cannot be null");
underTest.setMetricKey(null);
}
@Test
public void setOperator_throws_NPE_if_operator_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("operator can not be null");
+ expectedException.expectMessage("operator cannot be null");
underTest.setOperator(null);
}
underTest.setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("metricKey can not be null");
+ expectedException.expectMessage("metricKey cannot be null");
underTest.buildNoValue();
}
underTest.setMetricKey(SOME_METRIC_KEY).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("operator can not be null");
+ expectedException.expectMessage("operator cannot be null");
underTest.buildNoValue();
}
initValidBuilder();
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.build(null, SOME_VALUE);
}
initValidBuilder();
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("status can not be NO_VALUE, use method buildNoValue() instead");
+ expectedException.expectMessage("status cannot be NO_VALUE, use method buildNoValue() instead");
underTest.build(QualityGate.EvaluationStatus.NO_VALUE, SOME_VALUE);
}
initValidBuilder();
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("value can not be null, use method buildNoValue() instead");
+ expectedException.expectMessage("value cannot be null, use method buildNoValue() instead");
underTest.build(SOME_STATUS_BUT_NO_VALUE, null);
}
underTest.setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("metricKey can not be null");
+ expectedException.expectMessage("metricKey cannot be null");
underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE);
}
underTest.setMetricKey(SOME_METRIC_KEY).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("operator can not be null");
+ expectedException.expectMessage("operator cannot be null");
underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE);
}
@Test
public void of_throws_NPE_if_PostProjectAnalysisTask_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("PostProjectAnalysisTask instance can not be null");
+ expectedException.expectMessage("PostProjectAnalysisTask instance cannot be null");
PostProjectAnalysisTaskTester.of(null);
}
@Test
public void withCeTask_throws_NPE_if_ceTask_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("ceTask can not be null");
+ expectedException.expectMessage("ceTask cannot be null");
underTest.withCeTask(null);
}
@Test
public void withProject_throws_NPE_if_project_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("project can not be null");
+ expectedException.expectMessage("project cannot be null");
underTest.withProject(null);
}
@Test
public void at_throws_NPE_if_date_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("date can not be null");
+ expectedException.expectMessage("date cannot be null");
underTest.at(null);
}
underTest.withProject(project).at(someDate);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("ceTask can not be null");
+ expectedException.expectMessage("ceTask cannot be null");
underTest.execute();
}
underTest.withCeTask(ceTask).at(someDate);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("project can not be null");
+ expectedException.expectMessage("project cannot be null");
underTest.execute();
}
underTest.withCeTask(ceTask).withProject(project);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("date can not be null");
+ expectedException.expectMessage("date cannot be null");
underTest.execute();
}
@Test
public void setKey_throws_NPE_if_key_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("key can not be null");
+ expectedException.expectMessage("key cannot be null");
underTest.setKey(null);
}
@Test
public void setName_throws_NPE_if_name_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.setName(null);
}
@Test
public void setUuid_throws_NPE_if_uuid_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can not be null");
+ expectedException.expectMessage("uuid cannot be null");
underTest.setUuid(null);
}
underTest.setUuid(SOME_UUID).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("key can not be null");
+ expectedException.expectMessage("key cannot be null");
underTest.build();
}
underTest.setUuid(SOME_UUID).setKey(SOME_KEY);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.build();
underTest.setKey(SOME_KEY).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can not be null");
+ expectedException.expectMessage("uuid cannot be null");
underTest.build();
}
@Test
public void setId_throws_NPE_if_id_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.setId(null);
}
@Test
public void setStatus_throws_NPE_if_status_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.setStatus(null);
}
@Test
public void setName_throws_NPE_if_name_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.setName(null);
}
@Test
public void addCondition_throws_NPE_if_condition_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("condition can not be null");
+ expectedException.expectMessage("condition cannot be null");
underTest.add(null);
}
underTest.setStatus(SOME_STATUS).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.build();
}
underTest.setId(SOME_ID).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.build();
}
underTest.setId(SOME_ID).setStatus(SOME_STATUS);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.build();
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.batch.bootstrap.AbstractAnalysisMode;
import org.sonar.batch.bootstrap.GlobalProperties;
import org.sonar.batch.mediumtest.FakePluginInstaller;
/**
* @since 4.0
*/
-public class DefaultAnalysisMode extends AbstractAnalysisMode implements AnalysisMode {
+public class DefaultAnalysisMode extends AbstractAnalysisMode {
private static final Logger LOG = LoggerFactory.getLogger(DefaultAnalysisMode.class);
private static final String KEY_SCAN_ALL = "sonar.scanAllFiles";
*/
package org.sonar.batch.bootstrap;
-import org.sonar.api.CoreProperties;
-
-import org.sonar.api.batch.AnalysisMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.sonar.api.CoreProperties;
-public class GlobalMode extends AbstractAnalysisMode implements AnalysisMode {
+public class GlobalMode extends AbstractAnalysisMode {
private static final Logger LOG = LoggerFactory.getLogger(GlobalMode.class);
public GlobalMode(GlobalProperties props) {