Search in sources :

Example 1 with ServiceRecord

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);
}
Also used : InstrumentPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage) Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage.Field) InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) ServiceRecordPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage) ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord) Test(org.junit.Test)

Example 2 with ServiceRecord

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);
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage.Field) ServiceRecordPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage) ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord) Test(org.junit.Test)

Example 3 with ServiceRecord

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;
}
Also used : Criteria(org.hibernate.Criteria) ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord)

Example 4 with ServiceRecord

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);
}
Also used : Date(java.util.Date) ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 5 with ServiceRecord

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);
}
Also used : ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Aggregations

ServiceRecord (uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord)17 Test (org.junit.Test)9 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)5 Instrument (uk.ac.bbsrc.tgac.miso.core.data.Instrument)4 ServiceRecordPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage)4 Field (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage.Field)4 Date (java.util.Date)2 Criteria (org.hibernate.Criteria)2 NotFoundException (org.springframework.security.acls.model.NotFoundException)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 InstrumentImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl)2 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)1 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)1 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)1 ArrayList (java.util.ArrayList)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1 InstrumentPosition (uk.ac.bbsrc.tgac.miso.core.data.InstrumentPosition)1 Dtos (uk.ac.bbsrc.tgac.miso.dto.Dtos)1