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


Java DefaultAttribute类代码示例

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


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


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