Skip to content

Commit

Permalink
Merge pull request geoserver#3605 from hwbllmnn/fix-style-tab-ext-master
Browse files Browse the repository at this point in the history
[GEOS-9263] Style editor extension point not working
  • Loading branch information
aaime authored Jun 28, 2019
2 parents 5707179 + 5f5bd80 commit 7cf59fd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,9 @@ public Panel getPanel(String panelId) {
try {
tabPanel =
panelClass
.getConstructor(String.class, IModel.class)
.newInstance(panelId, styleModel);
.getConstructor(
String.class, AbstractStylePage.class)
.newInstance(panelId, AbstractStylePage.this);
} catch (Exception e) {
throw new WicketRuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -50,6 +51,7 @@
import org.junit.Before;
import org.junit.Test;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.springframework.util.Assert;
import org.w3c.dom.Document;

public class StyleEditPageTest extends GeoServerWicketTestSupport {
Expand Down Expand Up @@ -793,4 +795,31 @@ public void testPreviewSLD11Legend() throws Exception {
// check the SvgParameter has been interpreted and we get a red fill, not a gray one
assertPixel(panel.legendImage, 10, 10, Color.RED);
}

private static class StyleEditTabPanelTest extends StyleEditTabPanel {

/**
* @param id The id given to the panel.
* @param parent
*/
public StyleEditTabPanelTest(String id, AbstractStylePage parent) {
super(id, parent);
}
}

@Test
public void testStyleTabExtensionPoint()
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException {
StyleInfo styleInfo = new StyleInfoImpl(null);
styleInfo.setName("point");
styleInfo.setFilename("test.sld");

StyleEditPage page = new StyleEditPage(styleInfo);
Object tabPanel =
StyleEditTabPanelTest.class
.getConstructor(String.class, AbstractStylePage.class)
.newInstance("someid", page);
Assert.notNull(tabPanel, "Constructor for plugin tab panels has a broken signature.");
}
}

0 comments on commit 7cf59fd

Please sign in to comment.