本文整理汇总了Java中net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity类的典型用法代码示例。如果您正苦于以下问题:Java SyncEntity类的具体用法?Java SyncEntity怎么用?Java SyncEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyncEntity类属于net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation包,在下文中一共展示了SyncEntity类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: goToMaster
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
/**
* Synchronously transition from SLAVE to MASTER. By iterating through
* the store and learning all devices from the store
*/
private void goToMaster() {
if (logger.isDebugEnabled()) {
logger.debug("Transitioning to MASTER role");
}
cntTransitionToMaster.increment();
IClosableIterator<Map.Entry<String,Versioned<DeviceSyncRepresentation>>>
iter = null;
try {
iter = storeClient.entries();
} catch (SyncException e) {
cntSyncException.increment();
logger.error("Failed to read devices from sync store", e);
return;
}
try {
while(iter.hasNext()) {
Versioned<DeviceSyncRepresentation> versionedDevice =
iter.next().getValue();
DeviceSyncRepresentation storedDevice =
versionedDevice.getValue();
if (storedDevice == null)
continue;
cntDevicesFromStore.increment();
for(SyncEntity se: storedDevice.getEntities()) {
learnDeviceByEntity(se.asEntity());
}
}
} finally {
if (iter != null)
iter.close();
}
storeConsolidateTask.reschedule(initialSyncStoreConsolidateMs,
TimeUnit.MILLISECONDS);
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:39,代码来源:DeviceManagerImpl.java
示例2: testSyncEntity
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
@Test
public void testSyncEntity() {
Date d1 = new Date();
Date d2 = new Date(1);
Entity e1 = new Entity(MacAddress.of(1L), VlanVid.ofVlan(2), IPv4Address.of(3), IPv6Address.NONE, DatapathId.of(4L), OFPort.of(5), d1);
e1.setActiveSince(d2);
SyncEntity se1 = new SyncEntity(e1);
assertEntityEquals(e1, se1);
assertEquals(1L, se1.macAddress);
assertEquals(2, se1.vlan);
assertEquals(3, se1.ipv4Address);
assertEquals(4L, se1.switchDPID);
assertEquals(5, se1.switchPort);
assertEquals(d1, se1.lastSeenTimestamp);
assertEquals(d2, se1.activeSince);
assertNotSame(d1, se1.lastSeenTimestamp);
assertNotSame(d2, se1.activeSince);
Entity e2 = new Entity(MacAddress.of(42L), VlanVid.ZERO, IPv4Address.NONE, IPv6Address.NONE, DatapathId.NONE, OFPort.ZERO, Entity.NO_DATE);
SyncEntity se2 = new SyncEntity(e2);
assertEntityEquals(e2, se2);
SyncEntity se3 = new SyncEntity();
SyncEntity se4 = new SyncEntity();
se3.lastSeenTimestamp = new Date(1000);
se4.lastSeenTimestamp = new Date(2000);
assertTrue("", se3.compareTo(se4) < 0);
assertTrue("", se4.compareTo(se3) > 0);
se4.lastSeenTimestamp = new Date(1000);
assertTrue("", se3.compareTo(se4) == 0);
assertTrue("", se4.compareTo(se3) == 0);
se4.lastSeenTimestamp = new Date(500);
assertTrue("", se3.compareTo(se4) > 0);
assertTrue("", se4.compareTo(se3) < 0);
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:36,代码来源:DeviceManagerImplTest.java
示例3: testDeviceSyncRepresentationBasics
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
@Test
public void testDeviceSyncRepresentationBasics() {
DeviceSyncRepresentation dsr = new DeviceSyncRepresentation();
assertNull(dsr.getKey());
assertNull(dsr.getEntities());
dsr.setKey("MyKey");
assertEquals("MyKey", dsr.getKey());
assertEquals("MyKey", dsr.toString());
List<SyncEntity> entities = new ArrayList<SyncEntity>();
Entity e1a = new Entity(MacAddress.of(1L), VlanVid.ofVlan(2), IPv4Address.of(3), IPv6Address.NONE, DatapathId.of(4L), OFPort.of(5), new Date(1000));
Entity e1b = new Entity(MacAddress.of(1L), VlanVid.ofVlan(2), IPv4Address.NONE, IPv6Address.NONE, DatapathId.of(4L), OFPort.of(5), new Date(1));
entities.add(new SyncEntity(e1a));
entities.add(new SyncEntity(e1b));
// e1b comes before e1 (lastSeen) but we add it after it to test
// sorting
dsr.setEntities(entities);
assertEquals(2, dsr.getEntities().size());
// e1b has earlier time
assertEquals(e1b, dsr.getEntities().get(0).asEntity());
assertEquals(e1a, dsr.getEntities().get(1).asEntity());
dsr.setKey(null);
dsr.setEntities(null);
assertNull(dsr.getKey());
assertNull(dsr.getEntities());
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:29,代码来源:DeviceManagerImplTest.java
示例4: assertEntityEquals
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
private static void assertEntityEquals(Entity expected, SyncEntity actual) {
assertNotNull(actual);
assertNotNull(expected);
Entity actualEntity = actual.asEntity();
assertEquals("entityFields", expected, actualEntity);
assertEquals("lastSeenTimestamp",
expected.getLastSeenTimestamp(),
actualEntity.getLastSeenTimestamp());
assertEquals("activeSince",
expected.getActiveSince(), actualEntity.getActiveSince());
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:12,代码来源:DeviceManagerImplTest.java
示例5: testSyncEntity
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
@Test
public void testSyncEntity() {
Date d1 = new Date();
Date d2 = new Date(0);
Entity e1 = new Entity(MacAddress.of(1L), VlanVid.ofVlan(2), IPv4Address.of(3), DatapathId.of(4L), OFPort.of(5), d1);
e1.setActiveSince(d2);
SyncEntity se1 = new SyncEntity(e1);
assertEntityEquals(e1, se1);
assertEquals(1L, se1.macAddress);
assertEquals(2, se1.vlan);
assertEquals(3, se1.ipv4Address);
assertEquals(4L, se1.switchDPID);
assertEquals(5, se1.switchPort);
assertEquals(d1, se1.lastSeenTimestamp);
assertEquals(d2, se1.activeSince);
assertNotSame(d1, se1.lastSeenTimestamp);
assertNotSame(d2, se1.activeSince);
Entity e2 = new Entity(MacAddress.of(42L), null, null, null, null, null);
SyncEntity se2 = new SyncEntity(e2);
assertEntityEquals(e2, se2);
SyncEntity se3 = new SyncEntity();
SyncEntity se4 = new SyncEntity();
se3.lastSeenTimestamp = new Date(1000);
se4.lastSeenTimestamp = new Date(2000);
assertTrue("", se3.compareTo(se4) < 0);
assertTrue("", se4.compareTo(se3) > 0);
se4.lastSeenTimestamp = new Date(1000);
assertTrue("", se3.compareTo(se4) == 0);
assertTrue("", se4.compareTo(se3) == 0);
se4.lastSeenTimestamp = new Date(500);
assertTrue("", se3.compareTo(se4) > 0);
assertTrue("", se4.compareTo(se3) < 0);
}
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:36,代码来源:DeviceManagerImplTest.java
示例6: testDeviceSyncRepresentationBasics
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
@Test
public void testDeviceSyncRepresentationBasics() {
DeviceSyncRepresentation dsr = new DeviceSyncRepresentation();
assertNull(dsr.getKey());
assertNull(dsr.getEntities());
dsr.setKey("MyKey");
assertEquals("MyKey", dsr.getKey());
assertEquals("MyKey", dsr.toString());
List<SyncEntity> entities = new ArrayList<SyncEntity>();
Entity e1a = new Entity(MacAddress.of(1L), VlanVid.ofVlan(2), IPv4Address.of(3), DatapathId.of(4L), OFPort.of(5), new Date(1000));
Entity e1b = new Entity(MacAddress.of(1L), VlanVid.ofVlan(2), null, DatapathId.of(4L), OFPort.of(5), new Date(0));
entities.add(new SyncEntity(e1a));
entities.add(new SyncEntity(e1b));
// e1b comes before e1 (lastSeen) but we add it after it to test
// sorting
dsr.setEntities(entities);
assertEquals(2, dsr.getEntities().size());
// e1b has earlier time
assertEquals(e1b, dsr.getEntities().get(0).asEntity());
assertEquals(e1a, dsr.getEntities().get(1).asEntity());
dsr.setKey(null);
dsr.setEntities(null);
assertNull(dsr.getKey());
assertNull(dsr.getEntities());
}
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:29,代码来源:DeviceManagerImplTest.java
示例7: goToMaster
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
/**
* Synchronously transition from SLAVE to MASTER. By iterating through
* the store and learning all devices from the store
*/
private void goToMaster() {
if (logger.isDebugEnabled()) {
logger.debug("Transitioning to MASTER role");
}
cntTransitionToMaster.updateCounterWithFlush();
IClosableIterator<Map.Entry<String,Versioned<DeviceSyncRepresentation>>>
iter = null;
try {
iter = storeClient.entries();
} catch (SyncException e) {
cntSyncException.updateCounterWithFlush();
logger.error("Failed to read devices from sync store", e);
return;
}
try {
while(iter.hasNext()) {
Versioned<DeviceSyncRepresentation> versionedDevice =
iter.next().getValue();
DeviceSyncRepresentation storedDevice =
versionedDevice.getValue();
if (storedDevice == null)
continue;
cntDevicesFromStore.updateCounterWithFlush();
for(SyncEntity se: storedDevice.getEntities()) {
learnDeviceByEntity(se.asEntity());
}
}
} finally {
if (iter != null)
iter.close();
}
storeConsolidateTask.reschedule(initialSyncStoreConsolidateMs,
TimeUnit.MILLISECONDS);
}
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:39,代码来源:DeviceManagerImpl.java
示例8: testSyncEntity
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
@Test
public void testSyncEntity() {
Date d1 = new Date();
Date d2 = new Date(0);
Entity e1 = new Entity(1L, (short)2, 3, 4L, 5, d1);
e1.setActiveSince(d2);
SyncEntity se1 = new SyncEntity(e1);
assertEntityEquals(e1, se1);
assertEquals(1L, se1.macAddress);
assertEquals(Short.valueOf((short)2), se1.vlan);
assertEquals(Integer.valueOf(3), se1.ipv4Address);
assertEquals(Long.valueOf(4L), se1.switchDPID);
assertEquals(Integer.valueOf(5), se1.switchPort);
assertEquals(d1, se1.lastSeenTimestamp);
assertEquals(d2, se1.activeSince);
assertNotSame(d1, se1.lastSeenTimestamp);
assertNotSame(d2, se1.activeSince);
Entity e2 = new Entity(42L, null, null, null, null, null);
SyncEntity se2 = new SyncEntity(e2);
assertEntityEquals(e2, se2);
SyncEntity se3 = new SyncEntity();
SyncEntity se4 = new SyncEntity();
se3.lastSeenTimestamp = new Date(1000);
se4.lastSeenTimestamp = new Date(2000);
assertTrue("", se3.compareTo(se4) < 0);
assertTrue("", se4.compareTo(se3) > 0);
se4.lastSeenTimestamp = new Date(1000);
assertTrue("", se3.compareTo(se4) == 0);
assertTrue("", se4.compareTo(se3) == 0);
se4.lastSeenTimestamp = new Date(500);
assertTrue("", se3.compareTo(se4) > 0);
assertTrue("", se4.compareTo(se3) < 0);
}
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:36,代码来源:DeviceManagerImplTest.java
示例9: testDeviceSyncRepresentationBasics
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
@Test
public void testDeviceSyncRepresentationBasics() {
DeviceSyncRepresentation dsr = new DeviceSyncRepresentation();
assertNull(dsr.getKey());
assertNull(dsr.getEntities());
dsr.setKey("MyKey");
assertEquals("MyKey", dsr.getKey());
assertEquals("MyKey", dsr.toString());
List<SyncEntity> entities = new ArrayList<SyncEntity>();
Entity e1a = new Entity(1L, (short)2, 3, 4L, 5, new Date(1000));
Entity e1b = new Entity(1L, (short)2, null, 4L, 5, new Date(0));
entities.add(new SyncEntity(e1a));
entities.add(new SyncEntity(e1b));
// e1b comes before e1 (lastSeen) but we add it after it to test
// sorting
dsr.setEntities(entities);
assertEquals(2, dsr.getEntities().size());
// e1b has earlier time
assertEquals(e1b, dsr.getEntities().get(0).asEntity());
assertEquals(e1a, dsr.getEntities().get(1).asEntity());
dsr.setKey(null);
dsr.setEntities(null);
assertNull(dsr.getKey());
assertNull(dsr.getEntities());
}
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:29,代码来源:DeviceManagerImplTest.java
示例10: assertEntityEquals
import net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity; //导入依赖的package包/类
private static void assertEntityEquals(Entity expected, SyncEntity actual) {
assertNotNull(actual);
assertNotNull(expected);
Entity actualEntity = actual.asEntity();
assertEquals("entityFields", expected, actualEntity);
assertEquals("lastSeenTimestamp",
expected.getLastSeenTimestamp(),
actualEntity.getLastSeenTimestamp());
assertEquals("activeSince",
expected.getActiveSince(), actualEntity.getActiveSince());
}
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:12,代码来源:DeviceManagerImplTest.java
注:本文中的net.floodlightcontroller.devicemanager.internal.DeviceSyncRepresentation.SyncEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论