#106 - Polishing.

Some JavaDoc improvements, copyright headers. Using a logger instead of System.out in the test case now. Removed commented out dependency declaration from JPA pom.xml.
This commit is contained in:
Oliver Gierke
2015-06-18 14:23:18 +02:00
parent fd7d35a826
commit 8ed43d34fc
5 changed files with 13 additions and 20 deletions

View File

@@ -15,4 +15,5 @@
<artifactId>spring-data-jpa-java8</artifactId>
<name>Spring Data JPA - Java 8 specific features</name>
</project>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2015 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.

View File

@@ -18,6 +18,8 @@ package example.springdata.jpa.java8;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import lombok.extern.slf4j.Slf4j;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -41,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = AuditingConfiguration.class)
@Transactional
@Slf4j
public class Java8IntegrationTests {
@Autowired CustomerRepository repository;
@@ -104,10 +107,8 @@ public class Java8IntegrationTests {
}
/**
* Here we demonstrate the usage of CompletableFuture as a result wrapper for asynchronous
* Repository query methods.
*
* Note that we need to disable the surrounding TX to be able to asynchronously read the wirtten
* Here we demonstrate the usage of {@link CompletableFuture} as a result wrapper for asynchronous repository query
* methods. Note, that we need to disable the surrounding transaction to be able to asynchronously read the written
* data from from another thread within the same test method.
*/
@Test
@@ -118,19 +119,19 @@ public class Java8IntegrationTests {
repository.save(new Customer("Customer2", "Bar"));
CompletableFuture<Void> future = repository.readAllBy().thenAccept(customers -> {
assertThat(customers, hasSize(2));
customers.forEach(System.out::println);
System.out.println("Completed!");
customers.forEach(customer -> log.info(customer.toString()));
log.info("Completed!");
});
while (!future.isDone()) {
System.out.println("waiting...");
log.info("Waiting for the CompletableFuture to finish...");
TimeUnit.MILLISECONDS.sleep(500);
}
future.get();
System.out.println("Done");
log.info("Done!");
}
}

View File

@@ -1,4 +0,0 @@
#logging.level.org.springframework=INFO
#logging.level.org.springframework.orm=TRACE
#logging.level.org.springframework.transaction=TRACE
#logging.level.org.hsqldb=TRACE

View File

@@ -39,11 +39,6 @@
<artifactId>joda-time</artifactId>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.h2database</groupId> -->
<!-- <artifactId>h2</artifactId> -->
<!-- </dependency> -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>