Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import java.util.UUID;
import java.util.stream.Collectors;

import static java.lang.String.format;

@Slf4j
@Component
public class BatchImportMissingMkAssets extends RobotUserTask {
Expand Down Expand Up @@ -185,7 +187,7 @@ private boolean copyBlobBetweenContainers(RecordingDTO recording) {
);
return true;
} catch (Exception e) {
String message = String.format(
String message = format(
"Failed to copy blob '%s' between containers: %s -> %s",
blobName,
azureVodafoneStorageService.getStorageAccountName() + "/" + vfSourceContainer,
Expand Down Expand Up @@ -222,10 +224,9 @@ private List<String> awaitBatchComplete(List<String> jobNames, IMediaService med
} while (!jobs.isEmpty() && sleptFor < maxSleepTime);
if (!jobs.isEmpty()) {
log.error(
"Timeout waiting for transform jobs to complete for batch, {} job(s) still processing", jobs.size());
jobs.forEach(job -> {
log.error("Unknown job processing state: {}", job);
});
format("Timeout waiting for transform jobs to complete for batch, %d job(s) still processing. "
+ "Job names: %s",
jobs.size(), String.join(", ", jobs)));
var unknownJobs = jobs;
return jobNames.stream().filter(name -> !unknownJobs.contains(name)).toList();
} else {
Expand Down Expand Up @@ -330,7 +331,7 @@ protected void writeCsvReport() {
writer.println("RecordingId,CaseReference,Filename,Duration,MigrationStatus,ErrorMessage");

for (ReportItem item : reportItems) {
String line = String.format(
String line = format(
"%s,%s,%s,%d,%s,%s",
item.recordingId,
item.caseReference,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ void runFailureBatchTimeout(CapturedOutput output) throws IOException {
assertThat(output.getOut())
.contains("Timeout waiting for transform jobs to complete for batch, 1 job(s) still processing");
assertThat(output.getOut()).contains("Waiting for 1/1 transform jobs to complete for batch");
assertThat(output.getOut()).contains("Unknown job processing state: " + jobName);
assertThat(output.getOut()).contains("Job names: " + jobName);
}

@Test
Expand All @@ -474,25 +474,25 @@ void findAllVodafoneRecordings_ShouldReturnVodafoneRecordingsWithNullDuration()
recording1.setId(UUID.randomUUID());
recording1.setDuration(null);
recording1.setDeletedAt(null);

CaptureSessionDTO captureSession1 = new CaptureSessionDTO();
captureSession1.setOrigin(RecordingOrigin.VODAFONE);
recording1.setCaptureSession(captureSession1);

RecordingDTO recording2 = new RecordingDTO();
recording2.setId(UUID.randomUUID());
recording2.setDuration(Duration.ofMinutes(5));
recording2.setDuration(Duration.ofMinutes(5));
recording2.setDeletedAt(null);

CaptureSessionDTO captureSession2 = new CaptureSessionDTO();
captureSession2.setOrigin(RecordingOrigin.VODAFONE);
recording2.setCaptureSession(captureSession2);

when(recordingService.findAllVodafoneRecordings())
.thenReturn(List.of(recording1));

List<RecordingDTO> result = recordingService.findAllVodafoneRecordings();

assertThat(result).hasSize(1);
assertThat(result.get(0).getId()).isEqualTo(recording1.getId());
verify(recordingService, times(1)).findAllVodafoneRecordings();
Expand Down
Loading