This commit is contained in:
@@ -110,13 +110,13 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all unique Locale keys that were tracked
|
/// Get a coverage report of locale keys used versus unused
|
||||||
/// Required roles: Any
|
/// Required roles: Any
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List in alphabetical order of all unique locale keys requested since last server reboot</returns>
|
/// <returns>Report of all unique locale keys requested since last server reboot</returns>
|
||||||
[HttpGet("RequestedKeyList")]
|
[HttpGet("LocaleKeyCoverage")]
|
||||||
public ActionResult RequestedKeyList()
|
public ActionResult LocaleKeyCoverage()
|
||||||
{
|
{
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
LocaleBiz biz = new LocaleBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
LocaleBiz biz = new LocaleBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
||||||
|
|
||||||
var l = biz.RequestedKeyList();
|
var l = biz.LocaleKeyCoverage();
|
||||||
return Ok(new ApiOkResponse(l));
|
return Ok(new ApiOkResponse(l));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -420,5 +420,22 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (DEBUG)
|
||||||
|
public class LocaleCoverageInfo
|
||||||
|
{
|
||||||
|
public List<string> RequestedKeys { get; set; }
|
||||||
|
public int RequestedKeyCount { get; set; }
|
||||||
|
public List<string> NotRequestedKeys { get; set; }
|
||||||
|
public int NotRequestedKeyCount { get; set; }
|
||||||
|
|
||||||
|
public LocaleCoverageInfo()
|
||||||
|
{
|
||||||
|
RequestedKeys = new List<string>();
|
||||||
|
NotRequestedKeys = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,9 +98,24 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
internal List<string> RequestedKeyList()
|
internal AyaNova.Api.Controllers.LocaleController.LocaleCoverageInfo LocaleKeyCoverage()
|
||||||
{
|
{
|
||||||
return ServerBootConfig.LocaleKeysRequested;
|
AyaNova.Api.Controllers.LocaleController.LocaleCoverageInfo L = new AyaNova.Api.Controllers.LocaleController.LocaleCoverageInfo();
|
||||||
|
L.RequestedKeys = ServerBootConfig.LocaleKeysRequested;
|
||||||
|
L.RequestedKeys.Sort();
|
||||||
|
var AllKeys = GetKeyList();
|
||||||
|
foreach (string StockKey in AllKeys)
|
||||||
|
{
|
||||||
|
if (!L.RequestedKeys.Contains(StockKey))
|
||||||
|
{
|
||||||
|
L.NotRequestedKeys.Add(StockKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
L.NotRequestedKeys.Sort();
|
||||||
|
L.RequestedKeyCount = L.RequestedKeys.Count;
|
||||||
|
L.NotRequestedKeyCount = L.NotRequestedKeys.Count;
|
||||||
|
|
||||||
|
return L;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Track requests for keys so we can determine which are being used and which are not
|
//Track requests for keys so we can determine which are being used and which are not
|
||||||
|
|||||||
@@ -41,11 +41,18 @@ namespace raven_integration
|
|||||||
((JArray)a.ObjectResponse["result"]).Count.Should().Be(2);
|
((JArray)a.ObjectResponse["result"]).Count.Should().Be(2);
|
||||||
|
|
||||||
//Now ensure there are at least two keys in the fetched keys array
|
//Now ensure there are at least two keys in the fetched keys array
|
||||||
a = await Util.GetAsync("Locale/RequestedKeyList", await Util.GetTokenAsync("ClientLimited"));
|
a = await Util.GetAsync("Locale/LocaleKeyCoverage", await Util.GetTokenAsync("ClientLimited"));
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
Util.ValidateHTTPStatusCode(a, 200);
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
|
var RequestedKeyCount = a.ObjectResponse["result"]["requestedKeyCount"].Value<int>();
|
||||||
|
RequestedKeyCount.Should().BeGreaterOrEqualTo(2);
|
||||||
|
var NotRequestedKeyCount = a.ObjectResponse["result"]["notRequestedKeyCount"].Value<int>();
|
||||||
|
NotRequestedKeyCount.Should().BeGreaterThan(1);//For now at least, once we have this dialed in it should be zero ultimately
|
||||||
|
|
||||||
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
||||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterOrEqualTo(2);
|
((JArray)a.ObjectResponse["result"]["requestedKeys"]).Count.Should().Be(RequestedKeyCount);
|
||||||
|
((JArray)a.ObjectResponse["result"]["notRequestedKeys"]).Count.Should().Be(NotRequestedKeyCount);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user