Announcement Announcement Module
Collapse
No announcement yet.
creating indexes and unit testing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • creating indexes and unit testing

    Hi,
    I am using Spring-data-mongo 1.0.0.M5

    I am curious to know how and when others are creating indexes on their collections in general and especially when running unit tests. I am using the spring data repository functionality to create repository classes for interacting with my collection. I am also annotating my entity class with @Document, @Id, @Indexed, and @GeoSpatialIndexed. As part of my JUnit4 test case class, I try to clean up the collection (remove all items from it) before each test. If I drop the collection, I am finding that all of the indexes that were created by Spring from my annotations are also dropped. However, if I just remove all of the documents from the collection, I have to drop the collection after all of the tests are run so that errors don't occur when the indexes are recreated during the next run of the unit test.

    What is the recommended practice for creating indexes during unit testing?

    Thanks for any and all replies in advance,

    Richard
Working...
X