Search in sources :

Example 1 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode in project celements-blog by celements.

the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_undecided_noEditRights.

@Test
public void testGetArticleSubsRestrictions_undecided_noEditRights() {
    Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNDECIDED));
    boolean hasEditRights = false;
    QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
    assertNull(ret);
}
Also used : SubscriptionMode(com.celements.blog.article.ArticleLoadParameter.SubscriptionMode) HashSet(java.util.HashSet) QueryRestrictionGroup(com.celements.search.lucene.query.QueryRestrictionGroup) Test(org.junit.Test)

Example 2 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode 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());
}
Also used : SubscriptionMode(com.celements.blog.article.ArticleLoadParameter.SubscriptionMode) HashSet(java.util.HashSet) QueryRestrictionGroup(com.celements.search.lucene.query.QueryRestrictionGroup) Test(org.junit.Test)

Example 3 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode 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());
}
Also used : SubscriptionMode(com.celements.blog.article.ArticleLoadParameter.SubscriptionMode) HashSet(java.util.HashSet) QueryRestrictionGroup(com.celements.search.lucene.query.QueryRestrictionGroup) Test(org.junit.Test)

Example 4 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode in project celements-blog by celements.

the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_all.

@Test
public void testGetArticleSubsRestrictions_all() {
    DocumentReference blogConfDocRef = new DocumentReference("wiki", "space", "blog");
    Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.SUBSCRIBED, SubscriptionMode.UNSUBSCRIBED, SubscriptionMode.UNDECIDED));
    boolean hasEditRights = true;
    QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, blogConfDocRef, hasEditRights);
    assertEquals("", ret.getQueryString());
}
Also used : SubscriptionMode(com.celements.blog.article.ArticleLoadParameter.SubscriptionMode) DocumentReference(org.xwiki.model.reference.DocumentReference) HashSet(java.util.HashSet) QueryRestrictionGroup(com.celements.search.lucene.query.QueryRestrictionGroup) Test(org.junit.Test)

Example 5 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode in project celements-blog by celements.

the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_none.

@Test
public void testGetArticleSubsRestrictions_none() {
    Set<SubscriptionMode> modes = Collections.emptySet();
    boolean hasEditRights = true;
    QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
    assertNull(ret);
}
Also used : SubscriptionMode(com.celements.blog.article.ArticleLoadParameter.SubscriptionMode) QueryRestrictionGroup(com.celements.search.lucene.query.QueryRestrictionGroup) Test(org.junit.Test)

Aggregations

SubscriptionMode (com.celements.blog.article.ArticleLoadParameter.SubscriptionMode)16 QueryRestrictionGroup (com.celements.search.lucene.query.QueryRestrictionGroup)15 Test (org.junit.Test)15 HashSet (java.util.HashSet)14 DocumentReference (org.xwiki.model.reference.DocumentReference)3 DateMode (com.celements.blog.article.ArticleLoadParameter.DateMode)1 XWikiException (com.xpn.xwiki.XWikiException)1 ArrayList (java.util.ArrayList)1 SpaceReference (org.xwiki.model.reference.SpaceReference)1