use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_all_noEditRights.
@Test
public void testGetArticleSubsRestrictions_all_noEditRights() {
DocumentReference blogConfDocRef = new DocumentReference("wiki", "space", "blog");
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.SUBSCRIBED, SubscriptionMode.UNSUBSCRIBED, SubscriptionMode.UNDECIDED));
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, blogConfDocRef, 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_published.
@Test
public void testGetDateRestrictions_published() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED));
Date date = new Date();
boolean hasEditRights = true;
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_undecided_unsubscribed_noEditRights.
@Test
public void testGetArticleSubsRestrictions_undecided_unsubscribed_noEditRights() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNDECIDED, SubscriptionMode.UNSUBSCRIBED));
boolean hasEditRights = false;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
assertNull(ret);
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetDateRestrictions_none.
@Test
public void testGetDateRestrictions_none() {
Set<DateMode> modes = Collections.emptySet();
Date date = new Date();
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getDateRestrictions(modes, date, hasEditRights);
assertNull(ret);
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetSubsSpaceRestriction.
@Test
public void testGetSubsSpaceRestriction() throws Exception {
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
param.setDateModes(Arrays.asList(DateMode.PUBLISHED.name()));
param.setSubscriptionModes(Arrays.asList(SubscriptionMode.SUBSCRIBED.name()));
SpaceReference spaceRef = new SpaceReference("artSpace", wikiRef);
expectSpaceRightsCheck(spaceRef, null, true);
replayDefault();
QueryRestrictionGroup ret = builder.getSubsSpaceRestriction(param, spaceRef);
verifyDefault();
assertEquals(getSubsPublishQuery(spaceRef, param.getExecutionDate()), ret.getQueryString());
}
Aggregations