@Test public void setMainComponentUuid_accepts_null_empty_and_string_40_chars_or_less() { underTest.setMainComponentUuid(null); underTest.setMainComponentUuid(""); underTest.setMainComponentUuid("bar"); underTest.setMainComponentUuid(STR_40_CHARS); }
@Test public void setMainComponentUuid_throws_IAE_if_value_is_41_chars() { String str_41_chars = STR_40_CHARS + "a"; expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Value is too long for column CE_QUEUE.MAIN_COMPONENT_UUID: " + str_41_chars); underTest.setMainComponentUuid(str_41_chars); }
private CeQueueDto addToQueueInDb(DbSession dbSession, CeTaskSubmit submission) { for (Map.Entry<String, String> characteristic : submission.getCharacteristics().entrySet()) { CeTaskCharacteristicDto characteristicDto = new CeTaskCharacteristicDto(); characteristicDto.setUuid(uuidFactory.create()); characteristicDto.setTaskUuid(submission.getUuid()); characteristicDto.setKey(characteristic.getKey()); characteristicDto.setValue(characteristic.getValue()); dbClient.ceTaskCharacteristicsDao().insert(dbSession, characteristicDto); } CeQueueDto dto = new CeQueueDto(); dto.setUuid(submission.getUuid()); dto.setTaskType(submission.getType()); submission.getComponent().ifPresent(component -> dto .setComponentUuid(component.getUuid()) .setMainComponentUuid(component.getMainComponentUuid())); dto.setStatus(PENDING); dto.setSubmitterUuid(submission.getSubmitterUuid()); dbClient.ceQueueDao().insert(dbSession, dto); return dto; }
private CeQueueDto insertPending(String uuid, String mainComponentUuid) { CeQueueDto dto = new CeQueueDto(); dto.setUuid(uuid); dto.setTaskType(CeTaskTypes.REPORT); dto.setMainComponentUuid(mainComponentUuid); dto.setComponentUuid("uuid_" + pendingComponentUuidGenerator++); dto.setStatus(PENDING); dto.setSubmitterUuid("henri"); underTest.insert(db.getSession(), dto); db.getSession().commit(); return dto; }
private CeQueueDto insertPendingInQueue(@Nullable Component component) { CeQueueDto dto = new CeQueueDto() .setUuid(UuidFactoryFast.getInstance().create()) .setTaskType("some type") .setStatus(CeQueueDto.Status.PENDING); if (component != null) { dto.setComponentUuid(component.getUuid()) .setMainComponentUuid(component.getMainComponentUuid()); } db.getDbClient().ceQueueDao().insert(db.getSession(), dto); db.commit(); return dto; }
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()); }