From b459ca33770305653998d340b9891aaae5bc681d Mon Sep 17 00:00:00 2001 From: Mic Date: Mon, 14 Jan 2013 23:23:07 +0800 Subject: [PATCH] added aspectj decaration. All JUnit tests are now successful --- .../org.springframework.ide.eclipse.core.prefs | 16 +++++++++++++--- .springBeans | 2 ++ .../{EntityManagerClinic.java => JpaClinic.java} | 2 +- .../resources/spring/applicationContext-jpa.xml | 7 +++++-- src/main/webapp/resources/html/tutorial.html | 2 +- .../petclinic/aspects/UsageLogAspectTests.java | 16 ++++++++-------- .../jpa/applicationContext-entityManager.xml | 2 +- 7 files changed, 31 insertions(+), 16 deletions(-) rename src/main/java/org/springframework/samples/petclinic/jpa/{EntityManagerClinic.java => JpaClinic.java} (97%) diff --git a/.settings/org.springframework.ide.eclipse.core.prefs b/.settings/org.springframework.ide.eclipse.core.prefs index e096d67b6..53db11bd5 100644 --- a/.settings/org.springframework.ide.eclipse.core.prefs +++ b/.settings/org.springframework.ide.eclipse.core.prefs @@ -1,13 +1,13 @@ -#Tue Mar 17 10:00:21 EDT 2009 eclipse.preferences.version=1 org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true -org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=false -org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=true +org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=true +org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=false org.springframework.ide.eclipse.core.enable.project.preferences=false org.springframework.ide.eclipse.core.validator.enable.com.springsource.server.ide.manifest.core.manifestvalidator=true org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.beansvalidator=true org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.server.quickfix.manifestvalidator=true org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true +org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.bestpractices.beansvalidator=false org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=false org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=true org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true @@ -34,6 +34,7 @@ org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts. org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importLibraryVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importPackageVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.requireBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.autowire.autowire-org.springframework.ide.eclipse.beans.core.beansvalidator=false org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true @@ -46,6 +47,15 @@ org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.i org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.toolAnnotation-org.springframework.ide.eclipse.beans.core.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.AvoidDriverManagerDataSource-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.ImportElementsAtTopRulee-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.ParentBeanSpecifiesAbstractClassRule-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.RefElementRule-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.TooManyBeansInFileRule-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.UnnecessaryValueElementRule-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.com.springsource.sts.bestpractices.UseBeanInheritance-org.springframework.ide.eclipse.bestpractices.beansvalidator=false +org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.bestpractices.legacyxmlusage.jndiobjectfactory-org.springframework.ide.eclipse.bestpractices.beansvalidator=false org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=false org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=true org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=true diff --git a/.springBeans b/.springBeans index 2edd02cf1..f88ad9b6d 100644 --- a/.springBeans +++ b/.springBeans @@ -7,6 +7,8 @@ + src/main/resources/spring/applicationContext-dataSource.xml + src/main/resources/spring/applicationContext-jpa.xml diff --git a/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java b/src/main/java/org/springframework/samples/petclinic/jpa/JpaClinic.java similarity index 97% rename from src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java rename to src/main/java/org/springframework/samples/petclinic/jpa/JpaClinic.java index e3c82fc12..357189b5f 100644 --- a/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java +++ b/src/main/java/org/springframework/samples/petclinic/jpa/JpaClinic.java @@ -29,7 +29,7 @@ import org.springframework.dao.DataAccessException; */ @Repository @Transactional -public class EntityManagerClinic implements Clinic { +public class JpaClinic implements Clinic { @PersistenceContext private EntityManager em; diff --git a/src/main/resources/spring/applicationContext-jpa.xml b/src/main/resources/spring/applicationContext-jpa.xml index ccc8d33d7..6a9c86538 100644 --- a/src/main/resources/spring/applicationContext-jpa.xml +++ b/src/main/resources/spring/applicationContext-jpa.xml @@ -63,7 +63,10 @@ This aspect is defined in petclinic.jar's META-INF/aop.xml file. Note that we can dependency inject this bean like any other bean. --> - + + + + - + \ No newline at end of file diff --git a/src/main/webapp/resources/html/tutorial.html b/src/main/webapp/resources/html/tutorial.html index a46365f82..9e6d970a9 100644 --- a/src/main/webapp/resources/html/tutorial.html +++ b/src/main/webapp/resources/html/tutorial.html @@ -513,7 +513,7 @@

The JPA implementation of the Clinic interface is - org.springframework.samples.petclinic.jpa.EntityManagerClinic, + org.springframework.samples.petclinic.jpa.JpaClinic, which is based on native JPA usage combined with Spring's @Repository and @Transactional annotations but diff --git a/src/test/java/org/springframework/samples/petclinic/aspects/UsageLogAspectTests.java b/src/test/java/org/springframework/samples/petclinic/aspects/UsageLogAspectTests.java index 8e8624e90..1ec7689d2 100644 --- a/src/test/java/org/springframework/samples/petclinic/aspects/UsageLogAspectTests.java +++ b/src/test/java/org/springframework/samples/petclinic/aspects/UsageLogAspectTests.java @@ -39,17 +39,17 @@ public class UsageLogAspectTests { @Test public void testUsageLogAspectIsInvoked() { - String name1 = "Schuurman"; - String name2 = "Greenwood"; - String name3 = "Leau"; + String lastName1 = "Franklin"; + String lastName2 = "Davis"; + String lastName3 = "foo"; - assertTrue(this.clinic.findOwners(name1).isEmpty()); - assertTrue(this.clinic.findOwners(name2).isEmpty()); + assertFalse(this.clinic.findOwners(lastName1).isEmpty()); + assertFalse(this.clinic.findOwners(lastName2).isEmpty()); List namesRequested = this.usageLogAspect.getNamesRequested(); - assertTrue(namesRequested.contains(name1)); - assertTrue(namesRequested.contains(name2)); - assertFalse(namesRequested.contains(name3)); + assertTrue(namesRequested.contains(lastName1)); + assertTrue(namesRequested.contains(lastName2)); + assertFalse(namesRequested.contains(lastName3)); } } diff --git a/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml b/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml index a9d257385..5451060eb 100644 --- a/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml +++ b/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml @@ -11,6 +11,6 @@ - +