Search in sources :

Example 21 with WorkerImpl

use of org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl in project devspaces-images by redhat-developer.

the class MultiuserMySqlTckModule method configure.

@Override
protected void configure() {
    final Map<String, String> properties = new HashMap<>();
    properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
    final String dbUrl = System.getProperty("jdbc.url");
    final String dbUser = System.getProperty("jdbc.user");
    final String dbPassword = System.getProperty("jdbc.password");
    waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);
    properties.put(JDBC_URL, dbUrl);
    properties.put(JDBC_USER, dbUser);
    properties.put(JDBC_PASSWORD, dbPassword);
    properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));
    JpaPersistModule main = new JpaPersistModule("main");
    main.properties(properties);
    install(main);
    final com.mysql.cj.jdbc.MysqlDataSource dataSource = new com.mysql.cj.jdbc.MysqlDataSource();
    dataSource.setUser(dbUser);
    dataSource.setPassword(dbPassword);
    dataSource.setUrl(dbUrl);
    bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(dataSource, "che-schema"));
    bind(DBInitializer.class).asEagerSingleton();
    bind(TckResourcesCleaner.class).to(JpaCleaner.class);
    // repositories
    // api-account
    bind(new TypeLiteral<TckRepository<AccountImpl>>() {
    }).toInstance(new JpaTckRepository<>(AccountImpl.class));
    // api-user
    bind(new TypeLiteral<TckRepository<UserImpl>>() {
    }).to(UserJpaTckRepository.class);
    // api-workspace
    bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
    bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkerImpl.class));
    // api permission
    bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {
    }).toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
    bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {
    }).to(JpaSystemPermissionsDao.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
    }).to(WorkerDaoTest.TestDomain.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {
    }).to(SystemPermissionsDaoTest.TestDomain.class);
    // api-organization
    bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {
    }).to(JpaOrganizationImplTckRepository.class);
    bind(new TypeLiteral<TckRepository<MemberImpl>>() {
    }).toInstance(new JpaTckRepository<>(MemberImpl.class));
    bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {
    }).toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));
    // api-resource
    bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {
    }).toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
    // machine token keys
    bind(new TypeLiteral<TckRepository<SignatureKeyPairImpl>>() {
    }).toInstance(new JpaTckRepository<>(SignatureKeyPairImpl.class));
    bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
    }).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
    // dao
    bind(OrganizationDao.class).to(JpaOrganizationDao.class);
    bind(OrganizationDistributedResourcesDao.class).to(JpaOrganizationDistributedResourcesDao.class);
    bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
    bind(WorkerDao.class).to(JpaWorkerDao.class);
    bind(MemberDao.class).to(JpaMemberDao.class);
    bind(SignatureKeyDao.class).to(JpaSignatureKeyDao.class);
    bind(new TypeLiteral<PermissionsDao<MemberImpl>>() {
    }).to(JpaMemberDao.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {
    }).to(OrganizationDomain.class);
    bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
    }).to(UserDevfileDomain.class);
    bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
    }).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
    // SHA-512 ecnryptor is faster than PBKDF2 so it is better for testing
    bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
    // Creates empty multibinder to avoid error during container starting
    Multibinder.newSetBinder(binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
}
Also used : TckResourcesCleaner(org.eclipse.che.commons.test.tck.TckResourcesCleaner) WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) HashMap(java.util.HashMap) JpaUserDevfilePermissionDao(org.eclipse.che.multiuser.permission.devfile.server.spi.jpa.JpaUserDevfilePermissionDao) UserDevfilePermissionDao(org.eclipse.che.multiuser.permission.devfile.server.spi.UserDevfilePermissionDao) AccountImpl(org.eclipse.che.account.spi.AccountImpl) WorkerDaoTest(org.eclipse.che.multiuser.permission.workspace.server.spi.tck.WorkerDaoTest) JpaMemberDao(org.eclipse.che.multiuser.organization.spi.jpa.JpaMemberDao) MemberDao(org.eclipse.che.multiuser.organization.spi.MemberDao) SHA512PasswordEncryptor(org.eclipse.che.security.SHA512PasswordEncryptor) JpaSignatureKeyDao(org.eclipse.che.multiuser.machine.authentication.server.signature.jpa.JpaSignatureKeyDao) SignatureKeyDao(org.eclipse.che.multiuser.machine.authentication.server.signature.spi.SignatureKeyDao) SchemaInitializer(org.eclipse.che.core.db.schema.SchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) WorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.WorkerDao) JpaWorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.jpa.JpaWorkerDao) TypeLiteral(com.google.inject.TypeLiteral) DBInitializer(org.eclipse.che.core.db.DBInitializer) UserDevfileImpl(org.eclipse.che.api.devfile.server.model.impl.UserDevfileImpl) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) UserDevfilePermissionImpl(org.eclipse.che.multiuser.permission.devfile.server.model.impl.UserDevfilePermissionImpl) OrganizationDistributedResourcesImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl) JpaOrganizationDao(org.eclipse.che.multiuser.organization.spi.jpa.JpaOrganizationDao) OrganizationDao(org.eclipse.che.multiuser.organization.spi.OrganizationDao) MemberImpl(org.eclipse.che.multiuser.organization.spi.impl.MemberImpl) OrganizationDistributedResourcesDao(org.eclipse.che.multiuser.organization.spi.OrganizationDistributedResourcesDao) JpaOrganizationDistributedResourcesDao(org.eclipse.che.multiuser.organization.spi.jpa.JpaOrganizationDistributedResourcesDao) SignatureKeyPairImpl(org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyPairImpl) JpaPersistModule(com.google.inject.persist.jpa.JpaPersistModule) OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) UserDevfilePermission(org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission) SystemPermissionsDaoTest(org.eclipse.che.multiuser.api.permission.server.spi.tck.SystemPermissionsDaoTest) FreeResourcesLimitImpl(org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl) FreeResourcesLimitDao(org.eclipse.che.multiuser.resource.spi.FreeResourcesLimitDao) JpaFreeResourcesLimitDao(org.eclipse.che.multiuser.resource.spi.jpa.JpaFreeResourcesLimitDao) SystemPermissionsImpl(org.eclipse.che.multiuser.api.permission.server.model.impl.SystemPermissionsImpl) WorkerImpl(org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl)

