use of org.structr.core.entity.GenericNode in project structr by structr.
the class JavaParserModuleTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
use of org.structr.core.entity.GenericNode in project structr by structr.
the class GeoTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
use of org.structr.core.entity.GenericNode in project structr by structr.
the class StructrDataFeedsModuleTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
use of org.structr.core.entity.GenericNode in project structr by structr.
the class BasicTest method test01DeleteNode.
/**
* Test successful deletion of a node.
*
* The node shouldn't be found afterwards.
* Creation and deletion are executed in two different transactions.
*/
@Test
public void test01DeleteNode() {
try {
final PropertyMap props = new PropertyMap();
final String type = "GenericNode";
final String name = "GenericNode-name";
NodeInterface node = null;
String uuid = 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();
}
assertTrue(node != null);
try (final Tx tx = app.tx()) {
uuid = node.getUuid();
}
try (final Tx tx = app.tx()) {
app.delete(node);
tx.success();
}
try (final Tx tx = app.tx()) {
Result result = app.nodeQuery().uuid(uuid).getResult();
assertEquals("Node should have been deleted", 0, result.size());
} catch (FrameworkException fe) {
}
} catch (FrameworkException ex) {
logger.warn("", ex);
logger.error(ex.toString());
fail("Unexpected exception");
}
}
use of org.structr.core.entity.GenericNode in project structr by structr.
the class StructrApiModuleTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
Aggregations