Skip to content

Commit

Permalink
* inject objectMapper via Dependency Injection
Browse files Browse the repository at this point in the history
* added format to expires JSON Conversion
  • Loading branch information
Morphyum committed Mar 15, 2022
1 parent cdfaec0 commit 2a0999f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ void init() throws KeyStoreException, CertificateEncodingException, IOException
public String uploadRevocationBatch(RevocationBatchDto revocationBatchDto)
throws DgcRevocationBatchUploadException, JsonProcessingException {

mapper.registerModule(new JavaTimeModule());
String jsonString = mapper.writeValueAsString(revocationBatchDto);
objectMapper.registerModule(new JavaTimeModule());
String jsonString = objectMapper.writeValueAsString(revocationBatchDto);
String payload = new SignedStringMessageBuilder().withPayload(jsonString)
.withSigningCertificate(uploadCertificateHolder, uploadCertificatePrivateKey).buildAsString();

Expand Down Expand Up @@ -149,7 +149,7 @@ public void deleteRevocationBatch(String batchId) throws DgcRevocationBatchUploa

RevocationBatchDeleteRequestDto deleteRequest = new RevocationBatchDeleteRequestDto();
deleteRequest.setBatchId(batchId);
String jsonString = mapper.writeValueAsString(deleteRequest);
String jsonString = objectMapper.writeValueAsString(deleteRequest);

String payload = new SignedStringMessageBuilder().withPayload(jsonString)
.withSigningCertificate(uploadCertificateHolder, uploadCertificatePrivateKey).buildAsString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package eu.europa.ec.dgc.gateway.connector.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.ZonedDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
Expand All @@ -34,6 +35,7 @@ public class RevocationBatchDto {

private String country;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
private ZonedDateTime expires;

private String kid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ void testUploadOfRevocationList() throws Exception {
verify(restClientMock).uploadBatch(any());

SignedStringMessageParser parser = new SignedStringMessageParser(argumentCaptor.getValue());

Assertions.assertEquals(getRevocationJSON(), parser.getPayload());
Assertions.assertEquals(certificateUtils.convertCertificate(testKeyStore.getUpload()),
parser.getSigningCertificate());
Expand Down

0 comments on commit 2a0999f

Please sign in to comment.