use of org.structr.core.entity.OneFourOneToOne in project structr by structr.
the class PropertyTest method testSimpleStringPropertySearchOnRelationship.
@Test
public void testSimpleStringPropertySearchOnRelationship() {
try {
final TestOne testOne = createTestNode(TestOne.class);
final TestFour testFour = createTestNode(TestFour.class);
final Property<String> key = OneFourOneToOne.stringProperty;
assertNotNull(testOne);
assertNotNull(testFour);
final OneFourOneToOne testEntity = createTestRelationship(testOne, testFour, OneFourOneToOne.class);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
testEntity.setProperty(key, "test");
tx.success();
}
try (final Tx tx = app.tx()) {
// check value from database
assertEquals("test", testEntity.getProperty(key));
Result<OneFourOneToOne> result = app.relationshipQuery(OneFourOneToOne.class).and(key, "test").getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
}
} catch (FrameworkException fex) {
fail("Error in test");
}
}
Aggregations