@Test public void testStoringNewCertificateWithoutKeyIdToDocument() throws Exception { XWikiDocument storeDoc = mock(XWikiDocument.class); when(xwiki.getDocument(new DocumentReference(WIKI, SPACE, DOCUMENT), xcontext)).thenReturn(storeDoc); BaseObject certObj = mock(BaseObject.class); when(storeDoc.newXObject(X509CertificateWikiStore.CERTIFICATECLASS, xcontext)).thenReturn(certObj); store.store(DOC_STORE_REF, getMockedCertificate(false)); verify(certObj, never()).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_KEYID, ENCODED_SUBJECTKEYID); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_ISSUER, ISSUER); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_SERIAL, SERIAL.toString()); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_SUBJECT, SUBJECT); verify(certObj).setLargeStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_CERTIFICATE, ENCODED_CERTIFICATE); verify(xwiki).saveDocument(storeDoc, xcontext); }
@Override public void store(StoreReference store, CertifiedPublicKey certificate) throws CertificateStoreException { XWikiContext context = getXWikiContext(); try { context.getWiki().saveDocument(storeCertificate(store, certificate, context), context); } catch (XWikiException e) { throw new CertificateStoreException("Error while saving certificate to store [" + store + "]", e); } }
X509CertificateWikiStore extends AbstractX509WikiStore implements CertificateStore { @Override public void store(StoreReference store, CertifiedPublicKey certificate) throws CertificateStoreException { XWikiContext context = getXWikiContext(); try { context.getWiki().saveDocument(storeCertificate(store, certificate, context), context); } catch (XWikiException e) { throw new CertificateStoreException("Error while saving certificate to store [" + store + "]", e); } } }
X509CertificateWikiStore extends AbstractX509WikiStore implements CertificateStore { @Override public void store(StoreReference store, CertifiedPublicKey certificate) throws CertificateStoreException { XWikiContext context = getXWikiContext(); try { context.getWiki().saveDocument(storeCertificate(store, certificate, context), context); } catch (XWikiException e) { throw new CertificateStoreException("Error while saving certificate to store [" + store + "]", e); } }  }
X509CertificateWikiStore extends AbstractX509WikiStore implements CertificateStore { @Override public void store(StoreReference store, CertifiedPublicKey certificate) throws CertificateStoreException { XWikiContext context = getXWikiContext(); try { context.getWiki().saveDocument(storeCertificate(store, certificate, context), context); } catch (XWikiException e) { throw new CertificateStoreException("Error while saving certificate to store [" + store + "]", e); } }  @Override void store(StoreReference store, CertifiedPublicKey certificate); @Override CertificateProvider getCertificateProvider(StoreReference store); @Override Collection<CertifiedPublicKey> getAllCertificates(StoreReference store); }
X509CertificateWikiStore extends AbstractX509WikiStore implements CertificateStore { @Override public void store(StoreReference store, CertifiedPublicKey certificate) throws CertificateStoreException { XWikiContext context = getXWikiContext(); try { context.getWiki().saveDocument(storeCertificate(store, certificate, context), context); } catch (XWikiException e) { throw new CertificateStoreException("Error while saving certificate to store [" + store + "]", e); } }  @Override void store(StoreReference store, CertifiedPublicKey certificate); @Override CertificateProvider getCertificateProvider(StoreReference store); @Override Collection<CertifiedPublicKey> getAllCertificates(StoreReference store); static final String CERTIFICATECLASS_SPACE; static final String CERTIFICATECLASS_NAME; static final String CERTIFICATECLASS_FULLNAME; static final LocalDocumentReference CERTIFICATECLASS; static final String CERTIFICATECLASS_PROP_ISSUER; static final String CERTIFICATECLASS_PROP_SERIAL; static final String CERTIFICATECLASS_PROP_SUBJECT; static final String CERTIFICATECLASS_PROP_KEYID; static final String CERTIFICATECLASS_PROP_CERTIFICATE; }