Example 22 with WorkerImpl

use of org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl in project devspaces-images by redhat-developer.

the class MultiuserPostgresqlTckModule method configure.

@Override
protected void configure() {
    final Map<String, String> properties = new HashMap<>();
    properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
    final String dbUrl = System.getProperty("jdbc.url");
    final String dbUser = System.getProperty("jdbc.user");
    final String dbPassword = System.getProperty("jdbc.password");
    waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);
    properties.put(JDBC_URL, dbUrl);
    properties.put(JDBC_USER, dbUser);
    properties.put(JDBC_PASSWORD, dbPassword);
    properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));
    JpaPersistModule main = new JpaPersistModule("main");
    main.properties(properties);
    install(main);
    final PGSimpleDataSource dataSource = new PGSimpleDataSource();
    dataSource.setUser(dbUser);
    dataSource.setPassword(dbPassword);
    dataSource.setUrl(dbUrl);
    bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(dataSource, "che-schema"));
    bind(DBInitializer.class).asEagerSingleton();
    bind(TckResourcesCleaner.class).to(JpaCleaner.class);
    // repositories
    // api-account
    bind(new TypeLiteral<TckRepository<AccountImpl>>() {
    }).toInstance(new JpaTckRepository<>(AccountImpl.class));
    // api-user
    bind(new TypeLiteral<TckRepository<UserImpl>>() {
    }).to(UserJpaTckRepository.class);
    // api-workspace
    bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
    bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkerImpl.class));
    // api permission
    bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {
    }).toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
    bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {
    }).to(JpaSystemPermissionsDao.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
    }).to(WorkerDaoTest.TestDomain.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {
    }).to(SystemPermissionsDaoTest.TestDomain.class);
    // api-organization
    bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {
    }).to(JpaOrganizationImplTckRepository.class);
    bind(new TypeLiteral<TckRepository<MemberImpl>>() {
    }).toInstance(new JpaTckRepository<>(MemberImpl.class));
    bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {
    }).toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));
    // api-resource
    bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {
    }).toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
    // machine token keys
    bind(new TypeLiteral<TckRepository<SignatureKeyPairImpl>>() {
    }).toInstance(new JpaTckRepository<>(SignatureKeyPairImpl.class));
    bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
    }).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
    // dao
    bind(OrganizationDao.class).to(JpaOrganizationDao.class);
    bind(OrganizationDistributedResourcesDao.class).to(JpaOrganizationDistributedResourcesDao.class);
    bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
    bind(WorkerDao.class).to(JpaWorkerDao.class);
    bind(MemberDao.class).to(JpaMemberDao.class);
    bind(SignatureKeyDao.class).to(JpaSignatureKeyDao.class);
    bind(new TypeLiteral<PermissionsDao<MemberImpl>>() {
    }).to(JpaMemberDao.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {
    }).to(OrganizationDomain.class);
    bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
    bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
    }).to(UserDevfileDomain.class);
    bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
    }).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
    // SHA-512 ecnryptor is faster than PBKDF2 so it is better for testing
    bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
    // Creates empty multibinder to avoid error during container starting
    Multibinder.newSetBinder(binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
}
Also used : TckResourcesCleaner(org.eclipse.che.commons.test.tck.TckResourcesCleaner) WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) HashMap(java.util.HashMap) JpaUserDevfilePermissionDao(org.eclipse.che.multiuser.permission.devfile.server.spi.jpa.JpaUserDevfilePermissionDao) UserDevfilePermissionDao(org.eclipse.che.multiuser.permission.devfile.server.spi.UserDevfilePermissionDao) AccountImpl(org.eclipse.che.account.spi.AccountImpl) WorkerDaoTest(org.eclipse.che.multiuser.permission.workspace.server.spi.tck.WorkerDaoTest) JpaMemberDao(org.eclipse.che.multiuser.organization.spi.jpa.JpaMemberDao) MemberDao(org.eclipse.che.multiuser.organization.spi.MemberDao) SHA512PasswordEncryptor(org.eclipse.che.security.SHA512PasswordEncryptor) JpaSignatureKeyDao(org.eclipse.che.multiuser.machine.authentication.server.signature.jpa.JpaSignatureKeyDao) SignatureKeyDao(org.eclipse.che.multiuser.machine.authentication.server.signature.spi.SignatureKeyDao) SchemaInitializer(org.eclipse.che.core.db.schema.SchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) WorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.WorkerDao) JpaWorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.jpa.JpaWorkerDao) TypeLiteral(com.google.inject.TypeLiteral) DBInitializer(org.eclipse.che.core.db.DBInitializer) UserDevfileImpl(org.eclipse.che.api.devfile.server.model.impl.UserDevfileImpl) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) PGSimpleDataSource(org.postgresql.ds.PGSimpleDataSource) UserDevfilePermissionImpl(org.eclipse.che.multiuser.permission.devfile.server.model.impl.UserDevfilePermissionImpl) OrganizationDistributedResourcesImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl) JpaOrganizationDao(org.eclipse.che.multiuser.organization.spi.jpa.JpaOrganizationDao) OrganizationDao(org.eclipse.che.multiuser.organization.spi.OrganizationDao) MemberImpl(org.eclipse.che.multiuser.organization.spi.impl.MemberImpl) OrganizationDistributedResourcesDao(org.eclipse.che.multiuser.organization.spi.OrganizationDistributedResourcesDao) JpaOrganizationDistributedResourcesDao(org.eclipse.che.multiuser.organization.spi.jpa.JpaOrganizationDistributedResourcesDao) SignatureKeyPairImpl(org.eclipse.che.multiuser.machine.authentication.server.signature.model.impl.SignatureKeyPairImpl) JpaPersistModule(com.google.inject.persist.jpa.JpaPersistModule) OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) UserDevfilePermission(org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission) SystemPermissionsDaoTest(org.eclipse.che.multiuser.api.permission.server.spi.tck.SystemPermissionsDaoTest) FreeResourcesLimitImpl(org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl) FreeResourcesLimitDao(org.eclipse.che.multiuser.resource.spi.FreeResourcesLimitDao) JpaFreeResourcesLimitDao(org.eclipse.che.multiuser.resource.spi.jpa.JpaFreeResourcesLimitDao) SystemPermissionsImpl(org.eclipse.che.multiuser.api.permission.server.model.impl.SystemPermissionsImpl) WorkerImpl(org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl)

