Search in sources :

Example 71 with PropertyMap

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);
}
Also used : PropertyMap(org.structr.core.property.PropertyMap)

Example 72 with PropertyMap

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");
    }
}
Also used : PropertyMap(org.structr.core.property.PropertyMap) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) TestOne(org.structr.core.entity.TestOne) PropertyKey(org.structr.core.property.PropertyKey) Result(org.structr.core.Result) Test(org.junit.Test)

Example 73 with PropertyMap

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");
    }
}
Also used : PropertyMap(org.structr.core.property.PropertyMap) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) AbstractNode(org.structr.core.entity.AbstractNode) TestOne(org.structr.core.entity.TestOne) Result(org.structr.core.Result) Test(org.junit.Test)

Example 74 with PropertyMap

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");
    }
}
Also used : PropertyMap(org.structr.core.property.PropertyMap) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) AbstractNode(org.structr.core.entity.AbstractNode) TestOne(org.structr.core.entity.TestOne) PropertyKey(org.structr.core.property.PropertyKey) Result(org.structr.core.Result) Test(org.junit.Test)

Example 75 with PropertyMap

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");
    }
}
Also used : TestSeven(org.structr.core.entity.TestSeven) PropertyMap(org.structr.core.property.PropertyMap) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) PropertyKey(org.structr.core.property.PropertyKey) NodeInterface(org.structr.core.graph.NodeInterface) Result(org.structr.core.Result) Test(org.junit.Test)

Aggregations

PropertyMap (org.structr.core.property.PropertyMap)233 FrameworkException (org.structr.common.error.FrameworkException)100 Tx (org.structr.core.graph.Tx)93 Test (org.junit.Test)60 App (org.structr.core.app.App)34 StructrApp (org.structr.core.app.StructrApp)34 PropertyKey (org.structr.core.property.PropertyKey)34 LinkedList (java.util.LinkedList)28 NodeInterface (org.structr.core.graph.NodeInterface)25 SchemaProperty (org.structr.core.entity.SchemaProperty)23 SecurityContext (org.structr.common.SecurityContext)22 StructrUiTest (org.structr.web.StructrUiTest)21 GraphObject (org.structr.core.GraphObject)20 Result (org.structr.core.Result)19 File (org.structr.web.entity.File)19 DOMNode (org.structr.web.entity.dom.DOMNode)19 TestOne (org.structr.core.entity.TestOne)17 AbstractNode (org.structr.core.entity.AbstractNode)16 Folder (org.structr.web.entity.Folder)15 Page (org.structr.web.entity.dom.Page)15