@Test public void getUnknownSoftwareTokenInitStatus() throws Exception { when(signerProxyFacade.getTokens()).thenThrow(new Exception()); TokenInitStatusInfo tokenStatus = tokenService.getSoftwareTokenInitStatus(); assertEquals(TokenInitStatusInfo.UNKNOWN, tokenStatus); }
public TokenInitStatusInfo getSoftwareTokenInitStatus() { try { boolean isSoftwareTokenInitialized = isSoftwareTokenInitialized(); if (isSoftwareTokenInitialized) { return TokenInitStatusInfo.INITIALIZED; } else { return TokenInitStatusInfo.NOT_INITIALIZED; } } catch (SignerNotReachableException e) { log.error("Could not get software token status from signer", e); return TokenInitStatusInfo.UNKNOWN; } }
TokenService { public TokenInitStatusInfo getSoftwareTokenInitStatus() { try { boolean isSoftwareTokenInitialized = isSoftwareTokenInitialized(); if (isSoftwareTokenInitialized) { return TokenInitStatusInfo.INITIALIZED; } else { return TokenInitStatusInfo.NOT_INITIALIZED; } } catch (SignerNotReachableException e) { log.error("Could not get software token status from signer", e); return TokenInitStatusInfo.UNKNOWN; } } }
TokenService { public TokenInitStatusInfo getSoftwareTokenInitStatus() { try { boolean isSoftwareTokenInitialized = isSoftwareTokenInitialized(); if (isSoftwareTokenInitialized) { return TokenInitStatusInfo.INITIALIZED; } else { return TokenInitStatusInfo.NOT_INITIALIZED; } } catch (SignerNotReachableException e) { log.error("Could not get software token status from signer", e); return TokenInitStatusInfo.UNKNOWN; } } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); }
TokenService { public TokenInitStatusInfo getSoftwareTokenInitStatus() { try { boolean isSoftwareTokenInitialized = isSoftwareTokenInitialized(); if (isSoftwareTokenInitialized) { return TokenInitStatusInfo.INITIALIZED; } else { return TokenInitStatusInfo.NOT_INITIALIZED; } } catch (SignerNotReachableException e) { log.error("Could not get software token status from signer", e); return TokenInitStatusInfo.UNKNOWN; } } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); List<TokenInfo> getAllTokens(); List<CertificateInfo> getSignCertificates(ClientType clientType); List<CertificateInfo> getAllCertificates(ClientType clientType); void activateToken(String id, char[] password); void deactivateToken(String id); TokenInfo getToken(String id); TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName); TokenInfo getTokenForKeyId(String keyId); TokenInfoAndKeyId getTokenAndKeyIdForCertificateHash(String hash); boolean isSoftwareTokenInitialized(); TokenInitStatusInfo getSoftwareTokenInitStatus(); TokenInfoAndKeyId getTokenAndKeyIdForCertificateRequestId(String csrId); boolean hasHardwareTokens(); }
TokenService { public TokenInitStatusInfo getSoftwareTokenInitStatus() { try { boolean isSoftwareTokenInitialized = isSoftwareTokenInitialized(); if (isSoftwareTokenInitialized) { return TokenInitStatusInfo.INITIALIZED; } else { return TokenInitStatusInfo.NOT_INITIALIZED; } } catch (SignerNotReachableException e) { log.error("Could not get software token status from signer", e); return TokenInitStatusInfo.UNKNOWN; } } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); List<TokenInfo> getAllTokens(); List<CertificateInfo> getSignCertificates(ClientType clientType); List<CertificateInfo> getAllCertificates(ClientType clientType); void activateToken(String id, char[] password); void deactivateToken(String id); TokenInfo getToken(String id); TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName); TokenInfo getTokenForKeyId(String keyId); TokenInfoAndKeyId getTokenAndKeyIdForCertificateHash(String hash); boolean isSoftwareTokenInitialized(); TokenInitStatusInfo getSoftwareTokenInitStatus(); TokenInfoAndKeyId getTokenAndKeyIdForCertificateRequestId(String csrId); boolean hasHardwareTokens();  }