Search in sources :

Example 86 with Account

use of org.jbei.ice.storage.model.Account in project ice by JBEI.

the class CollectionEntriesTest method testGetEntriesByVisibility.

@Test
public void testGetEntriesByVisibility() throws Exception {
    Account account = AccountCreator.createTestAccount("CollectionEntriesTest.testGetEntriesByVisibility", false);
    Assert.assertNotNull(account);
    long id = TestEntryCreator.createTestPart(account.getEmail());
    Entry entry = DAOFactory.getEntryDAO().get(id);
    entry.setVisibility(Visibility.DRAFT.getValue());
    DAOFactory.getEntryDAO().update(entry);
    CollectionEntries collectionEntries = new CollectionEntries(account.getEmail(), CollectionType.DRAFTS);
    Results<PartData> results = collectionEntries.getEntries(ColumnField.CREATED, true, 0, 13);
    Assert.assertNotNull(results);
    Assert.assertEquals(1, results.getData().size());
    Assert.assertEquals(1, results.getResultCount());
}
Also used : Account(org.jbei.ice.storage.model.Account) Entry(org.jbei.ice.storage.model.Entry) PartData(org.jbei.ice.lib.dto.entry.PartData) Test(org.junit.Test)

Example 87 with Account

use of org.jbei.ice.storage.model.Account in project ice by JBEI.

the class GroupControllerTest method testCreate.

@Test
public void testCreate() throws Exception {
    Account account = AccountCreator.createTestAccount("testCreate", false);
    UserGroup userGroup = new UserGroup();
    userGroup.setLabel("test Group");
    userGroup.setDescription("test");
    userGroup = controller.createGroup(account.getEmail(), userGroup);
    Assert.assertNotNull(userGroup);
}
Also used : Account(org.jbei.ice.storage.model.Account) UserGroup(org.jbei.ice.lib.dto.group.UserGroup)

Example 88 with Account

use of org.jbei.ice.storage.model.Account in project ice by JBEI.

the class PartSequenceTest method testGet.

@Test
public void testGet() throws Exception {
    Account account = AccountCreator.createTestAccount("PartSequenceTest.testGet", false);
    Strain strain = TestEntryCreator.createTestStrain(account);
    PartSequence partSequence = new PartSequence(account.getEmail(), strain.getRecordId());
    FeaturedDNASequence sequence = partSequence.get();
    Assert.assertNull(sequence);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(genbank.getBytes());
    SequenceInfo sequenceInfo = partSequence.parseSequenceFile(inputStream, "testFile.gb");
    Assert.assertNotNull(sequenceInfo);
    FeaturedDNASequence featuredDNASequence = (FeaturedDNASequence) sequenceInfo.getSequence();
    Assert.assertNotNull(featuredDNASequence);
    Assert.assertEquals(1, featuredDNASequence.getFeatures().size());
    sequence = partSequence.get();
    Assert.assertNotNull(sequence);
    Assert.assertEquals(234, sequence.getSequence().length());
    Assert.assertEquals(1, sequence.getFeatures().size());
}
Also used : Account(org.jbei.ice.storage.model.Account) ByteArrayInputStream(java.io.ByteArrayInputStream) SequenceInfo(org.jbei.ice.lib.dto.entry.SequenceInfo) FeaturedDNASequence(org.jbei.ice.lib.dto.FeaturedDNASequence) Strain(org.jbei.ice.storage.model.Strain) Test(org.junit.Test)

Example 89 with Account

use of org.jbei.ice.storage.model.Account in project ice by JBEI.

the class GroupControllerTest method testSetGroupMembers.

@Test
public void testSetGroupMembers() throws Exception {
    Account a1 = AccountCreator.createTestAccount("testSetGroupMembers1", false);
    AccountCreator.createTestAccount("testSetGroupMembers2", false);
    AccountCreator.createTestAccount("testSetGroupMembers3", false);
    UserGroup user = new UserGroup();
    user.setDescription("desc");
    user.setLabel("label");
    user.setType(GroupType.PRIVATE);
    // create group
    user = controller.createGroup(a1.getEmail(), user);
    Assert.assertNotNull(user);
}
Also used : Account(org.jbei.ice.storage.model.Account) UserGroup(org.jbei.ice.lib.dto.group.UserGroup)

Example 90 with Account

use of org.jbei.ice.storage.model.Account in project ice by JBEI.

the class GroupControllerTest method testSave.

@Test
public void testSave() throws Exception {
    Account account = AccountCreator.createTestAccount("testSave", false);
    Group group = new Group();
    group.setOwner(account);
    group.setLabel("group label");
    group.setDescription("group description");
    Assert.assertNotNull(controller.save(group));
}
Also used : Account(org.jbei.ice.storage.model.Account) Group(org.jbei.ice.storage.model.Group) UserGroup(org.jbei.ice.lib.dto.group.UserGroup)

Aggregations

Account (org.jbei.ice.storage.model.Account)153 Test (org.junit.Test)71 Group (org.jbei.ice.storage.model.Group)24 Entry (org.jbei.ice.storage.model.Entry)21 Strain (org.jbei.ice.storage.model.Strain)20 PartData (org.jbei.ice.lib.dto.entry.PartData)18 Folder (org.jbei.ice.storage.model.Folder)18 ArrayList (java.util.ArrayList)16 UserGroup (org.jbei.ice.lib.dto.group.UserGroup)16 PermissionException (org.jbei.ice.lib.access.PermissionException)11 EntryCreator (org.jbei.ice.lib.entry.EntryCreator)10 Plasmid (org.jbei.ice.storage.model.Plasmid)10 AccountTransfer (org.jbei.ice.lib.account.AccountTransfer)8 AccessPermission (org.jbei.ice.lib.dto.access.AccessPermission)8 FolderDetails (org.jbei.ice.lib.dto.folder.FolderDetails)8 DAOException (org.jbei.ice.storage.DAOException)8 RemotePartner (org.jbei.ice.storage.model.RemotePartner)8 HibernateException (org.hibernate.HibernateException)7 HashSet (java.util.HashSet)6 Part (org.jbei.ice.storage.model.Part)6