import org.junit.jupiter.api.extension.RegisterExtension;
import org.sonar.api.measures.Metric;
import org.sonar.api.utils.System2;
-import org.sonar.core.util.Uuids;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
import org.sonar.db.component.BranchDto;
@Test
void insert() {
QualityGateDto newQgate = new QualityGateDto()
- .setUuid(Uuids.createFast())
.setName("My Quality Gate")
.setBuiltIn(false)
.setUpdatedAt(new Date());
@Test
void insert_built_in() {
- underTest.insert(db.getSession(), new QualityGateDto().setName("test").setBuiltIn(true).setUuid(Uuids.createFast()));
+ underTest.insert(db.getSession(), new QualityGateDto().setName("test").setBuiltIn(true));
QualityGateDto reloaded = underTest.selectByName(db.getSession(), "test");
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
private final DbClient dbClient = db.getDbClient();
private final DbSession dbSession = db.getSession();
- private final QualityGateUpdater underTest = new QualityGateUpdater(dbClient, UuidFactoryFast.getInstance());
+ private final QualityGateUpdater underTest = new QualityGateUpdater(dbClient);
@Test
public void create_quality_gate() {
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sonar.api.server.ws.WebService;
-import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
private final DbClient dbClient = db.getDbClient();
private final DbSession dbSession = db.getSession();
- private final QualityGateUpdater qualityGateUpdater = new QualityGateUpdater(dbClient, UuidFactoryFast.getInstance());
+ private final QualityGateUpdater qualityGateUpdater = new QualityGateUpdater(dbClient);
private final QualityGatesWsSupport wsSupport = new QualityGatesWsSupport(dbClient, userSession, TestComponentFinder.from(db));
private final CopyAction underTest = new CopyAction(dbClient, userSession, qualityGateUpdater, wsSupport);
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Metric;
import org.sonar.api.server.ws.WebService;
-import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
private final DbClient dbClient = db.getDbClient();
private final DbSession dbSession = db.getSession();
- private final CreateAction underTest = new CreateAction(dbClient, userSession, new QualityGateUpdater(dbClient,
- UuidFactoryFast.getInstance()),
+ private final CreateAction underTest = new CreateAction(dbClient, userSession, new QualityGateUpdater(dbClient),
new QualityGateConditionsUpdater(dbClient));
private final WsActionTester ws = new WsActionTester(underTest);
*/
package org.sonar.server.qualitygate;
-import org.sonar.core.util.UuidFactory;
import org.sonar.core.util.Uuids;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
public class QualityGateUpdater {
private final DbClient dbClient;
- private final UuidFactory uuidFactory;
- public QualityGateUpdater(DbClient dbClient, UuidFactory uuidFactory) {
+ public QualityGateUpdater(DbClient dbClient) {
this.dbClient = dbClient;
- this.uuidFactory = uuidFactory;
}
public QualityGateDto create(DbSession dbSession, String name) {
validateQualityGate(dbSession, name);
QualityGateDto newQualityGate = new QualityGateDto()
.setName(name)
- .setBuiltIn(false)
- .setUuid(uuidFactory.create());
+ .setBuiltIn(false);
dbClient.qualityGateDao().insert(dbSession, newQualityGate);
return newQualityGate;
}