synchronized void incrementSequence() { // prevent infinite loop on configuration update if (updating) return; try { updating = true; GeoServerInfo gsInfo = geoServer.getGlobal(); gsInfo.setUpdateSequence(gsInfo.getUpdateSequence() + 1); geoServer.save(gsInfo); } finally { updating = false; } }
if (other.getId() != null) return false; } else if (!id.equals(other.getId())) return false; if (updateSequence != other.getUpdateSequence()) return false;
@Test public void testCatalogUpdates() { long updateSequence = getGeoServer().getGlobal().getUpdateSequence(); // remove one layer getCatalog().remove(getCatalog().getLayers().get(0)); long newUpdateSequence = getGeoServer().getGlobal().getUpdateSequence(); assertTrue(newUpdateSequence > updateSequence); }
@Test public void testServiceUpdates() { GeoServerInfo global = getGeoServer().getGlobal(); long updateSequence = global.getUpdateSequence(); // change a flag in the config global.setVerbose(true); getGeoServer().save(global); long newUpdateSequence = getGeoServer().getGlobal().getUpdateSequence(); assertTrue(newUpdateSequence > updateSequence); } }
@Test public void testGlobal() throws Exception { GeoServerInfo info = importer.getConfiguration().getGlobal(); assertNotNull(info); LoggingInfo logging = importer.getConfiguration().getLogging(); assertNotNull(logging); assertEquals("DEFAULT_LOGGING.properties", logging.getLevel()); assertTrue(logging.isStdOutLogging()); assertEquals("logs/geoserver.log", logging.getLocation()); assertFalse(info.isVerbose()); assertFalse(info.isVerboseExceptions()); assertEquals(8, info.getNumDecimals()); assertEquals("UTF-8", info.getCharset()); assertEquals(3, info.getUpdateSequence()); } }
protected void updateSequence(AttributesImpl attributes) { attributes.addAttribute( "", "updateSequence", "updateSequence", "", wfs.getGeoServer().getGlobal().getUpdateSequence() + ""); }
public long getUpdateSequence() { GeoServerInfo global = getGeoServer().getGlobal(); return global.getUpdateSequence(); }
values.put(KEY_COVERAGEACCESS_KEEP_ALIVE_TIME, Integer.toString(coverageAccess.getKeepAliveTime())); values.put(KEY_UPDATE_SEQUENCE, Long.toString(geoServerInfo.getUpdateSequence()));
final long updateSequence = wcs.getGeoServer().getGlobal().getUpdateSequence(); long requestedUpdateSequence = -1; if (request.getUpdateSequence() != null) {
Integer.toString(coverageAccess.getKeepAliveTime())); values.put(KEY_UPDATE_SEQUENCE, Long.toString(geoServerInfo.getUpdateSequence())); values.put(KEY_JAVA_RENDERER, checkRenderer());
@Test public void testUpdateSequenceEqualsGet() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence(); Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&updateSequence=" + Long.toString(updateIndex)); checkValidationErrors(dom, WCS11_SCHEMA); final Node root = dom.getFirstChild(); assertEquals("wcs:Capabilities", root.getNodeName()); assertEquals(0, root.getChildNodes().getLength()); }
@Test public void testUpdateSequenceEqualsPost() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence(); String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs/1.1.1\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + Long.toString(updateIndex) + "\"/>"; Document dom = postAsDOM(BASEPATH, request); checkValidationErrors(dom, WCS11_SCHEMA); final Node root = dom.getFirstChild(); assertEquals("wcs:Capabilities", root.getNodeName()); assertEquals(0, root.getChildNodes().getLength()); }
@Test public void testUpdateSequenceEqualsGet() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence(); Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0&updateSequence=" + i); // print(dom); final Node root = dom.getFirstChild(); assertEquals("ServiceExceptionReport", root.getNodeName()); assertEquals( "CurrentUpdateSequence", root.getFirstChild() .getNextSibling() .getAttributes() .getNamedItem("code") .getNodeValue()); }
/** Compare two GeoServer info objects ignoring the update sequence. */ private static boolean checkEquals(GeoServerInfo infoA, GeoServerInfo infoB) { // for GeoServer infos to have the same update sequence infoA = ModificationProxy.unwrap(infoA); infoB = ModificationProxy.unwrap(infoB); long updateSequenceB = infoB.getUpdateSequence(); try { infoB.setUpdateSequence(infoA.getUpdateSequence()); // check that the two infos are equal return checkEquals((Info) infoA, infoB); } finally { // restore the original update sequence infoB.setUpdateSequence(updateSequenceB); } }
@Test public void testUpdateSequenceEqualsPost() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence(); String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + i + "\"/>"; Document dom = postAsDOM(BASEPATH, request); // print(dom); final Node root = dom.getFirstChild(); assertEquals("ServiceExceptionReport", root.getNodeName()); assertEquals( "CurrentUpdateSequence", root.getFirstChild() .getNextSibling() .getAttributes() .getNamedItem("code") .getNodeValue()); }
long geoUS = wfs.getGeoServer().getGlobal().getUpdateSequence(); if (reqUS > geoUS) { throw new ServiceException(
@Test public void testUpdateSequenceSuperiorGet() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence() + 1; Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&updateSequence=" + Long.toString(updateIndex)); checkValidationErrors(dom, WCS11_SCHEMA); // print(dom); checkOws11Exception(dom); }
@Test public void testUpdateSequenceSuperiorPost() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence() + 1; String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + i + "\" version=\"1.0.0\"/>"; Document dom = postAsDOM(BASEPATH, request); checkOws11Exception(dom); }
@Test public void testUpdateSequenceSuperiorPost() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence() + 1; String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs/1.1.1\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + Long.toString(updateIndex) + "\"/>"; Document dom = postAsDOM(BASEPATH, request); checkValidationErrors(dom, WCS11_SCHEMA); // print(dom); checkOws11Exception(dom); }
@Test public void testUpdateSequenceSuperiorGet() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence() + 1; Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0&updateSequence=" + i); // print(dom); checkOws11Exception(dom); }