本文整理汇总了Java中org.ndexbio.model.object.Group.setGroupName方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setGroupName方法的具体用法?Java Group.setGroupName怎么用?Java Group.setGroupName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ndexbio.model.object.Group
的用法示例。
在下文中一共展示了Group.setGroupName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test0003CreateGroupWithInvalidName
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
/**
* Try to create a group with the same name as user/account name.
* DuplicateObjectException is expected.
*
* APIs tested: public Group createGroup(Group)
*
*/
@Test
public void test0003CreateGroupWithInvalidName() throws JsonProcessingException, IOException, NdexException {
newGroup = new Group();
// set the group name to be user/account name
newGroup.setGroupName(accountName);
// initialize other properties
newGroup.setDescription(group.getDescription());
newGroup.setImage(group.getImage());
newGroup.setGroupName(group.getGroupName());
newGroup.setWebsite(group.getWebsite());
// expected exception is DuplicateObjectException
thrown.expect(DuplicateObjectException.class);
// expected message of DuplicateObjectException
thrown.expectMessage("Group with name " + accountName.toLowerCase() + " already exists.");
// try to create new group with the same name as user/account
// exception is expected
ndex.createGroup(newGroup);
}
示例2: getGroupFromDocument
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
public static Group getGroupFromDocument(ODocument n) {
Group result = new Group();
Helper.populateExternalObjectFromDoc (result, n);
result.setGroupName((String)n.field(NdexClasses.GRP_P_NAME));
result.setWebsite((String)n.field("websiteURL"));
result.setDescription((String)n.field("description"));
result.setImage((String)n.field("imageURL"));
if ( result.getIsDeleted()) {
result.setAccountName((String)n.field(NdexClasses.account_P_oldAcctName));
} else {
result.setAccountName((String)n.field(NdexClasses.account_P_accountName));
}
return result;
}
示例3: createGroup
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
@Test
public void createGroup() {
try {
localConnection.begin();
final Group newGroup = new Group();
newGroup.setGroupName("create");
newGroup.setAccountName("create");
newGroup.setDescription("create");
newGroup.setWebsite("create");
assertNotNull(dao.createNewGroup(newGroup, testUser.getExternalId()));
localConnection.rollback();
} catch (Throwable e){
fail(e.getMessage());
}
}
示例4: createTestGroup
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
private void createTestGroup() {
try {
final Group newGroup = new Group();
newGroup.setGroupName("testGroup");
newGroup.setAccountName("testGroup");
newGroup.setDescription("testGroup");
newGroup.setWebsite("testGroup");
testGroup = dao.createNewGroup(newGroup, testUser.getExternalId());
localConnection.commit();
//return true;
} catch (Exception e) {
//System.out.println(e.getMessage());
fail(e.getMessage());
}
}
示例5: testGetGroupOperations
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
@Test
public void testGetGroupOperations() throws IllegalStateException, Exception {
Group newGroup = new Group();
String testGroupName = "CJ's Test Group Created From Java Client";
String testGroupDesc = "Don't Modifiy this group";
newGroup.setGroupName(testGroupName);
newGroup.setDescription(testGroupDesc);
UUID groupId = ndex.createGroup(newGroup);
Group g = ndex.getGroup(groupId);
assertEquals(g.getGroupName(), testGroupName);
assertEquals(g.getExternalId(), groupId);
assertEquals(g.getDescription(), testGroupDesc);
String testString = "SpecialStringOnlyForABCDEFTesting";
g.setDescription(testString);
ndex.updateGroup(g);
g = ndex.getGroup(groupId);
assertEquals(g.getDescription(), testString);
SimpleQuery query = new SimpleQuery();
query.setSearchString(testString);
Thread.sleep(3000);
SolrSearchResult<Group> r = ndex.findGroups(query, 0, 10);
assertEquals(r.getNumFound(), 1);
assertEquals(r.getResultList().get(0).getDescription(), testString);
ndex.deleteGroup(groupId);
thrown1.expect(ObjectNotFoundException.class);
ndex.getGroup(groupId);
}
示例6: test0004CreateGroupWithInvalidName
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
/**
* Try to create a group with a bad account name (illegal character in name).
*
* APIs tested: public Group createGroup(Group)
*
*/
@Test
public void test0004CreateGroupWithInvalidName() throws JsonProcessingException, IOException, NdexException {
newGroup = new Group();
// set the group name to be user/account name
newGroup.setGroupName("$!BadName!");
// initialize other properties
newGroup.setDescription(group.getDescription());
newGroup.setImage(group.getImage());
newGroup.setGroupName(group.getGroupName());
newGroup.setWebsite(group.getWebsite());
// expected exception is DuplicateObjectException
thrown.expect(DuplicateObjectException.class);
// expected message of DuplicateObjectException
// thrown.expectMessage("Group with name " + accountName.toLowerCase() + " already exists.");
thrown.expectMessage("Is DuplicateObjectException correct exception for this test case? Discuss with Jing");
// try to create new group with the bad name
// exception is expected
Group groupWithBadName = GroupUtils.createGroup(ndex, newGroup);
if (null != groupWithBadName) {
GroupUtils.deleteGroup(ndex, groupWithBadName);
}
}
示例7: createGroupInvalidAccountName
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void createGroupInvalidAccountName() throws NdexException, IllegalArgumentException {
final Group newGroup = new Group();
newGroup.setGroupName("test");
newGroup.setAccountName("");
newGroup.setDescription("test");
newGroup.setWebsite("test");
dao.createNewGroup(newGroup, testUserGroupOwner.getExternalId());
}
示例8: createExistingGroup
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
@Test(expected = DuplicateObjectException.class)
public void createExistingGroup() throws IllegalArgumentException, NdexException, DuplicateObjectException {
final Group newGroup = new Group();
newGroup.setGroupName("testGroup");
newGroup.setAccountName("testGroup");
newGroup.setDescription("testGroup");
newGroup.setWebsite("testGroup");
dao.createNewGroup(newGroup, testUserGroupOwner.getExternalId());
}
示例9: test0005TryToCreateGroupWithNonExistentUser
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
/**
* Try to create a group with a non-existent user/account.
*
* APIs tested: public Group createGroup(Group)
*
*/
@Test
public void test0005TryToCreateGroupWithNonExistentUser() throws JsonProcessingException, IOException, NdexException {
// create new group
newGroup = GroupUtils.createGroup(ndex, group);
// check the contents of the newly created Group object
GroupUtils.compareGroupObjectsContents(group, newGroup);
Group newGroup1 = new Group();
Group newGroup2 = null;
// initialize properties
newGroup1.setGroupName(group.getGroupName() + System.currentTimeMillis());
newGroup1.setDescription(group.getDescription());
newGroup1.setImage(group.getImage());
newGroup1.setGroupName(group.getGroupName());
newGroup1.setWebsite(group.getWebsite());
// set user name to a random value
String userName = "RandomUserName" + System.currentTimeMillis();
// ndex.setCredentials(userName, accountPassword);
// expected exception is ObjectNotFoundException
thrown.expect(ObjectNotFoundException.class);
// expected message of ObjectNotFoundException
// thrown.expectMessage("Group with name " + accountName.toLowerCase() + " already exists.");
thrown.expectMessage("User " + userName.toLowerCase() + " not found.");
try {
// since the user account doesn't exist on the server
// we expect authentication failure when trying to create the group
// newGroup2 = ndex.createGroup(newGroup1);
} finally {
// set user name back to accountName
// ndex.setCredentials(accountName, accountPassword);
assertNull(newGroup2);
}
}
示例10: populateGroupFromResultSet
import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
private static void populateGroupFromResultSet(Group group, ResultSet rs) throws JsonParseException, JsonMappingException, SQLException, IOException {
Helper.populateAccountFromResultSet (group, rs,true);
group.setGroupName(rs.getString("group_name"));
}