Search in sources :

Example 21 with EdgeEvent

use of org.thingsboard.server.common.data.edge.EdgeEvent in project thingsboard by thingsboard.

the class BaseEdgeEventServiceTest method saveEdgeEventWithProvidedTime.

private EdgeEvent saveEdgeEventWithProvidedTime(long time, EdgeId edgeId, EntityId entityId, TenantId tenantId) throws Exception {
    EdgeEvent edgeEvent = generateEdgeEvent(tenantId, edgeId, entityId, EdgeEventActionType.ADDED);
    edgeEvent.setId(new EdgeEventId(Uuids.startOf(time)));
    return edgeEventService.save(edgeEvent);
}
Also used : EdgeEventId(org.thingsboard.server.common.data.id.EdgeEventId) EdgeEvent(org.thingsboard.server.common.data.edge.EdgeEvent)

Example 22 with EdgeEvent

use of org.thingsboard.server.common.data.edge.EdgeEvent in project thingsboard by thingsboard.

the class BaseEdgeEventServiceTest method saveEdgeEvent.

@Test
public void saveEdgeEvent() throws Exception {
    EdgeId edgeId = new EdgeId(Uuids.timeBased());
    DeviceId deviceId = new DeviceId(Uuids.timeBased());
    EdgeEvent edgeEvent = generateEdgeEvent(null, edgeId, deviceId, EdgeEventActionType.ADDED);
    EdgeEvent saved = edgeEventService.save(edgeEvent);
    Assert.assertEquals(saved.getTenantId(), edgeEvent.getTenantId());
    Assert.assertEquals(saved.getEdgeId(), edgeEvent.getEdgeId());
    Assert.assertEquals(saved.getEntityId(), edgeEvent.getEntityId());
    Assert.assertEquals(saved.getType(), edgeEvent.getType());
    Assert.assertEquals(saved.getAction(), edgeEvent.getAction());
    Assert.assertEquals(saved.getBody(), edgeEvent.getBody());
}
Also used : DeviceId(org.thingsboard.server.common.data.id.DeviceId) EdgeId(org.thingsboard.server.common.data.id.EdgeId) EdgeEvent(org.thingsboard.server.common.data.edge.EdgeEvent) Test(org.junit.Test)

Aggregations

EdgeEvent (org.thingsboard.server.common.data.edge.EdgeEvent)22 Test (org.junit.Test)7 EdgeId (org.thingsboard.server.common.data.id.EdgeId)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 AbstractMessage (com.google.protobuf.AbstractMessage)5 EntityDataProto (org.thingsboard.server.gen.edge.v1.EntityDataProto)5 Device (org.thingsboard.server.common.data.Device)4 DeviceId (org.thingsboard.server.common.data.id.DeviceId)3 TimePageLink (org.thingsboard.server.common.data.page.TimePageLink)3 AbstractControllerTest (org.thingsboard.server.controller.AbstractControllerTest)3 TransportProtos (org.thingsboard.server.gen.transport.TransportProtos)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 EdgeEventId (org.thingsboard.server.common.data.id.EdgeEventId)2 TenantId (org.thingsboard.server.common.data.id.TenantId)2 PageData (org.thingsboard.server.common.data.page.PageData)2 SortOrder (org.thingsboard.server.common.data.page.SortOrder)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Random (java.util.Random)1