@Test public void testDeployDefaultsFileNullWFDirURI() throws Exception { CelosCiContext context = mock(CelosCiContext.class); File localFolder = tempDir.newFolder(); localFolder.mkdirs(); File defFile = new File(localFolder, "defaults.js"); defFile.createNewFile(); OutputStream os = new FileOutputStream(defFile); os.write("newfile".getBytes()); os.flush(); WorkflowFilesDeployer deployer = new WorkflowFilesDeployer(context); File remoteFolderWf = tempDir.newFolder(); remoteFolderWf.mkdirs(); File remoteFolderDef = tempDir.newFolder(); remoteFolderDef.mkdirs(); CelosCiTarget target = new CelosCiTarget(URI.create(""), URI.create(""), emptyURI, remoteFolderDef.toURI(), URI.create("hiveJdbc")); doReturn(localFolder).when(context).getDeployDir(); doReturn(target).when(context).getTarget(); doReturn("workflow").when(context).getWorkflowName(); deployer.deploy(); Assert.assertArrayEquals(remoteFolderWf.list(), new String[]{}); Assert.assertArrayEquals(remoteFolderDef.list(), new String[]{"workflow.js"}); }
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; }