@Test (dependsOnMethods = "testRemoveEdge") public void testRemoveNode() throws GitAPIException, IOException { node1File.delete(); node2File.delete(); DataNode node1 = this.flowGraph.getNode("node1"); Assert.assertNotNull(node1); DataNode node2 = this.flowGraph.getNode("node2"); Assert.assertNotNull(node2); this.gitForPush.rm().addFilepattern(formNodeFilePath(this.node1Dir.getName(), this.node1File.getName())).call(); this.gitForPush.rm().addFilepattern(formNodeFilePath(this.node2Dir.getName(), this.node2File.getName())).call(); this.gitForPush.commit().setMessage("Node remove commit").call(); this.gitForPush.push().setRemote("origin").setRefSpecs(this.masterRefSpec).call(); this.gitFlowGraphMonitor.processGitConfigChanges(); node1 = this.flowGraph.getNode("node1"); Assert.assertNull(node1); node2 = this.flowGraph.getNode("node2"); Assert.assertNull(node2); }
@Override void processGitConfigChanges() throws GitAPIException, IOException { if (flowTemplateCatalog.isPresent() && flowTemplateCatalog.get().getAndSetShouldRefreshFlowGraph(false)) { log.info("Change to template catalog detected, refreshing FlowGraph"); this.gitRepo.initRepository(); } List<DiffEntry> changes = this.gitRepo.getChanges(); Collections.sort(changes, (o1, o2) -> { Integer o1Depth = (o1.getNewPath() != null) ? (new Path(o1.getNewPath())).depth() : (new Path(o1.getOldPath())).depth(); Integer o2Depth = (o2.getNewPath() != null) ? (new Path(o2.getNewPath())).depth() : (new Path(o2.getOldPath())).depth(); return o1Depth.compareTo(o2Depth); }); processGitConfigChangesHelper(changes); this.initComplete.countDown(); }
GitFlowGraphMonitor extends GitMonitoringService { @Override void processGitConfigChanges() throws GitAPIException, IOException { if (flowTemplateCatalog.isPresent() && flowTemplateCatalog.get().getAndSetShouldRefreshFlowGraph(false)) { log.info("Change to template catalog detected, refreshing FlowGraph"); this.gitRepo.initRepository(); } List<DiffEntry> changes = this.gitRepo.getChanges(); Collections.sort(changes, (o1, o2) -> { Integer o1Depth = (o1.getNewPath() != null) ? (new Path(o1.getNewPath())).depth() : (new Path(o1.getOldPath())).depth(); Integer o2Depth = (o2.getNewPath() != null) ? (new Path(o2.getNewPath())).depth() : (new Path(o2.getOldPath())).depth(); return o1Depth.compareTo(o2Depth); }); processGitConfigChangesHelper(changes); this.initComplete.countDown(); } }
GitFlowGraphMonitor extends GitMonitoringService { @Override void processGitConfigChanges() throws GitAPIException, IOException { if (flowTemplateCatalog.isPresent() && flowTemplateCatalog.get().getAndSetShouldRefreshFlowGraph(false)) { log.info("Change to template catalog detected, refreshing FlowGraph"); this.gitRepo.initRepository(); } List<DiffEntry> changes = this.gitRepo.getChanges(); Collections.sort(changes, (o1, o2) -> { Integer o1Depth = (o1.getNewPath() != null) ? (new Path(o1.getNewPath())).depth() : (new Path(o1.getOldPath())).depth(); Integer o2Depth = (o2.getNewPath() != null) ? (new Path(o2.getNewPath())).depth() : (new Path(o2.getOldPath())).depth(); return o1Depth.compareTo(o2Depth); }); processGitConfigChangesHelper(changes); this.initComplete.countDown(); } GitFlowGraphMonitor(Config config, Optional<? extends FSFlowTemplateCatalog> flowTemplateCatalog,
      FlowGraph graph, Map<URI, TopologySpec> topologySpecMap, CountDownLatch initComplete); }
GitFlowGraphMonitor extends GitMonitoringService { @Override void processGitConfigChanges() throws GitAPIException, IOException { if (flowTemplateCatalog.isPresent() && flowTemplateCatalog.get().getAndSetShouldRefreshFlowGraph(false)) { log.info("Change to template catalog detected, refreshing FlowGraph"); this.gitRepo.initRepository(); } List<DiffEntry> changes = this.gitRepo.getChanges(); Collections.sort(changes, (o1, o2) -> { Integer o1Depth = (o1.getNewPath() != null) ? (new Path(o1.getNewPath())).depth() : (new Path(o1.getOldPath())).depth(); Integer o2Depth = (o2.getNewPath() != null) ? (new Path(o2.getNewPath())).depth() : (new Path(o2.getOldPath())).depth(); return o1Depth.compareTo(o2Depth); }); processGitConfigChangesHelper(changes); this.initComplete.countDown(); } GitFlowGraphMonitor(Config config, Optional<? extends FSFlowTemplateCatalog> flowTemplateCatalog,
      FlowGraph graph, Map<URI, TopologySpec> topologySpecMap, CountDownLatch initComplete); @Override boolean shouldPollGit(); @Override void addChange(DiffEntry change); @Override void removeChange(DiffEntry change); }
GitFlowGraphMonitor extends GitMonitoringService { @Override void processGitConfigChanges() throws GitAPIException, IOException { if (flowTemplateCatalog.isPresent() && flowTemplateCatalog.get().getAndSetShouldRefreshFlowGraph(false)) { log.info("Change to template catalog detected, refreshing FlowGraph"); this.gitRepo.initRepository(); } List<DiffEntry> changes = this.gitRepo.getChanges(); Collections.sort(changes, (o1, o2) -> { Integer o1Depth = (o1.getNewPath() != null) ? (new Path(o1.getNewPath())).depth() : (new Path(o1.getOldPath())).depth(); Integer o2Depth = (o2.getNewPath() != null) ? (new Path(o2.getNewPath())).depth() : (new Path(o2.getOldPath())).depth(); return o1Depth.compareTo(o2Depth); }); processGitConfigChangesHelper(changes); this.initComplete.countDown(); } GitFlowGraphMonitor(Config config, Optional<? extends FSFlowTemplateCatalog> flowTemplateCatalog,
      FlowGraph graph, Map<URI, TopologySpec> topologySpecMap, CountDownLatch initComplete); @Override boolean shouldPollGit(); @Override void addChange(DiffEntry change); @Override void removeChange(DiffEntry change); static final String GIT_FLOWGRAPH_MONITOR_PREFIX; }