use of org.structr.core.property.PropertyMap in project structr by structr.
the class LicensingTest method createTestNode.
protected <T extends AbstractNode> T createTestNode(final Class<T> type, final String name) throws FrameworkException {
final PropertyMap map = new PropertyMap();
map.put(AbstractNode.name, name);
return (T) createTestNode(type, map);
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SearchAndSortingTest method test08SearchByStaticMethodWithNullSearchValue01.
@Test
public void test08SearchByStaticMethodWithNullSearchValue01() {
try {
PropertyMap props = new PropertyMap();
final PropertyKey key = AbstractNode.name;
final String name = "abc";
props.put(key, name);
createTestNode(TestOne.class, props);
try (final Tx tx = app.tx()) {
Result result = app.nodeQuery(TestOne.class).andName(null).includeDeletedAndHidden().getResult();
assertTrue(result.isEmpty());
}
} catch (FrameworkException ex) {
logger.warn("", ex);
logger.error(ex.toString());
fail("Unexpected exception");
}
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SearchAndSortingTest method test12SearchByEmptyLongField.
@Test
public void test12SearchByEmptyLongField() {
try {
PropertyMap props = new PropertyMap();
AbstractNode node = createTestNode(TestOne.class, props);
try (final Tx tx = app.tx()) {
Result result = app.nodeQuery(TestOne.class).and(TestOne.aLong, null).includeDeletedAndHidden().getResult();
assertTrue(result.size() == 1);
assertTrue(result.get(0).equals(node));
}
} catch (FrameworkException ex) {
logger.warn("", ex);
logger.error(ex.toString());
fail("Unexpected exception");
}
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SearchAndSortingTest method test07SearchByStaticMethod01.
@Test
public void test07SearchByStaticMethod01() {
try {
PropertyMap props = new PropertyMap();
final PropertyKey key = AbstractNode.name;
final String name = "89w3hkl sdfghsdkljth";
props.put(key, name);
final AbstractNode node = createTestNode(TestOne.class, props);
try (final Tx tx = app.tx()) {
Result result = app.nodeQuery(TestOne.class).andName(name).includeDeletedAndHidden().getResult();
assertTrue(result.size() == 1);
assertTrue(result.get(0).equals(node));
}
} catch (FrameworkException ex) {
logger.warn("", ex);
logger.error(ex.toString());
fail("Unexpected exception");
}
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SearchAndSortingTest method test04SearchByLocation.
@Test
public void test04SearchByLocation() {
try {
final PropertyMap props = new PropertyMap();
final PropertyKey lat = TestSeven.latitude;
final PropertyKey lon = TestSeven.longitude;
final Class type = TestSeven.class;
props.put(lat, 50.12284d);
props.put(lon, 8.73923d);
props.put(AbstractNode.name, "TestSeven-0");
NodeInterface node = createTestNode(type, props);
try (final Tx tx = app.tx()) {
Result result = app.nodeQuery(type).location("Hanauer Landstraße", "200", "60314", "Frankfurt", "Germany", 10.0).includeDeletedAndHidden().getResult();
assertEquals(1, result.size());
assertTrue(result.get(0).equals(node));
}
} catch (FrameworkException ex) {
logger.warn("", ex);
logger.error(ex.toString());
fail("Unexpected exception");
}
}
Aggregations