use of org.eclipse.che.api.workspace.activity.WorkspaceActivityDao in project che-server by eclipse-che.
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, WorkspaceActivity.class, ProjectConfigImpl.class, EnvironmentImpl.class, MachineConfigImpl.class, SourceStorageImpl.class, ServerConfigImpl.class, CommandImpl.class, RecipeImpl.class, SshPairImpl.class, VolumeImpl.class, ActionImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.CommandImpl.class, ComponentImpl.class, DevfileImpl.class, EndpointImpl.class, EntrypointImpl.class, EnvImpl.class, ProjectImpl.class, SourceImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl.class, KubernetesRuntimeState.class, KubernetesRuntimeCommandImpl.class, KubernetesMachineImpl.class, KubernetesMachineImpl.MachineId.class, KubernetesServerImpl.class, KubernetesServerImpl.ServerId.class).addEntityClass("org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute").addClass(SerializableConverter.class).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();
bind(String[].class).annotatedWith(Names.named("che.auth.reserved_user_names")).toInstance(new String[0]);
bind(Long.class).annotatedWith(Names.named("che.limits.workspace.idle.timeout")).toInstance(100000L);
bind(Long.class).annotatedWith(Names.named("che.limits.workspace.run.timeout")).toInstance(0L);
bind(UserManager.class);
bind(AccountManager.class);
install(new UserJpaModule());
install(new AccountModule());
install(new SshJpaModule());
install(new WorkspaceJpaModule());
install(new WorkspaceActivityModule());
install(new JpaKubernetesRuntimeCacheModule());
bind(ExecutorServiceWrapper.class).to(NoopExecutorServiceWrapper.class);
// initialize empty binder
Multibinder.newSetBinder(binder(), WorkspaceAttributeValidator.class);
bind(WorkspaceManager.class);
RuntimeInfrastructure infra = mock(RuntimeInfrastructure.class);
doReturn(emptySet()).when(infra).getRecipeTypes();
bind(RuntimeInfrastructure.class).toInstance(infra);
WorkspaceRuntimes wR = spy(new WorkspaceRuntimes(mock(EventService.class), emptyMap(), infra, mock(WorkspaceSharedPool.class), mock(WorkspaceDao.class), mock(DBInitializer.class), mock(ProbeScheduler.class), new DefaultWorkspaceStatusCache(), new DefaultWorkspaceLockService(), mock(DevfileConverter.class), false));
when(wR.hasRuntime(anyString())).thenReturn(false);
bind(WorkspaceRuntimes.class).toInstance(wR);
bind(AccountManager.class);
bind(WorkspaceSharedPool.class).toInstance(new WorkspaceSharedPool("cached", null, null, new NoopExecutorServiceWrapper()));
MapBinder.newMapBinder(binder(), String.class, ComponentIntegrityValidator.class).addBinding("kubernetes").toInstance(mock(ComponentIntegrityValidator.class));
}
});
eventService = injector.getInstance(EventService.class);
accountDao = injector.getInstance(AccountDao.class);
userDao = injector.getInstance(UserDao.class);
userManager = injector.getInstance(UserManager.class);
accountManager = injector.getInstance(AccountManager.class);
preferenceDao = injector.getInstance(PreferenceDao.class);
profileDao = injector.getInstance(ProfileDao.class);
sshDao = injector.getInstance(SshDao.class);
workspaceDao = injector.getInstance(WorkspaceDao.class);
workspaceActivityDao = injector.getInstance(WorkspaceActivityDao.class);
k8sRuntimes = injector.getInstance(KubernetesRuntimeStateCache.class);
k8sMachines = injector.getInstance(KubernetesMachineCache.class);
}
use of org.eclipse.che.api.workspace.activity.WorkspaceActivityDao in project devspaces-images by redhat-developer.
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, WorkspaceActivity.class, ProjectConfigImpl.class, EnvironmentImpl.class, MachineConfigImpl.class, SourceStorageImpl.class, ServerConfigImpl.class, CommandImpl.class, RecipeImpl.class, SshPairImpl.class, VolumeImpl.class, ActionImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.CommandImpl.class, ComponentImpl.class, DevfileImpl.class, EndpointImpl.class, EntrypointImpl.class, EnvImpl.class, ProjectImpl.class, SourceImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl.class, KubernetesRuntimeState.class, KubernetesRuntimeCommandImpl.class, KubernetesMachineImpl.class, KubernetesMachineImpl.MachineId.class, KubernetesServerImpl.class, KubernetesServerImpl.ServerId.class).addEntityClass("org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute").addClass(SerializableConverter.class).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();
bind(String[].class).annotatedWith(Names.named("che.auth.reserved_user_names")).toInstance(new String[0]);
bind(Long.class).annotatedWith(Names.named("che.limits.workspace.idle.timeout")).toInstance(100000L);
bind(Long.class).annotatedWith(Names.named("che.limits.workspace.run.timeout")).toInstance(0L);
bind(UserManager.class);
bind(AccountManager.class);
install(new UserJpaModule());
install(new AccountModule());
install(new SshJpaModule());
install(new WorkspaceJpaModule());
install(new WorkspaceActivityModule());
install(new JpaKubernetesRuntimeCacheModule());
bind(ExecutorServiceWrapper.class).to(NoopExecutorServiceWrapper.class);
// initialize empty binder
Multibinder.newSetBinder(binder(), WorkspaceAttributeValidator.class);
bind(WorkspaceManager.class);
RuntimeInfrastructure infra = mock(RuntimeInfrastructure.class);
doReturn(emptySet()).when(infra).getRecipeTypes();
bind(RuntimeInfrastructure.class).toInstance(infra);
WorkspaceRuntimes wR = spy(new WorkspaceRuntimes(mock(EventService.class), emptyMap(), infra, mock(WorkspaceSharedPool.class), mock(WorkspaceDao.class), mock(DBInitializer.class), mock(ProbeScheduler.class), new DefaultWorkspaceStatusCache(), new DefaultWorkspaceLockService(), mock(DevfileConverter.class), false));
when(wR.hasRuntime(anyString())).thenReturn(false);
bind(WorkspaceRuntimes.class).toInstance(wR);
bind(AccountManager.class);
bind(WorkspaceSharedPool.class).toInstance(new WorkspaceSharedPool("cached", null, null, new NoopExecutorServiceWrapper()));
MapBinder.newMapBinder(binder(), String.class, ComponentIntegrityValidator.class).addBinding("kubernetes").toInstance(mock(ComponentIntegrityValidator.class));
}
});
eventService = injector.getInstance(EventService.class);
accountDao = injector.getInstance(AccountDao.class);
userDao = injector.getInstance(UserDao.class);
userManager = injector.getInstance(UserManager.class);
accountManager = injector.getInstance(AccountManager.class);
preferenceDao = injector.getInstance(PreferenceDao.class);
profileDao = injector.getInstance(ProfileDao.class);
sshDao = injector.getInstance(SshDao.class);
workspaceDao = injector.getInstance(WorkspaceDao.class);
workspaceActivityDao = injector.getInstance(WorkspaceActivityDao.class);
k8sRuntimes = injector.getInstance(KubernetesRuntimeStateCache.class);
k8sMachines = injector.getInstance(KubernetesMachineCache.class);
}
Aggregations