本文整理汇总了Java中org.apache.directory.api.ldap.model.entry.DefaultEntry类的典型用法代码示例。如果您正苦于以下问题:Java DefaultEntry类的具体用法?Java DefaultEntry怎么用?Java DefaultEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultEntry类属于org.apache.directory.api.ldap.model.entry包,在下文中一共展示了DefaultEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: useBundleClasses
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的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: createEntry
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Helper method which creates an entry with 4 attributes.
*/
private Entry createEntry()
{
try
{
Entry entry = new DefaultEntry( exampleDn );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
entry.put( attrOC, attrCN, attrSN, attrPWD );
return entry;
}
catch ( LdapException ne )
{
// Do nothing
return null;
}
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:SchemaAwareEntryTest.java
示例3: testDefaultClientEntryLdif
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for DefaultEntry()
*/
@Test
public void testDefaultClientEntryLdif() throws Exception
{
Entry entry = new DefaultEntry(
"ou=example, dc=com",
"ObjectClass: top",
"ObjectClass: person",
"cn: test",
"sn: test" );
assertNotNull( entry );
assertEquals( "ou=example, dc=com", entry.getDn().toString() );
assertEquals( 3, entry.size() );
assertTrue( entry.contains( "objectClass", "top", "person" ) );
assertTrue( entry.contains( "cn", "test" ) );
assertTrue( entry.contains( "sn", "test" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:SchemaAwareEntryTest.java
示例4: testAddStringByteArrayArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for add( String, byte[]... )
*/
@Test
public void testAddStringByteArrayArray() throws LdapException
{
Entry entry = new DefaultEntry();
entry.add( "userPassword", ( byte[] ) null );
assertEquals( 1, entry.size() );
Attribute attributePWD = entry.get( "userPassword" );
assertEquals( 1, attributePWD.size() );
assertNotNull( attributePWD.get() );
assertNull( attributePWD.get().getBytes() );
entry.add( "jpegPhoto", BYTES1, BYTES1, BYTES2 );
assertEquals( 2, entry.size() );
Attribute attributeJPG = entry.get( "jpegPhoto" );
assertEquals( 2, attributeJPG.size() );
assertNotNull( attributeJPG.get() );
assertTrue( attributeJPG.contains( BYTES1 ) );
assertTrue( attributeJPG.contains( BYTES2 ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaAwareEntryTest.java
示例5: testAddStringStringArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for add( String, String... )
*/
@Test
public void testAddStringStringArray() throws LdapException
{
Entry entry = new DefaultEntry();
entry.add( "cn", ( String ) null );
assertEquals( 1, entry.size() );
Attribute attributeCN = entry.get( "cn" );
assertEquals( 1, attributeCN.size() );
assertNotNull( attributeCN.get() );
assertNull( attributeCN.get().getValue() );
entry.add( "sn", "test", "test", "TEST" );
assertEquals( 2, entry.size() );
Attribute attributeSN = entry.get( "sn" );
assertEquals( 2, attributeSN.size() );
assertNotNull( attributeSN.get() );
assertTrue( attributeSN.contains( "test" ) );
assertTrue( attributeSN.contains( "TEST" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaAwareEntryTest.java
示例6: testClear
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for clear()
*/
@Test
public void testClear() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertEquals( 0, entry.size() );
assertNull( entry.get( "ObjectClass" ) );
entry.clear();
assertEquals( 0, entry.size() );
assertNull( entry.get( "ObjectClass" ) );
entry.add( "ObjectClass", "top", "person" );
assertEquals( 1, entry.size() );
assertNotNull( entry.get( "ObjectClass" ) );
entry.clear();
assertEquals( 0, entry.size() );
assertNull( entry.get( "ObjectClass" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:23,代码来源:SchemaAwareEntryTest.java
示例7: testContainsEntryAttributeArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for contains( EntryAttribute... )
*/
@Test
public void testContainsEntryAttributeArray() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
assertFalse( entry.contains( attrOC, attrCN ) );
entry.add( attrOC, attrCN );
assertTrue( entry.contains( attrOC, attrCN ) );
assertFalse( entry.contains( attrOC, attrCN, attrSN ) );
entry.add( attrSN, attrPWD );
assertTrue( entry.contains( attrSN, attrPWD ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:SchemaAwareEntryTest.java
示例8: testContainsStringByteArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for contains( String, byte[]... )
*/
@Test
public void testContainsStringByteArray() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertFalse( entry.containsAttribute( "objectClass" ) );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );
entry.add( attrPWD );
assertTrue( entry.contains( " userPASSWORD ", BYTES1, BYTES2 ) );
assertTrue( entry.contains( " userPASSWORD ", ( byte[] ) null ) );
// We can search for byte[] using Strings. the strings will be converted to byte[]
assertTrue( entry.contains( " userPASSWORD ", "ab", "b" ) );
assertFalse( entry.contains( " userPASSWORD ", "ab", "b", "d" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:23,代码来源:SchemaAwareEntryTest.java
示例9: testContainsStringStringArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for contains( String, String... )
*/
@Test
public void testContainsStringStringArray() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertFalse( entry.containsAttribute( "objectClass" ) );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2", ( String ) null );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
entry.add( attrOC, attrCN, attrSN, attrPWD );
assertTrue( entry.contains( "OBJECTCLASS", "top", "person" ) );
assertTrue( entry.contains( " cn ", "test1", "test2" ) );
assertTrue( entry.contains( "Sn", "Test1", "Test2", ( String ) null ) );
assertTrue( entry.contains( " userPASSWORD ", "ab", "b" ) );
assertFalse( entry.contains( "OBJECTCLASS", "PERSON" ) );
assertFalse( entry.contains( " cn ", "test1", "test3" ) );
assertFalse( entry.contains( "Sn", "Test" ) );
assertFalse( entry.contains( " userPASSWORD ", ( String ) null ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:SchemaAwareEntryTest.java
示例10: testGet
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for get( String )
*/
@Test
public void testGet() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertNull( entry.get( "objectClass" ) );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
entry.add( attrOC, attrCN, attrSN, attrPWD );
assertNotNull( entry.get( " CN " ) );
Attribute attribute = entry.get( "cN" );
assertEquals( attribute, attrCN );
assertNull( entry.get( ( String ) null ) );
assertNull( entry.get( " " ) );
assertNull( entry.get( "l" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:SchemaAwareEntryTest.java
示例11: testHasObjectClass
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for hasObjectClass( String )
*/
@Test
public void testHasObjectClass() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertFalse( entry.containsAttribute( "objectClass" ) );
assertFalse( entry.hasObjectClass( "top" ) );
entry.add( new DefaultAttribute( "objectClass", "top", "person" ) );
assertTrue( entry.hasObjectClass( "top" ) );
assertTrue( entry.hasObjectClass( "person" ) );
assertFalse( entry.hasObjectClass( "inetorgperson" ) );
assertFalse( entry.hasObjectClass( ( String ) null ) );
assertFalse( entry.hasObjectClass( "" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:20,代码来源:SchemaAwareEntryTest.java
示例12: testRemoveAttributesStringArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for removeAttributes( String... )
*/
@Test
public void testRemoveAttributesStringArray() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
entry.put( attrOC, attrCN, attrSN, attrPWD );
entry.removeAttributes( "CN", "SN" );
assertFalse( entry.containsAttribute( "cn", "sn" ) );
assertTrue( entry.containsAttribute( "objectclass", "userpassword" ) );
entry.removeAttributes( "badId" );
entry.removeAttributes( ( String ) null );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:SchemaAwareEntryTest.java
示例13: testRemoveStringByteArrayArray
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for remove(String, byte[]... )
*/
@Test
public void testRemoveStringByteArrayArray() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );
entry.put( attrPWD );
assertTrue( entry.remove( "userPassword", ( byte[] ) null ) );
assertTrue( entry.remove( "userPassword", BYTES1, BYTES2 ) );
assertFalse( entry.containsAttribute( "userPassword" ) );
entry.add( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );
assertTrue( entry.remove( "userPassword", ( byte[] ) null ) );
assertEquals( 2, entry.get( "userPassword" ).size() );
assertTrue( entry.remove( "userPassword", BYTES1, BYTES3 ) );
assertEquals( 1, entry.get( "userPassword" ).size() );
assertTrue( Arrays.equals( BYTES2, entry.get( "userPassword" ).getBytes() ) );
assertFalse( entry.remove( "userPassword", BYTES3 ) );
assertFalse( entry.remove( "void", "whatever" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:SchemaAwareEntryTest.java
示例14: testSize
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for size()
*/
@Test
public void testSize() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertEquals( 0, entry.size() );
entry.add( "ObjectClass", "top", "person" );
entry.add( "cn", "test" );
entry.add( "sn", "Test" );
assertEquals( 3, entry.size() );
entry.clear();
assertEquals( 0, entry.size() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:SchemaAwareEntryTest.java
示例15: testSerializeCompleteEntry
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test the serialization of a complete entry
*/
@Test
public void testSerializeCompleteEntry() throws LdapException, IOException, ClassNotFoundException
{
Dn dn = new Dn( schemaManager, "ou=system" );
byte[] password = Strings.getBytesUtf8( "secret" );
Entry entry = new DefaultEntry( dn );
entry.add( "ObjectClass", "top", "person" );
entry.add( "cn", "test1" );
entry.add( "userPassword", password );
Entry entrySer = deserializeValue( serializeValue( entry ) );
assertEquals( entry, entrySer );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:SchemaAwareEntryTest.java
示例16: testUserCertificateBinary
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test method for userCertificate;binary AT
*/
@Test
public void testUserCertificateBinary() throws LdapException
{
Entry entry = new DefaultEntry( schemaManager );
entry.add( "objectClass", "top", "person", "inetorgPerson" );
entry.add( "cn", "test1", "test2" );
entry.add( "sn", "Test1", "Test2" );
entry.add( "userPassword", BYTES1, BYTES2 );
entry.add( "userCertificate;binary", Strings.getBytesUtf8( "secret" ) );
assertTrue( entry.containsAttribute( "userCertificate;binary" ) );
assertTrue( entry.containsAttribute( "userCertificate" ) );
entry.removeAttributes( "userCertificate;binary" );
assertFalse( entry.containsAttribute( "userCertificate;binary" ) );
assertFalse( entry.containsAttribute( "userCertificate" ) );
entry.add( "userCertificate", Strings.getBytesUtf8( "secret" ) );
assertTrue( entry.containsAttribute( "userCertificate;binary" ) );
assertTrue( entry.containsAttribute( "userCertificate" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:SchemaAwareEntryTest.java
示例17: testApplyAddModificationToEntry
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test a addModification applied to an entry
*/
@Test
public void testApplyAddModificationToEntry() throws LdapException
{
Entry entry = new DefaultEntry();
entry.add( "dc", "apache" );
assertEquals( 1, entry.size() );
Attribute attr = new DefaultAttribute( "cn", "test" );
Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
AttributeUtils.applyModification( entry, modification );
assertNotNull( entry.get( "cn" ) );
assertEquals( 2, entry.size() );
assertEquals( attr, entry.get( "cn" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:AttributeUtilsTest.java
示例18: testApplyRemoveModificationFromEntryAttributeNotPresent
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test the deletion of an attribute into an entry which does not contain the attribute
*/
@Test
public void testApplyRemoveModificationFromEntryAttributeNotPresent() throws LdapException
{
Entry entry = new DefaultEntry();
Attribute dc = new DefaultAttribute( "dc", "apache" );
entry.put( dc );
Attribute cn = new DefaultAttribute( "cn", "test" );
Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, cn );
AttributeUtils.applyModification( entry, modification );
assertNull( entry.get( "cn" ) );
assertNotNull( entry.get( "dc" ) );
assertEquals( 1, entry.size() );
assertEquals( dc, entry.get( "dc" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:23,代码来源:AttributeUtilsTest.java
示例19: testApplyRemoveModificationFromEntryAttributeNotSameValue
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test the deletion of an attribute into an entry which contains the attribute
* but without the value to be deleted
*/
@Test
public void testApplyRemoveModificationFromEntryAttributeNotSameValue() throws LdapException
{
Entry entry = new DefaultEntry();
Attribute cn = new DefaultAttribute( "cn", "apache" );
entry.put( cn );
Attribute attr = new DefaultAttribute( "cn", "test" );
Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
AttributeUtils.applyModification( entry, modification );
assertNotNull( entry.get( "cn" ) );
assertEquals( 1, entry.size() );
assertEquals( cn, entry.get( "cn" ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:23,代码来源:AttributeUtilsTest.java
示例20: testApplyRemoveModificationFromEntrySameAttributeSameValue
import org.apache.directory.api.ldap.model.entry.DefaultEntry; //导入依赖的package包/类
/**
* Test the deletion of an attribute into an entry which contains the attribute.
*
* The entry should not contain the attribute after the operation
*/
@Test
public void testApplyRemoveModificationFromEntrySameAttributeSameValue() throws LdapException
{
Entry entry = new DefaultEntry();
entry.put( "cn", "test" );
Attribute attr = new DefaultAttribute( "cn", "test" );
Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
AttributeUtils.applyModification( entry, modification );
assertNull( entry.get( "cn" ) );
assertEquals( 0, entry.size() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:AttributeUtilsTest.java
注:本文中的org.apache.directory.api.ldap.model.entry.DefaultEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论