@Test public void testInitSnapshot() { String networkName = "network"; String snapshotName = "snapshotName"; String fileName = "file.type"; String fileContents = "! empty config"; _manager.initNetwork(networkName, null); Path srcDir = createSnapshot(snapshotName, fileName, fileContents, _folder); _manager.initSnapshot(networkName, snapshotName, srcDir, false, Instant.now()); assertThat(_manager.getLatestSnapshot(networkName), equalTo(Optional.of(snapshotName))); }
@Override public void initSnapshot( String networkName, String snapshotName, Path srcDir, boolean autoAnalyze, Instant creationTime) { initSnapshot(networkName, snapshotName, srcDir, autoAnalyze, creationTime, null); }
WorkMgr extends AbstractCoordinator { @Override public void initSnapshot( String networkName, String snapshotName, Path srcDir, boolean autoAnalyze, Instant creationTime) { initSnapshot(networkName, snapshotName, srcDir, autoAnalyze, creationTime, null); } }
WorkMgr extends AbstractCoordinator { @Override public void initSnapshot( String networkName, String snapshotName, Path srcDir, boolean autoAnalyze, Instant creationTime) { initSnapshot(networkName, snapshotName, srcDir, autoAnalyze, creationTime, null); } WorkMgr(
      Settings settings,
      BatfishLogger logger,
      @Nonnull IdManager idManager,
      @Nonnull StorageProvider storage); }
WorkMgr extends AbstractCoordinator { @Override public void initSnapshot( String networkName, String snapshotName, Path srcDir, boolean autoAnalyze, Instant creationTime) { initSnapshot(networkName, snapshotName, srcDir, autoAnalyze, creationTime, null); } WorkMgr(
      Settings settings,
      BatfishLogger logger,
      @Nonnull IdManager idManager,
      @Nonnull StorageProvider storage); @VisibleForTesting @Nonnull StorageProvider getStorage(); @Nullable List<AutocompleteSuggestion> autoComplete(
      String network,
      String snapshot,
      Variable.Type completionType,
      String query,
      int maxSuggestions); void configureAnalysis(
      String network,
      boolean newAnalysis,
      String analysis,
      Map<String, String> questionsToAdd,
      List<String> questionsToDelete,
      @Nullable Boolean suggested); boolean delAnalysis(@Nonnull String network, @Nonnull String analysis); boolean delNetwork(@Nonnull String network); boolean delSnapshot(@Nonnull String network, @Nonnull String snapshot); boolean delQuestion(
      @Nonnull String network, @Nonnull String question, @Nullable String analysis); @Nullable Answer getAnswer(
      String network,
      String snapshot,
      String question,
      @Nullable String referenceSnapshot,
      @Nullable String analysis); @Nonnull String getAnswerString(
      String network,
      String snapshot,
      String question,
      @Nullable String referenceSnapshot,
      @Nullable String analysis); List<QueuedWork> getCompletedWork(String networkName, String snapshotName); @Nonnull Map<String, String> getAnalysisAnswers(
      String network,
      String snapshot,
      String referenceSnapshot,
      String analysis,
      Set<String> analysisQuestions); @Nonnull Map<String, AnswerMetadata> getAnalysisAnswersMetadata(
      String network,
      String snapshot,
      String referenceSnapshot,
      String analysis,
      Set<String> analysisQuestions); @Nonnull AnswerMetadata getAnswerMetadata(
      @Nonnull String network,
      @Nonnull String snapshot,
      @Nonnull String question,
      @Nullable String referenceSnapshot,
      @Nullable String analysis); Container getContainer(String networkName); @Override BatfishLogger getLogger(); @Override Set<String> getNetworkNames(); @Nonnull Optional<String> getLatestSnapshot(String network); @Nullable Set<String> getNodes(String network, String snapshot); @Nullable Topology getPojoTopology(@Nonnull String network, @Nonnull String snapshot); ReferenceLibrary getReferenceLibrary(String network); JSONObject getStatusJson(); boolean checkSnapshotExists(String network, String snapshot); boolean checkQuestionExists(String network, String question, @Nullable String analysis); @Nullable String getQuestion(String network, String question, @Nullable String analysis); QueuedWork getMatchingWork(WorkItem workItem, QueueType qType); QueuedWork getWork(UUID workItemId); @Nullable String getWorkLog(String networkName, String snapshotName, String workId); @Nullable String getWorkJson(String networkName, String snapshotName, String workId); String initNetwork(@Nullable String network, @Nullable String networkPrefix); @Override void initSnapshot(
      String networkName,
      String snapshotName,
      Path srcDir,
      boolean autoAnalyze,
      Instant creationTime); void initSnapshot(
      String networkName,
      String snapshotName,
      Path srcDir,
      boolean autoAnalyze,
      Instant creationTime,
      @Nullable SnapshotId parentSnapshotId); void forkSnapshot(String networkName, ForkSnapshotBean forkSnapshotBean); @Nullable SortedSet<String> listAnalyses(String network, AnalysisType analysisType); @Nullable SortedSet<String> listAnalysisQuestions(String network, String analysis); SortedSet<String> listNetworks(String apiKey); List<Container> getContainers(@Nullable String apiKey); List<QueuedWork> listIncompleteWork(
      String network, @Nullable String snapshot, @Nullable WorkType workType); @Nullable SortedSet<String> listQuestions(String network, boolean verbose); @Nullable List<String> listSnapshots(@Nonnull String network); @Nullable List<SnapshotMetadataEntry> listSnapshotsWithMetadata(@Nonnull String network); void putReferenceLibrary(ReferenceLibrary referenceLibrary, String network); boolean queueWork(WorkItem workItem); void startWorkManager(); boolean uploadQuestion(String network, String question, String questionJson); void uploadSnapshot(
      String networkName, String snapshotName, InputStream fileStream, boolean autoAnalyze); boolean checkNetworkExists(String networkName); Map<String, Answer> processAnalysisAnswers(
      Map<String, String> rawAnswers, Map<String, AnswerRowsOptions> answersRowsOptions); Answer filterAnswer(Answer rawAnswer, AnswerRowsOptions options); @VisibleForTesting IdManager getIdManager(); @VisibleForTesting SnapshotMetadataMgr getSnapshotMetadataManager(); @Nullable SnapshotMetadata getSnapshotMetadata(String network, String snapshot); void tryPromoteSnapshotNodeRoles(
      @Nonnull NetworkId networkId, @Nonnull SnapshotId snapshotId); @Nullable NodeRolesData getNetworkNodeRoles(@Nonnull String network); @Nullable NodeRolesData getSnapshotNodeRoles(
      @Nonnull String network, @Nonnull String snapshot); @MustBeClosed @Nullable InputStream getNetworkObject(@Nonnull String network, @Nonnull String key); boolean putNetworkObject(
      @Nonnull InputStream inputStream, @Nonnull String network, @Nonnull String key); boolean deleteNetworkObject(@Nonnull String network, @Nonnull String key); @MustBeClosed @Nullable InputStream getSnapshotObject(
      @Nonnull String network, @Nonnull String snapshot, @Nonnull String key); boolean putSnapshotExtendedObject(
      @Nonnull InputStream inputStream,
      @Nonnull String network,
      @Nonnull String snapshot,
      @Nonnull String key); boolean deleteSnapshotObject(
      @Nonnull String network, @Nonnull String snapshot, @Nonnull String key); @MustBeClosed InputStream getSnapshotInputObject(String network, String snapshot, String key); @Nullable List<StoredObjectMetadata> getSnapshotInputObjectsMetadata(String network, String snapshot); @Nullable List<StoredObjectMetadata> getSnapshotExtendedObjectsMetadata(
      String network, String snapshot); @Nullable org.batfish.datamodel.Topology getTopology(String network, String snapshot); boolean putNetworkNodeRoles(@Nonnull NodeRolesData nodeRolesData, @Nonnull String network); @Nullable InputValidationNotes validateInput(
      String network, String snapshot, Variable.Type varType, String query); }
