private List<String> servicesList() { return geoServer .getServices() .stream() .map(si -> si.getName()) .collect(Collectors.toList()); }
@Test public void testLoadGibberish() throws Exception { // we should get a log message, but the startup should continue File service = new File(getDataDirectory().getResourceLoader().getBaseDirectory(), "service.xml"); FileUtils.writeStringToFile(service, "duDaDa"); getGeoServer().reload(); assertEquals(0, geoServer.getServices().size()); }
private boolean isWMSAvailable(GeoServer geoServer) { ServiceInfo si = geoServer .getServices() .stream() .filter(s -> "WMS".equals(s.getName())) .findFirst() .orElse(null); return si != null; }
/** * * @see org.geoserver.web.CapabilitiesHomePageLinkProvider#getCapabilitiesComponent */ public Component getCapabilitiesComponent(final String id) { List<CapsInfo> serviceInfoLinks = new ArrayList<CapabilitiesHomePagePanel.CapsInfo>(); GeoServerApplication app = GeoServerApplication.get(); for (ServiceInfo si : app.getGeoServer().getServices()) { for (Version v : si.getVersions()) { String serviceId = si.getId(); String capsLink = "../ows?service=" + serviceId + "&version=" + v.toString() + "&request=GetCapabilities"; CapsInfo ci = new CapsInfo(serviceId, v, capsLink); serviceInfoLinks.add(ci); } } return new CapabilitiesHomePagePanel(id, serviceInfoLinks); } }
/** * Get all services info objects of a GeoServer instance, including the global service and * workspace services. */ private static List<ServiceInfo> getAllServices(GeoServer geoServer) { List<ServiceInfo> allServices = new ArrayList<>(); // get global services allServices.addAll(geoServer.getServices()); // get services per workspace List<WorkspaceInfo> workspaces = geoServer.getCatalog().getWorkspaces(); for (WorkspaceInfo workspace : workspaces) { // get the services of this workspace allServices.addAll(geoServer.getFacade().getServices(workspace)); } return allServices; }
@After public void clean() { // remove test workspace getCatalog().remove(getCatalog().getWorkspace("jms-test-workspace")); // remove any created service Collection<? extends ServiceInfo> services = getGeoServer().getServices(); for (ServiceInfo service : services) { ServiceInfo finalService = ModificationProxy.unwrap(service); if (finalService instanceof JmsTestServiceInfoImpl) { getGeoServer().remove(finalService); } } }