Search in sources :

Example 26 with Instrument

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

the class HibernateInstrumentDaoIT method testGetUsageByQcsNone.

@Test
public void testGetUsageByQcsNone() throws Exception {
    Instrument instrument = (Instrument) currentSession().get(InstrumentImpl.class, 1L);
    assertEquals(0L, dao.getUsageByQcs(instrument));
}
Also used : InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 27 with Instrument

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

the class HibernateServiceRecordDaoIT method testSaveEdit.

@Test
public void testSaveEdit() throws IOException {
    ServiceRecord rec = dao.get(1L);
    String newTitle = "ChangedTitle";
    rec.setTitle(newTitle);
    Instrument sr = Mockito.mock(Instrument.class);
    Mockito.when(sr.getId()).thenReturn(1L);
    rec.setInstrument(sr);
    assertEquals(1L, dao.save(rec));
    ServiceRecord saved = dao.get(1L);
    assertEquals(newTitle, saved.getTitle());
}
Also used : Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 28 with Instrument

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

the class HibernateInstrumentDao method getByName.

@Override
public Instrument getByName(String name) throws IOException {
    Criteria criteria = currentSession().createCriteria(InstrumentImpl.class);
    criteria.add(Restrictions.eq("name", name));
    return (Instrument) criteria.uniqueResult();
}
Also used : Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Criteria(org.hibernate.Criteria)

Aggregations

Instrument (uk.ac.bbsrc.tgac.miso.core.data.Instrument)28 Test (org.junit.Test)14 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)12 InstrumentImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl)11 Run (uk.ac.bbsrc.tgac.miso.core.data.Run)5 User (com.eaglegenomics.simlims.core.User)4 GetMapping (org.springframework.web.bind.annotation.GetMapping)4 ServiceRecord (uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord)4 NotFoundException (org.springframework.security.acls.model.NotFoundException)3 InstrumentModel (uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Date (java.util.Date)2 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2