Example 23 with WorkerImpl

use of org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl in project devspaces-images by redhat-developer.

the class MultiuserJpaWorkspaceDaoTest method setupEntities.

@BeforeClass
public void setupEntities() throws Exception {
    workers = new WorkerImpl[] { new WorkerImpl("ws1", "user1", Arrays.asList("read", "use", "search")), new WorkerImpl("ws2", "user1", Arrays.asList("read", "search")), new WorkerImpl("ws3", "user1", Arrays.asList("none", "run")), new WorkerImpl("ws1", "user2", Arrays.asList("read", "use")) };
    users = new UserImpl[] { new UserImpl("user1", "user1@com.com", "usr1"), new UserImpl("user2", "user2@com.com", "usr2") };
    account = new AccountImpl("account1", "accountName", "test");
    workspaces = new WorkspaceImpl[] { new WorkspaceImpl("ws1", account, new WorkspaceConfigImpl("wrksp1", "", "cfg1", null, null, null, null)), new WorkspaceImpl("ws2", account, new WorkspaceConfigImpl("wrksp2", "", "cfg2", null, null, null, null)), new WorkspaceImpl("ws3", account, new WorkspaceConfigImpl("wrksp3", "", "cfg3", null, null, null, null)) };
    Injector injector = Guice.createInjector(new WorkspaceTckModule());
    manager = injector.getInstance(EntityManager.class);
    dao = injector.getInstance(MultiuserJpaWorkspaceDao.class);
    tckResourcesCleaner = injector.getInstance(TckResourcesCleaner.class);
}
Also used : TckResourcesCleaner(org.eclipse.che.commons.test.tck.TckResourcesCleaner) WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) EntityManager(javax.persistence.EntityManager) Injector(com.google.inject.Injector) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) AccountImpl(org.eclipse.che.account.spi.AccountImpl) WorkspaceConfigImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl) WorkerImpl(org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl) MultiuserJpaWorkspaceDao(org.eclipse.che.multiuser.permission.workspace.server.spi.jpa.MultiuserJpaWorkspaceDao) BeforeClass(org.testng.annotations.BeforeClass)

