use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestWidgetTypeAction method testPasteNewUserWidgetType_1.
public void testPasteNewUserWidgetType_1() throws Throwable {
String widgetTypeCode = "randomShowletCode_1";
try {
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
String result = this.executePasteUserWidgetType("admin", widgetTypeCode, "en", "it", "coach_page", "2");
assertEquals(Action.SUCCESS, result);
Widget copiedWidget = this._pageManager.getDraftPage("coach_page").getWidgets()[2];
assertNotNull(copiedWidget);
assertNotNull(copiedWidget.getConfig());
WidgetType addedType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(addedType);
ApsProperties config = addedType.getConfig();
Iterator<Object> keysIter = config.keySet().iterator();
while (keysIter.hasNext()) {
String key = (String) keysIter.next();
assertEquals(copiedWidget.getConfig().getProperty(key), config.getProperty(key));
}
} catch (Throwable t) {
throw t;
} finally {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestPageAction method testSavePage_Draft_2.
public void testSavePage_Draft_2() throws Throwable {
String pageCode = "pagina_test_2";
assertNull(this._pageManager.getDraftPage(pageCode));
try {
IPage root = this._pageManager.getDraftRoot();
Map<String, String> params = new HashMap<String, String>();
params.put("strutsAction", String.valueOf(ApsAdminSystemConstants.ADD));
params.put("parentPageCode", root.getCode());
params.put("langit", "Pagina Test 2");
params.put("langen", "Test Page 2");
params.put("model", "internal");
params.put("group", Group.FREE_GROUP_NAME);
params.put("pageCode", pageCode);
String result = this.executeSave(params, "admin");
assertEquals(Action.SUCCESS, result);
IPage addedPage = this._pageManager.getDraftPage(pageCode);
assertNotNull(addedPage);
this.executeSetDefaultWidgets(params, "admin");
addedPage = this._pageManager.getDraftPage(pageCode);
assertNotNull(addedPage);
assertEquals("Pagina Test 2", addedPage.getMetadata().getTitles().getProperty("it"));
Widget[] showlets = addedPage.getWidgets();
assertEquals(addedPage.getMetadata().getModel().getFrames().length, showlets.length);
for (int i = 0; i < showlets.length; i++) {
Widget widget = showlets[i];
if (i == 3) {
assertNotNull(widget);
WidgetType type = widget.getType();
assertEquals("leftmenu", type.getCode());
assertEquals(1, type.getTypeParameters().size());
assertNull(type.getConfig());
ApsProperties config = widget.getConfig();
assertEquals(1, config.size());
assertEquals("code(homepage).subtree(1)", config.getProperty("navSpec"));
} else {
assertNull(widget);
}
}
} catch (Throwable t) {
throw t;
} finally {
this._pageManager.deletePage(pageCode);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestLocaleStringAction method testSaveEdit.
public void testSaveEdit() throws Throwable {
String key = "NEW_KEY";
assertFalse(this._i18nManager.getLabelGroups().containsKey(key));
try {
ApsProperties labels = this.prepareLabelProperties("itLabel", "enLabel");
this._i18nManager.addLabelGroup(key, labels);
String result = this.executeSaveEdit("admin", key, "updatedKeyIt", "updatedKeyEn");
assertEquals(Action.SUCCESS, result);
assertTrue(this._i18nManager.getLabelGroups().containsKey(key));
assertEquals(this._i18nManager.getLabel(key, "it"), "updatedKeyIt");
assertEquals(this._i18nManager.getLabel(key, "en"), "updatedKeyEn");
} catch (Throwable t) {
throw t;
} finally {
this._i18nManager.deleteLabelGroup(key);
assertFalse(this._i18nManager.getLabelGroups().containsKey(key));
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestLocaleStringAction method testSaveDelete.
public void testSaveDelete() throws Throwable {
String key = "NEW_KEY";
try {
ApsProperties labels = this.prepareLabelProperties("itLabel", "enLabel");
this._i18nManager.addLabelGroup(key, labels);
String result = this.executeDelete("admin", key);
assertEquals(Action.SUCCESS, result);
assertFalse(this._i18nManager.getLabelGroups().containsKey(key));
} catch (Throwable t) {
throw t;
} finally {
this._i18nManager.deleteLabelGroup(key);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testFailureAddExpression_2.
public void testFailureAddExpression_2() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "3");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "parent.subtree(2)+abs(1).subtree(2)+current");
params.put("specId", "3");
params.put("specSuperLevel", "-2");
String result = this.executeAddExpression("admin", params);
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
assertEquals(1, action.getActionErrors().size());
NavigatorWidgetConfigAction navAction = (NavigatorWidgetConfigAction) action;
Widget widget = navAction.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
assertEquals("parent.subtree(2)+abs(1).subtree(2)+current", navAction.getNavSpec());
assertEquals(3, navAction.getExpressions().size());
}
Aggregations