Search in sources :

Example 6 with MoveContentsResult

use of com.enonic.xp.content.MoveContentsResult 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 7 with MoveContentsResult

use of com.enonic.xp.content.MoveContentsResult 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

MoveContentsResult (com.enonic.xp.content.MoveContentsResult)7 MoveContentParams (com.enonic.xp.content.MoveContentParams)5 Content (com.enonic.xp.content.Content)3 Test (org.junit.jupiter.api.Test)3 LogAuditLogParams (com.enonic.xp.audit.LogAuditLogParams)1 ContentAccessException (com.enonic.xp.content.ContentAccessException)1 ContentAlreadyExistsException (com.enonic.xp.content.ContentAlreadyExistsException)1 MoveContentException (com.enonic.xp.content.MoveContentException)1 PropertySet (com.enonic.xp.data.PropertySet)1 PropertyTree (com.enonic.xp.data.PropertyTree)1 MoveNodeException (com.enonic.xp.node.MoveNodeException)1 NodeAccessException (com.enonic.xp.node.NodeAccessException)1 NodeAlreadyExistAtPathException (com.enonic.xp.node.NodeAlreadyExistAtPathException)1