Search in sources :

Example 21 with Plasmid

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

the class SequenceDAOTest method testGetSequence.

@Test
public void testGetSequence() throws Exception {
    Account account = AccountCreator.createTestAccount("SequenceDAOTest.testGetSequence", false);
    Plasmid plasmid = TestEntryCreator.createTestPlasmid(account);
    Assert.assertNotNull(plasmid);
    // parse sequence and associate with plasmid
    FeaturedDNASequence dnaSequence = GeneralParser.parse(sequenceString);
    Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
    Assert.assertNotNull(sequence);
    sequence.setEntry(plasmid);
    sequence = sequenceDAO.create(sequence);
    Assert.assertNotNull(sequence);
    Assert.assertNotNull(sequenceDAO.getSequence(0));
}
Also used : Plasmid(org.jbei.ice.storage.model.Plasmid) Account(org.jbei.ice.storage.model.Account) Sequence(org.jbei.ice.storage.model.Sequence) FeaturedDNASequence(org.jbei.ice.lib.dto.FeaturedDNASequence) FeaturedDNASequence(org.jbei.ice.lib.dto.FeaturedDNASequence) Test(org.junit.Test) HibernateRepositoryTest(org.jbei.ice.storage.hibernate.HibernateRepositoryTest)

Example 22 with Plasmid

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

the class TransferredPartsTest method createPlasmidObject.

private Plasmid createPlasmidObject(Account owner) {
    Plasmid plasmid = new Plasmid();
    plasmid.setBackbone("plasmid backone");
    plasmid.setOriginOfReplication("None");
    plasmid.setBioSafetyLevel(1);
    plasmid.setShortDescription("plasmid description");
    plasmid.setName("pLasmid");
    plasmid.setOwner(owner.getFullName());
    plasmid.setOwnerEmail(owner.getEmail());
    plasmid.setCreator(plasmid.getOwner());
    plasmid.setCreatorEmail(plasmid.getOwnerEmail());
    plasmid.setCreationTime(new Date());
    return plasmid;
}
Also used : Plasmid(org.jbei.ice.storage.model.Plasmid) Date(java.util.Date)

Example 23 with Plasmid

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

the class AuditDAOTest method testDeleteAll.

@Test
public void testDeleteAll() throws Exception {
    Account account = AccountCreator.createTestAccount("AuditDAOTest.testDeleteAll", false);
    Assert.assertNotNull(account);
    Plasmid plasmid = TestEntryCreator.createTestPlasmid(account);
    Random random = new Random();
    final long amount = random.nextInt(20);
    for (int i = 0; i < amount; i += 1) {
        Audit audit = new Audit();
        audit.setUserId(account.getEmail());
        audit.setEntry(plasmid);
        audit.setTime(new Date());
        audit.setAction("-r");
        Assert.assertNotNull(dao.create(audit));
    }
    Assert.assertEquals(amount, dao.getAuditsForEntryCount(plasmid));
    // create for second plasmid
    Strain strain = TestEntryCreator.createTestStrain(account);
    int amount2 = random.nextInt(20);
    for (int i = 0; i < amount2; i += 1) {
        Audit audit = new Audit();
        audit.setUserId(account.getEmail());
        audit.setEntry(strain);
        audit.setTime(new Date());
        audit.setAction("-r");
        Assert.assertNotNull(dao.create(audit));
    }
    Assert.assertEquals(amount2, dao.getAuditsForEntryCount(strain));
    // delete all for first
    Assert.assertEquals(amount, dao.deleteAll(plasmid));
    // verify that second remains while first is empty
    Assert.assertEquals(amount2, dao.getAuditsForEntryCount(strain));
    Assert.assertEquals(0, dao.getAuditsForEntryCount(plasmid));
    // delete for second
    Assert.assertEquals(amount2, dao.deleteAll(strain));
    // verify
    Assert.assertEquals(0, dao.getAuditsForEntryCount(strain));
    Assert.assertEquals(0, dao.getAuditsForEntryCount(plasmid));
}
Also used : Plasmid(org.jbei.ice.storage.model.Plasmid) Account(org.jbei.ice.storage.model.Account) Audit(org.jbei.ice.storage.model.Audit) Random(java.util.Random) Date(java.util.Date) Strain(org.jbei.ice.storage.model.Strain) HibernateRepositoryTest(org.jbei.ice.storage.hibernate.HibernateRepositoryTest) Test(org.junit.Test)

Example 24 with Plasmid

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

the class TestEntryCreator method createTestPlasmid.

public static Plasmid createTestPlasmid(Account account) {
    PartData plasmid = new PartData(EntryType.PLASMID);
    PlasmidData plasmidData = new PlasmidData();
    plasmidData.setBackbone("plasmid backone");
    plasmidData.setOriginOfReplication("None");
    plasmid.setPlasmidData(plasmidData);
    plasmid.setBioSafetyLevel(1);
    plasmid.setShortDescription("plasmid description");
    plasmid.setName("pLasmid");
    plasmid = new Entries(account.getEmail()).create(plasmid);
    return (Plasmid) DAOFactory.getEntryDAO().get(plasmid.getId());
}
Also used : Plasmid(org.jbei.ice.storage.model.Plasmid) PartData(org.jbei.ice.lib.dto.entry.PartData) PlasmidData(org.jbei.ice.lib.dto.entry.PlasmidData) Entries(org.jbei.ice.lib.entry.Entries)

Aggregations

Plasmid (org.jbei.ice.storage.model.Plasmid)24 Account (org.jbei.ice.storage.model.Account)22 Test (org.junit.Test)22 HibernateRepositoryTest (org.jbei.ice.storage.hibernate.HibernateRepositoryTest)11 FeaturedDNASequence (org.jbei.ice.lib.dto.FeaturedDNASequence)8 Sequence (org.jbei.ice.storage.model.Sequence)7 Strain (org.jbei.ice.storage.model.Strain)7 PartData (org.jbei.ice.lib.dto.entry.PartData)5 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 Random (java.util.Random)3 History (org.jbei.ice.lib.dto.History)3 Audit (org.jbei.ice.storage.model.Audit)3 PermissionsController (org.jbei.ice.lib.access.PermissionsController)1 Curation (org.jbei.ice.lib.dto.Curation)1 DNAFeature (org.jbei.ice.lib.dto.DNAFeature)1 AccessPermission (org.jbei.ice.lib.dto.access.AccessPermission)1 PlasmidData (org.jbei.ice.lib.dto.entry.PlasmidData)1 FolderDetails (org.jbei.ice.lib.dto.folder.FolderDetails)1 Entries (org.jbei.ice.lib.entry.Entries)1