From f95628f8aee52c3a555bd69cbd437aea535339ed Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Sun, 3 Dec 2023 15:59:35 -0500 Subject: [PATCH] chore: rename ssh session handlers --- .../lib/src/sshnp/impl/sshnp_dart_pure_impl.dart | 8 +++++--- .../lib/src/sshnp/impl/sshnp_openssh_local_impl.dart | 2 +- .../dart_ssh_session_handler.dart} | 7 +++---- .../openssh_ssh_session_handler.dart} | 4 ++-- .../ssh_session_handler.dart} | 2 +- packages/noports_core/lib/sshnp_foundation.dart | 6 +++--- .../openssh_ssh_session_handler_mocks.dart} | 6 ++---- .../openssh_ssh_session_handler_test.dart} | 4 ++-- .../ssh_session_handler_test.dart} | 2 +- 9 files changed, 20 insertions(+), 21 deletions(-) rename packages/noports_core/lib/src/sshnp/util/{sshnp_initial_tunnel_handler/sshnp_dart_initial_tunnel_handler.dart => ssh_session_handler/dart_ssh_session_handler.dart} (97%) rename packages/noports_core/lib/src/sshnp/util/{sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler.dart => ssh_session_handler/openssh_ssh_session_handler.dart} (96%) rename packages/noports_core/lib/src/sshnp/util/{sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler.dart => ssh_session_handler/ssh_session_handler.dart} (88%) rename packages/noports_core/test/sshnp/util/{sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_mocks.dart => ssh_session_handler/openssh_ssh_session_handler_mocks.dart} (92%) rename packages/noports_core/test/sshnp/util/{sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_test.dart => ssh_session_handler/openssh_ssh_session_handler_test.dart} (92%) rename packages/noports_core/test/sshnp/util/{sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler_test.dart => ssh_session_handler/ssh_session_handler_test.dart} (94%) diff --git a/packages/noports_core/lib/src/sshnp/impl/sshnp_dart_pure_impl.dart b/packages/noports_core/lib/src/sshnp/impl/sshnp_dart_pure_impl.dart index e29b6a075..1b117db29 100644 --- a/packages/noports_core/lib/src/sshnp/impl/sshnp_dart_pure_impl.dart +++ b/packages/noports_core/lib/src/sshnp/impl/sshnp_dart_pure_impl.dart @@ -5,7 +5,7 @@ import 'package:dartssh2/dartssh2.dart'; import 'package:noports_core/sshnp_foundation.dart'; class SshnpDartPureImpl extends SshnpCore - with SshnpDartSshKeyHandler, SshnpDartSshSessionHandler { + with SshnpDartSshKeyHandler, DartSshSessionHandler { SshnpDartPureImpl({ required super.atClient, required super.params, @@ -114,10 +114,12 @@ class SshnpDartPureImpl extends SshnpCore @override Future runShell() async { if (tunnelSshClient == null) { - throw StateError('Cannot execute runShell, tunnel has not yet been created'); + throw StateError( + 'Cannot execute runShell, tunnel has not yet been created'); } - SSHClient userSession = await startUserSession(tunnelSession: tunnelSshClient!); + SSHClient userSession = + await startUserSession(tunnelSession: tunnelSshClient!); SSHSession shell = await userSession.shell(); diff --git a/packages/noports_core/lib/src/sshnp/impl/sshnp_openssh_local_impl.dart b/packages/noports_core/lib/src/sshnp/impl/sshnp_openssh_local_impl.dart index 51bbcd16f..9f26df680 100644 --- a/packages/noports_core/lib/src/sshnp/impl/sshnp_openssh_local_impl.dart +++ b/packages/noports_core/lib/src/sshnp/impl/sshnp_openssh_local_impl.dart @@ -6,7 +6,7 @@ import 'package:noports_core/src/common/io_types.dart'; import 'package:noports_core/sshnp_foundation.dart'; class SshnpOpensshLocalImpl extends SshnpCore - with SshnpLocalSshKeyHandler, SshnpOpensshSshSessionHandler { + with SshnpLocalSshKeyHandler, OpensshSshSessionHandler { SshnpOpensshLocalImpl({ required super.atClient, required super.params, diff --git a/packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_dart_initial_tunnel_handler.dart b/packages/noports_core/lib/src/sshnp/util/ssh_session_handler/dart_ssh_session_handler.dart similarity index 97% rename from packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_dart_initial_tunnel_handler.dart rename to packages/noports_core/lib/src/sshnp/util/ssh_session_handler/dart_ssh_session_handler.dart index 7732d89e2..33e688606 100644 --- a/packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_dart_initial_tunnel_handler.dart +++ b/packages/noports_core/lib/src/sshnp/util/ssh_session_handler/dart_ssh_session_handler.dart @@ -9,8 +9,8 @@ import 'package:dartssh2/dartssh2.dart'; import 'package:meta/meta.dart'; import 'package:noports_core/sshnp_foundation.dart'; -mixin SshnpDartSshSessionHandler on SshnpCore - implements SshnpSshSessionHandler { +mixin DartSshSessionHandler on SshnpCore + implements SshSessionHandler { /// Set up timer to check to see if all connections are down @visibleForTesting String get terminateMessage => @@ -69,8 +69,7 @@ mixin SshnpDartSshSessionHandler on SshnpCore } @override - Future startUserSession( - {required SSHClient tunnelSession}) async { + Future startUserSession({required SSHClient tunnelSession}) async { throw UnimplementedError(); // TODO v similar to startInitialTunnelSession } diff --git a/packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler.dart b/packages/noports_core/lib/src/sshnp/util/ssh_session_handler/openssh_ssh_session_handler.dart similarity index 96% rename from packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler.dart rename to packages/noports_core/lib/src/sshnp/util/ssh_session_handler/openssh_ssh_session_handler.dart index dfed9096d..31efaf5ee 100644 --- a/packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler.dart +++ b/packages/noports_core/lib/src/sshnp/util/ssh_session_handler/openssh_ssh_session_handler.dart @@ -6,8 +6,8 @@ import 'package:noports_core/src/common/io_types.dart'; import 'package:noports_core/src/common/openssh_binary_path.dart'; import 'package:noports_core/sshnp_foundation.dart'; -mixin SshnpOpensshSshSessionHandler on SshnpCore - implements SshnpSshSessionHandler { +mixin OpensshSshSessionHandler on SshnpCore + implements SshSessionHandler { @override Future startInitialTunnelSession({ required String keyPairIdentifier, diff --git a/packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler.dart b/packages/noports_core/lib/src/sshnp/util/ssh_session_handler/ssh_session_handler.dart similarity index 88% rename from packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler.dart rename to packages/noports_core/lib/src/sshnp/util/ssh_session_handler/ssh_session_handler.dart index 4591cac1d..5fb08be8e 100644 --- a/packages/noports_core/lib/src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler.dart +++ b/packages/noports_core/lib/src/sshnp/util/ssh_session_handler/ssh_session_handler.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:meta/meta.dart'; -mixin SshnpSshSessionHandler { +mixin SshSessionHandler { @protected @visibleForTesting Future startInitialTunnelSession({required String keyPairIdentifier}); diff --git a/packages/noports_core/lib/sshnp_foundation.dart b/packages/noports_core/lib/sshnp_foundation.dart index d26e5101f..59bedf3d3 100644 --- a/packages/noports_core/lib/sshnp_foundation.dart +++ b/packages/noports_core/lib/sshnp_foundation.dart @@ -24,9 +24,9 @@ export 'src/sshnp/util/sshrvd_channel/sshrvd_channel.dart'; export 'src/sshnp/util/sshrvd_channel/sshrvd_dart_channel.dart'; export 'src/sshnp/util/sshrvd_channel/sshrvd_exec_channel.dart'; -export 'src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler.dart'; -export 'src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_dart_initial_tunnel_handler.dart'; -export 'src/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler.dart'; +export 'src/sshnp/util/ssh_session_handler/ssh_session_handler.dart'; +export 'src/sshnp/util/ssh_session_handler/dart_ssh_session_handler.dart'; +export 'src/sshnp/util/ssh_session_handler/openssh_ssh_session_handler.dart'; export 'src/sshnp/util/sshnp_ssh_key_handler/sshnp_ssh_key_handler.dart'; export 'src/sshnp/util/sshnp_ssh_key_handler/sshnp_local_ssh_key_handler.dart'; diff --git a/packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_mocks.dart b/packages/noports_core/test/sshnp/util/ssh_session_handler/openssh_ssh_session_handler_mocks.dart similarity index 92% rename from packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_mocks.dart rename to packages/noports_core/test/sshnp/util/ssh_session_handler/openssh_ssh_session_handler_mocks.dart index 5080508c1..9b82e750a 100644 --- a/packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_mocks.dart +++ b/packages/noports_core/test/sshnp/util/ssh_session_handler/openssh_ssh_session_handler_mocks.dart @@ -12,7 +12,7 @@ abstract class StartInitialTunnelCaller { class StartInitialTunnelStub extends Mock implements StartInitialTunnelCaller {} /// Stubbed Mixin that we are testing -mixin StubbedSshnpOpensshSshSessionHandler on SshnpOpensshSshSessionHandler { +mixin StubbedSshnpOpensshSshSessionHandler on OpensshSshSessionHandler { late StartInitialTunnelStub _stubbedStartInitialTunnel; late StartProcessStub _stubbedStartProcess; @@ -39,9 +39,7 @@ mixin StubbedSshnpOpensshSshSessionHandler on SshnpOpensshSshSessionHandler { /// Stubbed Sshnp instance with the mixin class StubbedSshnp extends SshnpCore - with - SshnpOpensshSshSessionHandler, - StubbedSshnpOpensshSshSessionHandler { + with OpensshSshSessionHandler, StubbedSshnpOpensshSshSessionHandler { StubbedSshnp({ required super.atClient, required super.params, diff --git a/packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_test.dart b/packages/noports_core/test/sshnp/util/ssh_session_handler/openssh_ssh_session_handler_test.dart similarity index 92% rename from packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_test.dart rename to packages/noports_core/test/sshnp/util/ssh_session_handler/openssh_ssh_session_handler_test.dart index ed92a7727..006d11916 100644 --- a/packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_openssh_initial_tunnel_handler_test.dart +++ b/packages/noports_core/test/sshnp/util/ssh_session_handler/openssh_ssh_session_handler_test.dart @@ -6,7 +6,7 @@ import 'package:noports_core/sshnp_foundation.dart'; import 'package:test/test.dart'; import '../../sshnp_mocks.dart'; -import 'sshnp_openssh_initial_tunnel_handler_mocks.dart'; +import 'openssh_ssh_session_handler_mocks.dart'; void main() { group('SshnpOpensshSshSessionHandler', () { @@ -44,7 +44,7 @@ void main() { }); test('implements SshnpSshSessionHandler', () { - expect(stubbedSshnp, isA>()); + expect(stubbedSshnp, isA>()); }); // test public API test('startInitialTunnel', () {}); // test startInitialTunnel }); // group SshnpOpensshSshSessionHandler diff --git a/packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler_test.dart b/packages/noports_core/test/sshnp/util/ssh_session_handler/ssh_session_handler_test.dart similarity index 94% rename from packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler_test.dart rename to packages/noports_core/test/sshnp/util/ssh_session_handler/ssh_session_handler_test.dart index e6e749d94..ddadf48c7 100644 --- a/packages/noports_core/test/sshnp/util/sshnp_initial_tunnel_handler/sshnp_initial_tunnel_handler_test.dart +++ b/packages/noports_core/test/sshnp/util/ssh_session_handler/ssh_session_handler_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; import 'package:mocktail/mocktail.dart'; class StubbedSshnpSshSessionHandler extends Mock - with SshnpSshSessionHandler {} + with SshSessionHandler {} void main() { group('SshnpSshSessionHandler', () {