当前位置: 首页>>代码示例>>Java>>正文


Java AbstractSyncManager类代码示例

本文整理汇总了Java中org.sdnplatform.sync.internal.AbstractSyncManager的典型用法代码示例。如果您正苦于以下问题:Java AbstractSyncManager类的具体用法?Java AbstractSyncManager怎么用?Java AbstractSyncManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractSyncManager类属于org.sdnplatform.sync.internal包,在下文中一共展示了AbstractSyncManager类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBasicOneNode

import org.sdnplatform.sync.internal.AbstractSyncManager; //导入依赖的package包/类
@Test
public void testBasicOneNode() throws Exception {
    AbstractSyncManager sync = syncManagers[0];
    IStoreClient<Key, TBean> testClient =
            sync.getStoreClient("global", Key.class, TBean.class);
    Key k = new Key("com.bigswitch.bigsync.internal", "test");
    TBean tb = new TBean("hello", 42);
    TBean tb2 = new TBean("hello", 84);
    TBean tb3 = new TBean("hello", 126);
    
    assertNotNull(testClient.get(k));
    assertNull(testClient.get(k).getValue());
    
    testClient.put(k, tb);
    Versioned<TBean> result = testClient.get(k);
    assertEquals(result.getValue(), tb);

    result.setValue(tb2);
    testClient.put(k, result);

    try {
        result.setValue(tb3);
        testClient.put(k, result);
        fail("Should get ObsoleteVersionException");
    } catch (ObsoleteVersionException e) {
        // happy town
    }

    result = testClient.get(k);
    assertEquals(tb2, result.getValue());
    
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:33,代码来源:SyncManagerTest.java

示例2: testIterator

import org.sdnplatform.sync.internal.AbstractSyncManager; //导入依赖的package包/类
@Test
public void testIterator() throws Exception {
    AbstractSyncManager sync = syncManagers[0];
    IStoreClient<Key, TBean> testClient =
            sync.getStoreClient("local", Key.class, TBean.class);
    
    HashMap<Key, TBean> testMap = new HashMap<Key, TBean>();
    for (int i = 0; i < 100; i++) {
        Key k = new Key("com.bigswitch.bigsync.internal", "test" + i);
        TBean tb = new TBean("value", i);
        testMap.put(k, tb);
        testClient.put(k, tb);
    }
    
    IClosableIterator<Entry<Key, Versioned<TBean>>> iter = 
            testClient.entries();
    int size = 0;
    try {
        while (iter.hasNext()) {
            Entry<Key, Versioned<TBean>> e = iter.next();
            assertEquals(testMap.get(e.getKey()), e.getValue().getValue());
            size += 1;
        }
    } finally {
        iter.close();
    }
    assertEquals(testMap.size(), size);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:29,代码来源:SyncManagerTest.java


注:本文中的org.sdnplatform.sync.internal.AbstractSyncManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。