Search in sources :

Example 11 with MoveContentParams

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

the class ContentServiceImplTest_move method move_to_folder_starting_with_same_name.

@Test
public void move_to_folder_starting_with_same_name() throws Exception {
    final Content site = createContent(ContentPath.ROOT, "site");
    final Content child1 = createContent(site.getPath(), "child1");
    createContent(child1.getPath(), "child1_1");
    createContent(child1.getPath(), "child2_1");
    final Content site2 = createContent(ContentPath.ROOT, "site2");
    refresh();
    final MoveContentParams params = MoveContentParams.create().contentId(child1.getId()).parentContentPath(site2.getPath()).build();
    final MoveContentsResult result = this.contentService.move(params);
    final Content movedContent = contentService.getById(result.getMovedContents().first());
    assertEquals(1, result.getMovedContents().getSize());
    assertEquals(movedContent.getParentPath(), site2.getPath());
}
Also used : MoveContentParams(com.enonic.xp.content.MoveContentParams) Content(com.enonic.xp.content.Content) MoveContentsResult(com.enonic.xp.content.MoveContentsResult) Test(org.junit.jupiter.api.Test)

Example 12 with MoveContentParams

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

the class ContentServiceImplTest_publish method doMove.

private void doMove(final ContentId contentId, final ContentPath newParent) {
    final MoveContentParams params = MoveContentParams.create().contentId(contentId).parentContentPath(newParent).build();
    this.contentService.move(params);
}
Also used : MoveContentParams(com.enonic.xp.content.MoveContentParams)

Example 13 with MoveContentParams

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

the class MoveContentHandlerTest method mockMove.

private void mockMove(final ContentId contentId, final String parentPath, final Content contentResult) {
    final MoveContentParams moveParams = MoveContentParams.create().contentId(contentId).parentContentPath(ContentPath.from(parentPath)).build();
    final MoveContentsResult result = MoveContentsResult.create().addMoved(contentResult.getId()).build();
    when(this.contentService.move(Mockito.eq(moveParams))).thenReturn(result);
}
Also used : MoveContentParams(com.enonic.xp.content.MoveContentParams) MoveContentsResult(com.enonic.xp.content.MoveContentsResult)

Aggregations

MoveContentParams (com.enonic.xp.content.MoveContentParams)13 Test (org.junit.jupiter.api.Test)9 Content (com.enonic.xp.content.Content)8 MoveContentsResult (com.enonic.xp.content.MoveContentsResult)5 PropertyTree (com.enonic.xp.data.PropertyTree)5 Node (com.enonic.xp.node.Node)2 LogAuditLogParams (com.enonic.xp.audit.LogAuditLogParams)1 ContentId (com.enonic.xp.content.ContentId)1 DeleteContentsResult (com.enonic.xp.content.DeleteContentsResult)1 PropertySet (com.enonic.xp.data.PropertySet)1 MoveNodeParams (com.enonic.xp.node.MoveNodeParams)1 NodeId (com.enonic.xp.node.NodeId)1 NodeNotFoundException (com.enonic.xp.node.NodeNotFoundException)1 ContentType (com.enonic.xp.schema.content.ContentType)1 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)1 Site (com.enonic.xp.site.Site)1