當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractPreferences.node方法代碼示例

本文整理匯總了Java中java.util.prefs.AbstractPreferences.node方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractPreferences.node方法的具體用法?Java AbstractPreferences.node怎麽用?Java AbstractPreferences.node使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.prefs.AbstractPreferences的用法示例。


在下文中一共展示了AbstractPreferences.node方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testGetKey

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Test is correct, functionality checked in separate Mock class.",
    method = "getKey",
    args = {}
)
public void testGetKey() {
    AbstractPreferences parent = (AbstractPreferences) Preferences
            .userNodeForPackage(Preferences.class);

    AbstractPreferences pref = (AbstractPreferences) parent.node("mock");

    MockPreferenceChangeListener pl = new MockPreferenceChangeListener(
            MockPreferenceChangeListener.TEST_GET_KEY);
    pref.addPreferenceChangeListener(pl);
    try {
        pref.putInt("key_int", Integer.MAX_VALUE);
        assertEquals(1, pl.getChanged());
        assertTrue(pl.getResult());
        pl.reset();
    } finally {
        pref.removePreferenceChangeListener(pl);
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:25,代碼來源:PreferenceChangeEventTest.java

示例2: testGetNode

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Test is correct, functionality checked in separate Mock class.",
    method = "getNode",
    args = {}
)
public void testGetNode() {
    AbstractPreferences parent = (AbstractPreferences) Preferences
            .userNodeForPackage(Preferences.class);

    AbstractPreferences pref = (AbstractPreferences) parent.node("mock");

    MockPreferenceChangeListener pl = new MockPreferenceChangeListener(
            MockPreferenceChangeListener.TEST_GET_NODE);
    pref.addPreferenceChangeListener(pl);
    try {
        pref.putInt("key_int", Integer.MAX_VALUE);
        assertEquals(1, pl.getChanged());
        assertTrue(pl.getResult());
        pl.reset();

    } finally {
        pref.removePreferenceChangeListener(pl);
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:26,代碼來源:PreferenceChangeEventTest.java

示例3: testGetChild

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Test is correct, functionality checked in separate Mock class.",
    method = "getChild",
    args = {}
)
public void testGetChild() throws BackingStoreException {

    AbstractPreferences parent = (AbstractPreferences) Preferences
            .userNodeForPackage(Preferences.class);

    AbstractPreferences pref = (AbstractPreferences) parent.node("mock");

    MockNodeChangeListener nl = new MockNodeChangeListener(
            MockNodeChangeListener.TEST_GET_CHILD);
    try {
        pref.addNodeChangeListener(nl);
        Preferences child1 = pref.node("mock1");
        nl.waitForEvent();
        assertEquals(1, nl.getAdded());
        assertTrue(nl.getAddResult());
        nl.reset();
        child1.removeNode();
        nl.waitForEvent();
        assertEquals(1, nl.getRemoved());
        assertTrue(nl.getRemoveResult());
        nl.reset();
    } finally {
        pref.removeNodeChangeListener(nl);
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:32,代碼來源:NodeChangeEventTest.java

示例4: testGetParent

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Test is correct, functionality checked in separate Mock class.",
    method = "getParent",
    args = {}
)
public void testGetParent() throws BackingStoreException {

    AbstractPreferences parent = (AbstractPreferences) Preferences
            .userNodeForPackage(Preferences.class);

    AbstractPreferences pref = (AbstractPreferences) parent.node("mock");

    MockNodeChangeListener nl = new MockNodeChangeListener(
            MockNodeChangeListener.TEST_GET_CHILD);
    try {
        pref.addNodeChangeListener(nl);
        Preferences child1 = pref.node("mock1");
        nl.waitForEvent();
        assertEquals(1, nl.getAdded());
        assertTrue(nl.getAddResult());
        nl.reset();
        child1.removeNode();
        nl.waitForEvent();
        assertEquals(1, nl.getRemoved());
        assertTrue(nl.getRemoveResult());
        nl.reset();
    } finally {
        pref.removeNodeChangeListener(nl);
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:32,代碼來源:NodeChangeEventTest.java

示例5: testGetNewValue

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Test is correct, functionality checked in separate Mock class.",
    method = "getNewValue",
    args = {}
)
public void testGetNewValue() {
    AbstractPreferences parent = (AbstractPreferences) Preferences
            .userNodeForPackage(Preferences.class);

    AbstractPreferences pref = (AbstractPreferences) parent.node("mock");

    MockPreferenceChangeListener pl = new MockPreferenceChangeListener(
            MockPreferenceChangeListener.TEST_GET_NEW_VALUE);
    pref.addPreferenceChangeListener(pl);
    try {
        pref.putInt("key_int", Integer.MAX_VALUE);
        assertEquals(1, pl.getChanged());
        assertTrue(pl.getResult());
        pl.reset();

        pref.putInt("key_int", Integer.MAX_VALUE);
        assertEquals(1, pl.getChanged());
        assertTrue(pl.getResult());
        pl.reset();
    } finally {
        pref.removePreferenceChangeListener(pl);
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:30,代碼來源:PreferenceChangeEventTest.java

示例6: setUp

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
protected void setUp() throws Exception {
    super.setUp();

    root = (AbstractPreferences) Preferences.userRoot();
    parent = (AbstractPreferences) Preferences.userNodeForPackage(this.getClass());

    pref = (AbstractPreferences) parent.node(nodeName);
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:9,代碼來源:AbstractPreferencesTest.java

示例7: setUp

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {
    super.setUp();
    root = (AbstractPreferences) Preferences.userRoot();
    parent = (AbstractPreferences) Preferences
    .userNodeForPackage(Preferences.class);
    // FIXME: change here is dangerous
    // pref = new MockAbstractPreferences((AbstractPreferences) parent,
    // "mock");

    pref = (AbstractPreferences) parent.node("mock");
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:AbstractPreferencesTest.java

示例8: setUp

import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
protected void setUp() throws Exception {
	super.setUp();
	root = (AbstractPreferences) Preferences.userRoot();
	parent = (AbstractPreferences) Preferences
			.userNodeForPackage(Preferences.class);
	// FIXME: change here is dangerous
	// pref = new MockAbstractPreferences((AbstractPreferences) parent,
	// "mock");

	pref = (AbstractPreferences) parent.node("mock");
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:12,代碼來源:AbstractPreferencesTest.java


注:本文中的java.util.prefs.AbstractPreferences.node方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。