-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement automatic configuration of client (#39)
* Implement initial remote configurability Code quality is not in mind as of yet - this is merely a test to see if remote configuration works at all. * Cleanup and reorganization of remote configuration components * Ordering visual nitpick in LighthouseClient constructor * Remove mixed JSON lib and attributes JsonObjectAttribute isn't required * Move LighthouseApiImpl into Types.Interfaces * Update README to reflect remote configurability * Temporarily deprecate local configurability * Disable config unit test and address code scan warnings * Use SerializableAttribute instead of UsedImplicitlyAttribute * Remove nullable annotation from PartyIdPrefix * Remove default value locking from GUI * Move entity and config enums to Types.Enums This is to help with organization mostly - and the fact that these enums could be used elsewhere and you may not want to reference the entire Slot entity for example to access that enum. * Nitpick remote config failure log message * Move log enricher to a subclass in Logger * Add nullable asset warning and change most fail logs to errors * MainForm class doesn't really need to be sealed * Reflect changes in LBPUnion/ProjectLighthouse@1003d59 * Implement Refresh integration testing * Finalize changes from testing and add missing JsonPropertyName attribs * Add success log for remote configuration retrieval
- Loading branch information
Showing
26 changed files
with
267 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using LBPUnion.PLRPC.Types.Configuration; | ||
using LBPUnion.PLRPC.Types.Enums; | ||
using Xunit; | ||
|
||
namespace LBPUnion.PLRPC.Tests.Integration; | ||
|
||
[Trait("Category", "Integration")] | ||
public class ConfigurationTests | ||
{ | ||
private static readonly Logger unitTestLogger = new(); | ||
|
||
private static readonly HttpClient lighthouseUnitTestClient = new() | ||
{ | ||
BaseAddress = new Uri("https://lighthouse.lbpunion.com/api/v1/"), | ||
DefaultRequestHeaders = { { "User-Agent", "LBPUnion/1.0 (PLRPC; unit-test) ApiClient/2.0" } }, | ||
}; | ||
|
||
private static readonly HttpClient refreshUnitTestClient = new() | ||
{ | ||
BaseAddress = new Uri("https://refresh.jvyden.xyz/api/v1/"), | ||
DefaultRequestHeaders = { { "User-Agent", "LBPUnion/1.0 (PLRPC; unit-test) ApiClient/2.0" } }, | ||
}; | ||
|
||
private static readonly Configuration lighthouseConfig = new(lighthouseUnitTestClient, unitTestLogger); | ||
private static readonly Configuration refreshConfig = new(refreshUnitTestClient, unitTestLogger); | ||
|
||
[Fact] | ||
public async void CanRetrieveAndParseLighthouseConfiguration() | ||
{ | ||
RemoteConfiguration? remoteConfiguration = await lighthouseConfig.GetRemoteConfiguration(); | ||
|
||
if (remoteConfiguration == null) | ||
{ | ||
Assert.Fail("Failed to retrieve remote configuration"); | ||
} | ||
|
||
Assert.Equal("1060973475151495288", remoteConfiguration.ApplicationId); | ||
Assert.Equal("beacon", remoteConfiguration.PartyIdPrefix); | ||
Assert.Equal(UsernameType.Integer, remoteConfiguration.UsernameType); | ||
} | ||
|
||
[Fact] | ||
public async void CanRetrieveAndParseRefreshConfiguration() | ||
{ | ||
RemoteConfiguration? remoteConfiguration = await refreshConfig.GetRemoteConfiguration(); | ||
|
||
if (remoteConfiguration == null) | ||
{ | ||
Assert.Fail("Failed to retrieve remote configuration"); | ||
} | ||
|
||
Assert.Equal("1138956002037866648", remoteConfiguration.ApplicationId); | ||
Assert.Equal("LittleBigRefresh", remoteConfiguration.PartyIdPrefix); | ||
Assert.Equal(UsernameType.Username, remoteConfiguration.UsernameType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.