Search in sources :

Example 11 with FindContentIdsByParentResult

use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.

the class ContentServiceImplTest_findIdsByParent method params_size_zero.

@Test
public void params_size_zero() throws Exception {
    final Content parentContent = createContent(ContentPath.ROOT);
    createContent(parentContent.getPath());
    createContent(parentContent.getPath());
    createContent(parentContent.getPath());
    this.nodeService.refresh(RefreshMode.SEARCH);
    final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(0).parentPath(parentContent.getPath()).build();
    final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
    assertNotNull(result);
    assertEquals(0, result.getHits());
    assertEquals(3, result.getTotalHits());
    assertTrue(result.getContentIds().isEmpty());
}
Also used : FindContentByParentParams(com.enonic.xp.content.FindContentByParentParams) Content(com.enonic.xp.content.Content) FindContentIdsByParentResult(com.enonic.xp.content.FindContentIdsByParentResult) Test(org.junit.jupiter.api.Test)

Example 12 with FindContentIdsByParentResult

use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.

the class ContentServiceImplTest_findIdsByParent method test_publish_expired_draft.

@Test
public void test_publish_expired_draft() throws Exception {
    final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().minus(Duration.ofDays(1))).build());
    assertEquals(1, result.getTotalHits());
}
Also used : FindContentIdsByParentResult(com.enonic.xp.content.FindContentIdsByParentResult) Test(org.junit.jupiter.api.Test)

Example 13 with FindContentIdsByParentResult

use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.

the class ContentServiceImplTest_findIdsByParent method test_publish_expired_master.

@Test
public void test_publish_expired_master() throws Exception {
    authorizedMasterContext().callWith(() -> {
        final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().minus(Duration.ofDays(1))).to(Instant.now().minus(Duration.ofDays(1))).build());
        assertEquals(0, result.getTotalHits());
        return null;
    });
}
Also used : FindContentIdsByParentResult(com.enonic.xp.content.FindContentIdsByParentResult) Test(org.junit.jupiter.api.Test)

Example 14 with FindContentIdsByParentResult

use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.

the class ContentServiceImplTest_findIdsByParent method hasChildResolved.

@Test
public void hasChildResolved() throws Exception {
    final Content parentContent = createContent(ContentPath.ROOT);
    final Content content1 = createContent(parentContent.getPath());
    createContent(content1.getPath());
    this.nodeService.refresh(RefreshMode.SEARCH);
    final FindContentByParentParams params = FindContentByParentParams.create().from(0).size(30).parentId(parentContent.getId()).build();
    final FindContentIdsByParentResult result = contentService.findIdsByParent(params);
    assertNotNull(result);
    assertEquals(1, result.getTotalHits());
    final Content content1Result = this.contentService.getById(result.getContentIds().first());
    assertTrue(content1Result.hasChildren());
}
Also used : FindContentByParentParams(com.enonic.xp.content.FindContentByParentParams) Content(com.enonic.xp.content.Content) FindContentIdsByParentResult(com.enonic.xp.content.FindContentIdsByParentResult) Test(org.junit.jupiter.api.Test)

Example 15 with FindContentIdsByParentResult

use of com.enonic.xp.content.FindContentIdsByParentResult in project xp by enonic.

the class ContentServiceImplTest_findIdsByParent method test_pending_publish_draft.

@Test
public void test_pending_publish_draft() throws Exception {
    final FindContentIdsByParentResult result = createAndFindContent(ContentPublishInfo.create().from(Instant.now().plus(Duration.ofDays(1))).build());
    assertEquals(1, result.getTotalHits());
}
Also used : FindContentIdsByParentResult(com.enonic.xp.content.FindContentIdsByParentResult) Test(org.junit.jupiter.api.Test)

Aggregations

FindContentIdsByParentResult (com.enonic.xp.content.FindContentIdsByParentResult)16 Test (org.junit.jupiter.api.Test)16 Content (com.enonic.xp.content.Content)8 FindContentByParentParams (com.enonic.xp.content.FindContentByParentParams)8 ContentPath (com.enonic.xp.content.ContentPath)4