use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class PreferencesControllerTest method testCreatePreference.
@Test
public void testCreatePreference() throws Exception {
Account account = AccountCreator.createTestAccount("testCreatePreference", false);
Preference preference = controller.createPreference(account, "foo", "bar");
Assert.assertNotNull(preference);
preference = controller.createPreference(account, "bar", "foo");
Assert.assertNotNull(preference);
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class PreferencesControllerTest method testRetrieveAccountPreferences.
@Test
public void testRetrieveAccountPreferences() throws Exception {
Account account = AccountCreator.createTestAccount("testRetrieveAccountPreferences", false);
ArrayList<PreferenceKey> keys = new ArrayList<>(Arrays.asList(PreferenceKey.values()));
HashMap<PreferenceKey, String> preferences = controller.retrieveAccountPreferences(account, keys);
Assert.assertNotNull(preferences);
Assert.assertEquals(0, preferences.size());
Preference preference = controller.createPreference(account, PreferenceKey.FUNDING_SOURCE.name(), "JBEI");
Assert.assertNotNull(preference);
preferences = controller.retrieveAccountPreferences(account, keys);
Assert.assertNotNull(preference);
Assert.assertEquals(1, preferences.size());
Assert.assertTrue(preferences.containsKey(PreferenceKey.FUNDING_SOURCE));
Assert.assertTrue(preferences.get(PreferenceKey.FUNDING_SOURCE).equals("JBEI"));
preference = controller.createPreference(account, PreferenceKey.PRINCIPAL_INVESTIGATOR.name(), "PI");
Assert.assertNotNull(preference);
preferences = controller.retrieveAccountPreferences(account, keys);
Assert.assertNotNull(preference);
Assert.assertEquals(2, preferences.size());
Assert.assertTrue(preferences.containsKey(PreferenceKey.FUNDING_SOURCE));
Assert.assertTrue(preferences.get(PreferenceKey.FUNDING_SOURCE).equals("JBEI"));
Assert.assertTrue(preferences.containsKey(PreferenceKey.PRINCIPAL_INVESTIGATOR));
Assert.assertTrue(preferences.get(PreferenceKey.PRINCIPAL_INVESTIGATOR).equals("PI"));
}
use of org.jbei.ice.storage.model.Account 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.storage.model.Account in project ice by JBEI.
the class UserApiKeysTest method testRequestKey.
@Test
public void testRequestKey() throws Exception {
Account account = AccountCreator.createTestAccount("UserApiKeysTest.testRequestKey", false);
UserApiKeys apiKeys = new UserApiKeys(account.getEmail());
AccessKey accessKey = apiKeys.requestKey("app.test");
Assert.assertNotNull(accessKey);
Assert.assertNotNull(accessKey.getToken());
AccessKey accessKey2 = apiKeys.requestKey("app.test2");
Assert.assertNotNull(accessKey2);
Assert.assertNotNull(accessKey2.getToken());
Assert.assertNotEquals(accessKey.getToken(), accessKey2.getToken());
}
use of org.jbei.ice.storage.model.Account in project ice by JBEI.
the class BulkEntryCreatorTest method testCreateEntry.
@Test
public void testCreateEntry() throws Exception {
Account account = AccountCreator.createTestAccount("testCreateEntry", false);
long uploadId = creator.createBulkUpload(account.getEmail(), EntryType.PLASMID);
PartData partData = new PartData(EntryType.PLASMID);
partData.setShortDescription("test summary");
partData.setName("plasmid");
partData.setBioSafetyLevel(1);
partData = creator.createEntry(account.getEmail(), uploadId, partData);
Assert.assertNotNull(partData);
}
Aggregations