org.openide.filesystems.Repository Java Examples

The following examples show how to use org.openide.filesystems.Repository. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataLoaderGetActionsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the testing environment by creating testing folders
 * on the system file system.
 */
@Override
protected void setUp() throws Exception {
    clearWorkDir();
    MockLookup.setInstances(
            new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
            new Pool());
    
    MyDL loader = MyDL.getLoader(MyDL.class);

    FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
    dfs.refresh (true);        
    root = FileUtil.createFolder (dfs.getRoot (), loader.actionsContext ());
    
    
    FileObject fo = FileUtil.createData (dfs.getRoot (), "a.txt");
    obj = DataObject.find (fo);
    
    assertEquals ("The correct loader", loader, obj.getLoader ());
    
    node = obj.getNodeDelegate ();    
}
 
Example #2
Source File: XMLPropertiesConvertorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testFactoryMethod() throws Exception {
    FileObject dtdFO = Repository.getDefault().getDefaultFileSystem().
        findResource("/xml/lookups/abc/x.instance");
    assertNotNull("Provider not found", dtdFO);
    Convertor c = XMLPropertiesConvertor.create(dtdFO);
    assertNotNull("Convertor created", c);
    
    DataFolder folder = DataFolder.findFolder(root);
    
    FactoryBase inst = FactoryBase.create();
    InstanceDataObject ido = InstanceDataObject.create(folder, null, inst, null);

    assertSame("Instance is there", inst, ido.instanceCreate());
    
    Reference<Object> ref = new WeakReference<Object>(inst);
    inst = null;
    
    assertGC("Instance can disappear", ref);
    
    Object obj = ido.instanceCreate();
    assertEquals("One can re-create it without default constructor", FactoryBase.class, obj.getClass());
}
 
