petclinic-uncached
Changes
.classpath 34(+28 -6)
.project 11(+5 -6)
.settings/.jsdtscope 2(+2 -0)
.settings/org.eclipse.jdt.core.prefs 12(+4 -8)
.settings/org.eclipse.m2e.core.prefs 5(+0 -5)
.settings/org.eclipse.m2e.wtp.prefs 2(+2 -0)
org.springframework.samples.petclinic/.settings/org.eclipse.jst.common.project.facet.core.prefs 3(+0 -3)
org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.project.facet.core.xml 7(+0 -7)
org.springframework.samples.petclinic/.settings/org.springframework.ide.eclipse.beans.core.prefs 3(+0 -3)
org.springframework.samples.petclinic/.settings/org.springframework.ide.eclipse.core.prefs 67(+0 -67)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/appointments/Appointment.java 37(+0 -37)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/appointments/AppointmentBook.java 13(+0 -13)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/appointments/AppointmentForm.java 67(+0 -67)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/appointments/Appointments.java 15(+0 -15)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/appointments/AppointmentsController.java 42(+0 -42)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/appointments/StubAppointmentBook.java 23(+0 -23)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/HomeController.java 15(+0 -15)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/Owner.java 69(+0 -69)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/OwnerController.java 39(+0 -39)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/OwnerRepository.java 13(+0 -13)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/OwnersController.java 43(+0 -43)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/OwnerSearchForm.java 15(+0 -15)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/pets/Gender.java 5(+0 -5)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/pets/Pet.java 25(+0 -25)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/pets/PetController.java 41(+0 -41)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/pets/PetRepository.java 9(+0 -9)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/pets/StubPetRepository.java 15(+0 -15)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/owners/StubOwnerRepository.java 22(+0 -22)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/util/ExternalContext.java 22(+0 -22)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/util/Measurement.java 10(+0 -10)
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/util/Unit.java 5(+0 -5)
org.springframework.samples.petclinic/src/main/webapp/WEB-INF/appointments/addNewForm.jsp 31(+0 -31)
pom.xml 252(+95 -157)
src/main/java/org/springframework/samples/petclinic/toplink/EssentialsHSQLPlatformWithNativeSequence.java 56(+0 -56)
src/main/resources/log4j.dtd 166(+166 -0)
src/main/resources/log4j.xml 27(+27 -0)
src/main/webapp/WEB-INF/jsp/owners/search.jsp 54(+33 -21)
src/main/webapp/WEB-INF/jsp/owners/show.jsp 20(+17 -3)
src/main/webapp/WEB-INF/jsp/welcome.jsp 23(+18 -5)
src/main/webapp/WEB-INF/petclinic-servlet.xml 35(+21 -14)
src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java 16(+7 -9)
src/test/java/org/springframework/samples/petclinic/jpa/OpenJpaEntityManagerClinicTests.java 27(+0 -27)
src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml 13(+3 -10)
Details
.classpath 34(+28 -6)
diff --git a/.classpath b/.classpath
index 8122bbb..c99cf86 100644
--- a/.classpath
+++ b/.classpath
@@ -1,15 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
+ <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
.project 11(+5 -6)
diff --git a/.project b/.project
index 239f04e..7d7f5c1 100644
--- a/.project
+++ b/.project
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.springframework.samples.petclinic</name>
- <comment></comment>
+ <name>spring-petclinic</name>
+ <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects>
- <project>Servers</project>
</projects>
<buildSpec>
<buildCommand>
@@ -38,12 +37,12 @@
</buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
.settings/.jsdtscope 2(+2 -0)
diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope
index bbb8e68..b72a6a4 100644
--- a/.settings/.jsdtscope
+++ b/.settings/.jsdtscope
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src/main/webapp"/>
+ <classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
.settings/org.eclipse.jdt.core.prefs 12(+4 -8)
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 9ec44e3..69c31cd 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,8 @@
-#Tue Mar 17 10:00:21 EDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
.settings/org.eclipse.m2e.wtp.prefs 2(+2 -0)
diff --git a/.settings/org.eclipse.m2e.wtp.prefs b/.settings/org.eclipse.m2e.wtp.prefs
new file mode 100644
index 0000000..ef86089
--- /dev/null
+++ b/.settings/org.eclipse.m2e.wtp.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 89d4f2a..2567413 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
- <wb-module deploy-name="org.springframework.samples.petclinic">
- <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
- <property name="java-output-path" value="target/classes"/>
- <property name="context-root" value="petclinic"/>
- </wb-module>
+ <wb-module deploy-name="spring-petclinic">
+ <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
+ <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
+ <property name="context-root" value="petclinic"/>
+ <property name="java-output-path" value="/spring-petclinic/target/classes"/>
+ </wb-module>
</project-modules>
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index d24a733..97d312c 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
- <fixed facet="jst.web"/>
- <fixed facet="jst.java"/>
- <installed facet="jst.java" version="5.0"/>
- <installed facet="jst.web" version="2.5"/>
+ <fixed facet="wst.jsdt.web"/>
+ <installed facet="java" version="1.6"/>
+ <installed facet="jst.web" version="2.4"/>
+ <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
pom.xml 252(+95 -157)
diff --git a/pom.xml b/pom.xml
index f0c6167..a60fcf2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,98 +3,89 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
- <artifactId>org.springframework.samples.petclinic</artifactId>
+ <artifactId>spring-petclinic</artifactId>
<name>petclinic</name>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
- <spring.version>3.0.0.RELEASE</spring.version>
- <slf4j.version>1.5.6</slf4j.version>
+ <spring.version>3.2.0.RELEASE</spring.version>
+ <slf4j.version>1.7.0</slf4j.version>
+ <log4j.version>1.2.17</log4j.version>
+ <hibernate.version>4.1.4.Final</hibernate.version>
+ <aspectj.version>1.7.1</aspectj.version>
</properties>
- <dependencies>
+ <dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>org.springframework.context</artifactId>
+ <artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.logging</artifactId>
+ <artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>org.springframework.orm</artifactId>
+ <artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>org.springframework.oxm</artifactId>
+ <artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>org.springframework.web.servlet</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.aspects</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <!-- AspectJ -->
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>com.springsource.org.aspectj.weaver</artifactId>
- <version>1.6.8.RELEASE</version>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${spring.version}</version>
</dependency>
<!-- Logging -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
- <version>${slf4j.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.log4j</artifactId>
- <version>${slf4j.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
- <version>1.2.15</version>
- <scope>runtime</scope>
- </dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
<!-- DataSource -->
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.dbcp</artifactId>
- <version>1.2.2.osgi</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.pool</artifactId>
- <version>1.5.3</version>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.4</version>
<scope>runtime</scope>
</dependency>
+
<dependency>
<groupId>org.hsqldb</groupId>
- <artifactId>com.springsource.org.hsqldb</artifactId>
- <version>1.8.0.9</version>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
<scope>runtime</scope>
</dependency>
<!-- MySQL JDBC Connector -->
@@ -103,153 +94,87 @@
<artifactId>com.springsource.com.mysql.jdbc</artifactId>
<version>5.1.6</version> </dependency>
-->
-
- <!-- Hibernate -->
+
+ <!-- AOP -->
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>com.springsource.org.hibernate</artifactId>
- <version>3.3.2.GA</version>
- </dependency>
-
- <!-- JPA -->
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>com.springsource.javax.persistence</artifactId>
- <version>1.0.0</version>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>${aspectj.version}</version>
</dependency>
- <!-- Toplink JPA Provider -->
+
<dependency>
- <groupId>com.oracle.toplink.essentials</groupId>
- <artifactId>com.springsource.oracle.toplink.essentials</artifactId>
- <version>2.0.0.b41-beta2</version>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>${aspectj.version}</version>
</dependency>
+
+ <!-- Hibernate -->
+
+ <!-- JPA -->
<!-- Hibernate JPA Provider -->
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>com.springsource.org.hibernate.ejb</artifactId>
- <version>3.4.0.GA</version>
- <exclusions>
- <!-- Exclude Commons Logging in favor of SLF4j -->
- <exclusion>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>com.springsource.org.hibernate.annotations</artifactId>
- <version>3.4.0.GA</version>
- <exclusions>
- <!-- Exclude Commons Logging in favor of SLF4j -->
- <exclusion>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Open JPA Provider -->
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>com.springsource.org.apache.openjpa</artifactId>
- <version>1.1.0</version>
- <exclusions>
- <!-- Exclude Commons Logging in favor of SLF4j -->
- <exclusion>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.logging</artifactId>
- </exclusion>
- </exclusions>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${hibernate.version}</version>
</dependency>
+
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>com.springsource.javax.servlet</artifactId>
- <version>2.5.0</version>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>com.springsource.javax.servlet.jsp</artifactId>
- <version>2.1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
- <version>1.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.taglibs</groupId>
- <artifactId>com.springsource.org.apache.taglibs.standard</artifactId>
- <version>1.1.2</version>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
</dependency>
<!-- Rome RSS -->
<dependency>
- <groupId>com.sun.syndication</groupId>
- <artifactId>com.springsource.com.sun.syndication</artifactId>
- <version>1.0.0</version>
+ <groupId>rome</groupId>
+ <artifactId>rome</artifactId>
+ <version>1.0</version>
</dependency>
+
<dependency>
<groupId>org.jdom</groupId>
- <artifactId>com.springsource.org.jdom</artifactId>
- <version>1.1.0</version>
+ <artifactId>jdom</artifactId>
+ <version>2.0.2</version>
<scope>runtime</scope>
</dependency>
<!-- JAXB -->
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>com.springsource.javax.xml.bind</artifactId>
- <version>2.1.7</version>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.2.6</version>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
- <groupId>org.junit</groupId>
- <artifactId>com.springsource.org.junit</artifactId>
- <version>4.7.0</version>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>org.springframework.test</artifactId>
+ <artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
- <artifactId>com.springsource.javax.transaction</artifactId>
- <version>1.1.0</version>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
- <repositories>
- <repository>
- <id>com.springsource.repository.bundles.release</id>
- <name>SpringSource Enterprise Bundle Repository - SpringSource Releases</name>
- <url>http://repository.springsource.com/maven/bundles/release</url>
- </repository>
- <repository>
- <id>com.springsource.repository.bundles.external</id>
- <name>SpringSource Enterprise Bundle Repository - External Releases</name>
- <url>http://repository.springsource.com/maven/bundles/external</url>
- </repository>
- <repository>
- <id>com.springsource.repository.bundles.milestone</id>
- <name>SpringSource Enterprise Bundle Repository - SpringSource Milestones</name>
- <url>http://repository.springsource.com/maven/bundles/milestone</url>
- </repository>
- <repository>
- <id>com.springsource.repository.bundles.snapshot</id>
- <name>SpringSource Enterprise Bundle Repository - Snapshot Releases</name>
- <url>http://repository.springsource.com/maven/bundles/snapshot</url>
- </repository>
- </repositories>
<build>
<plugins>
<plugin>
@@ -257,8 +182,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<verbose>true</verbose>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
@@ -280,6 +205,19 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ <wtpversion>2.0</wtpversion>
+ <sourceIncludes>
+ <sourceInclude>**/*.*</sourceInclude>
+ </sourceIncludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
diff --git a/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java b/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java
index 1d9894d..cc26338 100644
--- a/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java
+++ b/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java
@@ -18,7 +18,7 @@ import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.orm.ObjectRetrievalFailureException;
@@ -58,7 +58,7 @@ public class SimpleJdbcClinic implements Clinic, SimpleJdbcClinicMBean {
private final Logger logger = LoggerFactory.getLogger(getClass());
- private SimpleJdbcTemplate simpleJdbcTemplate;
+ private JdbcTemplate simpleJdbcTemplate;
private SimpleJdbcInsert insertOwner;
private SimpleJdbcInsert insertPet;
@@ -69,7 +69,7 @@ public class SimpleJdbcClinic implements Clinic, SimpleJdbcClinicMBean {
@Autowired
public void init(DataSource dataSource) {
- this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ this.simpleJdbcTemplate = new JdbcTemplate(dataSource);
this.insertOwner = new SimpleJdbcInsert(dataSource)
.withTableName("owners")
src/main/resources/log4j.dtd 166(+166 -0)
diff --git a/src/main/resources/log4j.dtd b/src/main/resources/log4j.dtd
new file mode 100755
index 0000000..d92a6e7
--- /dev/null
+++ b/src/main/resources/log4j.dtd
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!-- Authors: Chris Taylor, Ceki Gulcu. -->
+
+<!-- Version: 1.2 -->
+
+<!-- A configuration element consists of optional renderer
+elements,appender elements, categories and an optional root
+element. -->
+
+<!ELEMENT log4j:configuration (renderer*, appender*,(category|logger)*,root?,
+ categoryFactory?)>
+
+<!-- The "threshold" attribute takes a level value such that all -->
+<!-- logging statements with a level equal or below this value are -->
+<!-- disabled. -->
+
+<!-- Setting the "debug" enable the printing of internal log4j logging -->
+<!-- statements. -->
+
+<!-- By default, debug attribute is "null", meaning that we not do touch -->
+<!-- internal log4j logging settings. The "null" value for the threshold -->
+<!-- attribute can be misleading. The threshold field of a repository -->
+<!-- cannot be set to null. The "null" value for the threshold attribute -->
+<!-- simply means don't touch the threshold field, the threshold field -->
+<!-- keeps its old value. -->
+
+<!ATTLIST log4j:configuration
+ xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
+ threshold (all|debug|info|warn|error|fatal|off|null) "null"
+ debug (true|false|null) "null"
+>
+
+<!-- renderer elements allow the user to customize the conversion of -->
+<!-- message objects to String. -->
+
+<!ELEMENT renderer EMPTY>
+<!ATTLIST renderer
+ renderedClass CDATA #REQUIRED
+ renderingClass CDATA #REQUIRED
+>
+
+<!-- Appenders must have a name and a class. -->
+<!-- Appenders may contain an error handler, a layout, optional parameters -->
+<!-- and filters. They may also reference (or include) other appenders. -->
+<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>
+<!ATTLIST appender
+ name ID #REQUIRED
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT layout (param*)>
+<!ATTLIST layout
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT filter (param*)>
+<!ATTLIST filter
+ class CDATA #REQUIRED
+>
+
+<!-- ErrorHandlers can be of any class. They can admit any number of -->
+<!-- parameters. -->
+
+<!ELEMENT errorHandler (param*, root-ref?, logger-ref*, appender-ref?)>
+<!ATTLIST errorHandler
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT root-ref EMPTY>
+
+<!ELEMENT logger-ref EMPTY>
+<!ATTLIST logger-ref
+ ref IDREF #REQUIRED
+>
+
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED
+>
+
+
+<!-- The priority class is org.apache.log4j.Level by default -->
+<!ELEMENT priority (param*)>
+<!ATTLIST priority
+ class CDATA #IMPLIED
+ value CDATA #REQUIRED
+>
+
+<!-- The level class is org.apache.log4j.Level by default -->
+<!ELEMENT level (param*)>
+<!ATTLIST level
+ class CDATA #IMPLIED
+ value CDATA #REQUIRED
+>
+
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named category. -->
+<!ELEMENT category (param*,(priority|level)?,appender-ref*)>
+<!ATTLIST category
+ class CDATA #IMPLIED
+ name CDATA #REQUIRED
+ additivity (true|false) "true"
+>
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named logger. -->
+<!ELEMENT logger (level?,appender-ref*)>
+<!ATTLIST logger
+ name ID #REQUIRED
+ additivity (true|false) "true"
+>
+
+
+<!ELEMENT categoryFactory (param*)>
+<!ATTLIST categoryFactory
+ class CDATA #REQUIRED>
+
+<!ELEMENT appender-ref EMPTY>
+<!ATTLIST appender-ref
+ ref IDREF #REQUIRED
+>
+
+<!-- If no priority element is specified, then the configurator MUST not -->
+<!-- touch the priority of root. -->
+<!-- The root category always exists and cannot be subclassed. -->
+<!ELEMENT root (param*, (priority|level)?, appender-ref*)>
+
+
+<!-- ==================================================================== -->
+<!-- A logging event -->
+<!-- ==================================================================== -->
+<!ELEMENT log4j:eventSet (log4j:event*)>
+<!ATTLIST log4j:eventSet
+ xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
+ version (1.1|1.2) "1.2"
+ includesLocationInfo (true|false) "true"
+>
+
+
+
+<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?,
+ log4j:locationInfo?) >
+
+<!-- The timestamp format is application dependent. -->
+<!ATTLIST log4j:event
+ logger CDATA #REQUIRED
+ level CDATA #REQUIRED
+ thread CDATA #REQUIRED
+ timestamp CDATA #REQUIRED
+>
+
+<!ELEMENT log4j:message (#PCDATA)>
+<!ELEMENT log4j:NDC (#PCDATA)>
+
+<!ELEMENT log4j:throwable (#PCDATA)>
+
+<!ELEMENT log4j:locationInfo EMPTY>
+<!ATTLIST log4j:locationInfo
+ class CDATA #REQUIRED
+ method CDATA #REQUIRED
+ file CDATA #REQUIRED
+ line CDATA #REQUIRED
+>
src/main/resources/log4j.xml 27(+27 -0)
diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml
new file mode 100755
index 0000000..13330e6
--- /dev/null
+++ b/src/main/resources/log4j.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <!-- Appenders -->
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p: %c - %m%n" />
+ </layout>
+ </appender>
+
+ <logger name="org.springframework.samples.petclinic.aspects">
+ <level value="DEBUG" />
+ </logger>
+
+
+
+ <!-- Root Logger -->
+ <root>
+ <priority value="info" /><!--
+ <level value="info"></level>
+ --><appender-ref ref="console" />
+ </root>
+
+</log4j:configuration>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/jsp/footer.jsp b/src/main/webapp/WEB-INF/jsp/footer.jsp
index 52aaffc..486957d 100644
--- a/src/main/webapp/WEB-INF/jsp/footer.jsp
+++ b/src/main/webapp/WEB-INF/jsp/footer.jsp
@@ -1,12 +1,10 @@
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<table class="footer">
<tr>
<td><a href="<spring:url value="/" htmlEscape="true" />">Home</a></td>
- <td align="right"><img src="<spring:url value="/static/images/springsource-logo.png" htmlEscape="true" />" alt="Sponsored by SpringSource"/></td>
+ <td align="right"><img src="<spring:url value="/resources/images/springsource-logo.png" htmlEscape="true" />" alt="Sponsored by SpringSource"/></td>
</tr>
</table>
- </div>
-</body>
-</html>
diff --git a/src/main/webapp/WEB-INF/jsp/header.jsp b/src/main/webapp/WEB-INF/jsp/header.jsp
index 49393d3..1cdc670 100644
--- a/src/main/webapp/WEB-INF/jsp/header.jsp
+++ b/src/main/webapp/WEB-INF/jsp/header.jsp
@@ -1,7 +1,8 @@
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
+
<!--
PetClinic :: a Spring Framework demonstration
-->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
@@ -9,6 +10,4 @@
<title>PetClinic :: a Spring Framework demonstration</title>
</head>
-<body>
- <div id="main">
src/main/webapp/WEB-INF/jsp/owners/search.jsp 54(+33 -21)
diff --git a/src/main/webapp/WEB-INF/jsp/owners/search.jsp b/src/main/webapp/WEB-INF/jsp/owners/search.jsp
index b972390..7b6b5c8 100644
--- a/src/main/webapp/WEB-INF/jsp/owners/search.jsp
+++ b/src/main/webapp/WEB-INF/jsp/owners/search.jsp
@@ -1,26 +1,38 @@
-<%@ include file="/WEB-INF/jsp/includes.jsp" %>
-<%@ include file="/WEB-INF/jsp/header.jsp" %>
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<html lang="en">
-<h2>Find Owners:</h2>
+<jsp:include page="../header.jsp"/>
-<spring:url value="/owners" var="formUrl"/>
-<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get">
- <table>
- <tr>
- <th>
- Last Name: <form:errors path="*" cssClass="errors"/>
- <br/>
- <form:input path="lastName" size="30" maxlength="80" />
- </th>
- </tr>
- <tr>
- <td><p class="submit"><input type="submit" value="Find Owners"/></p></td>
- </tr>
- </table>
-</form:form>
+<body>
-<br/>
-<a href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
+ <div id="main">
-<%@ include file="/WEB-INF/jsp/footer.jsp" %>
+ <h2>Find Owners:</h2>
+
+ <spring:url value="/owners" var="formUrl"/>
+ <form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get">
+ <fieldset>
+ <label class="control-label">Last name:</label>
+ <div class="controls">
+ <form:input path="lastName" size="30" maxlength="80"/>
+ <form:errors path="*" cssClass="errors"/>
+ </div>
+ <div>
+ <button type="submit">Find Owner</button>
+ </div>
+ </fieldset>
+ </form:form>
+
+ <br/>
+ <a href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
+
+ <jsp:include page="../footer.jsp"/>
+
+ </div>
+</body>
+
+</html>
src/main/webapp/WEB-INF/jsp/owners/show.jsp 20(+17 -3)
diff --git a/src/main/webapp/WEB-INF/jsp/owners/show.jsp b/src/main/webapp/WEB-INF/jsp/owners/show.jsp
index 9767c18..cd7334d 100644
--- a/src/main/webapp/WEB-INF/jsp/owners/show.jsp
+++ b/src/main/webapp/WEB-INF/jsp/owners/show.jsp
@@ -1,7 +1,16 @@
-<%@ include file="/WEB-INF/jsp/includes.jsp" %>
-<%@ include file="/WEB-INF/jsp/header.jsp" %>
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+
+<jsp:include page="../header.jsp"/>
+
+<body>
+
+ <div id="main">
+
<h2>Owner Information</h2>
<table>
@@ -105,4 +114,9 @@
</table>
</c:forEach>
-<%@ include file="/WEB-INF/jsp/footer.jsp" %>
+<jsp:include page="../footer.jsp"/>
+
+ </div>
+</body>
+
+</html>
src/main/webapp/WEB-INF/jsp/welcome.jsp 23(+18 -5)
diff --git a/src/main/webapp/WEB-INF/jsp/welcome.jsp b/src/main/webapp/WEB-INF/jsp/welcome.jsp
index 3085818..9b431e4 100644
--- a/src/main/webapp/WEB-INF/jsp/welcome.jsp
+++ b/src/main/webapp/WEB-INF/jsp/welcome.jsp
@@ -1,16 +1,29 @@
-<%@ include file="/WEB-INF/jsp/includes.jsp" %>
-<%@ include file="/WEB-INF/jsp/header.jsp" %>
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<img src="<spring:url value="/static/images/pets.png" htmlEscape="true" />" align="right" style="position:relative;right:30px;">
+
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+
+<jsp:include page="header.jsp"/>
+
+<body>
+
+ <div id="main">
+<img src="<spring:url value="/resources/images/pets.png" htmlEscape="true" />" align="right" style="position:relative;right:30px;"></img>
<h2><fmt:message key="welcome"/></h2>
<ul>
<li><a href="<spring:url value="/owners/search" htmlEscape="true" />">Find owner</a></li>
<li><a href="<spring:url value="/vets" htmlEscape="true" />">Display all veterinarians</a></li>
- <li><a href="<spring:url value="/static/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li>
+ <li><a href="<spring:url value="/resources/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li>
</ul>
<p> </p>
<p> </p>
-<%@ include file="/WEB-INF/jsp/footer.jsp" %>
+<jsp:include page="footer.jsp"/>
+
+ </div>
+</body>
+
+</html>
src/main/webapp/WEB-INF/petclinic-servlet.xml 35(+21 -14)
diff --git a/src/main/webapp/WEB-INF/petclinic-servlet.xml b/src/main/webapp/WEB-INF/petclinic-servlet.xml
index e55766a..345a2da 100644
--- a/src/main/webapp/WEB-INF/petclinic-servlet.xml
+++ b/src/main/webapp/WEB-INF/petclinic-servlet.xml
@@ -3,11 +3,12 @@
- DispatcherServlet application context for PetClinic's web tier.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
- xmlns:oxm="http://www.springframework.org/schema/oxm"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
+ xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:mvc="http://www.springframework.org/schema/mvc"
+ xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
+ http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!--
- The controllers are autodetected POJOs labeled with the @Controller annotation.
@@ -30,7 +31,7 @@
- for request parameter binding. It overrides the default AnnotationMethodHandlerAdapter.
-->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
- <property name="webBindingInitializer">
+ <property name="webBindingInitializer">
<bean class="org.springframework.samples.petclinic.web.ClinicBindingInitializer"/>
</property>
</bean>
@@ -58,15 +59,21 @@
- BeanNameViewResolver. Note the use of the expression language to refer to the contentType
- property of the vets view bean, setting it to 'application/vnd.springsource.samples.petclinic+xml'.
-->
- <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
- <property name="mediaTypes">
- <map>
- <entry key="xml" value="#{vets.contentType}"/>
- <entry key="atom" value="#{visits.contentType}"/>
- </map>
- </property>
- <property name="order" value="0"/>
+
+ <mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
+ <mvc:resources mapping="/resources/**" location="/resources/"/>
+
+ <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
+ <property name="favorPathExtension" value="false" />
+ <property name="favorParameter" value="true" />
+ <property name="mediaTypes">
+ <value>
+ atom=application/atom+xml
+ xml=#{vets.contentType}
+ </value>
+ </property>
</bean>
+
<!--
- The BeanNameViewResolver is used to pick up the visits view name (below).
diff --git a/src/main/webapp/WEB-INF/spring/applicationContext-hibernate.xml b/src/main/webapp/WEB-INF/spring/applicationContext-hibernate.xml
index 4fd1992..4e155d5 100644
--- a/src/main/webapp/WEB-INF/spring/applicationContext-hibernate.xml
+++ b/src/main/webapp/WEB-INF/spring/applicationContext-hibernate.xml
@@ -20,7 +20,7 @@
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- Hibernate SessionFactory -->
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
+ <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
p:dataSource-ref="dataSource" p:mappingResources="petclinic.hbm.xml">
<property name="hibernateProperties">
<props>
@@ -32,14 +32,14 @@
<property name="eventListeners">
<map>
<entry key="merge">
- <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
+ <bean class="org.springframework.orm.hibernate4.support.IdTransferringMergeEventListener"/>
</entry>
</map>
</property>
</bean>
<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
- <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
+ <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
p:sessionFactory-ref="sessionFactory"/>
<!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
diff --git a/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java b/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java
index 63010dc..a62cb20 100644
--- a/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.util.EntityUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
+import org.springframework.transaction.annotation.Transactional;
/**
* <p>
@@ -81,18 +82,16 @@ import org.springframework.test.context.junit4.AbstractTransactionalJUnit4Spring
* @author Sam Brannen
*/
@ContextConfiguration
-public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4SpringContextTests {
+public abstract class AbstractClinicTests {
@Autowired
protected Clinic clinic;
- @Test
+ @Test @Transactional
public void getVets() {
Collection<Vet> vets = this.clinic.getVets();
- // Use the inherited countRowsInTable() convenience method (from
- // AbstractTransactionalJUnit4SpringContextTests) to verify the results.
- assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("vets"), vets.size());
+
Vet v1 = EntityUtils.getById(vets, Vet.class, 2);
assertEquals("Leary", v1.getLastName());
assertEquals(1, v1.getNrOfSpecialties());
@@ -107,8 +106,7 @@ public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4Spr
@Test
public void getPetTypes() {
Collection<PetType> petTypes = this.clinic.getPetTypes();
- assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("types"),
- petTypes.size());
+
PetType t1 = EntityUtils.getById(petTypes, PetType.class, 1);
assertEquals("cat", t1.getName());
PetType t4 = EntityUtils.getById(petTypes, PetType.class, 4);
diff --git a/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java b/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java
index 4f50d72..cedbba3 100644
--- a/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java
@@ -1,8 +1,10 @@
package org.springframework.samples.petclinic.hibernate;
+import org.junit.runner.RunWith;
import org.springframework.samples.petclinic.AbstractClinicTests;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* <p>
@@ -17,6 +19,7 @@ import org.springframework.test.context.ContextConfiguration;
*/
@ContextConfiguration
@DirtiesContext
+@RunWith(SpringJUnit4ClassRunner.class)
public class HibernateClinicTests extends AbstractClinicTests {
}
diff --git a/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java b/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
index 335297d..77b08a1 100644
--- a/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
@@ -1,12 +1,18 @@
package org.springframework.samples.petclinic.jpa;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
import java.util.Collection;
import java.util.Date;
import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.Clinic;
import org.springframework.samples.petclinic.Owner;
import org.springframework.samples.petclinic.Pet;
@@ -14,8 +20,6 @@ import org.springframework.samples.petclinic.PetType;
import org.springframework.samples.petclinic.Vet;
import org.springframework.samples.petclinic.Visit;
import org.springframework.samples.petclinic.util.EntityUtils;
-import org.springframework.test.annotation.ExpectedException;
-import org.springframework.test.jpa.AbstractJpaTests;
/**
* <p>
@@ -35,13 +39,6 @@ import org.springframework.test.jpa.AbstractJpaTests;
* <li>Executes each test method in its own transaction, which is automatically
* rolled back by default. This means that even if tests insert or otherwise
* change database state, there is no need for a teardown or cleanup script.</li>
- * <li>Provides useful inherited protected fields, such as a
- * {@link SimpleJdbcTemplate} that can be used to verify database state after
- * test operations, or verify the results of queries performed by application
- * code. Alternatively, you can use protected convenience methods such as
- * {@link #countRowsInTable(String)}, {@link #deleteFromTables(String[])},
- * etc. An ApplicationContext is also inherited, and can be used for explicit
- * lookup if necessary.</li>
* </ul>
* <p>
* {@link AbstractJpaTests} and related classes are shipped in
@@ -52,38 +49,30 @@ import org.springframework.test.jpa.AbstractJpaTests;
* @author Sam Brannen
* @see AbstractJpaTests
*/
-public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
+public abstract class AbstractJpaClinicTests {
+
+ @PersistenceContext
+ private EntityManager entityManager;
+ @Autowired
protected Clinic clinic;
- /**
- * This method is provided to set the Clinic instance being tested by the
- * Dependency Injection injection behaviour of the superclass from the
- * <code>org.springframework.test</code> package.
- *
- * @param clinic clinic to test
- */
- public void setClinic(Clinic clinic) {
- this.clinic = clinic;
- }
-
- @ExpectedException(IllegalArgumentException.class)
+ @Test
public void testBogusJpql() {
- this.sharedEntityManager.createQuery("SELECT RUBBISH FROM RUBBISH HEAP").executeUpdate();
+ try {
+ this.entityManager.createQuery("SELECT RUBBISH FROM RUBBISH HEAP").executeUpdate();
+ fail("exception was expected because of incorrect SQL statement");
+ } catch (Exception e) {
+ // expected
+ }
}
- public void testApplicationManaged() {
- EntityManager appManaged = this.entityManagerFactory.createEntityManager();
- appManaged.joinTransaction();
- }
+ @Test
public void testGetVets() {
Collection<Vet> vets = this.clinic.getVets();
- // Use the inherited countRowsInTable() convenience method (from
- // AbstractTransactionalDataSourceSpringContextTests) to verify the
- // results.
- assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("vets"), vets.size());
+
Vet v1 = EntityUtils.getById(vets, Vet.class, 2);
assertEquals("Leary", v1.getLastName());
assertEquals(1, v1.getNrOfSpecialties());
@@ -95,16 +84,17 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals("surgery", (v2.getSpecialties().get(1)).getName());
}
+ @Test
public void testGetPetTypes() {
Collection<PetType> petTypes = this.clinic.getPetTypes();
- assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("types"),
- petTypes.size());
+
PetType t1 = EntityUtils.getById(petTypes, PetType.class, 1);
assertEquals("cat", t1.getName());
PetType t4 = EntityUtils.getById(petTypes, PetType.class, 4);
assertEquals("snake", t4.getName());
}
+ @Test
public void testFindOwners() {
Collection<Owner> owners = this.clinic.findOwners("Davis");
assertEquals(2, owners.size());
@@ -112,21 +102,15 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals(0, owners.size());
}
+ @Test
public void testLoadOwner() {
Owner o1 = this.clinic.loadOwner(1);
assertTrue(o1.getLastName().startsWith("Franklin"));
Owner o10 = this.clinic.loadOwner(10);
assertEquals("Carlos", o10.getFirstName());
-
- // Check lazy loading, by ending the transaction
- endTransaction();
-
- // Now Owners are "disconnected" from the data store.
- // We might need to touch this collection if we switched to lazy loading
- // in mapping files, but this test would pick this up.
- o1.getPets();
}
+ @Test
public void testInsertOwner() {
Collection<Owner> owners = this.clinic.findOwners("Schultz");
int found = owners.size();
@@ -138,6 +122,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals(found + 1, owners.size());
}
+ @Test
public void testUpdateOwner() throws Exception {
Owner o1 = this.clinic.loadOwner(1);
String old = o1.getLastName();
@@ -147,6 +132,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals(old + "X", o1.getLastName());
}
+ @Test
public void testLoadPet() {
Collection<PetType> types = this.clinic.getPetTypes();
Pet p7 = this.clinic.loadPet(7);
@@ -159,6 +145,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals("Peter", p6.getOwner().getFirstName());
}
+ @Test
public void testInsertPet() {
Owner o6 = this.clinic.loadOwner(6);
int found = o6.getPets().size();
@@ -175,6 +162,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals(found + 1, o6.getPets().size());
}
+ @Test
public void testUpdatePet() throws Exception {
Pet p7 = this.clinic.loadPet(7);
String old = p7.getName();
@@ -184,6 +172,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
assertEquals(old + "X", p7.getName());
}
+ @Test
public void testInsertVisit() {
Pet p7 = this.clinic.loadPet(7);
int found = p7.getVisits().size();
diff --git a/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java b/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java
index 67c472f..669cdcd 100644
--- a/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java
@@ -2,7 +2,14 @@ package org.springframework.samples.petclinic.jpa;
import java.util.List;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.aspects.UsageLogAspect;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.assertFalse;
/**
* <p>
@@ -17,23 +24,16 @@ import org.springframework.samples.petclinic.aspects.UsageLogAspect;
* @author Rod Johnson
* @author Juergen Hoeller
*/
+@ContextConfiguration(locations={"applicationContext-jpaCommon.xml", "applicationContext-hibernateAdapter.xml",
+ "applicationContext-entityManager.xml"})
+@RunWith(SpringJUnit4ClassRunner.class)
public class EntityManagerClinicTests extends AbstractJpaClinicTests {
+ @Autowired
private UsageLogAspect usageLogAspect;
- public void setUsageLogAspect(UsageLogAspect usageLogAspect) {
- this.usageLogAspect = usageLogAspect;
- }
-
- @Override
- protected String[] getConfigPaths() {
- return new String[] {
- "applicationContext-jpaCommon.xml",
- "applicationContext-toplinkAdapter.xml",
- "applicationContext-entityManager.xml"
- };
- }
+ @Test
public void testUsageLogAspectIsInvoked() {
String name1 = "Schuurman";
String name2 = "Greenwood";
diff --git a/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java b/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java
index d95b452..d5dac39 100644
--- a/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java
@@ -1,5 +1,9 @@
package org.springframework.samples.petclinic.jpa;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
/**
* <p>
* Tests for the DAO variant based on the shared EntityManager approach, using
@@ -12,15 +16,9 @@ package org.springframework.samples.petclinic.jpa;
*
* @author Juergen Hoeller
*/
+@ContextConfiguration(locations={"applicationContext-jpaCommon.xml", "applicationContext-hibernateAdapter.xml",
+"applicationContext-entityManager.xml"})
+@RunWith(SpringJUnit4ClassRunner.class)
public class HibernateEntityManagerClinicTests extends EntityManagerClinicTests {
- @Override
- protected String[] getConfigPaths() {
- return new String[] {
- "applicationContext-jpaCommon.xml",
- "applicationContext-hibernateAdapter.xml",
- "applicationContext-entityManager.xml"
- };
- }
-
}
diff --git a/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml b/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml
index 7320035..bcf48e7 100644
--- a/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml
+++ b/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.springframework.samples.petclinic.hibernate.HibernateClinic">
<constructor-arg ref="sessionFactory"/>
</bean>
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
+ <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
p:dataSource-ref="dataSource" p:mappingResources="petclinic.hbm.xml">
<property name="hibernateProperties">
<props>
@@ -15,16 +15,9 @@
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
- <property name="eventListeners">
- <map>
- <entry key="merge">
- <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
- </entry>
- </map>
- </property>
</bean>
- <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
+ <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
p:sessionFactory-ref="sessionFactory" />
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />