use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class FolderControllerTest method testCreateNewFolder.
@Test
public void testCreateNewFolder() throws Exception {
Account account = AccountCreator.createTestAccount("testCreateNewFolder", false);
String userId = account.getEmail();
FolderDetails folderDetails = new FolderDetails();
folderDetails.setName("test");
FolderDetails folder = controller.createPersonalFolder(userId, folderDetails);
Assert.assertNotNull(folder);
Folder f = DAOFactory.getFolderDAO().get(folder.getId());
Assert.assertNotNull(f);
Assert.assertEquals("test", f.getName());
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class CollectionEntriesTest method testGetEntries.
@Test
public void testGetEntries() throws Exception {
Account account = AccountCreator.createTestAccount("CollectionEntriesTest.testGetEntries", false);
Assert.assertNotNull(account);
CollectionEntries entries = new CollectionEntries(account.getEmail(), CollectionType.AVAILABLE);
Results<PartData> results = entries.getEntries(ColumnField.CREATED, true, 0, 10);
Assert.assertNotNull(results);
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class GroupControllerTest method testGetMatchingGroups.
@Test
public void testGetMatchingGroups() throws Exception {
Account account = AccountCreator.createTestAccount("testGetMatchingGroups", false);
UserGroup g1 = new UserGroup();
g1.setDescription("desc");
g1.setLabel("label");
g1 = controller.createGroup(account.getEmail(), g1);
Assert.assertNotNull(g1);
Group group1 = DAOFactory.getGroupDAO().get(g1.getId());
account.getGroups().add(group1);
Assert.assertNotNull(group1);
UserGroup g2 = new UserGroup();
g2.setDescription("desc");
g2.setLabel("myg2");
g2 = controller.createGroup(account.getEmail(), g2);
Assert.assertNotNull(g2);
Group group2 = DAOFactory.getGroupDAO().get(g2.getId());
Assert.assertNotNull(group2);
account.getGroups().add(group2);
// save to add groups to account
DAOFactory.getAccountDAO().create(account);
Account account2 = AccountCreator.createTestAccount("testGetMatchingGroups2", false);
UserGroup g3 = new UserGroup();
g3.setDescription("desc");
g3.setLabel("myg3");
Assert.assertNotNull(controller.createGroup(account2.getEmail(), g3));
List<Group> groups = controller.getMatchingGroups(account.getEmail(), "myg", 10);
Assert.assertNotNull(groups);
Assert.assertEquals(1, groups.size());
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class GroupControllerTest method testGetGroupById.
@Test
public void testGetGroupById() throws Exception {
Account account = AccountCreator.createTestAccount("testGetGroupById", false);
UserGroup userGroup1 = new UserGroup();
userGroup1.setDescription("test1");
userGroup1.setType(GroupType.PRIVATE);
userGroup1.setLabel("label1");
long id = controller.createGroup(account.getEmail(), userGroup1).getId();
Assert.assertNotNull(controller.getGroupById(account.getEmail(), id));
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class ExperimentsTest method testCreateStudy.
@Test
public void testCreateStudy() throws Exception {
Account account = AccountCreator.createTestAccount("testCreateStudy", false);
String userId = account.getEmail();
String partId = Long.toString(TestEntryCreator.createTestPart(userId));
Study study = new Study();
study.setUrl("http://edd-test.jbei.org/foo/bar");
study.setLabel("test create");
Experiments experiments = new Experiments(userId, partId);
Study created = experiments.createOrUpdateStudy(study);
Assert.assertNotNull(created);
Assert.assertEquals(created.getUrl(), study.getUrl());
Assert.assertEquals(created.getLabel(), study.getLabel());
Assert.assertEquals(created.getOwnerEmail(), userId);
long createdId = created.getId();
// update
study.setLabel("Metabolomic study of the integrated adipic acid-producing Borrelidin Polyketide Synthase (PKS) (JGI constructs Ver. 1.0/ 2.0) S. venezuelae ATCC10712. From 20170206");
created = experiments.createOrUpdateStudy(study);
Assert.assertNotNull(created);
Assert.assertEquals(created.getUrl(), study.getUrl());
Assert.assertEquals(created.getLabel(), study.getLabel().substring(0, 128));
Assert.assertEquals(created.getOwnerEmail(), userId);
List<Study> studies = experiments.getPartStudies();
Assert.assertNotNull(studies);
Assert.assertEquals(1, studies.size());
// test assigning same study to a different entry
study.setUrl("http://edd-test.jbei.org/foo/bar");
study.setLabel("test create");
String partId2 = Long.toString(TestEntryCreator.createTestPart(userId));
experiments = new Experiments(userId, partId2);
created = experiments.createOrUpdateStudy(study);
Assert.assertNotNull(created);
// should be the same created experiment
Assert.assertEquals(created.getId(), createdId);
}
Aggregations