当前位置: 首页>>代码示例>>Java>>正文


Java Group.setDescription方法代码示例

本文整理汇总了Java中org.ndexbio.model.object.Group.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setDescription方法的具体用法?Java Group.setDescription怎么用?Java Group.setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ndexbio.model.object.Group的用法示例。


在下文中一共展示了Group.setDescription方法的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);
}
 
开发者ID:ndexbio,项目名称:ndex-java-client,代码行数:32,代码来源:testGroupService.java

示例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;
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:18,代码来源:GroupDocDAO.java

示例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());
		
	}
	
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:22,代码来源:TestGroupDAO.java

示例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());
		
	}
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:22,代码来源:TestGroupDAO.java

示例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);
}
 
开发者ID:ndexbio,项目名称:ndex-java-client,代码行数:31,代码来源:NdexRestClientTest.java

示例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);
    }
}
 
开发者ID:ndexbio,项目名称:ndex-java-client,代码行数:36,代码来源:testGroupService.java

示例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());
           
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:13,代码来源:TestGroupDAO.java

示例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());
		
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:13,代码来源:TestGroupDAO.java

示例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);
   	}
   	
   }
 
开发者ID:ndexbio,项目名称:ndex-java-client,代码行数:49,代码来源:testGroupService.java

示例10: updateGroup

import org.ndexbio.model.object.Group; //导入方法依赖的package包/类
@Test
public void updateGroup() {
    try {
    	
        //Group Group = dao.getGroupById(testGroup.getExternalId());
        final Group updated = new Group();
        updated.setDescription("changed");
        
        dao.updateGroup(updated, testGroup.getExternalId(), testUser.getExternalId());
        //localConnection.commit();
        
        assertEquals(updated.getDescription(), dao.getGroupById(testGroup.getExternalId()).getDescription());
        assertEquals(testGroup.getGroupName(), dao.getGroupById(testGroup.getExternalId()).getGroupName());
        
    } catch (Exception e) {
    	
        fail(e.getMessage());
        e.printStackTrace();
        
    } 
    
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:23,代码来源:TestGroupDAO.java


注:本文中的org.ndexbio.model.object.Group.setDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。