@@ -43,11 +43,11 @@ var marshalTestCases = []struct {
43
43
ModelUUID : "uuid" ,
44
44
Id : "Benji" ,
45
45
InstanceId : "Shazam" ,
46
- JujuStatus : multiwatcher.StatusInfo {
46
+ AgentStatus : multiwatcher.StatusInfo {
47
47
Current : status .StatusError ,
48
48
Message : "foo" ,
49
49
},
50
- MachineStatus : multiwatcher.StatusInfo {
50
+ InstanceStatus : multiwatcher.StatusInfo {
51
51
Current : status .StatusPending ,
52
52
},
53
53
Life : multiwatcher .Life ("alive" ),
@@ -58,7 +58,7 @@ var marshalTestCases = []struct {
58
58
HardwareCharacteristics : & instance.HardwareCharacteristics {},
59
59
},
60
60
},
61
- json : `["machine","change",{"ModelUUID ":"uuid","Id ":"Benji","InstanceId ":"Shazam","JujuStatus ":{"Err":null,"Current":" error","Message ":"foo","Since":null,"Version":"","Data":null },"MachineStatus ":{"Err":null,"Current":" pending","Message ":"","Since":null,"Version":"","Data":null },"Life ":"alive","Series ":"trusty","SupportedContainers ":["lxd"],"SupportedContainersKnown ":false,"HardwareCharacteristics ":{},"Jobs ":["JobManageModel"],"Addresses ":[],"HasVote ":false,"WantsVote ":false}]` ,
61
+ json : `["machine","change",{"model-uuid ":"uuid","id ":"Benji","instance-id ":"Shazam","agent-status ":{"current":" error","message ":"foo","version":"" },"instance-status ":{"current":" pending","message ":"","version":"" },"life ":"alive","series ":"trusty","supported-containers ":["lxd"],"supported-containers-known ":false,"hardware-characteristics ":{},"jobs ":["JobManageModel"],"addresses ":[],"has-vote ":false,"wants-vote ":false}]` ,
62
62
}, {
63
63
about : "ApplicationInfo Delta" ,
64
64
value : multiwatcher.Delta {
@@ -81,7 +81,7 @@ var marshalTestCases = []struct {
81
81
},
82
82
},
83
83
},
84
- json : `["application","change",{"ModelUUID ": "uuid", "CharmURL ": "cs:quantal/name","Name ":"Benji","Exposed ":true,"Life ":"dying","OwnerTag ":"test-owner","MinUnits ":42,"Constraints ":{"arch":"armhf", "mem": 1024},"Config ": {"hello":"goodbye","foo":false},"Subordinate ":false,"Status ":{"Current ":"active", "Message ":"all good", "Version ": "", "Err": null, "Data": null, "Since": null }}]` ,
84
+ json : `["application","change",{"model-uuid ": "uuid", "charm-url ": "cs:quantal/name","name ":"Benji","exposed ":true,"life ":"dying","owner-tag ":"test-owner","min-units ":42,"constraints ":{"arch":"armhf", "mem": 1024},"config ": {"hello":"goodbye","foo":false},"subordinate ":false,"status ":{"current ":"active", "message ":"all good", "version ": ""}}]` ,
85
85
}, {
86
86
about : "UnitInfo Delta" ,
87
87
value : multiwatcher.Delta {
@@ -91,11 +91,11 @@ var marshalTestCases = []struct {
91
91
Application : "Shazam" ,
92
92
Series : "precise" ,
93
93
CharmURL : "cs:~user/precise/wordpress-42" ,
94
- Ports : []network .Port {{
94
+ Ports : []multiwatcher .Port {{
95
95
Protocol : "http" ,
96
96
Number : 80 ,
97
97
}},
98
- PortRanges : []network .PortRange {{
98
+ PortRanges : []multiwatcher .PortRange {{
99
99
FromPort : 80 ,
100
100
ToPort : 80 ,
101
101
Protocol : "http" ,
@@ -107,12 +107,12 @@ var marshalTestCases = []struct {
107
107
Current : status .StatusActive ,
108
108
Message : "all good" ,
109
109
},
110
- JujuStatus : multiwatcher.StatusInfo {
110
+ AgentStatus : multiwatcher.StatusInfo {
111
111
Current : status .StatusIdle ,
112
112
},
113
113
},
114
114
},
115
- json : `["unit","change",{"ModelUUID ":"uuid","Name ":"Benji","Application ":"Shazam","Series ":"precise","CharmURL ":"cs:~user/precise/wordpress-42","PublicAddress ":"testing.invalid","PrivateAddress ":"10.0.0.1","MachineId ":"1","Ports ":[{"Protocol ":"http","Number ":80}],"PortRanges ":[{"FromPort ":80,"ToPort ":80,"Protocol ":"http"}],"Subordinate ":false,"WorkloadStatus ":{"Err":null,"Current":" active","Message ":"all good","Since":null,"Version":"","Data":null },"JujuStatus ":{"Err":null,"Current":" idle","Message ":"","Since":null,"Version":"","Data":null }}]` ,
115
+ json : `["unit","change",{"model-uuid ":"uuid","name ":"Benji","application ":"Shazam","series ":"precise","charm-url ":"cs:~user/precise/wordpress-42","public-address ":"testing.invalid","private-address ":"10.0.0.1","machine-id ":"1","ports ":[{"protocol ":"http","number ":80}],"port-ranges ":[{"from-port ":80,"to-port ":80,"protocol ":"http"}],"subordinate ":false,"workload-status ":{"current":" active","message ":"all good","version":"" },"agent-status ":{"current":" idle","message ":"","version":"" }}]` ,
116
116
}, {
117
117
about : "RelationInfo Delta" ,
118
118
value : multiwatcher.Delta {
@@ -121,11 +121,30 @@ var marshalTestCases = []struct {
121
121
Key : "Benji" ,
122
122
Id : 4711 ,
123
123
Endpoints : []multiwatcher.Endpoint {
124
- {ApplicationName : "logging" , Relation : charm.Relation {Name : "logging-directory" , Role : "requirer" , Interface : "logging" , Optional : false , Limit : 1 , Scope : "container" }},
125
- {ApplicationName : "wordpress" , Relation : charm.Relation {Name : "logging-dir" , Role : "provider" , Interface : "logging" , Optional : false , Limit : 0 , Scope : "container" }}},
124
+ {
125
+ ApplicationName : "logging" ,
126
+ Relation : multiwatcher.CharmRelation {
127
+ Name : "logging-directory" ,
128
+ Role : "requirer" ,
129
+ Interface : "logging" ,
130
+ Optional : false ,
131
+ Limit : 1 ,
132
+ Scope : "container" },
133
+ },
134
+ {
135
+ ApplicationName : "wordpress" ,
136
+ Relation : multiwatcher.CharmRelation {
137
+ Name : "logging-dir" ,
138
+ Role : "provider" ,
139
+ Interface : "logging" ,
140
+ Optional : false ,
141
+ Limit : 0 ,
142
+ Scope : "container" },
143
+ },
144
+ },
126
145
},
127
146
},
128
- json : `["relation","change",{"ModelUUID ": "uuid", "Key ":"Benji", "Id ": 4711, "Endpoints ": [{"ApplicationName ":"logging", "Relation ":{"Name ":"logging-directory", "Role ":"requirer", "Interface ":"logging", "Optional ":false, "Limit ":1, "Scope ":"container"}}, {"ApplicationName ":"wordpress", "Relation ":{"Name ":"logging-dir", "Role ":"provider", "Interface ":"logging", "Optional ":false, "Limit ":0, "Scope ":"container"}}]}]` ,
147
+ json : `["relation","change",{"model-uuid ": "uuid", "key ":"Benji", "id ": 4711, "endpoints ": [{"application-name ":"logging", "relation ":{"name ":"logging-directory", "role ":"requirer", "interface ":"logging", "optional ":false, "limit ":1, "scope ":"container"}}, {"application-name ":"wordpress", "relation ":{"name ":"logging-dir", "role ":"provider", "interface ":"logging", "optional ":false, "limit ":0, "scope ":"container"}}]}]` ,
129
148
}, {
130
149
about : "AnnotationInfo Delta" ,
131
150
value : multiwatcher.Delta {
@@ -138,7 +157,7 @@ var marshalTestCases = []struct {
138
157
},
139
158
},
140
159
},
141
- json : `["annotation","change",{"ModelUUID ": "uuid", "Tag ":"machine-0","Annotations ":{"foo":"bar","arble":"2 4"}}]` ,
160
+ json : `["annotation","change",{"model-uuid ": "uuid", "tag ":"machine-0","annotations ":{"foo":"bar","arble":"2 4"}}]` ,
142
161
}, {
143
162
about : "Delta Removed True" ,
144
163
value : multiwatcher.Delta {
@@ -148,7 +167,7 @@ var marshalTestCases = []struct {
148
167
Key : "Benji" ,
149
168
},
150
169
},
151
- json : `["relation","remove",{"ModelUUID ": "uuid", "Key ":"Benji", "Id ": 0, "Endpoints ": null}]` ,
170
+ json : `["relation","remove",{"model-uuid ": "uuid", "key ":"Benji", "id ": 0, "endpoints ": null}]` ,
152
171
}}
153
172
154
173
func (s * MarshalSuite ) TestDeltaMarshalJSON (c * gc.C ) {
@@ -175,7 +194,7 @@ func (s *MarshalSuite) TestDeltaUnmarshalJSON(c *gc.C) {
175
194
var unmarshalled multiwatcher.Delta
176
195
err := json .Unmarshal ([]byte (t .json ), & unmarshalled )
177
196
c .Check (err , jc .ErrorIsNil )
178
- c .Check (unmarshalled , gc .DeepEquals , t .value )
197
+ c .Check (unmarshalled , jc .DeepEquals , t .value )
179
198
}
180
199
}
181
200
0 commit comments