Introducing Spring Framework
Introducing Spring Framework Introducing Spring Framework
Chapter 15 ■ Spring Data Within Your Spring Application Figure 15-2. MongoDB Shell Shows the Types Collections Figure 15-3. MongoDB Shell Shows the Docs Collections Figure 15-2 shows how you can execute the db.types.find() command in order to see the contents of the types collections. Figure 15-3 shows the contents of the docs collection. To see the docs collection data, execute the db.docs.find() command as shown in Figure 15-3. 213
Chapter 15 ■ Spring Data Within Your Spring Application A Complete DocumentDAO Test Now you can complete the unit test with the rest of the DocumentDAO implementation. Remember that you have just migrated the existing data from JDBC to the MongoDB. So now it’s time to test the other methods from the DocumentDAO implementation—that is find, update, and remove from MongoDB. Listing 15-7 shows the completed unit test. Listing 15-7. MyDocumentsTest.java – Complete package com.apress.isf.spring.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.util.List; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.apress.isf.java.model.Document; import com.apress.isf.java.model.Type; import com.apress.isf.java.service.DocumentService; import com.apress.isf.java.service.TypeService; import com.apress.isf.spring.data.DocumentDAO; import com.apress.isf.spring.data.TypeDAO; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:META-INF/spring/mydocuments-context.xml") public class MyDocumentsTest { private static final Logger log = LoggerFactory.getLogger(MyDocumentsTest.class); private static final String ID = "1acbb68a-a859-49c9-ac88-d9e9322bac55"; private static final String NAME = "Book Template"; private static final String NAME_UPDATED = "My Book"; @Autowired DocumentDAO mongoDocumentDAO; @Autowired TypeDAO mongoTypeDAO; @Autowired DocumentService documentFacade; @Autowired TypeService typeFacade; 214
- Page 159 and 160: Chapter 11 ■ Integrating Your Spr
- Page 161 and 162: Chapter 11 ■ Integrating Your Spr
- Page 163 and 164: Chapter 11 ■ Integrating Your Spr
- Page 165 and 166: Chapter 11 ■ Integrating Your Spr
- Page 167 and 168: Chapter 12 Exposing a REST API Nowa
- Page 169 and 170: Chapter 12 ■ Exposing a REST API
- Page 171 and 172: Chapter 12 ■ Exposing a REST API
- Page 173 and 174: Chapter 12 ■ Exposing a REST API
- Page 175 and 176: Chapter 12 ■ Exposing a REST API
- Page 177 and 178: Chapter 12 ■ Exposing a REST API
- Page 179 and 180: HTTP-DELETE Chapter 12 ■ Exposing
- Page 181 and 182: Chapter 13 Adding E-mail and Schedu
- Page 183 and 184: Chapter 13 ■ Adding E-mail and Sc
- Page 185 and 186: Chapter 13 ■ Adding E-mail and Sc
- Page 187 and 188: Chapter 13 ■ Adding E-mail and Sc
- Page 189 and 190: Chapter 13 ■ Adding E-mail and Sc
- Page 191 and 192: Part III Spring Framework Advanced
- Page 193 and 194: Chapter 14 ■ Using Dynamic Langua
- Page 195 and 196: Chapter 14 ■ Using Dynamic Langua
- Page 197 and 198: Chapter 14 ■ Using Dynamic Langua
- Page 199 and 200: Chapter 14 ■ Using Dynamic Langua
- Page 201 and 202: Chapter 15 ■ Spring Data Within Y
- Page 203 and 204: Chapter 15 ■ Spring Data Within Y
- Page 205 and 206: Chapter 15 ■ Spring Data Within Y
- Page 207 and 208: Chapter 15 ■ Spring Data Within Y
- Page 209: Chapter 15 ■ Spring Data Within Y
- Page 213 and 214: Chapter 15 ■ Spring Data Within Y
- Page 215 and 216: Chapter 16 ■ Messaging with Your
- Page 217 and 218: Chapter 16 ■ Messaging with Your
- Page 219 and 220: Chapter 16 ■ Messaging with Your
- Page 221 and 222: Chapter 16 ■ Messaging with Your
- Page 223 and 224: Chapter 16 ■ Messaging with Your
- Page 225 and 226: Chapter 16 ■ Messaging with Your
- Page 227 and 228: Chapter 17 Be Social and Go Mobile
- Page 229 and 230: Chapter 17 ■ Be Social and Go Mob
- Page 231 and 232: Chapter 17 ■ Be Social and Go Mob
- Page 233 and 234: Chapter 17 ■ Be Social and Go Mob
- Page 235 and 236: Chapter 17 ■ Be Social and Go Mob
- Page 237 and 238: Chapter 17 ■ Be Social and Go Mob
- Page 239 and 240: Chapter 17 ■ Be Social and Go Mob
- Page 241 and 242: Chapter 17 ■ Be Social and Go Mob
- Page 243 and 244: Chapter 17 ■ Be Social and Go Mob
- Page 245 and 246: Chapter 17 ■ Be Social and Go Mob
- Page 247 and 248: Part IV Spring I/O Spring I/O is no
- Page 249 and 250: Chapter 18 ■ Spring and Groovy
- Page 251 and 252: Chapter 18 ■ Spring and Groovy Li
- Page 253 and 254: Chapter 18 ■ Spring and Groovy cl
- Page 255 and 256: Chapter 18 ■ Spring and Groovy If
- Page 257 and 258: Chapter 18 ■ Spring and Groovy Li
- Page 259 and 260: Chapter 19 ■ Spring Boot, Simplif
Chapter 15 ■ <strong>Spring</strong> Data Within Your <strong>Spring</strong> Application<br />
Figure 15-2. MongoDB Shell Shows the Types Collections<br />
Figure 15-3. MongoDB Shell Shows the Docs Collections<br />
Figure 15-2 shows how you can execute the db.types.find() command in order to see the contents of the types<br />
collections. Figure 15-3 shows the contents of the docs collection.<br />
To see the docs collection data, execute the db.docs.find() command as shown in Figure 15-3.<br />
213