Example usage for org.apache.wicket.markup.html.image Image getBehaviors

List of usage examples for org.apache.wicket.markup.html.image Image getBehaviors

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.image Image getBehaviors.

Prototype

public final List<? extends Behavior> getBehaviors() 

Source Link

Document

Gets the currently coupled Behavior s as a unmodifiable list.

Usage

From source file:org.geoserver.wms.web.data.publish.WMSLayerConfigTest.java

License:Open Source License

@Test
public void testLegendGraphicURL() throws Exception {
    // force style into ponds workspace
    Catalog catalog = getCatalog();/*from   w ww  . j a  v  a2  s .c  o  m*/
    StyleInfo style = catalog.getStyleByName(MockData.PONDS.getLocalPart());
    WorkspaceInfo ws = catalog.getWorkspaceByName(MockData.PONDS.getPrefix());
    style.setWorkspace(ws);
    catalog.save(style);

    final LayerInfo layer = getCatalog().getLayerByName(MockData.PONDS.getLocalPart());
    FormTestPage page = new FormTestPage(new ComponentBuilder() {

        public Component buildComponent(String id) {
            return new WMSLayerConfig(id, new Model(layer));
        }
    });
    tester.startPage(page);
    tester.assertRenderedPage(FormTestPage.class);
    tester.debugComponentTrees();

    Image img = (Image) tester.getComponentFromLastRenderedPage("form:panel:styles:defaultStyleLegendGraphic");
    assertNotNull(img);
    assertEquals(1, img.getBehaviors().size());
    assertTrue(img.getBehaviors().get(0) instanceof AttributeModifier);

    AttributeModifier mod = (AttributeModifier) img.getBehaviors().get(0);
    assertTrue(mod.toString().contains("wms?REQUEST=GetLegendGraphic"));
    assertTrue(mod.toString().contains("style=cite:Ponds"));

}