use of com.enonic.xp.node.LoadNodeParams in project xp by enonic.
the class LoadNodeCommandTest method node_already_exists_in_path.
@Test
public void node_already_exists_in_path() throws Exception {
final Node originalNode = createNode(NodePath.ROOT, "fisk");
final Node nodeToLoad = Node.create(originalNode).id(new NodeId()).parentPath(NodePath.ROOT).name("fisk").timestamp(Instant.now()).nodeVersionId(NodeVersionId.from("nodeVersionId")).build();
final LoadNodeParams loadParams = LoadNodeParams.create().node(nodeToLoad).build();
refresh();
doLoadNode(loadParams);
refresh();
final Node storedNode = getNodeByPath(nodeToLoad.path());
assertNotNull(storedNode);
assertNotEquals(originalNode.id(), storedNode.id());
}
use of com.enonic.xp.node.LoadNodeParams in project xp by enonic.
the class LoadNodeCommandTest method parent_does_not_exist.
@Test
public void parent_does_not_exist() throws Exception {
final LoadNodeParams loadParams = LoadNodeParams.create().node(Node.create().id(new NodeId()).parentPath(NodePath.create("ost").build()).name("fisk").timestamp(Instant.now()).nodeVersionId(NodeVersionId.from("nodeVersionId")).build()).build();
assertThrows(NodeLoadException.class, () -> doLoadNode(loadParams));
}
use of com.enonic.xp.node.LoadNodeParams in project xp by enonic.
the class LoadNodeCommandTest method load_node.
@Test
public void load_node() throws Exception {
final Node node = Node.create().id(NodeId.from("myNodeId")).parentPath(NodePath.ROOT).name("fisk").nodeState(NodeState.DEFAULT).childOrder(ChildOrder.manualOrder()).nodeType(NodeType.from("myNodes")).timestamp(Instant.now()).nodeVersionId(NodeVersionId.from("nodeVersionId")).build();
final LoadNodeParams loadParams = LoadNodeParams.create().node(node).build();
doLoadNode(loadParams);
final Node storedNode = NodeHelper.runAsAdmin(() -> getNode(node.id()));
assertNodeProperties(node, storedNode);
}
Aggregations