use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeEventsTest method testUpdated.
@Test
public void testUpdated() {
final Node updated = createNode("updated", NodePath.create("/mynode1/child1").build(), "myId");
Event event = NodeEvents.updated(updated);
assertNotNull(event);
assertTrue(event.isDistributed());
assertEquals(NodeEvents.NODE_UPDATED_EVENT, event.getType());
assertEquals("[{id=myId, path=/mynode1/child1/updated, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeEventsTest method testDeleted.
@Test
public void testDeleted() {
final Node deleted = createNode("deleted", NodePath.create("/mynode1/child1").build(), "myId");
Event event = NodeEvents.created(deleted);
assertNotNull(event);
assertTrue(event.isDistributed());
assertEquals("[{id=myId, path=/mynode1/child1/deleted, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeEventsTest method testCreated.
@Test
public void testCreated() {
final Node created = createNode("created", NodePath.create("/mynode1/child1").build(), "id");
Event event = NodeEvents.created(created);
assertNotNull(event);
assertTrue(event.isDistributed());
assertEquals("[{id=id, path=/mynode1/child1/created, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeEventsTest method testPushed.
@Test
public void testPushed() {
final Node pushed1 = createNode("pushed1", NodePath.create("/mynode1/pushed1").build(), "id1");
final Node pushed2 = createNode("pushed2", NodePath.create("/mynode1/pushed2").build(), "id2");
final Node pushed3 = createNode("pushed3Renamed", NodePath.create("/mynode1/pushed3").build(), "id3");
final NodeBranchEntry nodeBranchEntry = NodeBranchEntry.create().nodeId(pushed1.id()).nodePath(pushed1.path()).nodeState(NodeState.DEFAULT).nodeVersionId(pushed1.getNodeVersionId()).build();
final NodeBranchEntry nodeBranchEntry2 = NodeBranchEntry.create().nodeId(pushed2.id()).nodePath(pushed2.path()).nodeState(NodeState.DEFAULT).nodeVersionId(pushed2.getNodeVersionId()).build();
final NodeBranchEntry nodeBranchEntry3 = NodeBranchEntry.create().nodeId(pushed3.id()).nodePath(pushed3.path()).nodeState(NodeState.DEFAULT).nodeVersionId(pushed3.getNodeVersionId()).build();
final PushNodeEntries pushNodeEntries = PushNodeEntries.create().targetRepo(ContentConstants.CONTENT_REPO_ID).targetBranch(ContentConstants.BRANCH_MASTER).add(PushNodeEntry.create().nodeBranchEntry(nodeBranchEntry).build()).add(PushNodeEntry.create().nodeBranchEntry(nodeBranchEntry2).build()).add(PushNodeEntry.create().nodeBranchEntry(nodeBranchEntry3).currentTargetPath(NodePath.create("/mynode1/pushed3/pushed3").build()).build()).build();
Event event = NodeEvents.pushed(pushNodeEntries);
assertNotNull(event);
assertTrue(event.isDistributed());
assertTrue(event.hasValue("nodes"));
assertEquals(NodeEvents.NODE_PUSHED_EVENT, event.getType());
assertEquals("[{id=id1, path=/mynode1/pushed1/pushed1, branch=master, repo=com.enonic.cms.default}" + ", {id=id2, path=/mynode1/pushed2/pushed2, branch=master, repo=com.enonic.cms.default}" + ", {id=id3, path=/mynode1/pushed3/pushed3Renamed, branch=master, repo=com.enonic.cms.default, currentTargetPath=/mynode1/pushed3/pushed3}]", event.getValue("nodes").get().toString());
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class NodeEventsTest method testDuplicated.
@Test
public void testDuplicated() {
final Node duplicated = createNode("duplicated", NodePath.create("/mynode1/child1").build(), "myId");
Event event = NodeEvents.duplicated(duplicated);
assertNotNull(event);
assertTrue(event.isDistributed());
assertEquals(NodeEvents.NODE_DUPLICATED_EVENT, event.getType());
assertEquals("[{id=myId, path=/mynode1/child1/duplicated, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
Aggregations