public class FolderContext extends Object
Usage:
public class TestTest extends JellyTestCase { ... public void test() throws Exception { // find data folder FolderContext df = FolderContext.getDataFolder(this); // create folder df.createFolder("resources"); // create file with given content DataObject bundle = df.createDataObject("resources/Bundle.properties", "OpenIDE-Module-Name=My Module\n"); // new from template NewWizardOperator.create("Java Package", df.getTreePath("resources"), "org.netbeans.modules"); Node node = df.getJellyNode("resources|Bundle"); ... // remove garbage df.deleteDataObject("resources"); ... // find work dir, create and mount it if necesarry FolderContext wd = FolderContext.getWorkDir(this); ...
Constructor and Description |
---|
FolderContext(URL url)
Creates a new instance of FolderContext.
|
Modifier and Type | Method and Description |
---|---|
DataObject |
createDataObject(String spec,
String content)
Creates Data Object.
|
DataObject |
createFolder(String spec)
Creates folder.
|
void |
deleteDataObject(String spec)
Deletes the File Object.
|
static FolderContext |
getDataFolder(JellyTestCase test)
Returns data folder context for given test.
|
DataObject |
getDataObject(String spec)
Finds the Data Object.
|
FileObject |
getFileObject(String spec)
Finds the File Object.
|
String |
getTreePath(String path)
Returns absolute Tree Path.
|
static FolderContext |
getWorkDir(JellyTestCase test)
Returns working directory context for given test.
|
public FolderContext(URL url)
url
- folder's URLpublic static FolderContext getDataFolder(JellyTestCase test)
test
- the testpublic static FolderContext getWorkDir(JellyTestCase test) throws IOException
test
- the testIOException
- if the directory cannot be createdpublic FileObject getFileObject(String spec)
spec
- File Object's pathpublic DataObject createFolder(String spec) throws IOException
spec
- folder's relative path separated by '/'IOException
- if the folder cannot be createdpublic DataObject createDataObject(String spec, String content) throws IOException
spec
- Data Object's relative path separated by '/'content
- Data Object's contentIOException
- if the Data Object cannot be createdpublic DataObject getDataObject(String spec)
spec
- Data Object's pathpublic void deleteDataObject(String spec) throws IOException
spec
- File Object's pathIOException
- if something fails