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;
}
}
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;
}
}
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;
}
}
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);
}
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();
}
}
Aggregations