Example 24 with WorkerImpl

use of org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl in project devspaces-images by redhat-developer.

the class WorkspaceTckModule method configure.

@Override
protected void configure() {
    H2DBTestServer server = H2DBTestServer.startDefault();
    install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(AccountImpl.class, UserImpl.class, WorkspaceImpl.class, WorkspaceConfigImpl.class, ProjectConfigImpl.class, EnvironmentImpl.class, WorkerImpl.class, MachineConfigImpl.class, SourceStorageImpl.class, ServerConfigImpl.class, CommandImpl.class, RecipeImpl.class, VolumeImpl.class, // devfile
    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).addEntityClass("org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute").addClass(SerializableConverter.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(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
    }).toInstance(new WorkspaceRepository());
    bind(new TypeLiteral<TckRepository<UserImpl>>() {
    }).toInstance(new JpaTckRepository<>(UserImpl.class));
    bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkerImpl.class));
    bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
    }).to(WorkerDaoTest.TestDomain.class);
    bind(WorkerDao.class).to(JpaWorkerDao.class);
    bind(WorkspaceDao.class).to(JpaWorkspaceDao.class);
}
Also used : TckResourcesCleaner(org.eclipse.che.commons.test.tck.TckResourcesCleaner) WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) AccountImpl(org.eclipse.che.account.spi.AccountImpl) Driver(org.h2.Driver) WorkerDaoTest(org.eclipse.che.multiuser.permission.workspace.server.spi.tck.WorkerDaoTest) EnvironmentImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl) ServerConfigImpl(org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl) ComponentImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl) H2JpaCleaner(org.eclipse.che.commons.test.db.H2JpaCleaner) SchemaInitializer(org.eclipse.che.core.db.schema.SchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) WorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.WorkerDao) JpaWorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.jpa.JpaWorkerDao) TypeLiteral(com.google.inject.TypeLiteral) DBInitializer(org.eclipse.che.core.db.DBInitializer) DevfileImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) WorkspaceConfigImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl) CommandImpl(org.eclipse.che.api.workspace.server.model.impl.CommandImpl) EntrypointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EntrypointImpl) H2DBTestServer(org.eclipse.che.commons.test.db.H2DBTestServer) ProjectImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) EnvImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EnvImpl) SourceStorageImpl(org.eclipse.che.api.workspace.server.model.impl.SourceStorageImpl) PersistTestModuleBuilder(org.eclipse.che.commons.test.db.PersistTestModuleBuilder) SerializableConverter(org.eclipse.che.api.workspace.server.devfile.SerializableConverter) MachineConfigImpl(org.eclipse.che.api.workspace.server.model.impl.MachineConfigImpl) SourceImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.SourceImpl) RecipeImpl(org.eclipse.che.api.workspace.server.model.impl.RecipeImpl) VolumeImpl(org.eclipse.che.api.workspace.server.model.impl.VolumeImpl) ActionImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ActionImpl) WorkerImpl(org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl) JpaWorkspaceDao(org.eclipse.che.api.workspace.server.jpa.JpaWorkspaceDao) WorkspaceDao(org.eclipse.che.api.workspace.server.spi.WorkspaceDao) ProjectConfigImpl(org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl)

Example 25 with WorkerImpl

use of org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl in project devspaces-images by redhat-developer.

the class JpaTckModule method configure.

