use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project openhab-addons by openhab.
the class HomieThingHandlerTests method handleCommandRefresh.
@SuppressWarnings("null")
@Test
public void handleCommandRefresh() {
// Create mocked homie device tree with one node and one read-only property
Node node = thingHandler.device.createNode("node", spy(new NodeAttributes()));
doReturn(future).when(node.attributes).subscribeAndReceive(any(), any(), anyString(), any(), anyInt());
doReturn(future).when(node.attributes).unsubscribe();
node.attributes.name = "testnode";
Property property = node.createProperty("property", spy(new PropertyAttributes()));
doReturn(future).when(property.attributes).subscribeAndReceive(any(), any(), anyString(), any(), anyInt());
doReturn(future).when(property.attributes).unsubscribe();
property.attributes.name = "testprop";
property.attributes.datatype = DataTypeEnum.string_;
property.attributes.settable = false;
property.attributesReceived();
node.properties.put(property.propertyID, property);
thingHandler.device.nodes.put(node.nodeID, node);
ThingHandlerHelper.setConnection(thingHandler, connection);
// we need to set a channel value first, undefined values ignored on REFRESH
property.getChannelState().getCache().update(new StringType("testString"));
thingHandler.handleCommand(property.channelUID, RefreshType.REFRESH);
verify(callback).stateUpdated(argThat(arg -> property.channelUID.equals(arg)), argThat(arg -> property.getChannelState().getCache().getChannelState().equals(arg)));
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project JavaData by SaitoAsuk-a.
the class FirstLastLinkList method insertLast.
/**
* ����һ����㣬��β�����в���
*/
public void insertLast(long value) {
Node node = new Node(value);
if (isEmpty()) {
first = node;
} else {
last.next = node;
}
last = node;
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project JavaData by SaitoAsuk-a.
the class FirstLastLinkList method display.
/**
* ��ʾ����
*/
public void display() {
Node current = first;
while (current != null) {
current.display();
current = current.next;
}
System.out.println();
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project JavaData by SaitoAsuk-a.
the class FirstLastLinkList method insertFirst.
/**
* ����һ����㣬��ͷ������в���
*/
public void insertFirst(long value) {
Node node = new Node(value);
if (isEmpty()) {
last = node;
}
node.next = first;
first = node;
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project JavaData by SaitoAsuk-a.
the class FirstLastLinkList method deleteFirst.
/**
* ɾ��һ����㣬��ͷ�������ɾ��
*/
public Node deleteFirst() {
Node tmp = first;
if (first.next == null) {
last = null;
}
first = tmp.next;
return tmp;
}
Aggregations