JobBuildService { @Transactional public void reportProgress(Long id, String partialLog) { JobBuild jobBuild = jobBuildDao.findOne(id); log.info("Reporting progress on {}", id); if (jobBuild != null) { LogChunk logChunk = new LogChunk(); logChunk.setJobBuild(jobBuild); logChunk.getBuildLog().setOutput(partialLog); logChunkDao.save(logChunk); updateBuildStatus(jobBuild.getBuild()); } }  @Transactional void prepareJobs(Build build, Dickfile dickfile); @Transactional void buildStage(Build build, Dickfile dickfile, Stage stage); @Transactional Optional<BuildOrder> peekBuildFor(String workerName); boolean isStopped(Long id); @Transactional void reportProgress(Long id, String partialLog); @Transactional void reportFailure(Long id, String fullLog); @Transactional void reportSuccess(Long id, String fullLog); Build.Status updateBuildStatus(Build build); @Transactional void stop(Build build); @Transactional List<LogChunkModel> getLogChunks(Long id, Date creationDate); @Transactional OutputModel getOutput(Long id); @Transactional void deleteJobBuilds(Build build);  }
@Test public void shouldAppendLog() { Worker worker = produceWorker(Worker.Status.BUSY); Build build = produceBuild(); JobBuild jobBuild = produceJobBuild(worker, build, JobBuild.Status.IN_PROGRESS); jobBuildService.reportProgress(jobBuild.getId(), "foo"); jobBuildService.reportProgress(jobBuild.getId(), "bar"); List<LogChunk> logChunks = logChunkDao.findByJobBuild(jobBuild); assertThat(logChunks).extracting("buildLog").extracting("output").containsExactly("foo", "bar"); }