public void Test_PostAddressSearch_GLMSample() { /// POST http://glmenv1/GLMSWebServices/SearchLocationService.svc/AddressLocationQuery/v2 HTTP/1.1 /// Authorization: svc.asset_management /// X - GLM - API - Authorization: 6775 /// Content - Type: application / json /// Host: glmenv1 /// Content - Length: 155 /// /// { /// "AddressLine1":"10475 Park Meadows Dr", /// "City":"Lone Tree", /// "StateCode":"CO", /// "CountryCode":"USA", /// "PostalCode":"", /// "CreateSiteIfNotFound": true /// } Model.SearchLocationService.AddressLocationQuery.AddressLocationQueryRequest objAdvancedLocationQueryV2Request = new Model.SearchLocationService.AddressLocationQuery.AddressLocationQueryRequest(); objAdvancedLocationQueryV2Request.CreateSiteIfNotFound = true; objAdvancedLocationQueryV2Request.AddressLine1 = "10475 Park Meadows Dr"; objAdvancedLocationQueryV2Request.City = "Lone Tree"; objAdvancedLocationQueryV2Request.StateCode = "CO"; objAdvancedLocationQueryV2Request.CountryCode = "USA"; RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); List <Model.SearchLocationService.AddressLocationQuery.AddressSearchLocationV2> lstSearchResultV2 = objGLMCallManager.PostAddressSearchToGLM(objAdvancedLocationQueryV2Request); Assert.IsTrue(lstSearchResultV2 != null); Assert.IsTrue(objGLMCallManager.ErrorMessages.Count == 0); }
public void Test_Post_NewServiceLocation() { // http://glmenv1.level3.com/GLMSWeb/Location/Details/PL0000713667 // 1011JXRT // 7579 W 151st ST // Florr 1st, Room telco, Stanley, KS, 66223 // (in GLM, no Site Code) Level3.AddressManagement.Model.ServiceLocationService.Requests.AddServiceLocationRequest objAddServiceLocationRequest = new Model.ServiceLocationService.Requests.AddServiceLocationRequest(); objAddServiceLocationRequest.MasterSiteId = "PL0000713667"; objAddServiceLocationRequest.PrimaryServiceLocationDesignator = new Model.ServiceLocationService.Requests.Primaryservicelocationdesignator(); objAddServiceLocationRequest.PrimaryServiceLocationDesignator.FirstDesignatorTypeId = "FL"; objAddServiceLocationRequest.PrimaryServiceLocationDesignator.FirstDesignatorValue = "1"; objAddServiceLocationRequest.PrimaryServiceLocationDesignator.SecondDesignatorTypeId = "RM"; objAddServiceLocationRequest.PrimaryServiceLocationDesignator.SecondDesignatorValue = "telco"; //objAddServiceLocationRequest.PrimaryServiceLocationDesignator.ThirdDesignatorTypeId = ""; //objAddServiceLocationRequest.PrimaryServiceLocationDesignator.ThirdDesignatorValue = ""; //objAddServiceLocationRequest.SiteDesignatorId = null; // THIS HAS TO BE NULL, DUE TO A DEFECT IN THE GLM INTERFACE RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); Level3.AddressManagement.Model.ServiceLocationService.Responses.AddServiceLocationResponse objAddServiceLocationResponse = objGLMCallManager.PutNewServiceLocation(objAddServiceLocationRequest); Assert.IsTrue(objAddServiceLocationResponse != null); Assert.IsTrue(objGLMCallManager.ErrorMessages.Count == 0); }
public void Test_TryGetPLNumberForCLII() { string strCLII = "LTTNCOGW"; RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); List <Model.ResponseItem> lstResponseItems = objGLMCallManager.GetAddressFromGLMByMasterSideIDOrCLII(strCLII); string strPLNumber; string strErrorMessage; Assert.IsTrue(BLL.GLMResponseUtil.TryGetPLNumberForCLII(strCLII, lstResponseItems, out strPLNumber, out strErrorMessage)); Assert.IsTrue(strPLNumber == "PL0000012684"); Assert.IsTrue(strErrorMessage == String.Empty); // Now try it with a bogus Clii Assert.IsTrue(BLL.GLMResponseUtil.TryGetPLNumberForCLII("BOGUS", lstResponseItems, out strPLNumber, out strErrorMessage)); Assert.IsTrue(strPLNumber == String.Empty); Assert.IsTrue(strErrorMessage == String.Empty); // Now try it with an EMPTY list Assert.IsTrue(BLL.GLMResponseUtil.TryGetPLNumberForCLII(strCLII, new List <Model.ResponseItem>(), out strPLNumber, out strErrorMessage)); Assert.IsTrue(strPLNumber == String.Empty); Assert.IsTrue(strErrorMessage == String.Empty); // Now try it with a NULL list Assert.IsTrue(BLL.GLMResponseUtil.TryGetPLNumberForCLII(strCLII, null, out strPLNumber, out strErrorMessage)); Assert.IsTrue(strPLNumber == String.Empty); Assert.IsTrue(strErrorMessage == String.Empty); }
public void Test_GetAddress_GLMSample_By_CLII() { string strCLII = "USRVNJ90"; RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); List <Model.ResponseItem> lstResponseItems = objGLMCallManager.GetAddressFromGLMByMasterSideIDOrCLII(strCLII); Assert.IsTrue(lstResponseItems != null); Assert.IsTrue(objGLMCallManager.ErrorMessages.Count == 0); Assert.IsTrue(lstResponseItems.Where(s => s.SiteId.ToUpper().Trim() == strCLII).Count() > 0); Assert.IsTrue(lstResponseItems.Where(s => s.SiteCodes.Where(c => c.Contains(strCLII.Trim().ToUpper())).Count() > 0).Count() > 0); }
public void Test_Post_SiteCodeCreation() { // Missing Site Codes: // http://glmenv1.level3.com/GLMSWeb/Location/Details/PL0011796739 // http://glmenv1.level3.com/GLMSWeb/Location/Details/PL0000798549 RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); Level3.AddressManagement.Model.LocationService.OrderLocation.OrderNotificationResponse objOrderNotificationResponse = objGLMCallManager.PostOrderNotificationToGLMToCreateSiteCodeOrSCode("PL0011796739"); Assert.IsTrue(objOrderNotificationResponse != null); Assert.IsTrue(objGLMCallManager.HttpStatusCodeResult == System.Net.HttpStatusCode.OK); Assert.IsTrue((objOrderNotificationResponse.WorkQueueId == 0) || (objOrderNotificationResponse.WorkQueueId == null)); // If WorkQueueId > 0, then that means the turnaround time for the site location will be a few days Assert.IsTrue(objGLMCallManager.ErrorMessages.Count == 0); }
public void Test_PostAddressSearch_By_PLNumber() { //string strPLNumber = "PL0000012684"; string strPLNumber = "PL0011796739"; RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); List <SiteLocationV2> lstSiteLocationV2 = objGLMCallManager.GetSiteLocationFromGLMByPLOrClII(strPLNumber); Assert.IsTrue(lstSiteLocationV2 != null); Assert.IsTrue(objGLMCallManager.ErrorMessages.Count == 0); Assert.IsTrue(lstSiteLocationV2[0].MasterSiteId.Trim().ToUpper() == "PL0000012684".Trim().ToUpper()); Assert.IsTrue(lstSiteLocationV2[0].ServiceLocations.Count() > 0); Assert.IsTrue(lstSiteLocationV2[0].ServiceLocations.Count() > 0); }
public void Check_Why_SL_Not_Created() { int intOrderAddressID = 2; // Instantiate a GLM Call Manager, to be used to invoke the GLM Web Service APIs RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization, intOrderAddressID); bool blnServiceLocationExists; bool blnCallSucceeded; string strSLNumber; string strErrorMessage; DAL.OrderAddress _objOrderAddress = new DAL.OrderAddress().Get(intOrderAddressID, out strErrorMessage); // Invoke the GLM API, to search for the full set of data for the SITE LOCATION... including ALL of its SERVICE LOCATIONs List <Model.LocationService.SiteLocationV2> lstSiteLocationV2 = objGLMCallManager.GetSiteLocationFromGLMByPLOrClII("PL0001336837"); // Check to see if the call succeeded if (lstSiteLocationV2 != null) { // Declare an analzer class that will parse through the very cryptic GLM response to determine if the Site Location Exists BLL.SiteLocationAnalyzer objSiteLocationAnalyzer = new BLL.SiteLocationAnalyzer(); // Load the analyser if (objSiteLocationAnalyzer.Load(lstSiteLocationV2)) { // Search for the SERVICE LOCATION using its Floor, Room, and Suite blnServiceLocationExists = objSiteLocationAnalyzer.FindServiceLocation_SLNumber(_objOrderAddress.CDWFloor, _objOrderAddress.CDWRoom, _objOrderAddress.CDWSuite, out strSLNumber); // NOTE: The strSLNumber variable now holds the SL Number for the SERVICE LOCATION retrieved from GLM blnCallSucceeded = true; } else { // The call result cannot be loaded, which is the same end result as a failed call blnCallSucceeded = false; strSLNumber = String.Empty; } } else { // The call failed. blnCallSucceeded = false; strSLNumber = String.Empty; } }
public void Test_GetPreferredSiteCode_By_PLNumber() { string strPLNumber = "PL0011796739"; RAL.GLMCallManager objGLMCallManager = new RAL.GLMCallManager(_strBaseUrl, _strAuthorizationHeaderUsername_Authorization, _strAuthorizationHeaderApplicationID_XGLMAPIAuthorization); List <Model.ResponseItem> lstResponseItems = objGLMCallManager.GetAddressFromGLMByMasterSideIDOrCLII(strPLNumber); Assert.IsTrue(lstResponseItems != null); Assert.IsTrue(objGLMCallManager.ErrorMessages.Count == 0); Assert.IsTrue(lstResponseItems.Where(s => s.SiteId.ToUpper().Trim() == strPLNumber).Count() > 0); // Try to parse the value string strPreferredSiteCode = String.Empty; string strErrorMessage = String.Empty; Assert.IsTrue(BLL.GLMResponseUtil.TryGetPreferredSiteCodeForPLNumber(strPLNumber, lstResponseItems, out strPreferredSiteCode, out strErrorMessage)); Assert.IsTrue(strPreferredSiteCode == "KATYTXCE"); Assert.IsTrue(strErrorMessage == String.Empty); }