use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class WebPartnersTest method testAddNewPartner.
@Test
public void testAddNewPartner() throws Exception {
Account admin = AccountCreator.createTestAccount("WebPartnersTest.testAddNewPartner", true);
String adminUser = admin.getEmail();
WebPartners partners = createThisPartnerObject();
// create registryPartner for add
RegistryPartner partner = new RegistryPartner();
partner.setUrl("registry-test20.jbei.org");
RegistryPartner added = partners.addNewPartner(adminUser, partner);
Assert.assertNotNull(added);
Assert.assertEquals(partner.getUrl(), "registry-test20.jbei.org");
Assert.assertEquals(added.getStatus(), RemotePartnerStatus.APPROVED);
// try to add the same partner again: list of partners should remain the same
// (at two since both remote and local are implemented here)
long size = partners.getPartners().size();
partners.addNewPartner(adminUser, partner);
Assert.assertEquals(size, partners.getPartners().size());
}
use of org.jbei.ice.storage.model.Account 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.storage.model.Account in project ice by JBEI.
the class AccountDAOTest method testGet.
@Test
public void testGet() throws DAOException {
Assert.assertNull(dao.get(0));
Account account = createAccountObject("testGet");
Account saved = dao.create(account);
Assert.assertNotNull(saved);
Account ret = dao.get(saved.getId());
Assert.assertTrue(saved.getEmail().equals(ret.getEmail()));
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class AccountDAOTest method createAccountObject.
private Account createAccountObject(String email) {
Account account = new Account();
account.setEmail(email);
account.setFirstName("First");
account.setLastName("Last");
account.setInitials("FL");
account.setInstitution("");
account.setDescription("");
account.setIp("127.0.0.1");
account.setPassword("40ntH@cKm3br0");
return account;
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class AccountDAOTest method testGetAccounts.
@Test
public void testGetAccounts() throws DAOException {
for (int i = 0; i < 16; i += 1) {
Account account = createAccountObject("testGetAccounts" + i);
Assert.assertNotNull(dao.create(account));
}
// get all accounts (no filters), 4 at a time
for (int i = 0; i < 16; i += 4) {
List<Account> accountList = dao.getAccounts(i, 4, "id", true, null);
Assert.assertEquals(4, accountList.size());
}
// get all accounts, filter by email
for (int i = 0; i < 16; i += 4) {
List<Account> accountList = dao.getAccounts(i, 4, "id", true, "testGetAccounts");
Assert.assertEquals(4, accountList.size());
}
}
Aggregations