use of org.openhab.core.persistence.HistoricItem in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndWithLTOperator.
@Test
public void testQueryUsingNameAndStartAndEndWithLTOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.LT);
criteria.setState(getSecondItemState());
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));
}
use of org.openhab.core.persistence.HistoricItem in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndWithLTOperatorNoMatch.
@Test
public void testQueryUsingNameAndStartAndEndWithLTOperatorNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.LT);
criteria.setState(getFirstItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
}
use of org.openhab.core.persistence.HistoricItem in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndWithGTOperatorNoMatch.
@Test
public void testQueryUsingNameAndStartAndEndWithGTOperatorNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.GT);
criteria.setState(getSecondItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
}
use of org.openhab.core.persistence.HistoricItem in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndNoMatch.
@Test
public void testQueryUsingNameAndStartAndEndNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
// sic
criteria.setEndDate(beforeStore);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
assertFalse(iterable.iterator().hasNext());
}
use of org.openhab.core.persistence.HistoricItem 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);
}
Aggregations