• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DefaultAttribute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.directory.api.ldap.model.entry.DefaultAttribute的典型用法代码示例。如果您正苦于以下问题:Java DefaultAttribute类的具体用法?Java DefaultAttribute怎么用?Java DefaultAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultAttribute类属于org.apache.directory.api.ldap.model.entry包,在下文中一共展示了DefaultAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: useBundleClasses

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
@Override
protected void useBundleClasses() throws Exception
{
    new Dn( "dc=example,dc=com" ); // uses FastDnParser
    new Dn( "cn=a+sn=b,dc=example,dc=com" ); // uses ComplexDnparser (antlr based)
    new Value( "foo" );
    new DefaultAttribute( "cn" );
    new DefaultEntry();

    AttributeUtils.toJndiAttribute( new DefaultAttribute( "cn" ) );
    
    new BindRequestImpl();

    new EqualityNode<String>( "cn", "foo" );

    new LdapUrl( "ldap://ldap.example.com:10389/dc=example,dc=com?objectclass" );

    new ObjectClassDescriptionSchemaParser()
        .parse( "( 2.5.6.0 NAME 'top' DESC 'top of the superclass chain' ABSTRACT MUST objectClass )" );
    
    SchemaObject schemaObject = new LdapSyntax( "1.2.3" );
    new Registries().getGlobalOidRegistry().register( schemaObject );
    new Registries().getLoadedSchemas();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:ApiLdapModelOsgiTest.java


示例2: testGetAttribute

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
@Test
public void testGetAttribute() throws Exception
{
    AttributeType at = TestEntryUtils.getIA5StringAttributeType();

    DefaultAttribute attr = new DefaultAttribute( at );

    attr.add( "Test1" );
    attr.add( "Test2" );
    attr.add( "Test3" );

    assertEquals( "1.1", attr.getId() );
    assertEquals( 3, attr.size() );
    assertTrue( attr.contains( "Test1" ) );
    assertTrue( attr.contains( "Test2" ) );
    assertTrue( attr.contains( "Test3" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:18,代码来源:SchemaAwareAttributeTest.java


示例3: testContains

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test the contains() method
 */
@Test
public void testContains() throws Exception
{
    AttributeType at = TestEntryUtils.getIA5StringAttributeType();

    DefaultAttribute attr = new DefaultAttribute( at );

    attr.add( "Test  1" );
    attr.add( "Test  2" );
    attr.add( "Test  3" );

    assertTrue( attr.contains( "test 1" ) );
    assertTrue( attr.contains( "Test 2" ) );
    assertTrue( attr.contains( "TEST     3" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:SchemaAwareAttributeTest.java


示例4: testGetId

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method getId()
 */
@Test
public void testGetId()
{
    Attribute attr = new DefaultAttribute( atCN );

    assertEquals( "2.5.4.3", attr.getId() );

    attr.setUpId( "  CN  " );
    assertEquals( "2.5.4.3", attr.getId() );
    assertEquals( "  CN  ", attr.getUpId() );

    attr.setUpId( "  CommonName  " );
    assertEquals( "2.5.4.3", attr.getId() );
    assertEquals( "  CommonName  ", attr.getUpId() );

    attr.setUpId( "  2.5.4.3  " );
    assertEquals( "2.5.4.3", attr.getId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:22,代码来源:SchemaAwareAttributeTest.java


示例5: testGetUpId

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method getUpId
 */
@Test
public void testGetUpId()
{
    Attribute attr = new DefaultAttribute( atCN );

    assertNotNull( attr.getUpId() );
    assertEquals( "cn", attr.getUpId() );

    attr.setUpId( "CN" );
    assertEquals( "CN", attr.getUpId() );

    attr.setUpId( "  Cn  " );
    assertEquals( "  Cn  ", attr.getUpId() );

    attr.setUpId( "  2.5.4.3  " );
    assertEquals( "  2.5.4.3  ", attr.getUpId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:SchemaAwareAttributeTest.java


示例6: testContainsStringArray

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method contains( String... )
 */
@Test
public void testContainsStringArray() throws LdapException
{
    Attribute attr1 = new DefaultAttribute( atEMail );

    assertEquals( 0, attr1.size() );
    assertFalse( attr1.contains( "a" ) );
    assertFalse( attr1.contains( ( String ) null ) );

    attr1.add( ( String ) null );
    assertEquals( 1, attr1.size() );
    assertTrue( attr1.contains( ( String ) null ) );

    attr1.remove( ( String ) null );
    assertFalse( attr1.contains( ( String ) null ) );
    assertEquals( 0, attr1.size() );

    attr1.add( "a", "b", "c" );
    assertEquals( 3, attr1.size() );
    assertTrue( attr1.contains( "a" ) );
    assertTrue( attr1.contains( "b" ) );
    assertTrue( attr1.contains( "c" ) );
    assertFalse( attr1.contains( "e" ) );
    assertFalse( attr1.contains( ( String ) null ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:SchemaAwareAttributeTest.java


示例7: testContainsByteArray

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method contains( byte[]... )
 */
@Test
public void testContainsByteArray() throws LdapException
{
    Attribute attr1 = new DefaultAttribute( atPwd );

    assertEquals( 0, attr1.size() );
    assertFalse( attr1.contains( BYTES1 ) );
    assertFalse( attr1.contains( ( byte[] ) null ) );

    attr1.add( ( byte[] ) null );
    assertEquals( 1, attr1.size() );
    assertTrue( attr1.contains( ( byte[] ) null ) );

    attr1.remove( ( byte[] ) null );
    assertFalse( attr1.contains( ( byte[] ) null ) );
    assertEquals( 0, attr1.size() );

    attr1.add( BYTES1, BYTES2, BYTES3 );
    assertEquals( 3, attr1.size() );
    assertTrue( attr1.contains( BYTES1 ) );
    assertTrue( attr1.contains( BYTES2 ) );
    assertTrue( attr1.contains( BYTES3 ) );
    assertFalse( attr1.contains( BYTES4 ) );
    assertFalse( attr1.contains( ( byte[] ) null ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:SchemaAwareAttributeTest.java


示例8: testIterator

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method iterator()
 */
@Test
public void testIterator() throws LdapException
{
    Attribute attr1 = new DefaultAttribute( atCN );
    attr1.add( "a", "b", "c" );

    Iterator<Value> iter = attr1.iterator();

    assertTrue( iter.hasNext() );

    String[] values = new String[]
        { "a", "b", "c" };
    int pos = 0;

    for ( Value val : attr1 )
    {
        assertTrue( val instanceof Value );
        assertEquals( values[pos++], val.getValue() );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaAwareAttributeTest.java


示例9: descToLdif

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * @return The description as a ldif line
 * @throws org.apache.directory.api.ldap.model.exception.LdapException If the conversion goes wrong
 */
private String descToLdif() throws LdapException
{
    if ( Strings.isEmpty( description ) )
    {
        return "";
    }
    else
    {
        Entry entry = new DefaultEntry();
        Attribute attribute = new DefaultAttribute( "m-description", description );

        entry.put( attribute );

        return LdifUtils.convertAttributesToLdif( entry );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:SchemaElementImpl.java


示例10: testSetAttributeType

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method setAttributeType( AttributeType )
 */
@Test
public void testSetAttributeType() throws Exception
{
    Attribute attr = new DefaultAttribute( atCN );

    try
    {
        attr.apply( null );
        fail();
    }
    catch ( IllegalArgumentException iae )
    {
        assertTrue( true );
    }

    attr.apply( atSN );

    assertTrue( attr.isInstanceOf( atSN ) );
    assertEquals( "2.5.4.4", attr.getId() );
    assertEquals( "sn", attr.getUpId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:SchemaAwareAttributeTest.java


示例11: testDefaultServerAttributeAttributeTypeValueArray

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test constructor DefaultEntryAttribute( AttributeType, Value... )
 */
@Test
public void testDefaultServerAttributeAttributeTypeValueArray() throws Exception
{
    Attribute attr1 = new DefaultAttribute( atDC, stringValue1, stringValue2, nullStringValue );

    assertTrue( attr1.isHumanReadable() );
    assertEquals( 3, attr1.size() );
    assertEquals( "0.9.2342.19200300.100.1.25", attr1.getId() );
    assertEquals( "dc", attr1.getUpId() );
    assertEquals( atDC, attr1.getAttributeType() );
    assertTrue( attr1.contains( "a", "b" ) );
    assertTrue( attr1.contains( nullStringValue ) );

    Attribute attr2 = new DefaultAttribute( atDC, stringValue1, binaryValue2, nullStringValue );

    assertTrue( attr2.isHumanReadable() );
    assertEquals( 2, attr2.size() );
    assertEquals( "0.9.2342.19200300.100.1.25", attr2.getId() );
    assertEquals( "dc", attr2.getUpId() );
    assertEquals( atDC, attr2.getAttributeType() );
    assertTrue( attr2.contains( "a" ) );
    assertTrue( attr2.contains( nullStringValue ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:SchemaAwareAttributeTest.java


示例12: testDefaultServerAttributeAttributeTypeStringArray

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test constructor DefaultEntryAttribute( AttributeType, String... )
 */
@Test
public void testDefaultServerAttributeAttributeTypeStringArray() throws LdapException
{
    Attribute attr1 = new DefaultAttribute( atEMail, "a", "b", ( String ) null );

    assertTrue( attr1.isHumanReadable() );
    assertEquals( 3, attr1.size() );
    assertEquals( "1.2.840.113549.1.9.1", attr1.getId() );
    assertEquals( "email", attr1.getUpId() );
    assertEquals( atEMail, attr1.getAttributeType() );
    assertTrue( attr1.contains( "a", "b" ) );
    assertTrue( attr1.contains( nullStringValue ) );

    Attribute attr2 = new DefaultAttribute( atEMail, stringValue1, binaryValue2, nullStringValue );

    assertTrue( attr2.isHumanReadable() );
    assertEquals( 2, attr2.size() );
    assertEquals( "1.2.840.113549.1.9.1", attr2.getId() );
    assertEquals( "email", attr2.getUpId() );
    assertEquals( atEMail, attr2.getAttributeType() );
    assertTrue( attr2.contains( "a" ) );
    assertTrue( attr2.contains( nullStringValue ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:SchemaAwareAttributeTest.java


示例13: testDefaultServerAttributeAttributeTypeByteArray

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method DefaultEntryAttribute( AttributeType, byte[]... )
 */
@Test
public void testDefaultServerAttributeAttributeTypeByteArray() throws LdapException
{
    Attribute attr1 = new DefaultAttribute( atPwd, BYTES1, BYTES2, ( byte[] ) null );

    assertFalse( attr1.isHumanReadable() );
    assertEquals( 3, attr1.size() );
    assertEquals( "2.5.4.35", attr1.getId() );
    assertEquals( "userPassword", attr1.getUpId() );
    assertEquals( atPwd, attr1.getAttributeType() );
    assertTrue( attr1.contains( BYTES1, BYTES2 ) );
    assertTrue( attr1.contains( nullBinaryValue ) );

    Attribute attr2 = new DefaultAttribute( atPwd, stringValue1, binaryValue2, nullBinaryValue );

    assertFalse( attr2.isHumanReadable() );
    assertEquals( 2, attr2.size() );
    assertEquals( "2.5.4.35", attr2.getId() );
    assertEquals( "userPassword", attr2.getUpId() );
    assertEquals( atPwd, attr2.getAttributeType() );
    assertTrue( attr2.contains( BYTES2 ) );
    assertTrue( attr2.contains( nullBinaryValue ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:SchemaAwareAttributeTest.java


示例14: testDefaultServerAttributeStringAttributeTypeByteArray

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method DefaultEntryAttribute( String, AttributeType, byte[]... )
 */
@Test
public void testDefaultServerAttributeStringAttributeTypeByteArray() throws LdapException
{
    Attribute attr1 = new DefaultAttribute( "userPassword", atPwd, BYTES1, BYTES2, ( byte[] ) null );

    assertFalse( attr1.isHumanReadable() );
    assertEquals( 3, attr1.size() );
    assertEquals( "2.5.4.35", attr1.getId() );
    assertEquals( "userPassword", attr1.getUpId() );
    assertEquals( atPwd, attr1.getAttributeType() );
    assertTrue( attr1.contains( BYTES1, BYTES2 ) );
    assertTrue( attr1.contains( nullBinaryValue ) );

    Attribute attr2 = new DefaultAttribute( "2.5.4.35", atPwd, stringValue1, binaryValue2, nullBinaryValue );

    assertFalse( attr2.isHumanReadable() );
    assertEquals( 2, attr2.size() );
    assertEquals( "2.5.4.35", attr2.getId() );
    assertEquals( "2.5.4.35", attr2.getUpId() );
    assertEquals( atPwd, attr2.getAttributeType() );
    assertTrue( attr2.contains( BYTES2 ) );
    assertTrue( attr2.contains( nullBinaryValue ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:SchemaAwareAttributeTest.java


示例15: testClone

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test method testClone()
 */
@Test
public void testClone() throws LdapException
{
    Attribute attr = new DefaultAttribute( atDC );

    Attribute clone = attr.clone();

    assertEquals( attr, clone );
    attr.setUpId( "DomainComponent" );
    assertEquals( "0.9.2342.19200300.100.1.25", clone.getId() );

    attr.add( "a", ( String ) null, "b" );
    clone = attr.clone();
    assertEquals( attr, clone );

    attr.remove( "a" );
    assertNotSame( attr, clone );

    clone = attr.clone();
    assertEquals( attr, clone );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:SchemaAwareAttributeTest.java


示例16: testCopyConstructorServerAttribute

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test the copy constructor of a EntryAttribute
 */
@Test
public void testCopyConstructorServerAttribute() throws LdapException
{
    Attribute attribute = new DefaultAttribute( atCN );

    Attribute copy = new DefaultAttribute( atCN, attribute );

    assertEquals( copy, attribute );

    Attribute attribute2 = new DefaultAttribute( atCN, "test" );

    Attribute copy2 = new DefaultAttribute( atCN, attribute2 );

    assertEquals( copy2, attribute2 );
    attribute2.add( "test2" );
    assertNotSame( copy2, attribute2 );
    assertEquals( "test", copy2.getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:22,代码来源:SchemaAwareAttributeTest.java


示例17: testCopyConstructorClientAttribute

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test the copy constructor of a ClientAttribute
 */
@Test
public void testCopyConstructorClientAttribute() throws LdapException
{
    Attribute attribute = new DefaultAttribute( "commonName" );
    attribute.add( "test" );

    Attribute copy = new DefaultAttribute( atCN, attribute );

    assertEquals( atCN, copy.getAttributeType() );
    assertEquals( "test", copy.getString() );
    assertTrue( copy.isHumanReadable() );

    attribute.add( "test2" );
    assertFalse( copy.contains( "test2" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:SchemaAwareAttributeTest.java


示例18: testToClientAttribute

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test the conversion method
 */
@Test
public void testToClientAttribute() throws LdapException
{
    Attribute attribute = new DefaultAttribute( atCN, "test", "test2" );

    Attribute clientAttribute = attribute.clone();

    assertTrue( clientAttribute instanceof Attribute );

    assertTrue( clientAttribute.contains( "test", "test2" ) );
    assertEquals( "2.5.4.3", clientAttribute.getId() );

    attribute.remove( "test", "test2" );
    assertTrue( clientAttribute.contains( "test", "test2" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:SchemaAwareAttributeTest.java


示例19: nameToLdif

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * @return the Names as Ldif lines
 * @throws org.apache.directory.api.ldap.model.exception.LdapException If the conversion goes wrong
 */
private String nameToLdif() throws LdapException
{
    if ( names.isEmpty() )
    {
        return "";
    }
    else
    {
        Entry entry = new DefaultEntry();
        Attribute attribute = new DefaultAttribute( "m-name" );

        for ( String name : names )
        {
            attribute.add( name );
        }

        entry.put( attribute );

        return LdifUtils.convertAttributesToLdif( entry );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:SchemaElementImpl.java


示例20: testSerializeAttributeNullValue

import org.apache.directory.api.ldap.model.entry.DefaultAttribute; //导入依赖的package包/类
/**
 * Test the serialization of a server attribute with a null value
 */
@Test
public void testSerializeAttributeNullValue() throws LdapException, IOException, ClassNotFoundException
{
    DefaultAttribute dsa = new DefaultAttribute( atDC );
    dsa.setUpId( "DomainComponent" );
    dsa.add( ( String ) null );

    DefaultAttribute dsaSer = deserializeValue( serializeValue( dsa ), atDC );
    assertEquals( dsa.toString(), dsaSer.toString() );
    assertEquals( "0.9.2342.19200300.100.1.25", dsaSer.getId() );
    assertEquals( "DomainComponent", dsaSer.getUpId() );
    assertNull( dsaSer.getString() );
    assertEquals( 1, dsaSer.size() );
    assertTrue( dsaSer.contains( ( String ) null ) );
    assertTrue( dsaSer.isHumanReadable() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:20,代码来源:SchemaAwareAttributeTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ResponseBodyEmitter类代码示例发布时间:2022-05-22
下一篇:
Java WakerBehaviour类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap