Examples of DeleteOperationBasis


Examples of org.nasutekds.server.core.DeleteOperationBasis

         baseDn.toString());
     logError(message);
   }
   // In any case, remove the RUV entry
   // if it exists
   DeleteOperationBasis del =  new DeleteOperationBasis(conn,
       InternalClientConnection.nextOperationID(),
       InternalClientConnection.nextMessageID(), null,
       ByteString.valueOf(ruvEntry.getDN().toNormalizedString()));

   // Run the internal operation
   del.setInternalOperation(true);
   del.setSynchronizationOperation(true);
   del.setDontSynchronize(true);
   del.run();

   return genId;
  }
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

  {
    DN schemaDN = DN.decode("cn=schema");

    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    DeleteOperationBasis deleteOperation =
         new DeleteOperationBasis(conn, conn.nextOperationID(), conn.nextMessageID(),
                             null, schemaDN);

    schemaBackend.deleteEntry(schemaDN, deleteOperation);
  }
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

    }


    // Try to delete the operation.  If this fails, then delete it with a root
    // connection so it gets cleaned up.
    DeleteOperationBasis deleteOperation =
         new DeleteOperationBasis(conn,
        conn.nextOperationID(), conn.nextMessageID(), controls, newEntryDN);
    deleteOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS);
    }
    else
    {
      assertEquals(deleteOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED);

      InternalClientConnection rootConnection =
           InternalClientConnection.getRootConnection();
      DeleteOperation delOp = rootConnection.processDelete(newEntryDN);
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

    }


    // Try to delete the operation.  If this fails, then delete it with a root
    // connection so it gets cleaned up.
    DeleteOperationBasis deleteOperation =
         new DeleteOperationBasis(conn,
        conn.nextOperationID(), conn.nextMessageID(), controls, newEntryDN);
    deleteOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS,
                   "Unexpected delete failure for user " + authDN);
    }
    else
    {
      assertEquals(deleteOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED,
                   "Unexpected delete success for user " + authDN);

      InternalClientConnection rootConnection =
           InternalClientConnection.getRootConnection();
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

    }


    // Try to delete the operation.  If this fails, then delete it with a root
    // connection so it gets cleaned up.
    DeleteOperationBasis deleteOperation =
         new DeleteOperationBasis(conn, conn.nextOperationID(), conn.nextMessageID(),
                             controls, newEntryDN);
    deleteOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS);
    }
    else
    {
      assertEquals(deleteOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED);

      InternalClientConnection rootConnection =
           InternalClientConnection.getRootConnection();
      DeleteOperation delOp = rootConnection.processDelete(newEntryDN);
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

    }


    // Try to delete the operation.  If this fails, then delete it with a root
    // connection so it gets cleaned up.
    DeleteOperationBasis deleteOperation =
         new DeleteOperationBasis(conn, conn.nextOperationID(), conn.nextMessageID(),
                             controls, newEntryDN);
    deleteOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS,
                   "Unexpected delete failure for user " + authDN);
    }
    else
    {
      assertEquals(deleteOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED,
                   "Unexpected delete success for user " + authDN);

      InternalClientConnection rootConnection =
           InternalClientConnection.getRootConnection();
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

      assertTrue(DN.decode(moddnMsg.getDn()).compareTo(personEntry.getDN()) == 0,
      "The received MODIFY_DN message is not for the excepted DN : " + moddnMsg);

      // Delete the entry
      DeleteOperationBasis delOp = new DeleteOperationBasis(connection,
          InternalClientConnection.nextOperationID(), InternalClientConnection
          .nextMessageID(), null, DN
          .decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING));
      delOp.run();
      assertFalse(DirectoryServer.entryExists(newDN),
      "Unable to delete the new person Entry");

      // See if the client has received the msg
      msg = broker.receive();
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

    // Clean replication server database from previous run
    cleanUpReplicationServersDB();

    DN dn = DN.decode("cn=No Such Object,ou=People," + TEST_ROOT_DN_STRING);
    DeleteOperationBasis op =
         new DeleteOperationBasis(connection,
                             InternalClientConnection.nextOperationID(),
                             InternalClientConnection.nextMessageID(), null,
                             dn);
    op.run();
    assertEquals(op.getResultCode(), ResultCode.NO_SUCH_OBJECT);
  }
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

  {
    String tn = "ECLIncludeAttributes";
    debugInfo(tn, "Starting test\n\n");
    Backend backend2 = null;
    Backend backend3 = null;
    DeleteOperationBasis delOp =null;
    LDAPReplicationDomain domain2 = null;
    LDAPReplicationDomain domain3 = null;
    LDAPReplicationDomain domain21 = null;
    DN baseDn2 = null;
    DN baseDn3 = null;
    try
    {
      // Initialize a second test backend o=test2, in addtion to o=test
      // Configure replication on this backend
      // Add the root entry in the backend
      backend2 = initializeTestBackend(false,
          TEST_ROOT_DN_STRING2, TEST_BACKEND_ID2);
      baseDn2 = DN.decode(TEST_ROOT_DN_STRING2);
      SortedSet<String> replServers = new TreeSet<String>();
      replServers.add("localhost:"+replicationServerPort);
      DomainFakeCfg domainConf =
        new DomainFakeCfg(baseDn2, 1702, replServers);

      // on o=test2,sid=1702 include attrs set to : 'sn'
      SortedSet<AttributeType> eclInclude = new TreeSet<AttributeType>();
      eclInclude.add(DirectoryServer.getAttributeType("sn"));
      eclInclude.add(DirectoryServer.getAttributeType("roomnumber"));
      ExternalChangelogDomainFakeCfg eclCfg =
        new ExternalChangelogDomainFakeCfg(true, eclInclude);
      domainConf.setExternalChangelogDomain(eclCfg);
      // Set a Changetime heartbeat interval low enough (less than default
      // value that is 1000 ms) for the test to be sure to consider all changes
      // as eligible.
      domainConf.setChangetimeHeartbeatInterval(10);
      domain2 = MultimasterReplication.createNewDomain(domainConf);
      domain2.start();

      backend3 = initializeTestBackend(false,
          TEST_ROOT_DN_STRING3, TEST_BACKEND_ID3);
      baseDn3 = DN.decode(TEST_ROOT_DN_STRING3);
      domainConf =
        new DomainFakeCfg(baseDn3, 1703, replServers);

      // on o=test3,sid=1703 include attrs set to : 'objectclass'
      eclInclude = new TreeSet<AttributeType>();
      eclInclude.add(DirectoryServer.getAttributeType("objectclass"));
      eclCfg =
        new ExternalChangelogDomainFakeCfg(true, eclInclude);
      domainConf.setExternalChangelogDomain(eclCfg);
      // Set a Changetime heartbeat interval low enough (less than default
      // value that is 1000 ms) for the test to be sure to consider all changes
      // as eligible.
      domainConf.setChangetimeHeartbeatInterval(10);
      domain3 = MultimasterReplication.createNewDomain(domainConf);
      domain3.start();

      // on o=test2,sid=1704 include attrs set to : 'cn'
      domainConf =
        new DomainFakeCfg(baseDn2, 1704, replServers);
      eclInclude = new TreeSet<AttributeType>();
      eclInclude.add(DirectoryServer.getAttributeType("cn"));
      eclCfg =
        new ExternalChangelogDomainFakeCfg(true, eclInclude);
      domainConf.setExternalChangelogDomain(eclCfg);
      // Set a Changetime heartbeat interval low enough (less than default
      // value that is 1000 ms) for the test to be sure to consider all changes
      // as eligible.
      domainConf.setChangetimeHeartbeatInterval(10);
      domain21 = MultimasterReplication.createNewDomain(domainConf);
      domain21.start();

      sleep(1000);

      Entry e2 = createEntry(baseDn2);
      addEntry(e2);

      Entry e3 = createEntry(baseDn3);
      addEntry(e3);

      String lentry = new String(
          "dn: cn=Fiona Jensen," + TEST_ROOT_DN_STRING2 + "\n"
          + "objectclass: top\n"
          + "objectclass: person\n"
          + "objectclass: organizationalPerson\n"
          + "objectclass: inetOrgPerson\n"
          + "cn: Fiona Jensen\n"
          + "sn: Jensen\n"
          + "uid: fiona\n"
          + "telephonenumber: 12121212");

      Entry uentry1 = TestCaseUtils.entryFromLdifString(lentry);
      addEntry(uentry1); // add fiona in o=test2

      lentry = new String(
          "dn: cn=Robert Hue," + TEST_ROOT_DN_STRING3 + "\n"
          + "objectclass: top\n"
          + "objectclass: person\n"
          + "objectclass: organizationalPerson\n"
          + "objectclass: inetOrgPerson\n"
          + "cn: Robert Hue\n"
          + "sn: Robby\n"
          + "uid: robert\n"
          + "telephonenumber: 131313");
      Entry uentry2 = TestCaseUtils.entryFromLdifString(lentry);
      addEntry(uentry2); // add robert in o=test3

      // mod 'sn' of fiona (o=test2) with 'sn' configured as ecl-incl-att
      AttributeBuilder builder = new AttributeBuilder("sn");
      builder.add("newsn");
      Modification mod =
        new Modification(ModificationType.REPLACE, builder.toAttribute());
      List<Modification> mods = new ArrayList<Modification>();
      mods.add(mod);
      ModifyOperationBasis modOpBasis =
        new ModifyOperationBasis(connection, 1, 1, null, uentry1.getDN(), mods);
      modOpBasis.run();
      waitOpResult(modOpBasis, ResultCode.SUCCESS);

      // mod 'telephonenumber' of robert (o=test3)
      builder = new AttributeBuilder("telephonenumber");
      builder.add("555555");
      mod =
        new Modification(ModificationType.REPLACE, builder.toAttribute());
      mods = new ArrayList<Modification>();
      mods.add(mod);
      ModifyOperationBasis modOpBasis2 =
        new ModifyOperationBasis(connection, 1, 1, null, uentry2.getDN(), mods);
      modOpBasis2.run();
      waitOpResult(modOpBasis2, ResultCode.SUCCESS);

      // moddn robert (o=test3) to robert2 (o=test3)
      ModifyDNOperationBasis modDNOp = new ModifyDNOperationBasis(connection,
          InternalClientConnection.nextOperationID(),
          InternalClientConnection.nextMessageID(),
          null,
          DN.decode("cn=Robert Hue," + TEST_ROOT_DN_STRING3),
          RDN.decode("cn=Robert Hue2"), true,
          DN.decode(TEST_ROOT_DN_STRING3));
      modDNOp.run();
      waitOpResult(modDNOp, ResultCode.SUCCESS);

      // del robert (o=test3)
      delOp = new DeleteOperationBasis(connection,
          InternalClientConnection.nextOperationID(),
          InternalClientConnection.nextMessageID(), null,
          DN.decode("cn=Robert Hue2," + TEST_ROOT_DN_STRING3));
      delOp.run();
      waitOpResult(delOp, ResultCode.SUCCESS);

      getEntry(DN.decode("cn=Robert Hue2," + TEST_ROOT_DN_STRING3),5000,false);

      // Search on ECL from start on all suffixes
      String cookie = "";
      ExternalChangelogRequestControl control =
        new ExternalChangelogRequestControl(true,
            new MultiDomainServerState(cookie));
      ArrayList<Control> controls = new ArrayList<Control>(0);
      controls.add(control);
      LinkedHashSet<String> attributes = new LinkedHashSet<String>();
      attributes.add("+");
      attributes.add("*");

      sleep(1000);
      debugInfo(tn, "Search with cookie=" + cookie);
      InternalSearchOperation searchOp = connection.processSearch(
          ByteString.valueOf("cn=changelog"),
          SearchScope.WHOLE_SUBTREE,
          DereferencePolicy.NEVER_DEREF_ALIASES,
          0, // Size limit
          0, // Time limit
          false, // Types only
          LDAPFilter.decode("(targetDN=*)"),
          attributes,
          controls,
          null);

      waitOpResult(searchOp, ResultCode.SUCCESS);
      LinkedList<SearchResultEntry> entries = searchOp.getSearchEntries();

      sleep(2000);

      assertTrue(entries != null);
      String s = tn + " entries returned= ";
      if (entries != null)
      {
        for (SearchResultEntry resultEntry : entries)
        {
          // Expect
          debugInfo(tn, "Entry returned =" +  resultEntry.toLDIFString());
          s += "Entry:" + resultEntry.toLDIFString();

          String targetdn = getAttributeValue(resultEntry, "targetdn");
          if ((targetdn.endsWith("cn=robert hue,o=test3"))
            ||(targetdn.endsWith("cn=robert hue2,o=test3")))
          {
            HashSet<String> eoc = new HashSet<String>();
            eoc.add("person");eoc.add("inetOrgPerson");eoc.add("organizationalPerson");eoc.add("top");
            checkValues(resultEntry,"targetobjectclass",eoc);
          }
          if (targetdn.endsWith("cn=fiona jensen,o=test2"))
          {
            checkValue(resultEntry,"targetsn","jensen");
            checkValue(resultEntry,"targetcn","Fiona Jensen");
          }
          checkValue(resultEntry,"changeinitiatorsname", "cn=Internal Client,cn=Root DNs,cn=config");
        }
      }
      assertEquals(entries.size(),8, "Entries number returned by search" + s);
    }
    catch(Exception e)
    {
      fail("Ending "+tn+" test with exception:\n"
          +  stackTraceToSingleLineString(e));
    }
    finally
    {
      try
      {
        delOp = new DeleteOperationBasis(connection,
            InternalClientConnection.nextOperationID(),
            InternalClientConnection.nextMessageID(), null,
            DN.decode("cn=Fiona Jensen," + TEST_ROOT_DN_STRING2));
        delOp.run();
        waitOpResult(delOp, ResultCode.SUCCESS);
        delOp = new DeleteOperationBasis(connection,
            InternalClientConnection.nextOperationID(),
            InternalClientConnection.nextMessageID(), null,
            DN.decode(TEST_ROOT_DN_STRING2));
        delOp.run();
        waitOpResult(delOp, ResultCode.SUCCESS);
        delOp = new DeleteOperationBasis(connection,
            InternalClientConnection.nextOperationID(),
            InternalClientConnection.nextMessageID(), null,
            DN.decode(TEST_ROOT_DN_STRING3));
        delOp.run();
        waitOpResult(delOp, ResultCode.SUCCESS);

        // Cleaning
        if (domain21 != null)
          domain21.shutdown();
View Full Code Here

Examples of org.nasutekds.server.core.DeleteOperationBasis

        InternalClientConnection.getRootConnection();
    LocalBackendDeleteOperation op = null;
    try
    {
      DeleteOperation opBasis =
        new DeleteOperationBasis(connection, 1, 1,null, DN.decode(TEST_ROOT_DN_STRING));
      op = new LocalBackendDeleteOperation(opBasis);
    }
    catch (DirectoryException e)
    {
      // TODO Auto-generated catch block
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.