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


Java LdifEntry.getControl方法代码示例

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


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

示例1: testLdifParserChangeTypeDeleteWithControl

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a Delete changeType LdifEntry with one control
 * 
 * @throws Exception
 */
@Test
public void testLdifParserChangeTypeDeleteWithControl() throws Exception
{
    String ldif =
        "# Delete an entry. The operation will attach the LDAPv3\n" +
            "# Tree Delete Control defined in [9]. The criticality\n" +
            "# field is \"true\" and the controlValue field is\n" +
            "# absent, as required by [9].\n" +
            "control: 1.2.840.113556.1.4.805 true\n" +
            "changetype: delete\n";

    LdifEntry ldifEntry = new LdifEntry( "ou=Product Development, dc=airius, dc=com", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.Delete, ldifEntry.getChangeType() );
    assertNull( ldifEntry.getEntry() );
    assertEquals( "ou=Product Development, dc=airius, dc=com", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:31,代码来源:LdifEntryTest.java

示例2: testLdifParserChangeTypeDeleteWithControls

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a Delete changeType LdifEntry with controls
 * 
 * @throws Exception
 */
@Test
public void testLdifParserChangeTypeDeleteWithControls() throws Exception
{
    String ldif =
        "# Delete an entry. The operation will attach the LDAPv3\n" +
            "# Tree Delete Control defined in [9]. The criticality\n" +
            "# field is \"true\" and the controlValue field is\n" +
            "# absent, as required by [9].\n" +
            "control: 1.2.840.113556.1.4.805 true\n" +
            "control: 1.2.840.113556.1.4.806 false: test\n" +
            "changetype: delete\n";

    LdifEntry ldifEntry = new LdifEntry( "ou=Product Development, dc=airius, dc=com", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.Delete, ldifEntry.getChangeType() );
    assertNull( ldifEntry.getEntry() );
    assertEquals( "ou=Product Development, dc=airius, dc=com", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );

    ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.806" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.806", ldifControl.getOid() );
    assertFalse( ldifControl.isCritical() );
    assertNotNull( ldifControl.getValue() );
    assertEquals( "test", Strings.utf8ToString( ldifControl.getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:39,代码来源:LdifEntryTest.java

示例3: testLdifEntryChangeTypeAddWithControl

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a Add changeType LdifEntry with a control
 * @throws Exception
 */
@Test
public void testLdifEntryChangeTypeAddWithControl() throws Exception
{
    String ldif =
        "control: 1.2.840.113556.1.4.805 true\n" +
            "changetype: add\n" +
            "cn: app1\n" +
            "objectClass: top\n" +
            "objectClass: apApplication\n" +
            "displayName:   app1   \n" +
            "dependencies:\n" +
            "envVars:";

    LdifEntry ldifEntry = new LdifEntry( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.Add, ldifEntry.getChangeType() );
    assertNotNull( ldifEntry.getEntry() );
    assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.isLdifChange() );

    Attribute attr = ldifEntry.get( "displayname" );
    assertTrue( attr.contains( "app1" ) );
    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:LdifEntryTest.java

示例4: testLdifEntryChangeTypeAddWithControls

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a Add changeType LdifEntry with controls
 * @throws Exception
 */
@Test
public void testLdifEntryChangeTypeAddWithControls() throws Exception
{
    String ldif =
        "control: 1.2.840.113556.1.4.805 true\n" +
            "control: 1.2.840.113556.1.4.806 false: test\n" +
            "changetype: add\n" +
            "cn: app1\n" +
            "objectClass: top\n" +
            "objectClass: apApplication\n" +
            "displayName:   app1   \n" +
            "dependencies:\n" +
            "envVars:";

    LdifEntry ldifEntry = new LdifEntry( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.Add, ldifEntry.getChangeType() );
    assertNotNull( ldifEntry.getEntry() );
    assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.isLdifChange() );

    Attribute attr = ldifEntry.get( "displayname" );
    assertTrue( attr.contains( "app1" ) );
    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );

    ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.806" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.806", ldifControl.getOid() );
    assertFalse( ldifControl.isCritical() );
    assertNotNull( ldifControl.getValue() );
    assertEquals( "test", Strings.utf8ToString( ldifControl.getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:44,代码来源:LdifEntryTest.java

示例5: testLdifEntryChangeTypeModdnWithControl

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a ModDn changeType LdifEntry with a control
 * @throws Exception
 */
@Test
public void testLdifEntryChangeTypeModdnWithControl() throws Exception
{
    String ldif =
        "control: 1.2.840.113556.1.4.805 true\n" +
            "changetype: moddn\n" +
            "newrdn: cn=app2\n" +
            "deleteoldrdn: 1\n";

    LdifEntry ldifEntry = new LdifEntry( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.ModDn, ldifEntry.getChangeType() );
    assertNull( ldifEntry.getEntry() );
    assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.isLdifChange() );
    assertEquals( "cn=app2", ldifEntry.getNewRdn() );
    assertNull( ldifEntry.getNewSuperior() );
    assertTrue( ldifEntry.isDeleteOldRdn() );

    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:LdifEntryTest.java

示例6: testLdifEntryChangeTypeModddnWithControls

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a ModDN changeType LdifEntry with controls
 * @throws Exception
 */
@Test
public void testLdifEntryChangeTypeModddnWithControls() throws Exception
{
    String ldif =
        "control: 1.2.840.113556.1.4.805 true\n" +
            "control: 1.2.840.113556.1.4.806 false: test\n" +
            "changetype: moddn\n" +
            "newrdn: cn=app2\n" +
            "deleteoldrdn: 1\n";

    LdifEntry ldifEntry = new LdifEntry( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.ModDn, ldifEntry.getChangeType() );
    assertNull( ldifEntry.getEntry() );
    assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.isLdifChange() );
    assertEquals( "cn=app2", ldifEntry.getNewRdn() );
    assertTrue( ldifEntry.isDeleteOldRdn() );
    assertNull( ldifEntry.getNewSuperior() );
    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );

    ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.806" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.806", ldifControl.getOid() );
    assertFalse( ldifControl.isCritical() );
    assertNotNull( ldifControl.getValue() );
    assertEquals( "test", Strings.utf8ToString( ldifControl.getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:40,代码来源:LdifEntryTest.java

示例7: testLdifEntryChangeTypeModifyNoAttributeWithControls

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a Modify changeType LdifEntry with no attributes and controls
 */
@Test
public void testLdifEntryChangeTypeModifyNoAttributeWithControls() throws Exception
{
    String ldif =
        "control: 1.2.840.113556.1.4.805 true\n" +
            "control: 1.2.840.113556.1.4.806 false: test\n" +
            "changetype: modify\n" +
            "add: cn\n" +
            "-";

    LdifEntry ldifEntry = new LdifEntry( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldif );

    assertNotNull( ldifEntry );
    assertEquals( ChangeType.Modify, ldifEntry.getChangeType() );
    assertNull( ldifEntry.getEntry() );
    assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", ldifEntry.getDn().getName() );
    assertTrue( ldifEntry.isLdifChange() );

    // Check the modification
    assertNotNull( ldifEntry.getModifications() );

    for ( Modification modification : ldifEntry.getModifications() )
    {
        assertEquals( ModificationOperation.ADD_ATTRIBUTE, modification.getOperation() );
        Attribute attribute = modification.getAttribute();

        assertNotNull( attribute );
        assertEquals( "cn", attribute.getId() );
        assertEquals( 1, attribute.size() );
        assertTrue( attribute.get().isNull() );
    }

    assertTrue( ldifEntry.hasControls() );

    LdifControl ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.805" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.805", ldifControl.getOid() );
    assertTrue( ldifControl.isCritical() );
    assertNull( ldifControl.getValue() );

    ldifControl = ldifEntry.getControl( "1.2.840.113556.1.4.806" );
    assertNotNull( ldifControl );
    assertEquals( "1.2.840.113556.1.4.806", ldifControl.getOid() );
    assertFalse( ldifControl.isCritical() );
    assertNotNull( ldifControl.getValue() );
    assertEquals( "test", Strings.utf8ToString( ldifControl.getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:51,代码来源:LdifEntryTest.java


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