use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestDataObjectListHelper method getShowletForTest.
private Widget getShowletForTest(String showletTypeCode, ApsProperties config) throws Throwable {
WidgetType type = this._showletTypeManager.getWidgetType(showletTypeCode);
Widget widget = new Widget();
widget.setType(type);
if (null != config) {
widget.setConfig(config);
}
return widget;
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class DataObjectMapperCacheWrapperTest method createMockWidget.
private Widget createMockWidget() {
Widget widget = new Widget();
WidgetType type = new WidgetType();
type.setCode("type");
WidgetTypeParameter param1 = new WidgetTypeParameter();
param1.setName("dataId");
WidgetTypeParameter param2 = new WidgetTypeParameter();
param2.setName("testParam");
List<WidgetTypeParameter> params = Arrays.asList(new WidgetTypeParameter[] { param1, param2 });
type.setTypeParameters(params);
widget.setType(type);
ApsProperties props = new ApsProperties();
props.put("dataId", "id1");
props.put("testParam", "test");
widget.setConfig(props);
return widget;
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestApiWidgetTypeInterface method testJaxbWidgetType.
private void testJaxbWidgetType(String widgetTypeCode) throws Throwable {
WidgetType widgetType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
JAXBWidgetType jaxbWidgetType = this.getJaxbWidgetType(widgetType);
String body = this.getMarshalledObject(jaxbWidgetType);
assertNotNull(body);
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestApiWidgetTypeInterface method addMockWidget.
private void addMockWidget(String widgetTypeCode) throws Throwable {
WidgetType type = new WidgetType();
type.setCode(widgetTypeCode);
ApsProperties titles = new ApsProperties();
titles.setProperty("en", "English title");
titles.setProperty("it", "Italian title");
type.setTitles(titles);
this._widgetTypeManager.addWidgetType(type);
}
use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.
the class TestApiWidgetTypeInterface method testInvokeAddJaxbWidgetType.
private void testInvokeAddJaxbWidgetType(String newWidgetTypeCode, String widgetToClone, String customSingleGui, boolean expectedSuccess) throws Throwable {
WidgetType widgetType = this._widgetTypeManager.getWidgetType(widgetToClone);
assertNotNull(widgetType);
WidgetType newWidgetType = widgetType.clone();
assertNull(this._widgetTypeManager.getWidgetType(newWidgetTypeCode));
newWidgetType.setCode(newWidgetTypeCode);
try {
JAXBWidgetType jaxbWidgetType = this.getJaxbWidgetType(newWidgetType);
if (null != customSingleGui) {
jaxbWidgetType.setGui(customSingleGui);
}
this._apiWidgetTypeInterface.addWidgetType(jaxbWidgetType);
if (!expectedSuccess) {
fail();
}
WidgetType extractedWidgetType = this._widgetTypeManager.getWidgetType(newWidgetTypeCode);
assertNotNull(extractedWidgetType);
assertEquals(newWidgetType.getConfig(), extractedWidgetType.getConfig());
assertEquals(newWidgetType.getMainGroup(), extractedWidgetType.getMainGroup());
assertEquals(newWidgetType.getTitles(), extractedWidgetType.getTitles());
assertEquals(newWidgetType.getTypeParameters(), extractedWidgetType.getTypeParameters());
assertFalse(extractedWidgetType.isLocked());
} catch (ApiException ae) {
if (expectedSuccess) {
fail();
}
} catch (Throwable t) {
throw t;
} finally {
List<String> codes = this._guiFragmentManager.getGuiFragmentCodesByWidgetType(newWidgetTypeCode);
if (null != codes) {
for (int i = 0; i < codes.size(); i++) {
String code = codes.get(i);
this._guiFragmentManager.deleteGuiFragment(code);
}
}
this._widgetTypeManager.deleteWidgetType(newWidgetTypeCode);
}
}
Aggregations