Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-ui: Fix WMS service links gone when gwc.disabled=true #376

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class WmsConfiguration {
static final String WMS_BEANS_REGEX =
"""
^(?!\
|legendSample\
legendSample\
|getMapKvpReader\
|wmsCapabilitiesXmlReader\
|getMapXmlReader\
Expand All @@ -48,7 +48,7 @@ public class WmsConfiguration {
|.*LegendGraphicResponse\
|wmsGIFLegendOutputFormat\
|wmsJPEGLegendGraphicOutputFormat\
|wmsJSONLegendOutputFormat
|wmsJSONLegendOutputFormat\
).*$\
""";
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.util.tester.TagTester;
import org.apache.wicket.util.tester.WicketTester;
import org.geoserver.web.GeoServerApplication;
import org.geoserver.web.GeoServerHomePage;
import org.geoserver.web.GeoServerLoginPage;
import org.geoserver.web.ServicesPanel;
import org.geoserver.web.admin.GlobalSettingsPage;
import org.geoserver.web.wicket.WicketHierarchyPrinter;
import org.junit.jupiter.api.AfterEach;
Expand Down Expand Up @@ -135,6 +137,29 @@ public void GlobalSettingsPage_smoke_test() {
assertHidden("webUISettingsContainer");
}

@Test
public void GeoServerHomePage_smoke_test_service_links() {
GeoServerHomePage page = tester.startPage(GeoServerHomePage.class);
assertNotNull(page);
// print(page);
tester.assertComponent("serviceList", ServicesPanel.class);
tester.assertVisible("serviceList");
tester.assertComponent("serviceList:serviceDescriptions:0", ListItem.class);
tester.assertComponent("serviceList:serviceDescriptions:0:links:0", ListItem.class);

tester.assertComponent("serviceList:serviceDescriptions:1", ListItem.class);
tester.assertComponent("serviceList:serviceDescriptions:1:links:0", ListItem.class);

tester.assertComponent("serviceList:serviceDescriptions:2", ListItem.class);
tester.assertComponent("serviceList:serviceDescriptions:2:links:0", ListItem.class);

tester.assertComponent("serviceList:serviceDescriptions:3", ListItem.class);
tester.assertComponent("serviceList:serviceDescriptions:3:links:0", ListItem.class);

tester.assertComponent("serviceList:serviceDescriptions:4", ListItem.class);
tester.assertComponent("serviceList:serviceDescriptions:4:links:0", ListItem.class);
}

protected void assertHidden(String id) {
TagTester tag = tester.getTagById(id);
String msg =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class WebMapServiceMinimalConfiguration {
|.*LegendGraphicResponse\
|wmsGIFLegendOutputFormat\
|wmsJPEGLegendGraphicOutputFormat\
|wmsJSONLegendOutputFormat
|wmsJSONLegendOutputFormat\
).*$\
""";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,18 @@ private void registerDeferredAlias(String name, String alias) {

protected @Override void processBeanDefinition(
Element ele, BeanDefinitionParserDelegate delegate) {
if (!isFiltering()) {
super.processBeanDefinition(ele, delegate);
return;
}

final String beanNameOrId = getBeanNameOrId(ele);
if (shallInclude(beanNameOrId, ele)) {
if (hasText(beanNameOrId)) {
if (isFiltering()) {
if (shallInclude(beanNameOrId, ele)) {
logIncludingBeanMessage(beanNameOrId);
super.processBeanDefinition(ele, delegate);
} else if (hasText(beanNameOrId)) {
blackListedBeanNames.add(beanNameOrId);
logExcludedBeanMessage(beanNameOrId);
}
} else {
logUnfiltered(beanNameOrId);
super.processBeanDefinition(ele, delegate);
} else if (hasText(beanNameOrId)) {
blackListedBeanNames.add(beanNameOrId);
logExcludedBeanMessage(beanNameOrId);
}
}

Expand Down Expand Up @@ -404,14 +402,25 @@ private String getBeanNameOrId(Element ele) {
return nameAtt;
}

private void logUnfiltered(String beanName) {
if (hasText(beanName)) {
String msgFormat = "Include bean '{}', no regular expression provided";
log.trace(msgFormat, beanName);
}
}

private void logIncludingBeanMessage(String beanName) {
String msgFormat = "Registering '{}', matches regular expression";
log.trace(msgFormat, beanName);
if (hasText(beanName)) {
String msgFormat = "Include bean '{}', matches regular expression";
log.trace(msgFormat, beanName);
}
}

private void logExcludedBeanMessage(String beanName) {
String msgFormat = "Excluded bean '{}', no regular expression matches";
log.trace(msgFormat, beanName);
if (hasText(beanName)) {
String msgFormat = "Exclude bean '{}', no regular expression matches";
log.trace(msgFormat, beanName);
}
}
}
}
Loading