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


Java LdapNetworkConnection.modify方法代码示例

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


在下文中一共展示了LdapNetworkConnection.modify方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test822ModifyAccountHt

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
@Test
   public void test822ModifyAccountHt() throws Exception {
	final String TEST_NAME = "test822ModifyAccountHt";
       TestUtil.displayTestTile(this, TEST_NAME);

       // GIVEN
       Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
       OperationResult result = task.getResult();
       
       long tsStart = System.currentTimeMillis();
       
       // WHEN
       TestUtil.displayWhen(TEST_NAME);
       LdapNetworkConnection connection = ldapConnect();
       Modification modCn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "sn", ACCOUNT_HT_SN_MODIFIED);
       connection.modify(toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN), modCn);
	ldapDisconnect(connection);

	waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);
       
       // THEN
       TestUtil.displayThen(TEST_NAME);
       result.computeStatus();
       TestUtil.assertSuccess(result);
       
       long tsEnd = System.currentTimeMillis();
       
       PrismObject<UserType> user = findUserByUsername(ACCOUNT_HT_UID);
       assertNotNull("No user "+ACCOUNT_HT_UID+" created", user);
       assertUser(user, user.getOid(), ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN_MODIFIED);

       assertStepSyncToken(getSyncTaskOid(), 7, tsStart, tsEnd);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:34,代码来源:AbstractLdapSynchronizationTest.java

示例2: doAdditionalRenameModifications

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
@Override
protected void doAdditionalRenameModifications(LdapNetworkConnection connection) throws LdapException {
	Modification mod = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, 
			ATTRIBUTE_SAM_ACCOUNT_NAME_NAME, ACCOUNT_HTM_UID);
	connection.modify(toAccountDn(ACCOUNT_HTM_UID, ACCOUNT_HTM_CN), mod);
	display("Modified "+toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN)+" " + ATTRIBUTE_SAM_ACCOUNT_NAME_NAME + 
			" -> "+ACCOUNT_HTM_UID+": "+mod);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:9,代码来源:AbstractAdLdapTest.java

示例3: modify

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
protected void modify(Dn dn, List<Modification> modifications) {
	LdapNetworkConnection connection = connectionManager.getConnection(dn);
	try {
		PermissiveModify permissiveModifyControl = null;
		if (isUsePermissiveModify()) {
			permissiveModifyControl = new PermissiveModifyImpl();
		}
		if (LOG.isOk()) {
			OperationLog.logOperationReq(connection, "Modify REQ {0}: {1}, control={2}", dn, dumpModifications(modifications), 
					LdapUtil.toShortString(permissiveModifyControl));
		}
		ModifyRequest modRequest = new ModifyRequestImpl();
		modRequest.setName(dn);
		if (permissiveModifyControl != null) {
			modRequest.addControl(permissiveModifyControl);
		}
		// processModificationsBeforeUpdate must happen after logging. Otherwise passwords might be logged.
		for (Modification mod: processModificationsBeforeUpdate(modifications)) {
			modRequest.addModification(mod);
		}
		ModifyResponse modifyResponse = connection.modify(modRequest);
		
		if (LOG.isOk()) {
			OperationLog.logOperationRes(connection, "Modify RES {0}: {1}", dn, modifyResponse.getLdapResult());
		}
		
		if (modifyResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS) {
			throw processModifyResult(dn, modifications, modifyResponse);
		}
	} catch (LdapException e) {
		OperationLog.logOperationErr(connection, "Modify ERROR {0}: {1}: {2}", dn, dumpModifications(modifications), e.getMessage(), e);
		throw processModifyResult(dn.toString(), modifications, e);
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:35,代码来源:AbstractLdapConnector.java

示例4: test802ModifyAccountHt

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
@Test
   public void test802ModifyAccountHt() throws Exception {
	final String TEST_NAME = "test802ModifyAccountHt";
       TestUtil.displayTestTitle(this, TEST_NAME);

       // GIVEN
       Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
       OperationResult result = task.getResult();

       long tsStart = System.currentTimeMillis();

       // WHEN
       TestUtil.displayWhen(TEST_NAME);
       LdapNetworkConnection connection = ldapConnect();
       Modification modCn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "sn", ACCOUNT_HT_SN_MODIFIED);
       connection.modify(toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN), modCn);
	ldapDisconnect(connection);

	waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);

       // THEN
       TestUtil.displayThen(TEST_NAME);
       result.computeStatus();
       TestUtil.assertSuccess(result);

       long tsEnd = System.currentTimeMillis();

       PrismObject<UserType> user = findUserByUsername(ACCOUNT_HT_UID);
       assertNotNull("No user "+ACCOUNT_HT_UID+" created", user);
       assertUser(user, user.getOid(), ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN_MODIFIED);

       assertStepSyncToken(getSyncTaskOid(), 2, tsStart, tsEnd);

}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:35,代码来源:AbstractLdapSynchronizationTest.java

