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


Java DeviceKeyEvent类代码示例

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


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

示例1: testRemoveKey

import org.onosproject.net.key.DeviceKeyEvent; //导入依赖的package包/类
/**
 * Tests removal of a device key from the store using the device key identifier.
 */
@Test
public void testRemoveKey() {
    DeviceKeyId deviceKeyId = DeviceKeyId.deviceKeyId(deviceKeyIdValue);
    DeviceKey deviceKey = DeviceKey.createDeviceKeyUsingCommunityName(deviceKeyId,
                                                                      deviceKeyLabel, deviceKeySnmpName);
    // Add the new device key using the device key manager
    manager.addKey(deviceKey);

    // Remove the device key from the store
    manager.removeKey(deviceKeyId);

    // Validate that the device key was removed from the store by querying it.
    deviceKey = manager.getDeviceKey(deviceKeyId);
    assertNull("The device key set should be empty.", deviceKey);

    // Validate that the following events were received in order,
    // DEVICE_KEY_ADDED, DEVICE_KEY_REMOVED.
    validateEvents(DeviceKeyEvent.Type.DEVICE_KEY_ADDED, DeviceKeyEvent.Type.DEVICE_KEY_REMOVED);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DeviceKeyManagerTest.java

示例2: testAddKey

import org.onosproject.net.key.DeviceKeyEvent; //导入依赖的package包/类
/**
 * Tests adding a device key using the device key manager.
 * This also tests the device key manager query methods.
 */
@Test
public void testAddKey() {
    DeviceKeyId deviceKeyId = DeviceKeyId.deviceKeyId(deviceKeyIdValue);

    DeviceKey deviceKey = DeviceKey.createDeviceKeyUsingCommunityName(deviceKeyId,
                                                                      deviceKeyLabel, deviceKeySnmpName);

    // Test to make sure that the device key store is empty
    Collection<DeviceKey> deviceKeys = manager.getDeviceKeys();
    assertTrue("The device key set should be empty.", deviceKeys.isEmpty());

    // Add the new device key using the device key manager.
    manager.addKey(deviceKey);

    // Test the getDeviceKeys method to make sure that the new device key exists
    deviceKeys = manager.getDeviceKeys();
    assertEquals("There should be one device key in the set.", deviceKeys.size(), 1);

    // Test the getDeviceKey method using the device key unique identifier
    deviceKey = manager.getDeviceKey(deviceKeyId);
    assertEquals("There should be one device key in the set.", deviceKeys.size(), 1);

    // Validate that only the DEVICE_KEY_ADDED event was received.
    validateEvents(DeviceKeyEvent.Type.DEVICE_KEY_ADDED);

}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:DeviceKeyManagerTest.java

示例3: testAddSameKey

import org.onosproject.net.key.DeviceKeyEvent; //导入依赖的package包/类
/**
 * Tests re-adding the same device key to the store but with a different label.
 */
@Test
public void testAddSameKey() {
    DeviceKeyId deviceKeyId = DeviceKeyId.deviceKeyId(deviceKeyIdValue);

    DeviceKey deviceKey = DeviceKey.createDeviceKeyUsingCommunityName(deviceKeyId,
                                                                      deviceKeyLabel, deviceKeySnmpName);

    // Add the first device key via the device key manager
    manager.addKey(deviceKey);

    // Test the getDeviceKeys method
    Collection<DeviceKey> deviceKeys = manager.getDeviceKeys();
    assertEquals("There should be one device key in the set.", deviceKeys.size(), 1);

    // Now let's create a new device key with the same device key identifier as exists in the store.
    DeviceKey deviceKey2 = DeviceKey.createDeviceKeyUsingCommunityName(deviceKeyId,
                                                                       deviceKeyLabel2, deviceKeySnmpName);

    // Replace the new device key in the store
    manager.addKey(deviceKey2);

    // Test the getDeviceKeys method to ensure that only 1 device key exists in the store.
    deviceKeys = manager.getDeviceKeys();
    assertEquals("There should be one device key in the set.", deviceKeys.size(), 1);

    // Test the getDeviceKey method using the device key unique identifier
    deviceKey = manager.getDeviceKey(deviceKeyId);
    assertNotNull("The device key should not be null.", deviceKey);
    assertEquals("The device key label should match.", deviceKeyLabel2, deviceKey.label());

    // Validate that the following events were received in order,
    // DEVICE_KEY_ADDED, DEVICE_KEY_REMOVED, DEVICE_KEY_ADDED.
    validateEvents(DeviceKeyEvent.Type.DEVICE_KEY_ADDED, DeviceKeyEvent.Type.DEVICE_KEY_UPDATED);

}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:DeviceKeyManagerTest.java

示例4: activate

import org.onosproject.net.key.DeviceKeyEvent; //导入依赖的package包/类
@Activate
public void activate() {
    store.setDelegate(delegate);
    eventDispatcher.addSink(DeviceKeyEvent.class, listenerRegistry);
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:DeviceKeyManager.java

示例5: deactivate

import org.onosproject.net.key.DeviceKeyEvent; //导入依赖的package包/类
@Deactivate
public void deactivate() {
    store.unsetDelegate(delegate);
    eventDispatcher.removeSink(DeviceKeyEvent.class);
    log.info("Stopped");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:DeviceKeyManager.java


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