public class GenerateAlertEvents implements Decorator {
- private final RulesProfile profile;
private final QualityGate qualityGate;
private final TimeMachine timeMachine;
private NotificationManager notificationManager;
- public GenerateAlertEvents(RulesProfile profile, QualityGate qualityGate, TimeMachine timeMachine, NotificationManager notificationManager) {
- this.profile = profile;
+ public GenerateAlertEvents(QualityGate qualityGate, TimeMachine timeMachine, NotificationManager notificationManager) {
this.qualityGate = qualityGate;
this.timeMachine = timeMachine;
this.notificationManager = notificationManager;
}
public boolean shouldExecuteOnProject(Project project) {
- return profile != null && profile.getAlerts() != null && !profile.getAlerts().isEmpty()
- || qualityGate.isEnabled();
+ return qualityGate.isEnabled();
}
@DependsUpon
import org.sonar.api.measures.Metric;
import org.sonar.api.notifications.Notification;
import org.sonar.api.notifications.NotificationManager;
-import org.sonar.api.profiles.Alert;
-import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.File;
import org.sonar.api.resources.Project;
import org.sonar.api.test.ProjectTestBuilder;
import java.util.Date;
import static org.fest.assertions.Assertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isNull;
+import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
public class GenerateAlertEventsTest {
private GenerateAlertEvents decorator;
private DecoratorContext context;
- private RulesProfile profile;
private QualityGate qualityGate;
private TimeMachine timeMachine;
private NotificationManager notificationManager;
public void setup() {
context = mock(DecoratorContext.class);
timeMachine = mock(TimeMachine.class);
- profile = mock(RulesProfile.class);
qualityGate = mock(QualityGate.class);
notificationManager = mock(NotificationManager.class);
- decorator = new GenerateAlertEvents(profile, qualityGate, timeMachine, notificationManager);
+ decorator = new GenerateAlertEvents(qualityGate, timeMachine, notificationManager);
project = new ProjectTestBuilder().build();
}
assertThat(decorator.shouldExecuteOnProject(project)).isTrue();
}
- @Test
- public void shouldDecorateIfThresholds() {
- when(profile.getAlerts()).thenReturn(Arrays.asList(new Alert()));
- assertThat(decorator.shouldExecuteOnProject(project)).isTrue();
- }
-
@Test
public void shouldNotDecorateIfNotRootProject() {
decorator.decorate(new File("Foo"), context);
activeRule.getActiveRuleParams().size();
activeRule.getRule().getParams().size();
}
- profile.getAlerts().size();
return profile;
}
}
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.profiles.Alert;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Rule;
return null;
}
- @Override
- public List<Alert> getAlerts() {
- List<Alert> result = new ArrayList<Alert>();
- for (RulesProfile profile : profiles) {
- result.addAll(profile.getAlerts());
- }
- return result;
- }
-
@Override
public List<ActiveRule> getActiveRules() {
List<ActiveRule> activeRules = new ArrayList<ActiveRule>();
assertThat(profile).isNotNull().isInstanceOf(RulesProfileWrapper.class);
assertThat(profile.getLanguage()).isEqualTo("");
assertThat(profile.getName()).isEqualTo("SonarQube");
- assertThat(profile.getAlerts()).isEmpty();
assertThat(profile.getActiveRules()).isEmpty();
try {
profile.getId();
.copyTable(source, dest, "rules")
.copyTable(source, dest, "rules_parameters")
.copyTable(source, dest, "rules_profiles")
- .copyTable(source, dest, "alerts")
.copyTableColumns(source, dest, "users", new String[] {"id", "login", "name", "active"});
if (projectId != null) {
template.copyTable(source, dest, "projects", projectQuery(projectId, false));
<class>org.sonar.api.rules.ActiveRule</class>
<class>org.sonar.api.rules.ActiveRuleParam</class>
<class>org.sonar.api.batch.Event</class>
- <class>org.sonar.api.profiles.Alert</class>
<class>org.sonar.api.rules.ActiveRuleChange</class>
<class>org.sonar.api.rules.ActiveRuleParamChange</class>
assertThat(rowCount("metrics")).isEqualTo(2);
assertThat(rowCount("projects")).isZero();
- assertThat(rowCount("alerts")).isEqualTo(1);
assertThat(rowCount("events")).isZero();
assertThat(rowCount("users")).isEqualTo(3);
// Verify that password column was not exported into dryRun DB
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 org.sonar.api.profiles;
-
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.sonar.api.database.BaseIdentifiable;
-import org.sonar.api.measures.Metric;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-/**
- * Class to map alerts with hibernate model
- */
-@Entity
-@Table(name = "alerts")
-public class Alert extends BaseIdentifiable implements Cloneable {
- /**
- * Operator strictly greater than
- */
- public static final String OPERATOR_GREATER = ">";
-
- /**
- * Operator strictly lesser than
- */
- public static final String OPERATOR_SMALLER = "<";
-
- /**
- * Operator equals
- */
- public static final String OPERATOR_EQUALS = "=";
-
- /**
- * Operator not equals
- */
- public static final String OPERATOR_NOT_EQUALS = "!=";
-
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "profile_id")
- @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
- private RulesProfile rulesProfile;
-
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "metric_id", nullable = true)
- @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
- private Metric metric;
-
- @Column(name = "operator", updatable = false, nullable = true, length = 3)
- private String operator;
-
- @Column(name = "value_error", updatable = false, nullable = true, length = 64)
- private String valueError;
-
- @Column(name = "value_warning", updatable = false, nullable = true, length = 64)
- private String valueWarning;
-
- @Column(name = "period", updatable = false, nullable = true)
- private Integer period;
-
- /**
- * Default constructor
- */
- public Alert() {
- }
-
- /**
- * Creates an alert
- *
- * @param rulesProfile the profile used to trigger the alert
- * @param metric the metric tested for the alert
- * @param operator the operator defined
- * @param valueError the error value
- * @param valueWarning the warning value
- */
- public Alert(RulesProfile rulesProfile, Metric metric, String operator, String valueError, String valueWarning) {
- super();
- this.rulesProfile = rulesProfile;
- this.metric = metric;
- this.operator = operator;
- this.valueError = valueError;
- this.valueWarning = valueWarning;
- }
-
- /**
- * Creates an alert
- *
- * @param rulesProfile the profile used to trigger the alert
- * @param metric the metric tested for the alert
- * @param operator the operator defined
- * @param valueError the error value
- * @param valueWarning the warning value
- */
- public Alert(RulesProfile rulesProfile, Metric metric, String operator, String valueError, String valueWarning, Integer period) {
- this(rulesProfile, metric, operator, valueError, valueWarning);
- this.period = period;
- }
-
- /**
- * @return the alert profile
- */
- public RulesProfile getRulesProfile() {
- return rulesProfile;
- }
-
- /**
- * Sets the alert profile
- */
- public void setRulesProfile(RulesProfile rulesProfile) {
- this.rulesProfile = rulesProfile;
- }
-
- /**
- * @return the alert metric
- */
- public Metric getMetric() {
- return metric;
- }
-
- /**
- * Sets the alert metric
- */
- public void setMetric(Metric metric) {
- this.metric = metric;
- }
-
- /**
- * @return the alert operator
- */
- public String getOperator() {
- return operator;
- }
-
- /**
- * Sets the alert operator
- */
- public void setOperator(String operator) {
- this.operator = operator;
- }
-
- /**
- * @return the error value
- */
- public String getValueError() {
- return valueError;
- }
-
- /**
- * Sets the error value if any
- */
- public void setValueError(String valueError) {
- this.valueError = valueError;
- }
-
- /**
- * @return the warning value
- */
- public String getValueWarning() {
- return valueWarning;
- }
-
- /**
- * Sets the warning value if any
- */
- public void setValueWarning(String valueWarning) {
- this.valueWarning = valueWarning;
- }
-
- /**
- * @return the period
- */
- public Integer getPeriod() {
- return period;
- }
-
- /**
- * Sets the period if any
- */
- public void setPeriod(Integer period) {
- this.period = period;
- }
-
- /**
- * @return whether the operator is greater than
- */
- public boolean isGreaterOperator() {
- return operator.equals(OPERATOR_GREATER);
- }
-
- /**
- * @return whether the operator is lesser than
- */
- public boolean isSmallerOperator() {
- return operator.equals(OPERATOR_SMALLER);
- }
-
- /**
- * @return whether the operator is equals
- */
- public boolean isEqualsOperator() {
- return operator.equals(OPERATOR_EQUALS);
- }
-
- /**
- * @return whether the operator is not equals
- */
- public boolean isNotEqualsOperator() {
- return operator.equals(OPERATOR_NOT_EQUALS);
- }
-
- /**
- * @deprecated since 3.4 because it does not manage alerts with variation
- */
- @Deprecated
- public String getAlertLabel(Metric.Level level) {
- return new StringBuilder()
- .append(getMetric().getName())
- .append(" ").append(getOperator())
- .append(" ")
- .append(level.equals(Metric.Level.ERROR) ? getValueError() : getValueWarning()).toString();
- }
-
- @Override
- public Object clone() {
- return new Alert(getRulesProfile(), getMetric(), getOperator(), getValueError(), getValueWarning(), getPeriod());
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Alert alert = (Alert) o;
- if (metric != null ? !metric.equals(alert.metric) : alert.metric != null) {
- return false;
- }
- if (period != null ? !period.equals(alert.period) : alert.period != null) {
- return false;
- }
- return !(rulesProfile != null ? !rulesProfile.equals(alert.rulesProfile) : alert.rulesProfile != null);
- }
-
- @Override
- public int hashCode() {
- int result = rulesProfile != null ? rulesProfile.hashCode() : 0;
- result = 31 * result + (metric != null ? metric.hashCode() : 0);
- result = 31 * result + (period != null ? period.hashCode() : 0);
- return result;
- }
-}
@OneToMany(mappedBy = "rulesProfile", fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE})
private List<ActiveRule> activeRules = Lists.newArrayList();
- @OneToMany(mappedBy = "rulesProfile", fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE})
- private List<Alert> alerts = Lists.newArrayList();
-
/**
* @deprecated use the factory method create()
*/
this.name = name;
this.language = language;
this.activeRules = Lists.newArrayList();
- this.alerts = Lists.newArrayList();
}
/**
this.parentName = parentName;
}
- /**
- * @return the list of alerts defined in the profile
- */
- public List<Alert> getAlerts() {
- return alerts;
- }
-
- /**
- * Sets the list of alerts for the profile
- */
- public void setAlerts(List<Alert> alerts) {
- this.alerts = alerts;
- }
-
/**
* Note: disabled rules are excluded.
*
}
})));
}
- if (CollectionUtils.isNotEmpty(getAlerts())) {
- clone.setAlerts(new ArrayList<Alert>(CollectionUtils.collect(getAlerts(), new Transformer() {
- public Object transform(Object input) {
- return ((Alert) input).clone();
- }
- })));
- }
return clone;
}
import org.codehaus.staxmate.in.SMHierarchicCursor;
import org.codehaus.staxmate.in.SMInputCursor;
import org.sonar.api.ServerComponent;
-import org.sonar.api.measures.Metric;
import org.sonar.api.measures.MetricFinder;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;
import org.sonar.api.rules.RulePriority;
-import org.sonar.api.utils.Logs;
import org.sonar.api.utils.ValidationMessages;
import javax.xml.stream.XMLInputFactory;
SMInputCursor rulesCursor = cursor.childElementCursor("rule");
processRules(rulesCursor, profile, messages);
- } else if (StringUtils.equals("alerts", nodeName)) {
- SMInputCursor alertsCursor = cursor.childElementCursor("alert");
- processAlerts(alertsCursor, profile, messages);
-
} else if (StringUtils.equals("name", nodeName)) {
profile.setName(StringUtils.trim(cursor.collectDescendantText(false)));
}
}
- private void processAlerts(SMInputCursor alertsCursor, RulesProfile profile, ValidationMessages messages) throws XMLStreamException {
- if (metricFinder == null) {
- // TODO remove when constructor without MetricFinder would be removed
- Logs.INFO.error("Unable to parse alerts, because MetricFinder not available.");
- return;
- }
- while (alertsCursor.getNext() != null) {
- SMInputCursor alertCursor = alertsCursor.childElementCursor();
-
- String metricKey = null, operator = "", valueError = "", valueWarning = "";
- Integer period = null;
-
- while (alertCursor.getNext() != null) {
- String nodeName = alertCursor.getLocalName();
-
- if (StringUtils.equals("metric", nodeName)) {
- metricKey = StringUtils.trim(alertCursor.collectDescendantText(false));
-
- } else if (StringUtils.equals("period", nodeName)) {
- String periodParameter = StringUtils.trim(alertCursor.collectDescendantText(false));
- if (StringUtils.isNotBlank(periodParameter)) {
- period = Integer.parseInt(periodParameter);
- }
- } else if (StringUtils.equals("operator", nodeName)) {
- operator = StringUtils.trim(alertCursor.collectDescendantText(false));
-
- } else if (StringUtils.equals("warning", nodeName)) {
- valueWarning = StringUtils.trim(alertCursor.collectDescendantText(false));
-
- } else if (StringUtils.equals("error", nodeName)) {
- valueError = StringUtils.trim(alertCursor.collectDescendantText(false));
- }
- }
-
- Metric metric = metricFinder.findByKey(metricKey);
- if (metric == null) {
- messages.addWarningText("Metric '" + metricKey + "' does not exist");
- } else {
- Alert alert = new Alert(profile, metric, operator, valueError, valueWarning, period);
- profile.getAlerts().add(alert);
- }
- }
- }
-
}
try {
appendHeader(profile, writer);
appendRules(profile, writer);
- appendAlerts(profile, writer);
appendFooter(writer);
} catch (IOException e) {
}
}
- private void appendAlerts(RulesProfile profile, Writer writer) throws IOException {
- if (!profile.getAlerts().isEmpty()) {
- writer.append("<alerts>");
- for (Alert alert : profile.getAlerts()) {
- appendAlert(alert, writer);
- }
- writer.append("</alerts>");
- }
- }
-
- private void appendAlert(Alert alert, Writer writer) throws IOException {
- writer.append("<alert><metric>");
- StringEscapeUtils.escapeXml(writer, alert.getMetric().getKey());
- writer.append("</metric>");
- if (alert.getPeriod() !=null) {
- writer.append("<period>");
- StringEscapeUtils.escapeXml(writer, Integer.toString(alert.getPeriod()));
- writer.append("</period>");
- }
- writer.append("<operator>");
- StringEscapeUtils.escapeXml(writer, alert.getOperator());
- writer.append("</operator>");
- writer.append("<warning>");
- StringEscapeUtils.escapeXml(writer, alert.getValueWarning());
- writer.append("</warning>");
- writer.append("<error>");
- StringEscapeUtils.escapeXml(writer, alert.getValueError());
- writer.append("</error></alert>");
- }
-
private void appendFooter(Writer writer) throws IOException {
writer.append("</profile>");
}
assertThat(rule.getParameter("unknown")).isNull();
}
- @Test
- public void importProfileWithAlerts() {
- ValidationMessages validation = ValidationMessages.create();
- RulesProfile profile = parse("importProfileWithAlerts.xml", validation);
-
- assertThat(profile.getAlerts()).hasSize(2);
-
- Alert alert = profile.getAlerts().get(0);
- assertThat(alert.getMetric().getKey()).isEqualTo("lines");
- assertThat(alert.getOperator()).isEqualTo(Alert.OPERATOR_SMALLER);
- assertThat(alert.getValueWarning()).isEqualTo("0");
- assertThat(alert.getValueError()).isEqualTo("10");
- assertThat(alert.getPeriod()).isNull();
-
- alert = profile.getAlerts().get(1);
- assertThat(alert.getMetric().getKey()).isEqualTo("complexity");
- assertThat(alert.getOperator()).isEqualTo(Alert.OPERATOR_GREATER);
- assertThat(alert.getValueWarning()).isEqualTo("10");
- assertThat(alert.getValueError()).isEqualTo("12");
- assertThat(alert.getPeriod()).isEqualTo(1);
- }
-
- @Test
- public void shouldNotFailWhenNoMetricFinder() {
- ValidationMessages validation = ValidationMessages.create();
- RulesProfile profile = new XMLProfileParser(newRuleFinder(), null)
- .parseResource(getClass().getClassLoader(), getResourcePath("importProfileWithAlerts.xml"), validation);
-
- assertThat(profile.getAlerts()).isEmpty();
- }
-
private RulesProfile parse(String resource, ValidationMessages validation) {
return new XMLProfileParser(newRuleFinder(), newMetricFinder())
.parseResource(getClass().getClassLoader(), getResourcePath(resource), validation);
assertSimilarXml("exportRuleParameters.xml", writer.toString());
}
- @Test
- public void exportAlerts() throws Exception {
- Writer writer = new StringWriter();
- RulesProfile profile = RulesProfile.create("sonar way", "java");
- List<Alert> alerts = profile.getAlerts();
- Alert alert1 = new Alert(profile, new Metric("coverage"), Alert.OPERATOR_SMALLER, "60", "80");
- alerts.add(alert1);
- Alert alert2 = new Alert(profile, new Metric("complexity"), Alert.OPERATOR_GREATER, "12", "10", 1);
- alerts.add(alert2);
- new XMLProfileSerializer().write(profile, writer);
-
- assertSimilarXml("exportAlerts.xml", writer.toString());
- }
-
public static void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException, SAXException {
String pathToExpectedXml = "/org/sonar/api/profiles/XMLProfileSerializerTest/" + fileWithExpectedXml;
InputStream stream = XMLProfileSerializerTest.class.getResourceAsStream(pathToExpectedXml);
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
- <name>sonar way</name>
- <language>java</language>
- <rules>
- <rule>
- <repositoryKey>checkstyle</repositoryKey>
- <key>IllegalRegexp</key>
- <priority>CRITICAL</priority>
- </rule>
- </rules>
- <alerts>
- <alert>
- <metric>lines</metric>
- <operator><</operator>
- <warning>0</warning>
- <error>10</error>
- </alert>
- <alert>
- <metric>complexity</metric>
- <period>1</period>
- <operator>></operator>
- <error>12</error>
- <warning>10</warning>
- </alert>
- </alerts>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
- <name>sonar way</name>
- <language>java</language>
- <alerts>
- <alert>
- <metric>coverage</metric>
- <operator><</operator>
- <error>60</error>
- <warning>80</warning>
- </alert>
- <alert>
- <metric>complexity</metric>
- <period>1</period>
- <operator>></operator>
- <error>12</error>
- <warning>10</warning>
- </alert>
- </alerts>
-</profile>
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
-import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.measures.Metric;
-import org.sonar.api.profiles.Alert;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.rules.*;
import org.sonar.core.preview.PreviewCache;
String defaultProfile = "defaultProfile";
xStream.alias("profile", RulesProfile.class);
- xStream.alias("alert", Alert.class);
xStream.alias("active-rule", ActiveRule.class);
xStream.aliasField("active-rules", RulesProfile.class, "activeRules");
xStream.aliasField("default-profile", RulesProfile.class, defaultProfile);
xStream.omitField(RulesProfile.class, defaultProfile);
xStream.omitField(RulesProfile.class, "enabled");
xStream.registerConverter(getActiveRuleConverter());
- xStream.registerConverter(getAlertsConverter());
}
public void importProfile(RulesDao rulesDao, RulesProfile toImport) {
toImport.setUsed(false);
}
importActiveRules(rulesDao, toImport);
- importAlerts(toImport);
session.save(toImport);
dryRunCache.reportGlobalModification();
}
- private void importAlerts(RulesProfile profile) {
- if (profile.getAlerts() != null) {
- for (Iterator<Alert> ia = profile.getAlerts().iterator(); ia.hasNext(); ) {
- Alert alert = ia.next();
- Metric unMarshalledMetric = alert.getMetric();
- String validKey = unMarshalledMetric.getKey();
- Metric matchingMetricInDb = session.getSingleResult(Metric.class, KEY, validKey);
- if (matchingMetricInDb == null) {
- LoggerFactory.getLogger(getClass()).error("Unable to find metric " + validKey);
- ia.remove();
- continue;
- }
- alert.setMetric(matchingMetricInDb);
- alert.setRulesProfile(profile);
- }
- }
- }
-
private void importActiveRules(RulesDao rulesDao, RulesProfile profile) {
for (Iterator<ActiveRule> iar = profile.getActiveRules(true).iterator(); iar.hasNext(); ) {
ActiveRule activeRule = iar.next();
}
}
- private Converter getAlertsConverter() {
- return new Converter() {
-
- public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
- Alert alert = (Alert) source;
- writeNode(writer, OPERATOR, alert.getOperator());
- writeNode(writer, VALUE_ERROR, alert.getValueError());
- writeNode(writer, VALUE_WARNING, alert.getValueWarning());
- if (alert.getPeriod() != null) {
- writeNode(writer, PERIOD, Integer.toString(alert.getPeriod()));
- }
- writeNode(writer, METRIC_KEY, alert.getMetric().getKey());
- }
-
- public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
- Map<String, String> values = readNode(reader);
- Alert alert = new Alert(null, new Metric(values.get(METRIC_KEY)), values.get(OPERATOR), values.get(VALUE_ERROR),
- values.get(VALUE_WARNING));
- String periodText = values.get(PERIOD);
- if (StringUtils.isNotEmpty(periodText)) {
- alert.setPeriod(Integer.parseInt(periodText));
- }
- return alert;
- }
-
- public boolean canConvert(Class type) {
- return type.equals(Alert.class);
- }
- };
- }
-
private Converter getActiveRuleConverter() {
return new Converter() {
*/
package org.sonar.server.startup;
-import org.sonar.core.qualitygate.db.QualityGateConditionDao;
-
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Metric;
import org.sonar.api.measures.Metrics;
-import org.sonar.api.profiles.Alert;
import org.sonar.api.utils.TimeProfiler;
+import org.sonar.core.qualitygate.db.QualityGateConditionDao;
import org.sonar.jpa.dao.MeasuresDao;
-import javax.persistence.Query;
-
import java.util.List;
import java.util.Map;