Skip to content

Commit b65b066

Browse files
committed
feat(api): Updated ProductId handlers
1 parent fe6248b commit b65b066

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

Kepware.Api.Test/ApiClient/GetProductInfo.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ public async Task GetProductInfoAsync_ShouldReturnProductInfo_WhenApiRespondsSuc
3636

3737
#region GetProductInfoAsync - SupportsJsonProjectLoadService
3838

39-
//TODO: Add more test cases for TKS versions as well. Different product name
4039
[Theory]
4140
[InlineData("KEPServerEX", "12", 6, 17, true)] // Supports JSON Project Load Service (6.17+)
4241
[InlineData("KEPServerEX", "12", 6, 16, false)] // Does not support it (6.16)
43-
[InlineData("ThingWorxKepwareEdge", "13", 1, 10, true)] // Supports it (1.10+)
42+
[InlineData("ThingworxKepwareServer", "12", 6, 17, true)] // Supports JSON Project Load Service (6.17+)
43+
[InlineData("ThingworxKepwareServer", "12", 6, 16, false)] // Does not support it (6.16)
44+
[InlineData("ThingWorxKepwareEdge", "13", 1, 10, true)] // Supports JSON Project Load Service (1.10+)
4445
[InlineData("ThingWorxKepwareEdge", "13", 1, 9, false)] // Does not support it (1.9)
46+
[InlineData("Kepware Edge", "13", 1, 0, true)] // Supports JSON Project Load Service
4547
[InlineData("UnknownProduct", "99", 10, 0, false)] // Unknown product, should be false
4648
public async Task GetProductInfoAsync_ShouldReturnCorrect_SupportsJsonProjectLoadService(
4749
string productName, string productId, int majorVersion, int minorVersion, bool expectedResult)
@@ -62,8 +64,10 @@ public async Task GetProductInfoAsync_ShouldReturnCorrect_SupportsJsonProjectLoa
6264
#region GetProductInfoAsync - ProductType
6365

6466
[Theory]
65-
[InlineData("KEPServerEX", "12", ProductType.KEPServerEX)]
66-
[InlineData("ThingWorxKepwareEdge", "13", ProductType.ThingWorxKepwareEdge)]
67+
[InlineData("KEPServerEX", "12", ProductType.KepwareServer)]
68+
[InlineData("ThingworxKepwareServer", "12", ProductType.KepwareServer)]
69+
[InlineData("ThingWorxKepwareEdge", "13", ProductType.KepwareEdge)]
70+
[InlineData("Kepware Edge", "13", ProductType.KepwareEdge)]
6771
[InlineData("UnknownProduct", "99", ProductType.Unknown)]
6872
[InlineData("InvalidProduct", "abc", ProductType.Unknown)] // Invalid ID, should be Unknown
6973
public async Task GetProductInfoAsync_ShouldReturnCorrect_ProductType(

Kepware.Api.TestIntg/ApiClient/ProjectApiHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task GetOrCreateChannelAsync_ShouldCreateChannel_WhenChannelDoesNot
4747
var channel = CreateTestChannel();
4848

4949
// Act
50-
var result = await _projectApiHandler.Channels.GetOrCreateChannelAsync(channel.Name, channel.DeviceDriver);
50+
var result = await _projectApiHandler.Channels.GetOrCreateChannelAsync(channel.Name, channel.DeviceDriver!);
5151

5252
// Assert
5353
Assert.NotNull(result);

Kepware.Api/Model/ApiMessages.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ public enum ProductType
6666
/// </summary>
6767
Unknown = 0,
6868
/// <summary>
69-
/// Thing worx Kepware Edge.
69+
/// Kepware Edge - This covers Edge branded products including Thingworx Kepware Edge.
7070
/// </summary>
71-
ThingWorxKepwareEdge = 13,
71+
KepwareEdge = 13,
7272
/// <summary>
73-
/// KEPServerEX.
73+
/// Kepware Server - This covers all Kepware branded products including KEPServerEX,
74+
/// Thingworx Kepware Server, and future products that use the Kepware Server codebase.
7475
/// </summary>
75-
KEPServerEX = 12
76+
KepwareServer = 12
7677
}
7778

7879
/// <summary>
@@ -149,8 +150,9 @@ public ProductType ProductType
149150
/// </summary>
150151
[JsonIgnore]
151152
public bool SupportsJsonProjectLoadService =>
152-
(ProductType == ProductType.KEPServerEX && (ProductVersionMajor > 6 || (ProductVersionMajor == 6 && ProductVersionMinor >= 17))) ||
153-
(ProductType == ProductType.ThingWorxKepwareEdge && (ProductVersionMajor > 1 || (ProductVersionMajor == 1 && ProductVersionMinor >= 10)));
153+
(ProductType == ProductType.KepwareServer && (ProductVersionMajor > 6 || (ProductVersionMajor == 6 && ProductVersionMinor >= 17))) ||
154+
(ProductType == ProductType.KepwareEdge && (ProductVersionMajor > 1 || (ProductVersionMajor == 1 && ProductVersionMinor >= 10))) ||
155+
(ProductType == ProductType.KepwareEdge && ProductName == "Kepware Edge");
154156
}
155157

156158

0 commit comments

Comments
 (0)