Search in sources :

Example 1 with ArabidopsisSeed

use of org.jbei.ice.storage.model.ArabidopsisSeed in project ice by JBEI.

the class EntryCreatorTest method testCreatePart.

@Test
public void testCreatePart() throws Exception {
    Account account = AccountCreator.createTestAccount("testCreatePart", false);
    Assert.assertNotNull(account);
    String userId = account.getEmail();
    // create strain
    PartData strain = new PartData(EntryType.STRAIN);
    StrainData strainData = new StrainData();
    strainData.setGenotypePhenotype("genPhen");
    strainData.setHost("host");
    strain.setStrainData(strainData);
    strain.setOwner("Tester");
    strain.setOwnerEmail("tester");
    strain.setCreator(strain.getOwner());
    strain.setCreatorEmail(strain.getOwnerEmail());
    strain.setBioSafetyLevel(1);
    long id = creator.createPart(userId, strain).getId();
    Strain entry = (Strain) DAOFactory.getEntryDAO().get(id);
    Assert.assertNotNull(entry);
    Assert.assertEquals(entry.getOwnerEmail(), strain.getOwnerEmail());
    Assert.assertEquals(strainData.getGenotypePhenotype(), entry.getGenotypePhenotype());
    Assert.assertEquals(strainData.getHost(), entry.getHost());
    // create arabidopsis seed
    PartData seed = new PartData(EntryType.ARABIDOPSIS);
    ArabidopsisSeedData seedData = new ArabidopsisSeedData();
    seedData.setGeneration(Generation.F3);
    seedData.setPlantType(PlantType.OTHER);
    seedData.setHarvestDate("01/02/2014");
    seed.setBioSafetyLevel(2);
    seed.setArabidopsisSeedData(seedData);
    long seedId = creator.createPart(userId, seed).getId();
    ArabidopsisSeed entrySeed = (ArabidopsisSeed) DAOFactory.getEntryDAO().get(seedId);
    Assert.assertNotNull(entrySeed);
    Assert.assertEquals(seedData.getGeneration(), entrySeed.getGeneration());
    Assert.assertEquals(seedData.getPlantType(), entrySeed.getPlantType());
}
Also used : Account(org.jbei.ice.storage.model.Account) ArabidopsisSeed(org.jbei.ice.storage.model.ArabidopsisSeed) Strain(org.jbei.ice.storage.model.Strain) Test(org.junit.Test)

Aggregations

Account (org.jbei.ice.storage.model.Account)1 ArabidopsisSeed (org.jbei.ice.storage.model.ArabidopsisSeed)1 Strain (org.jbei.ice.storage.model.Strain)1 Test (org.junit.Test)1