From 9cffb7d641bf2ccedb09d11b48eb11e432deb735 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sun, 28 Jul 2024 13:52:53 +0200 Subject: [PATCH] refactor(nextcloud_test): mark test targets as internal Signed-off-by: Nikolas Rimikis --- packages/nextcloud_test/lib/nextcloud_test.dart | 1 - .../nextcloud_test/lib/src/models/nextcloud_tester.dart | 1 + packages/nextcloud_test/lib/src/presets.dart | 1 + .../lib/src/test_target/docker_container.dart | 7 +++++-- packages/nextcloud_test/lib/src/test_target/local.dart | 9 +++++---- .../nextcloud_test/lib/src/test_target/test_target.dart | 3 ++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/nextcloud_test/lib/nextcloud_test.dart b/packages/nextcloud_test/lib/nextcloud_test.dart index bb8856958f8..261009f25ff 100644 --- a/packages/nextcloud_test/lib/nextcloud_test.dart +++ b/packages/nextcloud_test/lib/nextcloud_test.dart @@ -1,4 +1,3 @@ export 'src/defaults.dart'; export 'src/fixtures.dart' hide appendFixture; export 'src/presets.dart'; -export 'src/test_target/test_target.dart'; diff --git a/packages/nextcloud_test/lib/src/models/nextcloud_tester.dart b/packages/nextcloud_test/lib/src/models/nextcloud_tester.dart index 14f966ffaf2..99e200e8511 100644 --- a/packages/nextcloud_test/lib/src/models/nextcloud_tester.dart +++ b/packages/nextcloud_test/lib/src/models/nextcloud_tester.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud_test/nextcloud_test.dart'; import 'package:nextcloud_test/src/models/models.dart'; +import 'package:nextcloud_test/src/test_target/test_target.dart'; import 'package:version/version.dart'; /// Class that manages the creation of nextcloud api clients and the test environment. diff --git a/packages/nextcloud_test/lib/src/presets.dart b/packages/nextcloud_test/lib/src/presets.dart index a540f9e918e..5b0a6af78a0 100644 --- a/packages/nextcloud_test/lib/src/presets.dart +++ b/packages/nextcloud_test/lib/src/presets.dart @@ -1,6 +1,7 @@ import 'package:meta/meta.dart'; import 'package:nextcloud_test/nextcloud_test.dart'; import 'package:nextcloud_test/src/models/models.dart'; +import 'package:nextcloud_test/src/test_target/test_target.dart'; import 'package:test/test.dart'; /// Signature for callback to [presets]. diff --git a/packages/nextcloud_test/lib/src/test_target/docker_container.dart b/packages/nextcloud_test/lib/src/test_target/docker_container.dart index 0022352c615..54812ad1797 100644 --- a/packages/nextcloud_test/lib/src/test_target/docker_container.dart +++ b/packages/nextcloud_test/lib/src/test_target/docker_container.dart @@ -5,6 +5,7 @@ import 'dart:math'; import 'package:built_collection/built_collection.dart'; import 'package:glob/glob.dart'; import 'package:glob/list_local_fs.dart'; +import 'package:meta/meta.dart'; import 'package:nextcloud_test/src/models/models.dart'; import 'package:nextcloud_test/src/test_target/test_target.dart'; import 'package:path/path.dart' as p; @@ -14,7 +15,8 @@ import 'package:version/version.dart'; int _randomPort() => 1024 + Random().nextInt(65535 - 1024); /// Factory for spawning docker containers as test targets. -class DockerContainerFactory extends TestTargetFactory { +@internal +final class DockerContainerFactory extends TestTargetFactory { /// Creates a new docker container and returns its representation. @override Future spawn(Preset preset) async { @@ -83,7 +85,8 @@ class DockerContainerFactory extends TestTargetFactory } /// Test target representing a docker container. -class DockerContainerInstance extends TestTargetInstance { +@internal +final class DockerContainerInstance extends TestTargetInstance { /// Creates a new Docker container instance. DockerContainerInstance({ required this.id, diff --git a/packages/nextcloud_test/lib/src/test_target/local.dart b/packages/nextcloud_test/lib/src/test_target/local.dart index ce242073b80..38958031d33 100644 --- a/packages/nextcloud_test/lib/src/test_target/local.dart +++ b/packages/nextcloud_test/lib/src/test_target/local.dart @@ -2,15 +2,15 @@ import 'dart:async'; import 'dart:convert'; import 'package:built_collection/built_collection.dart'; -import 'package:nextcloud_test/nextcloud_test.dart'; +import 'package:meta/meta.dart'; import 'package:nextcloud_test/src/models/models.dart'; import 'package:nextcloud_test/src/test_target/test_target.dart'; import 'package:process_run/process_run.dart'; import 'package:version/version.dart'; /// Factory for running tests against a local instance. - -class LocalFactory extends TestTargetFactory { +@internal +final class LocalFactory extends TestTargetFactory { /// Creates a new test factory for a local server. LocalFactory({ required String dir, @@ -86,7 +86,8 @@ class LocalFactory extends TestTargetFactory { } /// Test target representing a local instance. -class LocalInstance extends TestTargetInstance { +@internal +final class LocalInstance extends TestTargetInstance { /// Creates a new test instance for a local server. LocalInstance({ required Uri url, diff --git a/packages/nextcloud_test/lib/src/test_target/test_target.dart b/packages/nextcloud_test/lib/src/test_target/test_target.dart index b35fb96c636..560f5b78d37 100644 --- a/packages/nextcloud_test/lib/src/test_target/test_target.dart +++ b/packages/nextcloud_test/lib/src/test_target/test_target.dart @@ -14,7 +14,7 @@ import 'package:nextcloud_test/src/test_target/local.dart'; import 'package:version/version.dart'; /// Factory for creating [TestTargetInstance]s. - +@internal abstract class TestTargetFactory { /// The instance of the [TestTargetFactory]. static final TestTargetFactory instance = TestTargetFactory._create(); @@ -49,6 +49,7 @@ abstract class TestTargetFactory { } /// Instance of a test target. +@internal abstract class TestTargetInstance { /// Destroys the instance. FutureOr destroy();