use of org.jbei.ice.lib.entry.EntryCreator in project ice by JBEI.
the class TestEntryCreator method createTestStrain.
public static Strain createTestStrain(Account account) throws Exception {
Strain strain = new Strain();
strain.setName("sTrain");
strain = (Strain) new EntryCreator().createEntry(account, strain, null);
return strain;
}
use of org.jbei.ice.lib.entry.EntryCreator in project ice by JBEI.
the class TestEntryCreator method createTestAccountAndStrain.
public static Strain createTestAccountAndStrain(String userId) throws Exception {
Account account = AccountCreator.createTestAccount(userId, false);
Assert.assertNotNull(account);
Strain strain = new Strain();
strain.setName("sTrain");
strain.setBioSafetyLevel(BioSafetyOption.LEVEL_ONE.ordinal());
strain.setShortDescription("test strain");
strain = (Strain) new EntryCreator().createEntry(account, strain, null);
return strain;
}
use of org.jbei.ice.lib.entry.EntryCreator in project ice by JBEI.
the class EntryDAOTest method testGetByUniqueName.
@Test
public void testGetByUniqueName() throws Exception {
Account account = AccountCreator.createTestAccount("testGetByUniqueName", false);
PartData data = new PartData(EntryType.PART);
data.setShortDescription("summary for test");
String uniqueName = "pTest" + account.getEmail();
data.setName(uniqueName);
data.setBioSafetyLevel(1);
EntryCreator creator = new EntryCreator();
creator.createPart(account.getEmail(), data);
List<Entry> entries = entryDAO.getByName("pTest");
Assert.assertTrue(entries == null || entries.isEmpty());
entries = entryDAO.getByName(uniqueName);
Assert.assertNotNull(entries);
}
use of org.jbei.ice.lib.entry.EntryCreator in project ice by JBEI.
the class FolderDAOTest method testGetFolderSize.
@Test
public void testGetFolderSize() throws Exception {
Account account = AccountCreator.createTestAccount("testGetFolderSize", false);
String email = account.getEmail();
// create test folder
Folder folder = createFolderObject("testGetFolderSize");
folder = dao.create(folder);
Assert.assertNotNull(folder);
List<Entry> entries = new ArrayList<>();
EntryCreator creator = new EntryCreator();
// create 10 entries
for (int i = 0; i < 10; i += 1) {
Part part = new Part();
part.setName("name" + i);
part.setOwnerEmail(email);
part.setAlias("alias" + i);
part.setShortDescription("short description");
Entry entry = creator.createEntry(account, part, null);
entries.add(entry);
}
// add entries to folder
folder = dao.addFolderContents(folder, entries);
Assert.assertEquals(10, dao.getFolderSize(folder.getId(), null, true).intValue());
}
use of org.jbei.ice.lib.entry.EntryCreator in project ice by JBEI.
the class FolderDAOTest method testGetFolderContents.
@Test
public void testGetFolderContents() throws Exception {
Account account = AccountCreator.createTestAccount("testGetFolderContents", false);
String email = account.getEmail();
// create test folder
Folder folder = createFolderObject("testGetFolderContents");
folder = dao.create(folder);
Assert.assertNotNull(folder);
List<Entry> entries = new ArrayList<>();
EntryCreator creator = new EntryCreator();
// create 10 entries
for (int i = 0; i < 10; i += 1) {
Part part = new Part();
part.setName("name" + i);
part.setOwnerEmail(email);
part.setAlias("alias" + i);
part.setShortDescription("short description");
Entry entry = creator.createEntry(account, part, null);
entries.add(entry);
}
// add entries to folder
folder = dao.addFolderContents(folder, entries);
Assert.assertNotNull(folder);
}
Aggregations