use of org.jbei.ice.lib.dto.entry.PlasmidData in project ice by JBEI.
the class SearchIndexesTest method testRunSearch.
@Test
public void testRunSearch() throws Exception {
Account account = AccountCreator.createTestAccount("testRunSearch", false);
Assert.assertNotNull(account);
// create entry
PlasmidData plasmidData = new PlasmidData();
plasmidData.setCircular(true);
plasmidData.setPromoters("pTet");
plasmidData.setOriginOfReplication("oRep");
PartData partData = new PartData(EntryType.PLASMID);
partData.setBioSafetyLevel(BioSafetyOption.LEVEL_ONE.ordinal());
partData.setStatus("Complete");
partData.setName("testPlasmid");
partData.setFundingSource("DOE");
partData.setPrincipalInvestigator("Nathan");
partData.setPlasmidData(plasmidData);
partData = new Entries(account.getEmail()).create(partData);
Entry entry = DAOFactory.getEntryDAO().get(partData.getId());
Assert.assertNotNull(entry);
Assert.assertTrue(entry.getId() > 0);
// commit triggers indexing
HibernateUtil.commitTransaction();
HibernateUtil.beginTransaction();
SearchQuery query = new SearchQuery();
query.setQueryString("testPlasmid");
SearchResults results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// case insensentive
results = controller.runSearch(account.getEmail().toLowerCase(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// search for promoters
query.setQueryString("pTet");
results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// search email
query.setQueryString(account.getEmail());
results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// fake search
query.setQueryString("FAKE_SEARCH");
results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(0, results.getResultCount());
}
use of org.jbei.ice.lib.dto.entry.PlasmidData in project ice by JBEI.
the class Plasmid method toDataTransferObject.
@Override
public PartData toDataTransferObject() {
PartData data = super.toDataTransferObject();
PlasmidData plasmidData = new PlasmidData();
plasmidData.setBackbone(this.backbone);
plasmidData.setCircular(this.circular);
plasmidData.setOriginOfReplication(this.originOfReplication);
plasmidData.setPromoters(this.promoters);
plasmidData.setReplicatesIn(this.replicatesIn);
data.setPlasmidData(plasmidData);
return data;
}
use of org.jbei.ice.lib.dto.entry.PlasmidData in project ice by JBEI.
the class SearchControllerTest method testRunSearch.
@Test
public void testRunSearch() throws Exception {
Account account = AccountCreator.createTestAccount("testRunSearch", false);
Assert.assertNotNull(account);
// create entry
PlasmidData plasmidData = new PlasmidData();
plasmidData.setCircular(true);
plasmidData.setPromoters("pTet");
plasmidData.setOriginOfReplication("oRep");
PartData partData = new PartData(EntryType.PLASMID);
partData.setBioSafetyLevel(BioSafetyOption.LEVEL_ONE.ordinal());
partData.setStatus("Complete");
partData.setName("testPlasmid");
partData.setFundingSource("DOE");
partData.setPrincipalInvestigator("Nathan");
partData.setPlasmidData(plasmidData);
Entry entry = InfoToModelFactory.infoToEntry(partData);
entry = new EntryCreator().createEntry(account, entry, null);
Assert.assertNotNull(entry);
Assert.assertTrue(entry.getId() > 0);
// commit triggers indexing
HibernateUtil.commitTransaction();
HibernateUtil.beginTransaction();
SearchQuery query = new SearchQuery();
query.setQueryString("testPlasmid");
SearchResults results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// search for promoters
query.setQueryString("pTet");
results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// search email
query.setQueryString(account.getEmail());
results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(1, results.getResultCount());
// fake search
query.setQueryString("FAKE_SEARCH");
results = controller.runSearch(account.getEmail(), query);
Assert.assertNotNull(results);
Assert.assertEquals(0, results.getResultCount());
}
use of org.jbei.ice.lib.dto.entry.PlasmidData 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