use of org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule in project che by eclipse.
the class CascadeRemovalTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
server = H2DBTestServer.startDefault();
injector = Guice.createInjector(Stage.PRODUCTION, new AbstractModule() {
@Override
protected void configure() {
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(AccountImpl.class, UserImpl.class, ProfileImpl.class, PreferenceEntity.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, SshPairImpl.class).addEntityClass("org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute").setExceptionHandler(H2ExceptionHandler.class).build());
bind(EventService.class).in(Singleton.class);
install(new InitModule(PostConstruct.class));
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
install(new UserJpaModule());
install(new AccountModule());
install(new SshJpaModule());
install(new WorkspaceJpaModule());
install(new MachineJpaModule());
bind(WorkspaceManager.class);
final WorkspaceRuntimes wR = mock(WorkspaceRuntimes.class);
when(wR.hasRuntime(anyString())).thenReturn(false);
bind(WorkspaceRuntimes.class).toInstance(wR);
bind(AccountManager.class);
bind(Boolean.class).annotatedWith(Names.named("che.workspace.auto_snapshot")).toInstance(false);
bind(Boolean.class).annotatedWith(Names.named("che.workspace.auto_restore")).toInstance(false);
bind(WorkspaceSharedPool.class).toInstance(new WorkspaceSharedPool("cached", null, null));
}
});
eventService = injector.getInstance(EventService.class);
accountDao = injector.getInstance(AccountDao.class);
userDao = injector.getInstance(UserDao.class);
preferenceDao = injector.getInstance(PreferenceDao.class);
profileDao = injector.getInstance(ProfileDao.class);
sshDao = injector.getInstance(SshDao.class);
snapshotDao = injector.getInstance(SnapshotDao.class);
workspaceDao = injector.getInstance(WorkspaceDao.class);
}
Aggregations