Example #1
0
        public void GetCallHandlerTemplate_EmptyObjectId_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, _mockServer, "", "");

            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with empty objectId and name did not fail");
        }
Example #2
0
        public void GetCallHandlerTemplates_NullConnectionServer_Failure()
        {
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(null, out oTemplates, 1, 10, null);

            Assert.IsFalse(res.Success, "Passing null connection server should fail.");
        }
Example #3
0
        public void AddCallHandlerTemplate_EmptyMediaSwitchId_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "displayname", "", "recipientlist", "recipientuser", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate with empty mediaswitch objectId did not fail");
        }
Example #4
0
        public void GetCallHandlerTemplate_NullConnectionServer_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, null, "objectid", "displayname");

            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with null ConnectionServerRest did not fail");
        }
Example #5
0
        public void AddCallHandlerTemplate_EmptyRecipients_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "displayname", "mediaswitchobjectid", "", "", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate with no recipients did not fail");
        }
        public void CallHandlerTemplate_AddDeleteTest_ListRecipient()
        {
            List <PhoneSystem> oPhoneSystems;
            var res = PhoneSystem.GetPhoneSystems(_connectionServer, out oPhoneSystems, 1, 1);

            Assert.IsTrue(res.Success, "Failed to fetch phone systems:" + res);
            Assert.IsTrue(oPhoneSystems.Count == 1, "Failed to fetch single phone system");

            List <DistributionList> oLists;

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 1);
            Assert.IsTrue(res.Success, "Failed to fetch lists:" + res);
            Assert.IsTrue(oLists.Count == 1, "Failed to fetch single list");

            string strName = "Temp_" + Guid.NewGuid().ToString();

            CallHandlerTemplate oTemplate;

            res = CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oPhoneSystems[0].ObjectId,
                                                             oLists[0].ObjectId, "", null, out oTemplate);

            Assert.IsTrue(res.Success, "Failed creating new call handler template:" + res);

            res = oTemplate.Delete();
            Assert.IsTrue(res.Success, "Failed deleting call handler template:" + res);
        }
Example #7
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");
        }
        public void CallHandlerTemplate_AddDeleteTest_UserRecipient()
        {
            List <PhoneSystem> oPhoneSystems;
            var res = PhoneSystem.GetPhoneSystems(_connectionServer, out oPhoneSystems, 1, 1);

            Assert.IsTrue(res.Success, "Failed to fetch phone systems:" + res);
            Assert.IsTrue(oPhoneSystems.Count == 1, "Failed to fetch single phone system");

            List <UserBase> oUsers;

            res = UserBase.GetUsers(_connectionServer, out oUsers, 1, 1);
            Assert.IsTrue(res.Success, "Failed to fetch users:" + res);
            Assert.IsTrue(oUsers.Count == 1, "Failed to fetch single user");

            string strName = "Temp_" + Guid.NewGuid().ToString();

            CallHandlerTemplate oTemplate;

            res = CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oPhoneSystems[0].ObjectId,
                                                             "", oUsers[0].ObjectId, null, out oTemplate);

            Assert.IsTrue(res.Success, "Failed creating new call handler template:" + res);

            res = oTemplate.Delete();
            Assert.IsTrue(res.Success, "Failed deleting call handler template:" + res);
        }
Example #9
0
        public void AddCallHandlerTemplate_NullConnectionServer_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(null, "display name", "mediaswitchobjectid", "recipientlist", "recipientuser",
                                                                 null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate with null ConnectionServerRest did not fail");
        }
Example #10
0
        public void CallHandlerTemplates_Test()
        {
            _errorString = "";
            List <CallHandlerTemplate> oCallHandlerTemplates;
            var res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oCallHandlerTemplates, 1, 2);

            Assert.IsTrue(res.Success, "Failed to fetch call handler templates:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), "Error parsing Json for CallHandlerTemplate:" + _errorString);
        }
        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 StaticCallFailures__GetCallHandlerTemplate()
        {
            CallHandlerTemplate oTemplate;

            var res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, _connectionServer, "objectId", "");

            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with invalid objectId did not fail");

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, _connectionServer, "", "_bogus_");
            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with invalid name did not fail");
        }
Example #13
0
        public void AddCallHandlerTemplate_JunkObjectIdReturn_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "/vmrest/callhandlertemplates/junk"
            });

            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "test", "test", "", "test", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate that produces invalid new ObjectId did not fail");
        }
Example #14
0
        public void AddCallHandlerTemplate_ErrorResult_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success    = false,
                StatusCode = 404,
            });

            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "test", "test", "", "test", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate that produces error response did not fail");
        }
