@Test public void testDeployFileExists() throws Exception { CelosCiContext context = mock(CelosCiContext.class); File localFolder = tempDir.newFolder(); localFolder.mkdirs(); File wfFile = new File(localFolder, "workflow.js"); wfFile.createNewFile(); writeTextToFile(wfFile, "newfile"); WorkflowFilesDeployer deployer = new WorkflowFilesDeployer(context); File remoteFolder = tempDir.newFolder(); remoteFolder.mkdirs(); CelosCiTarget target = new CelosCiTarget(URI.create(""), URI.create(""), remoteFolder.toURI(), emptyURI, URI.create("hiveJdbc")); doReturn(localFolder).when(context).getDeployDir(); doReturn(target).when(context).getTarget(); doReturn("workflow").when(context).getWorkflowName(); File destFile = new File(remoteFolder, "workflow.js"); destFile.createNewFile(); writeTextToFile(destFile, "oldfile"); Assert.assertEquals("oldfile", readFileContent(destFile)); deployer.deploy(); Assert.assertArrayEquals(remoteFolder.list(), new String[]{"workflow.js"}); Assert.assertEquals("newfile", readFileContent(destFile)); }
public void deploy() throws IOException, URISyntaxException { undeploy(); deployJSFile(config.getTarget().getWorkflowsDirUri(), WORKFLOW_FILENAME); deployJSFile(config.getTarget().getDefaultsDirUri(), DEFAULTS_FILENAME); }
WorkflowFilesDeployer { public void deploy() throws IOException, URISyntaxException { undeploy(); deployJSFile(config.getTarget().getWorkflowsDirUri(), WORKFLOW_FILENAME); deployJSFile(config.getTarget().getDefaultsDirUri(), DEFAULTS_FILENAME); } }
WorkflowFilesDeployer { public void deploy() throws IOException, URISyntaxException { undeploy(); deployJSFile(config.getTarget().getWorkflowsDirUri(), WORKFLOW_FILENAME); deployJSFile(config.getTarget().getDefaultsDirUri(), DEFAULTS_FILENAME); } WorkflowFilesDeployer(CelosCiContext context); }
WorkflowFilesDeployer { public void deploy() throws IOException, URISyntaxException { undeploy(); deployJSFile(config.getTarget().getWorkflowsDirUri(), WORKFLOW_FILENAME); deployJSFile(config.getTarget().getDefaultsDirUri(), DEFAULTS_FILENAME); } WorkflowFilesDeployer(CelosCiContext context); void undeploy(); void deploy(); }
WorkflowFilesDeployer { public void deploy() throws IOException, URISyntaxException { undeploy(); deployJSFile(config.getTarget().getWorkflowsDirUri(), WORKFLOW_FILENAME); deployJSFile(config.getTarget().getDefaultsDirUri(), DEFAULTS_FILENAME); } WorkflowFilesDeployer(CelosCiContext context); void undeploy(); void deploy(); static final String WORKFLOW_FILENAME; static final String DEFAULTS_FILENAME; }