VagrantStrategy implements ClusterStrategy { @Override public NodeStatus getNodeStatus(Node node) throws IOException { Path nodePath = getPath(node); if (!Files.exists(nodePath)) { return NodeStatus.OFFLINE; } String output = executor.execute(nodePath, "vagrant", "status").getOutput(); return statusParser.parseStatusOutput(output); } protected  VagrantStrategy(); @Override boolean isAvailable(); @Override Node createNode(Cluster cluster); @Override NodeStatus getNodeStatus(Node node); @Override void startNode(Node node); @Override void stopNode(Node node); @Override void destroyNode(Node node); SshConfig getSshConfig(Node node); static final String NAME; }
@Test public void testGetNodeStatus() throws IOException { Files.createDirectories(vagrantPath); when(executor.execute(vagrantPath, "vagrant", "status")).thenReturn( new ExecutionResult(0, "status line", "")); when(statusParser.parseStatusOutput("status line")).thenReturn(NodeStatus.ONLINE); assertEquals(NodeStatus.ONLINE, strategy.getNodeStatus(prepareNode())); }