@Test public void should_store_certificate() throws InvalidParseOperationException { GUID id = GUIDFactory.newGUID(); IdentityModel identityModel = new IdentityModel(); identityModel.setContextId("1"); identityModel.setIssuerDN("issuerDN"); identityModel.setSubjectDN("distinguishedName"); identityModel.setSerialNumber(String.valueOf(BigInteger.TEN)); identityModel.setId(id.toString()); identityRepository.createIdentity(identityModel); Document document = certificateCollection.find(eq("_id", id.toString())).first(); assertThat(document) .isNotNull() .containsEntry("IssuerDN", "issuerDN") .containsEntry("SubjectDN", "distinguishedName") .containsEntry("SerialNumber", "10"); }
public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(identityModel); identityCollection.insertOne(Document.parse(json)); }
IdentityRepository implements CertificateCRLCheckStateUpdater<IdentityModel> { public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(identityModel); identityCollection.insertOne(Document.parse(json)); } }
IdentityRepository implements CertificateCRLCheckStateUpdater<IdentityModel> { public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(identityModel); identityCollection.insertOne(Document.parse(json)); } @VisibleForTesting  IdentityRepository(MongoDbAccess mongoDbAccess, String collectionName);  IdentityRepository(MongoDbAccess mongoDbAccess); }
IdentityRepository implements CertificateCRLCheckStateUpdater<IdentityModel> { public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(identityModel); identityCollection.insertOne(Document.parse(json)); } @VisibleForTesting  IdentityRepository(MongoDbAccess mongoDbAccess, String collectionName);  IdentityRepository(MongoDbAccess mongoDbAccess); void createIdentity(IdentityModel identityModel); Optional<IdentityModel> findIdentity(String subjectDN, String serialNumber); void linkContextToIdentity(String subjectDN, String contextId, String serialNumber); boolean contextIsUsed(String contextId); @Override FindIterable<Document> findCertificate(String issuerDN, CertificateStatus certificateStatus); @Override void updateCertificateState(List<String> certificatesToUpdate, CertificateStatus certificateStatus); @Override Class<IdentityModel> getEntityModelType(); }
IdentityRepository implements CertificateCRLCheckStateUpdater<IdentityModel> { public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException { String json = JsonHandler.writeAsString(identityModel); identityCollection.insertOne(Document.parse(json)); } @VisibleForTesting  IdentityRepository(MongoDbAccess mongoDbAccess, String collectionName);  IdentityRepository(MongoDbAccess mongoDbAccess); void createIdentity(IdentityModel identityModel); Optional<IdentityModel> findIdentity(String subjectDN, String serialNumber); void linkContextToIdentity(String subjectDN, String contextId, String serialNumber); boolean contextIsUsed(String contextId); @Override FindIterable<Document> findCertificate(String issuerDN, CertificateStatus certificateStatus); @Override void updateCertificateState(List<String> certificatesToUpdate, CertificateStatus certificateStatus); @Override Class<IdentityModel> getEntityModelType(); static final String CERTIFICATE_COLLECTION; }