Search in sources :

Example 1 with PlasmidData

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());
}
Also used : SearchQuery(org.jbei.ice.lib.dto.search.SearchQuery) Account(org.jbei.ice.storage.model.Account) Entry(org.jbei.ice.storage.model.Entry) PartData(org.jbei.ice.lib.dto.entry.PartData) PlasmidData(org.jbei.ice.lib.dto.entry.PlasmidData) Entries(org.jbei.ice.lib.entry.Entries) SearchResults(org.jbei.ice.lib.dto.search.SearchResults) Test(org.junit.Test)

Example 2 with PlasmidData

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;
}
Also used : PartData(org.jbei.ice.lib.dto.entry.PartData) PlasmidData(org.jbei.ice.lib.dto.entry.PlasmidData)

Example 3 with PlasmidData

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());
}
Also used : SearchQuery(org.jbei.ice.lib.dto.search.SearchQuery) Account(org.jbei.ice.storage.model.Account) Entry(org.jbei.ice.storage.model.Entry) EntryCreator(org.jbei.ice.lib.entry.EntryCreator) PartData(org.jbei.ice.lib.dto.entry.PartData) PlasmidData(org.jbei.ice.lib.dto.entry.PlasmidData) SearchResults(org.jbei.ice.lib.dto.search.SearchResults) Test(org.junit.Test)

Example 4 with PlasmidData

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

PartData (org.jbei.ice.lib.dto.entry.PartData)4 PlasmidData (org.jbei.ice.lib.dto.entry.PlasmidData)4 SearchQuery (org.jbei.ice.lib.dto.search.SearchQuery)2 SearchResults (org.jbei.ice.lib.dto.search.SearchResults)2 Entries (org.jbei.ice.lib.entry.Entries)2 Account (org.jbei.ice.storage.model.Account)2 Entry (org.jbei.ice.storage.model.Entry)2 Test (org.junit.Test)2 EntryCreator (org.jbei.ice.lib.entry.EntryCreator)1 Plasmid (org.jbei.ice.storage.model.Plasmid)1