WorkMgr extends AbstractCoordinator { @Override public void initSnapshot( String networkName, String snapshotName, Path srcDir, boolean autoAnalyze, Instant creationTime) { initSnapshot(networkName, snapshotName, srcDir, autoAnalyze, creationTime, null); } WorkMgr(
      Settings settings,
      BatfishLogger logger,
      @Nonnull IdManager idManager,
      @Nonnull StorageProvider storage); @VisibleForTesting @Nonnull StorageProvider getStorage(); @Nullable List<AutocompleteSuggestion> autoComplete(
      String network,
      String snapshot,
      Variable.Type completionType,
      String query,
      int maxSuggestions); void configureAnalysis(
      String network,
      boolean newAnalysis,
      String analysis,
      Map<String, String> questionsToAdd,
      List<String> questionsToDelete,
      @Nullable Boolean suggested); boolean delAnalysis(@Nonnull String network, @Nonnull String analysis); boolean delNetwork(@Nonnull String network); boolean delSnapshot(@Nonnull String network, @Nonnull String snapshot); boolean delQuestion(
      @Nonnull String network, @Nonnull String question, @Nullable String analysis); @Nullable Answer getAnswer(
      String network,
      String snapshot,
      String question,
      @Nullable String referenceSnapshot,
      @Nullable String analysis); @Nonnull String getAnswerString(
      String network,
      String snapshot,
      String question,
      @Nullable String referenceSnapshot,
      @Nullable String analysis); List<QueuedWork> getCompletedWork(String networkName, String snapshotName); @Nonnull Map<String, String> getAnalysisAnswers(
      String network,
      String snapshot,
      String referenceSnapshot,
      String analysis,
      Set<String> analysisQuestions); @Nonnull Map<String, AnswerMetadata> getAnalysisAnswersMetadata(
      String network,
      String snapshot,
      String referenceSnapshot,
      String analysis,
      Set<String> analysisQuestions); @Nonnull AnswerMetadata getAnswerMetadata(
      @Nonnull String network,
      @Nonnull String snapshot,
      @Nonnull String question,
      @Nullable String referenceSnapshot,
      @Nullable String analysis); Container getContainer(String networkName); @Override BatfishLogger getLogger(); @Override Set<String> getNetworkNames(); @Nonnull Optional<String> getLatestSnapshot(String network); @Nullable Set<String> getNodes(String network, String snapshot); @Nullable Topology getPojoTopology(@Nonnull String network, @Nonnull String snapshot); ReferenceLibrary getReferenceLibrary(String network); JSONObject getStatusJson(); boolean checkSnapshotExists(String network, String snapshot); boolean checkQuestionExists(String network, String question, @Nullable String analysis); @Nullable String getQuestion(String network, String question, @Nullable String analysis); QueuedWork getMatchingWork(WorkItem workItem, QueueType qType); QueuedWork getWork(UUID workItemId); @Nullable String getWorkLog(String networkName, String snapshotName, String workId); @Nullable String getWorkJson(String networkName, String snapshotName, String workId); String initNetwork(@Nullable String network, @Nullable String networkPrefix); @Override void initSnapshot(
      String networkName,
      String snapshotName,
      Path srcDir,
      boolean autoAnalyze,
      Instant creationTime); void initSnapshot(
      String networkName,
      String snapshotName,
      Path srcDir,
      boolean autoAnalyze,
      Instant creationTime,
      @Nullable SnapshotId parentSnapshotId); void forkSnapshot(String networkName, ForkSnapshotBean forkSnapshotBean); @Nullable SortedSet<String> listAnalyses(String network, AnalysisType analysisType); @Nullable SortedSet<String> listAnalysisQuestions(String network, String analysis); SortedSet<String> listNetworks(String apiKey); List<Container> getContainers(@Nullable String apiKey); List<QueuedWork> listIncompleteWork(
      String network, @Nullable String snapshot, @Nullable WorkType workType); @Nullable SortedSet<String> listQuestions(String network, boolean verbose); @Nullable List<String> listSnapshots(@Nonnull String network); @Nullable List<SnapshotMetadataEntry> listSnapshotsWithMetadata(@Nonnull String network); void putReferenceLibrary(ReferenceLibrary referenceLibrary, String network); boolean queueWork(WorkItem workItem); void startWorkManager(); boolean uploadQuestion(String network, String question, String questionJson); void uploadSnapshot(
      String networkName, String snapshotName, InputStream fileStream, boolean autoAnalyze); boolean checkNetworkExists(String networkName); Map<String, Answer> processAnalysisAnswers(
      Map<String, String> rawAnswers, Map<String, AnswerRowsOptions> answersRowsOptions); Answer filterAnswer(Answer rawAnswer, AnswerRowsOptions options); @VisibleForTesting IdManager getIdManager(); @VisibleForTesting SnapshotMetadataMgr getSnapshotMetadataManager(); @Nullable SnapshotMetadata getSnapshotMetadata(String network, String snapshot); void tryPromoteSnapshotNodeRoles(
      @Nonnull NetworkId networkId, @Nonnull SnapshotId snapshotId); @Nullable NodeRolesData getNetworkNodeRoles(@Nonnull String network); @Nullable NodeRolesData getSnapshotNodeRoles(
      @Nonnull String network, @Nonnull String snapshot); @MustBeClosed @Nullable InputStream getNetworkObject(@Nonnull String network, @Nonnull String key); boolean putNetworkObject(
      @Nonnull InputStream inputStream, @Nonnull String network, @Nonnull String key); boolean deleteNetworkObject(@Nonnull String network, @Nonnull String key); @MustBeClosed @Nullable InputStream getSnapshotObject(
      @Nonnull String network, @Nonnull String snapshot, @Nonnull String key); boolean putSnapshotExtendedObject(
      @Nonnull InputStream inputStream,
      @Nonnull String network,
      @Nonnull String snapshot,
      @Nonnull String key); boolean deleteSnapshotObject(
      @Nonnull String network, @Nonnull String snapshot, @Nonnull String key); @MustBeClosed InputStream getSnapshotInputObject(String network, String snapshot, String key); @Nullable List<StoredObjectMetadata> getSnapshotInputObjectsMetadata(String network, String snapshot); @Nullable List<StoredObjectMetadata> getSnapshotExtendedObjectsMetadata(
      String network, String snapshot); @Nullable org.batfish.datamodel.Topology getTopology(String network, String snapshot); boolean putNetworkNodeRoles(@Nonnull NodeRolesData nodeRolesData, @Nonnull String network); @Nullable InputValidationNotes validateInput(
      String network, String snapshot, Variable.Type varType, String query);  }