@Override public String toString() { String attributeModifier = super.toString(); attributeModifier = attributeModifier.substring(0, attributeModifier.length() - 2) + ", separator=" + separator + "]"; return attributeModifier; } }
@Override public String toString() { String attributeModifier = super.toString(); attributeModifier = attributeModifier.substring(0, attributeModifier.length() - 2) + ", separator=" + separator + "]"; return attributeModifier; } }
private void assertMaxFeaturesInData(DataView data, int maxFeatures) { for (Iterator it = data.iterator(); it.hasNext(); ) { MarkupContainer c = (MarkupContainer) it.next(); MarkupContainer list = (MarkupContainer) c.get("itemProperties:4:component:menu"); for (Iterator<? extends Behavior> itBehaviors = list.getBehaviors().iterator(); itBehaviors.hasNext(); ) { Behavior b = itBehaviors.next(); if (b instanceof AttributeModifier) { AttributeModifier am = (AttributeModifier) b; String url = am.toString(); if (maxFeatures > 0) { assertTrue(url.contains("&maxFeatures=" + maxFeatures)); } else { assertTrue(!url.contains("&maxFeatures=")); } } } } }
@Test public void testWfsOutputFormatValueUrlEncoding() { tester.startPage(MapPreviewPage.class); tester.assertRenderedPage(MapPreviewPage.class); Label optionLabel = (Label) tester.getComponentFromLastRenderedPage( "table:listContainer:items:4:itemProperties:4:component:menu:wfs:wfsFormats:3"); assertTrue(optionLabel.getDefaultModelObjectAsString().equals("GML3.2")); for (Iterator<? extends Behavior> itBehaviors = optionLabel.getBehaviors().iterator(); itBehaviors.hasNext(); ) { Behavior b = itBehaviors.next(); if (b instanceof AttributeModifier) { AttributeModifier am = (AttributeModifier) b; String url = am.toString(); assertTrue(!url.contains("gml+xml")); assertTrue(url.contains("gml%2Bxml")); break; } } }
public void testLegendGraphicURL() throws Exception { 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("../cite/wms?REQUEST=GetLegendGraphic")); } }