Skip to content

Commit 3aed6e0

Browse files
committed
Change PluginCategory to enum and delete PluginNamespace and fix related unit tests #15
1 parent db5501e commit 3aed6e0

7 files changed

Lines changed: 131 additions & 178 deletions

File tree

src/FlowSynx.PluginCore/PluginCategories.cs

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 117 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,133 @@
11
namespace FlowSynx.PluginCore;
22

3-
public sealed class PluginCategory
3+
/// <summary>
4+
/// Defines the logical categorization or role of a plugin within the system.
5+
/// </summary>
6+
public enum PluginCategory
47
{
58
/// <summary>
6-
/// Gets the unique identifier or key of the category (optional).
9+
/// Plugins that offer artificial intelligence capabilities
10+
/// such as computer vision, natural language processing, or reasoning engines.
711
/// </summary>
8-
public string Id { get; }
12+
AI,
913

1014
/// <summary>
11-
/// Gets the human-readable title of the category.
15+
/// Plugins that provide or consume Application Programming Interfaces (APIs),
16+
/// including REST, GraphQL, or RPC-based services.
1217
/// </summary>
13-
public string Title { get; }
18+
Api,
1419

1520
/// <summary>
16-
/// Gets the description of the category.
21+
/// Plugins that handle identity and access management (IAM), SSO, OAuth,
22+
/// or multi-factor authentication services.
1723
/// </summary>
18-
public string Description { get; }
24+
Authentication,
1925

20-
private PluginCategory(string id, string title, string description)
21-
{
22-
Id = id ?? throw new ArgumentNullException(nameof(id));
23-
Title = title ?? throw new ArgumentNullException(nameof(title));
24-
Description = description ?? throw new ArgumentNullException(nameof(description));
25-
}
26+
/// <summary>
27+
/// Plugins that help in collecting, analyzing, and visualizing
28+
/// business data to support decision-making.
29+
/// </summary>
30+
BusinessIntelligence,
2631

27-
public override bool Equals(object? obj) =>
28-
obj is PluginCategory other && Id == other.Id;
32+
/// <summary>
33+
/// Plugins that specifically target blockchain protocols, nodes,
34+
/// ledger manipulation, or tokenomics, beyond just Web3.
35+
/// </summary>
36+
Blockchain,
2937

30-
public override int GetHashCode() => Id.GetHashCode();
38+
/// <summary>
39+
/// Plugins that enable integration with cloud service providers
40+
/// such as AWS, Azure, Google Cloud, and others.
41+
/// </summary>
42+
Cloud,
3143

32-
public override string ToString() => $"{Title} ({Id})";
44+
/// <summary>
45+
/// Plugins that handle messaging, chat, email, VoIP, SMS,
46+
/// or other communication protocols and services.
47+
/// </summary>
48+
Communication,
49+
50+
/// <summary>
51+
/// Plugins for data processing, transformation, pipelines,
52+
/// and data flow orchestration.
53+
/// </summary>
54+
Data,
3355

34-
internal static PluginCategory Create(string id, string title, string description) =>
35-
new PluginCategory(id, title, description);
36-
}
56+
/// <summary>
57+
/// Plugins that provide access to or manage relational and non-relational
58+
/// database systems like PostgreSQL, MySQL, MongoDB, etc.
59+
/// </summary>
60+
Database,
61+
62+
/// <summary>
63+
/// Plugins that assist with infrastructure automation, CI/CD pipelines,
64+
/// configuration management, and deployment tooling.
65+
/// </summary>
66+
DevOps,
67+
68+
/// <summary>
69+
/// Plugins related to financial systems, transactions, accounting,
70+
/// billing, and related computations.
71+
/// </summary>
72+
Finance,
73+
74+
/// <summary>
75+
/// Plugins that implement or assist with machine learning workflows,
76+
/// including model training, evaluation, and prediction.
77+
/// </summary>
78+
ML,
79+
80+
/// <summary>
81+
/// Plugins that observe the health, performance, and uptime
82+
/// of applications and infrastructure.
83+
/// </summary>
84+
Monitoring,
85+
86+
/// <summary>
87+
/// Plugins that capture logs, aggregate them, parse,
88+
/// and send them to external logging systems or dashboards.
89+
/// </summary>
90+
Logging,
91+
92+
/// <summary>
93+
/// Plugins that support network operations, diagnostics,
94+
/// connectivity, DNS, routing, firewalls, and load balancers.
95+
/// </summary>
96+
Networking,
97+
98+
/// <summary>
99+
/// Plugins that support task management, project planning,
100+
/// issue tracking, or general workflow automation.
101+
/// </summary>
102+
ProjectWorkflow,
103+
104+
/// <summary>
105+
/// Plugins for managing company resources such as HR, inventory,
106+
/// scheduling, budgeting, or operations planning.
107+
/// </summary>
108+
ResourcePlanning,
109+
110+
/// <summary>
111+
/// Plugins that enhance security features such as encryption,
112+
/// vulnerability scanning, firewalls, or threat detection.
113+
/// </summary>
114+
Security,
115+
116+
/// <summary>
117+
/// Plugins for file storage, blob storage, object storage,
118+
/// or distributed storage systems.
119+
/// </summary>
120+
Storage,
121+
122+
/// <summary>
123+
/// Plugins that run or support automated and manual tests,
124+
/// including unit, integration, and end-to-end testing tools.
125+
/// </summary>
126+
Testing,
127+
128+
/// <summary>
129+
/// Plugins that build and serve websites or web applications,
130+
/// including frontend and backend frameworks.
131+
/// </summary>
132+
Web
133+
}

