use of org.structr.core.entity.SixOneManyToMany in project structr by structr.
the class SearchAndSortingTest method test09SearchBySourceAndTargetId.
@Test
public void test09SearchBySourceAndTargetId() {
try {
final TestOne test1 = createTestNode(TestOne.class);
final List<TestSix> tests = createTestNodes(TestSix.class, 5);
try (final Tx tx = app.tx()) {
test1.setProperty(TestOne.manyToManyTestSixs, tests);
tx.success();
}
try (final Tx tx = app.tx()) {
final List<SixOneManyToMany> result1 = app.relationshipQuery(SixOneManyToMany.class).and(SixOneManyToMany.sourceId, tests.get(0).getUuid()).getAsList();
assertEquals("Invalid sourceId query result", 1, result1.size());
tx.success();
}
try (final Tx tx = app.tx()) {
final List<SixOneManyToMany> result1 = app.relationshipQuery(SixOneManyToMany.class).and(SixOneManyToMany.targetId, test1.getUuid()).getAsList();
assertEquals("Invalid targetId query result", 5, result1.size());
tx.success();
}
} catch (FrameworkException ex) {
logger.error(ex.toString());
fail("Unexpected exception");
}
}
Aggregations