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


Java Attribute.setUpId方法代码示例

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


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

示例1: testGetId

import org.apache.directory.api.ldap.model.entry.Attribute; //导入方法依赖的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

示例2: testGetUpId

import org.apache.directory.api.ldap.model.entry.Attribute; //导入方法依赖的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

示例3: testToString

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

    assertEquals( "email: (null)", attr.toString() );

    attr.setUpId( "EMail" );
    assertEquals( "EMail: (null)", attr.toString() );

    attr.add( ( String ) null );
    assertEquals( "EMail: ''", attr.toString() );

    attr.clear();
    attr.add( "a", "b" );
    assertEquals( "EMail: a\nEMail: b", attr.toString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:SchemaAwareAttributeTest.java

示例4: testClone

import org.apache.directory.api.ldap.model.entry.Attribute; //导入方法依赖的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

示例5: testSetId

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

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

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

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

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

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

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

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

    try
    {
        attr.setUpId( " SN " );
        fail();
    }
    catch ( IllegalArgumentException iae )
    {
        assertTrue( true );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:47,代码来源:SchemaAwareAttributeTest.java

示例6: testEquals

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

    assertFalse( attr1.equals( null ) );

    Attribute attr2 = new DefaultAttribute( atCN );

    assertTrue( attr1.equals( attr2 ) );

    attr2.setUpId( "CN" );
    assertTrue( attr1.equals( attr2 ) );

    attr1.setUpId( "CommonName" );
    assertTrue( attr1.equals( attr2 ) );

    attr1.setUpId( "CN" );
    assertTrue( attr1.equals( attr2 ) );

    attr1.add( "a", "b", "c" );
    attr2.add( "c", "b", "a" );
    assertTrue( attr1.equals( attr2 ) );

    assertTrue( attr1.equals( attr2 ) );

    Attribute attr3 = new DefaultAttribute( atPwd );
    Attribute attr4 = new DefaultAttribute( atPwd );

    attr3.add( nullBinaryValue );
    attr4.add( nullBinaryValue );
    assertTrue( attr3.equals( attr4 ) );

    Attribute attr5 = new DefaultAttribute( atPwd );
    Attribute attr6 = new DefaultAttribute( atDC );
    assertFalse( attr5.equals( attr6 ) );

    attr5.add( nullBinaryValue );
    attr6.add( nullStringValue );
    assertFalse( attr5.equals( attr6 ) );

    Attribute attr7 = new DefaultAttribute( atCN );
    Attribute attr8 = new DefaultAttribute( atPwd );

    attr7.add( "a" );
    attr8.add( BYTES2 );
    assertFalse( attr7.equals( attr8 ) );

    Attribute attr9 = new DefaultAttribute( atCN );
    Attribute attr10 = new DefaultAttribute( atPwd );

    attr9.add( "a" );
    attr9.add( BYTES2 );
    attr10.add( "a", "b" );
    assertFalse( attr9.equals( attr10 ) );

    Attribute attr11 = new DefaultAttribute( atPwd, BYTES1 );
    Attribute attr12 = new DefaultAttribute( atPwd, BYTES1 );

    assertTrue( attr11.get().equals( attr12.get() ) );
    assertTrue( attr12.get().equals( attr11.get() ) );

    Attribute attr13 = new DefaultAttribute( "userPassword", BYTES1 );

    assertTrue( attr11.get().equals( attr13.get() ) );
    assertTrue( attr13.get().equals( attr11.get() ) );

    Attribute attr14 = new DefaultAttribute( "userPassword", BYTES1 );

    assertTrue( attr14.get().equals( attr13.get() ) );
    assertTrue( attr13.get().equals( attr14.get() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:76,代码来源:SchemaAwareAttributeTest.java


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