diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index d9d4f8cff..192d849ac 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -15,6 +15,8 @@
+
+
diff --git a/src/main/resources/spring/mvc-core-config.xml b/src/main/resources/spring/mvc-core-config.xml
index 8aa5d61f0..3724b0559 100644
--- a/src/main/resources/spring/mvc-core-config.xml
+++ b/src/main/resources/spring/mvc-core-config.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/src/main/resources/spring/mvc-view-config.xml b/src/main/resources/spring/mvc-view-config.xml
index 8425754ac..4413f0195 100644
--- a/src/main/resources/spring/mvc-view-config.xml
+++ b/src/main/resources/spring/mvc-view-config.xml
@@ -17,24 +17,37 @@
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTest.java b/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTest.java
deleted file mode 100644
index 51458c86f..000000000
--- a/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2002-2009 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.samples.petclinic.web;
-
-import com.sun.syndication.feed.atom.Entry;
-import com.sun.syndication.feed.atom.Feed;
-import org.joda.time.DateTime;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.samples.petclinic.model.Pet;
-import org.springframework.samples.petclinic.model.PetType;
-import org.springframework.samples.petclinic.model.Visit;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * @author Arjen Poutsma
- * @author Michael Isvy
- */
-public class VisitsAtomViewTest {
-
- private VetsAtomView visitView;
-
- private Map model;
-
- private Feed feed;
-
- @Before
- public void setUp() {
- visitView = new VetsAtomView();
- PetType dog = new PetType();
- dog.setName("dog");
- Pet bello = new Pet();
- bello.setName("Bello");
- bello.setType(dog);
- Visit belloVisit = new Visit();
- belloVisit.setPet(bello);
- belloVisit.setDate(new DateTime(2009, 1, 1, 1, 1));
- belloVisit.setDescription("Bello visit");
- Pet wodan = new Pet();
- wodan.setName("Wodan");
- wodan.setType(dog);
- Visit wodanVisit = new Visit();
- wodanVisit.setPet(wodan);
- wodanVisit.setDate(new DateTime(2009, 1, 2, 1, 1));
- wodanVisit.setDescription("Wodan visit");
- List visits = new ArrayList();
- visits.add(belloVisit);
- visits.add(wodanVisit);
-
- model = new HashMap();
- model.put("visits", visits);
- feed = new Feed();
-
- }
-
-
- @Test
- public void buildFeedMetadata() {
- visitView.buildFeedMetadata(model, feed, null);
-
- assertNotNull("No id set", feed.getId());
- assertNotNull("No title set", feed.getTitle());
- assertEquals("Invalid update set", new DateTime(2009, 1, 2, 1, 1).toDate(), feed.getUpdated());
- }
-
- @Test
- public void buildFeedEntries() throws Exception {
- List entries = visitView.buildFeedEntries(model, null, null);
- assertEquals("Invalid amount of entries", 2, entries.size());
- }
-}
diff --git a/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTestWithContainer-config.xml b/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest-config.xml
similarity index 100%
rename from src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTestWithContainer-config.xml
rename to src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest-config.xml
diff --git a/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewWithContainerTest.java b/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java
similarity index 75%
rename from src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewWithContainerTest.java
rename to src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java
index 542c2ee4e..8fb3480c4 100644
--- a/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewWithContainerTest.java
+++ b/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java
@@ -31,8 +31,11 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.hamcrest.Matchers.containsString;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*;
+
/**
* @author Arjen Poutsma
@@ -40,11 +43,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
-// Spring configuration files that are inside WEB-INF folder can be referenced here because they've been
-// added to the classpath inside the Maven pom.xml file (inside ... )
-@ContextConfiguration("VisitsAtomViewTestWithContainer-config.xml")
+@ContextConfiguration("VisitsViewTest-config.xml")
@ActiveProfiles("jdbc")
-public class VisitsAtomViewWithContainerTest {
+public class VisitsViewTest {
@Autowired
private WebApplicationContext webApplicationContext;
@@ -55,15 +56,14 @@ public class VisitsAtomViewWithContainerTest {
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.webApplicationContext).build();
}
-
+
@Test
- public void getVisits() throws Exception {
- //gDickens: MediaType is not used
- MediaType mediaType = MediaType.APPLICATION_ATOM_XML;
- ResultActions actions = this.mockMvc.perform(get("/vets.atom"));
+ public void getVisitsXml() throws Exception {
+ ResultActions actions = this.mockMvc.perform(get("/vets.xml").accept(MediaType.APPLICATION_XML));
+ actions.andDo(print()); // action is logged into the console
actions.andExpect(status().isOk());
- actions.andExpect(xpath("//*").string(containsString("Pet ClinicService Visits")));
- actions.andExpect(content().contentType("application/atom+xml"));
+ actions.andExpect(content().contentType("application/xml"));
+ actions.andExpect(xpath("/vets/vetList[id=1]/firstName").string(containsString("James")));
}
}