chore: Fix JDBC driver issues caused by blob incompatibility

chore: Remove lob annotation from certificate entity
chore: Rename commonName colum to reflect it being in the subject information
chore: Add more verbose logging
chore: Update test to yield actually usefull assertion errors
fix: Delete all items in the repository before running test
- This fixes an issue where non-deterministic test order would cause the #singleElement assertion to fail sometimes
This commit is contained in:
Magnus Leßmann (@MarkL4YG) 2024-11-22 21:43:13 +01:00
parent de738b7311
commit 8d83cba2cd
4 changed files with 25 additions and 12 deletions

View file

@ -24,9 +24,6 @@ public class Certificate {
@Enumerated(EnumType.STRING)
private CertificateType type;
@NotNull
private String commonName;
private String trustingAuthority;
@Min(1)
@ -35,6 +32,9 @@ public class Certificate {
@Min(1)
private int requestedValidityDays;
@NotNull
private String subjectCommonName;
private String subjectEmailAddress;
private String subjectOrganization;
private String subjectOrganizationalUnit;
@ -45,15 +45,15 @@ public class Certificate {
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
private List<CertificateExtension> certificateExtension = new ArrayList<>();
@Lob
//@Lob - Cannot annotate column: https://github.com/xerial/sqlite-jdbc/issues/135
@Column(nullable = false)
private byte[] cert = new byte[0];
@Lob
//@Lob - Cannot annotate column: https://github.com/xerial/sqlite-jdbc/issues/135
@Column(nullable = false)
private byte[] privateKey = new byte[0];
@Lob
//@Lob - Cannot annotate column: https://github.com/xerial/sqlite-jdbc/issues/135
@Column
private byte[] fullchain;

View file

@ -46,7 +46,7 @@ public class CertificateCreationService {
private Certificate createEntityFromRequest(CertificateRequest certificateRequest) {
final Certificate certificate = new Certificate();
certificate.setType(mapCertificateRequestType(certificateRequest.getType()));
certificate.setCommonName(certificateRequest.getSubject().getCommonName());
certificate.setSubjectCommonName(certificateRequest.getSubject().getCommonName());
certificate.setTrustingAuthority(certificateRequest.getTrustingAuthority());
certificate.setRequestedKeyLength(certificateRequest.getRequestedKeyLength());
certificate.setRequestedValidityDays(certificateRequest.getRequestedValidityDays());