Example #15
0
        public void GetCallHandlerTemplates_EmptyResults_Failure()
        {
            //empty results
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });

            List <CallHandlerTemplate> oTemplates;
            var res = CallHandlerTemplate.GetCallHandlerTemplates(_mockServer, out oTemplates, 1, 5, "EmptyResultText");

            Assert.IsFalse(res.Success, "Calling GetCallHandlerTemplates with EmptyResultText did not fail");
        }
Example #16
0
        public void AddCallHandlerTemplate_EmptyResponse_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });

            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "test", "test", "", "test", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate that returns empty response did not fail");
        }
Example #17
0
        public void GetCallHandlerTemplates_GarbageResults_Success()
        {
            //garbage response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "garbage result"
            });

            List <CallHandlerTemplate> oTemplates;
            var res = CallHandlerTemplate.GetCallHandlerTemplates(_mockServer, out oTemplates, 1, 5, "InvalidResultText");

            Assert.IsTrue(res.Success, "Calling GetCallHandlerTemplates with InvalidResultText should not fail:" + res);
            Assert.IsTrue(oTemplates.Count == 0, "Invalid result text should produce an empty list of templates");
        }
Example #18
0
        public void AddCallHandlerFailure_InvalidExtension()
        {
            //grab the first template - should always be one and it doesn't matter which
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates, 1, 1);

            if (res.Success == false || oTemplates == null || oTemplates.Count == 0)
            {
                Assert.Fail("Could not fetch call handler templates:" + res);
            }

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

            res = CallHandler.AddCallHandler(_connectionServer, oTemplates[0].ObjectId, strExtension, strExtension, null);
            Assert.IsFalse(res.Success, "Creating new call handler with invalid extension should fail");
        }
Example #19
0
        public void GetCallHandlerTemplates_ErrorResult_Failure()
        {
            //error response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = false,
                ResponseText = "error text",
                StatusCode   = 404
            });

            List <CallHandlerTemplate> oTemplates;
            var res = CallHandlerTemplate.GetCallHandlerTemplates(_mockServer, out oTemplates, 1, 5, "ErrorResponse");

            Assert.IsFalse(res.Success, "Calling GetCallHandlerTemplates with ErrorResponse did not fail");
        }
Example #20
0
        public new static void MyClassInitialize(TestContext testContext)
        {
            BaseIntegrationTests.MyClassInitialize(testContext);

            //grab the first template - should always be one and it doesn't matter which
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates);

            if (res.Success == false || oTemplates == null || oTemplates.Count == 0)
            {
                Assert.Fail("Could not fetch call handler templates:" + res);
            }

            //create new handler with GUID in the name to ensure uniqueness
            String strName = "TempHandler_" + Guid.NewGuid().ToString().Replace("-", "");

            res = CallHandler.AddCallHandler(_connectionServer, oTemplates[0].ObjectId, strName, "", null, out _tempHandler);
            Assert.IsTrue(res.Success, "Failed creating temporary callhandler:" + res.ToString());
        }
        /// <summary>
        /// Helper method to create a temporary handler template for use in these tests
        /// </summary>
        private static WebCallResult CreateTemplateHandler()
        {
            //grab the first template - should always be one and it doesn't matter which
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates);

            if (res.Success == false || oTemplates == null || oTemplates.Count == 0)
            {
                Assert.Fail("Could not fetch call handler templates:" + res);
            }

            CallHandlerTemplate oTemplate = oTemplates[0];

            //create new handler with GUID in the name to ensure uniqueness
            String strName = "TempHandlerTemplate_" + Guid.NewGuid().ToString().Replace("-", "");

            return(CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oTemplate.MediaSwitchObjectId,
                                                              oTemplate.RecipientDistributionListObjectId,
                                                              oTemplate.RecipientSubscriberObjectId, null,
                                                              out _tempHandlerTemplate));
        }
Example #22
0
        //at form load time go fetch the handler templates that are on the server and load them into the combo box for selection.
        private void FormNewCallHandlerInfo_Load(object sender, EventArgs e)
        {
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res;

            comboTemplate.Items.Clear();

            //fetch the templates defined on the Connection server
            res = CallHandlerTemplate.GetCallHandlerTemplates(GlobalItems.CurrentConnectionServer, out oTemplates);

            if (res.Success == false || oTemplates.Count == 0)
            {
                MessageBox.Show("Failure loading call handler templates:" + res.ErrorText);

                //dump the entire WebCallResult structure to the log for diagnostic purposes.
                SimpleLogger.Logger.Log(res.ToString());
                return;
            }

            //construct a simple hash table that puts the ObjectId in as the key and the Display Name in as the value.
            Hashtable ht = new Hashtable();

            foreach (CallHandlerTemplate oTemplate in oTemplates)
            {
                ht.Add(oTemplate.ObjectId, oTemplate.DisplayName);
            }

            //bind the combobox to the hash table
            BindingSource bs = new BindingSource();

            bs.DataSource = ht;

            comboTemplate.DataSource    = bs;
            comboTemplate.DisplayMember = "value";
            comboTemplate.ValueMember   = "key";

            //force the first template to be selected
            comboTemplate.SelectedIndex = 0;
        }
