use of org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl in project che by eclipse.
the class StackServiceTest method shouldReturnsStackByTagList.
@Test
public void shouldReturnsStackByTagList() throws ServerException {
StackImpl stack2 = new StackImpl(stackImpl);
stack2.setTags(singletonList("Subversion"));
when(stackDao.searchStacks(anyString(), eq(singletonList("Subversion")), anyInt(), anyInt())).thenReturn(singletonList(stack2));
Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().get(SECURE_PATH + "/stack?tags=Subversion");
assertEquals(response.getStatusCode(), 200);
verify(stackDao).searchStacks(anyString(), eq(singletonList("Subversion")), anyInt(), anyInt());
List<StackDto> result = unwrapListDto(response, StackDto.class);
assertEquals(result.size(), 1);
assertEquals(result.get(0).getName(), stack2.getName());
}
use of org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl in project che by eclipse.
the class PostgreSqlTckModule method configure.
@Override
protected void configure() {
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);
// jpa
install(new PersistTestModuleBuilder().setDriver(Driver.class).setUrl(dbUrl).setUser(dbUser).setPassword(dbPassword).setExceptionHandler(PostgreSqlExceptionHandler.class).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").build());
bind(TckResourcesCleaner.class).to(JpaCleaner.class);
// db initialization
bind(DBInitializer.class).asEagerSingleton();
final PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setUser(dbUser);
dataSource.setPassword(dbPassword);
dataSource.setUrl(dbUrl);
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(dataSource, "che-schema"));
// account
bind(AccountDao.class).to(JpaAccountDao.class);
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
// user
bind(UserDao.class).to(JpaUserDao.class);
bind(ProfileDao.class).to(JpaProfileDao.class);
bind(PreferenceDao.class).to(JpaPreferenceDao.class);
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).to(UserRepo.class);
bind(new TypeLiteral<TckRepository<Pair<String, Map<String, String>>>>() {
}).to(PreferencesRepo.class);
bind(new TypeLiteral<TckRepository<ProfileImpl>>() {
}).toInstance(new JpaTckRepository<>(ProfileImpl.class));
bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class);
// machine
bind(RecipeDao.class).to(JpaRecipeDao.class);
bind(SnapshotDao.class).to(JpaSnapshotDao.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 WorkspaceRepoForSnapshots());
// ssh
bind(SshDao.class).to(JpaSshDao.class);
bind(new TypeLiteral<TckRepository<SshPairImpl>>() {
}).toInstance(new JpaTckRepository<>(SshPairImpl.class));
// workspace
bind(WorkspaceDao.class).to(JpaWorkspaceDao.class);
bind(StackDao.class).to(JpaStackDao.class);
bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
}).toInstance(new WorkspaceRepository());
bind(new TypeLiteral<TckRepository<StackImpl>>() {
}).toInstance(new StackRepository());
}
use of org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl in project che by eclipse.
the class StackDaoTest method shouldNotUpdateStackIfNewNameIsReserved.
@Test(expectedExceptions = ConflictException.class)
public void shouldNotUpdateStackIfNewNameIsReserved() throws Exception {
final StackImpl stack = stacks[0];
stack.setName(stacks[1].getName());
stackDao.update(stack);
}
use of org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl in project che by eclipse.
the class StackDaoTest method shouldReturnAllStacksWhenSearchingWithoutTags.
@Test
public void shouldReturnAllStacksWhenSearchingWithoutTags() throws Exception {
final List<StackImpl> found = stackDao.searchStacks(null, null, 0, 0);
found.forEach(s -> Collections.sort(s.getTags()));
for (StackImpl stack : stacks) {
Collections.sort(stack.getTags());
}
assertEquals(new HashSet<>(found), new HashSet<>(asList(stacks)));
}
use of org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl in project che by eclipse.
the class StackDaoTest method shouldGetById.
@Test
public void shouldGetById() throws Exception {
final StackImpl stack = stacks[0];
assertEquals(stackDao.getById(stack.getId()), stack);
}
Aggregations