當前位置: 首頁>>代碼示例>>Java>>正文


Java Group.setGroupName方法代碼示例

本文整理匯總了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);
}
 
開發者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: 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"));
}
 
開發者ID:ndexbio,項目名稱:ndex-rest,代碼行數:6,代碼來源:GroupDAO.java


注:本文中的org.ndexbio.model.object.Group.setGroupName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。