@Override public void execute(ComputationStep.Context context) { analysisMetadataHolder.setUuid(uuidFactory.create()); }
@Override public CeWorker create(int ordinal) { String uuid = uuidFactory.create(); CeWorkerImpl ceWorker = new CeWorkerImpl(ordinal, uuid, queue, taskProcessorRepository, ceWorkerController, executionListeners); ceWorkers = Stream.concat(ceWorkers.stream(), Stream.of(ceWorker)).collect(MoreCollectors.toSet(ceWorkers.size() + 1)); return ceWorker; }
@Override public String create() { String uuid = uuidFactory.create(); generatedUuids.add(uuid); return uuid; }
@Override public String create() { String uuid = uuidFactory.create(); generatedUuids.add(uuid); return uuid; }
private boolean handle(Select.Row row, SqlStatement update) throws SQLException { long id = row.getLong(1); update.setString(1, uuidFactory.create()); update.setLong(2, id); return true; }
public Collection<EsQueueDto> insert(DbSession dbSession, Collection<EsQueueDto> items) { long now = system2.now(); EsQueueMapper mapper = mapper(dbSession); items.forEach(item -> { item.setUuid(uuidFactory.create()); mapper.insert(item, now); }); return items; }
public void insertOrUpdate(DbSession dbSession, ALM alm, String repoId, String projectUuid, @Nullable String githubSlug, String url) { checkAlm(alm); checkRepoId(repoId); checkArgument(isNotEmpty(projectUuid), "projectUuid can't be null nor empty"); checkArgument(isNotEmpty(url), "url can't be null nor empty"); ProjectAlmBindingMapper mapper = getMapper(dbSession); long now = system2.now(); if (mapper.update(alm.getId(), repoId, projectUuid, githubSlug, url, now) == 0) { mapper.insert(uuidFactory.create(), alm.getId(), repoId, projectUuid, githubSlug, url, now); } }
private void insertMeasures(String componentUuid, int number) { IntStream.range(0, number).forEach(index -> db.executeInsert( "PROJECT_MEASURES", "COMPONENT_UUID", componentUuid, "ANALYSIS_UUID", uuidFactory.create(), "METRIC_ID", "111")); }
private boolean handle(Select.Row row, SqlStatement update) throws SQLException { long id = row.getLong(1); update.setString(1, uuidFactory.create()); update.setLong(2, id); return true; }
public void put(DbSession dbSession, String keyType, String key, String projectUuid) { checkKeyType(keyType); checkKey(key); checkArgument(isNotEmpty(projectUuid), "projectUuid can't be null nor empty"); ProjectMappingsMapper mapper = getMapper(dbSession); mapper.deleteByKey(keyType, key); long now = system2.now(); mapper.put(uuidFactory.create(), keyType, key, projectUuid, now); }
public QualityGateDto create(DbSession dbSession, OrganizationDto organizationDto, String name) { validateQualityGate(dbSession, organizationDto, name); QualityGateDto newQualityGate = new QualityGateDto() .setName(name) .setBuiltIn(false) .setUuid(uuidFactory.create()); dbClient.qualityGateDao().insert(dbSession, newQualityGate); dbClient.qualityGateDao().associate(dbSession, uuidFactory.create(), organizationDto, newQualityGate); return newQualityGate; }
private void setupSecondMultiModuleProject() { String project3Uuid = uuidFactory.create(); String singleModuleUuid = uuidFactory.create(); insertComponent(8, project3Uuid, null, project3Uuid, Qualifiers.PROJECT, "Another multi-module project"); insertComponent(9, singleModuleUuid, project3Uuid, project3Uuid, Qualifiers.MODULE, "Module X"); insertProperty(11, 8, "sonar.coverage.exclusions", "InRoot.java", null); insertProperty(12, 9, "sonar.coverage.exclusions", "InModule.java", null); }
public void insert(DbSession dbSession, QProfileChangeDto dto) { checkState(dto.getCreatedAt() == 0L, "Date of QProfileChangeDto must be set by DAO only. Got %s.", dto.getCreatedAt()); dto.setUuid(uuidFactory.create()); dto.setCreatedAt(system2.now()); mapper(dbSession).insert(dto); }
@Test public void should_throw_ISE_if_no_default_organization() throws SQLException { insertOrganization(uuidFactory.create()); insertOrganization(uuidFactory.create()); insertQualityGate(uuidFactory.create(), "QualityGate1", false); insertQualityGate(uuidFactory.create(), "QualityGate2", true); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Default organization uuid is missing"); underTest.execute(); }
@Test public void test_format_of_uuid() { String uuid = underTest.create(); assertThat(uuid.length()).isGreaterThan(10).isLessThan(40); // URL-safe: only letters, digits, dash and underscore. assertThat(uuid).matches("^[\\w\\-_]+$"); } }
@Test public void test_format_of_uuid() { String uuid = underTest.create(); assertThat(uuid.length()).isGreaterThan(10).isLessThan(40); // URL-safe: only letters, digits, dash and underscore. assertThat(uuid).matches("^[\\w\\-_]+$"); } }
private QualityGateDto createQualityGate(DbSession dbSession, String name) { QualityGateDto qualityGate = new QualityGateDto() .setName(name) .setBuiltIn(true) .setUuid(uuidFactory.create()) .setCreatedAt(new Date(system2.now())); return dbClient.qualityGateDao().insert(dbSession, qualityGate); }
@Test public void create_from_scratch_creates_ServerId_from_JDBC_URL_and_new_uuid() { String jdbcUrl = "jdbc"; String uuid = Uuids.create(); String sanitizedJdbcUrl = "sanitized_jdbc"; settings.setProperty(JDBC_URL.getKey(), jdbcUrl); when(uuidFactory.create()).thenReturn(uuid); when(jdbcUrlSanitizer.sanitize(jdbcUrl)).thenReturn(sanitizedJdbcUrl); ServerId serverId = underTest.create(); assertThat(serverId.getDatabaseId().get()).isEqualTo(crc32Hex(sanitizedJdbcUrl)); assertThat(serverId.getDatasetId()).isEqualTo(uuid); }