Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.Entry


        "objectClass: person\n" + "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" + "sn: snValue\n" + "cn: cnValue\n" +
        "entryUUID: " + ENTRY_UUID + "\n" +
        "displayName: ValueToBeKept\ndisplayName: displayNameValue\n";

      Entry entry = null;
      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      AddMsg addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);

      /*
       * check that entry has been created and has attribute values from RDN
       * only
       */

      Entry newEntry = null;
      try
      {
        newEntry = getEntry(entry.getDN(), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(entry.getDN(), newEntry.getDN());
      ObjectClass objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");

      /**
       * Now perform same test, but with 2 forbidden attributes in RDN, using '+'
       */

      /*
       * Perform add operation with fornbidden attribute in RDN
       */

      entryLdif = "dn: displayName=ValueToBeKept+description=ValueToBeKeptToo," +
        TEST_ROOT_DN_STRING + "\n" + "objectClass: top\n" +
        "objectClass: person\n" + "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" + "entryUUID: " + ENTRY_UUID2 + "\n" +
        "sn: snValue\n" + "cn: cnValue\n" +
        "displayName: ValueToBeKept\ndisplayName: displayNameValue\n" +
        "description: descriptionValue\ndescription: ValueToBeKeptToo\n";

      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID2,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);

      /*
       * check that entry has been created and has attribute values from RDN
       * only
       */

      try
      {
        newEntry = getEntry(entry.getDN(), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(entry.getDN(), newEntry.getDN());
      objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      checkEntryAttributeValue(newEntry, "description", "ValueToBeKeptToo");
    }
    finally
    {
View Full Code Here


        "entryUUID: " + ENTRY_UUID + "\n" +
        "displayName: ValueToBeKept\ndisplayName: displayNameValue\n" +
        "carLicense: cirLicenseValue\n";


      Entry entry = null;
      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      AddMsg addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);

      /*
       * check that entry has been created and has attribute values from RDN
       * only
       */

      Entry newEntry = null;
      try
      {
        newEntry = getEntry(entry.getDN(), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(entry.getDN(), newEntry.getDN());
      ObjectClass objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      checkEntryAttributeValue(newEntry, "carLicense", "cirLicenseValue");

      /**
       * Now perform same test, but with 2 forbidden attributes in RDN, using '+'
       */

      /*
       * Perform add operation with fornbidden attribute in RDN
       */

      entryLdif = "dn: displayName=ValueToBeKept+description=ValueToBeKeptToo," +
        TEST_ROOT_DN_STRING + "\n" + "objectClass: top\n" +
        "objectClass: person\n" + "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" + "sn: snValue\n" + "cn: cnValue\n" +
        "entryUUID: " + ENTRY_UUID2 + "\n" +
        "displayName: ValueToBeKept\ndisplayName: displayNameValue\n" +
        "description: descriptionValue\ndescription: ValueToBeKeptToo\n" +
        "carLicense: cirLicenseValue\n";

      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID2,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);

      /*
       * check that entry has been created and has attribute values from RDN
       * only
       */

      try
      {
        newEntry = getEntry(entry.getDN(), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(entry.getDN(), newEntry.getDN());
      objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      checkEntryAttributeValue(newEntry, "description", "ValueToBeKeptToo");
      checkEntryAttributeValue(newEntry, "carLicense", "cirLicenseValue");
    }
    finally
View Full Code Here

        "objectClass: person\n" + "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" + "sn: snValue\n" + "cn: cnValue\n" +
        "entryUUID: " + ENTRY_UUID + "\n" +
        "displayName: ValueToBeKept\ndescription: ValueToBeRemoved\n";

      Entry entry = null;
      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      AddMsg addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);

      /*
       * check that entry has been created and has attribute values from RDN
       */

      Entry newEntry = null;
      try
      {
        newEntry = getEntry(entry.getDN(), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(entry.getDN(), newEntry.getDN());
      ObjectClass objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      checkEntryAttributeValue(newEntry, "description", "ValueToBeRemoved");

      /*
       * Perform modify dn operation by renaming the entry keeping only one of
       * the forbidden attributes
       */

      String newEntryName = "displayName=ValueToBeKept," + TEST_ROOT_DN_STRING ;
      DN newEntryDn = null;
      try
      {
        newEntryDn = DN.decode(newEntryName);
      } catch(DirectoryException e)
      {
        fail("Could not get DN from string: " + newEntryName);
      }

      // Create modify dn message to modify the entry.
      ModifyDNMsg modDnMsg = new ModifyDNMsg(entryName, gen.newChangeNumber(),
        ENTRY_UUID, ENTRY_UUID3, false, TEST_ROOT_DN_STRING,
        "displayName=ValueToBeKept", null);

      replicationDomain.publish(modDnMsg);

      /*
       * check that entry has been renamed  and has only attribute left in the
       * new RDN
       */

      try
      {
        newEntry = getEntry(newEntryDn, TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(newEntryDn, newEntry.getDN());
      objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      assertNull(newEntry.getAttribute("description"));
    }
    finally
    {
      endTest();
    }
View Full Code Here

        "objectClass: person\n" + "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" + "sn: snValue\n" + "cn: cnValue\n" +
        "entryUUID: " + ENTRY_UUID + "\n" +
        "displayName: ValueToBeKept\ndescription: ValueToBeRemoved\n";

      Entry entry = null;
      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      AddMsg addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);

      /*
       * check that entry has been created and has attribute values from RDN
       */

      Entry newEntry = null;
      try
      {
        newEntry = getEntry(entry.getDN(), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(entry.getDN(), newEntry.getDN());
      ObjectClass objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      checkEntryAttributeValue(newEntry, "description", "ValueToBeRemoved");

      /*
       * Perform modify dn operation by renaming the entry keeping only one of
       * the forbidden attributes
       */

      String newEntryName = "displayName=ValueToBeKept," + TEST_ROOT_DN_STRING ;
      DN newEntryDn = null;
      try
      {
        newEntryDn = DN.decode(newEntryName);
      } catch(DirectoryException e)
      {
        fail("Could not get DN from string: " + newEntryName);
      }

      // Create modify dn message to modify the entry.
      ModifyDNMsg modDnMsg = new ModifyDNMsg(entryName, gen.newChangeNumber(),
        ENTRY_UUID, ENTRY_UUID3, false, TEST_ROOT_DN_STRING,
        "displayName=ValueToBeKept", null);

      replicationDomain.publish(modDnMsg);

      /*
       * check that entry has been renamed  and has only attribute left in the
       * new RDN
       */

      try
      {
        newEntry = getEntry(newEntryDn, TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      assertNotNull(newEntry);
      assertEquals(newEntryDn, newEntry.getDN());
      objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      assertNull(newEntry.getAttribute("description"));
    }
    finally
    {
      endTest();
    }
View Full Code Here

          userAttributes.put(attrType, attrList);
        }
      }
    }

    return new Entry(dn, objectClasses, userAttributes, operationalAttributes);
  }
View Full Code Here

      {
        String ldif = getIndexLDIF();

        ldifImportConfig = new LDIFImportConfig(new StringReader(ldif));
        LDIFReader reader = new LDIFReader(ldifImportConfig);
        Entry newConfigEntry = reader.readEntry();
        Entry oldEntry = DirectoryServer.getConfigEntry(
            newConfigEntry.getDN()).getEntry();
        DirectoryServer.getConfigHandler().replaceEntry(oldEntry,
            newConfigEntry,
            null);
        DirectoryServer.getConfigHandler().writeUpdatedConfig();
View Full Code Here

      {
        String ldif = getIndexLDIF();

        ldifImportConfig = new LDIFImportConfig(new StringReader(ldif));
        LDIFReader reader = new LDIFReader(ldifImportConfig);
        Entry backendConfigEntry;
        while ((backendConfigEntry = reader.readEntry()) != null)
        {
          DirectoryServer.getConfigHandler().addEntry(backendConfigEntry, null);
        }
        DirectoryServer.getConfigHandler().writeUpdatedConfig();
View Full Code Here

      LDIFImportConfig ldifImportConfig = null;
      try
      {
        ldifImportConfig = new LDIFImportConfig(new StringReader(ldif));
        LDIFReader reader = new LDIFReader(ldifImportConfig);
        Entry indexEntry = reader.readEntry();
        Attributes attrs = new BasicAttributes();

        BasicAttribute oc = new BasicAttribute("objectClass");
        Iterator<AttributeValue> it =
          indexEntry.getObjectClassAttribute().iterator();
        while (it.hasNext())
        {
          oc.add(it.next().getValue().toString());
        }
        attrs.put(oc);

        List<Attribute> odsAttrs = indexEntry.getAttributes();
        for (Attribute odsAttr : odsAttrs)
        {
          String attrName = odsAttr.getName();
          BasicAttribute attr = new BasicAttribute(attrName);
          it = odsAttr.iterator();
          while (it.hasNext())
          {
            attr.add(it.next().getValue().toString());
          }
          attrs.put(attr);
        }

        final StringBuilder sb = new StringBuilder();
        sb.append(getConfigCommandLineName());
        Collection<String> args =
          getObfuscatedCommandLineArguments(getDSConfigCommandLineArguments());
        for (String arg : args)
        {
          sb.append(" "+CommandBuilder.escapeValue(arg));
        }

        ctx.createSubcontext(indexEntry.getDN().toString(), attrs);
      }
      catch (Throwable t)
      {
        throw new OnlineUpdateException(
            ERR_CTRL_PANEL_ERROR_UPDATING_CONFIGURATION.get(t.toString()), t);
View Full Code Here

      }

      configEntries.clear();

      // Read the first entry from the configuration file.
      Entry entry;
      try
      {
        entry = reader.readEntry(checkSchema);
        if (entry == null)
        {
          Message message = ERR_CONFIG_FILE_EMPTY.get(f.getAbsolutePath());
          throw new InitializationException(message);
        }
        configRootEntry = new ConfigEntry(entry, null);

        baseDNs = new DN[] { configRootEntry.getDN() };

        configEntries.put(entry.getDN(), configRootEntry);
        // Iterate through the rest of the configuration file and process the
        // remaining entries.
        while (entry != null)
        {
          // Read the next entry from the configuration.
          entry = reader.readEntry(checkSchema);
          if (entry != null)
          {
            DN entryDN = entry.getDN();
            DN parentDN = entryDN.getParent();
            ConfigEntry parentEntry = null;
            if (parentDN != null)
            {
              parentEntry = configEntries.get(parentDN);
View Full Code Here

          throws DirectoryException
  {
    // Determine if this is a password policy subentry.
    ObjectClass pwdPolicyOC =
         DirectoryServer.getObjectClass(PWD_OC_POLICY);
    Entry entry = subentry.getEntry();
    Map<ObjectClass, String> objectClasses =
            entry.getObjectClasses();
    if (pwdPolicyOC == null) {
      // This should not happen -- The server doesn't
      // have a pwdPolicy objectclass defined.
      if (debugEnabled()) {
        TRACER.debugWarning(
View Full Code Here

TOP

Related Classes of org.nasutekds.server.types.Entry

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.