diff options
Diffstat (limited to 'sonar-core')
7 files changed, 56 insertions, 71 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/activity/db/package-info.java b/sonar-core/src/main/java/org/sonar/core/activity/db/package-info.java new file mode 100644 index 00000000000..ddc4a6d20fb --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/activity/db/package-info.java @@ -0,0 +1,24 @@ +/* + * 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. + */ + +@ParametersAreNonnullByDefault +package org.sonar.core.activity.db; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/sonar-core/src/main/java/org/sonar/core/activity/package-info.java b/sonar-core/src/main/java/org/sonar/core/activity/package-info.java new file mode 100644 index 00000000000..8c6baa92aa2 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/activity/package-info.java @@ -0,0 +1,24 @@ +/* + * 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. + */ + +@ParametersAreNonnullByDefault +package org.sonar.core.activity; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/sonar-core/src/main/java/org/sonar/core/cluster/NullQueue.java b/sonar-core/src/main/java/org/sonar/core/cluster/NullQueue.java index d67576c418c..235d2078fef 100644 --- a/sonar-core/src/main/java/org/sonar/core/cluster/NullQueue.java +++ b/sonar-core/src/main/java/org/sonar/core/cluster/NullQueue.java @@ -21,16 +21,15 @@ package org.sonar.core.cluster; import java.util.List; - public class NullQueue implements WorkQueue<QueueAction> { @Override public void enqueue(QueueAction action) { - + // do nothing } @Override public void enqueue(List<QueueAction> actions) { - + // do nothing } } diff --git a/sonar-core/src/main/java/org/sonar/core/cluster/QueueAction.java b/sonar-core/src/main/java/org/sonar/core/cluster/QueueAction.java index 99a7ef3a1cf..f83078d3bb5 100644 --- a/sonar-core/src/main/java/org/sonar/core/cluster/QueueAction.java +++ b/sonar-core/src/main/java/org/sonar/core/cluster/QueueAction.java @@ -38,7 +38,7 @@ public abstract class QueueAction implements Runnable { @Override public void run(){ this.doExecute(); - if(latch != null){ + if (latch != null){ latch.countDown(); } } diff --git a/sonar-core/src/main/java/org/sonar/core/cluster/WorkQueue.java b/sonar-core/src/main/java/org/sonar/core/cluster/WorkQueue.java index bdd583b733a..9b4141f510d 100644 --- a/sonar-core/src/main/java/org/sonar/core/cluster/WorkQueue.java +++ b/sonar-core/src/main/java/org/sonar/core/cluster/WorkQueue.java @@ -21,7 +21,6 @@ package org.sonar.core.cluster; import java.util.List; - public interface WorkQueue<K extends QueueAction> { void enqueue(K action); diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java index a7f01729ccc..0f3af1f521f 100644 --- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java +++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java @@ -38,16 +38,6 @@ public class ActiveRuleDao implements ServerComponent { session.getMapper(ActiveRuleMapper.class).insert(dto); } - public void insert(ActiveRuleDto dto) { - SqlSession session = mybatis.openSession(false); - try { - insert(dto, session); - session.commit(); - } finally { - MyBatis.closeQuietly(session); - } - } - public List<ActiveRuleDto> selectByProfileId(int profileId) { SqlSession session = mybatis.openSession(false); try { @@ -61,16 +51,6 @@ public class ActiveRuleDao implements ServerComponent { session.getMapper(ActiveRuleMapper.class).insertParameter(dto); } - public void insert(ActiveRuleParamDto dto) { - SqlSession session = mybatis.openSession(false); - try { - insert(dto, session); - session.commit(); - } finally { - MyBatis.closeQuietly(session); - } - } - public List<ActiveRuleParamDto> selectParamsByProfileId(int profileId) { SqlSession session = mybatis.openSession(false); try { diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleDaoTest.java index 108525d1b8b..30ef5ac5673 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleDaoTest.java @@ -22,12 +22,11 @@ package org.sonar.core.qualityprofile.db; import org.junit.Before; import org.junit.Test; -import org.sonar.api.rule.Severity; import org.sonar.core.persistence.AbstractDaoTestCase; +import org.sonar.core.persistence.DbSession; import java.util.List; -import static junit.framework.Assert.fail; import static org.fest.assertions.Assertions.assertThat; public class ActiveRuleDaoTest extends AbstractDaoTestCase { @@ -40,21 +39,6 @@ public class ActiveRuleDaoTest extends AbstractDaoTestCase { } @Test - public void insert() { - setupData("empty"); - - ActiveRuleDto dto = new ActiveRuleDto() - .setProfileId(1) - .setRuleId(10) - .setSeverity(Severity.MAJOR) - .setInheritance("INHERITED"); - - dao.insert(dto); - - checkTables("insert", "active_rules"); - } - - @Test public void select_by_profile() { setupData("shared"); @@ -66,13 +50,15 @@ public class ActiveRuleDaoTest extends AbstractDaoTestCase { public void insert_parameter() { setupData("empty"); + DbSession session = getMyBatis().openSession(false); ActiveRuleParamDto dto = new ActiveRuleParamDto() .setActiveRuleId(1) .setRulesParameterId(1) .setKey("max") .setValue("20"); - - dao.insert(dto); + dao.insert(dto, session); + session.commit(); + session.close(); checkTables("insert_parameter", "active_rule_parameters"); } @@ -83,31 +69,4 @@ public class ActiveRuleDaoTest extends AbstractDaoTestCase { assertThat(dao.selectParamsByProfileId(1)).hasSize(2); } - - @Test - public void fail_unique_rule_index() { - setupData("empty"); - - ActiveRuleDto dto = new ActiveRuleDto() - .setProfileId(1) - .setRuleId(10) - .setSeverity(Severity.MAJOR) - .setInheritance("INHERITED"); - - dao.insert(dto); - - try { - ActiveRuleDto dto2 = new ActiveRuleDto() - .setProfileId(1) - .setRuleId(10) - .setSeverity(Severity.MAJOR) - .setInheritance("INHERITED"); - - dao.insert(dto2); - fail(); - } catch (Exception e) { - - } - - } } |