use of uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType in project miso-lims by miso-lims.
the class Dtos method to.
public static LibraryDesign to(@Nonnull LibraryDesignDto from) {
LibraryDesign to = new LibraryDesign();
setLong(to::setId, from.getId(), false);
setString(to::setName, from.getName());
setObject(to::setSampleClass, SampleClassImpl::new, from.getSampleClassId());
setObject(to::setLibraryDesignCode, LibraryDesignCode::new, from.getDesignCodeId());
setObject(to::setLibrarySelectionType, LibrarySelectionType::new, from.getSelectionId());
setObject(to::setLibraryStrategyType, LibraryStrategyType::new, from.getStrategyId());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType in project miso-lims by miso-lims.
the class HibernateLibraryDaoIT method testCreate.
@Test
public void testCreate() throws Exception {
Library library = new LibraryImpl();
String libraryName = "newLibrary";
library.setName(libraryName);
library.setAlias("theAlias");
library.setDescription("a description");
library.setPlatformType(PlatformType.ILLUMINA);
Sample sample = new SampleImpl();
sample.setId(4);
library.setSample(sample);
LibraryType libraryType = new LibraryType();
libraryType.setId(1L);
library.setLibraryType(libraryType);
LibrarySelectionType librarySelectionType = new LibrarySelectionType();
librarySelectionType.setId(1L);
library.setLibrarySelectionType(librarySelectionType);
LibraryStrategyType libraryStrategyType = new LibraryStrategyType();
libraryStrategyType.setId(1L);
library.setLibraryStrategyType(libraryStrategyType);
User mockUser = new UserImpl();
mockUser.setId(1L);
Date now = new Date();
library.setCreator(mockUser);
library.setCreationTime(now);
library.setLastModifier(mockUser);
library.setLastModified(now);
long libraryId = dao.save(library);
Library insertedLibrary = dao.get(libraryId);
assertEquals(libraryName, insertedLibrary.getName());
assertEquals("theAlias", insertedLibrary.getAlias());
assertEquals("a description", insertedLibrary.getDescription());
assertEquals(4, library.getSample().getId());
assertEquals(1L, library.getLibraryType().getId());
assertEquals(1L, library.getLibrarySelectionType().getId());
assertEquals(1L, library.getLibraryStrategyType().getId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType in project miso-lims by miso-lims.
the class HibernateLibrarySelectionDaoIT method testUpdate.
@Test
public void testUpdate() throws IOException {
long id = 1L;
String name = "New Name";
LibrarySelectionType type = (LibrarySelectionType) getSessionFactory().getCurrentSession().get(LibrarySelectionType.class, id);
assertNotEquals(name, type.getName());
type.setName(name);
sut.update(type);
clearSession();
LibrarySelectionType saved = (LibrarySelectionType) getSessionFactory().getCurrentSession().get(LibrarySelectionType.class, id);
assertEquals(name, saved.getName());
}
use of uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType in project miso-lims by miso-lims.
the class HibernateLibrarySelectionDaoIT method testGet.
@Test
public void testGet() throws IOException {
long id = 1L;
LibrarySelectionType type = sut.get(id);
assertNotNull(type);
assertEquals(id, type.getId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType in project miso-lims by miso-lims.
the class HibernateLibrarySelectionDaoIT method testCreate.
@Test
public void testCreate() throws IOException {
String name = "New Selection";
LibrarySelectionType type = new LibrarySelectionType();
type.setName(name);
type.setDescription("desc");
long savedId = sut.create(type);
clearSession();
LibrarySelectionType saved = (LibrarySelectionType) getSessionFactory().getCurrentSession().get(LibrarySelectionType.class, savedId);
assertEquals(name, saved.getName());
}
Aggregations