use of uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord in project miso-lims by miso-lims.
the class ServiceRecordPageIT method testCreate.
@Test
public void testCreate() throws Exception {
// goal: add one service record
Instrument seq = (Instrument) getSession().get(InstrumentImpl.class, 200L);
assertNotNull(seq);
assertEquals(0, seq.getServiceRecords().size());
InstrumentPage seqPage = InstrumentPage.get(getDriver(), getBaseUrl(), 200L);
ServiceRecordPage page = seqPage.addServiceRecord();
assertNotNull(page);
assertEquals(seq.getName(), page.getField(Field.INSTRUMENT));
Map<Field, String> fields = Maps.newLinkedHashMap();
fields.put(Field.TITLE, "Test Service Record");
fields.put(Field.DETAILS, "Many details, all of them important");
fields.put(Field.SERVICED_BY, "Technician");
fields.put(Field.REFERENCE_NUMBER, "123456");
fields.put(Field.SERVICE_DATE, "2017-09-01");
fields.put(Field.START_TIME, "2017-08-31 16:00:00");
fields.put(Field.OUT_OF_SERVICE, "true");
fields.put(Field.END_TIME, "2017-09-01 09:00:00");
page.setFields(fields);
assertFieldValues("pre-save", fields, page);
ServiceRecordPage page2 = page.save();
assertNotNull(page2);
assertFieldValues("post-save", fields, page2);
String newId = page2.getField(Field.ID);
ServiceRecord sr = (ServiceRecord) getSession().get(ServiceRecord.class, Long.valueOf(newId));
assertServiceRecordAttributes(fields, sr);
}
use of uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord in project miso-lims by miso-lims.
the class ServiceRecordPageIT method testAddValues.
@Test
public void testAddValues() throws Exception {
ServiceRecordPage page1 = ServiceRecordPage.get(getDriver(), getBaseUrl(), null, 151L);
// initial values;
Map<ServiceRecordPage.Field, String> fields = Maps.newLinkedHashMap();
fields.put(Field.ID, "151");
fields.put(Field.INSTRUMENT, "NewHiSeq_101");
fields.put(Field.TITLE, "Test 151");
fields.put(Field.DETAILS, null);
fields.put(Field.SERVICED_BY, null);
fields.put(Field.REFERENCE_NUMBER, null);
fields.put(Field.SERVICE_DATE, "2017-09-12");
fields.put(Field.START_TIME, null);
fields.put(Field.OUT_OF_SERVICE, "false");
fields.put(Field.END_TIME, null);
assertFieldValues("initial values", fields, page1);
Map<ServiceRecordPage.Field, String> changes = Maps.newLinkedHashMap();
changes.put(Field.DETAILS, "details");
changes.put(Field.REFERENCE_NUMBER, "REFERENCE");
changes.put(Field.SERVICED_BY, "person");
changes.put(Field.START_TIME, "2017-09-10 09:10:00");
changes.put(Field.OUT_OF_SERVICE, "true");
changes.put(Field.END_TIME, "2017-09-12 12:00:00");
page1.setFields(changes);
fields.putAll(changes);
assertFieldValues("changes pre-save", fields, page1);
ServiceRecordPage page2 = page1.save();
assertFieldValues("post-save", fields, page2);
ServiceRecord savedRecord = (ServiceRecord) getSession().get(ServiceRecord.class, 151L);
assertServiceRecordAttributes(fields, savedRecord);
}
use of uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord in project miso-lims by miso-lims.
the class HibernateServiceRecordDao method listByInstrumentId.
@Override
public List<ServiceRecord> listByInstrumentId(long instrumentId) {
Criteria criteria = currentSession().createCriteria(ServiceRecord.class);
criteria.add(Restrictions.eq("instrument.id", instrumentId));
@SuppressWarnings("unchecked") List<ServiceRecord> records = criteria.list();
return records;
}
use of uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord in project miso-lims by miso-lims.
the class HibernateServiceRecordDaoIT method testSaveDecommissioned.
@Test
public void testSaveDecommissioned() throws IOException {
ServiceRecord newRec = makeServiceRecord("New Record 2");
newRec.getInstrument().setDateDecommissioned(new Date());
exception.expect(IOException.class);
dao.save(newRec);
}
use of uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord in project miso-lims by miso-lims.
the class HibernateServiceRecordDaoIT method testGetNone.
@Test
public void testGetNone() throws IOException {
ServiceRecord rec = dao.get(100L);
assertNull(rec);
}
Aggregations