org.iternine.jeppetto.testsupport
Class MongoDatabaseProvider

java.lang.Object
  extended by org.iternine.jeppetto.testsupport.MongoDatabaseProvider
All Implemented Interfaces:
Closeable, DatabaseProvider

public class MongoDatabaseProvider
extends Object
implements DatabaseProvider, Closeable


Constructor Summary
MongoDatabaseProvider()
          Construct a default MongoDatabaseProvider that will uniquify mongodb database names.
MongoDatabaseProvider(boolean uniquifyName)
          Uses the default mongodb port properties (either "mongodb.left.port" or "mongodb.port").
MongoDatabaseProvider(String mongoPortProperty, String mongoDbNameProperty, boolean uniquifyName)
           
 
Method Summary
 void close()
           
 Database getDatabase(Properties properties, org.springframework.context.ApplicationContext applicationContext)
          Create and initialize the database.
 Properties modifyProperties(Properties properties)
          Optionally make any property modifications before refreshing the application context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoDatabaseProvider

public MongoDatabaseProvider()
Construct a default MongoDatabaseProvider that will uniquify mongodb database names.


MongoDatabaseProvider

public MongoDatabaseProvider(boolean uniquifyName)
Uses the default mongodb port properties (either "mongodb.left.port" or "mongodb.port"). Uses the default mongodb name property ("mongodb.dbname")

Parameters:
uniquifyName - true if the mongodb database name should be modified to avoid collisions with concurrent tests

MongoDatabaseProvider

public MongoDatabaseProvider(String mongoPortProperty,
                             String mongoDbNameProperty,
                             boolean uniquifyName)
Parameters:
mongoPortProperty - name of the property that specifies the mongodb port
mongoDbNameProperty - name of the property that specifies the mongodb database name
uniquifyName - true if the mongodb database name should be modified to avoid collisions with concurrent tests
Method Detail

modifyProperties

public Properties modifyProperties(Properties properties)
Description copied from interface: DatabaseProvider
Optionally make any property modifications before refreshing the application context.

Specified by:
modifyProperties in interface DatabaseProvider
Parameters:
properties - properties
Returns:
modified properties

getDatabase

public Database getDatabase(Properties properties,
                            org.springframework.context.ApplicationContext applicationContext)
Description copied from interface: DatabaseProvider
Create and initialize the database.

Specified by:
getDatabase in interface DatabaseProvider
Parameters:
properties - app properties
applicationContext - app context
Returns:
new initialized database

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2012. All Rights Reserved.