From 8869750c25611f05db2ba86f6c0cf5fd5092df84 Mon Sep 17 00:00:00 2001 From: figueroaRicardo <41128440+figueroaRicardo@users.noreply.github.com> Date: Wed, 7 Nov 2018 11:37:14 -0600 Subject: [PATCH 1/4] Fix links Closes gh-369 --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 598b626bb..cf6d1aa7f 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ See the presentation here ## Running petclinic locally -Petclinic is a https://spring.io/guides/gs/spring-boot[Spring Boot] application built using https://spring.io/guides/gs/maven/[Maven]. You can build a jar file and run it from the command line: +Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/). You can build a jar file and run it from the command line: ``` @@ -42,7 +42,7 @@ docker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306: ## Working with Petclinic in your IDE -### prerequisites +### Prerequisites The following items should be installed in your system: * Java 8 or newer. * git command line tool (https://help.github.com/articles/set-up-git) @@ -113,7 +113,7 @@ Here is a list of them: The [issue tracker](https://github.com/spring-projects/spring-petclinic/issues) is the preferred channel for bug reports, features requests and submitting pull requests. -For pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at . If you have not previously done so, please fill out and submit the https://cla.pivotal.io/sign/spring[Contributor License Agreement]. +For pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at . If you have not previously done so, please fill out and submit the [Contributor License Agreement](https://cla.pivotal.io/sign/spring). # License From 13f1bfb079210ace2fc1e460dfbb7aedcafdee8c Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 15 Nov 2018 04:24:58 +0800 Subject: [PATCH 2/4] Update to Boot 2.1.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 12462197e..96ab1323e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.BUILD-SNAPSHOT + 2.1.0.RELEASE petclinic From df359ab1bc39b15fa7ba5144993a9c9f33f42a91 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 4 Dec 2018 13:53:23 +0000 Subject: [PATCH 3/4] Update to Boot 2.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 96ab1323e..b5378287e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.RELEASE + 2.1.1.RELEASE petclinic From ab567242851166983e5f0140ab7593fd04c7d365 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 17 Dec 2018 16:41:44 +0000 Subject: [PATCH 4/4] Remove redundant component scan filter The @DataJpaTests creates all the repositories. There's no need for a filter (and there aren't any matching @Service beans anyway). --- .gitignore | 2 ++ .../petclinic/service/ClinicServiceTests.java | 36 +++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 8cdbd1ff4..559982f3d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ target/* .settings/* .classpath .project +.factorypath +.attach_pid* .idea *.iml /target diff --git a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java index 9f12151d9..b5626fae5 100644 --- a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java +++ b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java @@ -16,16 +16,14 @@ package org.springframework.samples.petclinic.service; -import static org.assertj.core.api.Assertions.assertThat; - import java.time.LocalDate; import java.util.Collection; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.context.annotation.ComponentScan; import org.springframework.samples.petclinic.owner.Owner; import org.springframework.samples.petclinic.owner.OwnerRepository; import org.springframework.samples.petclinic.owner.Pet; @@ -35,22 +33,32 @@ import org.springframework.samples.petclinic.vet.Vet; import org.springframework.samples.petclinic.vet.VetRepository; import org.springframework.samples.petclinic.visit.Visit; import org.springframework.samples.petclinic.visit.VisitRepository; -import org.springframework.stereotype.Service; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; +import static org.assertj.core.api.Assertions.assertThat; + /** * Integration test of the Service and the Repository layer. *

- * ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided by the Spring - * TestContext Framework:

  • Spring IoC container caching which spares us unnecessary set up - * time between test execution.
  • Dependency Injection of test fixture instances, meaning that - * we don't need to perform application context lookups. See the use of {@link Autowired @Autowired} on the {@link - * ClinicServiceTests#clinicService clinicService} instance variable, which uses autowiring by - * type.
  • Transaction management, meaning each test method is executed in its own transaction, - * which is automatically rolled back by default. Thus, even if tests insert or otherwise change database state, there - * is no need for a teardown or cleanup script.
  • An {@link org.springframework.context.ApplicationContext - * ApplicationContext} is also inherited and can be used for explicit bean lookup if necessary.
+ * ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided + * by the Spring TestContext Framework: + *

+ *
    + *
  • Spring IoC container caching which spares us unnecessary set up + * time between test execution.
  • + *
  • Dependency Injection of test fixture instances, meaning that we + * don't need to perform application context lookups. See the use of + * {@link Autowired @Autowired} on the {@link + * ClinicServiceTests#clinicService clinicService} instance variable, which uses + * autowiring by type. + *
  • Transaction management, meaning each test method is executed in + * its own transaction, which is automatically rolled back by default. Thus, even if tests + * insert or otherwise change database state, there is no need for a teardown or cleanup + * script. + *
  • An {@link org.springframework.context.ApplicationContext ApplicationContext} is + * also inherited and can be used for explicit bean lookup if necessary.
  • + *
* * @author Ken Krebs * @author Rod Johnson @@ -61,7 +69,7 @@ import org.springframework.transaction.annotation.Transactional; */ @RunWith(SpringRunner.class) -@DataJpaTest(includeFilters = @ComponentScan.Filter(Service.class)) +@DataJpaTest public class ClinicServiceTests { @Autowired