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

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

Introduction

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

Prototype

@Override
public Component get(final String path) 

Source Link

Document

Gets the component at the given path.

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  www. j av  a2 s . co  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"));

}