Exemple #1
0
        public void UpdateRoutingRule_EmptyProperties_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();
            var res = RoutingRule.UpdateRoutingRule(_mockServer, "objectid", oProps);

            Assert.IsFalse(res.Success, "Calling UpdateRoutingRule with empty properties should fail");
        }
Exemple #2
0
 public FlagPropertiesTestClass()
 {
     _changedPropList       = new ConnectionPropertyList();
     _publicReadWrite       = true;
     _publicReadOnly        = "testing";
     _publicReadPrivteWrite = "testing";
 }
Exemple #3
0
        //user wants to update one of the top level items for a user - they may have edited the first/last name, display name, alias or extension (any or all of them).
        //All the values will be sent over regardless of if they've changed - a more sophisticated "dirty flag" approach or the like is left as an exercize for reader.
        private void buttonUpdateItem_Click(object sender, EventArgs e)
        {
            DisableFormControls();

            ConnectionPropertyList oPropList = new ConnectionPropertyList();

            string strObjectID = gridUsers.SelectedRows[0].Cells["ObjectId"].Value.ToString();

            //the property names are case sensitive
            oPropList.Add("Alias", textUserAlias.Text);
            oPropList.Add("FirstName", textUserFirstName.Text);
            oPropList.Add("LastName", textUserLastName.Text);
            oPropList.Add("DisplayName", textUserDisplayName.Text);
            oPropList.Add("DtmfAccessId", textUserExtension.Text);

            //do the call to update the items via CUPI
            WebCallResult res = UserBase.UpdateUser(GlobalItems.CurrentConnectionServer, strObjectID, oPropList);

            EnableFormControls();

            if (res.Success)
            {
                MessageBox.Show("User updated");
                Logger.Log(string.Format("User updated:{0}\r\n{1}", strObjectID, oPropList));
                gridUsers.Refresh();
            }
            else
            {
                MessageBox.Show("User failed to update:" + res.ErrorText);
                Logger.Log(string.Format("User failed to update:{0}, error=[{1}]\r\n{2}", strObjectID, res.ErrorText, oPropList));

                //dump out all the results information send from the server for diag purposes
                Logger.Log(res.ToString());
            }
        }
Exemple #4
0
        /// <summary>
        /// Allows one or more properties on a message handler to be udpated.  The caller needs to construct a list of property
        /// names and new values using the ConnectionPropertyList class's "Add" method.  At least one property pair needs to be passed in
        /// but as many as are desired can be included in a single call.
        /// </summary>
        /// <param name="pConnectionServer">
        /// Reference to the ConnectionServer object that points to the home server where the object is homed.
        /// </param>
        /// <param name="pUserObjectId">
        /// Unique identifier for user that owns the message handler being updated
        /// </param>
        /// <param name="pPropList">
        /// List ConnectionProperty pairs that identify a transfer option property name and a new value for that property to apply to the option
        /// being updated. This is passed in as a ConnectionPropertyList instance which contains 1 or more ConnectionProperty instances.  At least one
        /// property pair needs to be included for the funtion to execute.
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult UpdateMessageHandler(ConnectionServerRest pConnectionServer,
                                                         string pUserObjectId,
                                                         string pObjectId,
                                                         ConnectionPropertyList pPropList)
        {
            WebCallResult res = new WebCallResult();

            res.Success = false;

            if (pConnectionServer == null)
            {
                res.ErrorText = "Null ConnectionServer referenced passed to UpdateMessageHandler";
                return(res);
            }

            if (pPropList == null || pPropList.Count < 1)
            {
                res.ErrorText = "empty property list passed to UpdateMessageHandler";
                return(res);
            }

            string strBody = "<MessageHandler>";

            foreach (var oPair in pPropList)
            {
                strBody += string.Format("<{0}>{1}</{0}>", oPair.PropertyName, oPair.PropertyValue);
            }

            strBody += "</MessageHandler>";

            return(pConnectionServer.GetCupiResponse(string.Format("{0}users/{1}/messagehandlers/{2}",
                                                                   pConnectionServer.BaseUrl, pUserObjectId, pObjectId), MethodType.PUT, strBody, false));
        }
Exemple #5
0
        public void UpdateCallHandlerTemplate_EmptyPropertyList_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();
            var res = CallHandlerTemplate.UpdateCallHandlerTemplate(_mockServer, "objectId", oProps);

            Assert.IsFalse(res.Success, "UpdateCallHandlerTemplate with empty property list did not fail");
        }
