Upgrade build to boot 2.x
- Pump up version to 2.0.0 - Some generic polish - All changes around breakage with boot 2.x - Some boot classes has been moved around - You can't no longer have binding key ending with camelCase. - New Binder now has illegal keys. - Some changes to tests as we can directly do end-to-end testing with ENV_VAR_FORMAT as normal keys - Spring data repo changes as now uses Optional - Remove relaxed binder and its tests in favor of new Binder - Some mockito api changes - One Ingored test TextPlainToJsonConversionTest.testTextPlainToJsonConversionOnInput - Relates to #935 Cache metric export properties Add code formatting guidelines Rearranged files
This commit is contained in:
committed by
Soby Chacko
parent
e2c214b34e
commit
4f72a10bc6
@@ -18,6 +18,7 @@ package org.springframework.cloud.stream.schema.server.controllers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cloud.stream.schema.server.config.SchemaServerProperties;
|
||||
import org.springframework.cloud.stream.schema.server.model.Schema;
|
||||
@@ -125,11 +126,11 @@ public class ServerController {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, produces = "application/json", path = "/schemas/{id}")
|
||||
public ResponseEntity<Schema> findOne(@PathVariable("id") Integer id) {
|
||||
Schema schema = this.repository.findOne(id);
|
||||
if (schema == null) {
|
||||
Optional<Schema> schema = this.repository.findById(id);
|
||||
if (!schema.isPresent()) {
|
||||
throw new SchemaNotFoundException("Could not find Schema");
|
||||
}
|
||||
return new ResponseEntity<>(schema, HttpStatus.OK);
|
||||
return new ResponseEntity<>(schema.get(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, produces = "application/json", path = "/{subject}/{format}")
|
||||
@@ -160,8 +161,11 @@ public class ServerController {
|
||||
@RequestMapping(value = "/schemas/{id}", method = RequestMethod.DELETE)
|
||||
public void delete(@PathVariable("id") Integer id) {
|
||||
if (this.schemaServerProperties.isAllowSchemaDeletion()) {
|
||||
Schema schema = this.repository.findOne(id);
|
||||
deleteSchema(schema);
|
||||
Optional<Schema> schema = this.repository.findById(id);
|
||||
if (!schema.isPresent()) {
|
||||
throw new SchemaNotFoundException("Could not find Schema");
|
||||
}
|
||||
deleteSchema(schema.get());
|
||||
}
|
||||
else {
|
||||
throw new SchemaDeletionNotAllowedException();
|
||||
|
||||
Reference in New Issue
Block a user