@Deprecated
public static final String SUN_CONVENTIONS_NAME = "Sun checks";
- private Integer id;
private String name;
private Boolean defaultProfile = Boolean.FALSE;
- private Boolean used = Boolean.FALSE;
private String language;
private String parentName;
private List<ActiveRule> activeRules = Lists.newArrayList();
}
public Integer getId() {
- return id;
+ return null;
}
/**
*/
@Deprecated
public Boolean getUsed() {
- return used;
+ return null;
}
/**
*/
@Deprecated
public RulesProfile setUsed(Boolean used) {
- this.used = used;
return this;
}
*/
package org.sonar.server.activity.db;
-import com.google.common.annotations.VisibleForTesting;
import org.sonar.api.utils.System2;
import org.sonar.core.activity.db.ActivityDto;
import org.sonar.core.activity.db.ActivityMapper;
*/
public class ActivityDao extends BaseDao<ActivityMapper, ActivityDto, String> {
- public ActivityDao() {
- this(System2.INSTANCE);
- }
-
- @VisibleForTesting
public ActivityDao(System2 system) {
super(IndexDefinition.LOG, ActivityMapper.class, system);
}
@Override
protected ActivityDto doUpdate(DbSession session, ActivityDto item) {
- throw new IllegalStateException("Cannot update Log!");
+ throw new IllegalStateException("Cannot update Log!");
}
@Override
@Override
public void synchronizeAfter(DbSession session, Date time) {
- for(ActivityDto activity:this.findAll(session)){
+ for (ActivityDto activity : this.findAll(session)) {
session.enqueue(new DtoIndexAction<ActivityDto>(this.getIndexType(), IndexAction.Method.UPSERT, activity));
}
session.commit();
*/
package org.sonar.server.component.persistence;
-import com.google.common.annotations.VisibleForTesting;
import org.apache.ibatis.session.SqlSession;
import org.sonar.api.ServerComponent;
import org.sonar.api.utils.System2;
*/
public class ComponentDao extends BaseDao<ComponentMapper, ComponentDto, String> implements ServerComponent, DaoComponent {
- public ComponentDao() {
- this(System2.INSTANCE);
- }
-
- @VisibleForTesting
public ComponentDao(System2 system) {
super(ComponentMapper.class, system);
}
private final System2 system2;
private final Database db;
- public IssueChangelogMigration(Database database, PropertiesDao propertiesDao) {
- this(database, new WorkDurationConvertor(propertiesDao), System2.INSTANCE);
+ public IssueChangelogMigration(Database database, System2 system2, PropertiesDao propertiesDao) {
+ this(database, system2, new WorkDurationConvertor(propertiesDao));
}
@VisibleForTesting
- IssueChangelogMigration(Database database, WorkDurationConvertor convertor, System2 system2) {
+ IssueChangelogMigration(Database database, System2 system2, WorkDurationConvertor convertor) {
this.db = database;
this.workDurationConvertor = convertor;
this.system2 = system2;
private final System2 system2;
private final Database db;
- public NotResolvedIssuesOnRemovedComponentsMigration(Database database) {
- this(database, System2.INSTANCE);
- }
-
- @VisibleForTesting
- NotResolvedIssuesOnRemovedComponentsMigration(Database database, System2 system2) {
+ public NotResolvedIssuesOnRemovedComponentsMigration(Database database, System2 system2) {
this.db = database;
this.system2 = system2;
}
@Test
public void facade() throws Exception {
MyBatis myBatis = db.myBatis();
- RuleDao ruleDao = new RuleDao();
+ RuleDao ruleDao = new RuleDao(System2.INSTANCE);
QualityProfileDao qualityProfileDao = new QualityProfileDao(myBatis, System2.INSTANCE);
- ActiveRuleDao activeRuleDao = new ActiveRuleDao(qualityProfileDao, ruleDao);
+ ActiveRuleDao activeRuleDao = new ActiveRuleDao(qualityProfileDao, ruleDao, System2.INSTANCE);
DbClient client = new DbClient(db.database(), myBatis, ruleDao, activeRuleDao, qualityProfileDao);
WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao);
convertor.init();
- migration = new IssueChangelogMigration(db.database(), convertor, system2);
+ migration = new IssueChangelogMigration(db.database(), system2, convertor);
}
@Test
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.sonar.api.utils.System2;
import org.sonar.core.measure.db.MeasureDto;
import org.sonar.core.measure.db.MeasureKey;
import org.sonar.core.persistence.AbstractDaoTestCase;
@Before
public void createDao() {
session = getMyBatis().openSession(false);
- dao = new MeasureDao();
+ dao = new MeasureDao(System2.INSTANCE);
}
@After
package org.sonar.server.rule;
import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang.time.DateUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
// Verify rule has not been updated
Rule customRuleReloaded = index.getByKey(RuleTesting.XOO_X1);
- assertThat(customRuleReloaded.updatedAt()).isEqualTo(updatedAt);
+ assertThat(DateUtils.isSameInstant(customRuleReloaded.updatedAt(), updatedAt));
}
@Test
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.sonar.api.rule.RuleKey;
+import org.sonar.api.utils.System2;
import org.sonar.core.permission.GlobalPermissions;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.rule.RuleDto;
when(dbClient.openSession(false)).thenReturn(session);
when(dbClient.ruleDao()).thenReturn(ruleDao);
when(dbClient.debtCharacteristicDao()).thenReturn(characteristicDao);
- operations = new RuleOperations(dbClient);
+ operations = new RuleOperations(dbClient, System2.INSTANCE);
}
@Test