@Test public void uploadInitialAnchor() throws Exception { byte[] anchorBytes = FileUtils.readFileToByteArray(ANCHOR_FILE); when(anchorRepository.readAnchorFile()).thenThrow(new NoSuchFileException("")); try { systemService.uploadInitialAnchor(anchorBytes); } catch (Exception e) { fail("Should not fail"); } }
public void uploadInitialAnchor(byte[] anchorBytes) throws InvalidAnchorInstanceException, AnchorUploadException, MalformedAnchorException, ConfigurationDownloadException, ConfigurationVerifier.ConfigurationVerificationException, AnchorAlreadyExistsException { if (isAnchorImported()) { throw new AnchorAlreadyExistsException("Anchor already exists - cannot upload a second one"); } uploadAnchor(anchorBytes, false); }
SystemService { public void uploadInitialAnchor(byte[] anchorBytes) throws InvalidAnchorInstanceException, AnchorUploadException, MalformedAnchorException, ConfigurationDownloadException, ConfigurationVerifier.ConfigurationVerificationException, AnchorAlreadyExistsException { if (isAnchorImported()) { throw new AnchorAlreadyExistsException("Anchor already exists - cannot upload a second one"); } uploadAnchor(anchorBytes, false); } }
SystemService { public void uploadInitialAnchor(byte[] anchorBytes) throws InvalidAnchorInstanceException, AnchorUploadException, MalformedAnchorException, ConfigurationDownloadException, ConfigurationVerifier.ConfigurationVerificationException, AnchorAlreadyExistsException { if (isAnchorImported()) { throw new AnchorAlreadyExistsException("Anchor already exists - cannot upload a second one"); } uploadAnchor(anchorBytes, false); } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); }
SystemService { public void uploadInitialAnchor(byte[] anchorBytes) throws InvalidAnchorInstanceException, AnchorUploadException, MalformedAnchorException, ConfigurationDownloadException, ConfigurationVerifier.ConfigurationVerificationException, AnchorAlreadyExistsException { if (isAnchorImported()) { throw new AnchorAlreadyExistsException("Anchor already exists - cannot upload a second one"); } uploadAnchor(anchorBytes, false); } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); List<TspType> getConfiguredTimestampingServices(); void addConfiguredTimestampingService(TspType tspTypeToAdd); void deleteConfiguredTimestampingService(TspType tspTypeToDelete); byte[] generateInternalCsr(String distinguishedName); AnchorFile getAnchorFile(); AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance); void uploadInitialAnchor(byte[] anchorBytes); void replaceAnchor(byte[] anchorBytes); boolean isAnchorImported(); byte[] readAnchorFile(); String getAnchorFilenameForDownload(); }
SystemService { public void uploadInitialAnchor(byte[] anchorBytes) throws InvalidAnchorInstanceException, AnchorUploadException, MalformedAnchorException, ConfigurationDownloadException, ConfigurationVerifier.ConfigurationVerificationException, AnchorAlreadyExistsException { if (isAnchorImported()) { throw new AnchorAlreadyExistsException("Anchor already exists - cannot upload a second one"); } uploadAnchor(anchorBytes, false); } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); List<TspType> getConfiguredTimestampingServices(); void addConfiguredTimestampingService(TspType tspTypeToAdd); void deleteConfiguredTimestampingService(TspType tspTypeToDelete); byte[] generateInternalCsr(String distinguishedName); AnchorFile getAnchorFile(); AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance); void uploadInitialAnchor(byte[] anchorBytes); void replaceAnchor(byte[] anchorBytes); boolean isAnchorImported(); byte[] readAnchorFile(); String getAnchorFilenameForDownload();  }