Search in sources :

Example 16 with Sample

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

the class DefaultSampleServiceTest method testValidateRelationshipForSimpleSample.

@Test
public void testValidateRelationshipForSimpleSample() throws Exception {
    // Simple sample has no DetailedSample attributes.
    Sample child = new SampleImpl();
    // Simple sample has no parent.
    Sample parent = null;
    assertTrue("Simple sample with a null parent and null DetailedSample is a valid relationship", sut.isValidRelationship(parent, child));
}
Also used : DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) Test(org.junit.Test)

Example 17 with Sample

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

the class DefaultSampleServiceTest method notTemporarySampleNameTest.

@Test
public void notTemporarySampleNameTest() throws Exception {
    Sample sample = new SampleImpl();
    sample.setName("RealSampleName");
    assertFalse("Real sample names must return false.", hasTemporaryName(sample));
}
Also used : DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) Test(org.junit.Test)

Example 18 with Sample

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

the class DefaultSampleServiceTest method makePlainSample.

private Sample makePlainSample() {
    Sample sample = new SampleImpl();
    sample.setId(77L);
    sample.setAlias("alias");
    sample.setName("name");
    return sample;
}
Also used : DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)

Example 19 with Sample

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

the class DefaultSampleServiceTest method testPlainSampleAliasGeneration.

@Test
public void testPlainSampleAliasGeneration() throws Exception {
    Sample sample = new SampleImpl();
    mockShellProjectWithRealLookup(sample);
    String expectedAlias = "generated_alias";
    Mockito.when(namingScheme.hasSampleAliasGenerator()).thenReturn(true);
    Mockito.when(namingScheme.generateSampleAlias((Sample) Mockito.any())).thenReturn(expectedAlias);
    Mockito.when(sampleStore.getSample(Mockito.anyLong())).thenReturn(sample);
    sut.create(sample);
    ArgumentCaptor<Sample> updatedCapture = ArgumentCaptor.forClass(Sample.class);
    Mockito.verify(sampleStore).update(updatedCapture.capture());
    Sample updated = updatedCapture.getValue();
    assertEquals("alias should be generated", expectedAlias, updated.getAlias());
}
Also used : DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) Test(org.junit.Test)

Example 20 with Sample

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

the class DefaultTransferService method addTransferSample.

@Override
public void addTransferSample(TransferSample transferSample) throws IOException {
    Transfer managedTransfer = get(transferSample.getTransfer().getId());
    Sample managedSample = sampleService.get(transferSample.getItem().getId());
    transferSample.setTransfer(managedTransfer);
    transferSample.setItem(managedSample);
    validateAddition(managedTransfer, transferSample);
    transferStore.update(managedTransfer);
    sampleService.update(managedSample);
}
Also used : Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer)

Aggregations

Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)97 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)60 Test (org.junit.Test)55 SampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)37 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)24 TransferSample (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample)19 SampleIdentity (uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity)11 User (com.eaglegenomics.simlims.core.User)9 ArrayList (java.util.ArrayList)9 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)9 SampleTissue (uk.ac.bbsrc.tgac.miso.core.data.SampleTissue)8 IOException (java.io.IOException)7 PostMapping (org.springframework.web.bind.annotation.PostMapping)7 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)7 SampleStock (uk.ac.bbsrc.tgac.miso.core.data.SampleStock)7 Requisition (uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition)7 WorksetSample (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample)7 Date (java.util.Date)6 Criteria (org.hibernate.Criteria)6 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)6