Package org.apache.directory.shared.ldap.ldif

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry


     * @throws NamingException if there are problems
     */
    @Test
    public void testNoRdnChangesOnAdminByNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();

        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );

        try
        {
            service.getAdminSession().rename(
                new LdapDN( "uid=admin,ou=system" ),
View Full Code Here


     * @throws NamingException on error
     */
    @Test
    public void testModifyOnAdminByNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
       
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
       
        // Read the entry we just created using the akarasuluSession
        Entry readEntry = service.getAdminSession().lookup( akarasulu.getDn(), new String[]{ "userPassword"} );
       
        assertTrue( Arrays.equals( akarasulu.get( "userPassword" ).getBytes(), readEntry.get( "userPassword" ).getBytes() ) );

        EntryAttribute attribute = new DefaultClientAttribute( "userPassword", "replaced" );

        List<Modification> mods = new ArrayList<Modification>();
       
View Full Code Here

     * @throws NamingException if there are problems
     */
    @Test
    public void testNoSearchByNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
       
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );

        try
        {
            ExprNode filter = FilterParser.parse( "(objectClass=*)" );
            service.getAdminSession().search( new LdapDN( "ou=system" ), SearchScope.SUBTREE, filter , AliasDerefMode.DEREF_ALWAYS, null );
View Full Code Here

     * @throws NamingException on error
     */
    @Test
    public void testConfirmNonAdminUserDnIsCreatorsName() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getSystemContext( service );
        createData( sysRoot );

        Attributes attributes = sysRoot.getAttributes( "uid=akarasulu,ou=users", new String[]
View Full Code Here

    @Test
    public void testLogCheckRevision() throws Exception
    {
        assertEquals( "first revision is always 0", 0, store.getCurrentRevision() );

        LdifEntry forward = new LdifEntry();
        forward.setDn( "ou=system" );
        forward.setChangeType( ChangeType.Add );
        forward.putAttribute( "objectClass", "organizationalUnit" );
        forward.putAttribute( "ou", "system" );

        LdifEntry reverse = LdifRevertor.reverseAdd( new LdapDN( forward.getDn() ) );
        assertEquals( 1, store.log( new LdapPrincipal(), forward, reverse ).getRevision() );
        assertEquals( 1, store.getCurrentRevision() );
    }
View Full Code Here

        systemDn.normalize( oidsMap );
       
        LdapDN adminDn = new LdapDN( "uid=admin, ou=system" );
        adminDn.normalize( oidsMap );

        LdifEntry forward = new LdifEntry();
        forward.setDn( systemDn );
        forward.setChangeType( ChangeType.Add );
        forward.putAttribute( "objectClass", "organizationalUnit" );
        forward.putAttribute( "ou", "system" );
       
        LdapDN reverseDn = new LdapDN( forward.getDn() );
        reverseDn.normalize( oidsMap );

        LdifEntry reverse = LdifRevertor.reverseAdd( reverseDn );

        String zuluTime = DateUtils.getGeneralizedTime();
        long revision = 1L;
       
        LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.SIMPLE, StringTools.getBytesUtf8( "secret"  ) );
View Full Code Here

     *
     * @throws NamingException on error
     */
    protected void createData() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getSystemContext( service );

        /*
         * create ou=testing00,ou=system
View Full Code Here

            "m-obsolete: FALSE\n" +
            "m-description: A ship\n";

        StringReader in = new StringReader( numberOfGunsAttrLdif + "\n\n" + shipOCLdif );
        LdifReader ldifReader = new LdifReader( in );
        LdifEntry numberOfGunsAttrEntry = ldifReader.next();
        LdifEntry shipOCEntry = ldifReader.next();
        assertFalse( ldifReader.hasNext() );
       
        // should be fine with unique OID
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), numberOfGunsAttrEntry.getEntry() ) );

        // should blow chuncks using same OID
        try
        {
            service.getAdminSession().add(
                new DefaultServerEntry( service.getRegistries(), shipOCEntry.getEntry() ) );
           
            fail( "Should not be possible to create two schema entities with the same OID." );
        }
        catch( NamingException e )
        {
View Full Code Here


    @Test
    public void testListSystemAsNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getContext( akarasulu.getDn().getUpName(), service, "ou=system" );
        HashSet<String> set = new HashSet<String>();
        NamingEnumeration<NameClassPair> list = sysRoot.list( "" );

        while ( list.hasMore() )
        {
View Full Code Here


    @Test
    public void testListUsersAsNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getContext( akarasulu.getDn().getUpName(), service, "ou=system" );
        HashSet<String> set = new HashSet<String>();
        NamingEnumeration<NameClassPair> list = sysRoot.list( "ou=users" );

        while ( list.hasMore() )
        {
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.ldif.LdifEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.