Skip to content

Commit 4cc7191

Browse files
committed
Rename sync_operations to sync
Signed-off-by: Rina Fujino <[email protected]>
1 parent fe80cd2 commit 4cc7191

File tree

7 files changed

+19
-17
lines changed

7 files changed

+19
-17
lines changed

crates/core/tedge_api/src/mqtt_topics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ impl OperationType {
797797

798798
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
799799
pub enum SignalType {
800-
SyncOperations,
800+
Sync,
801801
Custom(String),
802802
}
803803

@@ -832,7 +832,7 @@ impl FromStr for SignalType {
832832
impl<'a> From<&'a str> for SignalType {
833833
fn from(s: &'a str) -> SignalType {
834834
match s {
835-
"sync_operations" => SignalType::SyncOperations,
835+
"sync" => SignalType::Sync,
836836
custom => SignalType::Custom(custom.to_string()),
837837
}
838838
}
@@ -841,7 +841,7 @@ impl<'a> From<&'a str> for SignalType {
841841
impl Display for SignalType {
842842
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
843843
match self {
844-
SignalType::SyncOperations => write!(f, "sync_operations"),
844+
SignalType::Sync => write!(f, "sync"),
845845
SignalType::Custom(custom) => write!(f, "{custom}"),
846846
}
847847
}
@@ -1164,10 +1164,10 @@ mod tests {
11641164
mqtt_schema.topic_for(
11651165
&device,
11661166
&Channel::Signal {
1167-
signal_type: SignalType::SyncOperations,
1167+
signal_type: SignalType::Sync,
11681168
}
11691169
),
1170-
mqtt_channel::Topic::new_unchecked("te/device/main///signal/sync_operations")
1170+
mqtt_channel::Topic::new_unchecked("te/device/main///signal/sync")
11711171
);
11721172
assert_eq!(
11731173
mqtt_schema.topic_for(&device, &Channel::Health),

crates/extensions/c8y_mapper_ext/src/signals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl CumulocityConverter {
1717
}
1818

1919
match signal_type {
20-
SignalType::SyncOperations => {
20+
SignalType::Sync => {
2121
for external_id in self.entity_cache.get_all_external_ids() {
2222
if let Ok(message) =
2323
self.load_and_create_supported_operations_messages(external_id.as_ref())

crates/extensions/c8y_mapper_ext/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3172,7 +3172,7 @@ async fn mapper_publishes_all_supported_operations_on_signal() {
31723172
mqtt.skip(3).await; // Skip registration messages
31733173

31743174
mqtt.send(MqttMessage::new(
3175-
&Topic::new_unchecked("te/device/main/service/tedge-mapper-c8y/signal/sync_operations"),
3175+
&Topic::new_unchecked("te/device/main/service/tedge-mapper-c8y/signal/sync"),
31763176
"{}",
31773177
))
31783178
.await

docs/src/operate/c8y/supported-operations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ Available only in the template operation file definition:
488488
To send or resend `c8y_SupportedOperations` fragment from %%te%% to your Cumulocity tenant, publish the following message:
489489

490490
```sh te2mqtt formats=v1
491-
tedge mqtt pub te/device/main/service/tedge-mapper-c8y/signal/sync_operations '{}'
491+
tedge mqtt pub te/device/main/service/tedge-mapper-c8y/signal/sync '{}'
492492
```
493493

494494
This command republishes the supported operations for the main device and all its child devices.

docs/src/references/mappers/c8y-mapper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ This request makes the `c8y-mapper` republish the supported operations of all th
12791279
**%%te%% (input)**
12801280

12811281
```text title="Topic"
1282-
te/device/main/service/tedge-mapper-c8y/signal/sync_operations
1282+
te/device/main/service/tedge-mapper-c8y/signal/sync
12831283
```
12841284

12851285
```json5 title="Payload"

docs/src/references/mqtt-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,9 @@ Where the signal segments are describe as follows:
712712

713713
The following table details some example signal types which are supported by %%te%%.
714714

715-
| Signal Type | Example Topic |
716-
|------------------|------------------------------------------|
717-
| sync_operations | `te/<identifier>/signal/sync_operations` |
715+
| Signal Type | Example Topic |
716+
|-------------|-------------------------------|
717+
| sync | `te/<identifier>/signal/sync` |
718718

719719
The signal would be interpreted differently based on the target entity.
720720

@@ -730,7 +730,7 @@ We plan to add support for more signal types in the future.
730730
Signal to request the supported operations of the `tedge-mapper-c8y` service:
731731

732732
```sh te2mqtt formats=v1
733-
tedge mqtt pub te/device/main/service/tedge-mapper-c8y/signal/sync_operations '{}'
733+
tedge mqtt pub te/device/main/service/tedge-mapper-c8y/signal/sync '{}'
734734
```
735735

736736
## Health check

tests/RobotFramework/tests/cumulocity/supported_operations/mapper-publishing-agent-supported-ops.robot

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ Re-publish supported operations by signal channel
6363
Execute Command tedge mqtt pub -r te/device/child01/service/foo '{"@type": "service"}'
6464
Execute Command tedge mqtt pub -r te/device/child01/service/foo/cmd/restart '{}'
6565

66-
Execute Command tedge mqtt pub te/device/main/service/tedge-mapper-c8y/signal/sync_operations '{}'
67-
Should Have MQTT Messages c8y/s/us message_contains=114
68-
Should Have MQTT Messages c8y/s/us/${DEVICE_SN}:device:child01 message_contains=114
69-
Should Have MQTT Messages c8y/s/us/${DEVICE_SN}:device:child01:service:foo message_contains=114
66+
Execute Command tedge mqtt pub te/device/main/service/tedge-mapper-c8y/signal/sync '{}'
67+
Should Have MQTT Messages
68+
... c8y/s/us
69+
... message_contains=114,c8y_DeviceProfile,c8y_DownloadConfigFile,c8y_LogfileRequest,c8y_RemoteAccessConnect,c8y_Restart,c8y_SoftwareUpdate,c8y_UploadConfigFile
70+
Should Have MQTT Messages c8y/s/us/${DEVICE_SN}:device:child01 message_contains=114,c8y_Restart
71+
Should Have MQTT Messages c8y/s/us/${DEVICE_SN}:device:child01:service:foo message_contains=114,c8y_Restart
7072

7173

7274
*** Keywords ***

0 commit comments

Comments
 (0)