Search in sources :

Example 16 with BoxPosition

use of uk.ac.bbsrc.tgac.miso.core.data.BoxPosition in project miso-lims by miso-lims.

the class HibernateBoxDaoIT method testAddItem.

@Test
public void testAddItem() throws IOException {
    Box box = dao.get(1L);
    String insertPos = "A02";
    assertEquals(2, box.getBoxPositions().size());
    assertFalse(box.getBoxPositions().containsKey(insertPos));
    BoxPosition bp = new BoxPosition(box, insertPos, EntityType.LIBRARY, 1L);
    box.getBoxPositions().put(insertPos, bp);
    dao.save(box);
    sessionFactory.getCurrentSession().flush();
    sessionFactory.getCurrentSession().clear();
    Box saved = dao.get(1L);
    assertEquals(3, saved.getBoxPositions().size());
    assertTrue(box.getBoxPositions().containsKey(insertPos));
}
Also used : Box(uk.ac.bbsrc.tgac.miso.core.data.Box) BoxPosition(uk.ac.bbsrc.tgac.miso.core.data.BoxPosition) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

Box (uk.ac.bbsrc.tgac.miso.core.data.Box)16 BoxPosition (uk.ac.bbsrc.tgac.miso.core.data.BoxPosition)16 BoxableId (uk.ac.bbsrc.tgac.miso.core.data.BoxableId)9 Test (org.junit.Test)6 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)5 BoxableView (uk.ac.bbsrc.tgac.miso.core.data.impl.view.box.BoxableView)5 Boxable (uk.ac.bbsrc.tgac.miso.core.data.Boxable)3 Sets (com.google.common.collect.Sets)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)2 ValidationError (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)2 Functions (com.google.common.base.Functions)1