Example #23
0
        public void UpdateCallHandlerTemplate_NullConnectionServer_Failure()
        {
            var res = CallHandlerTemplate.UpdateCallHandlerTemplate(null, "objectId", null);

            Assert.IsFalse(res.Success, "UpdateCallHandlerTemplate with null Connection server did not fail");
        }
        public void StaticCallFailures__DeleteCallHandlerTemplate()
        {
            var res = CallHandlerTemplate.DeleteCallHandlerTemplate(_connectionServer, "objectid");

            Assert.IsFalse(res.Success, "DeleteCallHandlerTemplate with invalid objectId did not fail");
        }
        public void CallHandlerTemplate_FetchTest()
        {
            List <CallHandlerTemplate> oTemplates;

            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(null, out oTemplates);

            Assert.IsFalse(res.Success, "Null ConnectionServerRest parameter should fail");

            res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates, 1, 10, null);
            Assert.IsTrue(res.Success, "Failed to get call handler templates");
            Assert.IsNotNull(oTemplates, "Null call handler template returned");
            Assert.IsTrue(oTemplates.Count > 0, "Empty list of templates returned");

            //exercise the toString method
            Console.WriteLine(oTemplates[0].ToString());
            Console.WriteLine(oTemplates[0].DumpAllProps());

            res = oTemplates[0].RefetchUserTemplateData();
            Assert.IsTrue(res.Success, "Failed refetching template data:" + res);

            //exercise the NEW create methods
            CallHandlerTemplate oNewTemplate;

            try
            {
                oNewTemplate = new CallHandlerTemplate(_connectionServer, oTemplates[0].ObjectId);
                Console.WriteLine(oNewTemplate);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get call handler template via NEW by objectId:" + ex);
            }

            try
            {
                oNewTemplate = new CallHandlerTemplate(_connectionServer, "", oTemplates[0].DisplayName);
                Console.WriteLine(oNewTemplate);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get call handler template via NEW by displayName:" + ex);
            }

            try
            {
                oNewTemplate = new CallHandlerTemplate(_connectionServer, "");
                Console.WriteLine(oNewTemplate);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create empty call handler template via NEW:" + ex);
            }

            //exercise the static methods
            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer);
            Assert.IsFalse(res.Success, "Static call to get call handler template did not fail with empty objectid and name");

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, null);
            Assert.IsFalse(res.Success, "Static call to get call handler template did not fail with null ConnectionServer");

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer, oTemplates[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed to get call handler via static call using ObjectID:" + res);

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer, "", oTemplates[0].DisplayName);
            Assert.IsTrue(res.Success, "Failed to get call handler via static call using DisplayName:" + res);

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer, "", "bogus");
            Assert.IsFalse(res.Success, "Call to get call handler via static call using invalid DisplayName did not fail.");

            res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates, 1, 2, "query=(ObjectId is bogus)");
            Assert.IsTrue(res.Success, "fetching Templates with invalid query should not fail:" + res);
            Assert.IsTrue(oTemplates.Count == 0, "Invalid query string should return an empty COS list:" + oTemplates.Count);
        }
Example #26
0
        public void DeleteCallHandlerTemplate_NullconnectionServer_Failure()
        {
            var res = CallHandlerTemplate.DeleteCallHandlerTemplate(null, "objectid");

            Assert.IsFalse(res.Success, "DeleteCallHandlerTemplate with null connection server did not fail");
        }
Example #27
0
        public void Constructor_NullConnectionServer_Failure()
        {
            CallHandlerTemplate oTestTemplate = new CallHandlerTemplate(null, "aaa");

            Console.WriteLine(oTestTemplate);
        }
Example #28
0
        public void DeleteCallHandlerTemplate_EmptyObjectId_Failure()
        {
            var res = CallHandlerTemplate.DeleteCallHandlerTemplate(_mockServer, "");

            Assert.IsFalse(res.Success, "DeleteCallHandlerTemplate with empty objectid did not fail");
        }
Example #29
0
        public void UpdateCallHandlerTemplate_EmptyObjectId_Failure()
        {
            var res = CallHandlerTemplate.UpdateCallHandlerTemplate(_mockServer, "", null);

            Assert.IsFalse(res.Success, "UpdateCallHandlerTemplate with empty object did not fail");
        }