/** * <p>Returns the next pseudorandom, uniformly distributed long value * from the Math.random() sequence.</p> * <b>N.B. All values are >= 0.<b> * @return the random long */ public static long nextLong() { return nextLong(JVM_RANDOM); }
private void insertOrganization(String uuid, @Nullable Integer defaultGroupId, @Nullable String projectPermTemplateUuid, @Nullable String viewPermTemplateUuid) { db.executeInsert("ORGANIZATIONS", "UUID", uuid, "KEE", uuid, "NAME", uuid, "GUARDED", false, "default_group_id", defaultGroupId == null ? null : valueOf(defaultGroupId), "default_perm_template_project", projectPermTemplateUuid, "default_perm_template_view", viewPermTemplateUuid, "CREATED_AT", nextLong(), "UPDATED_AT", nextLong()); }
private void setupDefaultOrganization() { db.executeInsert("ORGANIZATIONS", "UUID", DEFAULT_ORGANIZATION_UUID, "KEE", DEFAULT_ORGANIZATION_UUID, "NAME", DEFAULT_ORGANIZATION_UUID, "GUARDED", false, "CREATED_AT", nextLong(), "UPDATED_AT", nextLong()); db.executeInsert("INTERNAL_PROPERTIES", "KEE", "organization.default", "IS_EMPTY", "false", "TEXT_VALUE", DEFAULT_ORGANIZATION_UUID); }
public static IssueChangeDto newIssuechangeDto(IssueDto issue) { return new IssueChangeDto() .setKey(UuidFactoryFast.getInstance().create()) .setIssueKey(issue.getKey()) .setChangeData("data_" + randomAlphanumeric(40)) .setChangeType(IssueChangeDto.TYPE_FIELD_CHANGE) .setUserUuid("userUuid_" + randomAlphanumeric(40)) .setIssueChangeCreationDate(nextLong()) .setCreatedAt(nextLong()) .setUpdatedAt(nextLong()); }
public ActiveRuleDto activateRule(QProfileDto profile, RuleDefinitionDto rule, Consumer<ActiveRuleDto> consumer) { ActiveRuleDto activeRule = createFor(profile, rule) .setSeverity(Severity.ALL.get(nextInt(Severity.ALL.size()))) .setCreatedAt(nextLong()) .setUpdatedAt(nextLong()); consumer.accept(activeRule); dbClient.activeRuleDao().insert(dbSession, activeRule); dbSession.commit(); return activeRule; }
public static CeQueueDto newCeQueueDto(String uuid) { return new CeQueueDto() .setUuid(uuid) .setComponentUuid(randomAlphanumeric(40)) .setMainComponentUuid(randomAlphanumeric(39)) .setStatus(CeQueueDto.Status.PENDING) .setTaskType(CeTaskTypes.REPORT) .setSubmitterUuid(randomAlphanumeric(255)) .setCreatedAt(nextLong()) .setUpdatedAt(nextLong()); }
private CeActivityDto insertActivity(String projectUuid, SnapshotDto analysis, CeActivityDto.Status status) { CeQueueDto queueDto = new CeQueueDto(); queueDto.setTaskType(CeTaskTypes.REPORT); queueDto.setComponentUuid(projectUuid); queueDto.setUuid(randomAlphanumeric(40)); queueDto.setCreatedAt(nextLong()); CeActivityDto activityDto = new CeActivityDto(queueDto); activityDto.setStatus(status); activityDto.setExecutionTimeMs(nextLong()); activityDto.setExecutedAt(nextLong()); activityDto.setAnalysisUuid(analysis.getUuid()); db.getDbClient().ceActivityDao().insert(db.getSession(), activityDto); db.commit(); return activityDto; } }
private void activateRuleInDb(RulesProfileDto profile, RuleDefinitionDto rule, RulePriority severity) { ActiveRuleDto dto = new ActiveRuleDto() .setProfileId(profile.getId()) .setSeverity(severity.name()) .setRuleId(rule.getId()) .setCreatedAt(nextLong()) .setUpdatedAt(nextLong()); db.getDbClient().activeRuleDao().insert(db.getSession(), dto); db.commit(); }
public static UserTokenDto newUserToken() { return new UserTokenDto() .setUserUuid("userUuid_" + randomAlphanumeric(40)) .setName("name_" + randomAlphanumeric(20)) .setTokenHash("hash_" + randomAlphanumeric(30)) .setCreatedAt(nextLong()); } }
/** * Create an instance of {@link QProfileChangeDto} with random field values, * except changeType which is always {@code "ACTIVATED"}. */ public static QProfileChangeDto newQProfileChangeDto() { return new QProfileChangeDto() .setUuid(randomAlphanumeric(40)) .setRulesProfileUuid(randomAlphanumeric(40)) .setCreatedAt(nextLong()) .setChangeType("ACTIVATED") .setUserUuid("userUuid_" + randomAlphanumeric(10)); }
/** * Create an instance of {@link QProfileDto} with random field values. */ public static QProfileDto newQualityProfileDto() { String uuid = Uuids.createFast(); return new QProfileDto() .setKee(uuid) .setRulesProfileUuid(Uuids.createFast()) .setOrganizationUuid(randomAlphanumeric(40)) .setName(uuid) .setLanguage(randomAlphanumeric(20)) .setLastUsed(nextLong()); }
public static UserDto newUserDto() { return new UserDto() .setId(nextInt()) .setUuid(randomAlphanumeric(40)) .setActive(true) .setLocal(nextBoolean()) .setLogin(randomAlphanumeric(30)) .setName(randomAlphanumeric(30)) .setEmail(randomAlphanumeric(30)) .setOnboarded(nextBoolean()) .setScmAccounts(singletonList(randomAlphanumeric(40))) .setExternalId(randomAlphanumeric(40)) .setExternalLogin(randomAlphanumeric(40)) .setExternalIdentityProvider(randomAlphanumeric(40)) .setSalt(randomAlphanumeric(40)) .setCryptedPassword(randomAlphanumeric(40)) .setCreatedAt(nextLong()) .setUpdatedAt(nextLong()); }
private static DbFileSources.Data.Builder newRandomData(int numberOfLines) { DbFileSources.Data.Builder dataBuilder = DbFileSources.Data.newBuilder(); for (int i = 1; i <= numberOfLines; i++) { dataBuilder.addLinesBuilder() .setLine(i) .setScmRevision(randomAlphanumeric(15)) .setScmAuthor(randomAlphanumeric(10)) .setScmDate(RandomUtils.nextLong()) .setSource(randomAlphanumeric(20)) .setLineHits(RandomUtils.nextInt(4)) .setConditions(RandomUtils.nextInt(4)) .setCoveredConditions(RandomUtils.nextInt(4)) .setHighlighting(randomAlphanumeric(40)) .setSymbols(randomAlphanumeric(30)) .addAllDuplication(Arrays.asList(RandomUtils.nextInt(200), RandomUtils.nextInt(200))) .build(); } return dataBuilder; } }
public static WebhookDeliveryDto newDto() { return new WebhookDeliveryDto() .setUuid(Uuids.createFast()) .setWebhookUuid(randomAlphanumeric(40)) .setComponentUuid(randomAlphanumeric(40)) .setCeTaskUuid(randomAlphanumeric(40)) .setAnalysisUuid(randomAlphanumeric(40)) .setName(randomAlphanumeric(10)) .setUrl(randomAlphanumeric(10)) .setDurationMs(nextInt()) .setHttpStatus(nextInt()) .setSuccess(nextBoolean()) .setPayload(randomAlphanumeric(10)) .setCreatedAt(nextLong()); }
/** * <p>Returns the next pseudorandom, uniformly distributed long value * from the Math.random() sequence.</p> * <b>N.B. All values are >= 0.<b> * @return the random long */ public static long nextLong() { return nextLong(JVM_RANDOM); }
/** * <p>Returns the next pseudorandom, uniformly distributed long value * from the Math.random() sequence.</p> * <b>N.B. All values are >= 0.<b> * @return the random long */ public static long nextLong() { return nextLong(JVM_RANDOM); }
@Programmatic public long any() { return RandomUtils.nextLong(fake.random); } }