本文整理汇总了Java中org.sdnplatform.sync.internal.store.IStore.get方法的典型用法代码示例。如果您正苦于以下问题:Java IStore.get方法的具体用法?Java IStore.get怎么用?Java IStore.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sdnplatform.sync.internal.store.IStore
的用法示例。
在下文中一共展示了IStore.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetVersions
import org.sdnplatform.sync.internal.store.IStore; //导入方法依赖的package包/类
@Test
public void testGetVersions() throws Exception {
List<K> keys = getKeys(2);
K key = keys.get(0);
V value = getValue();
IStore<K, V> store = getStore();
store.put(key, Versioned.value(value));
List<Versioned<V>> versioneds = store.get(key);
List<IVersion> versions = store.getVersions(key);
assertEquals(1, versioneds.size());
assertTrue(versions.size() > 0);
for(int i = 0; i < versions.size(); i++)
assertEquals(versioneds.get(0).getVersion(), versions.get(i));
assertEquals(0, store.getVersions(keys.get(1)).size());
}
示例2: testEmptyByteArray
import org.sdnplatform.sync.internal.store.IStore; //导入方法依赖的package包/类
@Test
public void testEmptyByteArray() throws Exception {
IStore<ByteArray, byte[]> store = getStore();
Versioned<byte[]> bytes = new Versioned<byte[]>(new byte[0]);
store.put(new ByteArray(new byte[0]), bytes);
List<Versioned<byte[]>> found = store.get(new ByteArray(new byte[0]));
assertEquals("Incorrect number of results.", 1, found.size());
bassertEquals("Get doesn't equal put.", bytes, found.get(0));
}
示例3: testPutNullValue
import org.sdnplatform.sync.internal.store.IStore; //导入方法依赖的package包/类
@Test
public void testPutNullValue() throws Exception {
IStore<K,V> store = getStore();
K key = getKey();
store.put(key, new Versioned<V>(null));
List<Versioned<V>> found = store.get(key);
assertEquals("Wrong number of values.", 1, found.size());
assertEquals("Returned non-null value.", null,
found.get(0).getValue());
}
示例4: testGetAndDeleteNonExistentKey
import org.sdnplatform.sync.internal.store.IStore; //导入方法依赖的package包/类
@Test
public void testGetAndDeleteNonExistentKey() throws Exception {
K key = getKey();
IStore<K, V> store = getStore();
List<Versioned<V>> found = store.get(key);
assertEquals("Found non-existent key: " + found, 0, found.size());
}
示例5: testFetchedEqualsPut
import org.sdnplatform.sync.internal.store.IStore; //导入方法依赖的package包/类
@Test
public void testFetchedEqualsPut() throws Exception {
K key = getKey();
IStore<K, V> store = getStore();
VectorClock clock = getClock(1, 1, 2, 3, 3, 4);
V value = getValue();
assertEquals("Store not empty at start!", 0, store.get(key).size());
Versioned<V> versioned = new Versioned<V>(value, clock);
store.put(key, versioned);
List<Versioned<V>> found = store.get(key);
assertEquals("Should only be one version stored.", 1, found.size());
assertTrue("Values not equal!", valuesEqual(versioned.getValue(), found.get(0).getValue()));
}