use of org.eclipse.leshan.Link in project leshan by eclipse.
the class LinkFormatHelperTest method encode_objectModel_to_linkObject_with_explicit_complex_root_path.
@Test
public void encode_objectModel_to_linkObject_with_explicit_complex_root_path() {
ObjectModel locationModel = getObjectModel(6);
Link[] links = LinkFormatHelper.getObjectDescription(locationModel, "/r/t/");
String strLinks = Link.serialize(links);
assertEquals("</r/t/6>, </r/t/6/0/0>, </r/t/6/0/1>, </r/t/6/0/2>, </r/t/6/0/3>, </r/t/6/0/4>, </r/t/6/0/5>, </r/t/6/0/6>", strLinks);
}
use of org.eclipse.leshan.Link in project leshan by eclipse.
the class LinkFormatHelperTest method encode_client_description_with_version_2_0_no_instances.
@Test
public void encode_client_description_with_version_2_0_no_instances() {
List<LwM2mObjectEnabler> objectEnablers = new ArrayList<>();
Map<Integer, LwM2mInstanceEnabler> instancesMap = new HashMap<>();
objectEnablers.add(new ObjectEnabler(6, getVersionedObjectModel(6, "2.0"), instancesMap, null));
Link[] links = LinkFormatHelper.getClientDescription(objectEnablers, null);
String strLinks = Link.serialize(links);
assertEquals("</>;rt=\"oma.lwm2m\", </6>;ver=\"2.0\"", strLinks);
}
use of org.eclipse.leshan.Link in project leshan by eclipse.
the class LinkFormatHelperTest method encode_objectModel_to_linkObject_with_simple_root_path.
@Test
public void encode_objectModel_to_linkObject_with_simple_root_path() {
ObjectModel locationModel = getObjectModel(6);
Link[] links = LinkFormatHelper.getObjectDescription(locationModel, "rp");
String strLinks = Link.serialize(links);
assertEquals("</rp/6>, </rp/6/0/0>, </rp/6/0/1>, </rp/6/0/2>, </rp/6/0/3>, </rp/6/0/4>, </rp/6/0/5>, </rp/6/0/6>", strLinks);
}
use of org.eclipse.leshan.Link in project leshan by eclipse.
the class LinkFormatHelperTest method encode_objectModel_to_linkObject_with_empty_root_path.
@Test
public void encode_objectModel_to_linkObject_with_empty_root_path() {
ObjectModel locationModel = getObjectModel(6);
Link[] links = LinkFormatHelper.getObjectDescription(locationModel, "");
String strLinks = Link.serialize(links);
assertEquals("</6>, </6/0/0>, </6/0/1>, </6/0/2>, </6/0/3>, </6/0/4>, </6/0/5>, </6/0/6>", strLinks);
}
use of org.eclipse.leshan.Link in project leshan by eclipse.
the class LinkFormatHelperTest method encode_client_description_with_version_1_0.
@Test
public void encode_client_description_with_version_1_0() {
List<LwM2mObjectEnabler> objectEnablers = new ArrayList<>();
Map<Integer, LwM2mInstanceEnabler> instancesMap = new HashMap<>();
instancesMap.put(0, new BaseInstanceEnabler());
objectEnablers.add(new ObjectEnabler(6, getObjectModel(6), instancesMap, null));
Link[] links = LinkFormatHelper.getClientDescription(objectEnablers, null);
String strLinks = Link.serialize(links);
assertEquals("</>;rt=\"oma.lwm2m\", </6/0>", strLinks);
}
Aggregations