String ownerType = "group";
String ownerId = "/platform/administrators";
String formerName = "testtest";
String updatedName = "updatedupdated";
PageNavigation pageNav = new PageNavigation();
pageNav.setOwnerType(ownerType);
pageNav.setOwnerId(ownerId);
storage_.remove(pageNav);
storage_.create(pageNav);
pageNav = storage_.getPageNavigation(ownerType, ownerId);
assertNotNull("Could not create navigation!", pageNav);
PageNode pageNode = new PageNode();
pageNode.setName(formerName);
pageNode.setUri(formerName + "_uri");
pageNode.setLabel(formerName + "_label");
pageNav.addNode(pageNode);
storage_.save(pageNav);
pageNav = storage_.getPageNavigation(ownerType, ownerId);
pageNode = pageNav.getNode(formerName);
//Check if the node with name containing '_' has been created
assertNotNull("Could not create page node!", pageNode);
assertEquals(formerName, pageNode.getName());
assertEquals(formerName + "_uri", pageNode.getUri());
assertEquals(formerName + "_label", pageNode.getLabel());
pageNode.setName(updatedName);
pageNode.setUri(updatedName + "_uri");
pageNode.setLabel(updatedName + "_label");
storage_.save(pageNav);
pageNav = storage_.getPageNavigation(ownerType, ownerId);
pageNode = pageNav.getNode(updatedName);
assertNull("Node name has been updated", pageNode);
pageNode = pageNav.getNode(formerName);
assertNotNull("Could not find node " + formerName, pageNode);
assertEquals(formerName, pageNode.getName());
assertEquals(updatedName + "_uri", pageNode.getUri());
assertEquals(updatedName + "_label", pageNode.getLabel());
for(PageNode node : pageNav.getNodes())
{
StringBuffer message = new StringBuffer("Current node metadata: \n");
message.append("Name: " + node.getName() + "\n");
message.append("Label: " + node.getLabel() + "\n");
message.append("Uri: " + node.getUri() + "\n");