Exemple #6
0
        /// <summary>
        /// Generic constructor for Json parsing
        /// </summary>
        public MessageHandler()
        {
            //make an instanced of the changed prop list to keep track of updated properties on this object
            _changedPropList = new ConnectionPropertyList();

            ClearPendingChanges();
        }
        public void UpdateCallHandler_EmptyPropertyList_Failure()
        {
            ConnectionPropertyList oPropList = new ConnectionPropertyList();
            var res = CallHandler.UpdateCallHandler(_mockServer, "aaa", oPropList);

            Assert.IsFalse(res.Success, "UpdateCallHandler should fail if the property list is empty");
        }
        public void UpdatePrivateList_EmptyPropertyList_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();
            var res = PrivateList.UpdatePrivateList(_mockServer, "Object", oProps, "ownerid");

            Assert.IsFalse(res.Success, "Updating private list via static method did not fail with empty property list");
        }
        public void UpdateCallHandler_EmptyObjectId_Failure()
        {
            ConnectionPropertyList oPropList = new ConnectionPropertyList();

            var res = CallHandler.UpdateCallHandler(_mockServer, "", oPropList);

            Assert.IsFalse(res.Success, "UpdateCallHandler should fail if the ObjectId parameter is blank");
        }
Exemple #10
0
        public void UpdateRoutingRule_NullConnectionServer_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            var res = RoutingRule.UpdateRoutingRule(null, "objectid", oProps);

            Assert.IsFalse(res.Success, "Calling UpdateRoutingRule with null ConnectionServerRest should fail");
        }
Exemple #11
0
        public void UpdateContact_EmptyPropertyList_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            var res = Contact.UpdateContact(_mockServer, "bogus", oProps);

            Assert.IsFalse(res.Success, "Static call to UpdateContact did not return failure for empty property list");
        }
Exemple #12
0
        public void ImportLdapUser_EmptyProperties_Failure()
        {
            UserFull oUser;
            ConnectionPropertyList oProps = new ConnectionPropertyList();
            var res = UserLdap.ImportLdapUser(_mockServer, "templatealias", "pkid", "alias", "firstname", "lastname", "extension", oProps, out oUser);

            Assert.IsFalse(res.Success, "Calling ImportLdapUser with empty properties should fail");
        }
        public void UpdateCallHandler_NullConnectionServer_Failure()
        {
            ConnectionPropertyList oPropList = new ConnectionPropertyList();

            WebCallResult res = CallHandler.UpdateCallHandler(null, "", oPropList);

            Assert.IsFalse(res.Success, "UpdateCallHandler should fail if the ConnectionServerRest parameter is null");
        }
Exemple #14
0
        public void UpdateUserMessage_InvalidObjectIds_Failure()
        {
            var oProps = new ConnectionPropertyList();

            oProps.Add("Test", "test");
            var res = UserMessage.UpdateUserMessage(_connectionServer, "MessageObjectId", "userobjectId", oProps);

            Assert.IsFalse(res.Success, "Calling UpdateUserMessage with invalid ObjectIds did not fail");
        }
Exemple #15
0
        public void UpdateMenuEntry_EmptyKeyName_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("Test", "test");
            var res = MenuEntry.UpdateMenuEntry(_mockServer, "ObjectId", "", oProps);

            Assert.IsFalse(res.Success, "Empty KeyName should fail");
        }
Exemple #16
0
        public void StaticMethodFailure_UpdateRoutingRule()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("test", "test");
            var res = RoutingRule.UpdateRoutingRule(_connectionServer, "objectid", oProps);

            Assert.IsFalse(res.Success, "Calling UpdateRoutingRule with invalid ObjectId should fail");
        }
Exemple #17
0
        public void UpdateTransferOption_InvalidObjectId_Failure()
        {
            var oProps = new ConnectionPropertyList();

            oProps.Add("test", "test");
            var res = TransferOption.UpdateTransferOption(_connectionServer, "objectid", TransferOptionTypes.Alternate, oProps);

            Assert.IsFalse(res.Success, "Calling update for transfer options with no parameters should fail");
        }
        public void UpdatePrivateList_InvalidObjectIdAndOwnerObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("blah", "blah");
            var res = PrivateList.UpdatePrivateList(_connectionServer, "Object", oProps, "ownerId");

            Assert.IsFalse(res.Success, "Updating private list via static method did not fail with invalid owner and objectIds ");
        }
        public void UpdateInterviewHandler_InvalidObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("bogus", "bogusvalue");

            var res = InterviewHandler.UpdateInterviewHandler(_connectionServer, "ObjectId", oProps);

            Assert.IsFalse(res.Success, "Calling static method UpdateInterviewHandler did not fail with: invalid objectId");
        }
