import org.sonar.api.resources.Qualifiers;
import org.sonar.api.resources.Scopes;
+import org.sonar.api.utils.internal.Uuids;
import org.sonar.core.component.ComponentDto;
-import java.util.UUID;
-
public class ComponentTesting {
public static ComponentDto newFileDto(ComponentDto subProjectOrProject) {
return new ComponentDto()
- .setUuid(UUID.randomUUID().toString())
+ .setUuid(Uuids.create())
.setProjectUuid(subProjectOrProject.projectUuid())
.setModuleUuid(subProjectOrProject.uuid())
.setModuleUuidPath(subProjectOrProject.moduleUuidPath() == null ? subProjectOrProject.uuid() : subProjectOrProject.moduleUuidPath() + "." + subProjectOrProject.uuid())
public static ComponentDto newModuleDto(ComponentDto subProjectOrProject) {
return new ComponentDto()
- .setUuid(UUID.randomUUID().toString())
+ .setUuid(Uuids.create())
.setProjectUuid(subProjectOrProject.projectUuid())
.setModuleUuid(subProjectOrProject.uuid())
.setModuleUuidPath(subProjectOrProject.moduleUuidPath() == null ? subProjectOrProject.uuid() : subProjectOrProject.moduleUuidPath() + "." + subProjectOrProject.uuid())
}
public static ComponentDto newProjectDto() {
- String uuid = UUID.randomUUID().toString();
+ String uuid = Uuids.create();
return new ComponentDto()
.setUuid(uuid)
.setProjectUuid(uuid)
import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.api.utils.System2;
+import org.sonar.api.utils.internal.Uuids;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
import org.sonar.core.persistence.TestDatabase;
import org.sonar.server.db.fake.FakeMapper;
import java.util.Date;
-import java.util.UUID;
import static org.fest.assertions.Assertions.assertThat;
public void can_insert_and_select_by_key() throws Exception {
long t0 = System.currentTimeMillis() - 1000;
- String key = UUID.randomUUID().toString();
+ String key = Uuids.create();
FakeDto myDto = new FakeDto()
.setKey(key);
dao.insert(session, myDto);
@Test
public void does_enqueue_on_insert() {
FakeDto myDto = new FakeDto()
- .setKey(UUID.randomUUID().toString());
+ .setKey(Uuids.create());
dao.insert(session, myDto);
session.commit();
assertThat(session.getActionCount()).isEqualTo(1);
public void synchronize_to_es_after_date() throws Exception {
long t0 = System.currentTimeMillis() - 1000;
- String key = UUID.randomUUID().toString();
+ String key = Uuids.create();
FakeDto myDto = new FakeDto()
.setKey(key);
dao.insert(session, myDto);
import org.sonar.api.rule.Severity;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.KeyValueFormat;
+import org.sonar.api.utils.internal.Uuids;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.issue.db.IssueDto;
import org.sonar.core.rule.RuleDto;
import org.sonar.server.issue.index.IssueDoc;
-import java.util.UUID;
-
import static org.fest.assertions.Assertions.assertThat;
public class IssueTesting {
*/
public static IssueDto newDto(RuleDto rule, ComponentDto file, ComponentDto project) {
return new IssueDto()
- .setKee(UUID.randomUUID().toString())
+ .setKee(Uuids.create())
.setRule(rule)
.setComponent(file)
.setProject(project)