use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_all_noEditRights.
@Test
public void testGetDateRestrictions_all_noEditRights() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED, DateMode.ARCHIVED, DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
String expectedQuery = "(" + getPublishedQuery(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 testGetArticleSubsRestrictions_unsubscribed.
@Test
public void testGetArticleSubsRestrictions_unsubscribed() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNSUBSCRIBED));
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
assertEquals(getUnsubsQuery(false), ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_undecided_subscribed_noEditRights.
@Test
public void testGetArticleSubsRestrictions_undecided_subscribed_noEditRights() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNDECIDED, SubscriptionMode.SUBSCRIBED));
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
assertEquals(getSubsQuery(false), ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_archived.
@Test
public void testGetDateRestrictions_archived() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.ARCHIVED));
Date date = new Date();
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
assertEquals(getArchivedQuery(date), ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_undecided.
@Test
public void testGetArticleSubsRestrictions_undecided() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNDECIDED));
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
assertEquals(getSubsUnsubsQuery(true), ret.getQueryString());
}
Aggregations