From 6b2d6dbfbb178a76abe5b1aae771d434dc9de227 Mon Sep 17 00:00:00 2001 From: u221711 Date: Wed, 30 Oct 2024 13:48:06 +0100 Subject: [PATCH] add workflow for analyze, fix lint errors --- .github/workflows/flutter_android_build.yml | 4 +- .../workflows/flutter_build_test_analyze.yml | 59 +++++++++++++++++++ .github/workflows/flutter_ios_build.yml | 1 - das_client/analysis_options.yaml | 5 +- .../lib/dont_use_src_folder_imports.dart | 12 ++-- das_client/das_custom_lints/pubspec.yaml | 1 - .../auth/integrationtest_authenticator.dart | 2 +- .../auth/mqtt_client_user_connector.dart | 16 ++--- das_client/lib/auth/token_spec.dart | 2 +- das_client/lib/bloc/fahrbild_cubit.dart | 4 +- das_client/lib/bloc/fahrbild_state.dart | 2 +- das_client/lib/flavor.dart | 8 +-- das_client/lib/logging/src/das_log_tree.dart | 22 +++---- das_client/lib/logging/src/log_entry.dart | 2 +- das_client/lib/logging/src/log_service.dart | 16 ++--- .../lib/model/db/journey_profile_entity.dart | 2 +- .../lib/model/db/segment_profile_entity.dart | 2 +- das_client/lib/model/sfera/b2g_request.dart | 2 +- .../sfera/das_operating_modes_selected.dart | 10 ++-- .../sfera/das_operating_modes_supported.dart | 14 ++--- .../model/sfera/enums/das_architecture.dart | 4 +- .../model/sfera/enums/das_connectivity.dart | 4 +- .../model/sfera/enums/das_driving_mode.dart | 16 ++--- .../sfera/enums/handshake_reject_reason.dart | 14 ++--- .../enums/related_train_request_type.dart | 10 ++-- .../lib/model/sfera/g2b_reply_payload.dart | 2 +- .../sfera/handshake_acknowledgement.dart | 4 +- .../lib/model/sfera/handshake_reject.dart | 6 +- .../lib/model/sfera/handshake_request.dart | 8 +-- .../lib/model/sfera/journey_profile.dart | 4 +- das_client/lib/model/sfera/jp_request.dart | 2 +- .../lib/model/sfera/message_header.dart | 42 ++++++------- das_client/lib/model/sfera/otn_id.dart | 26 ++++---- .../lib/model/sfera/segment_profile.dart | 18 +++--- .../lib/model/sfera/segment_profile_list.dart | 14 ++--- .../sfera/sfera_b2g_request_message.dart | 2 +- .../model/sfera/sfera_g2b_reply_message.dart | 2 +- .../lib/model/sfera/sfera_xml_element.dart | 8 +-- das_client/lib/model/sfera/signal.dart | 4 +- das_client/lib/model/sfera/signal_id.dart | 8 +-- das_client/lib/model/sfera/sp_points.dart | 2 +- das_client/lib/model/sfera/sp_request.dart | 8 +-- das_client/lib/model/sfera/sp_zone.dart | 8 +-- .../sfera/stopping_point_information.dart | 6 +- das_client/lib/model/sfera/timing_point.dart | 8 +-- .../model/sfera/timing_point_constraints.dart | 2 +- .../model/sfera/timing_point_reference.dart | 2 +- .../lib/model/sfera/tp_id_reference.dart | 6 +- das_client/lib/model/sfera/tp_name.dart | 6 +- .../lib/model/sfera/train_identification.dart | 2 +- .../lib/model/sfera/virtual_balise.dart | 6 +- .../model/sfera/virtual_balise_position.dart | 10 ++-- .../lib/pages/fahrt/widgets/fahrbild.dart | 4 +- .../pages/fahrt/widgets/train_selection.dart | 6 +- das_client/lib/repo/sfera_repository.dart | 6 +- das_client/lib/service/backend_service.dart | 6 +- .../mqtt/mqtt_client_oauth_connector.dart | 20 +++---- .../mqtt/mqtt_client_tms_oauth_connector.dart | 16 ++--- das_client/lib/service/mqtt/mqtt_service.dart | 20 +++---- .../journey_profile_reply_handler.dart | 2 +- .../segment_profile_reply_handler.dart | 2 +- .../lib/service/sfera/sfera_service.dart | 16 ++--- .../service/sfera/task/handshake_task.dart | 8 +-- .../task/request_journey_profile_task.dart | 4 +- .../task/request_segment_profiles_task.dart | 6 +- .../lib/service/sfera/task/sfera_task.dart | 2 +- .../lib/service/sfera_auth_service.dart | 6 +- das_client/lib/util/format.dart | 2 +- das_client/pubspec.lock | 2 +- .../test/logging/logging_service_test.dart | 24 ++++---- .../test/model/sfera/sfera_document_test.dart | 38 ++++++------ .../sfera/sfera_handshake_task_test.dart | 2 +- ...era_request_journey_profile_task_test.dart | 2 +- 73 files changed, 349 insertions(+), 295 deletions(-) create mode 100644 .github/workflows/flutter_build_test_analyze.yml diff --git a/.github/workflows/flutter_android_build.yml b/.github/workflows/flutter_android_build.yml index a759c8e6..edfb1cbf 100644 --- a/.github/workflows/flutter_android_build.yml +++ b/.github/workflows/flutter_android_build.yml @@ -27,7 +27,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -52,8 +52,6 @@ jobs: echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV" flutter pub get flutter pub run build_runner build --delete-conflicting-outputs - - run: flutter pub run custom_lint - - run: flutter test - run: flutter build appbundle --flavor dev -t lib/main_dev.dart - run: flutter build appbundle --flavor inte -t lib/main_inte.dart - run: flutter build appbundle --flavor prod -t lib/main_prod.dart \ No newline at end of file diff --git a/.github/workflows/flutter_build_test_analyze.yml b/.github/workflows/flutter_build_test_analyze.yml new file mode 100644 index 00000000..a759c8e6 --- /dev/null +++ b/.github/workflows/flutter_build_test_analyze.yml @@ -0,0 +1,59 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Flutter Android Build + +defaults: + run: + working-directory: das_client + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + push: + paths: + - 'das_client/**' + pull_request: + paths: + - 'das_client/**' + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.24.3' + - name: Prepare Flutter Build + env: + ANDROID_KEYSTORE_STRING: ${{ secrets.ANDROID_KEYSTORE }} + ANDROID_KEYSTORE: ${{ github.workspace }}/das_client/android/das.keystore + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} + ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} + run: | + echo $ANDROID_KEYSTORE_STRING | base64 -d > $ANDROID_KEYSTORE + echo "ANDROID_KEYSTORE=$ANDROID_KEYSTORE" >> "$GITHUB_ENV" + echo "ANDROID_KEYSTORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD" >> "$GITHUB_ENV" + echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> "$GITHUB_ENV" + echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV" + flutter pub get + flutter pub run build_runner build --delete-conflicting-outputs + - run: flutter pub run custom_lint + - run: flutter test + - run: flutter build appbundle --flavor dev -t lib/main_dev.dart + - run: flutter build appbundle --flavor inte -t lib/main_inte.dart + - run: flutter build appbundle --flavor prod -t lib/main_prod.dart \ No newline at end of file diff --git a/.github/workflows/flutter_ios_build.yml b/.github/workflows/flutter_ios_build.yml index 1282e592..5423c2f2 100644 --- a/.github/workflows/flutter_ios_build.yml +++ b/.github/workflows/flutter_ios_build.yml @@ -41,7 +41,6 @@ jobs: run: | flutter pub get flutter pub run build_runner build --delete-conflicting-outputs - - run: flutter test - name: Build iOS App DEV run: flutter build ipa --flavor dev -t lib/main_dev.dart --release --no-codesign - name: Build iOS App INTE diff --git a/das_client/analysis_options.yaml b/das_client/analysis_options.yaml index 7a84bf36..139636e7 100644 --- a/das_client/analysis_options.yaml +++ b/das_client/analysis_options.yaml @@ -23,6 +23,7 @@ linter: # producing the lint. rules: always_use_package_imports: true + prefer_single_quotes: true # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options @@ -31,6 +32,4 @@ analyzer: - custom_lint exclude: - lib/**.g.dart - - test/**.mocks.dart - errors: - invalid_annotation_target: ignore \ No newline at end of file + - test/**.mocks.dart \ No newline at end of file diff --git a/das_client/das_custom_lints/lib/dont_use_src_folder_imports.dart b/das_client/das_custom_lints/lib/dont_use_src_folder_imports.dart index 783cf852..3ed128ae 100644 --- a/das_client/das_custom_lints/lib/dont_use_src_folder_imports.dart +++ b/das_client/das_custom_lints/lib/dont_use_src_folder_imports.dart @@ -22,20 +22,20 @@ class DontUseSrcFolderImports extends DartLintRule { CustomLintContext context, ) { - // A call back fn that runs on all variable declarations in a file + // A call back fn that runs on all import declarations in a file context.registry.addImportDirective((importDirective) { var importUri = importDirective.uri.stringValue; if (importUri == null || !importUri.contains('/src/')) return; var filePath = importDirective.element!.source.fullName; - if (!filePath.contains("/lib/")) return; + if (!filePath.contains('/lib/')) return; - importUri = importUri.substring(importUri.indexOf("/") + 1); - filePath = filePath.substring(filePath.indexOf("/lib/") + 5); + importUri = importUri.substring(importUri.indexOf('/') + 1); + filePath = filePath.substring(filePath.indexOf('/lib/') + 5); - final importParts = importUri.split("/src/"); - final fileParts = filePath.split("/src/"); + final importParts = importUri.split('/src/'); + final fileParts = filePath.split('/src/'); if (fileParts[0].startsWith(importParts[0])) return; // report a lint error with the `code` and the respective import directive diff --git a/das_client/das_custom_lints/pubspec.yaml b/das_client/das_custom_lints/pubspec.yaml index a844e8be..04f7a793 100644 --- a/das_client/das_custom_lints/pubspec.yaml +++ b/das_client/das_custom_lints/pubspec.yaml @@ -9,4 +9,3 @@ dependencies: analyzer: ^6.7.0 analyzer_plugin: ^0.11.2 custom_lint_builder: ^0.7.0 - # path: ../../../dart_custom_lint/packages/custom_lint_builder diff --git a/das_client/integration_test/auth/integrationtest_authenticator.dart b/das_client/integration_test/auth/integrationtest_authenticator.dart index 77e7f28c..7991d5da 100644 --- a/das_client/integration_test/auth/integrationtest_authenticator.dart +++ b/das_client/integration_test/auth/integrationtest_authenticator.dart @@ -24,7 +24,7 @@ class IntegrationtestAuthenticator implements Authenticator { @override Future userId({String? tokenId}) async { - return "tester@testeee.com"; + return 'tester@testeee.com'; } OidcToken _token() { diff --git a/das_client/integration_test/auth/mqtt_client_user_connector.dart b/das_client/integration_test/auth/mqtt_client_user_connector.dart index 2fbfadaa..7b700783 100644 --- a/das_client/integration_test/auth/mqtt_client_user_connector.dart +++ b/das_client/integration_test/auth/mqtt_client_user_connector.dart @@ -3,32 +3,32 @@ import 'package:fimber/fimber.dart'; import 'package:mqtt_client/mqtt_client.dart'; class MqttClientUserConnector implements MqttClientConnector { - static const mqttUsername = "MQTT_USERNAME"; - static const mqttPassword = "MQTT_PASSWORD"; + static const mqttUsername = 'MQTT_USERNAME'; + static const mqttPassword = 'MQTT_PASSWORD'; @override Future connect(MqttClient client, String company, String train) async { - Fimber.i("Connecting to mqtt using static login and password"); + Fimber.i('Connecting to mqtt using static login and password'); if (!const bool.hasEnvironment(mqttUsername) || !const bool.hasEnvironment(mqttPassword)) { - Fimber.e("$mqttUsername or $mqttPassword not defined"); + Fimber.e('$mqttUsername or $mqttPassword not defined'); return false; } try { var mqttClientConnectionStatus = await client.connect(const String.fromEnvironment(mqttUsername), const String.fromEnvironment(mqttPassword)); - Fimber.i("mqttClientConnectionStatus=$mqttClientConnectionStatus"); + Fimber.i('mqttClientConnectionStatus=$mqttClientConnectionStatus'); if (mqttClientConnectionStatus?.state == MqttConnectionState.connected) { - Fimber.i("Successfully connected to MQTT broker"); + Fimber.i('Successfully connected to MQTT broker'); return true; } } catch (e) { - Fimber.e("Exception during connect", ex: e); + Fimber.e('Exception during connect', ex: e); } - Fimber.w("Failed to connect to MQTT broker"); + Fimber.w('Failed to connect to MQTT broker'); return false; } } diff --git a/das_client/lib/auth/token_spec.dart b/das_client/lib/auth/token_spec.dart index 1f93229f..4add4c3a 100644 --- a/das_client/lib/auth/token_spec.dart +++ b/das_client/lib/auth/token_spec.dart @@ -4,7 +4,7 @@ import 'package:meta/meta.dart'; @sealed @immutable class TokenSpec { - static const String defaultTokenId = "T1"; + static const String defaultTokenId = 'T1'; const TokenSpec({ required this.id, diff --git a/das_client/lib/bloc/fahrbild_cubit.dart b/das_client/lib/bloc/fahrbild_cubit.dart index ea883fbf..4d1e7162 100644 --- a/das_client/lib/bloc/fahrbild_cubit.dart +++ b/das_client/lib/bloc/fahrbild_cubit.dart @@ -33,7 +33,7 @@ class FahrbildCubit extends Cubit { final company = currentState.company; final trainNumber = currentState.trainNumber; if (company == null || trainNumber == null) { - Fimber.i("company or trainNumber null"); + Fimber.i('company or trainNumber null'); return; } @@ -81,7 +81,7 @@ class FahrbildCubit extends Cubit { void reset() { if (state is BaseFahrbildState) { - Fimber.i("Reseting fahrbild cubit in state $state"); + Fimber.i('Reseting fahrbild cubit in state $state'); emit(SelectingFahrbildState( trainNumber: (state as BaseFahrbildState).trainNumber, company: (state as BaseFahrbildState).company)); } diff --git a/das_client/lib/bloc/fahrbild_state.dart b/das_client/lib/bloc/fahrbild_state.dart index 863eba2f..4ffd173f 100644 --- a/das_client/lib/bloc/fahrbild_state.dart +++ b/das_client/lib/bloc/fahrbild_state.dart @@ -20,7 +20,7 @@ abstract class BaseFahrbildState extends FahrbildState { @override String toString() { - return "${runtimeType.toString()}(company=$company, trainNumber=$trainNumber, date=$date)"; + return '${runtimeType.toString()}(company=$company, trainNumber=$trainNumber, date=$date)'; } } diff --git a/das_client/lib/flavor.dart b/das_client/lib/flavor.dart index 8d74bfbd..0791f06c 100644 --- a/das_client/lib/flavor.dart +++ b/das_client/lib/flavor.dart @@ -57,7 +57,7 @@ enum Flavor { const _authenticatorConfigTmsDev = AuthenticatorConfig( discoveryUrl: - "https://login.microsoftonline.com/2cda5d11-f0ac-46b3-967d-af1b2e1bd01a/v2.0/.well-known/openid-configuration", + 'https://login.microsoftonline.com/2cda5d11-f0ac-46b3-967d-af1b2e1bd01a/v2.0/.well-known/openid-configuration', clientId: '8af8281c-4f1d-47b5-ad77-526b1da61b2b', redirectUrl: 'ch.sbb.das://sbbauth/redirect', tokenSpecs: TokenSpecProvider([ @@ -70,7 +70,7 @@ const _authenticatorConfigTmsDev = AuthenticatorConfig( ); const _authenticatorConfigMockDev = AuthenticatorConfig( - discoveryUrl: "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + discoveryUrl: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration', clientId: '6025180f-123b-4f2f-9703-16e08fc221f0', redirectUrl: 'ch.sbb.das://sbbauth/redirect', tokenSpecs: TokenSpecProvider([ @@ -83,7 +83,7 @@ const _authenticatorConfigMockDev = AuthenticatorConfig( ); const _authenticatorConfigInte = AuthenticatorConfig( - discoveryUrl: "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + discoveryUrl: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration', clientId: '6025180f-123b-4f2f-9703-16e08fc221f0', redirectUrl: 'ch.sbb.das://sbbauth/redirect', tokenSpecs: TokenSpecProvider([ @@ -96,7 +96,7 @@ const _authenticatorConfigInte = AuthenticatorConfig( ); const _authenticatorConfigProd = AuthenticatorConfig( - discoveryUrl: "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + discoveryUrl: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration', clientId: '6025180f-123b-4f2f-9703-16e08fc221f0', redirectUrl: 'ch.sbb.das://sbbauth/redirect', tokenSpecs: TokenSpecProvider([ diff --git a/das_client/lib/logging/src/das_log_tree.dart b/das_client/lib/logging/src/das_log_tree.dart index 747b3fd0..9809942e 100644 --- a/das_client/lib/logging/src/das_log_tree.dart +++ b/das_client/lib/logging/src/das_log_tree.dart @@ -33,7 +33,7 @@ class DasLogTree extends LogTree { } void _processAndroidDeviceInfo(AndroidDeviceInfo deviceInfo) { - metadata['systemName'] = "android"; + metadata['systemName'] = 'android'; metadata['systemVersion'] = deviceInfo.version.sdkInt.toString(); metadata['model'] = deviceInfo.model; } @@ -46,7 +46,7 @@ class DasLogTree extends LogTree { @override List getLevels() { - return ["I", "W", "E"]; + return ['I', 'W', 'E']; } @override @@ -57,16 +57,16 @@ class DasLogTree extends LogTree { void logInternal(String level, String message, {String? tag, ex, StackTrace? stacktrace}) async { await _initialized; - final messageBuilder = StringBuffer("$tag:\t $message"); + final messageBuilder = StringBuffer('$tag:\t $message'); if (ex != null) { - messageBuilder.write("\n$ex"); + messageBuilder.write('\n$ex'); } if (stacktrace != null) { final tmpStacktrace = stacktrace.toString().split('\n'); final stackTraceMessage = - tmpStacktrace.map((stackLine) => "\t$stackLine").join("\n"); - messageBuilder.write("\n$stackTraceMessage"); + tmpStacktrace.map((stackLine) => '\t$stackLine').join('\n'); + messageBuilder.write('\n$stackTraceMessage'); } _logService.save(LogEntry(messageBuilder.toString(), _getLogLevel(level), metadata)); @@ -74,15 +74,15 @@ class DasLogTree extends LogTree { LogLevel _getLogLevel(String level) { switch (level) { - case "D": + case 'D': return LogLevel.debug; - case "W": + case 'W': return LogLevel.warning; - case "E": + case 'E': return LogLevel.error; - case "V": + case 'V': return LogLevel.trace; - case "I": + case 'I': default: return LogLevel.info; } diff --git a/das_client/lib/logging/src/log_entry.dart b/das_client/lib/logging/src/log_entry.dart index 79fc7172..522c47a8 100644 --- a/das_client/lib/logging/src/log_entry.dart +++ b/das_client/lib/logging/src/log_entry.dart @@ -3,7 +3,7 @@ import 'package:das_client/logging/src/log_level.dart'; class LogEntry { LogEntry(this.message, this.level, this.metadata) : time = DateTime.now().millisecondsSinceEpoch / 1000, - source = "das_client"; + source = 'das_client'; final double time; final String source; diff --git a/das_client/lib/logging/src/log_service.dart b/das_client/lib/logging/src/log_service.dart index 0009402f..2429df5e 100644 --- a/das_client/lib/logging/src/log_service.dart +++ b/das_client/lib/logging/src/log_service.dart @@ -11,8 +11,8 @@ import 'package:synchronized/synchronized.dart'; class LogService { static const _rolloverTimeMinutes = 1; static const _maxFileSize = 50 * 1024; - static const _prefix = "das-log"; - static const _lastSavedFileName = "$_prefix-lastSavedFile.json"; + static const _prefix = 'das-log'; + static const _lastSavedFileName = '$_prefix-lastSavedFile.json'; final _lock = Lock(); final _senderLock = Lock(); @@ -31,7 +31,7 @@ class LogService { } Future _getLogPath() async { - return "${(await getApplicationSupportDirectory()).path}/logs"; + return '${(await getApplicationSupportDirectory()).path}/logs'; } void save(LogEntry log) { @@ -41,16 +41,16 @@ class LogService { void _saveInternal(LogEntry log) async { await _initialized; _lock.synchronized(() { - var lastSavedFile = File("$_logPath/$_lastSavedFileName"); + var lastSavedFile = File('$_logPath/$_lastSavedFileName'); if (!(lastSavedFile.existsSync())) { lastSavedFile.createSync(recursive: true); } - lastSavedFile.writeAsStringSync("${jsonEncode(log)},", mode: FileMode.append); + lastSavedFile.writeAsStringSync('${jsonEncode(log)},', mode: FileMode.append); // Check rollover if (lastSavedFile.lengthSync() > _maxFileSize || _nextRolloverTimeStamp.isBefore(DateTime.now())) { - Fimber.d("Rolling over log file"); - lastSavedFile.renameSync("$_logPath/$_prefix-${DateTime.now().millisecondsSinceEpoch}.json"); + Fimber.d('Rolling over log file'); + lastSavedFile.renameSync('$_logPath/$_prefix-${DateTime.now().millisecondsSinceEpoch}.json'); _nextRolloverTimeStamp = DateTime.now().add(const Duration(minutes: _rolloverTimeMinutes)); _sendLogs(); } @@ -64,7 +64,7 @@ class LogService { Fimber.d('Found ${files.length} log files in log directory: $_logPath'); for (var file in files) { - if (file is File && file.path.endsWith(".json") && !file.path.contains(_lastSavedFileName)) { + if (file is File && file.path.endsWith('.json') && !file.path.contains(_lastSavedFileName)) { Fimber.d('Sending ${file.path} to backend'); var content = file.readAsStringSync(); diff --git a/das_client/lib/model/db/journey_profile_entity.dart b/das_client/lib/model/db/journey_profile_entity.dart index 03d37724..e7e6e524 100644 --- a/das_client/lib/model/db/journey_profile_entity.dart +++ b/das_client/lib/model/db/journey_profile_entity.dart @@ -4,7 +4,7 @@ import 'package:isar/isar.dart'; part 'journey_profile_entity.g.dart'; -@Collection(accessor: "journeyProfile") +@Collection(accessor: 'journeyProfile') class JourneyProfileEntity { JourneyProfileEntity( {required this.id, diff --git a/das_client/lib/model/db/segment_profile_entity.dart b/das_client/lib/model/db/segment_profile_entity.dart index 86c8ff2d..c33088e2 100644 --- a/das_client/lib/model/db/segment_profile_entity.dart +++ b/das_client/lib/model/db/segment_profile_entity.dart @@ -4,7 +4,7 @@ import 'package:isar/isar.dart'; part 'segment_profile_entity.g.dart'; -@Collection(accessor: "segmentProfile") +@Collection(accessor: 'segmentProfile') class SegmentProfileEntity { SegmentProfileEntity( {required this.id, diff --git a/das_client/lib/model/sfera/b2g_request.dart b/das_client/lib/model/sfera/b2g_request.dart index df14980c..766ae47b 100644 --- a/das_client/lib/model/sfera/b2g_request.dart +++ b/das_client/lib/model/sfera/b2g_request.dart @@ -3,7 +3,7 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/sp_request.dart'; class B2gRequest extends SferaXmlElement { - static const String elementType = "B2G_Request"; + static const String elementType = 'B2G_Request'; B2gRequest({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/das_operating_modes_selected.dart b/das_client/lib/model/sfera/das_operating_modes_selected.dart index 4e35b7fa..452ebba7 100644 --- a/das_client/lib/model/sfera/das_operating_modes_selected.dart +++ b/das_client/lib/model/sfera/das_operating_modes_selected.dart @@ -4,18 +4,18 @@ import 'package:das_client/model/sfera/enums/xml_enum.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class DasOperatingModesSelected extends SferaXmlElement { - static const String elementType = "DAS_OperatingModeSelected"; + static const String elementType = 'DAS_OperatingModeSelected'; DasOperatingModesSelected({super.type = elementType, super.attributes, super.children, super.value}); - DasArchitecture get architecture => XmlEnum.valueOf(DasArchitecture.values, attributes["DAS_architecture"]!)!; + DasArchitecture get architecture => XmlEnum.valueOf(DasArchitecture.values, attributes['DAS_architecture']!)!; - DasConnectivity get connectivity => XmlEnum.valueOf(DasConnectivity.values, attributes["DAS_connectivity"]!)!; + DasConnectivity get connectivity => XmlEnum.valueOf(DasConnectivity.values, attributes['DAS_connectivity']!)!; @override bool validate() { - return validateHasEnumAttribute(DasArchitecture.values, "DAS_architecture") && - validateHasEnumAttribute(DasConnectivity.values, "DAS_connectivity") && + return validateHasEnumAttribute(DasArchitecture.values, 'DAS_architecture') && + validateHasEnumAttribute(DasConnectivity.values, 'DAS_connectivity') && super.validate(); } } diff --git a/das_client/lib/model/sfera/das_operating_modes_supported.dart b/das_client/lib/model/sfera/das_operating_modes_supported.dart index ea1a3034..0117526e 100644 --- a/das_client/lib/model/sfera/das_operating_modes_supported.dart +++ b/das_client/lib/model/sfera/das_operating_modes_supported.dart @@ -4,24 +4,24 @@ import 'package:das_client/model/sfera/enums/das_driving_mode.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class DasOperatingModesSupported extends SferaXmlElement { - static const String elementType = "DAS_OperatingModesSupported"; + static const String elementType = 'DAS_OperatingModesSupported'; DasOperatingModesSupported({super.type = elementType, super.attributes, super.children, super.value}); factory DasOperatingModesSupported.create( DasDrivingMode drivingMode, DasArchitecture architecture, DasConnectivity connectivity) { final operatingMode = DasOperatingModesSupported(); - operatingMode.attributes["DAS_drivingMode"] = drivingMode.xmlValue; - operatingMode.attributes["DAS_architecture"] = architecture.xmlValue; - operatingMode.attributes["DAS_connectivity"] = connectivity.xmlValue; + operatingMode.attributes['DAS_drivingMode'] = drivingMode.xmlValue; + operatingMode.attributes['DAS_architecture'] = architecture.xmlValue; + operatingMode.attributes['DAS_connectivity'] = connectivity.xmlValue; return operatingMode; } @override bool validate() { - return validateHasAttribute("DAS_drivingMode") && - validateHasAttribute("DAS_architecture") && - validateHasAttribute("DAS_connectivity") && + return validateHasAttribute('DAS_drivingMode') && + validateHasAttribute('DAS_architecture') && + validateHasAttribute('DAS_connectivity') && super.validate(); } } diff --git a/das_client/lib/model/sfera/enums/das_architecture.dart b/das_client/lib/model/sfera/enums/das_architecture.dart index 8c342e93..b2a28eab 100644 --- a/das_client/lib/model/sfera/enums/das_architecture.dart +++ b/das_client/lib/model/sfera/enums/das_architecture.dart @@ -1,8 +1,8 @@ import 'package:das_client/model/sfera/enums/xml_enum.dart'; enum DasArchitecture implements XmlEnum { - groundAdviceCalculation(xmlValue: "GroundAdviceCalculation"), - boardAdviceCalculation(xmlValue: "BoardAdviceCalculation"); + groundAdviceCalculation(xmlValue: 'GroundAdviceCalculation'), + boardAdviceCalculation(xmlValue: 'BoardAdviceCalculation'); const DasArchitecture({ required this.xmlValue, diff --git a/das_client/lib/model/sfera/enums/das_connectivity.dart b/das_client/lib/model/sfera/enums/das_connectivity.dart index 176323ad..90d9662a 100644 --- a/das_client/lib/model/sfera/enums/das_connectivity.dart +++ b/das_client/lib/model/sfera/enums/das_connectivity.dart @@ -1,8 +1,8 @@ import 'package:das_client/model/sfera/enums/xml_enum.dart'; enum DasConnectivity implements XmlEnum { - standalone(xmlValue: "Standalone"), - connected(xmlValue: "Connected"); + standalone(xmlValue: 'Standalone'), + connected(xmlValue: 'Connected'); const DasConnectivity({ required this.xmlValue, diff --git a/das_client/lib/model/sfera/enums/das_driving_mode.dart b/das_client/lib/model/sfera/enums/das_driving_mode.dart index 4cce5c40..b37a9495 100644 --- a/das_client/lib/model/sfera/enums/das_driving_mode.dart +++ b/das_client/lib/model/sfera/enums/das_driving_mode.dart @@ -1,14 +1,14 @@ import 'package:das_client/model/sfera/enums/xml_enum.dart'; enum DasDrivingMode implements XmlEnum { - inactive(xmlValue: "Inactive"), - timetable(xmlValue: "Timetable"), - readOnly(xmlValue: "Read-Only"), - dasNotConnected(xmlValue: "DAS not connected to ATP"), - goa1(xmlValue: "GoA1"), - goa2(xmlValue: "GoA2"), - goa3(xmlValue: "GoA3"), - goa4(xmlValue: "GoA4"); + inactive(xmlValue: 'Inactive'), + timetable(xmlValue: 'Timetable'), + readOnly(xmlValue: 'Read-Only'), + dasNotConnected(xmlValue: 'DAS not connected to ATP'), + goa1(xmlValue: 'GoA1'), + goa2(xmlValue: 'GoA2'), + goa3(xmlValue: 'GoA3'), + goa4(xmlValue: 'GoA4'); const DasDrivingMode({ required this.xmlValue, diff --git a/das_client/lib/model/sfera/enums/handshake_reject_reason.dart b/das_client/lib/model/sfera/enums/handshake_reject_reason.dart index 5da40f20..9e2848e0 100644 --- a/das_client/lib/model/sfera/enums/handshake_reject_reason.dart +++ b/das_client/lib/model/sfera/enums/handshake_reject_reason.dart @@ -1,13 +1,13 @@ import 'package:das_client/model/sfera/enums/xml_enum.dart'; enum HandshakeRejectReason implements XmlEnum { - atoVersionIncompatible(xmlValue: "ATO system version incompatible"), - sferaVersionIncompatible(xmlValue: "SFERA version incompatible"), - anotherDasAtoInCharge(xmlValue: "Another DAS-TS/ATO-TS in charge"), - dasInChargeUnkown(xmlValue: "DAS-TS/ATO-TS in charge unknown"), - architectureNotSupported(xmlValue: "Architecture not supported"), - connectivityNotSupported(xmlValue: "Connectivity not supported"), - archAndConnNotSupported(xmlValue: "Architecture and connectivity not supported"); + atoVersionIncompatible(xmlValue: 'ATO system version incompatible'), + sferaVersionIncompatible(xmlValue: 'SFERA version incompatible'), + anotherDasAtoInCharge(xmlValue: 'Another DAS-TS/ATO-TS in charge'), + dasInChargeUnkown(xmlValue: 'DAS-TS/ATO-TS in charge unknown'), + architectureNotSupported(xmlValue: 'Architecture not supported'), + connectivityNotSupported(xmlValue: 'Connectivity not supported'), + archAndConnNotSupported(xmlValue: 'Architecture and connectivity not supported'); const HandshakeRejectReason({ required this.xmlValue, diff --git a/das_client/lib/model/sfera/enums/related_train_request_type.dart b/das_client/lib/model/sfera/enums/related_train_request_type.dart index d73bf88f..e3029f54 100644 --- a/das_client/lib/model/sfera/enums/related_train_request_type.dart +++ b/das_client/lib/model/sfera/enums/related_train_request_type.dart @@ -1,11 +1,11 @@ import 'package:das_client/model/sfera/enums/xml_enum.dart'; enum RelatedTrainRequestType implements XmlEnum { - none(xmlValue: "None"), - ownTrain(xmlValue: "OwnTrain"), - relatedTrains(xmlValue: "RelatedTrains"), - ownTrainAndRelatedTrains(xmlValue: "OwnTrainAndRelatedTrains"), - ownTrainAndOrRelatedTrains(xmlValue: "OwnTrainAndOrRelatedTrains"); + none(xmlValue: 'None'), + ownTrain(xmlValue: 'OwnTrain'), + relatedTrains(xmlValue: 'RelatedTrains'), + ownTrainAndRelatedTrains(xmlValue: 'OwnTrainAndRelatedTrains'), + ownTrainAndOrRelatedTrains(xmlValue: 'OwnTrainAndOrRelatedTrains'); const RelatedTrainRequestType({ required this.xmlValue, diff --git a/das_client/lib/model/sfera/g2b_reply_payload.dart b/das_client/lib/model/sfera/g2b_reply_payload.dart index 9eee2f3a..fd84c44d 100644 --- a/das_client/lib/model/sfera/g2b_reply_payload.dart +++ b/das_client/lib/model/sfera/g2b_reply_payload.dart @@ -3,7 +3,7 @@ import 'package:das_client/model/sfera/segment_profile.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class G2bReplyPayload extends SferaXmlElement { - static const String elementType = "G2B_ReplyPayload"; + static const String elementType = 'G2B_ReplyPayload'; G2bReplyPayload({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/handshake_acknowledgement.dart b/das_client/lib/model/sfera/handshake_acknowledgement.dart index 6f948b48..6654c287 100644 --- a/das_client/lib/model/sfera/handshake_acknowledgement.dart +++ b/das_client/lib/model/sfera/handshake_acknowledgement.dart @@ -2,7 +2,7 @@ import 'package:das_client/model/sfera/das_operating_modes_selected.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class HandshakeAcknowledgement extends SferaXmlElement { - static const String elementType = "HandshakeAcknowledgement"; + static const String elementType = 'HandshakeAcknowledgement'; HandshakeAcknowledgement({super.type = elementType, super.attributes, super.children, super.value}); @@ -10,6 +10,6 @@ class HandshakeAcknowledgement extends SferaXmlElement { @override bool validate() { - return validateHasChild("DAS_OperatingModeSelected") && super.validate(); + return validateHasChild('DAS_OperatingModeSelected') && super.validate(); } } diff --git a/das_client/lib/model/sfera/handshake_reject.dart b/das_client/lib/model/sfera/handshake_reject.dart index 84f2f267..054cbeb1 100644 --- a/das_client/lib/model/sfera/handshake_reject.dart +++ b/das_client/lib/model/sfera/handshake_reject.dart @@ -4,14 +4,14 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/sp_zone.dart'; class HandshakeReject extends SferaXmlElement { - static const String elementType = "HandshakeReject"; + static const String elementType = 'HandshakeReject'; HandshakeReject({super.type = elementType, super.attributes, super.children, super.value}); SpZone? get spZone => children.whereType().firstOrNull; - String? get atotsId => attributes["ATOTS_ID"]; + String? get atotsId => attributes['ATOTS_ID']; HandshakeRejectReason? get handshakeRejectReason => - XmlEnum.valueOf(HandshakeRejectReason.values, attributes["handshakeRejectReason"]); + XmlEnum.valueOf(HandshakeRejectReason.values, attributes['handshakeRejectReason']); } diff --git a/das_client/lib/model/sfera/handshake_request.dart b/das_client/lib/model/sfera/handshake_request.dart index 5d2b7fe5..d41e0abd 100644 --- a/das_client/lib/model/sfera/handshake_request.dart +++ b/das_client/lib/model/sfera/handshake_request.dart @@ -3,7 +3,7 @@ import 'package:das_client/model/sfera/enums/related_train_request_type.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class HandshakeRequest extends SferaXmlElement { - static const String elementType = "HandshakeRequest"; + static const String elementType = 'HandshakeRequest'; HandshakeRequest({super.type = elementType, super.attributes, super.children, super.value}); @@ -12,13 +12,13 @@ class HandshakeRequest extends SferaXmlElement { final request = HandshakeRequest(); request.children.addAll(supportedOperatingModes); if (relatedTrainRequestType != null) { - request.attributes["relatedTrainRequest"] = relatedTrainRequestType.xmlValue; + request.attributes['relatedTrainRequest'] = relatedTrainRequestType.xmlValue; } if (statusReportsEnabled != null) { - request.attributes["statusReportsEnabled"] = statusReportsEnabled.toString(); + request.attributes['statusReportsEnabled'] = statusReportsEnabled.toString(); } if (additionalInfo != null) { - request.attributes["additionalInfo"] = additionalInfo; + request.attributes['additionalInfo'] = additionalInfo; } return request; } diff --git a/das_client/lib/model/sfera/journey_profile.dart b/das_client/lib/model/sfera/journey_profile.dart index 6ca1d936..ae26832e 100644 --- a/das_client/lib/model/sfera/journey_profile.dart +++ b/das_client/lib/model/sfera/journey_profile.dart @@ -3,7 +3,7 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/train_identification.dart'; class JourneyProfile extends SferaXmlElement { - static const String elementType = "JourneyProfile"; + static const String elementType = 'JourneyProfile'; JourneyProfile({super.type = elementType, super.attributes, super.children, super.value}); @@ -13,6 +13,6 @@ class JourneyProfile extends SferaXmlElement { @override bool validate() { - return validateHasChild("TrainIdentification") && super.validate(); + return validateHasChild('TrainIdentification') && super.validate(); } } diff --git a/das_client/lib/model/sfera/jp_request.dart b/das_client/lib/model/sfera/jp_request.dart index 5232b6df..a705d211 100644 --- a/das_client/lib/model/sfera/jp_request.dart +++ b/das_client/lib/model/sfera/jp_request.dart @@ -2,7 +2,7 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/train_identification.dart'; class JpRequest extends SferaXmlElement { - static const String elementType = "JP_Request"; + static const String elementType = 'JP_Request'; JpRequest({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/message_header.dart b/das_client/lib/model/sfera/message_header.dart index 671711d4..b233146a 100644 --- a/das_client/lib/model/sfera/message_header.dart +++ b/das_client/lib/model/sfera/message_header.dart @@ -2,48 +2,48 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/train_identification.dart'; class MessageHeader extends SferaXmlElement { - static const String elementType = "MessageHeader"; + static const String elementType = 'MessageHeader'; MessageHeader({super.type = elementType, super.attributes, super.children, super.value}); factory MessageHeader.create(String messageId, String timestamp, String sourceDevice, String destinationDevice, String sender, String recipient, {TrainIdentification? trainIdentification}) { final messageHeader = MessageHeader(); - messageHeader.attributes["SFERA_version"] = "2.01"; - messageHeader.attributes["message_ID"] = messageId; - messageHeader.attributes["timestamp"] = timestamp; - messageHeader.attributes["sourceDevice"] = sourceDevice; - messageHeader.attributes["destinationDevice"] = destinationDevice; + messageHeader.attributes['SFERA_version'] = '2.01'; + messageHeader.attributes['message_ID'] = messageId; + messageHeader.attributes['timestamp'] = timestamp; + messageHeader.attributes['sourceDevice'] = sourceDevice; + messageHeader.attributes['destinationDevice'] = destinationDevice; if (trainIdentification != null) { messageHeader.children.add(trainIdentification); } - messageHeader.children.add(SferaXmlElement(type: "Sender", value: sender)); - messageHeader.children.add(SferaXmlElement(type: "Recipient", value: recipient)); + messageHeader.children.add(SferaXmlElement(type: 'Sender', value: sender)); + messageHeader.children.add(SferaXmlElement(type: 'Recipient', value: recipient)); return messageHeader; } - String get sferaVersion => attributes["SFERA_version"]!; + String get sferaVersion => attributes['SFERA_version']!; - String get messageId => attributes["message_ID"]!; + String get messageId => attributes['message_ID']!; - String get correlationId => attributes["correlation_ID"]!; + String get correlationId => attributes['correlation_ID']!; - String get timestamp => attributes["timestamp"]!; + String get timestamp => attributes['timestamp']!; - String get sourceDevice => attributes["timestamp"]!; + String get sourceDevice => attributes['timestamp']!; - String get sender => childrenWithType("Sender").first.value!; + String get sender => childrenWithType('Sender').first.value!; - String get recipient => childrenWithType("Recipient").first.value!; + String get recipient => childrenWithType('Recipient').first.value!; @override bool validate() { - return validateHasChild("Sender") && - validateHasChild("Recipient") && - validateHasAttribute("SFERA_version") && - validateHasAttribute("message_ID") && - validateHasAttribute("timestamp") && - validateHasAttribute("sourceDevice") && + return validateHasChild('Sender') && + validateHasChild('Recipient') && + validateHasAttribute('SFERA_version') && + validateHasAttribute('message_ID') && + validateHasAttribute('timestamp') && + validateHasAttribute('sourceDevice') && super.validate(); } } diff --git a/das_client/lib/model/sfera/otn_id.dart b/das_client/lib/model/sfera/otn_id.dart index 84eeaeb8..c6b3989d 100644 --- a/das_client/lib/model/sfera/otn_id.dart +++ b/das_client/lib/model/sfera/otn_id.dart @@ -2,40 +2,40 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/util/format.dart'; class OtnId extends SferaXmlElement { - static const String elementType = "OTN_ID"; + static const String elementType = 'OTN_ID'; OtnId({super.type = elementType, super.attributes, super.children, super.value}); factory OtnId.create(String company, String operationalTrainNumber, DateTime startDate, {String? additionalTrainNumber}) { final otnId = OtnId(); - otnId.children.add(SferaXmlElement(type: "Company", value: company)); - otnId.children.add(SferaXmlElement(type: "OperationalTrainNumber", value: operationalTrainNumber)); - otnId.children.add(SferaXmlElement(type: "StartDate", value: Format.sferaDate(startDate))); + otnId.children.add(SferaXmlElement(type: 'Company', value: company)); + otnId.children.add(SferaXmlElement(type: 'OperationalTrainNumber', value: operationalTrainNumber)); + otnId.children.add(SferaXmlElement(type: 'StartDate', value: Format.sferaDate(startDate))); if (additionalTrainNumber != null) { - otnId.children.add(SferaXmlElement(type: "AdditionalTrainNumber", value: additionalTrainNumber)); + otnId.children.add(SferaXmlElement(type: 'AdditionalTrainNumber', value: additionalTrainNumber)); } return otnId; } - String get company => childrenWithType("Company").first.value!; + String get company => childrenWithType('Company').first.value!; - String get operationalTrainNumber => childrenWithType("OperationalTrainNumber").first.value!; + String get operationalTrainNumber => childrenWithType('OperationalTrainNumber').first.value!; - String? get additionalTrainNumber => childrenWithType("AdditionalTrainNumber").firstOrNull?.value; + String? get additionalTrainNumber => childrenWithType('AdditionalTrainNumber').firstOrNull?.value; - DateTime get startDate => DateTime.parse(childrenWithType("StartDate").first.value!); + DateTime get startDate => DateTime.parse(childrenWithType('StartDate').first.value!); @override bool validate() { - return validateHasChild("Company") && - validateHasChild("OperationalTrainNumber") && - validateHasChild("StartDate") && + return validateHasChild('Company') && + validateHasChild('OperationalTrainNumber') && + validateHasChild('StartDate') && super.validate(); } @override toString() { - return "OtnId(company: $company, operationalTrainNumber: $operationalTrainNumber, startDate: $startDate, additionalTrainNumber: $additionalTrainNumber)"; + return 'OtnId(company: $company, operationalTrainNumber: $operationalTrainNumber, startDate: $startDate, additionalTrainNumber: $additionalTrainNumber)'; } } diff --git a/das_client/lib/model/sfera/segment_profile.dart b/das_client/lib/model/sfera/segment_profile.dart index 16bb0e4a..83b2f487 100644 --- a/das_client/lib/model/sfera/segment_profile.dart +++ b/das_client/lib/model/sfera/segment_profile.dart @@ -3,14 +3,14 @@ import 'package:das_client/model/sfera/sp_points.dart'; import 'package:das_client/model/sfera/sp_zone.dart'; class SegmentProfile extends SferaXmlElement { - static const String elementType = "SegmentProfile"; + static const String elementType = 'SegmentProfile'; SegmentProfile({super.type = elementType, super.attributes, super.children, super.value}); - String get versionMajor => attributes["SP_VersionMajor"]!; - String get versionMinor => attributes["SP_VersionMinor"]!; - String get length => attributes["SP_Length"]!; - String get id => attributes["SP_ID"]!; + String get versionMajor => attributes['SP_VersionMajor']!; + String get versionMinor => attributes['SP_VersionMinor']!; + String get length => attributes['SP_Length']!; + String get id => attributes['SP_ID']!; SpZone? get zone => children.whereType().firstOrNull; @@ -18,10 +18,10 @@ class SegmentProfile extends SferaXmlElement { @override bool validate() { - return validateHasAttribute("SP_VersionMajor") && - validateHasAttribute("SP_VersionMinor") && - validateHasAttribute("SP_Length") && - validateHasAttribute("SP_ID") && + return validateHasAttribute('SP_VersionMajor') && + validateHasAttribute('SP_VersionMinor') && + validateHasAttribute('SP_Length') && + validateHasAttribute('SP_ID') && super.validate(); } } diff --git a/das_client/lib/model/sfera/segment_profile_list.dart b/das_client/lib/model/sfera/segment_profile_list.dart index 6b07d272..27a01af5 100644 --- a/das_client/lib/model/sfera/segment_profile_list.dart +++ b/das_client/lib/model/sfera/segment_profile_list.dart @@ -3,15 +3,15 @@ import 'package:das_client/model/sfera/sp_zone.dart'; import 'package:das_client/model/sfera/timing_point_constraints.dart'; class SegmentProfileList extends SferaXmlElement { - static const String elementType = "SegmentProfileList"; + static const String elementType = 'SegmentProfileList'; SegmentProfileList({super.type = elementType, super.attributes, super.children, super.value}); - String get spId => attributes["SP_ID"]!; + String get spId => attributes['SP_ID']!; - String get versionMajor => attributes["SP_VersionMajor"]!; + String get versionMajor => attributes['SP_VersionMajor']!; - String get versionMinor => attributes["SP_VersionMinor"]!; + String get versionMinor => attributes['SP_VersionMinor']!; SpZone get spZone => children.whereType().first; @@ -19,9 +19,9 @@ class SegmentProfileList extends SferaXmlElement { @override bool validate() { - return validateHasAttribute("SP_ID") && - validateHasAttribute("SP_VersionMajor") && - validateHasAttribute("SP_VersionMinor") && + return validateHasAttribute('SP_ID') && + validateHasAttribute('SP_VersionMajor') && + validateHasAttribute('SP_VersionMinor') && validateHasChildOfType() && super.validate(); } diff --git a/das_client/lib/model/sfera/sfera_b2g_request_message.dart b/das_client/lib/model/sfera/sfera_b2g_request_message.dart index dd198887..08496800 100644 --- a/das_client/lib/model/sfera/sfera_b2g_request_message.dart +++ b/das_client/lib/model/sfera/sfera_b2g_request_message.dart @@ -4,7 +4,7 @@ import 'package:das_client/model/sfera/message_header.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class SferaB2gRequestMessage extends SferaXmlElement { - static const String elementType = "SFERA_B2G_RequestMessage"; + static const String elementType = 'SFERA_B2G_RequestMessage'; SferaB2gRequestMessage({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/sfera_g2b_reply_message.dart b/das_client/lib/model/sfera/sfera_g2b_reply_message.dart index c80b6fbb..3d91d917 100644 --- a/das_client/lib/model/sfera/sfera_g2b_reply_message.dart +++ b/das_client/lib/model/sfera/sfera_g2b_reply_message.dart @@ -5,7 +5,7 @@ import 'package:das_client/model/sfera/message_header.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class SferaG2bReplyMessage extends SferaXmlElement { - static const String elementType = "SFERA_G2B_ReplyMessage"; + static const String elementType = 'SFERA_G2B_ReplyMessage'; SferaG2bReplyMessage({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/sfera_xml_element.dart b/das_client/lib/model/sfera/sfera_xml_element.dart index 5aa49db5..4de53d7f 100644 --- a/das_client/lib/model/sfera/sfera_xml_element.dart +++ b/das_client/lib/model/sfera/sfera_xml_element.dart @@ -18,7 +18,7 @@ class SferaXmlElement { bool validateHasAttribute(String attribute) { if (!attributes.containsKey(attribute)) { - Fimber.w("Validation failed for $type because attribute $attribute is missing"); + Fimber.w('Validation failed for $type because attribute $attribute is missing'); return false; } @@ -27,7 +27,7 @@ class SferaXmlElement { bool validateHasChild(String type) { if (childrenWithType(type).isEmpty) { - Fimber.w("Validation failed for ${this.type} because it has no child of type $type"); + Fimber.w('Validation failed for ${this.type} because it has no child of type $type'); return false; } @@ -36,7 +36,7 @@ class SferaXmlElement { bool validateHasChildOfType() { if (children.whereType().isEmpty) { - Fimber.w("Validation failed for $type because it has no child of type ${T.toString()}"); + Fimber.w('Validation failed for $type because it has no child of type ${T.toString()}'); return false; } @@ -58,7 +58,7 @@ class SferaXmlElement { } if (XmlEnum.valueOf(allValues, attributes[attribute]!) == null) { - Fimber.w("Validation failed for $type because attribute $attribute could not be mapped to Enum ${T.toString()}"); + Fimber.w('Validation failed for $type because attribute $attribute could not be mapped to Enum ${T.toString()}'); } return true; diff --git a/das_client/lib/model/sfera/signal.dart b/das_client/lib/model/sfera/signal.dart index efd7b29f..933c5411 100644 --- a/das_client/lib/model/sfera/signal.dart +++ b/das_client/lib/model/sfera/signal.dart @@ -2,7 +2,7 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/signal_id.dart'; class Signal extends SferaXmlElement { - static const String elementType = "Signal"; + static const String elementType = 'Signal'; Signal({super.type = elementType, super.attributes, super.children, super.value}); @@ -10,6 +10,6 @@ class Signal extends SferaXmlElement { @override bool validate() { - return validateHasChild("Signal_ID") && super.validate(); + return validateHasChild('Signal_ID') && super.validate(); } } diff --git a/das_client/lib/model/sfera/signal_id.dart b/das_client/lib/model/sfera/signal_id.dart index db860722..aa0622c4 100644 --- a/das_client/lib/model/sfera/signal_id.dart +++ b/das_client/lib/model/sfera/signal_id.dart @@ -1,16 +1,16 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class SignalId extends SferaXmlElement { - static const String elementType = "Signal_ID"; + static const String elementType = 'Signal_ID'; SignalId({super.type = elementType, super.attributes, super.children, super.value}); - String get physicalId => attributes["signal_ID_Physical"]!; + String get physicalId => attributes['signal_ID_Physical']!; - String get location => attributes["location"]!; + String get location => attributes['location']!; @override bool validate() { - return validateHasAttribute("signal_ID_Physical") && validateHasAttribute("location") && super.validate(); + return validateHasAttribute('signal_ID_Physical') && validateHasAttribute('location') && super.validate(); } } diff --git a/das_client/lib/model/sfera/sp_points.dart b/das_client/lib/model/sfera/sp_points.dart index 7150c1a6..e3f19d45 100644 --- a/das_client/lib/model/sfera/sp_points.dart +++ b/das_client/lib/model/sfera/sp_points.dart @@ -4,7 +4,7 @@ import 'package:das_client/model/sfera/timing_point.dart'; import 'package:das_client/model/sfera/virtual_balise.dart'; class SpPoints extends SferaXmlElement { - static const String elementType = "SP_Points"; + static const String elementType = 'SP_Points'; SpPoints({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/sp_request.dart b/das_client/lib/model/sfera/sp_request.dart index 07ed4214..b398a30e 100644 --- a/das_client/lib/model/sfera/sp_request.dart +++ b/das_client/lib/model/sfera/sp_request.dart @@ -2,15 +2,15 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/sp_zone.dart'; class SpRequest extends SferaXmlElement { - static const String elementType = "SP_Request"; + static const String elementType = 'SP_Request'; SpRequest({super.type = elementType, super.attributes, super.children, super.value}); factory SpRequest.create({required String id, required String versionMajor, required String versionMinor, required SpZone spZone}) { final request = SpRequest(); - request.attributes["SP_ID"] = id; - request.attributes["SP_VersionMajor"] = versionMajor; - request.attributes["SP_VersionMinor"] = versionMinor; + request.attributes['SP_ID'] = id; + request.attributes['SP_VersionMajor'] = versionMajor; + request.attributes['SP_VersionMinor'] = versionMinor; request.children.add(spZone); return request; } diff --git a/das_client/lib/model/sfera/sp_zone.dart b/das_client/lib/model/sfera/sp_zone.dart index f9299a2e..72ea40db 100644 --- a/das_client/lib/model/sfera/sp_zone.dart +++ b/das_client/lib/model/sfera/sp_zone.dart @@ -1,16 +1,16 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class SpZone extends SferaXmlElement { - static const String elementType = "SP_Zone"; + static const String elementType = 'SP_Zone'; SpZone({super.type = elementType, super.attributes, super.children, super.value}); - String? get imId => childrenWithType("IM_ID").firstOrNull?.value; + String? get imId => childrenWithType('IM_ID').firstOrNull?.value; - String? get nidC => childrenWithType("NID_C").firstOrNull?.value; + String? get nidC => childrenWithType('NID_C').firstOrNull?.value; @override bool validate() { - return validateHasChild("IM_ID") || validateHasChild("NID_C"); + return validateHasChild('IM_ID') || validateHasChild('NID_C'); } } diff --git a/das_client/lib/model/sfera/stopping_point_information.dart b/das_client/lib/model/sfera/stopping_point_information.dart index eab667d9..a73b21af 100644 --- a/das_client/lib/model/sfera/stopping_point_information.dart +++ b/das_client/lib/model/sfera/stopping_point_information.dart @@ -1,14 +1,14 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class StoppingPointInformation extends SferaXmlElement { - static const String elementType = "StoppingPointInformation"; + static const String elementType = 'StoppingPointInformation'; StoppingPointInformation({super.type = elementType, super.attributes, super.children, super.value}); - String get departureTime => attributes["departureTime"]!; + String get departureTime => attributes['departureTime']!; @override bool validate() { - return validateHasAttribute("departureTime") && super.validate(); + return validateHasAttribute('departureTime') && super.validate(); } } diff --git a/das_client/lib/model/sfera/timing_point.dart b/das_client/lib/model/sfera/timing_point.dart index e9db1dad..914db755 100644 --- a/das_client/lib/model/sfera/timing_point.dart +++ b/das_client/lib/model/sfera/timing_point.dart @@ -2,18 +2,18 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/tp_name.dart'; class TimingPoint extends SferaXmlElement { - static const String elementType = "TimingPoint"; + static const String elementType = 'TimingPoint'; TimingPoint({super.type = elementType, super.attributes, super.children, super.value}); - String get id => attributes["TP_ID"]!; + String get id => attributes['TP_ID']!; - String get location => attributes["location"]!; + String get location => attributes['location']!; Iterable get names => children.whereType(); @override bool validate() { - return validateHasAttribute("TP_ID") && validateHasAttribute("location") && super.validate(); + return validateHasAttribute('TP_ID') && validateHasAttribute('location') && super.validate(); } } diff --git a/das_client/lib/model/sfera/timing_point_constraints.dart b/das_client/lib/model/sfera/timing_point_constraints.dart index b32e3245..7f3ec9ba 100644 --- a/das_client/lib/model/sfera/timing_point_constraints.dart +++ b/das_client/lib/model/sfera/timing_point_constraints.dart @@ -2,7 +2,7 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/timing_point_reference.dart'; class TimingPointConstraints extends SferaXmlElement { - static const String elementType = "TimingPointConstraints"; + static const String elementType = 'TimingPointConstraints'; TimingPointConstraints({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/timing_point_reference.dart b/das_client/lib/model/sfera/timing_point_reference.dart index 82f9af9d..dde84adb 100644 --- a/das_client/lib/model/sfera/timing_point_reference.dart +++ b/das_client/lib/model/sfera/timing_point_reference.dart @@ -1,7 +1,7 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class TimingPointReference extends SferaXmlElement { - static const String elementType = "TimingPointReference"; + static const String elementType = 'TimingPointReference'; TimingPointReference({super.type = elementType, super.attributes, super.children, super.value}); } diff --git a/das_client/lib/model/sfera/tp_id_reference.dart b/das_client/lib/model/sfera/tp_id_reference.dart index c14513b1..54687b1d 100644 --- a/das_client/lib/model/sfera/tp_id_reference.dart +++ b/das_client/lib/model/sfera/tp_id_reference.dart @@ -1,14 +1,14 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class TpIdReference extends SferaXmlElement { - static const String elementType = "TP_ID_Reference"; + static const String elementType = 'TP_ID_Reference'; TpIdReference({super.type = elementType, super.attributes, super.children, super.value}); - String get tpId => attributes["TP_ID"]!; + String get tpId => attributes['TP_ID']!; @override bool validate() { - return validateHasAttribute("TP_ID") && super.validate(); + return validateHasAttribute('TP_ID') && super.validate(); } } diff --git a/das_client/lib/model/sfera/tp_name.dart b/das_client/lib/model/sfera/tp_name.dart index ef5d13d9..ae355015 100644 --- a/das_client/lib/model/sfera/tp_name.dart +++ b/das_client/lib/model/sfera/tp_name.dart @@ -1,14 +1,14 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class TpName extends SferaXmlElement { - static const String elementType = "TP_Name"; + static const String elementType = 'TP_Name'; TpName({super.type = elementType, super.attributes, super.children, super.value}); - String get name => attributes["name"]!; + String get name => attributes['name']!; @override bool validate() { - return validateHasAttribute("name") && super.validate(); + return validateHasAttribute('name') && super.validate(); } } diff --git a/das_client/lib/model/sfera/train_identification.dart b/das_client/lib/model/sfera/train_identification.dart index 255bab96..f3276486 100644 --- a/das_client/lib/model/sfera/train_identification.dart +++ b/das_client/lib/model/sfera/train_identification.dart @@ -2,7 +2,7 @@ import 'package:das_client/model/sfera/otn_id.dart'; import 'package:das_client/model/sfera/sfera_xml_element.dart'; class TrainIdentification extends SferaXmlElement { - static const String elementType = "TrainIdentification"; + static const String elementType = 'TrainIdentification'; TrainIdentification({super.type = elementType, super.attributes, super.children, super.value}); diff --git a/das_client/lib/model/sfera/virtual_balise.dart b/das_client/lib/model/sfera/virtual_balise.dart index fe36cd2e..0cc65003 100644 --- a/das_client/lib/model/sfera/virtual_balise.dart +++ b/das_client/lib/model/sfera/virtual_balise.dart @@ -2,16 +2,16 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; import 'package:das_client/model/sfera/virtual_balise_position.dart'; class VirtualBalise extends SferaXmlElement { - static const String elementType = "VirtualBalise"; + static const String elementType = 'VirtualBalise'; VirtualBalise({super.type = elementType, super.attributes, super.children, super.value}); VirtualBalisePosition get position => children.whereType().first; - String get location => attributes["location"]!; + String get location => attributes['location']!; @override bool validate() { - return validateHasAttribute("location") && validateHasChildOfType() && super.validate(); + return validateHasAttribute('location') && validateHasChildOfType() && super.validate(); } } diff --git a/das_client/lib/model/sfera/virtual_balise_position.dart b/das_client/lib/model/sfera/virtual_balise_position.dart index f3be73ab..a5e00104 100644 --- a/das_client/lib/model/sfera/virtual_balise_position.dart +++ b/das_client/lib/model/sfera/virtual_balise_position.dart @@ -1,18 +1,18 @@ import 'package:das_client/model/sfera/sfera_xml_element.dart'; class VirtualBalisePosition extends SferaXmlElement { - static const String elementType = "VirtualBalisePosition"; + static const String elementType = 'VirtualBalisePosition'; VirtualBalisePosition({super.type = elementType, super.attributes, super.children, super.value}); - String get latitude => attributes["latitude"]!; + String get latitude => attributes['latitude']!; - String get longitude => attributes["longitude"]!; + String get longitude => attributes['longitude']!; - String? get altitude => attributes["altitude"]!; + String? get altitude => attributes['altitude']!; @override bool validate() { - return validateHasAttribute("latitude") && validateHasAttribute("longitude") && super.validate(); + return validateHasAttribute('latitude') && validateHasAttribute('longitude') && super.validate(); } } diff --git a/das_client/lib/pages/fahrt/widgets/fahrbild.dart b/das_client/lib/pages/fahrt/widgets/fahrbild.dart index 578c44d1..908f90e2 100644 --- a/das_client/lib/pages/fahrt/widgets/fahrbild.dart +++ b/das_client/lib/pages/fahrt/widgets/fahrbild.dart @@ -39,11 +39,11 @@ class Fahrbild extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: Row( children: [ - Text(timingPoint.attributes["TP_PlannedLatestArrivalTime"] ?? ""), + Text(timingPoint.attributes['TP_PlannedLatestArrivalTime'] ?? ''), const SizedBox( width: sbbDefaultSpacing, ), - Text(tp?.names.first.name ?? "unkown"), + Text(tp?.names.first.name ?? 'unkown'), ], ), ); diff --git a/das_client/lib/pages/fahrt/widgets/train_selection.dart b/das_client/lib/pages/fahrt/widgets/train_selection.dart index d916f9f3..7342f5ce 100644 --- a/das_client/lib/pages/fahrt/widgets/train_selection.dart +++ b/das_client/lib/pages/fahrt/widgets/train_selection.dart @@ -19,8 +19,8 @@ class _TrainSelectionState extends State { @override void initState() { super.initState(); - _trainNumberController = TextEditingController(text: "7839"); - _companyController = TextEditingController(text: "1085"); + _trainNumberController = TextEditingController(text: '7839'); + _companyController = TextEditingController(text: '1085'); context.fahrbildCubit.updateTrainNumber(_trainNumberController.text); context.fahrbildCubit.updateCompany(_companyController.text); @@ -75,7 +75,7 @@ class _TrainSelectionState extends State { Widget _errorWidget(BuildContext context, FahrbildState state) { if (state is SelectingFahrbildState && state.errorCode != null) { - return Text("${state.errorCode}", style: SBBTextStyles.mediumBold); + return Text('${state.errorCode}', style: SBBTextStyles.mediumBold); } return Container(); } diff --git a/das_client/lib/repo/sfera_repository.dart b/das_client/lib/repo/sfera_repository.dart index af71e5f8..cdcfa16f 100644 --- a/das_client/lib/repo/sfera_repository.dart +++ b/das_client/lib/repo/sfera_repository.dart @@ -39,7 +39,7 @@ class SferaRepository { journeyProfile.toEntity(id: existingProfile?.id ?? _db.journeyProfile.autoIncrement(), startDate: today); Fimber.i( - "Writing journey profile to db company=${journeyProfileEntity.company} operationalTrainNumber=${journeyProfileEntity.operationalTrainNumber} startDate=${journeyProfileEntity.startDate}"); + 'Writing journey profile to db company=${journeyProfileEntity.company} operationalTrainNumber=${journeyProfileEntity.operationalTrainNumber} startDate=${journeyProfileEntity.startDate}'); await _db.writeAsync((isar) { isar.journeyProfile.put(journeyProfileEntity); }); @@ -53,13 +53,13 @@ class SferaRepository { if (existingProfile == null) { final segmentProfileEntity = segmentProfile.toEntity(isarId: _db.segmentProfile.autoIncrement()); Fimber.i( - "Writing segment profile to db spId=${segmentProfileEntity.spId} majorVersion=${segmentProfileEntity.majorVersion} minorVersion=${segmentProfileEntity.minorVersion}"); + 'Writing segment profile to db spId=${segmentProfileEntity.spId} majorVersion=${segmentProfileEntity.majorVersion} minorVersion=${segmentProfileEntity.minorVersion}'); _db.write((isar) { isar.segmentProfile.put(segmentProfileEntity); }); } else { Fimber.i( - "Segment profile already exists in db spId=${segmentProfile.id} majorVersion=${segmentProfile.versionMajor} minorVersion=${segmentProfile.versionMinor}"); + 'Segment profile already exists in db spId=${segmentProfile.id} majorVersion=${segmentProfile.versionMajor} minorVersion=${segmentProfile.versionMinor}'); } } diff --git a/das_client/lib/service/backend_service.dart b/das_client/lib/service/backend_service.dart index b200d12a..c4a5b542 100644 --- a/das_client/lib/service/backend_service.dart +++ b/das_client/lib/service/backend_service.dart @@ -15,7 +15,7 @@ class BackendService { _baseUrl = baseUrl; Future sendLogs(List logs) async { - Fimber.i("Trying to send logs to backend..."); + Fimber.i('Trying to send logs to backend...'); final url = Uri.parse('$_baseUrl/api/v1/logging/logs'); var authToken = await _authenticator.token(); @@ -29,10 +29,10 @@ class BackendService { var statusCode = response.statusCode; if (statusCode >= 200 && statusCode < 300) { - Fimber.i("Successfully sent logs to backend"); + Fimber.i('Successfully sent logs to backend'); return true; } else { - Fimber.w("Failed to send logs to backend. StatusCode=$statusCode"); + Fimber.w('Failed to send logs to backend. StatusCode=$statusCode'); return false; } } diff --git a/das_client/lib/service/mqtt/mqtt_client_oauth_connector.dart b/das_client/lib/service/mqtt/mqtt_client_oauth_connector.dart index b78889ed..6358c71c 100644 --- a/das_client/lib/service/mqtt/mqtt_client_oauth_connector.dart +++ b/das_client/lib/service/mqtt/mqtt_client_oauth_connector.dart @@ -14,31 +14,31 @@ class MqttClientOauthConnector implements MqttClientConnector { @override Future connect(MqttClient client, String company, String train) async { - Fimber.i("Connecting to mqtt using oauth token"); + Fimber.i('Connecting to mqtt using oauth token'); - var sferaAuthToken = await _sferaAuthService.retrieveSferaAuthToken(company, train, "active"); + var sferaAuthToken = await _sferaAuthService.retrieveSferaAuthToken(company, train, 'active'); - Fimber.i("Received sfera token=${sferaAuthToken?.substring(0, 20)}"); + Fimber.i('Received sfera token=${sferaAuthToken?.substring(0, 20)}'); var token = await _authenticator.token(); var jsonWebToken = token.accessToken.toJwt(); - var userId = jsonWebToken.payload["preferred_username"]; - Fimber.i("Using userId=$userId"); + var userId = jsonWebToken.payload['preferred_username']; + Fimber.i('Using userId=$userId'); if (sferaAuthToken != null && userId != null) { try { - var mqttClientConnectionStatus = await client.connect(userId, "OAUTH~azureAd~$sferaAuthToken"); - Fimber.i("mqttClientConnectionStatus=$mqttClientConnectionStatus"); + var mqttClientConnectionStatus = await client.connect(userId, 'OAUTH~azureAd~$sferaAuthToken'); + Fimber.i('mqttClientConnectionStatus=$mqttClientConnectionStatus'); if (mqttClientConnectionStatus?.state == MqttConnectionState.connected) { - Fimber.i("Successfully connected to MQTT broker"); + Fimber.i('Successfully connected to MQTT broker'); return true; } } catch (e) { - Fimber.e("Exception during connect", ex: e); + Fimber.e('Exception during connect', ex: e); } } - Fimber.w("Failed to connect to MQTT broker"); + Fimber.w('Failed to connect to MQTT broker'); return false; } } diff --git a/das_client/lib/service/mqtt/mqtt_client_tms_oauth_connector.dart b/das_client/lib/service/mqtt/mqtt_client_tms_oauth_connector.dart index ea76db7d..43de1505 100644 --- a/das_client/lib/service/mqtt/mqtt_client_tms_oauth_connector.dart +++ b/das_client/lib/service/mqtt/mqtt_client_tms_oauth_connector.dart @@ -10,26 +10,26 @@ class MqttClientTMSOauthConnector implements MqttClientConnector { @override Future connect(MqttClient client, String company, String train) async { - Fimber.i("Connecting to TMS mqtt using oauth token"); + Fimber.i('Connecting to TMS mqtt using oauth token'); - var sferaAuthToken = await _sferaAuthService.retrieveSferaAuthToken(company, train, "active"); - Fimber.i("Received TMS sfera token=${sferaAuthToken?.substring(0, 20)}"); + var sferaAuthToken = await _sferaAuthService.retrieveSferaAuthToken(company, train, 'active'); + Fimber.i('Received TMS sfera token=${sferaAuthToken?.substring(0, 20)}'); if (sferaAuthToken != null) { try { - var mqttClientConnectionStatus = await client.connect("JWT", "OPENID~AzureAD_IMTS~~$sferaAuthToken"); - Fimber.i("mqttClientConnectionStatus=$mqttClientConnectionStatus"); + var mqttClientConnectionStatus = await client.connect('JWT', 'OPENID~AzureAD_IMTS~~$sferaAuthToken'); + Fimber.i('mqttClientConnectionStatus=$mqttClientConnectionStatus'); if (mqttClientConnectionStatus?.state == MqttConnectionState.connected) { - Fimber.i("Successfully connected to MQTT broker"); + Fimber.i('Successfully connected to MQTT broker'); return true; } } catch (e) { - Fimber.e("Exception during connect", ex: e); + Fimber.e('Exception during connect', ex: e); } } - Fimber.w("Failed to connect to MQTT broker"); + Fimber.w('Failed to connect to MQTT broker'); return false; } } diff --git a/das_client/lib/service/mqtt/mqtt_service.dart b/das_client/lib/service/mqtt/mqtt_service.dart index 0059e9a2..61a4cf45 100644 --- a/das_client/lib/service/mqtt/mqtt_service.dart +++ b/das_client/lib/service/mqtt/mqtt_service.dart @@ -36,7 +36,7 @@ class MqttService { } void disconnect() { - Fimber.i("Disconnecting from MQTT broker"); + Fimber.i('Disconnecting from MQTT broker'); _client.disconnect(); } @@ -45,8 +45,8 @@ class MqttService { _client.disconnect(); } if (await _mqttClientConnector.connect(_client, company, train)) { - _client.subscribe("${prefix}90940/2/event/$company/$train", MqttQos.exactlyOnce); - _client.subscribe("${prefix}90940/2/G2B/$company/$train/$_deviceId", MqttQos.exactlyOnce); + _client.subscribe('${prefix}90940/2/event/$company/$train', MqttQos.exactlyOnce); + _client.subscribe('${prefix}90940/2/G2B/$company/$train/$_deviceId', MqttQos.exactlyOnce); Fimber.i("Subscribed to topic with prefix='$prefix'..."); _startUpdateListener(); return true; @@ -57,16 +57,16 @@ class MqttService { bool publishMessage(String company, String train, String message) { if (_client.connectionStatus?.state == MqttConnectionState.connected) { - final topic = "${prefix}90940/2/B2G/$company/$train/$_deviceId"; + final topic = '${prefix}90940/2/B2G/$company/$train/$_deviceId'; final builder = MqttClientPayloadBuilder(); builder.addString(message); _client.publishMessage(topic, MqttQos.exactlyOnce, builder.payload!); - Fimber.v("Published MQTT message: topic=$topic message=$message"); + Fimber.v('Published MQTT message: topic=$topic message=$message'); return true; } else { - Fimber.w("Failed to publish MQTT message because it is not connected"); + Fimber.w('Failed to publish MQTT message because it is not connected'); return false; } } @@ -77,19 +77,19 @@ class MqttService { if (messageList != null) { for (final message in messageList) { Fimber.v( - "Received mqtt message with type=${message.runtimeType.toString()} payload=${message.payload.toString()}"); + 'Received mqtt message with type=${message.runtimeType.toString()} payload=${message.payload.toString()}'); if (message.payload is MqttPublishMessage) { final recMess = message.payload as MqttPublishMessage; final decodedMessage = utf8.decode(recMess.payload.message); - Fimber.v("Decoded mqtt message: $decodedMessage"); + Fimber.v('Decoded mqtt message: $decodedMessage'); _messageSubject.add(decodedMessage); } else { - Fimber.w("Type ${message.payload.runtimeType.toString()} parsing not implemented"); + Fimber.w('Type ${message.payload.runtimeType.toString()} parsing not implemented'); } } } else { - Fimber.w("received mqtt update with messageList=null"); + Fimber.w('received mqtt update with messageList=null'); } }); } diff --git a/das_client/lib/service/sfera/handler/journey_profile_reply_handler.dart b/das_client/lib/service/sfera/handler/journey_profile_reply_handler.dart index f5e5a96f..99b9f4e6 100644 --- a/das_client/lib/service/sfera/handler/journey_profile_reply_handler.dart +++ b/das_client/lib/service/sfera/handler/journey_profile_reply_handler.dart @@ -13,7 +13,7 @@ class JourneyProfileReplyHandler implements SferaMessageHandler { return false; } - Fimber.i("Updating journey profiles..."); + Fimber.i('Updating journey profiles...'); for (var journeyProfile in message.payload!.journeyProfiles) { await _sferaRepository.saveJourneyProfile(journeyProfile); } diff --git a/das_client/lib/service/sfera/handler/segment_profile_reply_handler.dart b/das_client/lib/service/sfera/handler/segment_profile_reply_handler.dart index cb415915..ea334af2 100644 --- a/das_client/lib/service/sfera/handler/segment_profile_reply_handler.dart +++ b/das_client/lib/service/sfera/handler/segment_profile_reply_handler.dart @@ -13,7 +13,7 @@ class SegmentProfileReplyHandler implements SferaMessageHandler { return false; } - Fimber.i("Updating segment profiles..."); + Fimber.i('Updating segment profiles...'); for (var segmentProfile in message.payload!.segmentProfiles) { await _sferaRepository.saveSegmentProfile(segmentProfile); } diff --git a/das_client/lib/service/sfera/sfera_service.dart b/das_client/lib/service/sfera/sfera_service.dart index 96190968..259210e4 100644 --- a/das_client/lib/service/sfera/sfera_service.dart +++ b/das_client/lib/service/sfera/sfera_service.dart @@ -57,7 +57,7 @@ class SferaService { _mqttStreamSubscription = _mqttService.messageStream.listen((message) async { var sferaG2bReplyMessage = SferaReplyParser.parse(message); if (!sferaG2bReplyMessage.validate()) { - Fimber.w("Validation failed for MQTT response"); + Fimber.w('Validation failed for MQTT response'); } var handled = false; @@ -66,13 +66,13 @@ class SferaService { } if (!handled) { - Fimber.w("Could not handle sfera message $message"); + Fimber.w('Could not handle sfera message $message'); } }); } Future connect(OtnId otnId) async { - Fimber.i("Starting new connection for $otnId"); + Fimber.i('Starting new connection for $otnId'); this.otnId = otnId; _messageHandlers.clear(); lastErrorCode = null; @@ -92,7 +92,7 @@ class SferaService { void onTaskCompleted(SferaTask task, dynamic data) async { _messageHandlers.remove(task); - Fimber.i("Task $task completed"); + Fimber.i('Task $task completed'); if (task is HandshakeTask) { _stateSubject.add(SferaServiceState.loadingJourney); var requestJourneyTask = @@ -123,7 +123,7 @@ class SferaService { if (segmentProfileEntity != null) { segments.add(segmentProfileEntity.toDomain()); } else { - Fimber.w("Could not find segment profile for ${element.spId}"); + Fimber.w('Could not find segment profile for ${element.spId}'); } } _segmentProfilesSubject.add(segments); @@ -138,7 +138,7 @@ class SferaService { void onTaskFailed(SferaTask task, ErrorCode errorCode) { _messageHandlers.remove(task); lastErrorCode = errorCode; - Fimber.e("Task $task failed with error code $errorCode"); + Fimber.e('Task $task failed with error code $errorCode'); if (task is HandshakeTask) { disconnect(); } @@ -151,12 +151,12 @@ class SferaService { static Future messageHeader({TrainIdentification? trainIdentification}) async { return MessageHeader.create(const Uuid().v4(), Format.sferaTimestamp(DateTime.now()), - await DeviceIdInfo.getDeviceId(), "TMS", "1085", "0085", + await DeviceIdInfo.getDeviceId(), 'TMS', '1085', '0085', trainIdentification: trainIdentification); } static String sferaTrain(String trainNumber, DateTime date) { - return "${trainNumber}_${Format.sferaDate(date)}"; + return '${trainNumber}_${Format.sferaDate(date)}'; } void dispose() { diff --git a/das_client/lib/service/sfera/task/handshake_task.dart b/das_client/lib/service/sfera/task/handshake_task.dart index 98a0d662..14b8ea25 100644 --- a/das_client/lib/service/sfera/task/handshake_task.dart +++ b/das_client/lib/service/sfera/task/handshake_task.dart @@ -35,7 +35,7 @@ class HandshakeTask extends SferaTask { Future _sendHandshakeRequest() async { var sferaTrain = SferaService.sferaTrain(otnId.operationalTrainNumber, otnId.startDate); - Fimber.i("Sending handshake request for company=${otnId.company} train=$sferaTrain"); + Fimber.i('Sending handshake request for company=${otnId.company} train=$sferaTrain'); var handshakeRequest = HandshakeRequest.create([ DasOperatingModesSupported.create( DasDrivingMode.readOnly, DasArchitecture.boardAdviceCalculation, DasConnectivity.connected), @@ -55,17 +55,17 @@ class HandshakeTask extends SferaTask { Future handleMessage(SferaG2bReplyMessage message) async { if (message.handshakeAcknowledgement != null) { stopTimeout(); - Fimber.i("Received handshake acknowledgment"); + Fimber.i('Received handshake acknowledgment'); _taskCompletedCallback(this, null); return true; } else if (message.handshakeReject != null) { stopTimeout(); - Fimber.w("Received handshake reject with reason=${message.handshakeReject?.handshakeRejectReason?.toString()}"); + Fimber.w('Received handshake reject with reason=${message.handshakeReject?.handshakeRejectReason?.toString()}'); _taskFailedCallback(this, ErrorCode.sferaHandshakeRejected); _mqttService.disconnect(); return true; } else { - Fimber.w("Ignoring response because is does not contain handshake"); + Fimber.w('Ignoring response because is does not contain handshake'); return false; } } diff --git a/das_client/lib/service/sfera/task/request_journey_profile_task.dart b/das_client/lib/service/sfera/task/request_journey_profile_task.dart index 64a9fefc..0ce369c2 100644 --- a/das_client/lib/service/sfera/task/request_journey_profile_task.dart +++ b/das_client/lib/service/sfera/task/request_journey_profile_task.dart @@ -43,7 +43,7 @@ class RequestJourneyProfileTask extends SferaTask { var sferaB2gRequestMessage = SferaB2gRequestMessage.create( await SferaService.messageHeader(trainIdentification: trainIdentification), b2gRequest: B2gRequest.createJPRequest(jpRequest)); - Fimber.i("Sending journey profile request..."); + Fimber.i('Sending journey profile request...'); _mqttService.publishMessage(otnId.company, SferaService.sferaTrain(otnId.operationalTrainNumber, otnId.startDate), sferaB2gRequestMessage.buildDocument().toString()); } @@ -53,7 +53,7 @@ class RequestJourneyProfileTask extends SferaTask { if (replyMessage.payload != null && replyMessage.payload!.journeyProfiles.isNotEmpty) { stopTimeout(); Fimber.i( - "Received G2bReplyPayload response with ${replyMessage.payload!.journeyProfiles.length} JourneyProfiles and ${replyMessage.payload!.segmentProfiles.length} SegmentProfiles...", + 'Received G2bReplyPayload response with ${replyMessage.payload!.journeyProfiles.length} JourneyProfiles and ${replyMessage.payload!.segmentProfiles.length} SegmentProfiles...', ); for (var element in replyMessage.payload!.segmentProfiles) { diff --git a/das_client/lib/service/sfera/task/request_segment_profiles_task.dart b/das_client/lib/service/sfera/task/request_segment_profiles_task.dart index 0296f907..d046f36e 100644 --- a/das_client/lib/service/sfera/task/request_segment_profiles_task.dart +++ b/das_client/lib/service/sfera/task/request_segment_profiles_task.dart @@ -42,7 +42,7 @@ class RequestSegmentProfilesTask extends SferaTask> { var missingSp = await findMissingSegmentProfiles(); if (missingSp.isEmpty) { - Fimber.i("No missing SegmentProfiles found..."); + Fimber.i('No missing SegmentProfiles found...'); _taskCompletedCallback(this, []); return; } @@ -56,7 +56,7 @@ class RequestSegmentProfilesTask extends SferaTask> { var sferaB2gRequestMessage = SferaB2gRequestMessage.create( await SferaService.messageHeader(trainIdentification: trainIdentification), b2gRequest: B2gRequest.createSPRequest(spRequests)); - Fimber.i("Sending segment profiles request..."); + Fimber.i('Sending segment profiles request...'); startTimeout(_taskFailedCallback); _mqttService.publishMessage(otnId.company, SferaService.sferaTrain(otnId.operationalTrainNumber, otnId.startDate), @@ -82,7 +82,7 @@ class RequestSegmentProfilesTask extends SferaTask> { if (replyMessage.payload != null && replyMessage.payload!.segmentProfiles.isNotEmpty) { stopTimeout(); Fimber.i( - "Received G2bReplyPayload response with ${replyMessage.payload!.segmentProfiles.length} SegmentProfiles...", + 'Received G2bReplyPayload response with ${replyMessage.payload!.segmentProfiles.length} SegmentProfiles...', ); for (var element in replyMessage.payload!.segmentProfiles) { diff --git a/das_client/lib/service/sfera/task/sfera_task.dart b/das_client/lib/service/sfera/task/sfera_task.dart index 7fec8c17..7716c70c 100644 --- a/das_client/lib/service/sfera/task/sfera_task.dart +++ b/das_client/lib/service/sfera/task/sfera_task.dart @@ -20,7 +20,7 @@ abstract class SferaTask implements SferaMessageHandler { ) { timeoutTimer?.cancel(); timeoutTimer = Timer(_timeout, () { - Fimber.e("Timeout reached for task $this"); + Fimber.e('Timeout reached for task $this'); onFailed(this, ErrorCode.sferaRequestTimeout); }); } diff --git a/das_client/lib/service/sfera_auth_service.dart b/das_client/lib/service/sfera_auth_service.dart index 0434ed62..fffdb152 100644 --- a/das_client/lib/service/sfera_auth_service.dart +++ b/das_client/lib/service/sfera_auth_service.dart @@ -14,7 +14,7 @@ class SferaAuthService { Future retrieveSferaAuthToken(String ru, String train, String role) async { - Fimber.i("Trying to fetch sfera auth token for ru=$ru train=$train role=$role..."); + Fimber.i('Trying to fetch sfera auth token for ru=$ru train=$train role=$role...'); final url = Uri.parse('$_tokenExchangeUrl?ru=$ru&train=$train&role=$role'); var authToken = await _authenticator.token(); @@ -24,10 +24,10 @@ class SferaAuthService { }); var statusCode = response.statusCode; if (statusCode >= 200 && statusCode < 300) { - Fimber.i("Successfully retrieved sfera auth token"); + Fimber.i('Successfully retrieved sfera auth token'); return response.body; } else { - Fimber.w("Failed to retrieved sfera auth token. StatusCode=$statusCode"); + Fimber.w('Failed to retrieved sfera auth token. StatusCode=$statusCode'); return null; } } diff --git a/das_client/lib/util/format.dart b/das_client/lib/util/format.dart index f532a2aa..221f37ee 100644 --- a/das_client/lib/util/format.dart +++ b/das_client/lib/util/format.dart @@ -5,7 +5,7 @@ class Format { static String sferaDate(DateTime date) { final localDate = date.toLocal(); - final dateFormat = DateFormat("yyyy-MM-dd"); + final dateFormat = DateFormat('yyyy-MM-dd'); return dateFormat.format(localDate); } diff --git a/das_client/pubspec.lock b/das_client/pubspec.lock index b315cf47..55493976 100644 --- a/das_client/pubspec.lock +++ b/das_client/pubspec.lock @@ -247,7 +247,7 @@ packages: source: hosted version: "1.0.0" custom_lint: - dependency: transitive + dependency: "direct dev" description: name: custom_lint sha256: "3486c470bb93313a9417f926c7dd694a2e349220992d7b9d14534dc49c15bba9" diff --git a/das_client/test/logging/logging_service_test.dart b/das_client/test/logging/logging_service_test.dart index a5631635..417ae413 100644 --- a/das_client/test/logging/logging_service_test.dart +++ b/das_client/test/logging/logging_service_test.dart @@ -28,7 +28,7 @@ void main() { setUp(() async { PathProviderPlatform.instance = MockPathProviderPlatform(); - logDirectory = Directory("${(await getApplicationSupportDirectory()).path}/logs"); + logDirectory = Directory('${(await getApplicationSupportDirectory()).path}/logs'); logDirectory.createSync(recursive: true); logDirectory.listSync().forEach((element) { element.deleteSync(); @@ -43,7 +43,7 @@ void main() { var files = logDirectory.listSync(); expect(files, hasLength(0)); - var logEntry = LogEntry("Test message", LogLevel.info, {}); + var logEntry = LogEntry('Test message', LogLevel.info, {}); loggingService.save(logEntry); await Future.delayed(const Duration(milliseconds: 30)); @@ -57,13 +57,13 @@ void main() { var files = logDirectory.listSync(); expect(files, hasLength(0)); - var logEntry = LogEntry("Test message", LogLevel.fatal, {}); + var logEntry = LogEntry('Test message', LogLevel.fatal, {}); loggingService.save(logEntry); await Future.delayed(const Duration(milliseconds: 30)); files = logDirectory.listSync(); expect(files, hasLength(1)); - expect((files[0] as File).readAsStringSync(), "${jsonEncode(logEntry)},"); + expect((files[0] as File).readAsStringSync(), '${jsonEncode(logEntry)},'); }); test('Test writes multiple logs to same file', () async { @@ -72,10 +72,10 @@ void main() { var files = logDirectory.listSync(); expect(files, hasLength(0)); - loggingService.save(LogEntry("Test message", LogLevel.info, {})); - loggingService.save(LogEntry("Test message 2", LogLevel.error, {})); - loggingService.save(LogEntry("Test message 3", LogLevel.warning, {})); - loggingService.save(LogEntry("Test message 4", LogLevel.debug, {})); + loggingService.save(LogEntry('Test message', LogLevel.info, {})); + loggingService.save(LogEntry('Test message 2', LogLevel.error, {})); + loggingService.save(LogEntry('Test message 3', LogLevel.warning, {})); + loggingService.save(LogEntry('Test message 4', LogLevel.debug, {})); await Future.delayed(const Duration(milliseconds: 30)); files = logDirectory.listSync(); @@ -83,7 +83,7 @@ void main() { }); test('Test log entry json encode & decode', () async { - final logEntry = LogEntry("Test message", LogLevel.info, {'version': "0.1", 'systemName': "unitTests"}); + final logEntry = LogEntry('Test message', LogLevel.info, {'version': '0.1', 'systemName': 'unitTests'}); final logEntryDecoded = LogEntry.fromJson(jsonDecode(jsonEncode(logEntry))); expect(logEntryDecoded.message, logEntry.message); @@ -99,7 +99,7 @@ void main() { var files = logDirectory.listSync(); expect(files, hasLength(0)); - final logEntry = LogEntry("Test message", LogLevel.info, {'version': "0.1", 'systemName': "unitTests"}); + final logEntry = LogEntry('Test message', LogLevel.info, {'version': '0.1', 'systemName': 'unitTests'}); loggingService.save(logEntry); await Future.delayed(const Duration(milliseconds: 20)); @@ -125,7 +125,7 @@ void main() { var files = logDirectory.listSync(); expect(files, hasLength(0)); - final logEntry = LogEntry("Test message", LogLevel.info, {'version': "0.1", 'systemName': "unitTests"}); + final logEntry = LogEntry('Test message', LogLevel.info, {'version': '0.1', 'systemName': 'unitTests'}); loggingService.save(logEntry); await Future.delayed(const Duration(milliseconds: 20)); @@ -151,7 +151,7 @@ void main() { var files = logDirectory.listSync(); expect(files, hasLength(0)); - final logEntry = LogEntry("Test message", LogLevel.info, {'version': "0.1", 'systemName': "unitTests"}); + final logEntry = LogEntry('Test message', LogLevel.info, {'version': '0.1', 'systemName': 'unitTests'}); loggingService.save(logEntry); await Future.delayed(const Duration(milliseconds: 20)); diff --git a/das_client/test/model/sfera/sfera_document_test.dart b/das_client/test/model/sfera/sfera_document_test.dart index 3cacaa79..c67851cc 100644 --- a/das_client/test/model/sfera/sfera_document_test.dart +++ b/das_client/test/model/sfera/sfera_document_test.dart @@ -23,7 +23,7 @@ void main() { var parsedMessage = SferaReplyParser.parse(file.readAsStringSync()); - expect(() => parsedMessage.children.add(SferaXmlElement(type: "dummy")), throwsA(isA())); + expect(() => parsedMessage.children.add(SferaXmlElement(type: 'dummy')), throwsA(isA())); }); test('Test attributes are unmodifiable', () async { @@ -31,7 +31,7 @@ void main() { var parsedMessage = SferaReplyParser.parse(file.readAsStringSync()); - expect(() => parsedMessage.attributes["dummy"] = "dummy", throwsA(isA())); + expect(() => parsedMessage.attributes['dummy'] = 'dummy', throwsA(isA())); }); test('Test SferaReplyParser with SFERA_G2B_Reply_JP_request_9232.xml', () async { @@ -42,8 +42,8 @@ void main() { expect(sferaG2bReplyMessage.type, SferaG2bReplyMessage.elementType); expect(sferaG2bReplyMessage.validate(), true); - expect(sferaG2bReplyMessage.messageHeader.sender, "0088"); - expect(sferaG2bReplyMessage.messageHeader.recipient, "1088"); + expect(sferaG2bReplyMessage.messageHeader.sender, '0088'); + expect(sferaG2bReplyMessage.messageHeader.recipient, '1088'); expect(sferaG2bReplyMessage.payload, isNotNull); var payload = sferaG2bReplyMessage.payload!; @@ -54,22 +54,22 @@ void main() { expect(payload.segmentProfiles, hasLength(23)); expect(payload.segmentProfiles.first.points, isNotNull); expect(payload.segmentProfiles.first.zone, isNotNull); - expect(payload.segmentProfiles.first.zone!.imId, "0088"); + expect(payload.segmentProfiles.first.zone!.imId, '0088'); expect(payload.segmentProfiles.first.points!.timingPoints, hasLength(3)); - expect(payload.segmentProfiles.first.points!.timingPoints.first.id, "1837"); - expect(payload.segmentProfiles.first.points!.timingPoints.first.location, "0"); + expect(payload.segmentProfiles.first.points!.timingPoints.first.id, '1837'); + expect(payload.segmentProfiles.first.points!.timingPoints.first.location, '0'); expect( - payload.segmentProfiles.first.points!.timingPoints.first.names.first.name, "MEER-GRENS"); + payload.segmentProfiles.first.points!.timingPoints.first.names.first.name, 'MEER-GRENS'); expect(payload.segmentProfiles.first.points!.signals, hasLength(9)); - expect(payload.segmentProfiles.first.points!.signals.first.id.physicalId, "102346"); - expect(payload.segmentProfiles.first.points!.signals.first.id.location, "843"); + expect(payload.segmentProfiles.first.points!.signals.first.id.physicalId, '102346'); + expect(payload.segmentProfiles.first.points!.signals.first.id.location, '843'); expect(payload.segmentProfiles.first.points!.balise, hasLength(3)); - expect(payload.segmentProfiles.first.points!.balise.first.location, "0"); - expect(payload.segmentProfiles.first.points!.balise.first.position.latitude, "51.48591"); - expect(payload.segmentProfiles.first.points!.balise.first.position.longitude, "4.73459"); + expect(payload.segmentProfiles.first.points!.balise.first.location, '0'); + expect(payload.segmentProfiles.first.points!.balise.first.position.latitude, '51.48591'); + expect(payload.segmentProfiles.first.points!.balise.first.position.longitude, '4.73459'); }); test('Test Sfera HandshakeRequest generation', () async { @@ -80,13 +80,13 @@ void main() { DasDrivingMode.goa1, DasArchitecture.boardAdviceCalculation, DasConnectivity.standalone) ], relatedTrainRequestType: RelatedTrainRequestType.ownTrainAndOrRelatedTrains, statusReportsEnabled: true); - var messageHeader = MessageHeader.create("a24e63c3-ab2e-4102-9a10-ba058dec5efe", "2019-09-26T20:07:36Z", "DAS", "TMS", "1084", "0084"); + var messageHeader = MessageHeader.create('a24e63c3-ab2e-4102-9a10-ba058dec5efe', '2019-09-26T20:07:36Z', 'DAS', 'TMS', '1084', '0084'); var sferaB2gRequestMessage = SferaB2gRequestMessage.create(messageHeader, handshakeRequest: handshakeRequest); expect(sferaB2gRequestMessage.validate(), true); var xmlDocument = sferaB2gRequestMessage.buildDocument(); - var sferaB2gRequestMessageString = xmlDocument.toXmlString(pretty: true, newLine: "\r\n", indent: "\t"); + var sferaB2gRequestMessageString = xmlDocument.toXmlString(pretty: true, newLine: '\r\n', indent: '\t'); final file = File('test_resources/SFERA_B2G_RequestMessage_handshake.xml'); final xmlFileString = file.readAsStringSync(); @@ -101,8 +101,8 @@ void main() { expect(sferaG2bReplyMessage.type, SferaG2bReplyMessage.elementType); expect(sferaG2bReplyMessage.validate(), true); - expect(sferaG2bReplyMessage.messageHeader.sender, "0084"); - expect(sferaG2bReplyMessage.messageHeader.recipient, "1084"); + expect(sferaG2bReplyMessage.messageHeader.sender, '0084'); + expect(sferaG2bReplyMessage.messageHeader.recipient, '1084'); expect(sferaG2bReplyMessage.handshakeAcknowledgement, isNotNull); var handshakeAcknowledgement = sferaG2bReplyMessage.handshakeAcknowledgement!; @@ -119,8 +119,8 @@ void main() { expect(sferaG2bReplyMessage.type, SferaG2bReplyMessage.elementType); expect(sferaG2bReplyMessage.validate(), true); - expect(sferaG2bReplyMessage.messageHeader.sender, "0084"); - expect(sferaG2bReplyMessage.messageHeader.recipient, "1084"); + expect(sferaG2bReplyMessage.messageHeader.sender, '0084'); + expect(sferaG2bReplyMessage.messageHeader.recipient, '1084'); expect(sferaG2bReplyMessage.handshakeAcknowledgement, isNull); expect(sferaG2bReplyMessage.handshakeReject, isNotNull); diff --git a/das_client/test/service/sfera/sfera_handshake_task_test.dart b/das_client/test/service/sfera/sfera_handshake_task_test.dart index ecf0443d..98006850 100644 --- a/das_client/test/service/sfera/sfera_handshake_task_test.dart +++ b/das_client/test/service/sfera/sfera_handshake_task_test.dart @@ -23,7 +23,7 @@ void main() { setUp(() { mqttService = MockMqttService(); - otnId = OtnId.create("1085", "719", DateTime.now()); + otnId = OtnId.create('1085', '719', DateTime.now()); }); test('Test handshake successful', () async { diff --git a/das_client/test/service/sfera/sfera_request_journey_profile_task_test.dart b/das_client/test/service/sfera/sfera_request_journey_profile_task_test.dart index 98d5e926..b17909b2 100644 --- a/das_client/test/service/sfera/sfera_request_journey_profile_task_test.dart +++ b/das_client/test/service/sfera/sfera_request_journey_profile_task_test.dart @@ -27,7 +27,7 @@ void main() { setUp(() { mqttService = MockMqttService(); sferaRepository = MockSferaRepository(); - otnId = OtnId.create("1085", "719", DateTime.now()); + otnId = OtnId.create('1085', '719', DateTime.now()); }); test('Test JP request successful', () async {