use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testHasSequence.
@Test
public void testHasSequence() throws Exception {
Account account1 = AccountCreator.createTestAccount("SequenceDAOTest.testHasSequence1", false);
Account account2 = AccountCreator.createTestAccount("SequenceDAOTest.testHasSequence2", false);
Account account3 = AccountCreator.createTestAccount("SequenceDAOTest.testHasSequence3", false);
Plasmid plasmid1 = TestEntryCreator.createTestPlasmid(account1);
Plasmid plasmid2 = TestEntryCreator.createTestPlasmid(account2);
Plasmid plasmid3 = TestEntryCreator.createTestPlasmid(account3);
// create sequence for plasmid1
FeaturedDNASequence dnaSequence = GeneralParser.parse(sequenceString);
Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(plasmid1);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// create sequence for plasmid3
dnaSequence = GeneralParser.parse(sequenceString + "atc");
sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(plasmid3);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// test
Assert.assertTrue(sequenceDAO.hasSequence(plasmid1.getId()));
Assert.assertFalse(sequenceDAO.hasSequence(plasmid2.getId()));
Assert.assertTrue(sequenceDAO.hasSequence(plasmid3.getId()));
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testHasOriginalSequence.
@Test
public void testHasOriginalSequence() throws Exception {
Account account = AccountCreator.createTestAccount("SequenceDAOTest.testHasOriginalSequence", 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.setSequenceUser(sequenceString);
sequence.setEntry(plasmid);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// test
Assert.assertTrue(sequenceDAO.hasOriginalSequence(plasmid.getId()));
// test with another sequence
Plasmid plasmid2 = TestEntryCreator.createTestPlasmid(account);
dnaSequence = GeneralParser.parse(sequenceString + "atc");
sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(plasmid2);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
Assert.assertFalse(sequenceDAO.hasOriginalSequence(plasmid2.getId()));
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testGetSequenceFilename.
@Test
public void testGetSequenceFilename() throws Exception {
Account account = AccountCreator.createTestAccount("SequenceDAOTest.testGetSequenceFilename", 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.setFileName("testFile.gb");
sequence.setEntry(plasmid);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
String filename = sequenceDAO.getSequenceFilename(plasmid);
Assert.assertEquals("testFile.gb", filename);
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testRetrieve.
@Test
public void testRetrieve() throws Exception {
Account account = AccountCreator.createTestAccount("SequenceDAOTest.testRetrieve", false);
Strain strain = TestEntryCreator.createTestStrain(account);
Assert.assertNotNull(strain);
// parse sequence and associate with strain
FeaturedDNASequence dnaSequence = GeneralParser.parse(sequenceString);
Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(strain);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// get
Sequence result = sequenceDAO.get(sequence.getId());
Assert.assertNotNull(result);
Assert.assertEquals(result, sequence);
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testUpdate.
@Test
public void testUpdate() throws Exception {
Account account = AccountCreator.createTestAccount("SequenceDAOTest.testUpdate", false);
Strain strain = TestEntryCreator.createTestStrain(account);
Assert.assertNotNull(strain);
// parse sequence and associate with strain
FeaturedDNASequence dnaSequence = GeneralParser.parse(sequenceString);
Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(strain);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// get
Sequence result = sequenceDAO.get(sequence.getId());
Assert.assertNotNull(result);
Assert.assertEquals(result, sequence);
// update
String newSequence = "gatgatgtggtttctacaggatctgacattattattgttggaagaggactattt";
sequence.setSequence(newSequence);
sequence = sequenceDAO.update(sequence);
Assert.assertNotNull(sequence);
// get
result = sequenceDAO.get(sequence.getId());
Assert.assertNotNull(result);
Assert.assertEquals(result, sequence);
Assert.assertEquals(newSequence, result.getSequence());
Assert.assertEquals(newSequence, sequence.getSequence());
}
Aggregations