本文整理汇总了Java中org.eclipse.che.account.spi.AccountImpl类的典型用法代码示例。如果您正苦于以下问题:Java AccountImpl类的具体用法?Java AccountImpl怎么用?Java AccountImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccountImpl类属于org.eclipse.che.account.spi包,在下文中一共展示了AccountImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanup
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@AfterMethod
public void cleanup() {
manager.getTransaction().begin();
manager
.createQuery("SELECT e FROM Worker e", WorkerImpl.class)
.getResultList()
.forEach(manager::remove);
manager
.createQuery("SELECT w FROM Workspace w", WorkspaceImpl.class)
.getResultList()
.forEach(manager::remove);
manager
.createQuery("SELECT u FROM Usr u", UserImpl.class)
.getResultList()
.forEach(manager::remove);
manager
.createQuery("SELECT a FROM Account a", AccountImpl.class)
.getResultList()
.forEach(manager::remove);
manager.getTransaction().commit();
}
示例2: createWorkspace
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
/** Creates users workspace object based on the owner and machines RAM. */
public static WorkspaceImpl createWorkspace(
String owner, String devMachineRam, String... machineRams) throws Exception {
return WorkspaceImpl.builder()
.generateId()
.setConfig(
WorkspaceConfigImpl.builder()
.setName(NameGenerator.generate("workspace", 2))
.setEnvironments(
singletonMap("dev-env", createEnvironment(devMachineRam, machineRams)))
.setDefaultEnv("dev-env")
.build())
.setAccount(new AccountImpl("accountId", owner, "test"))
.setTemporary(false)
.setStatus(WorkspaceStatus.STOPPED)
.build();
}
示例3: configure
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@Override
protected void configure() {
install(new JpaPersistModule("main"));
H2DBTestServer server = H2DBTestServer.startDefault();
bind(SchemaInitializer.class)
.toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {})
.toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
.toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
}
示例4: configure
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@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);
}
示例5: configure
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@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));
}
示例6: WorkspaceImpl
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
public WorkspaceImpl(
String id,
Account account,
WorkspaceConfig config,
Runtime runtime,
Map<String, String> attributes,
boolean isTemporary,
WorkspaceStatus status) {
this.id = id;
if (account != null) {
this.account = new AccountImpl(account);
}
if (config != null) {
this.config = new WorkspaceConfigImpl(config);
}
if (runtime != null) {
this.runtime =
new RuntimeImpl(runtime.getActiveEnv(), runtime.getMachines(), runtime.getOwner());
}
if (attributes != null) {
this.attributes = new HashMap<>(attributes);
}
this.isTemporary = isTemporary;
this.status = status;
}
示例7: shouldSynchronizeWorkspaceNameWithConfigNameWhenConfigIsUpdated
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@Test(expectedExceptions = DuplicateKeyException.class)
public void shouldSynchronizeWorkspaceNameWithConfigNameWhenConfigIsUpdated() throws Exception {
final AccountImpl account = new AccountImpl("accountId", "namespace", "test");
final WorkspaceImpl workspace1 = createWorkspace("id", account, "name1");
final WorkspaceImpl workspace2 = createWorkspace("id2", account, "name2");
// persist prepared data
manager.getTransaction().begin();
manager.persist(account);
manager.persist(workspace1);
manager.persist(workspace2);
manager.getTransaction().commit();
// make conflict update
workspace2.getConfig().setName(workspace1.getConfig().getName());
manager.getTransaction().begin();
manager.merge(workspace2);
manager.getTransaction().commit();
}
示例8: createWorkspace
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
public static WorkspaceImpl createWorkspace(String id, AccountImpl account, String name) {
final WorkspaceConfigImpl wCfg = createWorkspaceConfig(name);
// Workspace
final WorkspaceImpl workspace = new WorkspaceImpl();
workspace.setId(id);
workspace.setAccount(account);
wCfg.setName(name);
workspace.setConfig(wCfg);
workspace.setAttributes(
new HashMap<>(
ImmutableMap.of(
"attr1", "value1",
"attr2", "value2",
"attr3", "value3")));
workspace.setConfig(wCfg);
return workspace;
}
示例9: setUp
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
workspaceManager =
new WorkspaceManager(workspaceDao, runtimes, eventService, accountManager, validator);
when(accountManager.getByName(NAMESPACE_1))
.thenReturn(new AccountImpl("accountId", NAMESPACE_1, "test"));
when(accountManager.getByName(NAMESPACE_2))
.thenReturn(new AccountImpl("accountId2", NAMESPACE_2, "test"));
when(workspaceDao.create(any(WorkspaceImpl.class)))
.thenAnswer(invocation -> invocation.getArguments()[0]);
when(workspaceDao.update(any(WorkspaceImpl.class)))
.thenAnswer(invocation -> invocation.getArguments()[0]);
EnvironmentContext.setCurrent(
new EnvironmentContext() {
@Override
public Subject getSubject() {
return new SubjectImpl(NAMESPACE_1, USER_ID, "token", false);
}
});
}
示例10: createAndMockWorkspace
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
private WorkspaceImpl createAndMockWorkspace(WorkspaceConfig cfg, String namespace)
throws Exception {
WorkspaceImpl workspace =
WorkspaceImpl.builder()
.generateId()
.setConfig(cfg)
.setAccount(new AccountImpl("id", namespace, "type"))
.setStatus(STOPPED)
.build();
when(workspaceDao.get(workspace.getId())).thenReturn(workspace);
when(workspaceDao.get(workspace.getConfig().getName(), workspace.getNamespace()))
.thenReturn(workspace);
when(workspaceDao.get(workspace.getConfig().getName(), NAMESPACE_1)).thenReturn(workspace);
when(workspaceDao.getByNamespace(eq(workspace.getNamespace()), anyInt(), anyLong()))
.thenReturn(new Page<>(singletonList(workspace), 0, 1, 1));
when(workspaceDao.getByNamespace(eq(NAMESPACE_1), anyInt(), anyLong()))
.thenReturn(new Page<>(singletonList(workspace), 0, 1, 1));
when(workspaceDao.getWorkspaces(eq(USER_ID), anyInt(), anyLong()))
.thenReturn(new Page<>(singletonList(workspace), 0, 1, 1));
return workspace;
}
示例11: configure
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(
new PersistTestModuleBuilder()
.setDriver(Driver.class)
.runningOn(server)
.addEntityClasses(
OrganizationImpl.class,
AccountImpl.class,
WorkspaceImpl.class,
WorkspaceConfigImpl.class,
ProjectConfigImpl.class,
EnvironmentImpl.class,
ExtendedMachineImpl.class,
CommandImpl.class,
SourceStorageImpl.class,
ServerConf2Impl.class,
SnapshotImpl.class,
InviteImpl.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", "codenvy-schema"));
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
bind(new TypeLiteral<TckRepository<InviteImpl>>() {})
.toInstance(new JpaTckRepository<>(InviteImpl.class));
bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
.toInstance(new JpaTckRepository<>(OrganizationImpl.class));
bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
.toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
bind(InviteDao.class).to(JpaInviteDao.class);
}
示例12: setupEntities
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@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", "[email protected]", "usr1"),
new UserImpl("user2", "[email protected]", "usr2")
};
account = new AccountImpl("account1", "accountName", "test");
workspaces =
new WorkspaceImpl[] {
new WorkspaceImpl(
"ws1", account, new WorkspaceConfigImpl("wrksp1", "", "cfg1", null, null, null)),
new WorkspaceImpl(
"ws2", account, new WorkspaceConfigImpl("wrksp2", "", "cfg2", null, null, null)),
new WorkspaceImpl(
"ws3", account, new WorkspaceConfigImpl("wrksp3", "", "cfg3", null, null, null))
};
Injector injector = Guice.createInjector(new WorkspaceTckModule());
manager = injector.getInstance(EntityManager.class);
dao = injector.getInstance(MultiuserJpaWorkspaceDao.class);
tckResourcesCleaner = injector.getInstance(TckResourcesCleaner.class);
}
示例13: setupEntities
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@BeforeClass
public void setupEntities() throws Exception {
account = new AccountImpl("account1", "accountName", "test");
users =
new UserImpl[] {
new UserImpl("user1", "[email protected]", "usr1"),
new UserImpl("user2", "[email protected]", "usr2")
};
workspace =
new WorkspaceImpl(
"ws1", account, new WorkspaceConfigImpl("", "", "cfg1", null, null, null));
workers =
new WorkerImpl[] {
new WorkerImpl("ws1", "user1", Arrays.asList("read", "use", "run")),
new WorkerImpl("ws1", "user2", Arrays.asList("read", "use"))
};
Injector injector = Guice.createInjector(new JpaTckModule());
manager = injector.getInstance(EntityManager.class);
workerDao = injector.getInstance(JpaWorkerDao.class);
workspaceDao = injector.getInstance(JpaWorkspaceDao.class);
subscriber = injector.getInstance(RemoveWorkersBeforeWorkspaceRemovedEventSubscriber.class);
subscriber.subscribe();
tckResourcesCleaner = injector.getInstance(TckResourcesCleaner.class);
}
示例14: setUp
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws TckRepositoryException {
workers =
new WorkerImpl[] {
new WorkerImpl("ws1", "user1", Arrays.asList("read", "use", "run")),
new WorkerImpl("ws1", "user2", Arrays.asList("read", "use")),
new WorkerImpl("ws2", "user1", Arrays.asList("read", "run")),
new WorkerImpl("ws2", "user2", Arrays.asList("read", "use", "run", "configure")),
new WorkerImpl("ws2", "user0", Arrays.asList("read", "use", "run", "configure"))
};
final UserImpl[] users =
new UserImpl[] {
new UserImpl("user0", "[email protected]", "usr0"),
new UserImpl("user1", "[email protected]", "usr1"),
new UserImpl("user2", "[email protected]", "usr2")
};
userRepository.createAll(Arrays.asList(users));
AccountImpl account = new AccountImpl("account1", "accountName", "test");
accountRepository.createAll(Collections.singletonList(account));
workspaceRepository.createAll(
Arrays.asList(
new WorkspaceImpl(
"ws0", account, new WorkspaceConfigImpl("ws-name0", "", "cfg0", null, null, null)),
new WorkspaceImpl(
"ws1", account, new WorkspaceConfigImpl("ws-name1", "", "cfg1", null, null, null)),
new WorkspaceImpl(
"ws2",
account,
new WorkspaceConfigImpl("ws-name2", "", "cfg2", null, null, null))));
workerRepository.createAll(
Stream.of(workers).map(WorkerImpl::new).collect(Collectors.toList()));
}
示例15: configure
import org.eclipse.che.account.spi.AccountImpl; //导入依赖的package包/类
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(
new PersistTestModuleBuilder()
.setDriver(Driver.class)
.runningOn(server)
.addEntityClasses(
UserImpl.class,
AccountImpl.class,
AbstractPermissions.class,
SystemPermissionsImpl.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));
// Creates empty multibinder to avoid error during container starting
Multibinder.newSetBinder(
binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {})
.to(TestDomain.class);
bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {})
.to(JpaSystemPermissionsDao.class);
bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {})
.toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
bind(new TypeLiteral<TckRepository<UserImpl>>() {})
.toInstance(new JpaTckRepository<>(UserImpl.class));
}