Search in sources :

Example 1 with WidgetTypeDOM

use of org.entando.entando.aps.system.services.widgettype.WidgetTypeDOM in project entando-core by entando.

the class TestWidgetTypeDOM method testParseConfig.

public void testParseConfig() throws ApsSystemException {
    String framesXml = "<config>" + "<parameter name=\"contentType\">" + "Tipo di contenuto (obbligatorio)" + "</parameter>" + "<parameter name=\"modelId\">" + "Modello di contenuto (obbligatorio)" + "</parameter>" + "<parameter name=\"filters\" />" + "<action name=\"listViewerConfig\"/>" + "</config>";
    WidgetTypeDOM showletTypeDOM = new WidgetTypeDOM(framesXml);
    String action = showletTypeDOM.getAction();
    assertTrue(action.equals("listViewerConfig"));
    List<WidgetTypeParameter> params = showletTypeDOM.getParameters();
    assertEquals(3, params.size());
}
Also used : WidgetTypeDOM(org.entando.entando.aps.system.services.widgettype.WidgetTypeDOM) WidgetTypeParameter(org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)

Example 2 with WidgetTypeDOM

use of org.entando.entando.aps.system.services.widgettype.WidgetTypeDOM in project entando-core by entando.

the class TestWidgetTypeDOM method testCreateConfig.

public void testCreateConfig() throws ApsSystemException {
    WidgetTypeParameter params1 = new WidgetTypeParameter();
    params1.setName("param1");
    params1.setDescr("Param1 Descr");
    WidgetTypeParameter params2 = new WidgetTypeParameter();
    params2.setName("param2");
    params2.setDescr("Param2 Descr");
    List<WidgetTypeParameter> params = new ArrayList<WidgetTypeParameter>();
    params.add(params1);
    params.add(params2);
    WidgetTypeDOM showletTypeDOM = new WidgetTypeDOM(params, "customActionName");
    String xml = showletTypeDOM.getXMLDocument();
    WidgetTypeDOM showletTypeDOM2 = new WidgetTypeDOM(xml);
    assertEquals("customActionName", showletTypeDOM2.getAction());
    List<WidgetTypeParameter> extractedParams = showletTypeDOM2.getParameters();
    assertEquals(2, extractedParams.size());
    assertEquals("param1", extractedParams.get(0).getName());
    assertEquals("Param2 Descr", extractedParams.get(1).getDescr());
}
Also used : ArrayList(java.util.ArrayList) WidgetTypeDOM(org.entando.entando.aps.system.services.widgettype.WidgetTypeDOM) WidgetTypeParameter(org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)

Aggregations

WidgetTypeDOM (org.entando.entando.aps.system.services.widgettype.WidgetTypeDOM)2 WidgetTypeParameter (org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)2 ArrayList (java.util.ArrayList)1