Search in sources :

Example 11 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode 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());
}
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 12 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode 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());
}
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 13 with SubscriptionMode

use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode 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());
}
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 14 with SubscriptionMode

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

the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_undecided_unsubscribed.

@Test
public void testGetArticleSubsRestrictions_undecided_unsubscribed() {
    Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNDECIDED, SubscriptionMode.UNSUBSCRIBED));
    boolean hasEditRights = true;
    QueryRestrictionGroup ret = builder.getArticleSubsRestrictions(modes, docRef, hasEditRights);
    assertEquals(getSubsQuery(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 15 with SubscriptionMode

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

the class ArticleLuceneQueryBuilderTest method testGetArticleSubsRestrictions_unsubscribed_noEditRights.

@Test
public void testGetArticleSubsRestrictions_unsubscribed_noEditRights() {
    Set<SubscriptionMode> modes = new HashSet<>(Arrays.asList(SubscriptionMode.UNSUBSCRIBED));
    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)

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