@Test public void should_store_certificate() throws InvalidParseOperationException { GUID id = GUIDFactory.newGUID(); PersonalCertificateModel personalCertificateModel = new PersonalCertificateModel(); personalCertificateModel.setIssuerDN("issuerDN"); personalCertificateModel.setSubjectDN("distinguishedName"); personalCertificateModel.setSerialNumber(String.valueOf(BigInteger.TEN)); personalCertificateModel.setId(id.toString()); personalCertificateModel.setCertificateHash( CERTIFICATE_HASH); personalRepository.createPersonalCertificate(personalCertificateModel); Document document = certificateCollection.find(eq("_id", id.toString())).first(); assertThat(document) .isNotNull() .containsEntry("IssuerDN", "issuerDN") .containsEntry("SubjectDN", "distinguishedName") .containsEntry("SerialNumber", String.valueOf(10)) .containsEntry("Hash", CERTIFICATE_HASH); }
public void createPersonalCertificate(PersonalCertificateModel personalCertificateModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(personalCertificateModel); personnalCollection.insertOne(Document.parse(json)); }
PersonalRepository implements CertificateCRLCheckStateUpdater<PersonalCertificateModel> { public void createPersonalCertificate(PersonalCertificateModel personalCertificateModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(personalCertificateModel); personnalCollection.insertOne(Document.parse(json)); } }
PersonalRepository implements CertificateCRLCheckStateUpdater<PersonalCertificateModel> { public void createPersonalCertificate(PersonalCertificateModel personalCertificateModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(personalCertificateModel); personnalCollection.insertOne(Document.parse(json)); } @VisibleForTesting  PersonalRepository(MongoDbAccess mongoDbAccess, String collectionName);  PersonalRepository(MongoDbAccess mongoDbAccess); }
PersonalRepository implements CertificateCRLCheckStateUpdater<PersonalCertificateModel> { public void createPersonalCertificate(PersonalCertificateModel personalCertificateModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(personalCertificateModel); personnalCollection.insertOne(Document.parse(json)); } @VisibleForTesting  PersonalRepository(MongoDbAccess mongoDbAccess, String collectionName);  PersonalRepository(MongoDbAccess mongoDbAccess); void createPersonalCertificate(PersonalCertificateModel personalCertificateModel); Optional<PersonalCertificateModel> findPersonalCertificateByHash(String hash); void deletePersonalCertificate(String hash); @Override FindIterable<Document> findCertificate(String issuerDN, CertificateStatus certificateStatus); @Override void updateCertificateState(List<String> certificatesToUpdate, CertificateStatus certificateStatus); @Override Class<PersonalCertificateModel> getEntityModelType(); }
PersonalRepository implements CertificateCRLCheckStateUpdater<PersonalCertificateModel> { public void createPersonalCertificate(PersonalCertificateModel personalCertificateModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(personalCertificateModel); personnalCollection.insertOne(Document.parse(json)); } @VisibleForTesting  PersonalRepository(MongoDbAccess mongoDbAccess, String collectionName);  PersonalRepository(MongoDbAccess mongoDbAccess); void createPersonalCertificate(PersonalCertificateModel personalCertificateModel); Optional<PersonalCertificateModel> findPersonalCertificateByHash(String hash); void deletePersonalCertificate(String hash); @Override FindIterable<Document> findCertificate(String issuerDN, CertificateStatus certificateStatus); @Override void updateCertificateState(List<String> certificatesToUpdate, CertificateStatus certificateStatus); @Override Class<PersonalCertificateModel> getEntityModelType(); static final String PERSONAL_COLLECTION; }