Search in sources :

Example 16 with ResourceId

use of org.onosproject.yang.model.ResourceId in project onos by opennetworkinglab.

the class OpenConfigChannelHandlerTest method testSetResourceId.

/**
 * UnitTest method for setResourceId.
 */
@Test
public void testSetResourceId() {
    // call setResourceId
    OpenConfigChannelHandler channel = new OpenConfigChannelHandler(1, parent);
    // get resourceId
    ResourceId resourceId = null;
    try {
        Field field = OpenConfigObjectHandler.class.getDeclaredField("resourceId");
        field.setAccessible(true);
        resourceId = (ResourceId) field.get(channel);
    } catch (NoSuchFieldException e) {
        Assert.fail("[NG]setResourceId:ResourceId does not exist.\n" + e);
    } catch (IllegalAccessException e) {
        Assert.fail("[NG]setResourceId:Access to ResourceId is illegal.\n" + e);
    }
    assertEquals("[NG]setResourceId:Set ResourceId is not an expected one.\n", rid, resourceId);
}
Also used : Field(java.lang.reflect.Field) ResourceId(org.onosproject.yang.model.ResourceId) Test(org.junit.Test)

Example 17 with ResourceId

use of org.onosproject.yang.model.ResourceId in project onos by opennetworkinglab.

the class OpenConfigComponentsHandlerTest method testSetResourceId.

/**
 * UnitTest method for setResourceId.
 */
@Test
public void testSetResourceId() {
    // call setResourceId
    OpenConfigComponentsHandler components = new OpenConfigComponentsHandler();
    // get resourceId
    ResourceId resourceId = null;
    try {
        Field field = OpenConfigObjectHandler.class.getDeclaredField("resourceId");
        field.setAccessible(true);
        resourceId = (ResourceId) field.get(components);
    } catch (NoSuchFieldException e) {
        Assert.fail("[NG]setResourceId:ResourceId does not exist.\n" + e);
    } catch (IllegalAccessException e) {
        Assert.fail("[NG]setResourceId:Access to ResourceId is illegal.\n" + e);
    }
    assertEquals("[NG]setResourceId:Set ResourceId is not an expected one.\n", rid, resourceId);
}
Also used : Field(java.lang.reflect.Field) ResourceId(org.onosproject.yang.model.ResourceId) Test(org.junit.Test)

Example 18 with ResourceId

use of org.onosproject.yang.model.ResourceId in project onos by opennetworkinglab.

the class OpenConfigConfigOfTransceiverHandlerTest method testSetResourceId.

/**
 * UnitTest method for setResourceId.
 */
@Test
public void testSetResourceId() {
    // call setResourceId
    OpenConfigConfigOfTransceiverHandler config = new OpenConfigConfigOfTransceiverHandler(parent);
    // get resourceId
    ResourceId resourceId = null;
    try {
        Field field = OpenConfigObjectHandler.class.getDeclaredField("resourceId");
        field.setAccessible(true);
        resourceId = (ResourceId) field.get(config);
    } catch (NoSuchFieldException e) {
        Assert.fail("[NG]setResourceId:ResourceId does not exist.\n" + e);
    } catch (IllegalAccessException e) {
        Assert.fail("[NG]setResourceId:Access to ResourceId is illegal.\n" + e);
    }
    assertEquals("[NG]setResourceId:Set ResourceId is not an expected one.\n", rid, resourceId);
}
Also used : Field(java.lang.reflect.Field) ResourceId(org.onosproject.yang.model.ResourceId) Test(org.junit.Test)

Example 19 with ResourceId

use of org.onosproject.yang.model.ResourceId in project onos by opennetworkinglab.

the class OpenConfigLogicalChannelsHandlerTest method testSetResourceId.

/**
 * UnitTest method for setResourceId.
 */
@Test
public void testSetResourceId() {
    // call setResourceId
    OpenConfigLogicalChannelsHandler logicalChannels = new OpenConfigLogicalChannelsHandler(parent);
    // get resourceId
    ResourceId resourceId = null;
    try {
        Field field = OpenConfigObjectHandler.class.getDeclaredField("resourceId");
        field.setAccessible(true);
        resourceId = (ResourceId) field.get(logicalChannels);
    } catch (NoSuchFieldException e) {
        Assert.fail("[NG]setResourceId:ResourceId does not exist.\n" + e);
    } catch (IllegalAccessException e) {
        Assert.fail("[NG]setResourceId:Access to ResourceId is illegal.\n" + e);
    }
    assertEquals("[NG]setResourceId:Set ResourceId is not an expected one.\n", rid, resourceId);
}
Also used : Field(java.lang.reflect.Field) ResourceId(org.onosproject.yang.model.ResourceId) Test(org.junit.Test)

Example 20 with ResourceId

use of org.onosproject.yang.model.ResourceId in project onos by opennetworkinglab.

the class OpenConfigTerminalDeviceHandlerTest method testSetResourceId.

/**
 * UnitTest method for setResourceId.
 */
@Test
public void testSetResourceId() {
    // call setResourceId
    OpenConfigTerminalDeviceHandler terminalDevice = new OpenConfigTerminalDeviceHandler();
    // get resourceId
    ResourceId resourceId = null;
    try {
        Field field = OpenConfigObjectHandler.class.getDeclaredField("resourceId");
        field.setAccessible(true);
        resourceId = (ResourceId) field.get(terminalDevice);
    } catch (NoSuchFieldException e) {
        Assert.fail("[NG]setResourceId:ResourceId does not exist.\n" + e);
    } catch (IllegalAccessException e) {
        Assert.fail("[NG]setResourceId:Access to ResourceId is illegal.\n" + e);
    }
    assertEquals("[NG]setResourceId:Set ResourceId is not an expected one.\n", rid, resourceId);
}
Also used : Field(java.lang.reflect.Field) ResourceId(org.onosproject.yang.model.ResourceId) Test(org.junit.Test)

Aggregations

ResourceId (org.onosproject.yang.model.ResourceId)30 Test (org.junit.Test)21 Field (java.lang.reflect.Field)12 DeviceResourceIds.toResourceId (org.onosproject.d.config.DeviceResourceIds.toResourceId)6 DataNode (org.onosproject.yang.model.DataNode)6 FailedException (org.onosproject.config.FailedException)4 RestconfUtils.convertJsonToDataNode (org.onosproject.restconf.utils.RestconfUtils.convertJsonToDataNode)4 DefaultResourceData (org.onosproject.yang.model.DefaultResourceData)4 ResourceData (org.onosproject.yang.model.ResourceData)4 RestconfException (org.onosproject.restconf.api.RestconfException)3 KeyLeaf (org.onosproject.yang.model.KeyLeaf)3 ListKey (org.onosproject.yang.model.ListKey)3 SchemaId (org.onosproject.yang.model.SchemaId)3 DeviceId (org.onosproject.net.DeviceId)2 URI (java.net.URI)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 DynamicConfigEvent (org.onosproject.config.DynamicConfigEvent)1 DynamicConfigListener (org.onosproject.config.DynamicConfigListener)1 DynamicConfigService (org.onosproject.config.DynamicConfigService)1 YangToolUtil.toCharSequence (org.onosproject.odtn.utils.YangToolUtil.toCharSequence)1