src/FlowSynx.PluginCore/PluginMetadata.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,16 @@ public required string CompanyName
101101
public string? ReadMe { get; set; }
102102

103103
/// <summary>
104-
/// Gets or sets the namespace the plugin belongs to.
104+
/// Gets or sets the category the plugin belongs to.
105105
/// Used as the middle component in the plugin's type identifier.
106106
/// </summary>
107-
public required PluginNamespace Namespace { get; set; }
107+
public required PluginCategory Category { get; set; }
108108

109109
/// <summary>
110110
/// Gets the full plugin type name in the format: CompanyName.Namespace.PluginName.
111111
/// This is used for plugin resolution, identification, or registration.
112112
/// </summary>
113-
public string Type => $"{CompanyName}.{Namespace}.{Name}";
114-
115-
/// <summary>
116-
/// Gets the category of the plugin.
117-
/// </summary>
118-
public required PluginCategory Category { get; set; }
113+
public string Type => $"{CompanyName}.{Category.ToString()}.{Name}";
119114

120115
/// <summary>
121116
/// Validates that an identifier is non-empty, starts with a letter,

src/FlowSynx.PluginCore/PluginNamespace.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/FlowSynx.PluginCore.UnitTests/PluginMetadataTests.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ public void TypeProperty_ReturnsCorrectFormat()
1111
Id = Guid.NewGuid(),
1212
Name = "MyPlugin",
1313
Version = new PluginVersion(1, 0, 0),
14-
Namespace = PluginNamespace.Connectors,
14+
Category = PluginCategory.Api,
1515
CompanyName = "Test",
16-
Category = PluginCategories.WebApi
1716
};
1817

1918
// Act
2019
var type = metadata.Type;
2120

2221
// Assert
23-
Assert.Equal("Test.Connectors.MyPlugin", type);
22+
Assert.Equal("Test.Api.MyPlugin", type);
2423
}
2524

2625
[Fact]
@@ -29,7 +28,7 @@ public void Properties_AreAssignedCorrectly()
2928
// Arrange
3029
var id = Guid.NewGuid();
3130
var version = new PluginVersion(1, 2, 3);
32-
var ns = PluginNamespace.Connectors;
31+
var category = PluginCategory.Api;
3332

3433
var metadata = new PluginMetadata
3534
{
@@ -39,9 +38,8 @@ public void Properties_AreAssignedCorrectly()
3938
Description = "Performs analytics",
4039
Authors = new List<string> { "DevTeam" },
4140
ProjectUrl = "https://registry.flowsynx.io/AnalyticsPlugin/",
42-
Namespace = ns,
43-
CompanyName= "Test",
44-
Category = PluginCategories.WebApi
41+
Category = category,
42+
CompanyName= "Test"
4543
};
4644

4745
// Assert
@@ -51,8 +49,8 @@ public void Properties_AreAssignedCorrectly()
5149
Assert.Equal("Performs analytics", metadata.Description);
5250
Assert.Equal("DevTeam", metadata.Authors[0]);
5351
Assert.Equal("https://registry.flowsynx.io/AnalyticsPlugin/", metadata.ProjectUrl);
54-
Assert.Equal(ns, metadata.Namespace);
55-
Assert.Equal("Test.Connectors.AnalyticsPlugin", metadata.Type);
52+
Assert.Equal(category, metadata.Category);
53+
Assert.Equal("Test.Api.AnalyticsPlugin", metadata.Type);
5654
}
5755

5856
[Fact]
@@ -64,15 +62,14 @@ public void TypeProperty_HandlesDifferentNamespacesAndNames()
6462
Id = Guid.NewGuid(),
6563
Name = "Processor",
6664
Version = new PluginVersion(0, 1, 1),
67-
Namespace = PluginNamespace.Transformers,
65+
Category = PluginCategory.AI,
6866
CompanyName = "Test",
69-
Category = PluginCategories.WebApi
7067
};
7168

7269
// Act
7370
var type = metadata.Type;
7471

7572
// Assert
76-
Assert.Equal("Test.Transformers.Processor", type);
73+
Assert.Equal("Test.AI.Processor", type);
7774
}
7875
}

tests/FlowSynx.PluginCore.UnitTests/PluginNamespaceTests.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)