@RequestMapping(method = RequestMethod.PUT) public void serverPut(@RequestBody ServerConfigurationPOJO serverConfiguration) throws IOException { // Throw an exception if a read-only value is modified if (serverConfiguration.getIdentifier() != null && !this.serverConfiguration .getIdentifier() .equals(serverConfiguration.getIdentifier())) { throw new RestException( "Cannot modify read-only property \"identifier\"", HttpStatus.BAD_REQUEST); } if (serverConfiguration.getLocation() != null && !this.serverConfiguration .getLocation() .equals(serverConfiguration.getLocation())) { throw new RestException( "Cannot modify read-only property \"location\"", HttpStatus.BAD_REQUEST); } if (serverConfiguration.getVersion() != null && !this.serverConfiguration .getVersion() .equals(serverConfiguration.getVersion())) { throw new RestException( "Cannot modify read-only property \"version\"", HttpStatus.BAD_REQUEST); } serverConfiguration.apply(this.serverConfiguration); } }
/** * Constructs a new POJO based on the provided {@link ServerConfiguration} * * @param template Template used to initialize properties */ public ServerConfigurationPOJO(ServerConfiguration template) throws IOException { this.serviceInformation = template.getServiceInformation(); this.runtimeStatsEnabled = template.isRuntimeStatsEnabled(); setLockProvider(template.getLockProvider()); this.fullWMS = template.isFullWMS(); this.wmtsCiteCompliant = template.isWmtsCiteCompliant(); this.backendTimeout = template.getBackendTimeout(); this.cacheBypassAllowed = template.isCacheBypassAllowed(); this.version = template.getVersion(); this.identifier = template.getIdentifier(); this.location = template.getLocation(); }
assertTrue(config.isCacheBypassAllowed()); assertEquals(config.getBackendTimeout(), (Integer) 60); assertThat(config.getVersion(), TestUtils.matchesRegex(VERSION_PATTERN));