Search in sources :

Example 1 with DatabaseModule

use of com.manydesigns.portofino.modules.DatabaseModule in project Portofino by ManyDesigns.

the class PersistenceTest method setup.

protected void setup(FileObject appDir) throws Exception {
    Configuration configuration = new PropertiesConfiguration();
    final DatabasePlatformsRegistry databasePlatformsRegistry = new DatabasePlatformsRegistry(configuration);
    databasePlatformsRegistry.addDatabasePlatform(new H2DatabasePlatform());
    databaseModule = new DatabaseModule() {

        @Override
        public void destroy() {
            if (subscription != null) {
                subscription.dispose();
                subscription = null;
            }
        }
    };
    databaseModule.applicationDirectory = appDir;
    databaseModule.configuration = new ConfigurationSource(configuration, null);
    persistence = databaseModule.getPersistence(databasePlatformsRegistry, new CacheResetListenerRegistry());
    databaseModule.init();
    persistence.start();
    setupJPetStore();
    setupHibernateTest();
    persistence.initModel();
}
Also used : H2DatabasePlatform(com.manydesigns.portofino.database.platforms.H2DatabasePlatform) ConfigurationSource(com.manydesigns.portofino.config.ConfigurationSource) Configuration(org.apache.commons.configuration2.Configuration) PropertiesConfiguration(org.apache.commons.configuration2.PropertiesConfiguration) DatabasePlatformsRegistry(com.manydesigns.portofino.model.database.platforms.DatabasePlatformsRegistry) CacheResetListenerRegistry(com.manydesigns.portofino.cache.CacheResetListenerRegistry) DatabaseModule(com.manydesigns.portofino.modules.DatabaseModule) PropertiesConfiguration(org.apache.commons.configuration2.PropertiesConfiguration)

Aggregations

CacheResetListenerRegistry (com.manydesigns.portofino.cache.CacheResetListenerRegistry)1 ConfigurationSource (com.manydesigns.portofino.config.ConfigurationSource)1 H2DatabasePlatform (com.manydesigns.portofino.database.platforms.H2DatabasePlatform)1 DatabasePlatformsRegistry (com.manydesigns.portofino.model.database.platforms.DatabasePlatformsRegistry)1 DatabaseModule (com.manydesigns.portofino.modules.DatabaseModule)1 Configuration (org.apache.commons.configuration2.Configuration)1 PropertiesConfiguration (org.apache.commons.configuration2.PropertiesConfiguration)1