use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestWidgetTypeManager method testGetWidgetType_1.
public void testGetWidgetType_1() throws ApsSystemException {
WidgetType widgetType = _widgetTypeManager.getWidgetType("content_viewer");
assertEquals("content_viewer", widgetType.getCode());
assertEquals("Contenuti - Pubblica un Contenuto", widgetType.getTitles().get("it"));
assertTrue(widgetType.isLocked());
assertFalse(widgetType.isLogic());
assertFalse(widgetType.isUserType());
assertNull(widgetType.getParentType());
assertNull(widgetType.getConfig());
String action = widgetType.getAction();
assertEquals(action, "viewerConfig");
List<WidgetTypeParameter> list = widgetType.getTypeParameters();
Iterator<WidgetTypeParameter> iter = list.iterator();
Map<String, String> parameters = new HashMap<String, String>();
while (iter.hasNext()) {
WidgetTypeParameter parameter = (WidgetTypeParameter) iter.next();
parameters.put(parameter.getName(), parameter.getDescr());
}
boolean containsKey = parameters.containsKey("contentId");
boolean containsValue = parameters.containsValue("Identificativo del Contenuto");
assertEquals(containsKey, true);
assertEquals(containsValue, true);
containsKey = parameters.containsKey("modelId");
containsValue = parameters.containsValue("Identificativo del Modello di Contenuto");
assertEquals(containsKey, true);
assertEquals(containsValue, true);
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestWidgetTypeManager method testGetWidgetType_2.
public void testGetWidgetType_2() throws ApsSystemException {
WidgetType widgetType = _widgetTypeManager.getWidgetType("90_events");
assertEquals("90_events", widgetType.getCode());
assertEquals("Lista contenuti anni '90", widgetType.getTitles().get("it"));
assertFalse(widgetType.isLocked());
assertTrue(widgetType.isLogic());
assertTrue(widgetType.isUserType());
assertNull(widgetType.getAction());
assertNull(widgetType.getTypeParameters());
assertNotNull(widgetType.getParentType());
assertEquals("content_viewer_list", widgetType.getParentType().getCode());
assertNotNull(widgetType.getConfig());
String contentTypeParam = widgetType.getConfig().getProperty("contentType");
assertEquals("EVN", contentTypeParam);
String filtersParam = widgetType.getConfig().getProperty("filters");
assertTrue(filtersParam.contains("start=01/01/1990"));
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestWidgetTypeManager method testAddDeleteWidgetType.
public void testAddDeleteWidgetType() throws Throwable {
String widgetTypeCode = "test_widgetType";
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
try {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
WidgetType type = this.createNewWidgetType(widgetTypeCode);
this._widgetTypeManager.addWidgetType(type);
assertNotNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
} catch (Throwable t) {
throw t;
} finally {
if (null != this._widgetTypeManager.getWidgetType(widgetTypeCode)) {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
}
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
}
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestWidgetTypeManager method testFailureDeleteWidgetType_2.
public void testFailureDeleteWidgetType_2() throws Throwable {
String widgetTypeCode = "test_widgetType";
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
try {
WidgetType type = this.createNewWidgetType(widgetTypeCode);
type.setLocked(true);
this._widgetTypeManager.addWidgetType(type);
assertNotNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
try {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
fail();
} catch (Throwable t) {
assertNotNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
}
} catch (Throwable t) {
throw t;
} finally {
if (null != this._widgetTypeManager.getWidgetType(widgetTypeCode)) {
this._mockWidgetTypeDAO.deleteWidgetType(widgetTypeCode);
}
((IManager) this._widgetTypeManager).refresh();
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
}
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestWidgetTypeManager method testUpdateTitles.
public void testUpdateTitles() throws Throwable {
String widgetTypeCode = "test_widgetType";
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
try {
WidgetType type = this.createNewWidgetType(widgetTypeCode);
this._widgetTypeManager.addWidgetType(type);
WidgetType extracted = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(extracted);
assertEquals("Titolo", extracted.getTitles().get("it"));
assertEquals("Title", extracted.getTitles().get("en"));
ApsProperties newTitles = new ApsProperties();
newTitles.put("it", "Titolo modificato");
newTitles.put("en", "Modified title");
this._widgetTypeManager.updateWidgetType(widgetTypeCode, newTitles, type.getConfig(), type.getMainGroup());
extracted = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(extracted);
assertEquals("Titolo modificato", extracted.getTitles().get("it"));
assertEquals("Modified title", extracted.getTitles().get("en"));
} catch (Throwable t) {
throw t;
} finally {
if (null != this._widgetTypeManager.getWidgetType(widgetTypeCode)) {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
}
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
}
}
Aggregations