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));
}
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));
}
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;
}
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());
}
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);
}
Aggregations