Search in sources :

Example 6 with Sample

use of org.icgc.dcc.song.server.model.entity.Sample in project SONG by overture-stack.

the class SampleServiceTest method testCreateAndDeleteSample.

@Test
public void testCreateAndDeleteSample() {
    val specimenId = "SP2";
    val metadata = JsonUtils.fromSingleQuoted("{'ageCategory': 3, 'species': 'human'}");
    val s = Sample.create("", "101-IP-A", specimenId, "Amplified DNA");
    s.setInfo(metadata);
    val status = sampleService.create(DEFAULT_STUDY_ID, s);
    val id = s.getSampleId();
    assertThat(sampleService.isSampleExist(id)).isTrue();
    assertThat(id).startsWith("SA");
    assertThat(status).isEqualTo(id);
    Sample check = sampleService.read(id);
    assertThat(check).isEqualToComparingFieldByField(s);
    sampleService.delete(newArrayList(id));
    assertThat(sampleService.isSampleExist(id)).isFalse();
}
Also used : lombok.val(lombok.val) Sample(org.icgc.dcc.song.server.model.entity.Sample) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with Sample

use of org.icgc.dcc.song.server.model.entity.Sample in project SONG by overture-stack.

the class SampleServiceTest method testUpdateSpecimenDNE.

@Test
public void testUpdateSpecimenDNE() {
    val randomSampleId = randomGenerator.generateRandomUUIDAsString();
    val sample = new Sample();
    sample.setSampleSubmitterId(randomGenerator.generateRandomUUIDAsString());
    sample.setSampleId(randomSampleId);
    sample.setSampleType(randomGenerator.randomElement(newArrayList(SAMPLE_TYPE)));
    sample.setSpecimenId(DEFAULT_SPECIMEN_ID);
    assertSongError(() -> sampleService.update(sample), SAMPLE_DOES_NOT_EXIST);
}
Also used : lombok.val(lombok.val) Sample(org.icgc.dcc.song.server.model.entity.Sample) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

lombok.val (lombok.val)7 Sample (org.icgc.dcc.song.server.model.entity.Sample)7 Test (org.junit.Test)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 Specimen (org.icgc.dcc.song.server.model.entity.Specimen)2 Maps (com.google.common.collect.Maps)1 Collection (java.util.Collection)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Slf4j (lombok.extern.slf4j.Slf4j)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 RandomGenerator (org.icgc.dcc.song.core.utils.RandomGenerator)1 RandomGenerator.createRandomGenerator (org.icgc.dcc.song.core.utils.RandomGenerator.createRandomGenerator)1 SequencingReadAnalysis (org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis)1 Donor (org.icgc.dcc.song.server.model.entity.Donor)1 CompositeEntity (org.icgc.dcc.song.server.model.entity.composites.CompositeEntity)1 DonorWithSpecimens (org.icgc.dcc.song.server.model.entity.composites.DonorWithSpecimens)1 SpecimenWithSamples (org.icgc.dcc.song.server.model.entity.composites.SpecimenWithSamples)1 AnalysisGenerator.createAnalysisGenerator (org.icgc.dcc.song.server.utils.AnalysisGenerator.createAnalysisGenerator)1 StudyGenerator (org.icgc.dcc.song.server.utils.StudyGenerator)1 StudyGenerator.createStudyGenerator (org.icgc.dcc.song.server.utils.StudyGenerator.createStudyGenerator)1