Add code formatting guidelines

Add 'eclipse' folder containing Eclipse code
formatter configuration and instructions how to use
 it.

Update rule for join_wrapped_lines

 - Set to `false`

Resolves #930

Update README

Address review comments
This commit is contained in:
Ilayaperumal Gopinathan
2017-05-12 21:34:39 +05:30
committed by Marius Bogoevici
parent 9632546f03
commit bd002e4aaf
159 changed files with 1770 additions and 1283 deletions

View File

@@ -48,17 +48,18 @@ public class SchemaServerConfiguration {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws
BeansException {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof BeanDefinitionRegistry) {
EntityScanPackages.register((BeanDefinitionRegistry) beanFactory, Collections.singletonList(Schema.class.getPackage().getName()));
EntityScanPackages.register((BeanDefinitionRegistry) beanFactory,
Collections.singletonList(Schema.class.getPackage().getName()));
}
}
};
}
@Bean
public ServerController serverController(SchemaRepository repository, SchemaServerProperties schemeServerProperties) {
public ServerController serverController(SchemaRepository repository,
SchemaServerProperties schemeServerProperties) {
return new ServerController(repository, schemaValidators(), schemeServerProperties);
}

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.schema.server.config;
import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.schema.server.controllers;
import java.util.List;
@@ -134,10 +133,12 @@ public class ServerController {
}
@RequestMapping(method = RequestMethod.GET, produces = "application/json", path = "/{subject}/{format}")
public ResponseEntity<List<Schema>> findBySubjectAndVersion(@PathVariable("subject") String subject, @PathVariable("format") String format) {
public ResponseEntity<List<Schema>> findBySubjectAndVersion(@PathVariable("subject") String subject,
@PathVariable("format") String format) {
List<Schema> schemas = repository.findBySubjectAndFormatOrderByVersion(subject, format);
if (schemas == null || schemas.size() == 0) {
throw new SchemaNotFoundException(String.format("No schemas found for subject %s and format %s", subject, format));
throw new SchemaNotFoundException(
String.format("No schemas found for subject %s and format %s", subject, format));
}
return new ResponseEntity<List<Schema>>(schemas, HttpStatus.OK);
}

View File

@@ -14,12 +14,14 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.schema.server.model;
/**
* @author Vinicius Carvalho
*/
public enum Compatibility {
BACKWARD, FORWARD, FULL, INCOMPATIBLE;
BACKWARD,
FORWARD,
FULL,
INCOMPATIBLE;
}

View File

@@ -207,7 +207,8 @@ public class SchemaRegistryServerAvroTests {
ResponseEntity<Schema> response1 = client.postForEntity("http://localhost:8990/",
schema1, Schema.class);
Assert.assertTrue(response1.getStatusCode().is2xxSuccessful());
Assert.assertEquals(HttpStatus.OK, client.getForEntity("http://localhost:8990/test/avro/v1", Schema.class).getStatusCode());
Assert.assertEquals(HttpStatus.OK,
client.getForEntity("http://localhost:8990/test/avro/v1", Schema.class).getStatusCode());
client.getForEntity("http://localhost:8990/test/avro/1", Schema.class);
Schema schema2 = new Schema();
schema2.setFormat("avro");
@@ -216,7 +217,8 @@ public class SchemaRegistryServerAvroTests {
ResponseEntity<Schema> response2 = client.postForEntity("http://localhost:8990/",
schema2, Schema.class);
Assert.assertTrue(response2.getStatusCode().is2xxSuccessful());
Assert.assertEquals(HttpStatus.OK, client.getForEntity("http://localhost:8990/test/avro/v2", Schema.class).getStatusCode());
Assert.assertEquals(HttpStatus.OK,
client.getForEntity("http://localhost:8990/test/avro/v2", Schema.class).getStatusCode());
schemaServerProperties.setAllowSchemaDeletion(true);
client.delete("http://localhost:8990/test");
ResponseEntity<Schema> response4 = client
@@ -236,7 +238,8 @@ public class SchemaRegistryServerAvroTests {
ResponseEntity<Schema> response1 = client.postForEntity("http://localhost:8990/",
schema, Schema.class);
Assert.assertTrue(response1.getStatusCode().is2xxSuccessful());
ResponseEntity<Object> deleteBySubjectFormatVersion = client.exchange("http://localhost:8990/test/avro/v1", HttpMethod.DELETE,
ResponseEntity<Object> deleteBySubjectFormatVersion = client.exchange("http://localhost:8990/test/avro/v1",
HttpMethod.DELETE,
null, Object.class);
assertThat(deleteBySubjectFormatVersion.getStatusCode()).isEqualTo(HttpStatus.METHOD_NOT_ALLOWED);
ResponseEntity<Object> deleteBySubject = client.exchange("http://localhost:8990/test", HttpMethod.DELETE,
@@ -266,8 +269,9 @@ public class SchemaRegistryServerAvroTests {
v2, Schema.class);
Assert.assertTrue(response2.getStatusCode().is2xxSuccessful());
ResponseEntity<List<Schema>> schemaResponse = client.exchange("http://localhost:8990/test/avro", HttpMethod.GET, null, new ParameterizedTypeReference<List<Schema>>() {
});
ResponseEntity<List<Schema>> schemaResponse = client.exchange("http://localhost:8990/test/avro", HttpMethod.GET,
null, new ParameterizedTypeReference<List<Schema>>() {
});
Assert.assertTrue(schemaResponse.getStatusCode().is2xxSuccessful());
Assert.assertEquals(2, schemaResponse.getBody().size());

View File

@@ -30,7 +30,8 @@ public class EntityScanningTests {
@Test
public void testApplicationWithEmbeddedSchemaRegistryServerOutsideOfRootPackage() throws Exception {
final ConfigurableApplicationContext context = SpringApplication.run(CustomApplicationEmbeddingSchemaServer.class, "--server.port=0");
final ConfigurableApplicationContext context = SpringApplication
.run(CustomApplicationEmbeddingSchemaServer.class, "--server.port=0");
context.close();
}

View File

@@ -31,7 +31,8 @@ public class EntityScanningTestsWithEntityScan {
@Test
public void testApplicationWithEmbeddedSchemaRegistryServerOutsideOfRootPackage() throws Exception {
final ConfigurableApplicationContext context = SpringApplication.run(CustomApplicationEmbeddingSchemaServer.class, "--server.port=0");
final ConfigurableApplicationContext context = SpringApplication
.run(CustomApplicationEmbeddingSchemaServer.class, "--server.port=0");
context.close();
}