InstanceCertManager { void updateX509CertificateSigner() { if (caX509CertificateSigner == null) { caX509CertificateSigner = getCACertificate(); } } InstanceCertManager(final PrivateKeyStore keyStore, Authorizer authorizer, HostnameResolver hostnameResolver,
            boolean readOnlyMode); void setCertStore(CertRecordStore certStore); void setSSHStore(SSHRecordStore sshStore); CertificateAuthorityBundle getCertificateAuthorityBundle(final String name); List<X509CertRecord> getUnrefreshedCertsNotifications(String serverHostName, String provider); X509CertRecord getX509CertRecord(final String provider, X509Certificate cert); X509CertRecord getX509CertRecord(final String provider, final String instanceId,
            final String service); boolean updateX509CertRecord(X509CertRecord certRecord); boolean deleteX509CertRecord(final String provider, final String instanceId,
            final String service); boolean insertX509CertRecord(X509CertRecord certRecord); String generateX509Certificate(final String csr, final String keyUsage, int expiryTime); String getCACertificate(); InstanceIdentity generateIdentity(String csr, String cn, String keyUsage,
            int expiryTime); String getX509CertificateSigner(); SSHCertificates generateSSHCertificates(Principal principal, SSHCertRequest certRequest); boolean generateSSHIdentity(Principal principal, InstanceIdentity identity, final String hostname,
            final String csr, SSHCertRecord sshCertRecord, final String certType); boolean authorizeLaunch(Principal providerService, String domain, String service,
            StringBuilder errorMsg); boolean verifyCertRefreshIPAddress(final String ipAddress); boolean verifyInstanceCertIPAddress(final String provider, final String ipAddress); boolean validPrincipals(final String hostname, SSHCertRecord sshCertRecord, SshHostCsr sshHostCsr); void logX509Cert(final Principal principal, final String ip, final String provider,
            final String instanceId, final X509Certificate x509Cert); SSHCertRecord getSSHCertRecord(final String instanceId, final String service); boolean updateSSHCertRecord(SSHCertRecord certRecord, boolean refresh); boolean enableCertStoreNotifications(NotificationManager notificationManager, RolesProvider rolesProvider, String serverName); boolean enableSSHStoreNotifications(NotificationManager notificationManager, RolesProvider rolesProvider, String serverName);  }
@Test public void testUpdateX509CertificateSigner() { final String caCert = "caCert"; System.clearProperty(ZTSConsts.ZTS_PROP_X509_CA_CERT_FNAME); CertSigner certSigner = Mockito.mock(com.yahoo.athenz.common.server.cert.CertSigner.class); when(certSigner.getCACertificate()).thenReturn(caCert); InstanceCertManager instanceManager = new InstanceCertManager(null, null, null, false); instanceManager.setCertSigner(certSigner); instanceManager.resetX509CertificateSigner(); instanceManager.updateX509CertificateSigner(); assertEquals("caCert", instanceManager.getX509CertificateSigner()); instanceManager.updateX509CertificateSigner(); assertEquals("caCert", instanceManager.getX509CertificateSigner()); instanceManager.shutdown(); }