本文整理汇总了Java中org.apache.directory.api.ldap.model.message.AddRequest类的典型用法代码示例。如果您正苦于以下问题:Java AddRequest类的具体用法?Java AddRequest怎么用?Java AddRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AddRequest类属于org.apache.directory.api.ldap.model.message包,在下文中一共展示了AddRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testRequestWithDn
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with the dn attribute
*/
@Test
public void testRequestWithDn()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_dn_attribute.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
assertTrue( addRequest.getEntryDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:AddRequestTest.java
示例2: testRequestWithRequestId
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with the (optional) requestID attribute
*/
@Test
public void testRequestWithRequestId()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
assertEquals( 456, addRequest.getMessageId() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:AddRequestTest.java
示例3: add
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void add( Entry entry ) throws LdapException
{
if ( entry == null )
{
String msg = "Cannot add an empty entry";
LOG.debug( msg );
throw new IllegalArgumentException( msg );
}
AddRequest addRequest = new AddRequestImpl();
addRequest.setEntry( entry );
AddResponse addResponse = add( addRequest );
processResponse( addResponse );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:LdapNetworkConnection.java
示例4: addAsync
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AddFuture addAsync( Entry entry ) throws LdapException
{
if ( entry == null )
{
String msg = "Cannot add null entry";
LOG.debug( msg );
throw new IllegalArgumentException( msg );
}
AddRequest addRequest = new AddRequestImpl();
addRequest.setEntry( entry );
return addAsync( addRequest );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:LdapNetworkConnection.java
示例5: add
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AddResponse add( AddRequest addRequest )
{
LdapConnection connection = null;
try
{
connection = connectionPool.getConnection();
return connection.add( addRequest );
}
catch ( LdapException e )
{
throw new LdapRuntimeException( e );
}
finally
{
returnLdapConnection( connection );
}
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:22,代码来源:LdapConnectionTemplate.java
示例6: action
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void action( LdapMessageContainer<AddRequestDecorator> container ) throws DecoderException
{
// Now, we can allocate the AddRequest Object
int messageId = container.getMessageId();
AddRequest internalAddRequest = new AddRequestImpl();
internalAddRequest.setMessageId( messageId );
AddRequestDecorator addRequest = new AddRequestDecorator(
container.getLdapCodecService(), internalAddRequest );
container.setMessage( addRequest );
// We will check that the request is not null
TLV tlv = container.getCurrentTLV();
if ( tlv.getLength() == 0 )
{
String msg = I18n.err( I18n.ERR_04084 );
LOG.error( msg );
// Will generate a PROTOCOL_ERROR
throw new DecoderException( msg );
}
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:InitAddRequest.java
示例7: addEntry
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* 添加条目
*
* Apache LDAP 主要提供三种添加条目的方法。当前用:同步的、服务器有返回响应的。
*
* @author ZhengWei(HY)
* @createDate 2017-02-14
* @version v1.0
*
* @param i_Entry
* @return 添加成功返回true。
*/
public boolean addEntry(Entry i_Entry)
{
LdapConnection v_Conn = null;
AddRequest v_AddRequest = new AddRequestImpl();
AddResponse v_Response = null;
try
{
v_AddRequest.setEntry( i_Entry);
v_AddRequest.addControl(new ManageDsaITImpl());
v_Conn = this.getConnection();
v_Response = v_Conn.add(v_AddRequest);
}
catch (Exception exce)
{
exce.printStackTrace();
}
finally
{
this.closeConnection(v_Conn);
}
return LDAP.isSuccess(v_Response);
}
开发者ID:HY-ZhengWei,项目名称:hy.common.ldap,代码行数:38,代码来源:LDAP.java
示例8: add
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void add( AddRequest addRequest, LogChange log ) throws LdapException
{
AddOperationContext addContext = new AddOperationContext( this, addRequest );
addContext.setLogChange( log );
OperationManager operationManager = directoryService.getOperationManager();
try
{
operationManager.add( addContext );
}
catch ( LdapException e )
{
addRequest.getResultResponse().addAllControls( addContext.getResponseControls() );
throw e;
}
addRequest.getResultResponse().addAllControls( addContext.getResponseControls() );
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:22,代码来源:DefaultCoreSession.java
示例9: setEntryDn
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AddRequest setEntryDn( Dn entryDn )
{
getDecorated().setEntryDn( entryDn );
return this;
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:AddRequestDsml.java
示例10: setEntry
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AddRequest setEntry( Entry entry )
{
getDecorated().setEntry( entry );
return this;
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:AddRequestDsml.java
示例11: setMessageId
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AddRequest setMessageId( int messageId )
{
super.setMessageId( messageId );
return this;
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:AddRequestDsml.java
示例12: testRequestWith1Control
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with a (optional) Control element
*/
@Test
public void testRequestWith1Control()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_1_control.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Map<String, Control> controls = addRequest.getControls();
assertEquals( 1, addRequest.getControls().size() );
Control control = controls.get( "1.2.840.113556.1.4.643" );
assertNotNull( control );
assertTrue( control.isCritical() );
assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
assertEquals( "Some text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:AddRequestTest.java
示例13: testRequestWith1ControlBase64Value
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with a (optional) Control element with Base64 value
*/
@Test
public void testRequestWith1ControlBase64Value()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput(
AddRequestTest.class.getResource( "request_with_1_control_base64_value.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Map<String, Control> controls = addRequest.getControls();
assertEquals( 1, addRequest.getControls().size() );
Control control = controls.get( "1.2.840.113556.1.4.643" );
assertNotNull( control );
assertTrue( control.isCritical() );
assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AddRequestTest.java
示例14: testRequestWith1ControlEmptyValue
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with a (optional) Control element with empty value
*/
@Test
public void testRequestWith1ControlEmptyValue()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_1_control_empty_value.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Map<String, Control> controls = addRequest.getControls();
assertEquals( 1, addRequest.getControls().size() );
Control control = controls.get( "1.2.840.113556.1.4.643" );
assertNotNull( control );
assertTrue( control.isCritical() );
assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AddRequestTest.java
示例15: testRequestWith2Controls
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with 2 (optional) Control elements
*/
@Test
public void testRequestWith2Controls()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_2_controls.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Map<String, Control> controls = addRequest.getControls();
assertEquals( 2, addRequest.getControls().size() );
Control control = controls.get( "1.2.840.113556.1.4.789" );
assertNotNull( control );
assertFalse( control.isCritical() );
assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
assertEquals( "Some other text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:AddRequestTest.java
示例16: testRequestWith3ControlsWithoutValue
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with 3 (optional) Control elements without value
*/
@Test
public void testRequestWith3ControlsWithoutValue()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_3_controls_without_value.xml" )
.openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Map<String, Control> controls = addRequest.getControls();
assertEquals( 3, addRequest.getControls().size() );
Control control = controls.get( "1.2.840.113556.1.4.456" );
assertNotNull( control );
assertTrue( control.isCritical() );
assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AddRequestTest.java
示例17: testRequestWith1AttrWithoutValue
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with an Attr elements with value
*/
@Test
public void testRequestWith1AttrWithoutValue()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_without_value.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Entry entry = addRequest.getEntry();
assertEquals( 1, entry.size() );
// Getting the Attribute
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "objectclass", attribute.getUpId() );
// Getting the Value
Iterator<Value> valueIterator = attribute.iterator();
assertFalse( valueIterator.hasNext() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:AddRequestTest.java
示例18: testRequestWith1AttrEmptyValue
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with an Attr elements with empty value
*/
@Test
public void testRequestWith1AttrEmptyValue()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_empty_value.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Entry entry = addRequest.getEntry();
assertEquals( 1, entry.size() );
// Getting the Attribute
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "objectclass", attribute.getUpId() );
// Getting the Value
Iterator<Value> valueIterator = attribute.iterator();
assertFalse( valueIterator.hasNext() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:AddRequestTest.java
示例19: testRequestWith1AttrWithValue
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with an Attr elements with value
*/
@Test
public void testRequestWith1AttrWithValue()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_with_value.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Entry entry = addRequest.getEntry();
assertEquals( 1, entry.size() );
// Getting the Attribute
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "objectclass", attribute.getUpId() );
// Getting the Value
Iterator<Value> valueIterator = attribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
assertEquals( "top", value.getValue() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:38,代码来源:AddRequestTest.java
示例20: testRequestWith1AttrWithBase64Value
import org.apache.directory.api.ldap.model.message.AddRequest; //导入依赖的package包/类
/**
* Test parsing of a request with an Attr elements with value
*/
@Test
public void testRequestWith1AttrWithBase64Value()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_with_base64_value.xml" )
.openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();
Entry entry = addRequest.getEntry();
assertEquals( 1, entry.size() );
// Getting the Attribute
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "objectclass", attribute.getUpId() );
// Getting the Value
Iterator<Value> valueIterator = attribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
assertFalse( value.isHumanReadable() );
assertEquals( "DSMLv2.0 rocks!!", value.getValue() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:39,代码来源:AddRequestTest.java
注:本文中的org.apache.directory.api.ldap.model.message.AddRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论