Exemple #20
0
        public void UpdateAlternateExtension_NullConnectionServer_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("name", "value");

            var res = AlternateExtension.UpdateAlternateExtension(null, "objectid", "aaa", oProps);

            Assert.IsFalse(res.Success, "Null ConnectionServerRest object should fail");
        }
Exemple #21
0
        public void UpdateAlternateExtension_EmptyUserObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("name", "value");

            var res = AlternateExtension.UpdateAlternateExtension(_mockServer, "", "aaa", oProps);

            Assert.IsFalse(res.Success, "Empty UserObjectID should fail");
        }
        public void StaticCallFailures__UpdateCallHandlerTemplate()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("dummy", "dummy");

            var res = CallHandlerTemplate.UpdateCallHandlerTemplate(_connectionServer, "objectId", oProps);

            Assert.IsFalse(res.Success, "UpdateCallHandlerTemplate with invalid ObjectId did not fail");
        }
        public void UpdateUser_InvalidObjectId_Failure()
        {
            ConnectionPropertyList oPropList = new ConnectionPropertyList();

            oPropList.Add("test", "value");

            var res = UserBase.UpdateUser(_connectionServer, "ObjectId", oPropList);

            Assert.IsFalse(res.Success, "Invalid ObjectId should fail");
        }
Exemple #24
0
        public void UpdateUser_NullConnectionServer_Failure()
        {
            ConnectionPropertyList oPropList = new ConnectionPropertyList();

            oPropList.Add("test", "value");

            var res = UserBase.UpdateUser(null, "ObjectId", oPropList);

            Assert.IsFalse(res.Success, "Null ConnectionServerRest object should fail");
        }
        public void UpdatePortGroupServer_EmptyPortGroupObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("Bogus", "invalid");

            var res = PortGroupServer.UpdatePortGroupServer(_connectionServer, "portgroupobjectid", "bogus", oProps);

            Assert.IsFalse(res.Success, "Static call to UpdatePortGroupServer did not fail with an empty property list");
        }
        public void UpdateNotificationDevice_NullConnectionServer_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("item", "value");

            WebCallResult res = NotificationDevice.UpdateNotificationDevice(null, "objectid", "aaa", NotificationDeviceTypes.Pager, oProps);

            Assert.IsFalse(res.Success, "Null Connection Server object should fail");
        }
        public void UpdateNotificationDevice_EmptyDeviceObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("item", "value");

            var res = NotificationDevice.UpdateNotificationDevice(_mockServer, "objectid", "", NotificationDeviceTypes.Pager, oProps);

            Assert.IsFalse(res.Success, "Empty device objectID should fail");
        }
Exemple #28
0
        public void ImportLdapUser_InvalidPkid_Failure()
        {
            UserFull oUser;
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("Test", "test");

            var res = UserLdap.ImportLdapUser(_connectionServer, "templatealias", "pkid", "alias", "firstname", "lastname", "extension", oProps, out oUser);

            Assert.IsFalse(res.Success, "Calling ImportLdapUser with invalid pkid should fail");
        }
Exemple #29
0
        public void ExercisePropertyList()
        {
            ConnectionPropertyList oList = new ConnectionPropertyList("propname", "propvalue");

            oList.Add("integer", 1);
            oList.Add("string", "stringvalue");
            oList.Add("date", DateTime.Now);
            oList.Add("boolean", false);

            Console.WriteLine(oList.ToString());
        }
Exemple #30
0
        public void UpdateNotificationDevice_InvalidObjectId_Failure()
        {
            //failure paths for update calls
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("item", "value");

            var res = NotificationDevice.UpdateNotificationDevice(_connectionServer, _tempUser.ObjectId, "aaa",
                                                                  NotificationDeviceTypes.Pager, oProps);

            Assert.IsFalse(res.Success, "Invalid device objectId should fail");
        }