From 708248ec44e1d8693e09146c018676cd2265f9fb Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 9 Oct 2024 19:31:28 +0200 Subject: [PATCH] Make `deviceDisplayName` optional in `DeviceRegistration` --- .../common/application/devices/AltBeacon.kt | 1 - .../BLESerialNumberDeviceRegistration.kt | 1 - .../devices/DefaultDeviceRegistration.kt | 1 - .../application/devices/DeviceRegistration.kt | 1 - .../devices/MACAddressDeviceRegistration.kt | 1 - .../common/application/devices/Website.kt | 1 - .../serialization/UnknownDeviceSerializers.kt | 2 +- .../application/DeploymentService.kt | 2 +- .../DeploymentServiceApiMigrator.kt | 44 +- ...StudyDeployment_fails_for_existing_id.json | 194 +++++++ ...yment_registers_preregistered_devices.json | 270 ++++++++++ ...mentFor_during_device_reregistrations.json | 356 +++++++++++++ ...ntaining_an_unknown_studyDeploymentId.json | 167 ++++++ ...getStudyDeploymentStatusList_succeeds.json | 417 +++++++++++++++ ...s_fails_for_unknown_studyDeploymentId.json | 13 + .../getStudyDeploymentStatus_succeeds.json | 212 ++++++++ .../modifications_after_stop_not_allowed.json | 499 ++++++++++++++++++ ...erDevice_can_be_called_multiple_times.json | 353 +++++++++++++ ...d_with_same_registration_when_stopped.json | 372 +++++++++++++ ...eStudyDeployments_ignores_unknown_ids.json | 182 +++++++ .../removeStudyDeployments_succeeds.json | 356 +++++++++++++ ...p_fails_for_unknown_studyDeploymentId.json | 13 + .../DeploymentServiceTest/stop_succeeds.json | 220 ++++++++ .../unregisterDevice_succeeds.json | 364 +++++++++++++ .../common/devices/DeviceRegistration.json | 2 +- .../DeploymentServiceRequest.json | 2 +- 26 files changed, 4031 insertions(+), 15 deletions(-) create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_fails_for_existing_id.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_registers_preregistered_devices.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getDeviceDeploymentFor_during_device_reregistrations.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_fails_when_containing_an_unknown_studyDeploymentId.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_succeeds.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_fails_for_unknown_studyDeploymentId.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_succeeds.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/modifications_after_stop_not_allowed.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_can_be_called_multiple_times.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_cannot_be_called_with_same_registration_when_stopped.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_ignores_unknown_ids.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_succeeds.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_fails_for_unknown_studyDeploymentId.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_succeeds.json create mode 100644 carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/unregisterDevice_succeeds.json diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt index 63435e17c..0dc83710f 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt @@ -78,7 +78,6 @@ data class AltBeaconDeviceRegistration( * This value is constrained from -127 to 0. */ val referenceRssi: Short, - @Required override val deviceDisplayName: String? = null, // TODO: We could map known manufacturerId's to display names. override val additionalSpecifications: ApplicationData? = null ) : DeviceRegistration() diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt index 8aa2a4065..610b51b71 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt @@ -15,7 +15,6 @@ import kotlin.js.JsExport @JsExport data class BLESerialNumberDeviceRegistration( val serialNumber: String, - @Required override val deviceDisplayName: String? = null, override val additionalSpecifications: ApplicationData? = null ) : DeviceRegistration() diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt index f57efe5b1..210a4f44e 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt @@ -15,7 +15,6 @@ import kotlin.js.JsExport @Serializable @JsExport data class DefaultDeviceRegistration( - @Required override val deviceDisplayName: String? = null, override val additionalSpecifications: ApplicationData? = null, @Required diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt index ca80fea51..345034123 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt @@ -38,7 +38,6 @@ abstract class DeviceRegistration * An optional concise textual representation for display purposes describing the key specifications of the device. * E.g., device manufacturer, name, and operating system version. */ - @Required abstract val deviceDisplayName: String? @Required diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt index 824e41b67..19ea94ed9 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt @@ -14,7 +14,6 @@ import kotlin.js.JsExport @JsExport data class MACAddressDeviceRegistration( val macAddress: MACAddress, - @Required override val deviceDisplayName: String? = null, override val additionalSpecifications: ApplicationData? = null ) : DeviceRegistration() diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Website.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Website.kt index e0f178bf7..4d44cfb91 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Website.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Website.kt @@ -51,7 +51,6 @@ data class WebsiteDeviceRegistration( * The HTTP User-Agent header of the user agent which made the HTTP request to [url]. */ val userAgent: String, - @Required override val deviceDisplayName: String? = userAgent, override val additionalSpecifications: ApplicationData? = null ) : DeviceRegistration() diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt index 3a9eb67c3..cd6579364 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt @@ -179,7 +179,7 @@ data class CustomDeviceRegistration internal constructor( @Serializable private data class BaseMembers( override val deviceId: String, - override val deviceDisplayName: String?, + override val deviceDisplayName: String? = null, override val additionalSpecifications: ApplicationData? = null ) : DeviceRegistration() diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeploymentService.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeploymentService.kt index 0dc7887e0..395a63b6a 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeploymentService.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeploymentService.kt @@ -18,7 +18,7 @@ import kotlinx.serialization.* */ interface DeploymentService : ApplicationService { - companion object { val API_VERSION = ApiVersion( 1, 1 ) } + companion object { val API_VERSION = ApiVersion( 1, 3 ) } @Serializable sealed class Event( override val aggregateId: String? ) : IntegrationEvent diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt index 81ec8b679..0fc37757f 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt @@ -1,13 +1,11 @@ package dk.cachet.carp.deployments.infrastructure.versioning import dk.cachet.carp.common.application.services.ApiVersion -import dk.cachet.carp.common.infrastructure.versioning.ApiResponse -import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigrator -import dk.cachet.carp.common.infrastructure.versioning.Major1Minor0To1Migration +import dk.cachet.carp.common.infrastructure.versioning.* import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.infrastructure.DeploymentServiceInvoker import dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest -import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.* private val major1Minor0To1Migration = @@ -29,10 +27,46 @@ private val major1Minor0To1Migration = } +private val major1Minor1To3Migration = + object : ApiMigration( 1, 3 ) + { + override fun migrateRequest( request: JsonObject ) = request + + override fun migrateResponse( request: JsonObject, response: ApiResponse, targetVersion: ApiVersion ) = + when ( request.getType( ) ) + { + "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetDeviceDeploymentFor" -> + { + val responseObject = (response.response as? JsonObject)?.migrate { + requiredDeviceDisplayName( "registration" ) + + updateOptionalObject( "connectedDeviceRegistrations" ) + { + for ( connectedDevice in json.keys ) requiredDeviceDisplayName( connectedDevice ) + } + } + ApiResponse( responseObject, response.ex ) + } + else -> response + } + + /** + * The `deviceDisplayName` field in `DeviceRegistration`, with default value `null`, was changed from required + * into optional. So, if it isn't set, it needs to bet set to `null` explicitly. + */ + private fun ApiJsonObjectMigrationBuilder.requiredDeviceDisplayName( fieldName: String ) = + updateObject( fieldName ) { + json.getOrPut( "deviceDisplayName" ) { JsonNull } + } + + override fun migrateEvent( event: JsonObject ) = event + } + + val DeploymentServiceApiMigrator = ApplicationServiceApiMigrator( DeploymentService.API_VERSION, DeploymentServiceInvoker, DeploymentServiceRequest.Serializer, DeploymentService.Event.serializer(), - listOf( major1Minor0To1Migration ) + listOf( major1Minor0To1Migration, major1Minor1To3Migration ) ) diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_fails_for_existing_id.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_fails_for_existing_id.json new file mode 100644 index 000000000..79900e220 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_fails_for_existing_id.json @@ -0,0 +1,194 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "6a4ff16c-cafc-4392-836a-503fe0b81127", + "protocol": { + "id": "e55bf62d-56e1-4596-ad12-4868475d5398", + "createdOn": "2024-10-09T08:17:33.762380Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "bc2b736f-fbc0-434d-8e07-736f56396335", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "6a4ff16c-cafc-4392-836a-503fe0b81127", + "apiVersion": "1.3", + "studyDeploymentId": "6a4ff16c-cafc-4392-836a-503fe0b81127", + "protocol": { + "id": "e55bf62d-56e1-4596-ad12-4868475d5398", + "createdOn": "2024-10-09T08:17:33.762380Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "bc2b736f-fbc0-434d-8e07-736f56396335", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "6a4ff16c-cafc-4392-836a-503fe0b81127", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "bc2b736f-fbc0-434d-8e07-736f56396335", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "6a4ff16c-cafc-4392-836a-503fe0b81127", + "protocol": { + "id": "d3d68082-69c7-4eda-8e60-3c134727bb84", + "createdOn": "2024-10-09T08:17:33.763129Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "3528a538-279d-4871-8d03-de6b3d5722f8", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "User" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_registers_preregistered_devices.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_registers_preregistered_devices.json new file mode 100644 index 000000000..784470893 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/createStudyDeployment_registers_preregistered_devices.json @@ -0,0 +1,270 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "bd9f4116-7c3c-4653-9285-38710660a8af", + "protocol": { + "id": "cc251597-c835-4120-b238-eca1df37eb9e", + "createdOn": "2024-10-09T08:17:33.754071Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "5511bab5-4f93-458a-b51e-d468d9624468", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": { + "Connected": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.754108Z", + "deviceId": "03baa630-74f7-4f7b-ab89-aea7b1fa5e2a" + } + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "apiVersion": "1.3", + "studyDeploymentId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "protocol": { + "id": "cc251597-c835-4120-b238-eca1df37eb9e", + "createdOn": "2024-10-09T08:17:33.754071Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "5511bab5-4f93-458a-b51e-d468d9624468", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": { + "Connected": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.754108Z", + "deviceId": "03baa630-74f7-4f7b-ab89-aea7b1fa5e2a" + } + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + } + ], + "participantStatusList": [ + { + "participantId": "5511bab5-4f93-458a-b51e-d468d9624468", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "deviceRoleName": "Primary", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.754227Z", + "deviceId": "a7b167cb-77d6-4db3-8fc3-cc3d612c82de" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "apiVersion": "1.3", + "studyDeploymentId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.754227Z", + "deviceId": "a7b167cb-77d6-4db3-8fc3-cc3d612c82de" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + } + ], + "participantStatusList": [ + { + "participantId": "5511bab5-4f93-458a-b51e-d468d9624468", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetDeviceDeploymentFor", + "apiVersion": "1.3", + "studyDeploymentId": "bd9f4116-7c3c-4653-9285-38710660a8af", + "primaryDeviceRoleName": "Primary" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "deviceConfiguration": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.754227Z", + "deviceId": "a7b167cb-77d6-4db3-8fc3-cc3d612c82de" + }, + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connectedDeviceRegistrations": { + "Connected": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.754108Z", + "deviceId": "03baa630-74f7-4f7b-ab89-aea7b1fa5e2a" + } + } + } + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getDeviceDeploymentFor_during_device_reregistrations.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getDeviceDeploymentFor_during_device_reregistrations.json new file mode 100644 index 000000000..63a7474c6 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getDeviceDeploymentFor_during_device_reregistrations.json @@ -0,0 +1,356 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "protocol": { + "id": "5205551a-37a8-4a87-adfc-b246304a6c1a", + "createdOn": "2024-10-09T08:17:33.782260Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "8ba6c597-f2d2-4fc6-98e7-bce34e18ce8a", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "protocol": { + "id": "5205551a-37a8-4a87-adfc-b246304a6c1a", + "createdOn": "2024-10-09T08:17:33.782260Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "8ba6c597-f2d2-4fc6-98e7-bce34e18ce8a", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device" + ] + } + ], + "participantStatusList": [ + { + "participantId": "8ba6c597-f2d2-4fc6-98e7-bce34e18ce8a", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceRoleName": "Test device", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.783526Z", + "deviceId": "c5cf6146-d748-46ce-9354-660d37a2c6eb" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.783526Z", + "deviceId": "c5cf6146-d748-46ce-9354-660d37a2c6eb" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + } + ], + "participantStatusList": [ + { + "participantId": "8ba6c597-f2d2-4fc6-98e7-bce34e18ce8a", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetDeviceDeploymentFor", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "primaryDeviceRoleName": "Test device" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "deviceConfiguration": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.783526Z", + "deviceId": "c5cf6146-d748-46ce-9354-660d37a2c6eb" + } + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.UnregisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceRoleName": "Test device" + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": null + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device" + ] + } + ], + "participantStatusList": [ + { + "participantId": "8ba6c597-f2d2-4fc6-98e7-bce34e18ce8a", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetDeviceDeploymentFor", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "primaryDeviceRoleName": "Test device" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceRoleName": "Test device", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.784020Z", + "deviceId": "7aa81293-dec8-4816-a1a8-2c687c01042c" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.784020Z", + "deviceId": "7aa81293-dec8-4816-a1a8-2c687c01042c" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + } + ], + "participantStatusList": [ + { + "participantId": "8ba6c597-f2d2-4fc6-98e7-bce34e18ce8a", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetDeviceDeploymentFor", + "apiVersion": "1.3", + "studyDeploymentId": "c58edc1e-c451-483b-9552-7b455ed2e0a6", + "primaryDeviceRoleName": "Test device" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "deviceConfiguration": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.784020Z", + "deviceId": "7aa81293-dec8-4816-a1a8-2c687c01042c" + } + } + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_fails_when_containing_an_unknown_studyDeploymentId.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_fails_when_containing_an_unknown_studyDeploymentId.json new file mode 100644 index 000000000..8f8278640 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_fails_when_containing_an_unknown_studyDeploymentId.json @@ -0,0 +1,167 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "675665b0-e21a-46e8-b930-64c4d2a5e9f2", + "protocol": { + "id": "fd96c542-f5c5-4338-800f-e1429720c4a0", + "createdOn": "2024-10-09T08:17:33.798560Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "02bcbf83-172c-4dd5-9f31-da1ec97ee9f9", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "675665b0-e21a-46e8-b930-64c4d2a5e9f2", + "apiVersion": "1.3", + "studyDeploymentId": "675665b0-e21a-46e8-b930-64c4d2a5e9f2", + "protocol": { + "id": "fd96c542-f5c5-4338-800f-e1429720c4a0", + "createdOn": "2024-10-09T08:17:33.798560Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "02bcbf83-172c-4dd5-9f31-da1ec97ee9f9", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "675665b0-e21a-46e8-b930-64c4d2a5e9f2", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "02bcbf83-172c-4dd5-9f31-da1ec97ee9f9", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatusList", + "apiVersion": "1.3", + "studyDeploymentIds": [ + "675665b0-e21a-46e8-b930-64c4d2a5e9f2", + "a27da272-b9a2-458d-a672-99778f05b7ed" + ] + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_succeeds.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_succeeds.json new file mode 100644 index 000000000..d951d992e --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatusList_succeeds.json @@ -0,0 +1,417 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "d028bb26-d458-428e-aac4-67916bab0fe4", + "protocol": { + "id": "f5405ce7-b03b-4757-9b97-a5d047ce22b8", + "createdOn": "2024-10-09T08:17:33.788885Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "8d82aa39-0c4e-4d19-846b-344b34b7f637", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "User 1" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "d028bb26-d458-428e-aac4-67916bab0fe4", + "apiVersion": "1.3", + "studyDeploymentId": "d028bb26-d458-428e-aac4-67916bab0fe4", + "protocol": { + "id": "f5405ce7-b03b-4757-9b97-a5d047ce22b8", + "createdOn": "2024-10-09T08:17:33.788885Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "8d82aa39-0c4e-4d19-846b-344b34b7f637", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "User 1" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "d028bb26-d458-428e-aac4-67916bab0fe4", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "8d82aa39-0c4e-4d19-846b-344b34b7f637", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "ee596f8b-46a6-4981-bfa7-3ce4dedfdcd0", + "protocol": { + "id": "f5405ce7-b03b-4757-9b97-a5d047ce22b8", + "createdOn": "2024-10-09T08:17:33.788885Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "a2ccb225-c763-422d-9de1-b896ec653ae9", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "User 2" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "ee596f8b-46a6-4981-bfa7-3ce4dedfdcd0", + "apiVersion": "1.3", + "studyDeploymentId": "ee596f8b-46a6-4981-bfa7-3ce4dedfdcd0", + "protocol": { + "id": "f5405ce7-b03b-4757-9b97-a5d047ce22b8", + "createdOn": "2024-10-09T08:17:33.788885Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "a2ccb225-c763-422d-9de1-b896ec653ae9", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "User 2" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "ee596f8b-46a6-4981-bfa7-3ce4dedfdcd0", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "a2ccb225-c763-422d-9de1-b896ec653ae9", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatusList", + "apiVersion": "1.3", + "studyDeploymentIds": [ + "d028bb26-d458-428e-aac4-67916bab0fe4", + "ee596f8b-46a6-4981-bfa7-3ce4dedfdcd0" + ] + }, + "precedingEvents": [], + "publishedEvents": [], + "response": [ + { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "d028bb26-d458-428e-aac4-67916bab0fe4", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "8d82aa39-0c4e-4d19-846b-344b34b7f637", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + }, + { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "ee596f8b-46a6-4981-bfa7-3ce4dedfdcd0", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "a2ccb225-c763-422d-9de1-b896ec653ae9", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + ] + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_fails_for_unknown_studyDeploymentId.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_fails_for_unknown_studyDeploymentId.json new file mode 100644 index 000000000..2f5b027c2 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_fails_for_unknown_studyDeploymentId.json @@ -0,0 +1,13 @@ +[ + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "a27da272-b9a2-458d-a672-99778f05b7ed" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_succeeds.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_succeeds.json new file mode 100644 index 000000000..fb25d7b8a --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/getStudyDeploymentStatus_succeeds.json @@ -0,0 +1,212 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "20592427-d369-4aae-97bc-03bf8f441350", + "protocol": { + "id": "85cf89c1-30b6-4b40-9a2a-00257e14cda5", + "createdOn": "2024-10-09T08:17:33.801927Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "aa29808c-f386-4493-ae39-ef4a730959ae", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "20592427-d369-4aae-97bc-03bf8f441350", + "apiVersion": "1.3", + "studyDeploymentId": "20592427-d369-4aae-97bc-03bf8f441350", + "protocol": { + "id": "85cf89c1-30b6-4b40-9a2a-00257e14cda5", + "createdOn": "2024-10-09T08:17:33.801927Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "aa29808c-f386-4493-ae39-ef4a730959ae", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "20592427-d369-4aae-97bc-03bf8f441350", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "aa29808c-f386-4493-ae39-ef4a730959ae", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "20592427-d369-4aae-97bc-03bf8f441350" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "20592427-d369-4aae-97bc-03bf8f441350", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "aa29808c-f386-4493-ae39-ef4a730959ae", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/modifications_after_stop_not_allowed.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/modifications_after_stop_not_allowed.json new file mode 100644 index 000000000..15e542e37 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/modifications_after_stop_not_allowed.json @@ -0,0 +1,499 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "protocol": { + "id": "c5724080-e5ec-4366-a9e4-281203369ab5", + "createdOn": "2024-10-09T08:17:33.804237Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "protocol": { + "id": "c5724080-e5ec-4366-a9e4-281203369ab5", + "createdOn": "2024-10-09T08:17:33.804237Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceRoleName": "Primary", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804445Z", + "deviceId": "01c6bda0-9c68-45e9-a924-687df9a27f4c" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804445Z", + "deviceId": "01c6bda0-9c68-45e9-a924-687df9a27f4c" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceRoleName": "Connected", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804598Z", + "deviceId": "38bb9e8b-2303-46bb-aa33-3a8cb1cd03bb" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804598Z", + "deviceId": "38bb9e8b-2303-46bb-aa33-3a8cb1cd03bb" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + } + ], + "participantStatusList": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.Stop", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14" + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentStopped", + "aggregateId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14" + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Stopped", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [] + } + ], + "participantStatusList": [ + { + "participantId": "08ea7dca-bb45-446d-b464-4f92d9408e55", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null, + "stoppedOn": "1970-01-01T00:00:00Z" + } + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceRoleName": "Connected", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804735Z", + "deviceId": "b3736803-d27e-42a3-8c91-10175b76abb4" + } + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalStateException" + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.UnregisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "deviceRoleName": "Primary" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalStateException" + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetDeviceDeploymentFor", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "primaryDeviceRoleName": "Primary" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "deviceConfiguration": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804445Z", + "deviceId": "01c6bda0-9c68-45e9-a924-687df9a27f4c" + }, + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connectedDeviceRegistrations": { + "Connected": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.804598Z", + "deviceId": "38bb9e8b-2303-46bb-aa33-3a8cb1cd03bb" + } + } + } + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.DeviceDeployed", + "apiVersion": "1.3", + "studyDeploymentId": "fa0ae217-904a-4a9f-b28a-ae9c9dd68f14", + "primaryDeviceRoleName": "Primary", + "deviceDeploymentLastUpdatedOn": "2024-10-09T08:17:33.804598Z" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalStateException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_can_be_called_multiple_times.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_can_be_called_multiple_times.json new file mode 100644 index 000000000..d3f2dc875 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_can_be_called_multiple_times.json @@ -0,0 +1,353 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "protocol": { + "id": "0d8f8e63-63c5-45af-b83f-3d75d5807eeb", + "createdOn": "2024-10-09T08:17:33.814534Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "bb31c185-6b47-4a81-92a0-ea802ead5032", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "apiVersion": "1.3", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "protocol": { + "id": "0d8f8e63-63c5-45af-b83f-3d75d5807eeb", + "createdOn": "2024-10-09T08:17:33.814534Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "bb31c185-6b47-4a81-92a0-ea802ead5032", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "bb31c185-6b47-4a81-92a0-ea802ead5032", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "bb31c185-6b47-4a81-92a0-ea802ead5032", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "deviceRoleName": "Primary", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.814753Z", + "deviceId": "115ada23-3643-4a81-b2c5-20c53b70af32" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "apiVersion": "1.3", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.814753Z", + "deviceId": "115ada23-3643-4a81-b2c5-20c53b70af32" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "bb31c185-6b47-4a81-92a0-ea802ead5032", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "deviceRoleName": "Primary", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.814753Z", + "deviceId": "115ada23-3643-4a81-b2c5-20c53b70af32" + } + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "f235ad9c-66f2-4245-bcb3-8b2985eae777", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "bb31c185-6b47-4a81-92a0-ea802ead5032", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_cannot_be_called_with_same_registration_when_stopped.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_cannot_be_called_with_same_registration_when_stopped.json new file mode 100644 index 000000000..2c77cdd21 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/registerDevice_cannot_be_called_with_same_registration_when_stopped.json @@ -0,0 +1,372 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "protocol": { + "id": "9e062dc6-1dcc-4a9e-b6c2-0ce9bd019302", + "createdOn": "2024-10-09T08:17:33.769601Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "e600986f-bca0-43c3-b59d-5c1c66adcd62", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "protocol": { + "id": "9e062dc6-1dcc-4a9e-b6c2-0ce9bd019302", + "createdOn": "2024-10-09T08:17:33.769601Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Primary" + } + ] + }, + "invitations": [ + { + "participantId": "e600986f-bca0-43c3-b59d-5c1c66adcd62", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "e600986f-bca0-43c3-b59d-5c1c66adcd62", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Primary" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Primary", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "e600986f-bca0-43c3-b59d-5c1c66adcd62", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "deviceRoleName": "Primary", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.769796Z", + "deviceId": "4ad851e6-550e-4b45-92d1-ed8bb6cc3025" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.769796Z", + "deviceId": "4ad851e6-550e-4b45-92d1-ed8bb6cc3025" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "e600986f-bca0-43c3-b59d-5c1c66adcd62", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.Stop", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b" + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentStopped", + "aggregateId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b" + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Stopped", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Primary" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "e600986f-bca0-43c3-b59d-5c1c66adcd62", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Primary" + ] + } + ], + "startedOn": null, + "stoppedOn": "1970-01-01T00:00:00Z" + } + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "371dbdd3-3913-4ee3-a300-e7e7639a7d0b", + "deviceRoleName": "Primary", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.769796Z", + "deviceId": "4ad851e6-550e-4b45-92d1-ed8bb6cc3025" + } + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalStateException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_ignores_unknown_ids.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_ignores_unknown_ids.json new file mode 100644 index 000000000..54a668af8 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_ignores_unknown_ids.json @@ -0,0 +1,182 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "ffd95240-3e43-427c-b3d4-df880639d040", + "protocol": { + "id": "7517d660-9592-4855-9c7e-94ea94beb0c9", + "createdOn": "2024-10-09T08:17:33.774582Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "a51762f9-19dc-4a59-9ca7-d9dd349853f8", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "ffd95240-3e43-427c-b3d4-df880639d040", + "apiVersion": "1.3", + "studyDeploymentId": "ffd95240-3e43-427c-b3d4-df880639d040", + "protocol": { + "id": "7517d660-9592-4855-9c7e-94ea94beb0c9", + "createdOn": "2024-10-09T08:17:33.774582Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "a51762f9-19dc-4a59-9ca7-d9dd349853f8", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "ffd95240-3e43-427c-b3d4-df880639d040", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "a51762f9-19dc-4a59-9ca7-d9dd349853f8", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RemoveStudyDeployments", + "apiVersion": "1.3", + "studyDeploymentIds": [ + "ffd95240-3e43-427c-b3d4-df880639d040", + "a8aa257c-a666-4bbd-a880-fa4a2d426f1d" + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentRemoved", + "aggregateId": "ffd95240-3e43-427c-b3d4-df880639d040", + "apiVersion": "1.3", + "studyDeploymentId": "ffd95240-3e43-427c-b3d4-df880639d040" + }, + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentRemoved", + "aggregateId": "a8aa257c-a666-4bbd-a880-fa4a2d426f1d", + "apiVersion": "1.3", + "studyDeploymentId": "a8aa257c-a666-4bbd-a880-fa4a2d426f1d" + } + ], + "response": [ + "ffd95240-3e43-427c-b3d4-df880639d040" + ] + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_succeeds.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_succeeds.json new file mode 100644 index 000000000..e7332bc01 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/removeStudyDeployments_succeeds.json @@ -0,0 +1,356 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "9f8409bf-037d-44a7-8822-c418df2f9b98", + "protocol": { + "id": "f767c872-48e9-4ebb-b760-da58d271de46", + "createdOn": "2024-10-09T08:17:33.808243Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "7b9ba56b-24b1-466e-9032-0b7f14f85a9c", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "9f8409bf-037d-44a7-8822-c418df2f9b98", + "apiVersion": "1.3", + "studyDeploymentId": "9f8409bf-037d-44a7-8822-c418df2f9b98", + "protocol": { + "id": "f767c872-48e9-4ebb-b760-da58d271de46", + "createdOn": "2024-10-09T08:17:33.808243Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "7b9ba56b-24b1-466e-9032-0b7f14f85a9c", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "9f8409bf-037d-44a7-8822-c418df2f9b98", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "7b9ba56b-24b1-466e-9032-0b7f14f85a9c", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408", + "protocol": { + "id": "872ebb05-1482-4184-b5ce-92cb9bdc780a", + "createdOn": "2024-10-09T08:17:33.811833Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "4ecc1c6e-f7a1-4544-8141-24862fd1c5f8", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408", + "apiVersion": "1.3", + "studyDeploymentId": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408", + "protocol": { + "id": "872ebb05-1482-4184-b5ce-92cb9bdc780a", + "createdOn": "2024-10-09T08:17:33.811833Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "4ecc1c6e-f7a1-4544-8141-24862fd1c5f8", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "4ecc1c6e-f7a1-4544-8141-24862fd1c5f8", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RemoveStudyDeployments", + "apiVersion": "1.3", + "studyDeploymentIds": [ + "9f8409bf-037d-44a7-8822-c418df2f9b98", + "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408" + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentRemoved", + "aggregateId": "9f8409bf-037d-44a7-8822-c418df2f9b98", + "apiVersion": "1.3", + "studyDeploymentId": "9f8409bf-037d-44a7-8822-c418df2f9b98" + }, + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentRemoved", + "aggregateId": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408", + "apiVersion": "1.3", + "studyDeploymentId": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408" + } + ], + "response": [ + "9f8409bf-037d-44a7-8822-c418df2f9b98", + "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408" + ] + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "9f8409bf-037d-44a7-8822-c418df2f9b98" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + }, + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "b42bdcf9-e4d0-4a50-b8fc-ba5cca9a8408" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_fails_for_unknown_studyDeploymentId.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_fails_for_unknown_studyDeploymentId.json new file mode 100644 index 000000000..a900f3945 --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_fails_for_unknown_studyDeploymentId.json @@ -0,0 +1,13 @@ +[ + { + "outcome": "Failed", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.Stop", + "apiVersion": "1.3", + "studyDeploymentId": "a27da272-b9a2-458d-a672-99778f05b7ed" + }, + "precedingEvents": [], + "publishedEvents": [], + "exceptionType": "IllegalArgumentException" + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_succeeds.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_succeeds.json new file mode 100644 index 000000000..13698472f --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/stop_succeeds.json @@ -0,0 +1,220 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "fd63f766-34c9-45bb-a961-0b451e4489ed", + "protocol": { + "id": "528a729d-02a8-4b5b-bb5e-073db0d3c5a8", + "createdOn": "2024-10-09T08:17:33.750460Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "dcd97239-635d-4586-a686-db8b7dc9de3c", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "fd63f766-34c9-45bb-a961-0b451e4489ed", + "apiVersion": "1.3", + "studyDeploymentId": "fd63f766-34c9-45bb-a961-0b451e4489ed", + "protocol": { + "id": "528a729d-02a8-4b5b-bb5e-073db0d3c5a8", + "createdOn": "2024-10-09T08:17:33.750460Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "dcd97239-635d-4586-a686-db8b7dc9de3c", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fd63f766-34c9-45bb-a961-0b451e4489ed", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "dcd97239-635d-4586-a686-db8b7dc9de3c", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.Stop", + "apiVersion": "1.3", + "studyDeploymentId": "fd63f766-34c9-45bb-a961-0b451e4489ed" + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentStopped", + "aggregateId": "fd63f766-34c9-45bb-a961-0b451e4489ed", + "apiVersion": "1.3", + "studyDeploymentId": "fd63f766-34c9-45bb-a961-0b451e4489ed" + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Stopped", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "fd63f766-34c9-45bb-a961-0b451e4489ed", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "dcd97239-635d-4586-a686-db8b7dc9de3c", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null, + "stoppedOn": "1970-01-01T00:00:00Z" + } + } +] \ No newline at end of file diff --git a/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/unregisterDevice_succeeds.json b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/unregisterDevice_succeeds.json new file mode 100644 index 000000000..18194b63d --- /dev/null +++ b/carp.deployments.core/src/commonTest/resources/test-requests/DeploymentService/1.3/DeploymentServiceTest/unregisterDevice_succeeds.json @@ -0,0 +1,364 @@ +[ + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.CreateStudyDeployment", + "apiVersion": "1.3", + "id": "911fd544-135f-49f0-8998-377b1307b70f", + "protocol": { + "id": "1721c856-0087-433b-a719-a8ada7641802", + "createdOn": "2024-10-09T08:17:33.778003Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "c8b447cf-a7ca-4b6c-bdd2-61ada806f849", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ] + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.StudyDeploymentCreated", + "aggregateId": "911fd544-135f-49f0-8998-377b1307b70f", + "apiVersion": "1.3", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "protocol": { + "id": "1721c856-0087-433b-a719-a8ada7641802", + "createdOn": "2024-10-09T08:17:33.778003Z", + "version": 0, + "ownerId": "27879e75-ccc1-4866-9ab3-4ece1b735052", + "name": "Test protocol", + "description": "Test description", + "primaryDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + } + ], + "connectedDevices": [ + { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + } + ], + "connections": [ + { + "roleName": "Connected", + "connectedToRoleName": "Test device" + } + ] + }, + "invitations": [ + { + "participantId": "c8b447cf-a7ca-4b6c-bdd2-61ada806f849", + "assignedRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "identity": { + "__type": "dk.cachet.carp.common.application.users.UsernameAccountIdentity", + "username": "Test" + }, + "invitation": { + "name": "Some study" + } + } + ], + "connectedDevicePreregistrations": {} + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "c8b447cf-a7ca-4b6c-bdd2-61ada806f849", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.GetStudyDeploymentStatus", + "apiVersion": "1.3", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f" + }, + "precedingEvents": [], + "publishedEvents": [], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "c8b447cf-a7ca-4b6c-bdd2-61ada806f849", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.RegisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "deviceRoleName": "Test device", + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.778267Z", + "deviceId": "a43533e7-58fb-4b5b-bed1-312ec0cc0d49" + } + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "911fd544-135f-49f0-8998-377b1307b70f", + "apiVersion": "1.3", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": { + "__type": "dk.cachet.carp.common.application.devices.DefaultDeviceRegistration", + "registrationCreatedOn": "2024-10-09T08:17:33.778267Z", + "deviceId": "a43533e7-58fb-4b5b-bed1-312ec0cc0d49" + } + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Registered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "c8b447cf-a7ca-4b6c-bdd2-61ada806f849", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + }, + { + "outcome": "Succeeded", + "request": { + "__type": "dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest.UnregisterDevice", + "apiVersion": "1.3", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "deviceRoleName": "Test device" + }, + "precedingEvents": [], + "publishedEvents": [ + { + "__type": "dk.cachet.carp.deployments.application.DeploymentService.Event.DeviceRegistrationChanged", + "aggregateId": "911fd544-135f-49f0-8998-377b1307b70f", + "apiVersion": "1.3", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "registration": null + } + ], + "response": { + "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.DeployingDevices", + "createdOn": "1970-01-01T00:00:00Z", + "studyDeploymentId": "911fd544-135f-49f0-8998-377b1307b70f", + "deviceStatusList": [ + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration", + "isPrimaryDevice": true, + "roleName": "Test device" + }, + "canBeDeployed": true, + "remainingDevicesToRegisterToObtainDeployment": [ + "Test device" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Test device", + "Connected" + ] + }, + { + "__type": "dk.cachet.carp.deployments.application.DeviceDeploymentStatus.Unregistered", + "device": { + "__type": "dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration", + "roleName": "Connected" + }, + "canBeDeployed": false, + "remainingDevicesToRegisterToObtainDeployment": [ + "Connected" + ], + "remainingDevicesToRegisterBeforeDeployment": [ + "Connected" + ] + } + ], + "participantStatusList": [ + { + "participantId": "c8b447cf-a7ca-4b6c-bdd2-61ada806f849", + "assignedParticipantRoles": { + "__type": "dk.cachet.carp.common.application.users.AssignedTo.All" + }, + "assignedPrimaryDeviceRoleNames": [ + "Test device" + ] + } + ], + "startedOn": null + } + } +] \ No newline at end of file diff --git a/rpc/schemas/common/devices/DeviceRegistration.json b/rpc/schemas/common/devices/DeviceRegistration.json index f8c30cee5..e66b2e763 100644 --- a/rpc/schemas/common/devices/DeviceRegistration.json +++ b/rpc/schemas/common/devices/DeviceRegistration.json @@ -34,7 +34,7 @@ "registrationCreatedOn": { "type": "string", "format": "date-time" }, "additionalSpecifications": { "$ref": "../../common/ApplicationData.json" } }, - "required": [ "__type", "deviceId", "deviceDisplayName", "registrationCreatedOn" ] + "required": [ "__type", "deviceId", "registrationCreatedOn" ] } } } diff --git a/rpc/schemas/deployments/DeploymentService/DeploymentServiceRequest.json b/rpc/schemas/deployments/DeploymentService/DeploymentServiceRequest.json index dc3e30384..484e50507 100644 --- a/rpc/schemas/deployments/DeploymentService/DeploymentServiceRequest.json +++ b/rpc/schemas/deployments/DeploymentService/DeploymentServiceRequest.json @@ -12,7 +12,7 @@ { "$ref": "#/$defs/Stop" } ], "$defs": { - "ApiVersion": { "const": "1.1" }, + "ApiVersion": { "const": "1.3" }, "CreateStudyDeployment": { "$anchor": "CreateStudyDeployment", "type": "object",