final PropertyMap props = new PropertyMap();
final String type = "UnknownTestType";
final String name = "GenericNode-name";
NodeInterface node = null;
props.put(AbstractNode.type, type);
props.put(AbstractNode.name, name);
try (final Tx tx = app.tx()) {
node = app.create(GenericNode.class, props);
tx.success();
}
try (final Tx tx = app.tx()) {
// Check defaults
assertEquals(GenericNode.class.getSimpleName(), node.getProperty(AbstractNode.type));
assertTrue(node.getProperty(AbstractNode.name).equals(name));
assertTrue(!node.getProperty(AbstractNode.hidden));
assertTrue(!node.getProperty(AbstractNode.deleted));
assertTrue(!node.getProperty(AbstractNode.visibleToAuthenticatedUsers));
assertTrue(!node.getProperty(AbstractNode.visibleToPublicUsers));
}
final String name2 = "GenericNode-name-äöüß";
try (final Tx tx = app.tx()) {
// Modify values
node.setProperty(AbstractNode.name, name2);
node.setProperty(AbstractNode.hidden, true);
node.setProperty(AbstractNode.deleted, true);
node.setProperty(AbstractNode.visibleToAuthenticatedUsers, true);
node.setProperty(AbstractNode.visibleToPublicUsers, true);
tx.success();
}
try (final Tx tx = app.tx()) {
assertTrue(node.getProperty(AbstractNode.name).equals(name2));
assertTrue(node.getProperty(AbstractNode.hidden));
assertTrue(node.getProperty(AbstractNode.deleted));
assertTrue(node.getProperty(AbstractNode.visibleToAuthenticatedUsers));
assertTrue(node.getProperty(AbstractNode.visibleToPublicUsers));
}
} catch (FrameworkException ex) {
logger.log(Level.SEVERE, ex.toString());