Search in sources :

Example 16 with SampleImpl

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

the class DefaultSampleServiceTest method nullSampleNameTest.

@Test
public void nullSampleNameTest() throws Exception {
    Sample sample = new SampleImpl();
    sample.setName(null);
    assertFalse("Non-temporary 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 17 with SampleImpl

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

the class DefaultSampleServiceTest method temporarySampleNameTest.

@Test
public void temporarySampleNameTest() throws Exception {
    Sample sample = new SampleImpl();
    sample.setName(LimsUtils.generateTemporaryName());
    assertTrue("Temporary sample names must return true.", 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 SampleImpl

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

the class DefaultSampleServiceTest method testNonUniqueExternalNamePerProjectFailTest.

@Test
public void testNonUniqueExternalNamePerProjectFailTest() throws IOException {
    Project project = new ProjectImpl();
    project.setId(1L);
    project.setReferenceGenome(humanReferenceGenome());
    IdentityView id1 = new IdentityView();
    id1.setId(1L);
    id1.setExternalName("String1,String2");
    id1.setProjectId(project.getId());
    Sample newSample = new SampleImpl();
    newSample.setProject(project);
    Mockito.when(sut.getIdentitiesByExternalNameOrAliasAndProject(Matchers.anyString(), Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(Collections.singletonList(id1));
    exception.expect(ValidationException.class);
    sut.confirmExternalNameUniqueForProjectIfRequired("String1,String3", newSample);
}
Also used : Project(uk.ac.bbsrc.tgac.miso.core.data.Project) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) IdentityView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.IdentityView) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) Test(org.junit.Test)

Example 19 with SampleImpl

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

the class DefaultSampleServiceTest method testNonUniqueExternalNamePerProjectPassTest.

@Test
public void testNonUniqueExternalNamePerProjectPassTest() throws IOException {
    Project project = new ProjectImpl();
    project.setId(1L);
    project.setReferenceGenome(humanReferenceGenome());
    IdentityView id1 = new IdentityView();
    id1.setExternalName("String1,String2");
    id1.setProjectId(project.getId());
    sut.setUniqueExternalNameWithinProjectRequired(false);
    Mockito.when(sut.getIdentitiesByExternalNameOrAliasAndProject(Matchers.anyString(), Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(Collections.singletonList(id1));
    Sample newSample = new SampleImpl();
    newSample.setProject(project);
    sut.confirmExternalNameUniqueForProjectIfRequired("String1", newSample);
}
Also used : Project(uk.ac.bbsrc.tgac.miso.core.data.Project) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) IdentityView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.IdentityView) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) Test(org.junit.Test)

Example 20 with SampleImpl

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

the class DefaultSampleServiceTest method testCanEditExternalNameTest.

@Test
public void testCanEditExternalNameTest() throws IOException {
    Project project = new ProjectImpl();
    project.setId(1L);
    project.setReferenceGenome(humanReferenceGenome());
    IdentityView id1 = new IdentityView();
    id1.setId(1L);
    id1.setExternalName("String1,String2");
    id1.setProjectId(project.getId());
    Mockito.when(sut.getIdentitiesByExternalNameOrAliasAndProject(Matchers.anyString(), Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(Collections.singletonList(id1));
    Sample newSample = new SampleImpl();
    newSample.setProject(project);
    exception.expect(ValidationException.class);
    sut.confirmExternalNameUniqueForProjectIfRequired("String1", newSample);
}
Also used : Project(uk.ac.bbsrc.tgac.miso.core.data.Project) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) IdentityView(uk.ac.bbsrc.tgac.miso.core.data.impl.view.IdentityView) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) Test(org.junit.Test)

Aggregations

SampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)26 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)22 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)21 Test (org.junit.Test)16 DetailedSampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)6 LibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl)5 ProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl)5 TransferSample (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample)5 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)4 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)4 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)4 User (com.eaglegenomics.simlims.core.User)4 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)4 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)4 DetailedLibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl)4 IdentityView (uk.ac.bbsrc.tgac.miso.core.data.impl.view.IdentityView)4 WorksetSample (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample)4 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)4 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)4 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)4