Package java.util.prefs

Examples of java.util.prefs.Preferences.nodeExists()


          p.removeNode();
        }
        else if (type.equals("local"))
        {
          final Properties props = new Properties();
          if (p.nodeExists("properties"))
          {
            final Preferences preferences = p.node("properties");
            final String[] strings = preferences.keys();
            for (int j = 0; j < strings.length; j++)
            {
View Full Code Here


    {
        Preferences prefs = Preferences.userRoot();

        final String test_node = "removeTest";

        assertFalse(prefs.nodeExists(test_node));

        Preferences removeNode = prefs.node(test_node);

        assertNotNull(removeNode);
View Full Code Here

    {
        Preferences prefs = Preferences.userRoot();

        final String test_node = "removeTest";

        assertFalse(prefs.nodeExists(test_node));

        Preferences removeNode = prefs.node(test_node);

        assertNotNull(removeNode);
View Full Code Here

                    .getResourceAsStream("/prefs/java/util/prefs/userprefs.xml");
            Preferences.importPreferences(in);

            prefs = Preferences.userNodeForPackage(PreferencesTest.class);
            assertEquals(1, prefs.childrenNames().length);
            assertTrue(prefs.nodeExists("mock/child/grandson"));
            assertEquals("newvalue", prefs.get("prefskey", null));
            assertEquals("oldvalue2", prefs.get("prefskey2", null));
            assertEquals("newvalue3", prefs.get("prefskey3", null));

            in = PreferencesTest.class
View Full Code Here

        assertTrue(pref.nodeExists("child"));
        assertTrue(pref.nodeExists("child/grandchild"));
        grandchild.removeNode();
        assertTrue(pref.nodeExists("child"));
        assertFalse(pref.nodeExists("child/grandchild"));
        assertFalse(grandchild.nodeExists(""));

        assertFalse(pref.nodeExists("child2/grandchild"));
        pref.node("child2/grandchild");
        assertTrue(pref.nodeExists("child2/grandchild"));
    }
View Full Code Here

        pref.removeNode();

        assertFalse(child.nodeExists(""));
        assertFalse(child1.nodeExists(""));
        assertFalse(grandchild.nodeExists(""));
        assertFalse(pref.nodeExists(""));
    }

    // public void testAddNodeChangeListener() throws BackingStoreException {
    // try {
View Full Code Here

      if ( type == SYSTEM_PREF_TYPE )
        directory_service_root = Preferences.systemNodeForPackage(Configuration.class);
      else
        directory_service_root = Preferences.userNodeForPackage(Configuration.class);
                                                                                                                                       
      return directory_service_root.nodeExists(config);
    }
    catch ( java.util.prefs.BackingStoreException bse ) {
      throw new ConfigurationException(bse.toString());
    }
  }
View Full Code Here

        assertTrue(pref.nodeExists("child"));
        assertTrue(pref.nodeExists("child/grandchild"));
        grandchild.removeNode();
        assertTrue(pref.nodeExists("child"));
        assertFalse(pref.nodeExists("child/grandchild"));
        assertFalse(grandchild.nodeExists(""));

        assertFalse(pref.nodeExists("child2/grandchild"));
        pref.node("child2/grandchild");
        assertTrue(pref.nodeExists("child2/grandchild"));
    }
View Full Code Here

        pref.removeNode();

        assertFalse(child.nodeExists(""));
        assertFalse(child1.nodeExists(""));
        assertFalse(grandchild.nodeExists(""));
        assertFalse(pref.nodeExists(""));
    }

    // public void testAddNodeChangeListener() throws BackingStoreException {
    // try {
View Full Code Here

            in = PreferencesTest.class.getResourceAsStream("/prefs/java/util/prefs/userprefs.xml");
            Preferences.importPreferences(in);

            prefs = Preferences.userNodeForPackage(PreferencesTest.class);
            assertEquals(1, prefs.childrenNames().length);
            assertTrue(prefs.nodeExists("mock/child/grandson"));
            assertEquals("newvalue", prefs.get("prefskey", null));
            assertEquals("oldvalue2", prefs.get("prefskey2", null));
            assertEquals("newvalue3", prefs.get("prefskey3", null));

            in = PreferencesTest.class
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.