use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndEnd.
@Test
public void testQueryUsingNameAndEnd() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOrdering(Ordering.ASCENDING);
criteria.setItemName(getItemName());
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
assertIterableContainsItems(iterable, true);
}
use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndFirst.
@Test
public void testQueryUsingNameAndStartAndEndFirst() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOrdering(Ordering.ASCENDING);
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore1);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getFirstItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore1));
assertTrue(actual1.getTimestamp().after(beforeStore));
}
use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartNoMatch.
@Test
public void testQueryUsingNameAndStartNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setItemName(getItemName());
criteria.setBeginDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
assertFalse(iterable.iterator().hasNext());
}
use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndWithEQOperator.
@Test
public void testQueryUsingNameAndStartAndEndWithEQOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.EQ);
criteria.setState(getFirstItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getFirstItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore1));
assertTrue(actual1.getTimestamp().after(beforeStore));
}
Aggregations