use of uk.ac.bbsrc.tgac.miso.core.data.BoxSize in project miso-lims by miso-lims.
the class HibernateBoxDaoIT method testSave.
@Test
public void testSave() throws Exception {
Box box = new BoxImpl();
UserImpl user = new UserImpl();
user.setId(1l);
Date now = new Date();
box.setCreator(user);
box.setCreationTime(now);
box.setLastModifier(user);
box.setLastModified(now);
box.setDescription("newboxdescription");
box.setAlias("newboxalias");
box.setName("newbox");
box.setLocationBarcode("newlocationbarcode");
BoxSize boxSize = new BoxSize();
boxSize.setColumns(2);
boxSize.setRows(3);
boxSize.setId(1l);
box.setSize(boxSize);
BoxUse boxuse = (BoxUse) sessionFactory.getCurrentSession().get(BoxUse.class, 1L);
box.setUse(boxuse);
long boxId = dao.save(box);
Box retrieved = dao.get(boxId);
assertEquals(box.getDescription(), retrieved.getDescription());
assertEquals(box.getAlias(), retrieved.getAlias());
assertEquals(box.getSize().getId(), retrieved.getSize().getId());
assertEquals(box.getName(), retrieved.getName());
}
use of uk.ac.bbsrc.tgac.miso.core.data.BoxSize in project miso-lims by miso-lims.
the class HibernateBoxSizeDaoIT method testGetUsage.
@Test
public void testGetUsage() throws IOException {
BoxSize boxSize = (BoxSize) getSessionFactory().getCurrentSession().get(BoxSize.class, 1L);
assertNotNull(boxSize);
assertEquals(2L, sut.getUsage(boxSize));
}
use of uk.ac.bbsrc.tgac.miso.core.data.BoxSize in project miso-lims by miso-lims.
the class HibernateBoxSizeDaoIT method testUpdate.
@Test
public void testUpdate() throws IOException {
long id = 1L;
int rows = 7;
int cols = 5;
BoxSize boxSize = (BoxSize) getSessionFactory().getCurrentSession().get(BoxSize.class, id);
assertNotEquals(rows, boxSize.getRows().intValue());
assertNotEquals(cols, boxSize.getColumns().intValue());
boxSize.setRows(rows);
boxSize.setColumns(cols);
sut.update(boxSize);
clearSession();
BoxSize saved = (BoxSize) getSessionFactory().getCurrentSession().get(BoxSize.class, id);
assertEquals(rows, saved.getRows().intValue());
assertEquals(cols, saved.getColumns().intValue());
}
use of uk.ac.bbsrc.tgac.miso.core.data.BoxSize in project miso-lims by miso-lims.
the class HibernateBoxSizeDaoIT method testCreate.
@Test
public void testCreate() throws IOException {
int rows = 3;
int cols = 2;
BoxSize boxSize = new BoxSize();
boxSize.setRows(rows);
boxSize.setColumns(cols);
boxSize.setBoxType(BoxType.STORAGE);
long savedId = sut.create(boxSize);
clearSession();
BoxSize saved = (BoxSize) getSessionFactory().getCurrentSession().get(BoxSize.class, savedId);
assertEquals(rows, saved.getRows().intValue());
assertEquals(cols, saved.getColumns().intValue());
}
use of uk.ac.bbsrc.tgac.miso.core.data.BoxSize in project miso-lims by miso-lims.
the class BoxRestControllerTest method makeEmptyBox.
private Box makeEmptyBox() {
Box box = new BoxImpl();
box.setId(1L);
box.setAlias("box");
BoxSize size = new BoxSize();
size.setRows(8);
size.setColumns(12);
box.setSize(size);
BoxUse use = new BoxUse();
use.setAlias("use");
box.setUse(use);
box.setLocationBarcode("freezer");
User user = new UserImpl();
user.setId(1L);
box.setLastModifier(user);
return box;
}
Aggregations