public void testCreateZFDApp() { LDAPZFDApp app = new LDAPZFDApp("cn=app1,ou=apps,o=KC"); app.setCN("app1"); Assert.AreSame("app1", app.getCN()); Assert.AreSame("cn=app1,ou=apps,o=KC", app.getDN()); }
/// <summary> /// Saves changes made to an existing ZFD 7 Application object /// </summary> /// <param name="app"> /// A <see cref="LDAPZFDApp"/> /// </param> public void modifyZFDApp(LDAPZFDApp app) { ArrayList modList; LDAPZFDApp existingApp = getZFDApp(app.getDN()); modList = ZFDAppUtils.BuildZFDAppModifications(app, existingApp); LdapModification[] mods = new LdapModification[modList.Count]; Type mtype=Type.GetType("Novell.Directory.LdapModification"); mods = (LdapModification[])modList.ToArray(typeof(LdapModification)); }
/// <summary> /// Compares current values in eDirectory with the values of the object that is to be written to eDirectory /// The results are returned as an LdapModifications array /// </summary> /// <param name="newApp"> /// A <see cref="LDAPZFDApp"/> /// </param> /// <param name="oldApp"> /// A <see cref="LDAPZFDApp"/> /// </param> /// <returns> /// A <see cref="LdapModification[]"/> /// </returns> internal static ArrayList BuildZFDAppModifications(LDAPZFDApp newApp, LDAPZFDApp oldApp) { LdapAttribute attribute; ArrayList modList = new ArrayList(); /* If associations list do not match, replace */ if (newApp.getZENAppAssociations().SequenceEqual(oldApp.getZENAppAssociations()) == false) { Logger.Debug("Current Associations and modified Associations do not match {0}", newApp.getDN()); attribute = new LdapAttribute( "appAssociations", newApp.getZENAppAssociations().ToArray()); modList.Add( new LdapModification(LdapModification.REPLACE, attribute)); //Add to the list of mods } return modList; }