Search in sources :

Example 1 with CompareContentResults

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

the class ContentServiceImplTest_resolvePublishDependencies method resolve_children_in_the_middle_excluded.

@Disabled("This test is not correct; it should not be allowed to exclude parent if new")
@Test
public void resolve_children_in_the_middle_excluded() throws Exception {
    final ResolvePublishDependenciesParams.Builder builder = getPushParamsWithDependenciesBuilder();
    final Content child3 = this.contentService.create(CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my child 3").parent(child1.getPath()).type(ContentTypeName.folder()).build());
    refresh();
    final ResolvePublishDependenciesParams pushParams = builder.contentIds(ContentIds.from(content1.getId(), content2.getId())).excludedContentIds(ContentIds.from(child1.getId())).build();
    final CompareContentResults result = this.contentService.resolvePublishDependencies(pushParams);
    assertEquals(4, result.contentIds().getSize());
    assertFalse(result.contentIds().contains(child1.getId()));
    assertTrue(result.contentIds().contains(child3.getId()));
}
Also used : ResolvePublishDependenciesParams(com.enonic.xp.content.ResolvePublishDependenciesParams) Content(com.enonic.xp.content.Content) CompareContentResults(com.enonic.xp.content.CompareContentResults) PropertyTree(com.enonic.xp.data.PropertyTree) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with CompareContentResults

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

the class ContentServiceImplTest_resolvePublishDependencies method resolve_single.

@Test
public void resolve_single() throws Exception {
    nodeService.push(NodeIds.from(ROOT_UUID), WS_OTHER);
    refresh();
    final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build();
    final Content content = this.contentService.create(createContentParams);
    refresh();
    final CompareContentResults result = this.contentService.resolvePublishDependencies(ResolvePublishDependenciesParams.create().contentIds(ContentIds.from(content.getId())).excludeChildrenIds(ContentIds.from(content.getId())).target(WS_OTHER).build());
    assertEquals(1, result.contentIds().getSize());
}
Also used : CreateContentParams(com.enonic.xp.content.CreateContentParams) Content(com.enonic.xp.content.Content) CompareContentResults(com.enonic.xp.content.CompareContentResults) PropertyTree(com.enonic.xp.data.PropertyTree) Test(org.junit.jupiter.api.Test)

Example 3 with CompareContentResults

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

the class ContentServiceImplTest_resolvePublishDependencies method resolve_children_excluded.

@Test
public void resolve_children_excluded() throws Exception {
    final ResolvePublishDependenciesParams.Builder builder = getPushParamsWithDependenciesBuilder().contentIds(ContentIds.from(content1.getId())).excludedContentIds(ContentIds.from(child1.getId()));
    refresh();
    final CompareContentResults result = this.contentService.resolvePublishDependencies(builder.build());
    assertEquals(1, result.contentIds().getSize());
    assertFalse(result.contentIds().contains(child1.getId()));
}
Also used : ResolvePublishDependenciesParams(com.enonic.xp.content.ResolvePublishDependenciesParams) CompareContentResults(com.enonic.xp.content.CompareContentResults) Test(org.junit.jupiter.api.Test)

Example 4 with CompareContentResults

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

the class PublishContentCommand method execute.

PublishContentResult execute() {
    this.nodeService.refresh(RefreshMode.ALL);
    final CompareContentResults results = getSyncWork();
    if (publishContentListener != null) {
        publishContentListener.contentResolved(results.size());
    }
    pushAndDelete(results);
    this.nodeService.refresh(RefreshMode.ALL);
    return resultBuilder.build();
}
Also used : CompareContentResults(com.enonic.xp.content.CompareContentResults)

Aggregations

CompareContentResults (com.enonic.xp.content.CompareContentResults)4 Test (org.junit.jupiter.api.Test)3 Content (com.enonic.xp.content.Content)2 ResolvePublishDependenciesParams (com.enonic.xp.content.ResolvePublishDependenciesParams)2 PropertyTree (com.enonic.xp.data.PropertyTree)2 CreateContentParams (com.enonic.xp.content.CreateContentParams)1 Disabled (org.junit.jupiter.api.Disabled)1