Search in sources :

Example 81 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class DaoWebEventRepositoryIT method testCountMatchingBySeverity.

@Test
@Transactional
public void testCountMatchingBySeverity() {
    int[] matchingEventCount = m_daoEventRepo.countMatchingEventsBySeverity(new EventCriteria(new SeverityFilter(3)));
    assertNotNull(matchingEventCount);
    assertEquals(8, matchingEventCount.length);
}
Also used : NegativeSeverityFilter(org.opennms.web.event.filter.NegativeSeverityFilter) SeverityFilter(org.opennms.web.event.filter.SeverityFilter) EventCriteria(org.opennms.web.event.filter.EventCriteria) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 82 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class DaoWebEventRepositoryIT method testAcknowledgeUnacknowledgeAllAlarms.

@Test
@Transactional
public void testAcknowledgeUnacknowledgeAllAlarms() {
    m_daoEventRepo.acknowledgeAll("TestUser", new Date());
    int matchingEventCount = m_daoEventRepo.countMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
    assertEquals(2, matchingEventCount);
    m_daoEventRepo.unacknowledgeAll();
    matchingEventCount = m_daoEventRepo.countMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
    assertEquals(0, matchingEventCount);
}
Also used : AcknowledgedByFilter(org.opennms.web.event.filter.AcknowledgedByFilter) EventCriteria(org.opennms.web.event.filter.EventCriteria) Date(java.util.Date) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 83 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class DaoWebEventRepositoryIT method testCountMatchingEvents.

@Test
@Transactional
public void testCountMatchingEvents() {
    EventCriteria criteria = new EventCriteria();
    int event = m_daoEventRepo.countMatchingEvents(criteria);
    assertEquals(2, event);
}
Also used : EventCriteria(org.opennms.web.event.filter.EventCriteria) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 84 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class DaoWebEventRepositoryIT method testCountMatchingEventsBySeverity.

@Test
@Transactional
public void testCountMatchingEventsBySeverity() {
    EventCriteria criteria = new EventCriteria();
    int[] matchingEvents = m_daoEventRepo.countMatchingEventsBySeverity(criteria);
    assertNotNull(matchingEvents);
    assertEquals(8, matchingEvents.length);
    assertEquals(1, matchingEvents[OnmsSeverity.CLEARED.getId()]);
    assertEquals(0, matchingEvents[OnmsSeverity.CRITICAL.getId()]);
    assertEquals(1, matchingEvents[OnmsSeverity.INDETERMINATE.getId()]);
    assertEquals(0, matchingEvents[OnmsSeverity.MAJOR.getId()]);
    assertEquals(0, matchingEvents[OnmsSeverity.MINOR.getId()]);
    assertEquals(0, matchingEvents[OnmsSeverity.NORMAL.getId()]);
    assertEquals(0, matchingEvents[OnmsSeverity.WARNING.getId()]);
}
Also used : EventCriteria(org.opennms.web.event.filter.EventCriteria) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 85 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class WebNotificationRepositoryFilterIT method testInterfaceFilter.

@Test
@Transactional
public void testInterfaceFilter() {
    InterfaceFilter filter = new InterfaceFilter("192.168.1.1");
    assert1Result(filter);
}
Also used : InterfaceFilter(org.opennms.web.notification.filter.InterfaceFilter) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Transactional (org.springframework.transaction.annotation.Transactional)1415 Test (org.junit.Test)507 Query (javax.persistence.Query)166 Date (java.util.Date)121 ArrayList (java.util.ArrayList)99 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)89 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)87 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)84 OnmsNode (org.opennms.netmgt.model.OnmsNode)83 TypedQuery (javax.persistence.TypedQuery)81 Rollback (org.springframework.test.annotation.Rollback)81 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)67 HashMap (java.util.HashMap)65 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)61 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)58 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)58 DBUnitTest (org.orcid.test.DBUnitTest)57 List (java.util.List)56 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)41 User (com.arnaugarcia.uplace.domain.User)39