diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-05-22 15:09:39 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-05-25 09:08:47 +0200 |
commit | abb3b3611c0fb9fb092847b69052a8f7e2635362 (patch) | |
tree | f0644e83293f348d46c01e3552700b54686b2d42 /sonar-core | |
parent | 0a4d5f75f078abd6c6d8d4a58d0b4efc8c5cd512 (diff) | |
download | sonarqube-abb3b3611c0fb9fb092847b69052a8f7e2635362.tar.gz sonarqube-abb3b3611c0fb9fb092847b69052a8f7e2635362.zip |
SONAR-6259 Do not assume that project exists at the begin of the compute engine
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java | 23 | ||||
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java | 11 |
2 files changed, 5 insertions, 29 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java index 1a50baf6e6c..4f37b6405d7 100644 --- a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java +++ b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java @@ -26,8 +26,8 @@ import org.apache.commons.dbutils.DbUtils; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; import org.sonar.api.batch.BatchSide; -import org.sonar.api.server.ServerSide; import org.sonar.api.resources.Scopes; +import org.sonar.api.server.ServerSide; import org.sonar.core.persistence.DaoComponent; import org.sonar.core.persistence.DaoUtils; import org.sonar.core.persistence.DbSession; @@ -133,27 +133,14 @@ public class PropertiesDao implements DaoComponent { } } - public List<PropertyDto> selectProjectProperties(String resourceKey, SqlSession session) { - return session.getMapper(PropertiesMapper.class).selectProjectProperties(resourceKey); - } - - public List<PropertyDto> selectProjectProperties(long resourceId) { - SqlSession session = mybatis.openSession(false); - try { - return selectProjectProperties(resourceId, session); - } finally { - MyBatis.closeQuietly(session); - } - } - - public List<PropertyDto> selectProjectProperties(long resourceId, SqlSession session) { - return session.getMapper(PropertiesMapper.class).selectProjectPropertiesByResourceId(resourceId); + public List<PropertyDto> selectProjectProperties(DbSession session, String projectKey) { + return session.getMapper(PropertiesMapper.class).selectProjectProperties(projectKey); } public List<PropertyDto> selectProjectProperties(String resourceKey) { - SqlSession session = mybatis.openSession(false); + DbSession session = mybatis.openSession(false); try { - return selectProjectProperties(resourceKey, session); + return selectProjectProperties(session, resourceKey); } finally { MyBatis.closeQuietly(session); } diff --git a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java index 908003b855e..7095646484d 100644 --- a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java @@ -164,17 +164,6 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @Test - public void selectProjectPropertiesByResourceId() { - setupData("selectProjectPropertiesByResourceId"); - - List<PropertyDto> properties = dao.selectProjectProperties(10L); - - assertThat(properties.size(), is(2)); - assertThat(properties).extracting("key").containsOnly("struts.one", "user.two"); - assertThat(properties).extracting("value").containsOnly("one", "two"); - } - - @Test public void select_module_properties_tree() { setupData("select_module_properties_tree"); |