@Override
protected void configure() {
    H2DBTestServer server = H2DBTestServer.startDefault();
    install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(AccountImpl.class, UserImpl.class, WorkspaceImpl.class, WorkspaceConfigImpl.class, ProjectConfigImpl.class, EnvironmentImpl.class, WorkerImpl.class, MachineConfigImpl.class, SourceStorageImpl.class, ServerConfigImpl.class, CommandImpl.class, RecipeImpl.class, VolumeImpl.class, // devfile
    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).addEntityClass("org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute").addClass(SerializableConverter.class).setExceptionHandler(H2ExceptionHandler.class).build());
    bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
    }).to(WorkerDaoTest.TestDomain.class);
    bind(WorkerDao.class).to(JpaWorkerDao.class);
    bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkerImpl.class));
    bind(new TypeLiteral<TckRepository<UserImpl>>() {
    }).toInstance(new JpaTckRepository<>(UserImpl.class));
    bind(new TypeLiteral<TckRepository<AccountImpl>>() {
    }).toInstance(new JpaTckRepository<>(AccountImpl.class));
    bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
    }).toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
    bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
    bind(DBInitializer.class).asEagerSingleton();
    bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
}
Also used : TckResourcesCleaner(org.eclipse.che.commons.test.tck.TckResourcesCleaner) WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) AccountImpl(org.eclipse.che.account.spi.AccountImpl) Driver(org.h2.Driver) WorkerDaoTest(org.eclipse.che.multiuser.permission.workspace.server.spi.tck.WorkerDaoTest) EnvironmentImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl) ServerConfigImpl(org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl) ComponentImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl) H2JpaCleaner(org.eclipse.che.commons.test.db.H2JpaCleaner) WorkerDao(org.eclipse.che.multiuser.permission.workspace.server.spi.WorkerDao) SchemaInitializer(org.eclipse.che.core.db.schema.SchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) FlywaySchemaInitializer(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer) TypeLiteral(com.google.inject.TypeLiteral) DBInitializer(org.eclipse.che.core.db.DBInitializer) DevfileImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) WorkspaceConfigImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl) CommandImpl(org.eclipse.che.api.workspace.server.model.impl.CommandImpl) EntrypointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EntrypointImpl) H2DBTestServer(org.eclipse.che.commons.test.db.H2DBTestServer) ProjectImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) EnvImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EnvImpl) SourceStorageImpl(org.eclipse.che.api.workspace.server.model.impl.SourceStorageImpl) PersistTestModuleBuilder(org.eclipse.che.commons.test.db.PersistTestModuleBuilder) SerializableConverter(org.eclipse.che.api.workspace.server.devfile.SerializableConverter) MachineConfigImpl(org.eclipse.che.api.workspace.server.model.impl.MachineConfigImpl) SourceImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.SourceImpl) RecipeImpl(org.eclipse.che.api.workspace.server.model.impl.RecipeImpl) VolumeImpl(org.eclipse.che.api.workspace.server.model.impl.VolumeImpl) ActionImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ActionImpl) WorkerImpl(org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl) ProjectConfigImpl(org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl)

Aggregations

WorkerImpl (org.eclipse.che.multiuser.permission.workspace.server.model.impl.WorkerImpl)26 UserImpl (org.eclipse.che.api.user.server.model.impl.UserImpl)18 WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)18 AccountImpl (org.eclipse.che.account.spi.AccountImpl)16 TckResourcesCleaner (org.eclipse.che.commons.test.tck.TckResourcesCleaner)12 WorkspaceConfigImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl)10 TypeLiteral (com.google.inject.TypeLiteral)8 DBInitializer (org.eclipse.che.core.db.DBInitializer)8 SchemaInitializer (org.eclipse.che.core.db.schema.SchemaInitializer)8 FlywaySchemaInitializer (org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer)8 WorkerDao (org.eclipse.che.multiuser.permission.workspace.server.spi.WorkerDao)8 WorkerDaoTest (org.eclipse.che.multiuser.permission.workspace.server.spi.tck.WorkerDaoTest)8 JpaWorkerDao (org.eclipse.che.multiuser.permission.workspace.server.spi.jpa.JpaWorkerDao)6 JpaPersistModule (com.google.inject.persist.jpa.JpaPersistModule)4 HashMap (java.util.HashMap)4 UserDevfileImpl (org.eclipse.che.api.devfile.server.model.impl.UserDevfileImpl)4 SerializableConverter (org.eclipse.che.api.workspace.server.devfile.SerializableConverter)4 CommandImpl (org.eclipse.che.api.workspace.server.model.impl.CommandImpl)4 EnvironmentImpl (org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl)4 MachineConfigImpl (org.eclipse.che.api.workspace.server.model.impl.MachineConfigImpl)4