use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndDesc.
@Test
public void testQueryUsingNameAndStartAndEndDesc() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOrdering(Ordering.DESCENDING);
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
assertIterableContainsItems(iterable, false);
}
use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndEndNoMatch.
@Test
public void testQueryUsingNameAndEndNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setItemName(getItemName());
criteria.setEndDate(beforeStore);
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 testQueryUsingNameAndStartAndEndWithLTEOperator.
@Test
public void testQueryUsingNameAndStartAndEndWithLTEOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.LTE);
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));
}
use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEndWithGTOperator.
@Test
public void testQueryUsingNameAndStartAndEndWithGTOperator() {
// Skip for subclasses which have null "state between"
Assume.assumeTrue(getQueryItemStateBetween() != null);
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.GT);
criteria.setState(getQueryItemStateBetween());
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(getSecondItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore2));
assertTrue(actual1.getTimestamp().after(afterStore1));
}
use of org.openhab.core.persistence.FilterCriteria in project openhab1-addons by openhab.
the class AbstractTwoItemIntegrationTest method testQueryUsingNameAndStartAndEnd.
@Test
public void testQueryUsingNameAndStartAndEnd() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOrdering(Ordering.ASCENDING);
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
assertIterableContainsItems(iterable, true);
}
Aggregations