use of org.eclipse.leshan.core.node.LwM2mPath in project leshan by eclipse.
the class LwM2mNodeDecoderTest method tlv_device_object_instance0_from_resources_tlv__instance_expected.
@Test
public void tlv_device_object_instance0_from_resources_tlv__instance_expected() throws CodecException {
LwM2mObjectInstance oInstance = decoder.decode(ENCODED_DEVICE_WITHOUT_INSTANCE, ContentFormat.TLV, new LwM2mPath(3), model, LwM2mObjectInstance.class);
assertDeviceInstance(oInstance);
}
use of org.eclipse.leshan.core.node.LwM2mPath in project leshan by eclipse.
the class LwM2mNodeDecoderTest method tlv_power_source__multiple_resource.
@Test
public void tlv_power_source__multiple_resource() throws CodecException {
// this content (a single TLV of type 'multiple_resource' containing the values)
// is probably not compliant with the spec but it should be supported by the server
byte[] content = new byte[] { -122, 6, 65, 0, 1, 65, 1, 5 };
LwM2mResource resource = (LwM2mResource) decoder.decode(content, ContentFormat.TLV, new LwM2mPath(3, 0, 6), model);
assertEquals(6, resource.getId());
assertEquals(2, resource.getValues().size());
assertEquals(1L, resource.getValue(0));
assertEquals(5L, resource.getValue(1));
}
use of org.eclipse.leshan.core.node.LwM2mPath in project leshan by eclipse.
the class LwM2mNodeDecoderTest method content_format_is_mandatory.
@Test(expected = CodecException.class)
public void content_format_is_mandatory() throws CodecException {
String value = "MyManufacturer";
decoder.decode(value.getBytes(StandardCharsets.UTF_8), null, new LwM2mPath(666, 0, 0), model);
}
use of org.eclipse.leshan.core.node.LwM2mPath in project leshan by eclipse.
the class LwM2mNodeDecoderTest method tlv_server_object_multi_instance_with_only_1_instance.
@Test
public void tlv_server_object_multi_instance_with_only_1_instance() throws Exception {
LwM2mObject oObject = ((LwM2mObject) decoder.decode(ENCODED_SERVER, ContentFormat.TLV, new LwM2mPath(1), model));
assertServerInstance(oObject);
}
use of org.eclipse.leshan.core.node.LwM2mPath in project leshan by eclipse.
the class LwM2mNodeDecoderTest method tlv_single_instance_with_obj_link.
@Test
public void tlv_single_instance_with_obj_link() throws Exception {
LwM2mObjectInstance oInstance = ((LwM2mObjectInstance) decoder.decode(ENCODED_OBJ65, ContentFormat.TLV, new LwM2mPath(65, 0), model));
assertObj65Instance(oInstance);
}
Aggregations