Reformat code using Eclipse Mars
This commit is contained in:
@@ -51,8 +51,8 @@ public class SampleActuatorApplicationTests {
|
||||
@Test
|
||||
public void testHome() throws Exception {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.port, Map.class);
|
||||
ResponseEntity<Map> entity = new TestRestTemplate()
|
||||
.getForEntity("http://localhost:" + this.port, Map.class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> body = entity.getBody();
|
||||
@@ -62,8 +62,8 @@ public class SampleActuatorApplicationTests {
|
||||
@Test
|
||||
public void testHealth() throws Exception {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.port + "/health", Map.class);
|
||||
ResponseEntity<Map> entity = new TestRestTemplate()
|
||||
.getForEntity("http://localhost:" + this.port + "/health", Map.class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> body = entity.getBody();
|
||||
|
||||
@@ -48,12 +48,10 @@ public class SampleAntApplicationIT {
|
||||
|
||||
});
|
||||
assertThat("Number of jars", jarFiles.length, equalTo(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(), equalTo(0));
|
||||
String output = FileCopyUtils.copyToString(new InputStreamReader(process
|
||||
.getInputStream()));
|
||||
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
|
||||
assertThat(output, containsString("Spring Boot Ant Example"));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ public class CacheManagerCheck implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... strings) throws Exception {
|
||||
logger.info("\n\n"
|
||||
+ "=========================================================\n"
|
||||
logger.info("\n\n" + "=========================================================\n"
|
||||
+ "Using cache manager: " + this.cacheManager.getClass().getName() + "\n"
|
||||
+ "=========================================================\n\n");
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ class SampleClient {
|
||||
|
||||
@Scheduled(fixedDelay = 500)
|
||||
public void retrieveCountry() {
|
||||
String randomCode = SAMPLE_COUNTRY_CODES.get(this.random
|
||||
.nextInt(SAMPLE_COUNTRY_CODES.size()));
|
||||
String randomCode = SAMPLE_COUNTRY_CODES
|
||||
.get(this.random.nextInt(SAMPLE_COUNTRY_CODES.size()));
|
||||
System.out.println("Looking for country with code '" + randomCode + "'");
|
||||
this.countryService.findByCode(randomCode);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package sample.data.cassandra;
|
||||
import org.cassandraunit.spring.CassandraUnitDependencyInjectionTestExecutionListener;
|
||||
import org.springframework.core.Ordered;
|
||||
|
||||
public class OrderedCassandraTestExecutionListener extends
|
||||
CassandraUnitDependencyInjectionTestExecutionListener {
|
||||
public class OrderedCassandraTestExecutionListener
|
||||
extends CassandraUnitDependencyInjectionTestExecutionListener {
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
|
||||
@@ -35,8 +35,8 @@ public class MyController {
|
||||
sessionVar = new Date();
|
||||
session.setAttribute("var", sessionVar);
|
||||
}
|
||||
ModelMap model = new ModelMap("message", Message.MESSAGE).addAttribute(
|
||||
"sessionVar", sessionVar);
|
||||
ModelMap model = new ModelMap("message", Message.MESSAGE)
|
||||
.addAttribute("sessionVar", sessionVar);
|
||||
return new ModelAndView("hello", model);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,8 +85,8 @@ public class SampleHypermediaJpaApplicationIntegrationTests {
|
||||
public void browser() throws Exception {
|
||||
MvcResult response = this.mockMvc.perform(get("/").accept(MediaType.TEXT_HTML))
|
||||
.andExpect(status().isFound()).andReturn();
|
||||
assertEquals("/browser/index.html#", response.getResponse()
|
||||
.getHeaders("location").get(0));
|
||||
assertEquals("/browser/index.html#",
|
||||
response.getResponse().getHeaders("location").get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ public class SampleHypermediaUiApplicationTests {
|
||||
|
||||
@Test
|
||||
public void home() {
|
||||
String response = new TestRestTemplate().getForObject("http://localhost:"
|
||||
+ this.port, String.class);
|
||||
String response = new TestRestTemplate()
|
||||
.getForObject("http://localhost:" + this.port, String.class);
|
||||
assertTrue("Wrong body: " + response, response.contains("Hello World"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void links() {
|
||||
String response = new TestRestTemplate().getForObject("http://localhost:"
|
||||
+ this.port + "/actuator", String.class);
|
||||
String response = new TestRestTemplate().getForObject(
|
||||
"http://localhost:" + this.port + "/actuator", String.class);
|
||||
assertTrue("Wrong body: " + response, response.contains("\"_links\":"));
|
||||
}
|
||||
|
||||
@@ -63,8 +63,9 @@ public class SampleHypermediaUiApplicationTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
|
||||
ResponseEntity<String> response = new TestRestTemplate().exchange(
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET, new URI(
|
||||
"http://localhost:" + this.port + "/actuator")), String.class);
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET,
|
||||
new URI("http://localhost:" + this.port + "/actuator")),
|
||||
String.class);
|
||||
assertTrue("Wrong body: " + response, response.getBody().contains("\"_links\":"));
|
||||
}
|
||||
|
||||
@@ -72,9 +73,9 @@ public class SampleHypermediaUiApplicationTests {
|
||||
public void homeWithHtml() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
ResponseEntity<String> response = new TestRestTemplate().exchange(
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET, new URI(
|
||||
"http://localhost:" + this.port)), String.class);
|
||||
ResponseEntity<String> response = new TestRestTemplate()
|
||||
.exchange(new RequestEntity<Void>(headers, HttpMethod.GET,
|
||||
new URI("http://localhost:" + this.port)), String.class);
|
||||
assertTrue("Wrong body: " + response, response.getBody().contains("Hello World"));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ public class SampleHypermediaApplicationHomePageTests {
|
||||
|
||||
@Test
|
||||
public void home() {
|
||||
String response = new TestRestTemplate().getForObject("http://localhost:"
|
||||
+ this.port, String.class);
|
||||
String response = new TestRestTemplate()
|
||||
.getForObject("http://localhost:" + this.port, String.class);
|
||||
assertTrue("Wrong body: " + response, response.contains("404"));
|
||||
}
|
||||
|
||||
@@ -56,8 +56,9 @@ public class SampleHypermediaApplicationHomePageTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
|
||||
ResponseEntity<String> response = new TestRestTemplate().exchange(
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET, new URI(
|
||||
"http://localhost:" + this.port + "/actuator")), String.class);
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET,
|
||||
new URI("http://localhost:" + this.port + "/actuator")),
|
||||
String.class);
|
||||
assertTrue("Wrong body: " + response, response.getBody().contains("\"_links\":"));
|
||||
}
|
||||
|
||||
@@ -66,8 +67,9 @@ public class SampleHypermediaApplicationHomePageTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
ResponseEntity<String> response = new TestRestTemplate().exchange(
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET, new URI(
|
||||
"http://localhost:" + this.port + "/actuator/")), String.class);
|
||||
new RequestEntity<Void>(headers, HttpMethod.GET,
|
||||
new URI("http://localhost:" + this.port + "/actuator/")),
|
||||
String.class);
|
||||
assertTrue("Wrong body: " + response, response.getBody().contains("HAL Browser"));
|
||||
}
|
||||
|
||||
|
||||
@@ -71,13 +71,14 @@ public class SampleJettyApplicationTests {
|
||||
|
||||
RestTemplate restTemplate = new TestRestTemplate();
|
||||
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange("http://localhost:"
|
||||
+ this.port, HttpMethod.GET, requestEntity, byte[].class);
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange(
|
||||
"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
|
||||
byte[].class);
|
||||
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
|
||||
GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
|
||||
entity.getBody()));
|
||||
GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()));
|
||||
try {
|
||||
assertEquals("Hello World",
|
||||
StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
|
||||
|
||||
@@ -69,11 +69,12 @@ public class SampleJetty8ApplicationTests {
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
RestTemplate restTemplate = new TestRestTemplate();
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange("http://localhost:"
|
||||
+ this.port, HttpMethod.GET, requestEntity, byte[].class);
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange(
|
||||
"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
|
||||
byte[].class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
|
||||
entity.getBody()));
|
||||
GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()));
|
||||
try {
|
||||
assertEquals("Hello World",
|
||||
StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
|
||||
|
||||
@@ -57,8 +57,8 @@ public class SampleJetty93ApplicationTests {
|
||||
|
||||
@Test
|
||||
public void testHome() throws Exception {
|
||||
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.port, String.class);
|
||||
ResponseEntity<String> entity = new TestRestTemplate()
|
||||
.getForEntity("http://localhost:" + this.port, String.class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
assertEquals("Hello World", entity.getBody());
|
||||
}
|
||||
@@ -69,11 +69,12 @@ public class SampleJetty93ApplicationTests {
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
RestTemplate restTemplate = new TestRestTemplate();
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange("http://localhost:"
|
||||
+ this.port, HttpMethod.GET, requestEntity, byte[].class);
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange(
|
||||
"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
|
||||
byte[].class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
|
||||
entity.getBody()));
|
||||
GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()));
|
||||
try {
|
||||
assertEquals("Hello World",
|
||||
StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
|
||||
|
||||
@@ -24,7 +24,8 @@ import sample.jooq.domain.tables.records.LanguageRecord;
|
||||
* A class modelling foreign key relationships between tables of the <code>PUBLIC</code>
|
||||
* schema
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Keys {
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ import sample.jooq.domain.tables.Language;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Public extends SchemaImpl {
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ import sample.jooq.domain.tables.Language;
|
||||
/**
|
||||
* Convenience access to all tables in PUBLIC
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Tables {
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ import sample.jooq.domain.tables.records.AuthorRecord;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Author extends TableImpl<AuthorRecord> {
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ import sample.jooq.domain.tables.records.BookRecord;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Book extends TableImpl<BookRecord> {
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ import sample.jooq.domain.tables.records.BookStoreRecord;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class BookStore extends TableImpl<BookStoreRecord> {
|
||||
|
||||
@@ -64,7 +65,8 @@ public class BookStore extends TableImpl<BookStoreRecord> {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private BookStore(String alias, Table<BookStoreRecord> aliased, Field<?>[] parameters) {
|
||||
private BookStore(String alias, Table<BookStoreRecord> aliased,
|
||||
Field<?>[] parameters) {
|
||||
super(alias, Public.PUBLIC, aliased, parameters, "");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ import sample.jooq.domain.tables.records.BookToBookStoreRecord;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class BookToBookStore extends TableImpl<BookToBookStoreRecord> {
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ import sample.jooq.domain.tables.records.LanguageRecord;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Language extends TableImpl<LanguageRecord> {
|
||||
|
||||
|
||||
@@ -18,10 +18,11 @@ import sample.jooq.domain.tables.Author;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class AuthorRecord extends UpdatableRecordImpl<AuthorRecord> implements
|
||||
Record6<Integer, String, String, Date, Integer, Byte> {
|
||||
public class AuthorRecord extends UpdatableRecordImpl<AuthorRecord>
|
||||
implements Record6<Integer, String, String, Date, Integer, Byte> {
|
||||
|
||||
private static final long serialVersionUID = -983051550;
|
||||
|
||||
|
||||
@@ -16,10 +16,11 @@ import sample.jooq.domain.tables.Book;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class BookRecord extends UpdatableRecordImpl<BookRecord> implements
|
||||
Record5<Integer, Integer, String, Integer, Integer> {
|
||||
public class BookRecord extends UpdatableRecordImpl<BookRecord>
|
||||
implements Record5<Integer, Integer, String, Integer, Integer> {
|
||||
|
||||
private static final long serialVersionUID = 220424682;
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@ import sample.jooq.domain.tables.BookStore;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class BookStoreRecord extends TableRecordImpl<BookStoreRecord> implements
|
||||
Record1<String> {
|
||||
public class BookStoreRecord extends TableRecordImpl<BookStoreRecord>
|
||||
implements Record1<String> {
|
||||
|
||||
private static final long serialVersionUID = -1969224219;
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ import sample.jooq.domain.tables.BookToBookStore;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class BookToBookStoreRecord extends UpdatableRecordImpl<BookToBookStoreRecord>
|
||||
implements Record3<String, Integer, Integer> {
|
||||
|
||||
@@ -16,10 +16,11 @@ import sample.jooq.domain.tables.Language;
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Generated(value = { "http://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@Generated(value = { "http://www.jooq.org",
|
||||
"jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ")
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class LanguageRecord extends UpdatableRecordImpl<LanguageRecord> implements
|
||||
Record3<Integer, String, String> {
|
||||
public class LanguageRecord extends UpdatableRecordImpl<LanguageRecord>
|
||||
implements Record3<Integer, String, String> {
|
||||
|
||||
private static final long serialVersionUID = -1003202585;
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ public class SampleJooqApplicationTests {
|
||||
SampleJooqApplication.main(NO_ARGS);
|
||||
assertThat(this.out.toString(), containsString("jOOQ Fetch 1 Greg Turnquest"));
|
||||
assertThat(this.out.toString(), containsString("jOOQ Fetch 2 Craig Walls"));
|
||||
assertThat(this.out.toString(), containsString("jOOQ SQL "
|
||||
+ "[Learning Spring Boot : Greg Turnquest, "
|
||||
+ "Spring Boot in Action : Craig Walls]"));
|
||||
assertThat(this.out.toString(),
|
||||
containsString("jOOQ SQL " + "[Learning Spring Boot : Greg Turnquest, "
|
||||
+ "Spring Boot in Action : Craig Walls]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,9 @@ public class AggregateMetricsConfiguration {
|
||||
}
|
||||
|
||||
private MetricReader globalMetricsForAggregation() {
|
||||
return new RedisMetricRepository(this.connectionFactory, this.export.getRedis()
|
||||
.getAggregatePrefix(), this.export.getRedis().getKey());
|
||||
return new RedisMetricRepository(this.connectionFactory,
|
||||
this.export.getRedis().getAggregatePrefix(),
|
||||
this.export.getRedis().getKey());
|
||||
}
|
||||
|
||||
private MetricReader aggregatesMetricReader() {
|
||||
|
||||
@@ -38,8 +38,8 @@ public class SampleRedisExportApplication {
|
||||
@ExportMetricWriter
|
||||
public RedisMetricRepository redisMetricWriter(
|
||||
RedisConnectionFactory connectionFactory) {
|
||||
return new RedisMetricRepository(connectionFactory, this.export.getRedis()
|
||||
.getPrefix(), this.export.getRedis().getKey());
|
||||
return new RedisMetricRepository(connectionFactory,
|
||||
this.export.getRedis().getPrefix(), this.export.getRedis().getKey());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -33,8 +33,8 @@ public class SampleParentContextApplication {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new SpringApplicationBuilder(Parent.class).child(
|
||||
SampleParentContextApplication.class).run(args);
|
||||
new SpringApplicationBuilder(Parent.class)
|
||||
.child(SampleParentContextApplication.class).run(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ public class SamplePropertyValidationApplication {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new SpringApplicationBuilder(SamplePropertyValidationApplication.class).profiles(
|
||||
"app").run(args);
|
||||
new SpringApplicationBuilder(SamplePropertyValidationApplication.class)
|
||||
.profiles("app").run(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,23 +85,22 @@ public class SampleSecureOAuth2ApplicationTests {
|
||||
public void useAppSecretsPlusUserAccountToGetBearerToken() throws Exception {
|
||||
String header = "Basic " + new String(Base64.encode("foo:bar".getBytes()));
|
||||
MvcResult result = this.mvc
|
||||
.perform(
|
||||
post("/oauth/token").header("Authorization", header)
|
||||
.param("grant_type", "password").param("scope", "read")
|
||||
.param("username", "greg").param("password", "turnquist"))
|
||||
.perform(post("/oauth/token").header("Authorization", header)
|
||||
.param("grant_type", "password").param("scope", "read")
|
||||
.param("username", "greg").param("password", "turnquist"))
|
||||
.andExpect(status().isOk()).andDo(print()).andReturn();
|
||||
Object accessToken = this.objectMapper.readValue(
|
||||
result.getResponse().getContentAsString(), Map.class).get("access_token");
|
||||
Object accessToken = this.objectMapper
|
||||
.readValue(result.getResponse().getContentAsString(), Map.class)
|
||||
.get("access_token");
|
||||
MvcResult flightsAction = this.mvc
|
||||
.perform(
|
||||
get("/flights/1").accept(MediaTypes.HAL_JSON).header(
|
||||
"Authorization", "Bearer " + accessToken))
|
||||
.perform(get("/flights/1").accept(MediaTypes.HAL_JSON)
|
||||
.header("Authorization", "Bearer " + accessToken))
|
||||
.andExpect(
|
||||
header().string("Content-Type", MediaTypes.HAL_JSON.toString()))
|
||||
.andExpect(status().isOk()).andDo(print()).andReturn();
|
||||
|
||||
Flight flight = this.objectMapper.readValue(flightsAction.getResponse()
|
||||
.getContentAsString(), Flight.class);
|
||||
Flight flight = this.objectMapper.readValue(
|
||||
flightsAction.getResponse().getContentAsString(), Flight.class);
|
||||
|
||||
assertThat(flight.getOrigin(), is("Nashville"));
|
||||
assertThat(flight.getDestination(), is("Dallas"));
|
||||
|
||||
@@ -63,9 +63,8 @@ public class SampleOAuth2SsoApplicationTests {
|
||||
|
||||
@Test
|
||||
public void everythingIsSecuredByDefault() throws Exception {
|
||||
this.mvc.perform(get("/"))
|
||||
.andExpect(status().isFound())
|
||||
.andExpect(header().string("location", containsString("localhost/login")));
|
||||
this.mvc.perform(get("/")).andExpect(status().isFound()).andExpect(
|
||||
header().string("location", containsString("localhost/login")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ import static org.junit.Assert.assertEquals;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration({ SampleSecureApplication.class, TestConfiguration.class })
|
||||
@SpringApplicationConfiguration({ SampleSecureApplication.class,
|
||||
TestConfiguration.class })
|
||||
public class SampleSecureApplicationTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -67,11 +67,12 @@ public class SampleTomcatApplicationTests {
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
RestTemplate restTemplate = new TestRestTemplate();
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange("http://localhost:"
|
||||
+ this.port, HttpMethod.GET, requestEntity, byte[].class);
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange(
|
||||
"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
|
||||
byte[].class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
|
||||
entity.getBody()));
|
||||
GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()));
|
||||
try {
|
||||
assertEquals("Hello World",
|
||||
StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
|
||||
|
||||
@@ -71,11 +71,12 @@ public class SampleUndertowApplicationTests {
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
RestTemplate restTemplate = new TestRestTemplate();
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange("http://localhost:"
|
||||
+ this.port, HttpMethod.GET, requestEntity, byte[].class);
|
||||
ResponseEntity<byte[]> entity = restTemplate.exchange(
|
||||
"http://localhost:" + this.port, HttpMethod.GET, requestEntity,
|
||||
byte[].class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(
|
||||
entity.getBody()));
|
||||
GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()));
|
||||
try {
|
||||
assertEquals("Hello World",
|
||||
StreamUtils.copyToString(inflater, Charset.forName("UTF-8")));
|
||||
|
||||
@@ -59,8 +59,8 @@ public class SampleGithubApplicationTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.mvc = webAppContextSetup(this.context).addFilters(this.filter,
|
||||
this.filterChain).build();
|
||||
this.mvc = webAppContextSetup(this.context)
|
||||
.addFilters(this.filter, this.filterChain).build();
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user