Example #3
Source File: TestBase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void setRepository(Repository repository) {
    // must set out repository first
    setProxyLookups(new Lookup[] {
        Lookups.singleton(repository),
    });

    FileObject servicesFolder = FileUtil.getConfigFile("Services");
    if (servicesFolder == null) {
        try {
            servicesFolder = FileUtil.getConfigRoot().createFolder("Services");
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
    DataFolder services = DataFolder.findFolder(servicesFolder);
    FolderLookup lookup = new FolderLookup(services);
    setProxyLookups(new Lookup[] {
        Lookups.singleton(repository),
        new FolderLookup(services).getLookup()
    });
}
 
Example #4
Source File: XMLPropertiesConvertorAnnotationTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testReadWrite() throws Exception {
    FileObject dtdFO = Repository.getDefault().getDefaultFileSystem().
        findResource("/xml/lookups/NetBeans_org_netbeans_modules_settings_xtest/DTD_XML_FooSetting_2_0.instance");
    assertNotNull("Provider not found", dtdFO);
    Convertor c = XMLPropertiesConvertor.create(dtdFO);
    AnnoFoo foo = new AnnoFoo();
    foo.setProperty1("xxx");
    CharArrayWriter caw = new CharArrayWriter(1024);
    c.write(caw, foo);
    caw.flush();
    caw.close();
    CharArrayReader car = new CharArrayReader(caw.toCharArray());
    Object obj = c.read(car);
    assertEquals(foo, obj);
    assertEquals("HooFoo is the class", HooFoo.class, obj.getClass());
}
 
Example #5
Source File: XMLDataObjectMimeTypeTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void setUp(String mime) throws Exception {
    super.setUp();
    MockServices.setServices(Pool.class);
    String ext = getName();
    
    clearWorkDir();
    lfs = new LocalFileSystem();
    lfs.setRootDirectory(getWorkDir());
    FileUtil.createData(lfs.getRoot(), "AA/a."  + ext);
    Repository.getDefault().addFileSystem(lfs);
    FileUtil.setMIMEType(ext, mime);
    FileObject fo = lfs.findResource("AA/a." + ext);
    assertNotNull("file not found", fo);
    obj = DataObject.find(fo);

    assertEquals("The right class", obj.getClass(), XMLDataObject.class);

    assertFalse("Designed to run outside of AWT", SwingUtilities.isEventDispatchThread());
}
 
Example #6
Source File: UnitTestUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void prepareTest (String[] stringLayers, Lookup lkp) 
            throws IOException, SAXException, PropertyVetoException {
    URL[] layers = new URL[stringLayers.length];
    
    for (int cntr = 0; cntr < layers.length; cntr++) {
        layers[cntr] = Utilities.class.getResource(stringLayers[cntr]);
    }
    
    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(layers);
    
    Repository repository = new Repository(system);
    
    if (lkp == null) {
        UnitTestUtils.setLookup(new Object[] { repository }, UnitTestUtils.class.getClassLoader());
    } else {
        UnitTestUtils.setLookup(new Object[] { repository }, lkp, UnitTestUtils.class.getClassLoader());
    }
}
 
Example #7
Source File: Util.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new PropertiesDataObject (properties file).
 * @param folder FileObject folder where to create the properties file
 * @param fileName String name of the file without the extension, can include
 *        relative path underneath the folder
 * @return created PropertiesDataObjet
 */
public static PropertiesDataObject createPropertiesDataObject(FileObject folder, String fileName)
    throws IOException
{
    int idx = fileName.lastIndexOf('/');
    if (idx > 0) {
        String folderPath = fileName.substring(0, idx);
        folder = FileUtil.createFolder(folder, folderPath);
        fileName = fileName.substring(idx + 1);
    }
    FileSystem defaultFS = Repository.getDefault().getDefaultFileSystem();
    FileObject templateFO = defaultFS.findResource("Templates/Other/properties.properties"); // NOI18N
    DataObject template = DataObject.find(templateFO);
    return (PropertiesDataObject)
           template.createFromTemplate(DataFolder.findFolder(folder), fileName);
}
 
Example #8
Source File: ChangingOfBeanPropertyProperties.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** setUp method  */
public void setUp() {
    System.out.println("########  "+getName()+"  #######");
    if (!getName().equals("testChangeSourceCode") && !getName().equals("testDeleteAnyPropertiesAndEvents")) {
        
        FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
        FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
        
        try {
            DataObject.find(testFile).copy(DataFolder.findFolder(destination));
        } catch (IOException e) {
            fail(e);
        }
    }
    new PropertiesAction().perform();
}
 
Example #9
Source File: CreateNewIndexedProperty.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** setUp method  */
public void setUp() {
    // redirect jemmy trace and error output to a log
    System.out.println("########  "+getName()+"  #######");

    OptionsOperator optionsOperator = OptionsOperator.invoke();
    optionsOperator.selectOption(Bundle.getString("org.netbeans.core.Bundle", "UI/Services/Editing")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Menu"));
    PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(optionsOperator);
    new Property(propertySheetTabOperator, Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Prop_Style")).setValue(Bundle.getString("org.netbeans.modules.beans.Bundle", "MSG_Option_Gen_This"));
    
    FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
    FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
    optionsOperator.close();
    try {
        DataObject.find(testFile).copy(DataFolder.findFolder(destination));
    } catch (IOException e) {
        fail(e);
    }
    new PropertiesAction().perform();
}
 
Example #10
Source File: BeanInfoGeneration.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** setUp method  */
public void setUp() {
    System.out.println("########  "+getName()+"  #######");

    new EventTool().waitNoEvent(DELAY);
    new PropertiesAction().perform();
    
    FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
    FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
    
    try {
        DataObject.find(testFile).copy(DataFolder.findFolder(destination));
    } catch (IOException e) {
        fail(e);
    }
}
 
Example #11
Source File: CreateNewNonIndexedProperty.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** setUp method  */
public void setUp() {
    System.out.println("########  "+getName()+"  #######");
    
    OptionsOperator optionsOperator = OptionsOperator.invoke();
    optionsOperator.selectOption(Bundle.getString("org.netbeans.core.Bundle", "UI/Services/Editing")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Menu"));
    PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(optionsOperator);
    new Property(propertySheetTabOperator, Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Prop_Style")).setValue(Bundle.getString("org.netbeans.modules.beans.Bundle", "MSG_Option_Gen_This"));

    FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
    FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
    optionsOperator.close();
    try {
        DataObject.find(testFile).copy(DataFolder.findFolder(destination));
    } catch (IOException e) {
        fail(e);
    }
    new PropertiesAction().perform();
}
 
Example #12
Source File: BeanInfoGeneration.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCheckBeanInfoCompilability() {
    createContent();
    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_GenerateBeanInfo"));
    new EventTool().waitNoEvent(DELAY);
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.beaninfo.Bundle", "CTL_TITLE_GenerateBeanInfo");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);
    nbDialogOperator.ok();
    //new EventTool().waitNoEvent(1000);
    explorerOperator = new RepositoryTabOperator();
    repositoryRootNode = explorerOperator.getRootNode();
    JavaNode javaNode = new JavaNode(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"BeanInfo");
    javaNode.select();
    javaNode.compile();
    
    MainWindowOperator.getDefault().waitStatusText("Finished TestFileBeanInfo");
    assertNotNull("Generated BeanInfo is not compilable", Repository.getDefault().findResource("TestFileBeanInfo.class"));
}
 
Example #13
Source File: UnitTestUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void prepareTest (String[] stringLayers, Lookup lkp) 
            throws IOException, SAXException, PropertyVetoException {
    URL[] layers = new URL[stringLayers.length];
    
    for (int cntr = 0; cntr < layers.length; cntr++) {
        layers[cntr] = Utilities.class.getResource(stringLayers[cntr]);
    }
    
    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(layers);
    
    Repository repository = new Repository(system);
    
    if (lkp == null) {
        DEFAULT_LOOKUP.setLookup(new Object[] { repository }, UnitTestUtils.class.getClassLoader());
    } else {
        DEFAULT_LOOKUP.setLookup(new Object[] { repository }, lkp, UnitTestUtils.class.getClassLoader());
    }
}
 
Example #14
Source File: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Mounts <userdir>/sampledir through API
 * @return absolute path of mounted dir
 */
public static boolean mountSampledir() {
    String userdir = System.getProperty("netbeans.user"); // NOI18N
    String mountPoint = userdir+File.separator+"sampledir"; // NOI18N
    mountPoint = mountPoint.replace('\\', '/');
    FileSystem fs = Repository.getDefault().findFileSystem(mountPoint);
    if (fs == null) {
        try {
            LocalFileSystem lfs= new LocalFileSystem();
            lfs.setRootDirectory(new File(mountPoint));
            Repository.getDefault().addFileSystem(lfs);
            return true;
        } catch (IOException ioe) {
            throw new JemmyException("Mounting FS: "+mountPoint+" failed.", ioe);
        } catch (PropertyVetoException pve) {
            throw new JemmyException("Mounting FS: "+mountPoint+" failed.", pve);
        }
    }
    return true;
}
 
Example #15
Source File: CustomWebServicesClientSupportProviderTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();
    File f = getWorkDir();
    assertTrue("work dir exists", f.exists());
    LocalFileSystem lfs = new LocalFileSystem ();
    lfs.setRootDirectory (f);
    Repository.getDefault ().addFileSystem (lfs);
    datadir = FileUtil.toFileObject(f);
    assertNotNull("no FileObject", datadir);
    nows = datadir.createData("custom", "nows");
    assertNotNull("no ws FileObject", nows);
    ws = datadir.createData("custom", "ws");
    assertNotNull("no ws FileObject", ws);
    jaxws = datadir.createData("custom", "jaxws");
    assertNotNull("no ws FileObject", jaxws);
    both = datadir.createData("custom", "both");
    assertNotNull("no ws FileObject", both);
}
 
Example #16
Source File: DataObjectSaveAsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the testing environment by creating testing folders
 * on the system file system.
 */
@Override
protected void setUp() throws Exception {
    clearWorkDir();
    MockLookup.setInstances(new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
            new Pool());
    
    MyDL1 loader1 = MyDL1.getLoader(MyDL1.class);
    MyDL2 loader2 = MyDL2.getLoader(MyDL2.class);

    FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
    dfs.refresh (true);        
    
    FileObject fo = FileUtil.createData (dfs.getRoot (), "a.ext1");
    obj1 = DataObject.find (fo);
    
    assertEquals ("The correct loader", loader1, obj1.getLoader ());
    
    fo = FileUtil.createData (dfs.getRoot (), "b.ext2");
    obj2 = DataObject.find (fo);
    
    assertEquals ("The correct loader", loader2, obj2.getLoader ());
    
    sfs = new PCL ();
    dfs.addFileChangeListener (sfs);
}
 
Example #17
Source File: GLFFilesCustomEditor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static List<String> getSupportedMimeTypes () {
    List<String> result = new ArrayList<String> ();
    FileSystem fs = Repository.getDefault ().getDefaultFileSystem ();
    FileObject root = fs.findResource ("Editors");
    Enumeration e1 = root.getChildren (false);
    while (e1.hasMoreElements ()) {
        FileObject f1 = (FileObject) e1.nextElement ();
        if (f1.isData ()) continue;
        Enumeration e2 = f1.getChildren (false);
        while (e2.hasMoreElements ()) {
            FileObject f2 = (FileObject) e2.nextElement ();
            if (f2.isData ()) continue;
            FileObject fo = f2.getFileObject ("language.nbs");
            if (fo == null) continue;
            result.add (f1.getName () + '/' + f2.getName ());
        }
    }
    return result;
}
 
Example #18
Source File: DataShadowTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void setUp() throws Exception {
    
    lfs = FileUtil.getConfigRoot().getFileSystem();
    
    FileObject[] delete = lfs.getRoot().getChildren();
    for (int i = 0; i < delete.length; i++) {
        delete[i].delete();
    }
    
    FileObject fo = FileUtil.createData (lfs.getRoot (), getName () + "/folder/original.txt");
    assertNotNull(fo);
    original = DataObject.find (fo);
    assertFalse ("Just to be sure that this is not shadow", original instanceof DataShadow);
    assertFalse ("And is some kind of subclass of DO", original.getClass () == DataObject.class);
    fo = FileUtil.createFolder (lfs.getRoot (), getName () + "/modify");
    assertNotNull(fo);
    assertTrue (fo.isFolder ());
    folder = DataFolder.findFolder (fo);
    
    Repository.getDefault ().addFileSystem (lfs);
    
    err = Logger.getLogger(getName());
}
 
Example #19
Source File: DefaultDataObjectLookupTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();

    registerIntoLookup(new DD());

    DD x = (DD)Lookup.getDefault().lookup(DD.class);
    assertNotNull("DD is there", x);

    String fsstruct [] = new String [] {
        "AA/a.test"
    };

    TestUtilHid.destroyLocalFileSystem(getName());
    lfs = TestUtilHid.createLocalFileSystem(getWorkDir(), fsstruct);
    Repository.getDefault().addFileSystem(lfs);

    FileObject fo = lfs.findResource("AA/a.test");
    assertNotNull("file not found", fo);
    obj = DataObject.find(fo);

    assertEquals("The right class", obj.getClass(), DefaultDataObject.class);

    assertTrue("Designed to run inside of AWT", SwingUtilities.isEventDispatchThread());
    DD.options = null;
    DD.disableTest = false;
}
 
Example #20
Source File: DataLoaderGetActionsCompatibilityTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the testing environment by creating testing folders
 * on the system file system.
 */
@Override
protected void setUp() throws Exception {
    clearWorkDir();
    MockLookup.setInstances(
            new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
            new Pool());
    
    MyDL loader = MyDL.getLoader(MyDL.class);

    FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
    dfs.refresh (true);        
    
    FileObject fo = FileUtil.createData (dfs.getRoot (), "a.txt");
    obj = DataObject.find (fo);
    
    assertEquals ("The correct loader", loader, obj.getLoader ());
    
    node = obj.getNodeDelegate ();    
    
    sfs = new PCL ();
    dfs.addFileChangeListener (sfs);
}
 
Example #21
Source File: BaseCaretTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException {
    Collection<URL> allUrls = new ArrayList<URL>();
    for (String u : additionalLayers) {
        if (u.charAt(0) == '/') {
            u = u.substring(1);
        }
        for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(u); en.hasMoreElements(); ) {
            allUrls.add(en.nextElement());
        }
    }
    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(allUrls.toArray(new URL[allUrls.size()]));
    
    Repository repository = new Repository(system);
    Object[] lookupContent = new Object[additionalLookupContent.length + 1];
    
    System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length);
    
    lookupContent[0] = repository;
    
    setLookup(lookupContent, BaseCaretTest.class.getClassLoader());
}
 
Example #22
Source File: BaseFileObjectTestHid.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void testFileUtilFromFile () throws Exception {        
    assertNotNull(root);
    
    File f = FileUtil.normalizeFile(getWorkDir());
    IgnoreDirFileSystem ifs = new IgnoreDirFileSystem();
    ifs.setRootDirectory(f);
    
    Repository.getDefault().addFileSystem(ifs);
    Repository.getDefault().addFileSystem(testedFS);
    
    FileObject[] fos = FileUtil.fromFile(f);
    assertTrue(fos.length > 0);
    assertEquals(fos[0].getFileSystem(), testedFS );
    
}
 
Example #23
Source File: XMLDataObjectMimeTypeTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void tearDown() throws Exception {
    waitForAWT();
    DD.disableTest = true;

    super.tearDown();
    if (obj != null) {
        CloseCookie cc;
        cc = obj.getCookie(CloseCookie.class);
        if (cc != null) {
            DD.toReturn = NotifyDescriptor.NO_OPTION;
            cc.close();
        }
    }
    Repository.getDefault().removeFileSystem(lfs);

    waitForAWT();
}
 
Example #24
Source File: HandlerTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
protected void tearDown() throws Exception {
for (FileSystem fs : Repository.getDefault().toArray()) {
        Repository.getDefault().removeFileSystem(fs);
    }

    
    List<Reference> gc = new ArrayList<Reference>();
    
    for (Object key : TimesCollectorPeer.getDefault().getFiles()) {
        gc.add(new WeakReference<Object>(key));
    }
    
    for (Reference<?> reference : gc) {
        assertGC("GC it", reference);
    }

}
 
Example #25
Source File: CustomJAXWSSupportProviderTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();
    File f = getWorkDir();
    assertTrue("work dir exists", f.exists());
    LocalFileSystem lfs = new LocalFileSystem ();
    lfs.setRootDirectory (f);
    Repository.getDefault ().addFileSystem (lfs);
    datadir = FileUtil.toFileObject(f);
    assertNotNull("no FileObject", datadir);
    ws = datadir.createData("custom", "ws");
    assertNotNull("no ws FileObject", ws);
    nows = datadir.createData("custom", "nows");
    assertNotNull("no ws FileObject", nows);
}
 
Example #26
Source File: CustomWebServicesViewProviderTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    File f = getWorkDir();
    assertTrue("work dir exists", f.exists());
    LocalFileSystem lfs = new LocalFileSystem ();
    lfs.setRootDirectory (f);
    Repository.getDefault ().addFileSystem (lfs);
    datadir = FileUtil.toFileObject(f);
    assertNotNull("no FileObject", datadir);
    ws = datadir.createData("custom", "ws");
    assertNotNull("no ws FileObject", ws);
    nows = datadir.createData("custom", "nows");
    assertNotNull("no ws FileObject", nows);
}
 
Example #27
Source File: CustomWebServicesClientViewProviderTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();
    File f = getWorkDir();
    assertTrue("work dir exists", f.exists());
    LocalFileSystem lfs = new LocalFileSystem ();
    lfs.setRootDirectory (f);
    Repository.getDefault ().addFileSystem (lfs);
    datadir = FileUtil.toFileObject(f);
    assertNotNull("no FileObject", datadir);
    ws = datadir.createData("custom", "ws");
    assertNotNull("no ws FileObject", ws);
    nows = datadir.createData("custom", "nows");
    assertNotNull("no ws FileObject", nows);
}
 
Example #28
Source File: CustomWebServicesSupportProviderTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    File f = getWorkDir();
    assertTrue("work dir exists", f.exists());
    LocalFileSystem lfs = new LocalFileSystem ();
    lfs.setRootDirectory (f);
    Repository.getDefault ().addFileSystem (lfs);
    datadir = FileUtil.toFileObject(f);
    assertNotNull("no FileObject", datadir);
    ws = datadir.createData("custom", "ws");
    assertNotNull("no ws FileObject", ws);
    nows = datadir.createData("custom", "nows");
    assertNotNull("no ws FileObject", nows);
}
 
Example #29
Source File: CustomProviderCarTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();
    File f = getDataDir();
    assertTrue("example dir exists", f.exists());
    LocalFileSystem lfs = new LocalFileSystem ();
    lfs.setRootDirectory (f);
    Repository.getDefault ().addFileSystem (lfs);
    datadir = FileUtil.toFileObject (f);
    assertNotNull ("no FileObject", datadir);
}
 
Example #30
Source File: ColorsManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static String getBundleName(Language l) {
    FileSystem fs = Repository.getDefault().getDefaultFileSystem();
    FileObject root = fs.findResource("Editors/" + l.getMimeType()); // NOI18N
    Object attrValue = root.getAttribute("SystemFileSystem.localizingBundle"); //NOI18N
    // [PENDING] if (bundleName == null) ... check for bundle name in nbs file
    return (String) attrValue;
}