Search in sources :

Example 1 with PublishedPointDao

use of com.serotonin.m2m2.db.dao.PublishedPointDao in project ma-core-public by infiniteautomation.

the class PublisherAuditTest method testPublishedPointAuditTrail.

@Test
public void testPublishedPointAuditTrail() {
    PublishedPointDao dao = PublishedPointDao.getInstance();
    IDataPoint dp = createMockDataPoints(1).get(0);
    MockPublisherVO publisher = createMockPublisher(false);
    MockPublishedPointVO vo = publisher.getDefinition().createPublishedPointVO(publisher, dp);
    vo.setName(dp.getName());
    vo.setEnabled(false);
    dao.insert(vo);
    // Update and delete
    vo.setName("New Name");
    dao.update(vo.getId(), vo);
    dao.delete(vo.getId());
    List<AuditEventInstanceVO> auditEvents = getAuditEvents(AuditEventType.TYPE_PUBLISHED_POINT, vo.getId());
    Assert.assertEquals(3, auditEvents.size());
}
Also used : IDataPoint(com.serotonin.m2m2.vo.IDataPoint) MockPublisherVO(com.serotonin.m2m2.vo.publish.mock.MockPublisherVO) PublishedPointDao(com.serotonin.m2m2.db.dao.PublishedPointDao) MockPublishedPointVO(com.serotonin.m2m2.vo.publish.mock.MockPublishedPointVO) AuditEventInstanceVO(com.serotonin.m2m2.vo.event.audit.AuditEventInstanceVO) Test(org.junit.Test)

Example 2 with PublishedPointDao

use of com.serotonin.m2m2.db.dao.PublishedPointDao in project ma-core-public by MangoAutomation.

the class PublisherAuditTest method testPublishedPointAuditTrail.

@Test
public void testPublishedPointAuditTrail() {
    PublishedPointDao dao = PublishedPointDao.getInstance();
    IDataPoint dp = createMockDataPoints(1).get(0);
    MockPublisherVO publisher = createMockPublisher(false);
    MockPublishedPointVO vo = publisher.getDefinition().createPublishedPointVO(publisher, dp);
    vo.setName(dp.getName());
    vo.setEnabled(false);
    dao.insert(vo);
    // Update and delete
    vo.setName("New Name");
    dao.update(vo.getId(), vo);
    dao.delete(vo.getId());
    List<AuditEventInstanceVO> auditEvents = getAuditEvents(AuditEventType.TYPE_PUBLISHED_POINT, vo.getId());
    Assert.assertEquals(3, auditEvents.size());
}
Also used : IDataPoint(com.serotonin.m2m2.vo.IDataPoint) MockPublisherVO(com.serotonin.m2m2.vo.publish.mock.MockPublisherVO) PublishedPointDao(com.serotonin.m2m2.db.dao.PublishedPointDao) MockPublishedPointVO(com.serotonin.m2m2.vo.publish.mock.MockPublishedPointVO) AuditEventInstanceVO(com.serotonin.m2m2.vo.event.audit.AuditEventInstanceVO) Test(org.junit.Test)

Aggregations

PublishedPointDao (com.serotonin.m2m2.db.dao.PublishedPointDao)2 IDataPoint (com.serotonin.m2m2.vo.IDataPoint)2 AuditEventInstanceVO (com.serotonin.m2m2.vo.event.audit.AuditEventInstanceVO)2 MockPublishedPointVO (com.serotonin.m2m2.vo.publish.mock.MockPublishedPointVO)2 MockPublisherVO (com.serotonin.m2m2.vo.publish.mock.MockPublisherVO)2 Test (org.junit.Test)2