use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_archived_future.
@Test
public void testGetDateRestrictions_archived_future() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.ARCHIVED, DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
String expectedQuery = "(" + getFutureQuery(date) + " OR " + getArchivedQuery(date) + ")";
assertEquals(expectedQuery, ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetSubsRestrictions_noSub.
@Test
public void testGetSubsRestrictions_noSub() throws Exception {
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
replayDefault();
QueryRestrictionGroup ret = builder.getSubsRestrictions(param);
verifyDefault();
assertNull(ret);
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_published_future.
@Test
public void testGetDateRestrictions_published_future() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED, DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
String expectedQuery = "(" + getPublishedQuery(date) + " OR " + getFutureQuery(date) + ")";
assertEquals(expectedQuery, ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_published_noEditRights.
@Test
public void testGetDateRestrictions_published_noEditRights() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED));
Date date = new Date();
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
assertEquals(getPublishedQuery(date), ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_subscribed_unsubscribed.
@Test
public void testGetArticleSubsRestrictions_subscribed_unsubscribed() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.SUBSCRIBED, SubscriptionMode.UNSUBSCRIBED));
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
assertEquals(getSubsUnsubsQuery(false), ret.getQueryString());
}
Aggregations