use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_subscribed.
@Test
public void testGetArticleSubsRestrictions_subscribed() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.SUBSCRIBED));
boolean hasEditRights = true;
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_future_noEditRights.
@Test
public void testGetDateRestrictions_future_noEditRights() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.FUTURE));
Date date = new Date();
boolean hasEditRights = false;
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 testGetDateRestrictions_published_archived.
@Test
public void testGetDateRestrictions_published_archived() {
Set<DateMode> modes = new HashSet<>(Arrays.asList(DateMode.PUBLISHED, DateMode.ARCHIVED));
Date date = new Date();
boolean hasEditRights = true;
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_undecided_subscribed.
@Test
public void testGetArticleSubsRestrictions_undecided_subscribed() {
Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNDECIDED, SubscriptionMode.SUBSCRIBED));
boolean hasEditRights = true;
QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
assertEquals(getUnsubsQuery(true), ret.getQueryString());
}
use of com.celements.search.lucene.query.QueryRestrictionGroup in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetSubsSpaceRestriction_noSubsQuery.
@Test
public void testGetSubsSpaceRestriction_noSubsQuery() throws Exception {
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
param.setDateModes(Arrays.asList(DateMode.PUBLISHED.name()));
param.setSubscriptionModes(Collections.<String>emptyList());
SpaceReference spaceRef = new SpaceReference("artSpace", wikiRef);
expectSpaceRightsCheck(spaceRef, null, true);
replayDefault();
QueryRestrictionGroup ret = builder.getSubsSpaceRestriction(param, spaceRef);
verifyDefault();
assertNull(ret);
}
Aggregations