use of org.structr.core.entity.TestEnum in project structr by structr.
the class PropertyTest method testSimpleEnumPropertySearchOnNode.
@Test
public void testSimpleEnumPropertySearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final PropertyKey<TestEnum> key = TestFour.enumProperty;
properties.put(key, TestEnum.Status1);
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(TestEnum.Status1, testEntity.getProperty(key));
Result<TestFour> result = app.nodeQuery(TestFour.class).and(key, TestEnum.Status1).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestEnum in project structr by structr.
the class PropertyTest method testSimpleEnumPropertySearchOnRelationship.
@Test
public void testSimpleEnumPropertySearchOnRelationship() {
try {
final TestOne testOne = createTestNode(TestOne.class);
final TestFour testFour = createTestNode(TestFour.class);
final Property<TestEnum> key = OneFourOneToOne.enumProperty;
assertNotNull(testOne);
assertNotNull(testFour);
final OneFourOneToOne testEntity = createTestRelationship(testOne, testFour, OneFourOneToOne.class);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
testEntity.setProperty(key, TestEnum.Status1);
tx.success();
}
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(TestEnum.Status1, testEntity.getProperty(key));
Result<OneFourOneToOne> result = app.relationshipQuery(OneFourOneToOne.class).and(key, TestEnum.Status1).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
Aggregations