Search in sources :

Example 26 with NodeComparison

use of com.enonic.xp.node.NodeComparison in project xp by enonic.

the class ResolveSyncWorkResultMapper method serialize.

@Override
public void serialize(final MapGenerator gen) {
    gen.array("diff");
    for (final NodeComparison entry : result.getNodeComparisons()) {
        gen.map();
        gen.value("id", entry.getNodeId());
        gen.value("status", entry.getCompareStatus().toString());
        gen.end();
    }
    gen.end();
}
Also used : NodeComparison(com.enonic.xp.node.NodeComparison)

Example 27 with NodeComparison

use of com.enonic.xp.node.NodeComparison in project xp by enonic.

the class PushNodeHandlerTest method testExampleWithChildren.

@Test
public void testExampleWithChildren() {
    Mockito.when(nodeService.resolveSyncWork(Mockito.isA(SyncWorkResolverParams.class))).thenReturn(ResolveSyncWorkResult.create().add(new NodeComparison(createEntry("a"), createEntry("a"), CompareStatus.NEW)).add(new NodeComparison(createEntry("b", "a/b"), createEntry("b", "a/b"), CompareStatus.NEW)).add(new NodeComparison(createEntry("c", "a/b/c"), createEntry("c", "a/b/c"), CompareStatus.NEW)).build());
    Mockito.when(nodeService.push(Mockito.eq(NodeIds.create().add(NodeId.from("a")).add(NodeId.from("b")).add(NodeId.from("c")).build()), Mockito.eq(Branch.from("otherBranch")))).thenReturn(PushNodesResult.create().addSuccess(createEntry("a")).addSuccess(createEntry("b")).addFailed(createEntry("c"), PushNodesResult.Reason.ACCESS_DENIED).build());
    runScript("/lib/xp/examples/node/push-4.js");
}
Also used : NodeComparison(com.enonic.xp.node.NodeComparison) SyncWorkResolverParams(com.enonic.xp.node.SyncWorkResolverParams) Test(org.junit.jupiter.api.Test)

Aggregations

NodeComparison (com.enonic.xp.node.NodeComparison)27 Test (org.junit.jupiter.api.Test)14 Node (com.enonic.xp.node.Node)9 NodeId (com.enonic.xp.node.NodeId)4 NodeIds (com.enonic.xp.node.NodeIds)4 SyncWorkResolverParams (com.enonic.xp.node.SyncWorkResolverParams)4 Context (com.enonic.xp.context.Context)3 NodeComparisons (com.enonic.xp.node.NodeComparisons)3 InternalContext (com.enonic.xp.repo.impl.InternalContext)3 CompareStatus (com.enonic.xp.content.CompareStatus)2 NodeBranchEntries (com.enonic.xp.node.NodeBranchEntries)2 NodeBranchEntry (com.enonic.xp.node.NodeBranchEntry)2 NodePaths (com.enonic.xp.node.NodePaths)2 Branch (com.enonic.xp.branch.Branch)1 ContentId (com.enonic.xp.content.ContentId)1 PropertyTree (com.enonic.xp.data.PropertyTree)1 FindNodesByParentResult (com.enonic.xp.node.FindNodesByParentResult)1 NodePath (com.enonic.xp.node.NodePath)1 PushNodeEntries (com.enonic.xp.node.PushNodeEntries)1 ResolveSyncWorkResult (com.enonic.xp.node.ResolveSyncWorkResult)1