use of com.enonic.xp.site.Site in project xp by enonic.
the class ContentServiceImplTest_getNearestSite method child_of_site_pending_publish_master.
@Test
public void child_of_site_pending_publish_master() {
final Content site = createSite();
final Content child = createContent(site.getPath(), ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
this.contentService.publish(PushContentParams.create().target(ContentConstants.BRANCH_MASTER).contentIds(ContentIds.from(site.getId())).build());
final Site fetchedSite = authorizedMasterContext().callWith(() -> this.contentService.getNearestSite(child.getId()));
assertNull(fetchedSite);
}
use of com.enonic.xp.site.Site in project xp by enonic.
the class ContentServiceImplTest_getNearestSite method child_of_site.
@Test
public void child_of_site() {
final Content site = createSite();
final Content child = createContent(site.getPath());
final Site fetchedSite = this.contentService.getNearestSite(child.getId());
assertNotNull(fetchedSite);
assertEquals(site.getId(), fetchedSite.getId());
}
use of com.enonic.xp.site.Site in project xp by enonic.
the class ContentServiceImplTest_getNearestSite method deep_child_of_site.
@Test
public void deep_child_of_site() {
final Content site = createSite();
final Content childLevel1 = createContent(site.getPath());
final Content childLevel2 = createContent(childLevel1.getPath());
final Content childLevel3 = createContent(childLevel2.getPath());
final Site fetchedSite = this.contentService.getNearestSite(childLevel3.getId());
assertNotNull(fetchedSite);
assertEquals(site.getId(), fetchedSite.getId());
}
use of com.enonic.xp.site.Site in project xp by enonic.
the class GetSiteConfigHandlerTest method testExample.
@Test
public void testExample() {
final Site site = TestDataFixtures.newSite();
when(this.contentService.findNearestSiteByPath(Mockito.any())).thenReturn(site);
when(this.contentService.getNearestSite(Mockito.any())).thenReturn(site);
runScript("/lib/xp/examples/content/getSiteConfig.js");
}
use of com.enonic.xp.site.Site in project xp by enonic.
the class GetCurrentSiteScriptTest method testExample.
@Test
public void testExample() {
final Site site = TestDataFixtures.newSite().build();
this.portalRequest.setSite(site);
runScript("/lib/xp/examples/portal/getSite.js");
}
Aggregations