use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testCaseInsensitiveMultilineStringPropertyInexactSubstringSearchOnNode.
@Test
public void testCaseInsensitiveMultilineStringPropertyInexactSubstringSearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final PropertyKey<String> key = TestFour.stringProperty;
properties.put(key, "{\n return fooBar;\n}");
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals("{\n return fooBar;\n}", testEntity.getProperty(key));
// inexact search
Result<TestFour> result = app.nodeQuery(TestFour.class).and(key, "foo", false).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
}
} catch (FrameworkException fex) {
fail("Error in test");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testSimpleDatePropertySearchOnNode.
@Test
public void testSimpleDatePropertySearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final PropertyKey<Date> key = TestFour.dateProperty;
final Date value = new Date(123456789L);
properties.put(key, value);
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(value, testEntity.getProperty(key));
Result<TestFour> result = app.nodeQuery(TestFour.class).and(key, value).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testDatePropertyRangeSearchOnNode.
@Test
public void testDatePropertyRangeSearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final PropertyKey<Date> key = TestFour.dateProperty;
final Date minValue = new Date(1234567880L);
final Date value = new Date(1234567890L);
final Date maxValue = new Date(1234567900L);
final Date maxMaxValue = new Date(1234567910L);
properties.put(key, value);
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals(value, testEntity.getProperty(key));
Result<TestFour> result = app.nodeQuery(TestFour.class).andRange(key, minValue, maxValue).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
tx.success();
}
try (final Tx tx = app.tx()) {
Result<TestFour> result = app.nodeQuery(TestFour.class).andRange(key, maxValue, maxMaxValue).getResult();
assertEquals(0, result.size());
tx.success();
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testSimpleStringPropertySearchOnNode.
@Test
public void testSimpleStringPropertySearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final PropertyKey<String> key = TestFour.stringProperty;
properties.put(key, "test");
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals("test", testEntity.getProperty(key));
Result<TestFour> result = app.nodeQuery(TestFour.class).and(key, "test").getResult();
assertEquals(result.size(), 1);
assertEquals(result.get(0), testEntity);
}
} catch (FrameworkException fex) {
fail("Error in test");
}
}
use of org.structr.core.entity.TestFour in project structr by structr.
the class PropertyTest method testIntPropertyRangeSearchOnNode.
@Test
public void testIntPropertyRangeSearchOnNode() {
try {
final PropertyMap properties = new PropertyMap();
final Property<Integer> key = OneFourOneToOne.integerProperty;
properties.put(key, 123456);
final TestFour testEntity = createTestNode(TestFour.class, properties);
assertNotNull(testEntity);
try (final Tx tx = app.tx()) {
// check value from database
assertEquals((Integer) 123456, testEntity.getProperty(key));
Result<TestFour> result = app.nodeQuery(TestFour.class).andRange(key, 123455, 123457).getResult();
assertEquals(1, result.size());
assertEquals(testEntity, result.get(0));
tx.success();
}
try (final Tx tx = app.tx()) {
Result<TestFour> result = app.nodeQuery(TestFour.class).andRange(key, 123457, 123458).getResult();
assertEquals(0, result.size());
tx.success();
}
} catch (FrameworkException fex) {
fail("Unable to store array");
}
}
Aggregations