use of org.eclipse.che.api.core.model.workspace.devfile.UserDevfile in project devspaces-images by redhat-developer.
the class UserDevfileDaoTest method shouldBeAbleToGetAvailableToUserDevfilesWithFilter2.
@Test
public void shouldBeAbleToGetAvailableToUserDevfilesWithFilter2() throws ServerException, NotFoundException, ConflictException {
// given
final UserDevfileImpl update = devfiles[0];
update.setName("New345Name");
userDevfileDaoDao.update(update);
// when
final Page<UserDevfile> result = userDevfileDaoDao.getDevfiles(30, 0, ImmutableList.of(new Pair<>("name", "like:%w345N%")), Collections.emptyList());
// then
assertEquals(new HashSet<>(result.getItems()), ImmutableSet.of(update));
}
use of org.eclipse.che.api.core.model.workspace.devfile.UserDevfile in project devspaces-images by redhat-developer.
the class UserDevfileDaoTest method shouldCreateUserDevfileWithEmptyMataName.
@Test
public void shouldCreateUserDevfileWithEmptyMataName() throws Exception {
// given
final UserDevfileImpl devfile = createUserDevfile(accounts[0]);
DevfileImpl newDevfile = new DevfileImpl(devfile.getDevfile());
MetadataImpl newMeta = new MetadataImpl();
newMeta.setGenerateName("gener-");
newDevfile.setMetadata(newMeta);
devfile.setDevfile(newDevfile);
// when
userDevfileDaoDao.create(devfile);
Optional<UserDevfile> devfileOptional = userDevfileDaoDao.getById(devfile.getId());
assertTrue(devfileOptional.isPresent());
UserDevfile actual = devfileOptional.get();
assertNull(actual.getDevfile().getMetadata().getName());
assertNotNull(actual.getDevfile().getMetadata().getGenerateName());
assertEquals(devfileOptional, Optional.of(new UserDevfileImpl(devfile)));
}
use of org.eclipse.che.api.core.model.workspace.devfile.UserDevfile in project devspaces-images by redhat-developer.
the class UserDevfileDaoTest method shouldGetDevfilesByNamespace.
@Test
public void shouldGetDevfilesByNamespace() throws Exception {
final UserDevfileImpl devfile1 = devfiles[0];
final UserDevfileImpl devfile2 = devfiles[1];
assertEquals(devfile1.getNamespace(), devfile2.getNamespace(), "Namespaces must be the same");
final Page<UserDevfile> found = userDevfileDaoDao.getByNamespace(devfile1.getNamespace(), 6, 0);
assertEquals(found.getTotalItemsCount(), 2);
assertEquals(found.getItemsCount(), 2);
assertEquals(new HashSet<>(found.getItems()), new HashSet<>(asList(devfile1, devfile2)));
}
use of org.eclipse.che.api.core.model.workspace.devfile.UserDevfile in project devspaces-images by redhat-developer.
the class UserDevfileDaoTest method shouldCreateUserDevfileWithNullDescription.
@Test
public void shouldCreateUserDevfileWithNullDescription() throws Exception {
// given
final UserDevfileImpl devfile = createUserDevfile(accounts[0]);
devfile.setDescription(null);
// when
userDevfileDaoDao.create(devfile);
Optional<UserDevfile> devfileOptional = userDevfileDaoDao.getById(devfile.getId());
assertTrue(devfileOptional.isPresent());
assertNull(devfileOptional.get().getDescription());
assertEquals(devfileOptional, Optional.of(new UserDevfileImpl(devfile)));
}
Aggregations