Search in sources :

Example 26 with Library

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

the class HibernateLibraryDaoIT method testGetNextCousin.

@Test
public void testGetNextCousin() throws Exception {
    Library library = (Library) currentSession().get(LibraryImpl.class, 2L);
    long nextId = 3L;
    EntityReference next = dao.getAdjacentLibrary(library, false);
    assertNotNull(next);
    assertEquals(nextId, next.getId());
    Library nextLibrary = (Library) currentSession().get(LibraryImpl.class, nextId);
    assertNotEquals(library.getSample().getId(), nextLibrary.getSample().getId());
}
Also used : LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) EntityReference(uk.ac.bbsrc.tgac.miso.core.data.impl.view.EntityReference) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 27 with Library

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

the class HibernateLibraryDaoIT method testListByProjectId.

@Test
public void testListByProjectId() throws Exception {
    List<Library> libraries = dao.listByProjectId(1);
    List<Long> libraryIds = Arrays.asList(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l, 9l, 10l, 11l, 12l, 13l, 14l, 15l);
    assertEquals(15, libraries.size());
    for (Library library : libraries) {
        assertTrue("bad library found", libraryIds.contains(library.getId()));
    }
}
Also used : Library(uk.ac.bbsrc.tgac.miso.core.data.Library) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 28 with Library

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

the class HibernateLibraryDaoIT method testGetPreviousSibling.

@Test
public void testGetPreviousSibling() throws Exception {
    Library library = (Library) currentSession().get(LibraryImpl.class, 2L);
    long previousId = 1L;
    EntityReference previous = dao.getAdjacentLibrary(library, true);
    assertNotNull(previous);
    assertEquals(previousId, previous.getId());
    Library previousLibrary = (Library) currentSession().get(LibraryImpl.class, previousId);
    assertEquals(library.getSample().getId(), previousLibrary.getSample().getId());
}
Also used : LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) EntityReference(uk.ac.bbsrc.tgac.miso.core.data.impl.view.EntityReference) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 29 with Library

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

the class HibernateLibraryDaoIT method testGetPreviousCousin.

@Test
public void testGetPreviousCousin() throws Exception {
    Library library = (Library) currentSession().get(LibraryImpl.class, 3L);
    long previousId = 2L;
    EntityReference previous = dao.getAdjacentLibrary(library, true);
    assertNotNull(previous);
    assertEquals(previousId, previous.getId());
    Library previousLibrary = (Library) currentSession().get(LibraryImpl.class, previousId);
    assertNotEquals(library.getSample().getId(), previousLibrary.getSample().getId());
}
Also used : LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) EntityReference(uk.ac.bbsrc.tgac.miso.core.data.impl.view.EntityReference) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 30 with Library

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

the class HibernateLibraryDaoIT method testGet.

@Test
public void testGet() throws Exception {
    Library library = dao.get(3);
    assertNotNull(library);
    assertEquals("library name is incorrect", "LIB3", library.getName());
    assertEquals("library description is incorrect", "Inherited from TEST_0002", library.getDescription());
}
Also used : Library(uk.ac.bbsrc.tgac.miso.core.data.Library) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

Library (uk.ac.bbsrc.tgac.miso.core.data.Library)56 Test (org.junit.Test)23 LibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl)20 DetailedLibrary (uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary)14 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)13 TransferLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary)13 LibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot)11 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)10 Pool (uk.ac.bbsrc.tgac.miso.core.data.Pool)8 ArrayList (java.util.ArrayList)7 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)7 IOException (java.io.IOException)6 PostMapping (org.springframework.web.bind.annotation.PostMapping)6 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)6 Collection (java.util.Collection)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 WorksetLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary)5 Date (java.util.Date)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)4