use of uk.ac.bbsrc.tgac.miso.core.data.type.LibraryStrategyType in project miso-lims by miso-lims.
the class Dtos method to.
public static LibraryStrategyType to(@Nonnull LibraryStrategyTypeDto from) {
LibraryStrategyType to = new LibraryStrategyType();
setLong(to::setId, from.getId(), false);
setString(to::setName, from.getName());
setString(to::setDescription, from.getDescription());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.type.LibraryStrategyType 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.LibraryStrategyType 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.LibraryStrategyType in project miso-lims by miso-lims.
the class HibernateLibraryStrategyDaoIT method testGetUsage.
@Test
public void testGetUsage() throws IOException {
LibraryStrategyType type = (LibraryStrategyType) getSessionFactory().getCurrentSession().get(LibraryStrategyType.class, 1L);
assertEquals("WGS", type.getName());
assertEquals(15L, sut.getUsage(type));
}
use of uk.ac.bbsrc.tgac.miso.core.data.type.LibraryStrategyType in project miso-lims by miso-lims.
the class HibernateLibraryStrategyDaoIT method testUpdate.
@Test
public void testUpdate() throws IOException {
long id = 1L;
String name = "New Name";
LibraryStrategyType type = (LibraryStrategyType) getSessionFactory().getCurrentSession().get(LibraryStrategyType.class, id);
assertNotEquals(name, type.getName());
type.setName(name);
sut.update(type);
clearSession();
LibraryStrategyType saved = (LibraryStrategyType) getSessionFactory().getCurrentSession().get(LibraryStrategyType.class, id);
assertEquals(name, saved.getName());
}
Aggregations