added aspectj decaration. All JUnit tests are now successful

This commit is contained in:
Mic 2013-01-14 23:23:07 +08:00
parent 608c42f74b
commit b459ca3377
7 changed files with 31 additions and 16 deletions

View file

@ -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

View file

@ -7,6 +7,8 @@
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
<config>src/main/resources/spring/applicationContext-dataSource.xml</config>
<config>src/main/resources/spring/applicationContext-jpa.xml</config>
</configs>
<configSets>
</configSets>

View file

@ -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;

View file

@ -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.
-->
<bean class="org.springframework.samples.petclinic.aspects.UsageLogAspect" p:historySize="300"/>
<aop:aspectj-autoproxy>
<aop:include name="usageLogAspect"/>
</aop:aspectj-autoproxy>
<bean id="usageLogAspect" class="org.springframework.samples.petclinic.aspects.UsageLogAspect" p:historySize="300"/>
<!--
Post-processor to perform exception translation on @Repository classes (from native
@ -76,6 +79,6 @@
EntityManager will be auto-injected due to @PersistenceContext.
PersistenceExceptions will be auto-translated due to @Repository.
-->
<bean id="clinic" class="org.springframework.samples.petclinic.jpa.EntityManagerClinic"/>
<bean id="clinic" class="org.springframework.samples.petclinic.jpa.JpaClinic"/>
</beans>

View file

@ -513,7 +513,7 @@
<p>
The JPA implementation of the <span style="font-weight: bold;">Clinic</span>
interface is
<span style="font-weight: bold; font-style: italic;">org.springframework.samples.petclinic.jpa.EntityManagerClinic</span>,
<span style="font-weight: bold; font-style: italic;">org.springframework.samples.petclinic.jpa.JpaClinic</span>,
which is based on native JPA usage combined with Spring's
<span style="font-weight: bold;">@Repository</span> and
<span style="font-weight: bold;">@Transactional</span> annotations but

View file

@ -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<String> 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));
}
}

View file

@ -11,6 +11,6 @@
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="clinic" class="org.springframework.samples.petclinic.jpa.EntityManagerClinic" />
<bean id="clinic" class="org.springframework.samples.petclinic.jpa.JpaClinic" />
</beans>