Example #1
0
        public void ContactRename()
        {
            string id = null;

            try
            {
                string       dn = Guid.NewGuid().ToString();
                ContactEntry e  = new ContactEntry();

                e.Emails.Add(new EMail()
                {
                    Address = "*****@*****.**", Label = "work"
                });

                e.ExtendedProperties.Add(new ExtendedProperty(dn, ApiInterfaceContact.DNAttributeName));

                e  = UnitTestControl.TestParameters.ContactsService.Add(e, UnitTestControl.TestParameters.Domain);
                id = e.SelfUri.Content;

                CSEntryChange cs = CSEntryChange.Create();
                cs.ObjectModificationType = ObjectModificationType.Update;
                cs.DN         = dn;
                cs.ObjectType = SchemaConstants.Contact;

                string newDN = Guid.NewGuid().ToString();

                cs.AttributeChanges.Add(AttributeChange.CreateAttributeUpdate("DN", new List <ValueChange>()
                {
                    ValueChange.CreateValueAdd(newDN), ValueChange.CreateValueDelete(dn)
                }));

                cs.AnchorAttributes.Add(AnchorAttribute.Create("id", id));
                CSEntryChangeResult result = ExportProcessor.PutCSEntryChange(cs, UnitTestControl.Schema.GetSchema().Types[SchemaConstants.Contact], UnitTestControl.TestParameters);

                if (result.ErrorCode != MAExportError.Success)
                {
                    Assert.Fail(result.ErrorName);
                }

                System.Threading.Thread.Sleep(5000);
                e = UnitTestControl.TestParameters.ContactsService.GetContact(id);
                Assert.AreEqual(newDN, e.ExtendedProperties.Single(t => t.Name == ApiInterfaceContact.DNAttributeName).Value);
                var x = CSEntryChangeQueue.Take();
            }
            finally
            {
                if (id != null)
                {
                    UnitTestControl.TestParameters.ContactsService.Delete(id);
                }
            }
        }
        private GetImportEntriesResults GetImportEntriesDelta()
        {
            GetImportEntriesResults results = new GetImportEntriesResults {
                CSEntries = new List <CSEntryChange>()
            };

            int count = 0;

            while (CSEntryChangeQueue.Count > 0 && (count < this.importRunStep.PageSize))
            {
                Interlocked.Increment(ref this.opCount);
                results.CSEntries.Add(CSEntryChangeQueue.Take());
                count++;
            }

            results.MoreToImport = CSEntryChangeQueue.Count > 0;

            return(results);
        }