Skip to content

Commit

Permalink
chore!(servient): remove hasClientFor method
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 12, 2024
1 parent f252675 commit 8b40a72
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 0 additions & 4 deletions lib/src/core/implementation/consumed_thing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ class ConsumedThing implements scripting_api.ConsumedThing {
/// Determines the id of this [ConsumedThing].
String get identifier => thingDescription.identifier;

/// Checks if the [Servient] of this [ConsumedThing] supports a protocol
/// [scheme].
bool hasClientFor(String scheme) => servient.hasClientFor(scheme);

(ProtocolClient client, AugmentedForm form) _getClientFor(
List<Form> forms,
OperationType operationType,
Expand Down
3 changes: 0 additions & 3 deletions lib/src/core/implementation/servient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ class Servient {
ProtocolClientFactory? removeClientFactory(String scheme) =>
_clientFactories.remove(scheme);

/// Checks whether a [ProtocolClient] is avaiable for a given [scheme].
bool hasClientFor(String scheme) => _clientFactories.containsKey(scheme);

/// Returns the [ProtocolClient] associated with a given [scheme].
ProtocolClient clientFor(String scheme) {
final clientFactory = _clientFactories[scheme];
Expand Down
5 changes: 2 additions & 3 deletions test/core/servient_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ void main() {
);

expect(servient.clientSchemes, [testUriScheme]);
expect(servient.hasClientFor(testUriScheme), true);
});

test(
Expand All @@ -53,11 +52,11 @@ void main() {
final servient = Servient()
..addClientFactory(MockedProtocolClientFactory());

expect(servient.hasClientFor(testUriScheme), true);
expect(servient.clientSchemes.contains(testUriScheme), true);

servient.removeClientFactory(testUriScheme);

expect(servient.hasClientFor(testUriScheme), false);
expect(servient.clientSchemes.contains(testUriScheme), false);
expect(servient.clientSchemes.length, 0);
},
);
Expand Down

0 comments on commit 8b40a72

Please sign in to comment.