use of uk.ac.bbsrc.tgac.miso.core.data.Instrument in project miso-lims by miso-lims.
the class EditServiceRecordController method newServiceRecord.
@GetMapping(value = "/new/{instrumentId}")
public ModelAndView newServiceRecord(@PathVariable(value = "instrumentId") Long instrumentId, ModelMap model) throws IOException {
Instrument instrument = instrumentService.get(instrumentId);
if (instrument == null) {
throw new NotFoundException("No instrument found for ID " + instrumentId.toString());
}
ServiceRecord record = new ServiceRecord();
record.setInstrument(instrument);
return showPage(record, model);
}
use of uk.ac.bbsrc.tgac.miso.core.data.Instrument in project miso-lims by miso-lims.
the class InstrumentPageIT method testChangeValues.
@Test
public void testChangeValues() throws Exception {
// goal: test editing all editable fields on an instrument
InstrumentPage page = InstrumentPage.get(getDriver(), getBaseUrl(), 100L);
// check initial values
Map<Field, String> fields = Maps.newLinkedHashMap();
fields.put(Field.ID, "100");
fields.put(Field.COMMISSIONED, "2017-01-01");
fields.put(Field.INSTRUMENT_MODEL, "Illumina - Illumina HiSeq 2500");
fields.put(Field.SERIAL_NUMBER, "100");
fields.put(Field.NAME, "HiSeq_100");
fields.put(Field.STATUS, "Production");
fields.put(Field.DEFAULT_PURPOSE, "Production");
assertFieldValues("loaded", fields, page);
// make changes
Map<Field, String> changes = Maps.newLinkedHashMap();
changes.put(Field.NAME, "HiSeq_changed_100");
changes.put(Field.SERIAL_NUMBER, "100100");
changes.put(Field.COMMISSIONED, "2017-01-31");
changes.put(Field.STATUS, "Retired");
changes.put(Field.DECOMMISSIONED, "2017-10-31");
page.setFields(changes);
// need to make sure this is done after the status change is made
// copy unchanged
fields.forEach((key, val) -> {
if (!changes.containsKey(key))
changes.put(key, val);
});
assertFieldValues("changes pre-save", changes, page);
InstrumentPage page2 = page.save();
assertNotNull(page2);
assertFieldValues("changes post-save", changes, page2);
Instrument sr = (Instrument) getSession().get(InstrumentImpl.class, 100L);
assertInstrumentAttributes(changes, sr);
}
use of uk.ac.bbsrc.tgac.miso.core.data.Instrument in project miso-lims by miso-lims.
the class HibernateArrayRunDaoIT method testSaveNew.
@Test
public void testSaveNew() throws Exception {
ArrayRun run = new ArrayRun();
run.setAlias("TestArrayRun");
Instrument inst = (Instrument) sessionFactory.getCurrentSession().get(InstrumentImpl.class, 3L);
run.setInstrument(inst);
run.setHealth(HealthType.Running);
Date now = new Date();
run.setStartDate(now);
User user = (User) sessionFactory.getCurrentSession().get(UserImpl.class, 1L);
run.setCreator(user);
run.setCreationTime(now);
run.setLastModifier(user);
run.setLastModified(now);
long savedId = sut.save(run);
ArrayRun saved = sut.get(savedId);
assertNotNull(saved);
assertEquals(run.getAlias(), saved.getAlias());
assertEquals(run.getInstrument().getId(), saved.getInstrument().getId());
assertEquals(run.getHealth(), saved.getHealth());
assertEquals(LimsUtils.formatDate(run.getStartDate()), LimsUtils.formatDate(saved.getStartDate()));
}
use of uk.ac.bbsrc.tgac.miso.core.data.Instrument in project miso-lims by miso-lims.
the class HibernateInstrumentDaoIT method testGet.
@Test
public void testGet() throws Exception {
Instrument instrument = dao.get(1);
assertNotNull(instrument);
assertEquals("instrument name does not match", "SN7001179", instrument.getName());
assertNull("instrument date commissioned is not null", instrument.getDateCommissioned());
assertNull("instrument date decommissioned is not null", instrument.getDateDecommissioned());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Instrument in project miso-lims by miso-lims.
the class HibernateInstrumentDaoIT method testGetUsageByRuns.
@Test
public void testGetUsageByRuns() throws Exception {
Instrument instrument = (Instrument) currentSession().get(InstrumentImpl.class, 1L);
assertEquals(3L, dao.getUsageByRuns(instrument));
}
Aggregations