This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

Resolve ""Error: Exercise could not be found..." during resource loading"

@@ -116,17 +116,25 @@ public class AuditEventServiceIT {
}
);
log.info("Saved {} outdated AuditEvents", MAX_OUTDATEDVALUES);
assertThat(persistenceAuditEventRepository.findAll().size()).isGreaterThan(MAX_OUTDATEDVALUES);
log.info("Removing outdated AuditEvents");
auditEventService.removeOldAuditEvents();
// persistenceAuditEventRepository.flush();
log.info("Removed outdated AuditEvents");
assertThat(persistenceAuditEventRepository.findAll().size()).isEqualTo(currentAuditLogs + 2);
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-old")).isEmpty();
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-retention")).isNotEmpty();
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-new")).isNotEmpty();
isolatedTransactionTemplate.execute(
new TransactionCallback<Boolean>() {
@Override
public Boolean doInTransaction(TransactionStatus status) {
log.info("Saved {} outdated AuditEvents", MAX_OUTDATEDVALUES);
assertThat(persistenceAuditEventRepository.findAll().size()).isGreaterThan(MAX_OUTDATEDVALUES);
log.info("Removing outdated AuditEvents");
auditEventService.removeOldAuditEvents();
// persistenceAuditEventRepository.flush();
log.info("Removed outdated AuditEvents");
assertThat(persistenceAuditEventRepository.findAll().size()).isEqualTo(currentAuditLogs + 2);
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-old")).isEmpty();
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-retention")).isNotEmpty();
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-new")).isNotEmpty();
return true;
}
}
);
}
}