use of org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer in project che by eclipse.
the class JpaTckModule method configure.
@Override
protected void configure() {
install(new JpaPersistModule("main"));
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(H2TestHelper.inMemoryDefault(), "che-schema"));
bind(TckResourcesCleaner.class).to(H2JpaCleaner.class);
bind(new TypeLiteral<TckRepository<RecipeImpl>>() {
}).toInstance(new JpaTckRepository<>(RecipeImpl.class));
bind(new TypeLiteral<TckRepository<SnapshotImpl>>() {
}).toInstance(new JpaTckRepository<>(SnapshotImpl.class));
bind(new TypeLiteral<TckRepository<Workspace>>() {
}).toInstance(new TestWorkspacesTckRepository());
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(RecipeDao.class).to(JpaRecipeDao.class);
bind(SnapshotDao.class).to(JpaSnapshotDao.class);
}
use of org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer in project che by eclipse.
the class SshTckModule method configure.
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(SshPairImpl.class, UserImpl.class, AccountImpl.class).setExceptionHandler(H2ExceptionHandler.class).build());
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
bind(SshDao.class).to(JpaSshDao.class);
bind(new TypeLiteral<TckRepository<SshPairImpl>>() {
}).toInstance(new JpaTckRepository<>(SshPairImpl.class));
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).toInstance(new JpaTckRepository<>(UserImpl.class));
}
use of org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer in project che by eclipse.
the class WorkspaceTckModule method configure.
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(AccountImpl.class, WorkspaceImpl.class, WorkspaceConfigImpl.class, ProjectConfigImpl.class, EnvironmentImpl.class, EnvironmentRecipeImpl.class, ExtendedMachineImpl.class, SourceStorageImpl.class, ServerConf2Impl.class, StackImpl.class, CommandImpl.class, SnapshotImpl.class, RecipeImpl.class).addEntityClass("org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute").setExceptionHandler(H2ExceptionHandler.class).build());
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
}).toInstance(new WorkspaceRepository());
bind(new TypeLiteral<TckRepository<StackImpl>>() {
}).toInstance(new StackRepository());
bind(WorkspaceDao.class).to(JpaWorkspaceDao.class);
bind(StackDao.class).to(JpaStackDao.class);
}
use of org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer in project che by eclipse.
the class JpaTckModule method configure.
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(UserImpl.class, ProfileImpl.class, PreferenceEntity.class, AccountImpl.class).setExceptionHandler(H2ExceptionHandler.class).build());
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server.getDataSource()));
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).to(UserJpaTckRepository.class);
bind(new TypeLiteral<TckRepository<ProfileImpl>>() {
}).toInstance(new JpaTckRepository<>(ProfileImpl.class));
bind(new TypeLiteral<TckRepository<Pair<String, Map<String, String>>>>() {
}).to(PreferenceJpaTckRepository.class);
bind(UserDao.class).to(JpaUserDao.class);
bind(ProfileDao.class).to(JpaProfileDao.class);
bind(PreferenceDao.class).to(JpaPreferenceDao.class);
// SHA-512 encryptor is faster than PBKDF2 so it is better for testing
bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
}
use of org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer in project che by eclipse.
the class AccountJpaTckModule method configure.
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClass(AccountImpl.class).setExceptionHandler(H2ExceptionHandler.class).build());
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(AccountDao.class).to(JpaAccountDao.class);
}
Aggregations