From 970ed35b578f53af743261de2ffeb0799196a784 Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Thu, 4 Jan 2024 05:42:04 +0100 Subject: [PATCH] feat!: rework library structure --- example/coap_discovery.dart | 3 +- example/coap_dns_sd_discovery.dart | 3 +- example/coaps_readproperty.dart | 3 +- example/complex_example.dart | 4 +- example/core_link_format_discovery.dart | 3 +- example/example.dart | 3 +- example/http_basic_authentication.dart | 3 +- example/mqtt_example.dart | 3 +- lib/core.dart | 32 +++ lib/dart_wot.dart | 15 -- lib/definitions.dart | 17 -- lib/scripting_api.dart | 23 -- lib/src/binding_coap/coap_client.dart | 7 +- lib/src/binding_coap/coap_extensions.dart | 18 +- lib/src/binding_coap/coap_server.dart | 2 +- lib/src/binding_coap/coap_subscription.dart | 2 +- lib/src/binding_http/http_client.dart | 12 +- lib/src/binding_http/http_request_method.dart | 4 +- lib/src/binding_http/http_server.dart | 2 +- lib/src/binding_mqtt/mqtt_client.dart | 2 +- lib/src/binding_mqtt/mqtt_extensions.dart | 9 +- lib/src/binding_mqtt/mqtt_subscription.dart | 4 +- lib/src/core/augmented_form.dart | 16 +- lib/src/core/codecs/cbor_codec.dart | 4 +- lib/src/core/codecs/content_codec.dart | 4 +- lib/src/core/codecs/json_codec.dart | 4 +- lib/src/core/codecs/text_codec.dart | 4 +- lib/src/core/consumed_thing.dart | 22 +- lib/src/core/content.dart | 4 +- lib/src/core/content_serdes.dart | 4 +- lib/src/core/credentials/ace_credentials.dart | 2 +- .../core/credentials/apikey_credentials.dart | 2 +- .../core/credentials/basic_credentials.dart | 2 +- .../core/credentials/bearer_credentials.dart | 2 +- lib/src/core/credentials/callbacks.dart | 2 +- .../core/credentials/digest_credentials.dart | 2 +- .../core/credentials/oauth2_credentials.dart | 2 +- lib/src/core/credentials/psk_credentials.dart | 2 +- .../additional_expected_response.dart | 0 .../{ => core}/definitions/data_schema.dart | 0 .../definitions/expected_response.dart | 0 .../definitions/extensions/json_parser.dart | 0 lib/src/{ => core}/definitions/form.dart | 0 .../interaction_affordances/action.dart | 0 .../interaction_affordances/event.dart | 0 .../interaction_affordance.dart | 0 .../interaction_affordances/property.dart | 0 lib/src/{ => core}/definitions/link.dart | 0 .../definitions/operation_type.dart | 0 .../security/ace_security_scheme.dart | 0 .../security/apikey_security_scheme.dart | 0 .../security/auto_security_scheme.dart | 0 .../security/basic_security_scheme.dart | 0 .../security/bearer_security_scheme.dart | 0 .../security/combo_security_scheme.dart | 0 .../security/digest_security_scheme.dart | 0 .../security/no_security_scheme.dart | 0 .../security/oauth2_security_scheme.dart | 0 .../security/psk_security_scheme.dart | 0 .../definitions/security/security_scheme.dart | 0 .../definitions/thing_description.dart | 0 .../{ => core}/definitions/thing_model.dart | 0 .../validation/thing_description_schema.dart | 0 .../validation/validation_exception.dart | 0 .../{ => core}/definitions/version_info.dart | 0 lib/src/core/exposed_thing.dart | 10 +- lib/src/core/interaction_output.dart | 6 +- .../protocol_interfaces/protocol_client.dart | 2 +- .../protocol_interfaces/protocol_server.dart | 2 +- .../scripting_api/consumed_thing.dart | 0 .../scripting_api/data_schema_value.dart | 0 .../discovery/discovery_method.dart | 0 .../discovery/thing_discovery.dart | 0 .../scripting_api/discovery/thing_filter.dart | 0 .../scripting_api/exposed_thing.dart | 0 .../scripting_api/interaction_input.dart | 0 .../scripting_api/interaction_output.dart | 0 .../scripting_api/subscription.dart | 0 lib/src/{ => core}/scripting_api/types.dart | 0 lib/src/{ => core}/scripting_api/wot.dart | 1 + lib/src/core/servient.dart | 6 +- lib/src/core/thing_discovery.dart | 17 +- lib/src/core/wot.dart | 24 +- test/binding_coap/binding_coap_test.dart | 4 +- .../binding_coap/binding_coap_test.mocks.dart | 225 ++++++++++++++---- test/binding_coap/coap_vocabulary_test.dart | 4 +- test/binding_http/http_test.dart | 3 +- test/binding_http/http_test.mocks.dart | 225 ++++++++++++++---- test/binding_mqtt/mqtt_extension_test.dart | 4 +- test/core/augmented_form_test.dart | 5 +- test/core/codec_test.dart | 2 +- test/core/consumed_thing_test.dart | 14 +- test/core/content_serdes_test.dart | 4 +- test/core/content_test.dart | 2 +- test/core/dart_wot_test.dart | 4 +- test/core/definitions_test.dart | 17 +- test/core/discovery_test.dart | 6 +- test/core/operation_type_test.dart | 6 +- test/core/servient_test.dart | 2 +- test/core/thing_description_test.dart | 2 +- test/core/thing_model_test.dart | 2 +- .../scripting_api/data_schema_value_test.dart | 2 +- .../scripting_api/interaction_input_test.dart | 2 +- 103 files changed, 541 insertions(+), 314 deletions(-) delete mode 100644 lib/dart_wot.dart delete mode 100644 lib/definitions.dart delete mode 100644 lib/scripting_api.dart rename lib/src/{ => core}/definitions/additional_expected_response.dart (100%) rename lib/src/{ => core}/definitions/data_schema.dart (100%) rename lib/src/{ => core}/definitions/expected_response.dart (100%) rename lib/src/{ => core}/definitions/extensions/json_parser.dart (100%) rename lib/src/{ => core}/definitions/form.dart (100%) rename lib/src/{ => core}/definitions/interaction_affordances/action.dart (100%) rename lib/src/{ => core}/definitions/interaction_affordances/event.dart (100%) rename lib/src/{ => core}/definitions/interaction_affordances/interaction_affordance.dart (100%) rename lib/src/{ => core}/definitions/interaction_affordances/property.dart (100%) rename lib/src/{ => core}/definitions/link.dart (100%) rename lib/src/{ => core}/definitions/operation_type.dart (100%) rename lib/src/{ => core}/definitions/security/ace_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/apikey_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/auto_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/basic_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/bearer_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/combo_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/digest_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/no_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/oauth2_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/psk_security_scheme.dart (100%) rename lib/src/{ => core}/definitions/security/security_scheme.dart (100%) rename lib/src/{ => core}/definitions/thing_description.dart (100%) rename lib/src/{ => core}/definitions/thing_model.dart (100%) rename lib/src/{ => core}/definitions/validation/thing_description_schema.dart (100%) rename lib/src/{ => core}/definitions/validation/validation_exception.dart (100%) rename lib/src/{ => core}/definitions/version_info.dart (100%) rename lib/src/{ => core}/scripting_api/consumed_thing.dart (100%) rename lib/src/{ => core}/scripting_api/data_schema_value.dart (100%) rename lib/src/{ => core}/scripting_api/discovery/discovery_method.dart (100%) rename lib/src/{ => core}/scripting_api/discovery/thing_discovery.dart (100%) rename lib/src/{ => core}/scripting_api/discovery/thing_filter.dart (100%) rename lib/src/{ => core}/scripting_api/exposed_thing.dart (100%) rename lib/src/{ => core}/scripting_api/interaction_input.dart (100%) rename lib/src/{ => core}/scripting_api/interaction_output.dart (100%) rename lib/src/{ => core}/scripting_api/subscription.dart (100%) rename lib/src/{ => core}/scripting_api/types.dart (100%) rename lib/src/{ => core}/scripting_api/wot.dart (99%) diff --git a/example/coap_discovery.dart b/example/coap_discovery.dart index 214449bb..7fda6b3d 100644 --- a/example/coap_discovery.dart +++ b/example/coap_discovery.dart @@ -6,7 +6,8 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/core.dart"; const propertyName = "string"; diff --git a/example/coap_dns_sd_discovery.dart b/example/coap_dns_sd_discovery.dart index ef424bbc..0204a199 100644 --- a/example/coap_dns_sd_discovery.dart +++ b/example/coap_dns_sd_discovery.dart @@ -6,7 +6,8 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/core.dart"; void handleThingDescription(ThingDescription thingDescription) => print('Discovered TD with title "${thingDescription.title}".'); diff --git a/example/coaps_readproperty.dart b/example/coaps_readproperty.dart index 4bea01b9..807fb816 100644 --- a/example/coaps_readproperty.dart +++ b/example/coaps_readproperty.dart @@ -8,7 +8,8 @@ import "dart:typed_data"; -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/core.dart"; /// Matches [PskCredentials] by hostname and URI scheme. final Map _pskCredentialsStore = { diff --git a/example/complex_example.dart b/example/complex_example.dart index 22b17d41..99477f5b 100644 --- a/example/complex_example.dart +++ b/example/complex_example.dart @@ -6,7 +6,9 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/binding_http.dart"; +import "package:dart_wot/core.dart"; const thingDescriptionJson = { "@context": [ diff --git a/example/core_link_format_discovery.dart b/example/core_link_format_discovery.dart index 8452f596..4681bc2d 100644 --- a/example/core_link_format_discovery.dart +++ b/example/core_link_format_discovery.dart @@ -6,7 +6,8 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/core.dart"; Future main(List args) async { final servient = Servient(clientFactories: [CoapClientFactory()]); diff --git a/example/example.dart b/example/example.dart index 93109152..94bc1773 100644 --- a/example/example.dart +++ b/example/example.dart @@ -6,7 +6,8 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/core.dart"; Future main(List args) async { final servient = Servient( diff --git a/example/http_basic_authentication.dart b/example/http_basic_authentication.dart index 7b979d6f..ed475502 100644 --- a/example/http_basic_authentication.dart +++ b/example/http_basic_authentication.dart @@ -6,7 +6,8 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_http.dart"; +import "package:dart_wot/core.dart"; const username = "username"; const password = "password"; diff --git a/example/mqtt_example.dart b/example/mqtt_example.dart index 21d34cc6..97d2d753 100644 --- a/example/mqtt_example.dart +++ b/example/mqtt_example.dart @@ -6,7 +6,8 @@ // ignore_for_file: avoid_print -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_mqtt.dart"; +import "package:dart_wot/core.dart"; const thingDescriptionJson = { "@context": "https://www.w3.org/2022/wot/td/v1.1", diff --git a/lib/core.dart b/lib/core.dart index f7455969..26de7463 100644 --- a/lib/core.dart +++ b/lib/core.dart @@ -23,7 +23,39 @@ export "src/core/credentials/credentials.dart"; export "src/core/credentials/digest_credentials.dart"; export "src/core/credentials/oauth2_credentials.dart"; export "src/core/credentials/psk_credentials.dart"; + +export "src/core/definitions/form.dart"; + +export "src/core/definitions/security/ace_security_scheme.dart"; +export "src/core/definitions/security/apikey_security_scheme.dart"; +export "src/core/definitions/security/auto_security_scheme.dart"; +export "src/core/definitions/security/basic_security_scheme.dart"; +export "src/core/definitions/security/bearer_security_scheme.dart"; +export "src/core/definitions/security/combo_security_scheme.dart"; +export "src/core/definitions/security/digest_security_scheme.dart"; +export "src/core/definitions/security/no_security_scheme.dart"; +export "src/core/definitions/security/oauth2_security_scheme.dart"; +export "src/core/definitions/security/psk_security_scheme.dart"; + +export "src/core/definitions/thing_description.dart"; +export "src/core/definitions/thing_model.dart"; +export "src/core/definitions/validation/thing_description_schema.dart" + show thingDescriptionSchema; + export "src/core/protocol_interfaces/protocol_client.dart"; export "src/core/protocol_interfaces/protocol_client_factory.dart"; export "src/core/protocol_interfaces/protocol_server.dart"; + +export "src/core/scripting_api/consumed_thing.dart"; +export "src/core/scripting_api/data_schema_value.dart"; +export "src/core/scripting_api/discovery/discovery_method.dart"; +export "src/core/scripting_api/discovery/thing_discovery.dart"; +export "src/core/scripting_api/discovery/thing_filter.dart"; +export "src/core/scripting_api/exposed_thing.dart"; +export "src/core/scripting_api/interaction_input.dart"; +export "src/core/scripting_api/interaction_output.dart"; +export "src/core/scripting_api/subscription.dart"; +export "src/core/scripting_api/types.dart"; +export "src/core/scripting_api/wot.dart"; + export "src/core/servient.dart"; diff --git a/lib/dart_wot.dart b/lib/dart_wot.dart deleted file mode 100644 index 04c6ae41..00000000 --- a/lib/dart_wot.dart +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2021 Contributors to the Eclipse Foundation. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// -// SPDX-License-Identifier: BSD-3-Clause - -/// A W3C Web of Things implementation written in Dart. -library dart_wot; - -export "binding_coap.dart"; -export "binding_http.dart"; -export "binding_mqtt.dart"; -export "core.dart"; -export "definitions.dart"; -export "scripting_api.dart"; diff --git a/lib/definitions.dart b/lib/definitions.dart deleted file mode 100644 index 0d0a3d8c..00000000 --- a/lib/definitions.dart +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 Contributors to the Eclipse Foundation. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// -// SPDX-License-Identifier: BSD-3-Clause - -/// Provides Thing Description and Thing Model Definitions that follow the -/// [WoT Thing Description Specification][spec link]. -/// -/// [spec link]: https://www.w3.org/TR/wot-thing-description11/ -library definitions; - -export "src/definitions/form.dart"; -export "src/definitions/thing_description.dart"; -export "src/definitions/thing_model.dart"; -export "src/definitions/validation/thing_description_schema.dart" - show thingDescriptionSchema; diff --git a/lib/scripting_api.dart b/lib/scripting_api.dart deleted file mode 100644 index 0c9fbab5..00000000 --- a/lib/scripting_api.dart +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 Contributors to the Eclipse Foundation. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// -// SPDX-License-Identifier: BSD-3-Clause - -/// Defines interfaces that follow the -/// [WoT Scripting API Specification][spec link]. -/// -/// [spec link]: https://www.w3.org/TR/wot-scripting-api/ -library scripting_api; - -export "src/scripting_api/consumed_thing.dart"; -export "src/scripting_api/data_schema_value.dart"; -export "src/scripting_api/discovery/discovery_method.dart"; -export "src/scripting_api/discovery/thing_discovery.dart"; -export "src/scripting_api/discovery/thing_filter.dart"; -export "src/scripting_api/exposed_thing.dart"; -export "src/scripting_api/interaction_input.dart"; -export "src/scripting_api/interaction_output.dart"; -export "src/scripting_api/subscription.dart"; -export "src/scripting_api/types.dart"; -export "src/scripting_api/wot.dart"; diff --git a/lib/src/binding_coap/coap_client.dart b/lib/src/binding_coap/coap_client.dart index 8213d44c..89753e36 100644 --- a/lib/src/binding_coap/coap_client.dart +++ b/lib/src/binding_coap/coap_client.dart @@ -16,10 +16,9 @@ import "../core/content.dart"; import "../core/credentials/ace_credentials.dart"; import "../core/credentials/callbacks.dart"; import "../core/credentials/psk_credentials.dart"; +import "../core/definitions/operation_type.dart"; import "../core/protocol_interfaces/protocol_client.dart"; -import "../definitions/form.dart"; -import "../definitions/operation_type.dart"; -import "../scripting_api/subscription.dart"; +import "../core/scripting_api/subscription.dart"; import "coap_binding_exception.dart"; import "coap_config.dart"; import "coap_definitions.dart"; @@ -256,7 +255,7 @@ final class CoapClient implements ProtocolClient { } /// Obtains an ACE creation hint serialized as a [List] of [int] from a - /// [Form]. + /// [form]. /// /// Returns `null` if no `ACESecurityScheme` is defined. Future _obtainAceCreationHintFromForm( diff --git a/lib/src/binding_coap/coap_extensions.dart b/lib/src/binding_coap/coap_extensions.dart index 8e409f04..d60d0cb3 100644 --- a/lib/src/binding_coap/coap_extensions.dart +++ b/lib/src/binding_coap/coap_extensions.dart @@ -3,17 +3,13 @@ import "dart:typed_data"; import "package:cbor/cbor.dart"; import "package:coap/coap.dart"; -import "package:dcaf/dcaf.dart"; - -import "../core/augmented_form.dart"; -import "../core/content.dart"; -import "../definitions/expected_response.dart"; -import "../definitions/form.dart"; -import "../definitions/operation_type.dart"; -import "../definitions/security/ace_security_scheme.dart"; -import "../definitions/security/auto_security_scheme.dart"; -import "../definitions/security/psk_security_scheme.dart"; -import "../definitions/validation/validation_exception.dart"; + +import "package:dart_wot/core.dart" hide PskCredentials; +import "package:dart_wot/src/core/content.dart"; +import "package:dart_wot/src/core/definitions/expected_response.dart"; +import "package:dart_wot/src/core/definitions/operation_type.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; + import "coap_binding_exception.dart"; import "coap_definitions.dart"; diff --git a/lib/src/binding_coap/coap_server.dart b/lib/src/binding_coap/coap_server.dart index 690f208d..041613b0 100644 --- a/lib/src/binding_coap/coap_server.dart +++ b/lib/src/binding_coap/coap_server.dart @@ -6,7 +6,7 @@ import "../core/credentials/callbacks.dart"; import "../core/protocol_interfaces/protocol_server.dart"; -import "../scripting_api/exposed_thing.dart"; +import '../core/scripting_api/exposed_thing.dart'; import "coap_config.dart"; /// A [ProtocolServer] for the Constrained Application Protocol (CoAP). diff --git a/lib/src/binding_coap/coap_subscription.dart b/lib/src/binding_coap/coap_subscription.dart index e660189e..3e068cae 100644 --- a/lib/src/binding_coap/coap_subscription.dart +++ b/lib/src/binding_coap/coap_subscription.dart @@ -6,7 +6,7 @@ import "package:coap/coap.dart"; -import "../scripting_api/subscription.dart"; +import '../core/scripting_api/subscription.dart'; /// [Subscription] to a CoAP resource, based on the observe option ([RFC 7641]). /// diff --git a/lib/src/binding_http/http_client.dart b/lib/src/binding_http/http_client.dart index dc3b4b1b..4602bd39 100644 --- a/lib/src/binding_http/http_client.dart +++ b/lib/src/binding_http/http_client.dart @@ -7,19 +7,11 @@ import "dart:convert"; import "dart:io"; +import "package:dart_wot/core.dart"; +import "package:dart_wot/src/core/definitions/operation_type.dart"; import "package:http/http.dart"; -import "../core/augmented_form.dart"; import "../core/content.dart"; -import "../core/credentials/basic_credentials.dart"; -import "../core/credentials/bearer_credentials.dart"; -import "../core/credentials/callbacks.dart"; -import "../core/protocol_interfaces/protocol_client.dart"; -import "../definitions/form.dart"; -import "../definitions/operation_type.dart"; -import "../definitions/security/basic_security_scheme.dart"; -import "../definitions/security/bearer_security_scheme.dart"; -import "../scripting_api/subscription.dart"; import "http_request_method.dart"; import "http_security_exception.dart"; diff --git a/lib/src/binding_http/http_request_method.dart b/lib/src/binding_http/http_request_method.dart index c8551bbe..e41b1dc3 100644 --- a/lib/src/binding_http/http_request_method.dart +++ b/lib/src/binding_http/http_request_method.dart @@ -1,5 +1,5 @@ -import "../definitions/form.dart"; -import "../definitions/operation_type.dart"; +import "package:dart_wot/src/core/definitions/form.dart"; +import "package:dart_wot/src/core/definitions/operation_type.dart"; const _getString = "GET"; const _putString = "PUT"; diff --git a/lib/src/binding_http/http_server.dart b/lib/src/binding_http/http_server.dart index 757bd93e..e5dbaad3 100644 --- a/lib/src/binding_http/http_server.dart +++ b/lib/src/binding_http/http_server.dart @@ -6,7 +6,7 @@ import "../core/credentials/callbacks.dart"; import "../core/protocol_interfaces/protocol_server.dart"; -import "../scripting_api/exposed_thing.dart"; +import "../core/scripting_api/exposed_thing.dart"; import "http_config.dart"; /// A [ProtocolServer] for the Hypertext Transfer Protocol (HTTP). diff --git a/lib/src/binding_mqtt/mqtt_client.dart b/lib/src/binding_mqtt/mqtt_client.dart index 4869a010..6d96e509 100644 --- a/lib/src/binding_mqtt/mqtt_client.dart +++ b/lib/src/binding_mqtt/mqtt_client.dart @@ -15,7 +15,7 @@ import "../core/content.dart"; import "../core/credentials/basic_credentials.dart"; import "../core/credentials/callbacks.dart"; import "../core/protocol_interfaces/protocol_client.dart"; -import "../scripting_api/subscription.dart" as scripting_api; +import "../core/scripting_api/subscription.dart" as scripting_api; import "constants.dart"; import "mqtt_binding_exception.dart"; import "mqtt_config.dart"; diff --git a/lib/src/binding_mqtt/mqtt_extensions.dart b/lib/src/binding_mqtt/mqtt_extensions.dart index 78878ec4..9555e422 100644 --- a/lib/src/binding_mqtt/mqtt_extensions.dart +++ b/lib/src/binding_mqtt/mqtt_extensions.dart @@ -5,16 +5,13 @@ // SPDX-License-Identifier: BSD-3-Clause import "package:curie/curie.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; import "package:mqtt_client/mqtt_client.dart"; import "package:mqtt_client/mqtt_server_client.dart"; import "package:uuid/uuid.dart"; -import "../core/augmented_form.dart"; -import "../core/credentials/basic_credentials.dart"; -import "../definitions/form.dart"; -import "../definitions/security/auto_security_scheme.dart"; -import "../definitions/security/basic_security_scheme.dart"; -import "../definitions/validation/validation_exception.dart"; +import "../../core.dart"; + import "constants.dart"; import "mqtt_binding_exception.dart"; diff --git a/lib/src/binding_mqtt/mqtt_subscription.dart b/lib/src/binding_mqtt/mqtt_subscription.dart index 3487f99d..0cea8948 100644 --- a/lib/src/binding_mqtt/mqtt_subscription.dart +++ b/lib/src/binding_mqtt/mqtt_subscription.dart @@ -4,12 +4,12 @@ // // SPDX-License-Identifier: BSD-3-Clause +import "package:dart_wot/core.dart"; import "package:mqtt_client/mqtt_client.dart"; import "package:mqtt_client/mqtt_server_client.dart"; import "../core/content.dart"; -import "../definitions/form.dart"; -import "../scripting_api/subscription.dart" as scripting_api; +import "../core/scripting_api/subscription.dart" as scripting_api; /// [scripting_api.Subscription] for the MQTT protocol. class MqttSubscription implements scripting_api.Subscription { diff --git a/lib/src/core/augmented_form.dart b/lib/src/core/augmented_form.dart index 113c2377..73e4571f 100644 --- a/lib/src/core/augmented_form.dart +++ b/lib/src/core/augmented_form.dart @@ -9,14 +9,14 @@ import "package:json_schema/json_schema.dart"; import "package:meta/meta.dart"; import "package:uri/uri.dart"; -import "../definitions/additional_expected_response.dart"; -import "../definitions/expected_response.dart"; -import "../definitions/form.dart"; -import "../definitions/interaction_affordances/interaction_affordance.dart"; -import "../definitions/operation_type.dart"; -import "../definitions/security/security_scheme.dart"; -import "../definitions/thing_description.dart"; -import "../definitions/validation/validation_exception.dart"; +import "definitions/additional_expected_response.dart"; +import "definitions/expected_response.dart"; +import "definitions/form.dart"; +import "definitions/interaction_affordances/interaction_affordance.dart"; +import "definitions/operation_type.dart"; +import "definitions/security/security_scheme.dart"; +import "definitions/thing_description.dart"; +import "definitions/validation/validation_exception.dart"; /// A [Form] augmented with information from its asscociated [_thingDescription] /// and [_interactionAffordance]. diff --git a/lib/src/core/codecs/cbor_codec.dart b/lib/src/core/codecs/cbor_codec.dart index b9b2e785..69ac3a16 100644 --- a/lib/src/core/codecs/cbor_codec.dart +++ b/lib/src/core/codecs/cbor_codec.dart @@ -6,8 +6,8 @@ import "package:cbor/cbor.dart" as cbor; -import "../../definitions/data_schema.dart"; -import "../../scripting_api/data_schema_value.dart"; +import "../definitions/data_schema.dart"; +import "../scripting_api/data_schema_value.dart"; import "content_codec.dart"; /// A [ContentCodec] that encodes and decodes CBOR data. diff --git a/lib/src/core/codecs/content_codec.dart b/lib/src/core/codecs/content_codec.dart index 33ec2015..82ca3007 100644 --- a/lib/src/core/codecs/content_codec.dart +++ b/lib/src/core/codecs/content_codec.dart @@ -4,8 +4,8 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions/data_schema.dart"; -import "../../scripting_api/data_schema_value.dart"; +import "../definitions/data_schema.dart"; +import "../scripting_api/data_schema_value.dart"; /// Interface for providing a codec for a specific media type. abstract class ContentCodec { diff --git a/lib/src/core/codecs/json_codec.dart b/lib/src/core/codecs/json_codec.dart index 45cd508b..52d3f3a6 100644 --- a/lib/src/core/codecs/json_codec.dart +++ b/lib/src/core/codecs/json_codec.dart @@ -6,9 +6,9 @@ import "dart:convert"; -import "../../definitions/data_schema.dart"; +import "../definitions/data_schema.dart"; -import "../../scripting_api/data_schema_value.dart"; +import "../scripting_api/data_schema_value.dart"; import "content_codec.dart"; /// A [ContentCodec] that encodes and decodes JSON data. diff --git a/lib/src/core/codecs/text_codec.dart b/lib/src/core/codecs/text_codec.dart index cec9dd27..0cee2333 100644 --- a/lib/src/core/codecs/text_codec.dart +++ b/lib/src/core/codecs/text_codec.dart @@ -6,9 +6,9 @@ import "dart:convert"; -import "../../definitions/data_schema.dart"; +import "../definitions/data_schema.dart"; -import "../../scripting_api/data_schema_value.dart"; +import "../scripting_api/data_schema_value.dart"; import "content_codec.dart"; const _utf8Coding = "utf-8"; diff --git a/lib/src/core/consumed_thing.dart b/lib/src/core/consumed_thing.dart index 1829666e..d9b05ef2 100644 --- a/lib/src/core/consumed_thing.dart +++ b/lib/src/core/consumed_thing.dart @@ -4,17 +4,21 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../scripting_api.dart" as scripting_api; -import "../../scripting_api.dart" hide ConsumedThing, InteractionOutput; -import "../definitions/data_schema.dart"; -import "../definitions/form.dart"; -import "../definitions/interaction_affordances/interaction_affordance.dart"; -import "../definitions/operation_type.dart"; -import "../definitions/thing_description.dart"; import "augmented_form.dart"; import "content.dart"; +import "definitions/data_schema.dart"; +import "definitions/form.dart"; +import "definitions/interaction_affordances/interaction_affordance.dart"; +import "definitions/operation_type.dart"; +import "definitions/thing_description.dart"; import "interaction_output.dart"; import "protocol_interfaces/protocol_client.dart"; + +import "scripting_api/consumed_thing.dart" as scripting_api; +import "scripting_api/interaction_input.dart"; +import "scripting_api/subscription.dart"; +import "scripting_api/types.dart"; + import "servient.dart"; /// This [Exception] is thrown when the body of a response is encoded @@ -57,9 +61,9 @@ class ConsumedThing implements scripting_api.ConsumedThing { /// The [title] of the Thing. final String title; - final Map _subscribedEvents = {}; + final Map _subscribedEvents = {}; - final Map _observedProperties = {}; + final Map _observedProperties = {}; /// Determines the id of this [ConsumedThing]. String get identifier => thingDescription.identifier; diff --git a/lib/src/core/content.dart b/lib/src/core/content.dart index 2d08d2f1..ed548681 100644 --- a/lib/src/core/content.dart +++ b/lib/src/core/content.dart @@ -8,9 +8,9 @@ import "dart:typed_data"; import "package:typed_data/typed_data.dart"; -import "../definitions/data_schema.dart"; -import "../scripting_api/interaction_input.dart"; import "content_serdes.dart"; +import "definitions/data_schema.dart"; +import "scripting_api/interaction_input.dart"; /// This class contains binary input or output data and indicates the media /// type this data is encoded in. diff --git a/lib/src/core/content_serdes.dart b/lib/src/core/content_serdes.dart index d2d0768b..0c69d1a1 100644 --- a/lib/src/core/content_serdes.dart +++ b/lib/src/core/content_serdes.dart @@ -9,14 +9,14 @@ import "dart:io"; import "package:http_parser/http_parser.dart"; import "package:json_schema/json_schema.dart"; -import "../definitions/data_schema.dart"; -import "../scripting_api/data_schema_value.dart"; import "codecs/cbor_codec.dart"; import "codecs/codec_media_type.dart"; import "codecs/content_codec.dart"; import "codecs/json_codec.dart"; import "codecs/text_codec.dart"; import "content.dart"; +import "definitions/data_schema.dart"; +import "scripting_api/data_schema_value.dart"; /// Defines `application/json` as the default content type. const defaultMediaType = "application/json"; diff --git a/lib/src/core/credentials/ace_credentials.dart b/lib/src/core/credentials/ace_credentials.dart index ac979e6e..40e43eaf 100644 --- a/lib/src/core/credentials/ace_credentials.dart +++ b/lib/src/core/credentials/ace_credentials.dart @@ -6,7 +6,7 @@ import "package:dcaf/dcaf.dart"; -import "../../definitions/security/ace_security_scheme.dart"; +import "../definitions/security/ace_security_scheme.dart"; import "credentials.dart"; /// [Credentials] used for the [AceSecurityScheme]. diff --git a/lib/src/core/credentials/apikey_credentials.dart b/lib/src/core/credentials/apikey_credentials.dart index f2b370cc..fc7d90f4 100644 --- a/lib/src/core/credentials/apikey_credentials.dart +++ b/lib/src/core/credentials/apikey_credentials.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions/security/apikey_security_scheme.dart"; +import "../definitions/security/apikey_security_scheme.dart"; import "credentials.dart"; diff --git a/lib/src/core/credentials/basic_credentials.dart b/lib/src/core/credentials/basic_credentials.dart index c1317d5c..8133c680 100644 --- a/lib/src/core/credentials/basic_credentials.dart +++ b/lib/src/core/credentials/basic_credentials.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions/security/basic_security_scheme.dart"; +import "../definitions/security/basic_security_scheme.dart"; import "credentials.dart"; diff --git a/lib/src/core/credentials/bearer_credentials.dart b/lib/src/core/credentials/bearer_credentials.dart index 8b77f507..e92e0d18 100644 --- a/lib/src/core/credentials/bearer_credentials.dart +++ b/lib/src/core/credentials/bearer_credentials.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions/security/bearer_security_scheme.dart"; +import "../definitions/security/bearer_security_scheme.dart"; import "credentials.dart"; diff --git a/lib/src/core/credentials/callbacks.dart b/lib/src/core/credentials/callbacks.dart index 87e98772..194a1789 100644 --- a/lib/src/core/credentials/callbacks.dart +++ b/lib/src/core/credentials/callbacks.dart @@ -6,8 +6,8 @@ import "package:dcaf/dcaf.dart"; -import "../../definitions/form.dart"; import "../augmented_form.dart"; +import "../definitions/form.dart"; import "ace_credentials.dart"; import "credentials.dart"; import "psk_credentials.dart"; diff --git a/lib/src/core/credentials/digest_credentials.dart b/lib/src/core/credentials/digest_credentials.dart index 594cba71..ee89d798 100644 --- a/lib/src/core/credentials/digest_credentials.dart +++ b/lib/src/core/credentials/digest_credentials.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions/security/digest_security_scheme.dart"; +import "../definitions/security/digest_security_scheme.dart"; import "credentials.dart"; /// [Credentials] used for the [DigestSecurityScheme]. diff --git a/lib/src/core/credentials/oauth2_credentials.dart b/lib/src/core/credentials/oauth2_credentials.dart index d19f241f..f5e4c058 100644 --- a/lib/src/core/credentials/oauth2_credentials.dart +++ b/lib/src/core/credentials/oauth2_credentials.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions/security/oauth2_security_scheme.dart"; +import "../definitions/security/oauth2_security_scheme.dart"; import "credentials.dart"; /// [Credentials] used for the [OAuth2SecurityScheme]. diff --git a/lib/src/core/credentials/psk_credentials.dart b/lib/src/core/credentials/psk_credentials.dart index b0936c99..32732082 100644 --- a/lib/src/core/credentials/psk_credentials.dart +++ b/lib/src/core/credentials/psk_credentials.dart @@ -6,7 +6,7 @@ import "dart:typed_data"; -import "../../definitions/security/psk_security_scheme.dart"; +import "../definitions/security/psk_security_scheme.dart"; import "credentials.dart"; /// [Credentials] used for the [PskSecurityScheme]. diff --git a/lib/src/definitions/additional_expected_response.dart b/lib/src/core/definitions/additional_expected_response.dart similarity index 100% rename from lib/src/definitions/additional_expected_response.dart rename to lib/src/core/definitions/additional_expected_response.dart diff --git a/lib/src/definitions/data_schema.dart b/lib/src/core/definitions/data_schema.dart similarity index 100% rename from lib/src/definitions/data_schema.dart rename to lib/src/core/definitions/data_schema.dart diff --git a/lib/src/definitions/expected_response.dart b/lib/src/core/definitions/expected_response.dart similarity index 100% rename from lib/src/definitions/expected_response.dart rename to lib/src/core/definitions/expected_response.dart diff --git a/lib/src/definitions/extensions/json_parser.dart b/lib/src/core/definitions/extensions/json_parser.dart similarity index 100% rename from lib/src/definitions/extensions/json_parser.dart rename to lib/src/core/definitions/extensions/json_parser.dart diff --git a/lib/src/definitions/form.dart b/lib/src/core/definitions/form.dart similarity index 100% rename from lib/src/definitions/form.dart rename to lib/src/core/definitions/form.dart diff --git a/lib/src/definitions/interaction_affordances/action.dart b/lib/src/core/definitions/interaction_affordances/action.dart similarity index 100% rename from lib/src/definitions/interaction_affordances/action.dart rename to lib/src/core/definitions/interaction_affordances/action.dart diff --git a/lib/src/definitions/interaction_affordances/event.dart b/lib/src/core/definitions/interaction_affordances/event.dart similarity index 100% rename from lib/src/definitions/interaction_affordances/event.dart rename to lib/src/core/definitions/interaction_affordances/event.dart diff --git a/lib/src/definitions/interaction_affordances/interaction_affordance.dart b/lib/src/core/definitions/interaction_affordances/interaction_affordance.dart similarity index 100% rename from lib/src/definitions/interaction_affordances/interaction_affordance.dart rename to lib/src/core/definitions/interaction_affordances/interaction_affordance.dart diff --git a/lib/src/definitions/interaction_affordances/property.dart b/lib/src/core/definitions/interaction_affordances/property.dart similarity index 100% rename from lib/src/definitions/interaction_affordances/property.dart rename to lib/src/core/definitions/interaction_affordances/property.dart diff --git a/lib/src/definitions/link.dart b/lib/src/core/definitions/link.dart similarity index 100% rename from lib/src/definitions/link.dart rename to lib/src/core/definitions/link.dart diff --git a/lib/src/definitions/operation_type.dart b/lib/src/core/definitions/operation_type.dart similarity index 100% rename from lib/src/definitions/operation_type.dart rename to lib/src/core/definitions/operation_type.dart diff --git a/lib/src/definitions/security/ace_security_scheme.dart b/lib/src/core/definitions/security/ace_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/ace_security_scheme.dart rename to lib/src/core/definitions/security/ace_security_scheme.dart diff --git a/lib/src/definitions/security/apikey_security_scheme.dart b/lib/src/core/definitions/security/apikey_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/apikey_security_scheme.dart rename to lib/src/core/definitions/security/apikey_security_scheme.dart diff --git a/lib/src/definitions/security/auto_security_scheme.dart b/lib/src/core/definitions/security/auto_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/auto_security_scheme.dart rename to lib/src/core/definitions/security/auto_security_scheme.dart diff --git a/lib/src/definitions/security/basic_security_scheme.dart b/lib/src/core/definitions/security/basic_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/basic_security_scheme.dart rename to lib/src/core/definitions/security/basic_security_scheme.dart diff --git a/lib/src/definitions/security/bearer_security_scheme.dart b/lib/src/core/definitions/security/bearer_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/bearer_security_scheme.dart rename to lib/src/core/definitions/security/bearer_security_scheme.dart diff --git a/lib/src/definitions/security/combo_security_scheme.dart b/lib/src/core/definitions/security/combo_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/combo_security_scheme.dart rename to lib/src/core/definitions/security/combo_security_scheme.dart diff --git a/lib/src/definitions/security/digest_security_scheme.dart b/lib/src/core/definitions/security/digest_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/digest_security_scheme.dart rename to lib/src/core/definitions/security/digest_security_scheme.dart diff --git a/lib/src/definitions/security/no_security_scheme.dart b/lib/src/core/definitions/security/no_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/no_security_scheme.dart rename to lib/src/core/definitions/security/no_security_scheme.dart diff --git a/lib/src/definitions/security/oauth2_security_scheme.dart b/lib/src/core/definitions/security/oauth2_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/oauth2_security_scheme.dart rename to lib/src/core/definitions/security/oauth2_security_scheme.dart diff --git a/lib/src/definitions/security/psk_security_scheme.dart b/lib/src/core/definitions/security/psk_security_scheme.dart similarity index 100% rename from lib/src/definitions/security/psk_security_scheme.dart rename to lib/src/core/definitions/security/psk_security_scheme.dart diff --git a/lib/src/definitions/security/security_scheme.dart b/lib/src/core/definitions/security/security_scheme.dart similarity index 100% rename from lib/src/definitions/security/security_scheme.dart rename to lib/src/core/definitions/security/security_scheme.dart diff --git a/lib/src/definitions/thing_description.dart b/lib/src/core/definitions/thing_description.dart similarity index 100% rename from lib/src/definitions/thing_description.dart rename to lib/src/core/definitions/thing_description.dart diff --git a/lib/src/definitions/thing_model.dart b/lib/src/core/definitions/thing_model.dart similarity index 100% rename from lib/src/definitions/thing_model.dart rename to lib/src/core/definitions/thing_model.dart diff --git a/lib/src/definitions/validation/thing_description_schema.dart b/lib/src/core/definitions/validation/thing_description_schema.dart similarity index 100% rename from lib/src/definitions/validation/thing_description_schema.dart rename to lib/src/core/definitions/validation/thing_description_schema.dart diff --git a/lib/src/definitions/validation/validation_exception.dart b/lib/src/core/definitions/validation/validation_exception.dart similarity index 100% rename from lib/src/definitions/validation/validation_exception.dart rename to lib/src/core/definitions/validation/validation_exception.dart diff --git a/lib/src/definitions/version_info.dart b/lib/src/core/definitions/version_info.dart similarity index 100% rename from lib/src/definitions/version_info.dart rename to lib/src/core/definitions/version_info.dart diff --git a/lib/src/core/exposed_thing.dart b/lib/src/core/exposed_thing.dart index 4f90c224..59f9388c 100644 --- a/lib/src/core/exposed_thing.dart +++ b/lib/src/core/exposed_thing.dart @@ -4,10 +4,12 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../definitions.dart"; -import "../../scripting_api.dart" hide ExposedThing; -import "../../scripting_api.dart" as scripting_api; -import "../definitions/interaction_affordances/interaction_affordance.dart"; +import "package:dart_wot/src/core/scripting_api/exposed_thing.dart"; + +import "definitions/interaction_affordances/interaction_affordance.dart"; +import "definitions/thing_description.dart"; +import "scripting_api/exposed_thing.dart" as scripting_api; +import "scripting_api/types.dart"; import "servient.dart"; /// Implemention of the [scripting_api.ExposedThing] interface. diff --git a/lib/src/core/interaction_output.dart b/lib/src/core/interaction_output.dart index 8531522c..eade334a 100644 --- a/lib/src/core/interaction_output.dart +++ b/lib/src/core/interaction_output.dart @@ -6,11 +6,11 @@ import "dart:typed_data"; -import "../../scripting_api.dart" as scripting_api; -import "../definitions/data_schema.dart"; -import "../definitions/form.dart"; import "content.dart"; import "content_serdes.dart"; +import "definitions/data_schema.dart"; +import "definitions/form.dart"; +import "scripting_api/interaction_output.dart" as scripting_api; /// Implementation of the [scripting_api.InteractionOutput] interface. class InteractionOutput implements scripting_api.InteractionOutput { diff --git a/lib/src/core/protocol_interfaces/protocol_client.dart b/lib/src/core/protocol_interfaces/protocol_client.dart index 570b9ce4..1e124c9c 100644 --- a/lib/src/core/protocol_interfaces/protocol_client.dart +++ b/lib/src/core/protocol_interfaces/protocol_client.dart @@ -4,9 +4,9 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../scripting_api/subscription.dart"; import "../augmented_form.dart"; import "../content.dart"; +import "../scripting_api/subscription.dart"; /// Base class for a Protocol Client. abstract interface class ProtocolClient { diff --git a/lib/src/core/protocol_interfaces/protocol_server.dart b/lib/src/core/protocol_interfaces/protocol_server.dart index 1a6d76db..f83b8b39 100644 --- a/lib/src/core/protocol_interfaces/protocol_server.dart +++ b/lib/src/core/protocol_interfaces/protocol_server.dart @@ -4,8 +4,8 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../../../scripting_api.dart"; import "../credentials/callbacks.dart"; +import "../scripting_api/exposed_thing.dart"; /// Base class for a Protocol Server. abstract interface class ProtocolServer { diff --git a/lib/src/scripting_api/consumed_thing.dart b/lib/src/core/scripting_api/consumed_thing.dart similarity index 100% rename from lib/src/scripting_api/consumed_thing.dart rename to lib/src/core/scripting_api/consumed_thing.dart diff --git a/lib/src/scripting_api/data_schema_value.dart b/lib/src/core/scripting_api/data_schema_value.dart similarity index 100% rename from lib/src/scripting_api/data_schema_value.dart rename to lib/src/core/scripting_api/data_schema_value.dart diff --git a/lib/src/scripting_api/discovery/discovery_method.dart b/lib/src/core/scripting_api/discovery/discovery_method.dart similarity index 100% rename from lib/src/scripting_api/discovery/discovery_method.dart rename to lib/src/core/scripting_api/discovery/discovery_method.dart diff --git a/lib/src/scripting_api/discovery/thing_discovery.dart b/lib/src/core/scripting_api/discovery/thing_discovery.dart similarity index 100% rename from lib/src/scripting_api/discovery/thing_discovery.dart rename to lib/src/core/scripting_api/discovery/thing_discovery.dart diff --git a/lib/src/scripting_api/discovery/thing_filter.dart b/lib/src/core/scripting_api/discovery/thing_filter.dart similarity index 100% rename from lib/src/scripting_api/discovery/thing_filter.dart rename to lib/src/core/scripting_api/discovery/thing_filter.dart diff --git a/lib/src/scripting_api/exposed_thing.dart b/lib/src/core/scripting_api/exposed_thing.dart similarity index 100% rename from lib/src/scripting_api/exposed_thing.dart rename to lib/src/core/scripting_api/exposed_thing.dart diff --git a/lib/src/scripting_api/interaction_input.dart b/lib/src/core/scripting_api/interaction_input.dart similarity index 100% rename from lib/src/scripting_api/interaction_input.dart rename to lib/src/core/scripting_api/interaction_input.dart diff --git a/lib/src/scripting_api/interaction_output.dart b/lib/src/core/scripting_api/interaction_output.dart similarity index 100% rename from lib/src/scripting_api/interaction_output.dart rename to lib/src/core/scripting_api/interaction_output.dart diff --git a/lib/src/scripting_api/subscription.dart b/lib/src/core/scripting_api/subscription.dart similarity index 100% rename from lib/src/scripting_api/subscription.dart rename to lib/src/core/scripting_api/subscription.dart diff --git a/lib/src/scripting_api/types.dart b/lib/src/core/scripting_api/types.dart similarity index 100% rename from lib/src/scripting_api/types.dart rename to lib/src/core/scripting_api/types.dart diff --git a/lib/src/scripting_api/wot.dart b/lib/src/core/scripting_api/wot.dart similarity index 99% rename from lib/src/scripting_api/wot.dart rename to lib/src/core/scripting_api/wot.dart index 60191de3..19822d4a 100644 --- a/lib/src/scripting_api/wot.dart +++ b/lib/src/core/scripting_api/wot.dart @@ -5,6 +5,7 @@ // SPDX-License-Identifier: BSD-3-Clause import "../definitions/thing_description.dart"; + import "consumed_thing.dart"; import "discovery/discovery_method.dart"; import "discovery/thing_discovery.dart"; diff --git a/lib/src/core/servient.dart b/lib/src/core/servient.dart index a5ebc69f..fd33eca6 100644 --- a/lib/src/core/servient.dart +++ b/lib/src/core/servient.dart @@ -4,16 +4,16 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "../definitions/interaction_affordances/interaction_affordance.dart"; -import "../definitions/thing_description.dart"; -import "../scripting_api/data_schema_value.dart"; import "consumed_thing.dart"; import "content_serdes.dart"; import "credentials/callbacks.dart"; +import "definitions/interaction_affordances/interaction_affordance.dart"; +import "definitions/thing_description.dart"; import "exposed_thing.dart"; import "protocol_interfaces/protocol_client.dart"; import "protocol_interfaces/protocol_client_factory.dart"; import "protocol_interfaces/protocol_server.dart"; +import "scripting_api/data_schema_value.dart"; import "thing_discovery.dart"; import "wot.dart"; diff --git a/lib/src/core/thing_discovery.dart b/lib/src/core/thing_discovery.dart index 01bcff9b..88861863 100644 --- a/lib/src/core/thing_discovery.dart +++ b/lib/src/core/thing_discovery.dart @@ -11,11 +11,8 @@ import "package:collection/collection.dart"; import "package:multicast_dns/multicast_dns.dart"; import "../../core.dart"; -import "../../scripting_api.dart" as scripting_api; -import "../definitions/thing_description.dart"; -import "../scripting_api/data_schema_value.dart"; -import "../scripting_api/discovery/discovery_method.dart"; import "content.dart"; +import 'scripting_api/discovery/thing_discovery.dart' as scripting_api; /// Custom [Exception] that is thrown when the discovery process fails. class DiscoveryException implements Exception { @@ -64,19 +61,19 @@ class ThingDiscovery extends Stream bool get active => _active; @override - final scripting_api.ThingFilter? thingFilter; + final ThingFilter? thingFilter; late final Stream _stream; Stream _start() async* { switch (_method) { - case scripting_api.DiscoveryMethod.direct: + case DiscoveryMethod.direct: yield* _discoverDirectly(_url); - case scripting_api.DiscoveryMethod.coreLinkFormat: + case DiscoveryMethod.coreLinkFormat: yield* _discoverWithCoreLinkFormat(_url); - case scripting_api.DiscoveryMethod.coreResourceDirectory: + case DiscoveryMethod.coreResourceDirectory: yield* _discoverfromCoreResourceDirectory(_url); - case scripting_api.DiscoveryMethod.dnsServiceDiscovery: + case DiscoveryMethod.dnsServiceDiscovery: yield* _discoverUsingDnsServiceDiscovery(_url); default: throw UnimplementedError(); @@ -404,7 +401,7 @@ class ThingDiscoveryProcess extends Stream Exception? get error => _error; @override - final scripting_api.ThingFilter? thingFilter; + final ThingFilter? thingFilter; @override StreamSubscription listen( diff --git a/lib/src/core/wot.dart b/lib/src/core/wot.dart index 3fd89d3d..d1dc38e5 100644 --- a/lib/src/core/wot.dart +++ b/lib/src/core/wot.dart @@ -8,11 +8,15 @@ import "dart:async"; import "package:uuid/uuid.dart"; -import "../../scripting_api.dart" as scripting_api; -import "../definitions/thing_description.dart"; -import "../scripting_api/discovery/discovery_method.dart"; import "consumed_thing.dart"; +import "definitions/thing_description.dart"; import "exposed_thing.dart"; +import "scripting_api/consumed_thing.dart" as scripting_api_consumed_thing; +import 'scripting_api/discovery/discovery_method.dart'; +import "scripting_api/exposed_thing.dart" as scripting_api_exposed_thing; +import "scripting_api/wot.dart" as scripting_api_wot; +import "scripting_api/discovery/thing_filter.dart" as scripting_api_discovery; +import 'scripting_api/discovery/thing_discovery.dart' as scripting_api; import "servient.dart"; import "thing_discovery.dart" show DiscoveryException, ThingDiscovery, ThingDiscoveryProcess; @@ -50,20 +54,20 @@ class ThingProductionException implements Exception { } /// Implementation of the [scripting_api.WoT] runtime interface. -class WoT implements scripting_api.WoT { +class WoT implements scripting_api_wot.WoT { /// Creates a new [WoT] runtime based on a [Servient]. WoT(this._servient); final Servient _servient; - /// Consumes a [ThingDescription] and returns a [scripting_api.ConsumedThing]. + /// Consumes a [ThingDescription] and returns a [scripting_api_consumed_thing.ConsumedThing]. /// /// The returned [ConsumedThing] can then be used to trigger /// interaction affordances exposed by the Thing. /// /// If a [ThingDescription] with the same identifier has already been @override - Future consume( + Future consume( ThingDescription thingDescription, ) async { final newThing = ConsumedThing(_servient, thingDescription); @@ -77,7 +81,9 @@ class WoT implements scripting_api.WoT { /// Exposes a Thing based on a (partial) TD. @override - Future produce(Map init) async { + Future produce( + Map init, + ) async { const uuid = Uuid(); final exposedThingInit = { @@ -97,7 +103,7 @@ class WoT implements scripting_api.WoT { @override ThingDiscovery discover( Uri url, { - scripting_api.ThingFilter? thingFilter, + scripting_api_discovery.ThingFilter? thingFilter, DiscoveryMethod method = DiscoveryMethod.direct, }) { return ThingDiscovery(url, thingFilter, _servient, method: method); @@ -111,7 +117,7 @@ class WoT implements scripting_api.WoT { @override Future exploreDirectory( Uri url, [ - scripting_api.ThingFilter? filter, + scripting_api_discovery.ThingFilter? filter, ]) async { final thingDescription = await requestThingDescription(url); diff --git a/test/binding_coap/binding_coap_test.dart b/test/binding_coap/binding_coap_test.dart index 33fbf644..2f391aa6 100644 --- a/test/binding_coap/binding_coap_test.dart +++ b/test/binding_coap/binding_coap_test.dart @@ -4,7 +4,9 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_coap.dart"; +import "package:dart_wot/core.dart"; + import "package:mockito/annotations.dart"; import "package:test/test.dart"; import "binding_coap_test.mocks.dart"; diff --git a/test/binding_coap/binding_coap_test.mocks.dart b/test/binding_coap/binding_coap_test.mocks.dart index a26b54ed..93ed46f8 100644 --- a/test/binding_coap/binding_coap_test.mocks.dart +++ b/test/binding_coap/binding_coap_test.mocks.dart @@ -1,25 +1,38 @@ -// Mocks generated by Mockito 5.1.0 from annotations +// Mocks generated by Mockito 5.4.3 from annotations // in dart_wot/test/binding_coap/binding_coap_test.dart. // Do not manually edit this file. +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'package:dart_wot/src/definitions/thing_description.dart' as _i2; -import 'package:dart_wot/src/scripting_api/exposed_thing.dart' as _i3; +import 'package:dart_wot/src/core/definitions/thing_description.dart' as _i2; +import 'package:dart_wot/src/core/scripting_api/exposed_thing.dart' as _i3; +import 'package:dart_wot/src/core/scripting_api/interaction_input.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class -class _FakeThingDescription_0 extends _i1.Fake - implements _i2.ThingDescription {} +class _FakeThingDescription_0 extends _i1.SmartFake + implements _i2.ThingDescription { + _FakeThingDescription_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} /// A class which mocks [ExposedThing]. /// @@ -30,70 +43,186 @@ class MockExposedThing extends _i1.Mock implements _i3.ExposedThing { } @override - _i2.ThingDescription get thingDescription => - (super.noSuchMethod(Invocation.getter(#thingDescription), - returnValue: _FakeThingDescription_0()) as _i2.ThingDescription); + _i2.ThingDescription get thingDescription => (super.noSuchMethod( + Invocation.getter(#thingDescription), + returnValue: _FakeThingDescription_0( + this, + Invocation.getter(#thingDescription), + ), + ) as _i2.ThingDescription); + @override - _i4.Future expose() => - (super.noSuchMethod(Invocation.method(#expose, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future expose() => (super.noSuchMethod( + Invocation.method( + #expose, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override - _i4.Future destroy() => - (super.noSuchMethod(Invocation.method(#destroy, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future destroy() => (super.noSuchMethod( + Invocation.method( + #destroy, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override - void setPropertyReadHandler(String? name, _i3.PropertyReadHandler? handler) => + void setPropertyReadHandler( + String? name, + _i3.PropertyReadHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyReadHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyReadHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setPropertyWriteHandler( - String? name, _i3.PropertyWriteHandler? handler) => + String? name, + _i3.PropertyWriteHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyWriteHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyWriteHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setPropertyObserveHandler( - String? name, _i3.PropertyReadHandler? handler) => + String? name, + _i3.PropertyReadHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyObserveHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyObserveHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setPropertyUnobserveHandler( - String? name, _i3.PropertyReadHandler? handler) => + String? name, + _i3.PropertyReadHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyUnobserveHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyUnobserveHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override - _i4.Future emitPropertyChange(String? name) => - (super.noSuchMethod(Invocation.method(#emitPropertyChange, [name]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future emitPropertyChange(String? name) => (super.noSuchMethod( + Invocation.method( + #emitPropertyChange, + [name], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override - void setActionHandler(String? name, _i3.ActionHandler? handler) => - super.noSuchMethod(Invocation.method(#setActionHandler, [name, handler]), - returnValueForMissingStub: null); + void setActionHandler( + String? name, + _i3.ActionHandler? handler, + ) => + super.noSuchMethod( + Invocation.method( + #setActionHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setEventSubscribeHandler( - String? name, _i3.EventSubscriptionHandler? handler) => + String? name, + _i3.EventSubscriptionHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setEventSubscribeHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setEventSubscribeHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setEventUnsubscribeHandler( - String? name, _i3.EventSubscriptionHandler? handler) => + String? name, + _i3.EventSubscriptionHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setEventUnsubscribeHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setEventUnsubscribeHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override - void setEventHandler(String? name, _i3.EventListenerHandler? handler) => - super.noSuchMethod(Invocation.method(#setEventHandler, [name, handler]), - returnValueForMissingStub: null); + void setEventHandler( + String? name, + _i3.EventListenerHandler? handler, + ) => + super.noSuchMethod( + Invocation.method( + #setEventHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override - _i4.Future emitEvent(String? name, Object? data) => - (super.noSuchMethod(Invocation.method(#emitEvent, [name, data]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future emitEvent( + String? name, + _i5.InteractionInput? data, + ) => + (super.noSuchMethod( + Invocation.method( + #emitEvent, + [ + name, + data, + ], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } diff --git a/test/binding_coap/coap_vocabulary_test.dart b/test/binding_coap/coap_vocabulary_test.dart index 8037cd3b..196044bb 100644 --- a/test/binding_coap/coap_vocabulary_test.dart +++ b/test/binding_coap/coap_vocabulary_test.dart @@ -5,10 +5,10 @@ // SPDX-License-Identifier: BSD-3-Clause import "package:coap/coap.dart"; -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/core.dart"; import "package:dart_wot/src/binding_coap/coap_definitions.dart"; import "package:dart_wot/src/binding_coap/coap_extensions.dart"; -import "package:dart_wot/src/definitions/validation/validation_exception.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; import "package:test/test.dart"; void main() { diff --git a/test/binding_http/http_test.dart b/test/binding_http/http_test.dart index 77a7a2a4..cba6b4f2 100644 --- a/test/binding_http/http_test.dart +++ b/test/binding_http/http_test.dart @@ -4,7 +4,8 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/binding_http.dart"; +import "package:dart_wot/core.dart"; import "package:mockito/annotations.dart"; import "package:test/test.dart"; import "http_test.mocks.dart"; diff --git a/test/binding_http/http_test.mocks.dart b/test/binding_http/http_test.mocks.dart index ed43523a..b3459a02 100644 --- a/test/binding_http/http_test.mocks.dart +++ b/test/binding_http/http_test.mocks.dart @@ -1,25 +1,38 @@ -// Mocks generated by Mockito 5.1.0 from annotations +// Mocks generated by Mockito 5.4.3 from annotations // in dart_wot/test/binding_http/http_test.dart. // Do not manually edit this file. +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'package:dart_wot/src/definitions/thing_description.dart' as _i2; -import 'package:dart_wot/src/scripting_api/exposed_thing.dart' as _i3; +import 'package:dart_wot/src/core/definitions/thing_description.dart' as _i2; +import 'package:dart_wot/src/core/scripting_api/exposed_thing.dart' as _i3; +import 'package:dart_wot/src/core/scripting_api/interaction_input.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class -class _FakeThingDescription_0 extends _i1.Fake - implements _i2.ThingDescription {} +class _FakeThingDescription_0 extends _i1.SmartFake + implements _i2.ThingDescription { + _FakeThingDescription_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} /// A class which mocks [ExposedThing]. /// @@ -30,70 +43,186 @@ class MockExposedThing extends _i1.Mock implements _i3.ExposedThing { } @override - _i2.ThingDescription get thingDescription => - (super.noSuchMethod(Invocation.getter(#thingDescription), - returnValue: _FakeThingDescription_0()) as _i2.ThingDescription); + _i2.ThingDescription get thingDescription => (super.noSuchMethod( + Invocation.getter(#thingDescription), + returnValue: _FakeThingDescription_0( + this, + Invocation.getter(#thingDescription), + ), + ) as _i2.ThingDescription); + @override - _i4.Future expose() => - (super.noSuchMethod(Invocation.method(#expose, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future expose() => (super.noSuchMethod( + Invocation.method( + #expose, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override - _i4.Future destroy() => - (super.noSuchMethod(Invocation.method(#destroy, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future destroy() => (super.noSuchMethod( + Invocation.method( + #destroy, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override - void setPropertyReadHandler(String? name, _i3.PropertyReadHandler? handler) => + void setPropertyReadHandler( + String? name, + _i3.PropertyReadHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyReadHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyReadHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setPropertyWriteHandler( - String? name, _i3.PropertyWriteHandler? handler) => + String? name, + _i3.PropertyWriteHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyWriteHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyWriteHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setPropertyObserveHandler( - String? name, _i3.PropertyReadHandler? handler) => + String? name, + _i3.PropertyReadHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyObserveHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyObserveHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setPropertyUnobserveHandler( - String? name, _i3.PropertyReadHandler? handler) => + String? name, + _i3.PropertyReadHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setPropertyUnobserveHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setPropertyUnobserveHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override - _i4.Future emitPropertyChange(String? name) => - (super.noSuchMethod(Invocation.method(#emitPropertyChange, [name]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future emitPropertyChange(String? name) => (super.noSuchMethod( + Invocation.method( + #emitPropertyChange, + [name], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override - void setActionHandler(String? name, _i3.ActionHandler? handler) => - super.noSuchMethod(Invocation.method(#setActionHandler, [name, handler]), - returnValueForMissingStub: null); + void setActionHandler( + String? name, + _i3.ActionHandler? handler, + ) => + super.noSuchMethod( + Invocation.method( + #setActionHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setEventSubscribeHandler( - String? name, _i3.EventSubscriptionHandler? handler) => + String? name, + _i3.EventSubscriptionHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setEventSubscribeHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setEventSubscribeHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override void setEventUnsubscribeHandler( - String? name, _i3.EventSubscriptionHandler? handler) => + String? name, + _i3.EventSubscriptionHandler? handler, + ) => super.noSuchMethod( - Invocation.method(#setEventUnsubscribeHandler, [name, handler]), - returnValueForMissingStub: null); + Invocation.method( + #setEventUnsubscribeHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override - void setEventHandler(String? name, _i3.EventListenerHandler? handler) => - super.noSuchMethod(Invocation.method(#setEventHandler, [name, handler]), - returnValueForMissingStub: null); + void setEventHandler( + String? name, + _i3.EventListenerHandler? handler, + ) => + super.noSuchMethod( + Invocation.method( + #setEventHandler, + [ + name, + handler, + ], + ), + returnValueForMissingStub: null, + ); + @override - _i4.Future emitEvent(String? name, Object? data) => - (super.noSuchMethod(Invocation.method(#emitEvent, [name, data]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + _i4.Future emitEvent( + String? name, + _i5.InteractionInput? data, + ) => + (super.noSuchMethod( + Invocation.method( + #emitEvent, + [ + name, + data, + ], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } diff --git a/test/binding_mqtt/mqtt_extension_test.dart b/test/binding_mqtt/mqtt_extension_test.dart index 81584567..67a29824 100644 --- a/test/binding_mqtt/mqtt_extension_test.dart +++ b/test/binding_mqtt/mqtt_extension_test.dart @@ -4,9 +4,9 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/core.dart"; import "package:dart_wot/src/binding_mqtt/mqtt_extensions.dart"; -import "package:dart_wot/src/definitions/validation/validation_exception.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; import "package:test/test.dart"; void main() { diff --git a/test/core/augmented_form_test.dart b/test/core/augmented_form_test.dart index a4209838..13a85c6f 100644 --- a/test/core/augmented_form_test.dart +++ b/test/core/augmented_form_test.dart @@ -4,9 +4,8 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; -import "package:dart_wot/src/definitions/security/no_security_scheme.dart"; -import "package:dart_wot/src/definitions/validation/validation_exception.dart"; +import "package:dart_wot/core.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; import "package:test/test.dart"; void main() { diff --git a/test/core/codec_test.dart b/test/core/codec_test.dart index 759f32a7..ded72a47 100644 --- a/test/core/codec_test.dart +++ b/test/core/codec_test.dart @@ -6,7 +6,7 @@ import "dart:convert"; -import "package:dart_wot/scripting_api.dart"; +import "package:dart_wot/core.dart"; import "package:dart_wot/src/core/codecs/cbor_codec.dart"; import "package:dart_wot/src/core/codecs/json_codec.dart" as json_codec; import "package:dart_wot/src/core/codecs/text_codec.dart"; diff --git a/test/core/consumed_thing_test.dart b/test/core/consumed_thing_test.dart index 693a3a9a..f038f5e7 100644 --- a/test/core/consumed_thing_test.dart +++ b/test/core/consumed_thing_test.dart @@ -4,17 +4,9 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; -import "package:dart_wot/src/definitions/security/apikey_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/auto_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/basic_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/bearer_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/combo_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/digest_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/no_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/oauth2_security_scheme.dart"; -import "package:dart_wot/src/definitions/security/psk_security_scheme.dart"; -import "package:dart_wot/src/definitions/validation/validation_exception.dart"; +import "package:dart_wot/binding_http.dart"; +import "package:dart_wot/core.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; import "package:test/test.dart"; void main() { diff --git a/test/core/content_serdes_test.dart b/test/core/content_serdes_test.dart index 15d7e3d3..4fd21615 100644 --- a/test/core/content_serdes_test.dart +++ b/test/core/content_serdes_test.dart @@ -8,8 +8,8 @@ import "package:curie/curie.dart"; import "package:dart_wot/src/core/codecs/json_codec.dart"; import "package:dart_wot/src/core/content.dart"; import "package:dart_wot/src/core/content_serdes.dart"; -import "package:dart_wot/src/definitions/data_schema.dart"; -import "package:dart_wot/src/scripting_api/data_schema_value.dart"; +import "package:dart_wot/src/core/definitions/data_schema.dart"; +import "package:dart_wot/src/core/scripting_api/data_schema_value.dart"; import "package:test/test.dart"; Content _getTestContent(String input) { diff --git a/test/core/content_test.dart b/test/core/content_test.dart index 14056c65..af24a435 100644 --- a/test/core/content_test.dart +++ b/test/core/content_test.dart @@ -6,7 +6,7 @@ import "dart:convert"; -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/core.dart"; import "package:dart_wot/src/core/content.dart"; import "package:test/test.dart"; diff --git a/test/core/dart_wot_test.dart b/test/core/dart_wot_test.dart index d6027c3f..26dc072d 100644 --- a/test/core/dart_wot_test.dart +++ b/test/core/dart_wot_test.dart @@ -4,8 +4,8 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; -import "package:dart_wot/src/definitions/link.dart"; +import "package:dart_wot/core.dart"; +import "package:dart_wot/src/core/definitions/link.dart"; import "package:test/test.dart"; // TODO(JKRhb): Add proper tests diff --git a/test/core/definitions_test.dart b/test/core/definitions_test.dart index 59442ddf..83a52b1e 100644 --- a/test/core/definitions_test.dart +++ b/test/core/definitions_test.dart @@ -7,15 +7,14 @@ import "dart:convert"; import "package:curie/curie.dart"; -import "package:dart_wot/dart_wot.dart"; -import "package:dart_wot/src/definitions/additional_expected_response.dart"; -import "package:dart_wot/src/definitions/data_schema.dart"; -import "package:dart_wot/src/definitions/expected_response.dart"; -import "package:dart_wot/src/definitions/extensions/json_parser.dart"; -import "package:dart_wot/src/definitions/operation_type.dart"; -import "package:dart_wot/src/definitions/security/no_security_scheme.dart"; -import "package:dart_wot/src/definitions/validation/thing_description_schema.dart"; -import "package:dart_wot/src/definitions/validation/validation_exception.dart"; +import "package:dart_wot/core.dart"; +import "package:dart_wot/src/core/definitions/additional_expected_response.dart"; +import "package:dart_wot/src/core/definitions/data_schema.dart"; +import "package:dart_wot/src/core/definitions/expected_response.dart"; +import "package:dart_wot/src/core/definitions/extensions/json_parser.dart"; +import "package:dart_wot/src/core/definitions/operation_type.dart"; +import "package:dart_wot/src/core/definitions/validation/thing_description_schema.dart"; +import "package:dart_wot/src/core/definitions/validation/validation_exception.dart"; import "package:test/test.dart"; void main() { diff --git a/test/core/discovery_test.dart b/test/core/discovery_test.dart index cc78e3d7..6e2471e4 100644 --- a/test/core/discovery_test.dart +++ b/test/core/discovery_test.dart @@ -7,13 +7,9 @@ import "dart:async"; import "dart:convert"; +import "package:dart_wot/core.dart"; import "package:dart_wot/src/core/content.dart"; -import "package:dart_wot/src/core/protocol_interfaces/protocol_client.dart"; -import "package:dart_wot/src/core/protocol_interfaces/protocol_client_factory.dart"; -import "package:dart_wot/src/core/servient.dart"; import "package:dart_wot/src/core/thing_discovery.dart"; -import "package:dart_wot/src/definitions/form.dart"; -import "package:dart_wot/src/scripting_api/subscription.dart"; import "package:test/test.dart"; const testUriScheme = "test"; diff --git a/test/core/operation_type_test.dart b/test/core/operation_type_test.dart index 505d0d8d..58717041 100644 --- a/test/core/operation_type_test.dart +++ b/test/core/operation_type_test.dart @@ -4,9 +4,9 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/src/definitions/data_schema.dart"; -import "package:dart_wot/src/definitions/interaction_affordances/interaction_affordance.dart"; -import "package:dart_wot/src/definitions/operation_type.dart"; +import "package:dart_wot/src/core/definitions/data_schema.dart"; +import "package:dart_wot/src/core/definitions/interaction_affordances/interaction_affordance.dart"; +import "package:dart_wot/src/core/definitions/operation_type.dart"; import "package:test/test.dart"; void main() { diff --git a/test/core/servient_test.dart b/test/core/servient_test.dart index 3fe3f2cd..585a6ea3 100644 --- a/test/core/servient_test.dart +++ b/test/core/servient_test.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/core.dart"; import "package:test/test.dart"; const testUriScheme = "test"; diff --git a/test/core/thing_description_test.dart b/test/core/thing_description_test.dart index 9a1c6275..38c4c03a 100644 --- a/test/core/thing_description_test.dart +++ b/test/core/thing_description_test.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/core.dart"; import "package:test/test.dart"; void main() { diff --git a/test/core/thing_model_test.dart b/test/core/thing_model_test.dart index acb860b9..232a24f3 100644 --- a/test/core/thing_model_test.dart +++ b/test/core/thing_model_test.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/dart_wot.dart"; +import "package:dart_wot/core.dart"; import "package:test/test.dart"; void main() { diff --git a/test/scripting_api/data_schema_value_test.dart b/test/scripting_api/data_schema_value_test.dart index 14dacdfb..c3721030 100644 --- a/test/scripting_api/data_schema_value_test.dart +++ b/test/scripting_api/data_schema_value_test.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/scripting_api.dart"; +import "package:dart_wot/core.dart"; import "package:test/test.dart"; void main() { diff --git a/test/scripting_api/interaction_input_test.dart b/test/scripting_api/interaction_input_test.dart index 8436efd6..77e2d650 100644 --- a/test/scripting_api/interaction_input_test.dart +++ b/test/scripting_api/interaction_input_test.dart @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "package:dart_wot/scripting_api.dart"; +import "package:dart_wot/core.dart"; import "package:test/test.dart"; void main() {