import com.google.common.collect.Sets;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.ibatis.session.SqlSession;
import org.picocontainer.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
import org.sonar.core.qualityprofile.db.ActiveRuleDao;
-import org.sonar.core.rule.RuleDao;
+import org.sonar.server.rule2.RuleDao;
import org.sonar.core.rule.RuleDto;
import org.sonar.core.rule.RuleParamDto;
import org.sonar.core.rule.RuleRuleTagDto;
// nothing
}
- private void selectRulesFromDb(Buffer buffer, SqlSession sqlSession) {
+ private void selectRulesFromDb(Buffer buffer, DbSession sqlSession) {
for (RuleDto ruleDto : ruleDao.selectNonManual(sqlSession)) {
buffer.add(ruleDto);
buffer.markUnprocessed(ruleDto);
return changed;
}
- private void mergeParams(Buffer buffer, SqlSession sqlSession, RulesDefinition.Rule ruleDef, RuleDto dto) {
+ private void mergeParams(Buffer buffer, DbSession sqlSession, RulesDefinition.Rule ruleDef, RuleDto dto) {
Collection<RuleParamDto> paramDtos = buffer.paramsForRuleId(dto.getId());
Set<String> persistedParamKeys = Sets.newHashSet();
for (RuleParamDto paramDto : paramDtos) {
return changed;
}
- private void mergeTags(Buffer buffer, SqlSession sqlSession, RulesDefinition.Rule ruleDef, RuleDto dto) {
+ private void mergeTags(Buffer buffer, DbSession sqlSession, RulesDefinition.Rule ruleDef, RuleDto dto) {
Set<String> existingSystemTags = Sets.newHashSet();
Collection<RuleRuleTagDto> tagDtos = ImmutableList.copyOf(buffer.tagsForRuleId(dto.getId()));
}
}
- private long getOrCreateReferenceTagId(Buffer buffer, String tag, SqlSession sqlSession) {
+ private long getOrCreateReferenceTagId(Buffer buffer, String tag, DbSession sqlSession) {
// End-user tag is converted to system tag
long tagId = 0L;
if (buffer.referenceTagExists(tag)) {
}
}
- private void index(Buffer buffer, SqlSession sqlSession) {
+ private void index(Buffer buffer, DbSession sqlSession) {
String[] ids = ruleRegistry.reindex(buffer.rulesById.values(), sqlSession);
ruleRegistry.removeDeletedRules(ids);
esRuleTags.putAllTags(buffer.referenceTagsByTagValue.values());
import org.sonar.core.persistence.AbstractDaoTestCase;
import org.sonar.core.persistence.MyBatis;
import org.sonar.core.qualityprofile.db.ActiveRuleDao;
-import org.sonar.core.rule.RuleDao;
+import org.sonar.server.rule2.RuleDao;
import org.sonar.core.rule.RuleDto;
import org.sonar.core.rule.RuleTagDao;
import org.sonar.core.rule.RuleTagDto;
// There is already one rule in DB
assertThat(ruleDao.selectAll()).hasSize(BigRepository.SIZE + 1);
assertThat(ruleDao.selectParameters()).hasSize(BigRepository.SIZE * 20);
- assertThat(ruleDao.selectTags(getMyBatis().openSession())).hasSize(BigRepository.SIZE * 3);
+ assertThat(ruleDao.selectTags(getMyBatis().openSession(false))).hasSize(BigRepository.SIZE * 3);
}
@Test
+++ /dev/null
-#!/bin/sh
-
-if [[ "$OSTYPE" == "darwin"* ]]; then
- OS='macosx-universal-64'
-else
- OS='linux-x86-64'
-fi
-
-if ! ls sonar-application/target/sonarqube-*.zip &> /dev/null; then
- echo 'Sources are not built'
- ./build.sh
-fi
-
-cd sonar-application/target/
-if ! ls sonarqube-*/bin/$OS/sonar.sh &> /dev/null; then
- unzip sonarqube-*.zip
-fi
-cd sonarqube-*
-bin/$OS/sonar.sh restart
-sleep 1
-tail -100f logs/sonar.log
--- /dev/null
+#!/bin/sh
+
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ OS='macosx-universal-64'
+else
+ OS='linux-x86-64'
+fi
+
+if ! ls sonar-application/target/sonarqube-*.zip &> /dev/null; then
+ echo 'Sources are not built'
+ ./build.sh
+fi
+
+cd sonar-application/target/
+if ! ls sonarqube-*/bin/$OS/sonar.sh &> /dev/null; then
+ unzip sonarqube-*.zip
+fi
+cd sonarqube-*
+bin/$OS/sonar.sh restart
+sleep 1
+tail -100f logs/sonar.log