getFileHandler().createFile(contextFile);
getFileHandler().createFile(contextFile);
/** * {@inheritDoc} */ @Override protected void doDeploy(String deployableDir, Deployable deployable) { Deployable deployableToDeploy; try { deployableToDeploy = modifyManifestForClasspathEntries(deployable); } catch (Exception e) { throw new DeployableException("Cannot update the MANIFEST of deployable" + " with the JBoss container classpath", e); } super.doDeploy(deployableDir, deployableToDeploy); if (deployableToDeploy.isExpanded()) { String deployableName = getDeployableName(deployableToDeploy); getFileHandler().createFile(getFileHandler().append(deployableDir, deployableName + ".dodeploy")); } }
/** * {@inheritDoc} */ @Override protected void doDeploy(String deployableDir, Deployable deployable) { Deployable deployableToDeploy; try { deployableToDeploy = modifyManifestForClasspathEntries(deployable); } catch (Exception e) { throw new DeployableException("Cannot update the MANIFEST of deployable" + " with the JBoss container classpath", e); } super.doDeploy(deployableDir, deployableToDeploy); if (deployableToDeploy.isExpanded()) { String deployableName = getDeployableName(deployableToDeploy); getFileHandler().createFile(getFileHandler().append(deployableDir, deployableName + ".dodeploy")); } }
/** * Test that the file system manager can insert an XML element deep in the XML tree into a file. * This also involves a lookup. * @throws Exception If anything goes wrong */ public void testManagerCanInsertAnElementIntoFileThreeLevelsDeep() throws Exception { Document document = builder.newDocument(); Element application = document.createElement("Application"); document.appendChild(application); Element foo = document.createElement("foo"); application.appendChild(foo); Element bar = document.createElement("bar"); foo.appendChild(bar); util.saveXml(document, TEST_FILE); fileHandler.createFile(TEST_FILE); manager.setFile(TEST_FILE); manager.loadFile(); manager.insertElementsUnderXPath("<subnode property='hello' />", "//Application/foo/bar"); manager.writeFile(); String xml = fileHandler.readTextFile(TEST_FILE, "UTF-8"); XMLAssert.assertXpathEvaluatesTo("hello", "//Application/foo/bar/subnode/@property", xml); }
getFileHandler().createFile(getFileHandler().append(getHome(), ".cargo"));
getFileHandler().createFile(getFileHandler().append(getHome(), ".cargo"));
getFileHandler().createFile(outFile);
fileHandler = new VFSFileHandler(fsManager); this.configuration.setFileHandler(fileHandler); this.fileHandler.createFile(TEST_FILE); this.fileHandler.createFile(PREVIOUS_FILE);
getFileHandler().createFile(outFile);
/** * Test that the file system manager can insert an XML element with a namespace. * @throws Exception If anything goes wrong */ public void testManagerCanInsertAnElementIntoFileWithNamespace() throws Exception { Document document = builder.newDocument(); Element domain = document.createElement("domain"); domain.setAttribute("xmlns", "http://www.bea.com/ns/weblogic/920/domain"); domain.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); domain.setAttribute("xsi:schemaLocation", "http://www.bea.com/ns/weblogic/920/domain " + "http://www.bea.com/ns/weblogic/920/domain.xsd"); document.appendChild(domain); util.saveXml(document, TEST_FILE); fileHandler.createFile(TEST_FILE); manager.setNamespaces(namespaces); manager.setFile(TEST_FILE); manager.loadFile(); manager.insertElementsUnderXPath("<subnode property='hello' />", "//weblogic:domain"); manager.writeFile(); String xml = fileHandler.readTextFile(TEST_FILE, "UTF-8"); XMLAssert.assertXpathEvaluatesTo("hello", "//weblogic:domain/weblogic:subnode/@property", xml); }
/** * Test that the file system manager can insert an XML element into a file. * @throws Exception If anything goes wrong */ public void testManagerCanInsertAnElementIntoFile() throws Exception { Document document = builder.newDocument(); Element application = document.createElement("Application"); document.appendChild(application); util.saveXml(document, TEST_FILE); fileHandler.createFile(TEST_FILE); manager.setFile(TEST_FILE); manager.loadFile(); manager.insertElementsUnderXPath("<subnode property='hello' />", "//Application"); manager.writeFile(); String xml = fileHandler.readTextFile(TEST_FILE, "UTF-8"); XMLAssert.assertXpathEvaluatesTo("hello", "//Application/subnode/@property", xml); }
/** * Test file copy to a non-existing path.<br> * This has been raised by https://codehaus-cargo.atlassian.net/browse/CARGO-1004 */ public void testCopyToNonExistingPath() { String random = UUID.randomUUID().toString(); assertFalse("Subdirectory " + random + " already exists", this.fileHandler.isDirectory("target/" + random)); this.fileHandler.createFile("target/random.txt"); this.fileHandler.copyFile("target/random.txt", "target/" + random + "/random.txt", new FilterChain(), "UTF-8"); assertTrue("Subdirectory " + random + " does not exist after copy", this.fileHandler.isDirectory("target/" + random)); assertTrue("File in subdirectory " + random + " missing after copy", this.fileHandler.exists("target/" + random + "/random.txt")); }
getFileHandler().createFile(timestampFile);