|
org.netbeans.modules.jellytools.platform/3 3.13 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.jellytools.util.FolderContext
public class FolderContext
The FolderContext class contains methods for finding, creating, removing Data Objects, File Objects and Nodes in a given folder (e.g. 'data'). All objects are addresed relatively to the folder.
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 Summary | |
|---|---|
FolderContext(URL url)
Creates a new instance of FolderContext. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FolderContext(URL url)
url - folder's URL| Method Detail |
|---|
public static FolderContext getDataFolder(JellyTestCase test)
test - the test
public static FolderContext getWorkDir(JellyTestCase test)
throws IOException
test - the test
IOException - if the directory cannot be createdpublic FileObject getFileObject(String spec)
spec - File Object's path
public DataObject createFolder(String spec)
throws IOException
spec - folder's relative path separated by '/'
IOException - if the folder cannot be created
public DataObject createDataObject(String spec,
String content)
throws IOException
spec - Data Object's relative path separated by '/'content - Data Object's content
IOException - if the Data Object cannot be createdpublic DataObject getDataObject(String spec)
spec - Data Object's path
public void deleteDataObject(String spec)
throws IOException
spec - File Object's path
IOException - if something failspublic String getTreePath(String path)
path - relative path separated by '|'
|
org.netbeans.modules.jellytools.platform/3 3.13 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||