Search in sources :

Example 1 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TestSearchEngineManager method testSearchContentsId_4.

public void testSearchContentsId_4() throws Throwable {
    try {
        Thread thread = this._searchEngineManager.startReloadContentsReferences();
        thread.join();
        SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
        SearchEngineFilter filterByType = new SearchEngineFilter(IIndexerDAO.CONTENT_TYPE_FIELD_NAME, "ART");
        SearchEngineFilter[] filters = { filterByType };
        List<String> allowedGroup = new ArrayList<String>();
        allowedGroup.add(Group.FREE_GROUP_NAME);
        List<String> contentsId = sem.searchEntityId(filters, null, allowedGroup);
        assertNotNull(contentsId);
        String[] expected1 = { "ART180", "ART1", "ART187", "ART121" };
        this.verify(contentsId, expected1);
        Category cat1 = this._categoryManager.getCategory("cat1");
        List<ITreeNode> categories = new ArrayList<ITreeNode>();
        categories.add(cat1);
        contentsId = sem.searchEntityId(filters, categories, allowedGroup);
        assertNotNull(contentsId);
        String[] expected2 = { "ART180" };
        this.verify(contentsId, expected2);
    } catch (Throwable t) {
        throw t;
    }
}
Also used : SearchEngineFilter(org.entando.entando.aps.system.services.searchengine.SearchEngineFilter) Category(com.agiletec.aps.system.services.category.Category) ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ArrayList(java.util.ArrayList)

Example 2 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TestSearchEngineManager method testSearchFacetedContents_1.

public void testSearchFacetedContents_1() throws Throwable {
    try {
        Thread thread = this._searchEngineManager.startReloadContentsReferences();
        thread.join();
        SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
        Category general = this._categoryManager.getCategory("general");
        List<ITreeNode> categories = new ArrayList<ITreeNode>();
        categories.add(general);
        List<String> allowedGroup = new ArrayList<String>();
        allowedGroup.add(Group.FREE_GROUP_NAME);
        allowedGroup.add(Group.ADMINS_GROUP_NAME);
        FacetedContentsResult result = sem.searchFacetedEntities(null, categories, allowedGroup);
        assertNotNull(result);
        String[] expected1 = { "ART122", "ART102", "ART111", "ART120" };
        this.verify(result.getContentsId(), expected1);
        assertEquals(4, result.getOccurrences().size());
    } catch (Throwable t) {
        throw t;
    }
}
Also used : FacetedContentsResult(org.entando.entando.aps.system.services.searchengine.FacetedContentsResult) Category(com.agiletec.aps.system.services.category.Category) ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ArrayList(java.util.ArrayList)

Example 3 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TestSearchEngineManager method testSearchContentsId_6.

public void testSearchContentsId_6() throws Throwable {
    try {
        Thread thread = this._searchEngineManager.startReloadContentsReferences();
        thread.join();
        SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
        Category general = this._categoryManager.getCategory("general");
        List<ITreeNode> categories = new ArrayList<ITreeNode>();
        categories.add(general);
        List<String> allowedGroup = new ArrayList<String>();
        allowedGroup.add(Group.ADMINS_GROUP_NAME);
        List<String> contentsId = sem.searchEntityId(null, categories, allowedGroup);
        assertNotNull(contentsId);
        String[] expected1 = { "ART122", "ART102", "ART111", "ART120" };
        this.verify(contentsId, expected1);
    } catch (Throwable t) {
        throw t;
    }
}
Also used : Category(com.agiletec.aps.system.services.category.Category) ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ArrayList(java.util.ArrayList)

Example 4 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TestPageTreeAction method testViewTree_1.

public void testViewTree_1() throws Throwable {
    this.initAction("/do/Page", "viewTree");
    this.setUserOnSession("admin");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    ITreeNode root = ((PageTreeAction) this.getAction()).getAllowedTreeRootNode();
    assertNotNull(root);
    assertEquals("homepage", root.getCode());
    assertEquals(7, root.getChildrenCodes().length);
    ITreeNode showableRoot = ((PageTreeAction) this.getAction()).getShowableTree();
    assertEquals("homepage", showableRoot.getCode());
    assertEquals(0, showableRoot.getChildrenCodes().length);
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Example 5 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TestPageTreeAction method checkTestViewTree_5_6.

private void checkTestViewTree_5_6() throws Throwable {
    ITreeNode showableRoot = ((PageTreeAction) this.getAction()).getShowableTree();
    assertEquals(AbstractPortalAction.VIRTUAL_ROOT_CODE, showableRoot.getCode());
    String[] children = showableRoot.getChildrenCodes();
    assertEquals(1, children.length);
    boolean check = false;
    for (int i = 0; i < children.length; i++) {
        // children[i];
        ITreeNode child = ((PageTreeAction) this.getAction()).getPage(children[i]);
        if (child.getCode().equals("customers_page")) {
            assertEquals(2, child.getChildrenCodes().length);
            assertEquals("customer_subpage_1", child.getChildrenCodes()[0]);
            assertEquals("customer_subpage_2", child.getChildrenCodes()[1]);
            check = true;
        } else {
            assertEquals(0, child.getChildrenCodes().length);
        }
    }
    if (!check) {
        fail();
    }
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Aggregations

ITreeNode (com.agiletec.aps.system.common.tree.ITreeNode)36 Category (com.agiletec.aps.system.services.category.Category)9 ArrayList (java.util.ArrayList)9 PageTreeAction (com.agiletec.apsadmin.portal.PageTreeAction)7 IDataObjectSearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager)4 SearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager)4 SearchEngineFilter (org.entando.entando.aps.system.services.searchengine.SearchEngineFilter)4 TreeNodeWrapper (com.agiletec.apsadmin.system.TreeNodeWrapper)2 Term (org.apache.lucene.index.Term)2 BooleanQuery (org.apache.lucene.search.BooleanQuery)2 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)2 PhraseQuery (org.apache.lucene.search.PhraseQuery)2 Query (org.apache.lucene.search.Query)2 TermQuery (org.apache.lucene.search.TermQuery)2 TermRangeQuery (org.apache.lucene.search.TermRangeQuery)2 FacetedContentsResult (org.entando.entando.aps.system.services.searchengine.FacetedContentsResult)2 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 IPage (com.agiletec.aps.system.services.page.IPage)1 IPageActionHelper (com.agiletec.apsadmin.portal.helper.IPageActionHelper)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1