private void saveGridSet(final GridSet gridSet) throws IOException { gridSetBroker.addGridSet(gridSet); }
@RequestMapping( path = "/{gridSetName}", method = RequestMethod.PUT, consumes = { MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE } ) public ResponseEntity<?> gridSetPut( @PathVariable String gridSetName, @RequestBody GridSet gridSet) { if (broker.get(gridSetName) != null) { broker.put(gridSet); } else { broker.addGridSet(gridSet); return new ResponseEntity<Object>("", HttpStatus.CREATED); } return null; }
public synchronized void put(GridSet gridSet) { remove(gridSet.getName()); addGridSet(gridSet); }
@Test public void testAddBadGridset() throws IOException { // existing GridSet existingGridSet = gridSetBroker.get(GWCConfigIntegrationTestData.GRIDSET_EPSG2163); try { gridSetBroker.addGridSet(existingGridSet); fail("Expected exception adding existing gridset"); } catch (IllegalArgumentException e) { } try { gridSetBroker.addGridSet(null); fail("Expected exception adding null gridset"); } catch (NullPointerException e) { } }
@Test public void testAddGridset() throws GeoWebCacheException, IOException { String gridsetName = "EPSG:3005"; GridSet epsg3005 = GridSetFactory.createGridSet( gridsetName, SRS.getSRS(gridsetName), new BoundingBox(35043.6538, 440006.8768, 1885895.3117, 1735643.8497), false, null, new double[] {25000000, 1250000, 500000, 250000}, null, GridSetFactory.DEFAULT_PIXEL_SIZE_METER, null, 256, 256, false); gridSetBroker.addGridSet(epsg3005); assertTrue(gridSetBroker.getNames().contains(gridsetName)); assertEquals(gridSetBroker.get(gridsetName), epsg3005); }