use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestNavigatorParser method testGetTargets_2.
public void testGetTargets_2() throws Throwable {
RequestContext reqCtx = this.valueRequestContext("contentview", "admin");
String spec = "current.path";
List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
assertEquals(2, targets.size());
NavigatorTarget target0 = targets.get(0);
assertEquals("homepage", target0.getPage().getCode());
NavigatorTarget target1 = targets.get(1);
assertEquals("contentview", target1.getPage().getCode());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestNavigatorParser method testGetTargets_3.
public void testGetTargets_3() throws Throwable {
RequestContext reqCtx = this.valueRequestContext("pagina_11", SystemConstants.GUEST_USER_NAME);
String spec = "abs(0).subtree(2)";
List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
assertEquals(5, targets.size());
NavigatorTarget target0 = targets.get(0);
assertEquals("homepage", target0.getPage().getCode());
assertEquals(0, target0.getLevel());
NavigatorTarget target1 = targets.get(1);
assertEquals("pagina_1", target1.getPage().getCode());
assertEquals(1, target1.getLevel());
NavigatorTarget target2 = targets.get(2);
assertEquals("pagina_11", target2.getPage().getCode());
assertEquals(2, target2.getLevel());
NavigatorTarget target3 = targets.get(3);
assertEquals("pagina_12", target3.getPage().getCode());
assertEquals(2, target3.getLevel());
NavigatorTarget target4 = targets.get(4);
assertEquals("pagina_2", target4.getPage().getCode());
assertEquals(1, target4.getLevel());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestURLManager method testGetURLString_1.
public void testGetURLString_1() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
PageURL pageURL = _urlManager.createURL(reqCtx);
pageURL.setLangCode("it");
pageURL.setPageCode("homepage");
try {
String url = this._urlManager.getURLString(pageURL, reqCtx);
assertEquals("/Entando/it/homepage.page", url);
this.changeUrlStyle(SystemConstants.CONFIG_PARAM_URL_STYLE_BREADCRUMBS);
url = this._urlManager.getURLString(pageURL, reqCtx);
assertEquals("/Entando/pages/it/homepage/", url);
} catch (Throwable t) {
throw t;
} finally {
this.changeUrlStyle(SystemConstants.CONFIG_PARAM_URL_STYLE_CLASSIC);
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentListHelper method testGetFilters_OneDefinition.
public void testGetFilters_OneDefinition() {
RequestContext reqCtx = this.getRequestContext();
String contentType = "ART";
String showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=ASC)";
EntitySearchFilter[] filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(1, filters.length);
EntitySearchFilter entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("Titolo", entitySearchFilter.getKey());
assertEquals("START", entitySearchFilter.getStart());
assertEquals("END", entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
contentType = "ART";
showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=DESC)";
filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(1, filters.length);
entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("Titolo", entitySearchFilter.getKey());
assertEquals("START", entitySearchFilter.getStart());
assertEquals("END", entitySearchFilter.getEnd());
assertEquals("DESC", entitySearchFilter.getOrder().toString());
contentType = "ART";
showletParam = "(key=descr;value=VALUE;attributeFilter=FALSE;order=ASC)";
filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(1, filters.length);
entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("descr", entitySearchFilter.getKey());
assertEquals(null, entitySearchFilter.getStart());
assertEquals(null, entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentListHelper method testGetFilters_TwoDefinition.
public void testGetFilters_TwoDefinition() {
RequestContext reqCtx = this.getRequestContext();
String contentType = "ART";
String showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=ASC)+(key=descr;value=VALUE;attributeFilter=FALSE;order=ASC)";
EntitySearchFilter[] filters = this._helper.getFilters(contentType, showletParam, reqCtx);
assertNotNull(filters);
assertEquals(2, filters.length);
EntitySearchFilter entitySearchFilter = filters[0];
assertNotNull(entitySearchFilter);
assertEquals("Titolo", entitySearchFilter.getKey());
assertEquals("START", entitySearchFilter.getStart());
assertEquals("END", entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
assertEquals(null, entitySearchFilter.getValue());
assertTrue(entitySearchFilter.isAttributeFilter());
entitySearchFilter = filters[1];
assertNotNull(entitySearchFilter);
assertEquals("descr", entitySearchFilter.getKey());
assertEquals(null, entitySearchFilter.getStart());
assertEquals(null, entitySearchFilter.getEnd());
assertEquals("ASC", entitySearchFilter.getOrder().toString());
assertFalse(entitySearchFilter.isAttributeFilter());
Object obj = entitySearchFilter.getValue();
assertNotNull(obj);
assertEquals(String.class, obj.getClass());
assertEquals("VALUE", (String) obj);
}
Aggregations