Search in sources :

Example 96 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class BeanWrapperVisitorTest method testNotNullFromNullRestriction.

@Test
public void testNotNullFromNullRestriction() {
    new CriteriaBuilder(TestBean.class).isNull("string").toCriteria().visit(m_visitor);
    assertEquals(0, m_visitor.getMatches().size());
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Test(org.junit.Test)

Example 97 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class BeanWrapperVisitorTest method testFailedGreaterThanWithEqualsComparison.

@Test
public void testFailedGreaterThanWithEqualsComparison() {
    new CriteriaBuilder(TestBean.class).gt("four", 4).toCriteria().visit(m_visitor);
    assertEquals(0, m_visitor.getMatches().size());
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Test(org.junit.Test)

Example 98 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class BeanWrapperVisitorTest method testGreaterEqual.

@Test
public void testGreaterEqual() {
    new CriteriaBuilder(TestBean.class).ge("one", 0.0f).toCriteria().visit(m_visitor);
    assertEquals(1, m_visitor.getMatches().size());
    m_visitor.reset();
    new CriteriaBuilder(TestBean.class).ge("one", 0.99999d).toCriteria().visit(m_visitor);
    assertEquals(1, m_visitor.getMatches().size());
    m_visitor.reset();
    new CriteriaBuilder(TestBean.class).ge("four", 3.9999f).toCriteria().visit(m_visitor);
    assertEquals(1, m_visitor.getMatches().size());
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Test(org.junit.Test)

Example 99 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class BeanWrapperVisitorTest method testEnumComparisonLt.

@Test
public void testEnumComparisonLt() {
    final BeanWrapperCriteriaVisitor visitor = new BeanWrapperCriteriaVisitor(m_testBean);
    new CriteriaBuilder(TestBean.class).lt("enumFirst", CompareMe.FIRST).toCriteria().visit(visitor);
    assertEquals(0, visitor.getMatches().size());
    visitor.reset();
    new CriteriaBuilder(TestBean.class).lt("enumSecond", CompareMe.FIRST).toCriteria().visit(visitor);
    assertEquals(0, visitor.getMatches().size());
    visitor.reset();
    new CriteriaBuilder(TestBean.class).lt("enumFirst", CompareMe.THIRD).toCriteria().visit(visitor);
    assertEquals(1, visitor.getMatches().size());
    visitor.reset();
    new CriteriaBuilder(TestBean.class).lt("enumSecond", CompareMe.THIRD).toCriteria().visit(visitor);
    assertEquals(1, visitor.getMatches().size());
    visitor.reset();
    new CriteriaBuilder(TestBean.class).lt("enumThird", CompareMe.THIRD).toCriteria().visit(visitor);
    assertEquals(0, visitor.getMatches().size());
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Test(org.junit.Test)

Example 100 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class BeanWrapperVisitorTest method testFailedLessThanWithGreaterComparison.

@Test
public void testFailedLessThanWithGreaterComparison() {
    new CriteriaBuilder(TestBean.class).lt("four", 1d).toCriteria().visit(m_visitor);
    assertEquals(0, m_visitor.getMatches().size());
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Test(org.junit.Test)

Aggregations

CriteriaBuilder (org.opennms.core.criteria.CriteriaBuilder)155 Test (org.junit.Test)60 Criteria (org.opennms.core.criteria.Criteria)31 OnmsNode (org.opennms.netmgt.model.OnmsNode)25 Transactional (org.springframework.transaction.annotation.Transactional)23 Date (java.util.Date)20 GET (javax.ws.rs.GET)13 ArrayList (java.util.ArrayList)12 Produces (javax.ws.rs.Produces)12 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)11 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)11 InetSocketAddress (java.net.InetSocketAddress)9 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)7 HibernateDaoFactory (org.opennms.smoketest.utils.HibernateDaoFactory)7 OnmsMinion (org.opennms.netmgt.model.minion.OnmsMinion)6 RateLimiter (com.google.common.util.concurrent.RateLimiter)4 JUnitTemporaryDatabase (org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)4 EventDao (org.opennms.netmgt.dao.api.EventDao)4 OnmsSeverity (org.opennms.netmgt.model.OnmsSeverity)4 OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)4