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


Java Attribute.remove方法代码示例

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


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

示例1: testContainsStringArray

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

示例2: testContainsByteArray

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

示例3: 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

示例4: testToClientAttribute

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

示例5: testCreateServerModification

import org.apache.directory.api.ldap.model.entry.Attribute; //导入方法依赖的package包/类
@Test
public void testCreateServerModification() throws LdapException
{
    Attribute attribute = new DefaultAttribute( "cn", cnAT );
    attribute.add( "test1", "test2" );

    Modification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
    Modification clone = mod.clone();

    attribute.remove( "test2" );

    Attribute clonedAttribute = clone.getAttribute();

    assertEquals( 1, mod.getAttribute().size() );
    assertTrue( mod.getAttribute().contains( "TEST1" ) );

    assertEquals( 2, clonedAttribute.size() );
    assertTrue( clone.getAttribute().contains( "test1" ) );
    assertTrue( clone.getAttribute().contains( "test2" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:SchemaAwareModificationSerializationTest.java

示例6: testCreateServerModification

import org.apache.directory.api.ldap.model.entry.Attribute; //导入方法依赖的package包/类
@Test
public void testCreateServerModification() throws LdapException
{
    Attribute attribute = new DefaultAttribute( "cn" );
    attribute.add( "test1", "test2" );

    Modification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
    Modification clone = mod.clone();

    attribute.remove( "test2" );

    Attribute clonedAttribute = clone.getAttribute();

    assertEquals( 1, mod.getAttribute().size() );
    assertTrue( mod.getAttribute().contains( "test1" ) );

    assertEquals( 2, clonedAttribute.size() );
    assertTrue( clone.getAttribute().contains( "test1" ) );
    assertTrue( clone.getAttribute().contains( "test2" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:ModificationTest.java

示例7: testGet

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

    attr1.add( ( String ) null );
    assertEquals( nullStringValue, attr1.get() );

    Attribute attr2 = new DefaultAttribute( "email", atEMail );

    attr2.add( "a", "b", "c" );
    assertEquals( "a", attr2.get().getValue() );

    attr2.remove( "a" );
    assertEquals( "b", attr2.get().getValue() );

    attr2.remove( "b" );
    assertEquals( "c", attr2.get().getValue() );

    attr2.remove( "c" );
    assertNull( attr2.get() );

    Attribute attr3 = new DefaultAttribute( "userPassword", atPwd );

    attr3.add( BYTES1, BYTES2, BYTES3 );
    assertTrue( Arrays.equals( BYTES1, attr3.get().getBytes() ) );

    attr3.remove( BYTES1 );
    assertTrue( Arrays.equals( BYTES2, attr3.get().getBytes() ) );

    attr3.remove( BYTES2 );
    assertTrue( Arrays.equals( BYTES3, attr3.get().getBytes() ) );

    attr3.remove( BYTES3 );
    assertNull( attr2.get() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:40,代码来源:SchemaAwareAttributeTest.java

示例8: testContainsValueArray

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

    assertEquals( 0, attr1.size() );
    assertFalse( attr1.contains( stringValue1 ) );
    assertFalse( attr1.contains( nullStringValue ) );

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

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

    attr1.add( "a", "b", "c" );
    assertEquals( 3, attr1.size() );
    assertTrue( attr1.contains( stringValue1 ) );
    assertTrue( attr1.contains( stringValue2 ) );
    assertTrue( attr1.contains( stringValue3 ) );
    assertTrue( attr1.contains( stringValue1, stringValue3 ) );
    assertFalse( attr1.contains( stringValue4 ) );
    assertFalse( attr1.contains( nullStringValue ) );

    Attribute attr2 = new DefaultAttribute( atPwd );
    assertEquals( 0, attr2.size() );
    assertFalse( attr2.contains( BYTES1 ) );
    assertFalse( attr2.contains( nullBinaryValue ) );

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

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

    attr2.add( BYTES1, BYTES2, BYTES3 );
    assertEquals( 3, attr2.size() );
    assertTrue( attr2.contains( binaryValue1 ) );
    assertTrue( attr2.contains( binaryValue2 ) );
    assertTrue( attr2.contains( binaryValue3 ) );
    assertFalse( attr2.contains( nullBinaryValue ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:50,代码来源:SchemaAwareAttributeTest.java


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