Commit 48534770 authored by Phillip Webb's avatar Phillip Webb

Reformat code

parent 625f428a
......@@ -117,8 +117,8 @@ public class JerseyAutoConfiguration implements ServletContextAware {
this.path = parseApplicationPath(this.jersey.getApplicationPath());
}
else {
this.path = findApplicationPath(
AnnotationUtils.findAnnotation(this.config.getApplication().getClass(), ApplicationPath.class));
this.path = findApplicationPath(AnnotationUtils.findAnnotation(
this.config.getApplication().getClass(), ApplicationPath.class));
}
}
......@@ -149,7 +149,8 @@ public class JerseyAutoConfiguration implements ServletContextAware {
registration.setFilter(new ServletContainer(this.config));
registration.setUrlPatterns(Arrays.asList(this.path));
registration.setOrder(this.jersey.getFilter().getOrder());
registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH, stripPattern(this.path));
registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH,
stripPattern(this.path));
addInitParameters(registration);
registration.setName("jerseyFilter");
registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
......@@ -167,8 +168,8 @@ public class JerseyAutoConfiguration implements ServletContextAware {
@ConditionalOnMissingBean(name = "jerseyServletRegistration")
@ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "servlet", matchIfMissing = true)
public ServletRegistrationBean jerseyServletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(this.config),
this.path);
ServletRegistrationBean registration = new ServletRegistrationBean(
new ServletContainer(this.config), this.path);
addInitParameters(registration);
registration.setName(getServletRegistrationName());
registration.setLoadOnStartup(this.jersey.getServlet().getLoadOnStartup());
......@@ -203,18 +204,23 @@ public class JerseyAutoConfiguration implements ServletContextAware {
@Override
public void setServletContext(ServletContext servletContext) {
String servletRegistrationName = getServletRegistrationName();
ServletRegistration registration = servletContext.getServletRegistration(servletRegistrationName);
ServletRegistration registration = servletContext
.getServletRegistration(servletRegistrationName);
if (registration != null) {
if (logger.isInfoEnabled()) {
logger.info("Configuring existing registration for Jersey servlet '" + servletRegistrationName + "'");
logger.info("Configuring existing registration for Jersey servlet '"
+ servletRegistrationName + "'");
}
registration.setInitParameters(this.jersey.getInit());
registration.setInitParameter(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, Boolean.TRUE.toString());
registration.setInitParameter(
CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE,
Boolean.TRUE.toString());
}
}
@Order(Ordered.HIGHEST_PRECEDENCE)
public static final class JerseyWebApplicationInitializer implements WebApplicationInitializer {
public static final class JerseyWebApplicationInitializer
implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
......@@ -233,19 +239,22 @@ public class JerseyAutoConfiguration implements ServletContextAware {
private static final String JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME = "com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector";
@Bean
public ResourceConfigCustomizer resourceConfigCustomizer(final ObjectMapper objectMapper) {
public ResourceConfigCustomizer resourceConfigCustomizer(
final ObjectMapper objectMapper) {
addJaxbAnnotationIntrospectorIfPresent(objectMapper);
return new ResourceConfigCustomizer() {
@Override
public void customize(ResourceConfig config) {
config.register(JacksonFeature.class);
config.register(new ObjectMapperContextResolver(objectMapper), ContextResolver.class);
config.register(new ObjectMapperContextResolver(objectMapper),
ContextResolver.class);
}
};
}
private void addJaxbAnnotationIntrospectorIfPresent(ObjectMapper objectMapper) {
if (ClassUtils.isPresent(JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME, getClass().getClassLoader())) {
if (ClassUtils.isPresent(JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME,
getClass().getClassLoader())) {
new ObjectMapperCustomizer().addJaxbAnnotationIntrospector(objectMapper);
}
}
......@@ -256,18 +265,22 @@ public class JerseyAutoConfiguration implements ServletContextAware {
JaxbAnnotationIntrospector jaxbAnnotationIntrospector = new JaxbAnnotationIntrospector(
objectMapper.getTypeFactory());
objectMapper.setAnnotationIntrospectors(
createPair(objectMapper.getSerializationConfig(), jaxbAnnotationIntrospector),
createPair(objectMapper.getDeserializationConfig(), jaxbAnnotationIntrospector));
createPair(objectMapper.getSerializationConfig(),
jaxbAnnotationIntrospector),
createPair(objectMapper.getDeserializationConfig(),
jaxbAnnotationIntrospector));
}
private AnnotationIntrospector createPair(MapperConfig<?> config,
JaxbAnnotationIntrospector jaxbAnnotationIntrospector) {
return AnnotationIntrospector.pair(config.getAnnotationIntrospector(), jaxbAnnotationIntrospector);
return AnnotationIntrospector.pair(config.getAnnotationIntrospector(),
jaxbAnnotationIntrospector);
}
}
private static final class ObjectMapperContextResolver implements ContextResolver<ObjectMapper> {
private static final class ObjectMapperContextResolver
implements ContextResolver<ObjectMapper> {
private final ObjectMapper objectMapper;
......
......@@ -43,8 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link JerseyAutoConfiguration} when using a custom
* {@link Application}.
* Tests for {@link JerseyAutoConfiguration} when using a custom {@link Application}.
*
* @author Stephane Nicoll
*/
......@@ -58,7 +57,8 @@ public class JerseyAutoConfigurationCustomApplicationTests {
@Test
public void contextLoads() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/test/hello", String.class);
ResponseEntity<String> entity = this.restTemplate.getForEntity("/test/hello",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
......@@ -78,8 +78,9 @@ public class JerseyAutoConfigurationCustomApplicationTests {
}
@Configuration
@Import({ EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
@Import({ EmbeddedServletContainerAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class })
static class TestConfiguration {
@Configuration
......
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -47,10 +47,12 @@ public class SampleAntApplicationIT {
});
assertThat(jarFiles).hasSize(1);
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
Process process = new JavaExecutable()
.processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
process.waitFor(5, TimeUnit.MINUTES);
assertThat(process.exitValue()).isEqualTo(0);
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
String output = FileCopyUtils
.copyToString(new InputStreamReader(process.getInputStream()));
assertThat(output).contains("Spring Boot Ant Example");
}
......
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -73,4 +73,5 @@ public class City implements Serializable {
public String toString() {
return getName() + "," + getState() + "," + getCountry();
}
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -78,4 +78,5 @@ public class Hotel implements Serializable {
public String getZip() {
return this.zip;
}
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,5 +17,7 @@
package sample.data.jpa.domain;
public enum Rating {
TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT,
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -126,4 +126,5 @@ public class Review implements Serializable {
public void setDetails(String details) {
this.details = details;
}
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable {
public void setDetails(String details) {
this.details = details;
}
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,5 +17,7 @@
package sample.data.jpa.domain;
public enum TripType {
BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
public void setName(String name) {
this.name = name;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,4 +75,5 @@ class CityServiceImpl implements CityService {
Assert.notNull(city, "City must not be null");
return this.hotelRepository.findByCity(city, pageable);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService {
Long count = this.ratingCount.get(rating);
return count == null ? 0 : count;
}
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -45,4 +45,5 @@ public class CityRepositoryIntegrationTests {
Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
assertThat(cities.getTotalElements()).isGreaterThan(20L);
}
}
......@@ -67,4 +67,5 @@ public class HotelRepositoryIntegrationTests {
assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE);
assertThat(counts.get(0).getCount()).isGreaterThan(1L);
}
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -24,6 +24,7 @@ public class Customer {
private String id;
private String firstName;
private String lastName;
public Customer() {
......
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -26,6 +26,7 @@ public class Customer {
private Long id;
private String firstName;
private String lastName;
public Customer() {
......
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -73,4 +73,5 @@ public class City implements Serializable {
public String toString() {
return getName() + "," + getState() + "," + getCountry();
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -72,4 +72,5 @@ public class Hotel implements Serializable {
public String getZip() {
return this.zip;
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
public void setName(String name) {
this.name = name;
}
}
......@@ -83,4 +83,5 @@ public class SampleDataRestApplicationTests {
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.cities", hasSize(3)));
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -63,4 +63,5 @@ public class CityRepositoryIntegrationTests {
new PageRequest(0, 10));
assertThat(cities.getTotalElements()).isEqualTo(3L);
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -22,10 +22,13 @@ import javax.persistence.Id;
@Entity
public class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
public String getFirstName() {
......@@ -49,4 +52,5 @@ public class Person {
return "Person [firstName=" + this.firstName + ", lastName=" + this.lastName
+ "]";
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -74,4 +74,5 @@ public class City implements Serializable {
public String toString() {
return getName() + "," + getState() + "," + getCountry();
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -79,4 +79,5 @@ public class Hotel implements Serializable {
public String getZip() {
return this.zip;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,5 +17,7 @@
package sample.hibernate4.domain;
public enum Rating {
TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT,
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -127,4 +127,5 @@ public class Review implements Serializable {
public void setDetails(String details) {
this.details = details;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable {
public void setDetails(String details) {
this.details = details;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,5 +17,7 @@
package sample.hibernate4.domain;
public enum TripType {
BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
public void setName(String name) {
this.name = name;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,4 +75,5 @@ class CityServiceImpl implements CityService {
Assert.notNull(city, "City must not be null");
return this.hotelRepository.findByCity(city, pageable);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService {
Long count = this.ratingCount.get(rating);
return count == null ? 0 : count;
}
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -45,4 +45,5 @@ public class CityRepositoryIntegrationTests {
Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
assertThat(cities.getTotalElements()).isGreaterThan(20L);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests {
@Autowired
CityRepository cityRepository;
@Autowired
HotelRepository repository;
......@@ -66,4 +67,5 @@ public class HotelRepositoryIntegrationTests {
assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE);
assertThat(counts.get(0).getCount()).isGreaterThan(1L);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -74,4 +74,5 @@ public class City implements Serializable {
public String toString() {
return getName() + "," + getState() + "," + getCountry();
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -79,4 +79,5 @@ public class Hotel implements Serializable {
public String getZip() {
return this.zip;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,5 +17,7 @@
package sample.hibernate52.domain;
public enum Rating {
TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT,
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -127,4 +127,5 @@ public class Review implements Serializable {
public void setDetails(String details) {
this.details = details;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable {
public void setDetails(String details) {
this.details = details;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,5 +17,7 @@
package sample.hibernate52.domain;
public enum TripType {
BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable {
public void setName(String name) {
this.name = name;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,4 +75,5 @@ class CityServiceImpl implements CityService {
Assert.notNull(city, "City must not be null");
return this.hotelRepository.findByCity(city, pageable);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService {
Long count = this.ratingCount.get(rating);
return count == null ? 0 : count;
}
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -45,4 +45,5 @@ public class CityRepositoryIntegrationTests {
Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
assertThat(cities.getTotalElements()).isGreaterThan(20L);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests {
@Autowired
CityRepository cityRepository;
@Autowired
HotelRepository repository;
......@@ -66,4 +67,5 @@ public class HotelRepositoryIntegrationTests {
assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE);
assertThat(counts.get(0).getCount()).isGreaterThan(1L);
}
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -59,4 +59,5 @@ public class SampleHypermediaUiSecureApplicationTests {
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -25,4 +25,5 @@ public class SampleHypermediaUiApplication {
public static void main(String[] args) {
SpringApplication.run(SampleHypermediaUiApplication.class, args);
}
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -123,4 +123,5 @@ public class SampleIntegrationApplicationTests {
}
return candidates;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -76,4 +76,5 @@ public class JooqExamples implements CommandLineRunner {
});
System.out.println("jOOQ SQL " + list);
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -68,4 +68,5 @@ public class SampleLiquibaseApplicationTests {
}
return false;
}
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -55,6 +55,7 @@ public class SampleController {
public void setValue(String value) {
this.value = value;
}
}
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -55,6 +55,7 @@ public class SampleController {
public void setValue(String value) {
this.value = value;
}
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -99,4 +99,5 @@ public class SampleIntegrationParentApplicationTests {
}
return builder.toString();
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -93,6 +93,7 @@ public class SampleSecureApplicationTests {
@PropertySource("classpath:test.properties")
@Configuration
protected static class TestConfiguration {
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -64,4 +64,5 @@ public class SampleServletApplicationTests {
private String getPassword() {
return this.security.getUser().getPassword();
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -40,4 +40,5 @@ public class VehicleIdentificationNumberNotFoundException extends RuntimeExcepti
public VehicleIdentificationNumber getVehicleIdentificationNumber() {
return this.vehicleIdentificationNumber;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -139,6 +139,7 @@ public class SampleTomcatTwoConnectorsApplicationTests {
}
super.prepareConnection(connection, httpMethod);
}
}
}
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -55,4 +55,5 @@ public class WebConfig extends WebMvcConfigurerAdapter {
DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -63,4 +63,5 @@ public class Message {
public void setSummary(String summary) {
this.summary = summary;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -66,4 +66,5 @@ public class Message {
public void setSummary(String summary) {
this.summary = summary;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -81,6 +81,7 @@ public class MessageControllerWebTests {
}
private static class RegexMatcher extends TypeSafeMatcher<String> {
private final String regex;
public RegexMatcher(String regex) {
......@@ -106,5 +107,7 @@ public class MessageControllerWebTests {
description.appendText("a string that matches regex: ")
.appendText(this.regex);
}
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
......@@ -63,4 +63,5 @@ public class Message {
public void setSummary(String summary) {
this.summary = summary;
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -81,6 +81,7 @@ public class MessageControllerWebTests {
}
private static class RegexMatcher extends TypeSafeMatcher<String> {
private final String regex;
public RegexMatcher(String regex) {
......@@ -106,5 +107,7 @@ public class MessageControllerWebTests {
description.appendText("a string that matches regex: ")
.appendText(this.regex);
}
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint {
session.getBasicRemote()
.sendText("Reversed: " + new StringBuilder(message).reverse());
}
}
......@@ -18,5 +18,7 @@
package samples.websocket.jetty.snake;
public enum Direction {
NONE, NORTH, SOUTH, EAST, WEST
}
......@@ -20,9 +20,13 @@ package samples.websocket.jetty.snake;
public class Location {
public int x;
public int y;
public static final int GRID_SIZE = 10;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int PLAYFIELD_WIDTH = 640;
public Location(int x, int y) {
......@@ -74,4 +78,5 @@ public class Location {
result = 31 * result + this.y;
return result;
}
}
......@@ -157,4 +157,5 @@ public class Snake {
public String getHexColor() {
return this.hexColor;
}
}
......@@ -23,7 +23,9 @@ import java.util.Random;
public class SnakeUtils {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final Random random = new Random();
......
......@@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SnakeWebSocketHandler extends TextWebSocketHandler {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final AtomicInteger snakeIds = new AtomicInteger(0);
private static final Random random = new Random();
private final int id;
private Snake snake;
public static String getRandomHexColor() {
......@@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
SnakeTimer.broadcast(
String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id)));
}
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -132,6 +132,7 @@ public class SampleWebSocketsApplicationTests {
public GreetingService greetingService() {
return new SimpleGreetingService();
}
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint {
session.getBasicRemote()
.sendText("Reversed: " + new StringBuilder(message).reverse());
}
}
......@@ -18,5 +18,7 @@
package samples.websocket.jetty93.snake;
public enum Direction {
NONE, NORTH, SOUTH, EAST, WEST
}
......@@ -20,9 +20,13 @@ package samples.websocket.jetty93.snake;
public class Location {
public int x;
public int y;
public static final int GRID_SIZE = 10;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int PLAYFIELD_WIDTH = 640;
public Location(int x, int y) {
......@@ -74,4 +78,5 @@ public class Location {
result = 31 * result + this.y;
return result;
}
}
......@@ -157,4 +157,5 @@ public class Snake {
public String getHexColor() {
return this.hexColor;
}
}
......@@ -23,7 +23,9 @@ import java.util.Random;
public class SnakeUtils {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final Random random = new Random();
......
......@@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SnakeWebSocketHandler extends TextWebSocketHandler {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final AtomicInteger snakeIds = new AtomicInteger(0);
private static final Random random = new Random();
private final int id;
private Snake snake;
public static String getRandomHexColor() {
......@@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
SnakeTimer.broadcast(
String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id)));
}
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -132,6 +132,7 @@ public class SampleWebSocketsApplicationTests {
public GreetingService greetingService() {
return new SimpleGreetingService();
}
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint {
session.getBasicRemote()
.sendText("Reversed: " + new StringBuilder(message).reverse());
}
}
......@@ -18,5 +18,7 @@
package samples.websocket.tomcat.snake;
public enum Direction {
NONE, NORTH, SOUTH, EAST, WEST
}
......@@ -20,9 +20,13 @@ package samples.websocket.tomcat.snake;
public class Location {
public int x;
public int y;
public static final int GRID_SIZE = 10;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int PLAYFIELD_WIDTH = 640;
public Location(int x, int y) {
......@@ -74,4 +78,5 @@ public class Location {
result = 31 * result + this.y;
return result;
}
}
......@@ -157,4 +157,5 @@ public class Snake {
public String getHexColor() {
return this.hexColor;
}
}
......@@ -23,7 +23,9 @@ import java.util.Random;
public class SnakeUtils {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final Random random = new Random();
......
......@@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SnakeWebSocketHandler extends TextWebSocketHandler {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final AtomicInteger snakeIds = new AtomicInteger(0);
private static final Random random = new Random();
private final int id;
private Snake snake;
public static String getRandomHexColor() {
......@@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
SnakeTimer.broadcast(
String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id)));
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -36,4 +36,5 @@ public class SnakeTimerTests {
SnakeTimer.broadcast("");
assertThat(SnakeTimer.getSnakes()).hasSize(0);
}
}
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint {
session.getBasicRemote()
.sendText("Reversed: " + new StringBuilder(message).reverse());
}
}
......@@ -18,5 +18,7 @@
package samples.websocket.undertow.snake;
public enum Direction {
NONE, NORTH, SOUTH, EAST, WEST
}
......@@ -20,9 +20,13 @@ package samples.websocket.undertow.snake;
public class Location {
public int x;
public int y;
public static final int GRID_SIZE = 10;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int PLAYFIELD_WIDTH = 640;
public Location(int x, int y) {
......@@ -74,4 +78,5 @@ public class Location {
result = 31 * result + this.y;
return result;
}
}
......@@ -157,4 +157,5 @@ public class Snake {
public String getHexColor() {
return this.hexColor;
}
}
......@@ -23,7 +23,9 @@ import java.util.Random;
public class SnakeUtils {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final Random random = new Random();
......
......@@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SnakeWebSocketHandler extends TextWebSocketHandler {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final AtomicInteger snakeIds = new AtomicInteger(0);
private static final Random random = new Random();
private final int id;
private Snake snake;
public static String getRandomHexColor() {
......@@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
SnakeTimer.broadcast(
String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id)));
}
}
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -36,4 +36,5 @@ public class SnakeTimerTests {
SnakeTimer.broadcast("");
assertThat(SnakeTimer.getSnakes()).hasSize(0);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment