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