示例5: test822ModifyAccountHt

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
@Test
   public void test822ModifyAccountHt() throws Exception {
	final String TEST_NAME = "test822ModifyAccountHt";
       TestUtil.displayTestTitle(this, TEST_NAME);

       // GIVEN
       Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
       OperationResult result = task.getResult();

       long tsStart = System.currentTimeMillis();

       // WHEN
       TestUtil.displayWhen(TEST_NAME);
       LdapNetworkConnection connection = ldapConnect();
       Modification modCn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "sn", ACCOUNT_HT_SN_MODIFIED);
       connection.modify(toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN), modCn);
	ldapDisconnect(connection);

	waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);

       // THEN
       TestUtil.displayThen(TEST_NAME);
       result.computeStatus();
       TestUtil.assertSuccess(result);

       long tsEnd = System.currentTimeMillis();

       PrismObject<UserType> user = findUserByUsername(ACCOUNT_HT_UID);
       assertNotNull("No user "+ACCOUNT_HT_UID+" created", user);
       assertUser(user, user.getOid(), ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN_MODIFIED);

       assertStepSyncToken(getSyncTaskOid(), 7, tsStart, tsEnd);
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:34,代码来源:AbstractLdapSynchronizationTest.java

示例6: doAdditionalRenameModifications

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
@Override
protected void doAdditionalRenameModifications(LdapNetworkConnection connection) throws LdapException {
	Modification mod = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE,
			ATTRIBUTE_SAM_ACCOUNT_NAME_NAME, ACCOUNT_HTM_UID);
	connection.modify(toAccountDn(ACCOUNT_HTM_UID, ACCOUNT_HTM_CN), mod);
	display("Modified "+toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN)+" " + ATTRIBUTE_SAM_ACCOUNT_NAME_NAME +
			" -> "+ACCOUNT_HTM_UID+": "+mod);
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:9,代码来源:AbstractAdLdapTest.java

示例7: test802ModifyAccountHt

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
@Test
   public void test802ModifyAccountHt() throws Exception {
	final String TEST_NAME = "test802ModifyAccountHt";
       TestUtil.displayTestTile(this, TEST_NAME);

       // GIVEN
       Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
       OperationResult result = task.getResult();
       
       long tsStart = System.currentTimeMillis();
       
       // WHEN
       TestUtil.displayWhen(TEST_NAME);
       LdapNetworkConnection connection = ldapConnect();
       Modification modCn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "sn", ACCOUNT_HT_SN_MODIFIED);
       connection.modify(toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN), modCn);
	ldapDisconnect(connection);

	waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);
       
       // THEN
       TestUtil.displayThen(TEST_NAME);
       result.computeStatus();
       TestUtil.assertSuccess(result);
       
       long tsEnd = System.currentTimeMillis();
       
       PrismObject<UserType> user = findUserByUsername(ACCOUNT_HT_UID);
       assertNotNull("No user "+ACCOUNT_HT_UID+" created", user);
       assertUser(user, user.getOid(), ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN_MODIFIED);

       assertStepSyncToken(getSyncTaskOid(), 2, tsStart, tsEnd);

}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:35,代码来源:AbstractLdapSynchronizationTest.java


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