use of org.xwiki.model.reference.SpaceReference in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetBlogRestriction_noEdit_future.
@Test
public void testGetBlogRestriction_noEdit_future() throws Exception {
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
param.setDateModes(Arrays.asList(DateMode.FUTURE.name()));
SpaceReference spaceRef = new SpaceReference("artSpace", wikiRef);
expect(builder.blogService.getBlogSpaceRef(eq(docRef))).andReturn(spaceRef).once();
expectSpaceRightsCheck(spaceRef, true, false);
replayDefault();
IQueryRestriction ret = builder.getBlogRestriction(param);
verifyDefault();
assertNull(ret);
}
use of org.xwiki.model.reference.SpaceReference in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetSubsRestrictions_oneSub.
@Test
public void testGetSubsRestrictions_oneSub() throws Exception {
DocumentReference subsBlogDocRef = new DocumentReference("subsBlog", spaceRef);
SpaceReference subsSpaceRef = new SpaceReference("artSpace", wikiRef);
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
param.setSubscribedToBlogs(Arrays.asList(subsBlogDocRef));
param.setDateModes(Arrays.asList(DateMode.PUBLISHED.name()));
param.setSubscriptionModes(Arrays.asList(SubscriptionMode.SUBSCRIBED.name()));
expect(builder.blogService.getBlogSpaceRef(eq(subsBlogDocRef))).andReturn(subsSpaceRef).once();
expectSpaceRightsCheck(subsSpaceRef, true, true);
replayDefault();
QueryRestrictionGroup ret = builder.getSubsRestrictions(param);
verifyDefault();
assertNotNull(ret);
String expected = "(" + RESTR_ARTICLE_ISSUBS + " AND " + getSubsPublishQuery(subsSpaceRef, param.getExecutionDate()) + ")";
assertEquals(expected, ret.getQueryString());
}
use of org.xwiki.model.reference.SpaceReference in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetBlogRestriction_noView.
@Test
public void testGetBlogRestriction_noView() throws Exception {
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
SpaceReference spaceRef = new SpaceReference("artSpace", wikiRef);
expect(builder.blogService.getBlogSpaceRef(eq(docRef))).andReturn(spaceRef).once();
expectSpaceRightsCheck(spaceRef, false, null);
replayDefault();
IQueryRestriction ret = builder.getBlogRestriction(param);
verifyDefault();
assertNull(ret);
}
use of org.xwiki.model.reference.SpaceReference in project celements-blog by celements.
the class ArticleLuceneQueryBuilderTest method testGetSubsSpaceRestriction_noDateQuery.
@Test
public void testGetSubsSpaceRestriction_noDateQuery() throws Exception {
ArticleLoadParameter param = new ArticleLoadParameter();
param.setBlogDocRef(docRef);
param.setDateModes(Collections.<String>emptyList());
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();
assertNull(ret);
}
use of org.xwiki.model.reference.SpaceReference 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