Merge lp:~jtv/gwacl/upper-case-xml-acronyms into lp:gwacl

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: 80
Merged at revision: 82
Proposed branch: lp:~jtv/gwacl/upper-case-xml-acronyms
Merge into: lp:gwacl
Diff against target: 244 lines (+27/-27)
4 files modified
managementapi_test.go (+1/-1)
test_helpers.go (+1/-1)
xmlobjects.go (+13/-13)
xmlobjects_test.go (+12/-12)
To merge this branch: bzr merge lp:~jtv/gwacl/upper-case-xml-acronyms
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+156330@code.launchpad.net

Commit message

Harmonize capitalization of acronyms in XML structs.

Description of the change

Azure's XML capitalizes acronyms in two different styles: all upper case, or with just the first letter capitalized as if it were a word. We had some TODO comments to fix this up.

In this branch I make all our XML struct fields consistently upper-case acronyms. Of course the XML itself still uses Microsoft's spelling, but our structs will have a single, consistent capitalization scheme.

Of course this does break compile-time compatibility for existing gwacl-based code. Annoying, but this early in the library's life it will produce minimal harm.

Jeroen

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Thank you for doing this!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'managementapi_test.go'
2--- managementapi_test.go 2013-03-29 16:03:54 +0000
3+++ managementapi_test.go 2013-04-01 07:32:21 +0000
4@@ -344,7 +344,7 @@
5
6 c.Check(keys.Primary, Equals, primaryKey)
7 c.Check(keys.Secondary, Equals, secondaryKey)
8- c.Check(keys.Url, Equals, url)
9+ c.Check(keys.URL, Equals, url)
10 }
11
12 func (suite *managementAPISuite) TestPerformNodeOperation(c *C) {
13
14=== modified file 'test_helpers.go'
15--- test_helpers.go 2013-03-29 01:27:37 +0000
16+++ test_helpers.go 2013-04-01 07:32:21 +0000
17@@ -98,7 +98,7 @@
18 Hostname: hostname,
19 Username: username,
20 Password: password,
21- DisableSshPasswordAuthentication: disable_ssh}
22+ DisableSSHPasswordAuthentication: disable_ssh}
23 }
24
25 func makeOSVirtualHardDisk() *OSVirtualHardDisk {
26
27=== modified file 'xmlobjects.go'
28--- xmlobjects.go 2013-03-29 10:23:07 +0000
29+++ xmlobjects.go 2013-04-01 07:32:21 +0000
30@@ -38,7 +38,7 @@
31 Hostname string `xml:"HostName"`
32 Username string `xml:"UserName"`
33 Password string `xml:"UserPassword"`
34- DisableSshPasswordAuthentication bool `xml:"DisableSshPasswordAuthentication"`
35+ DisableSSHPasswordAuthentication bool `xml:"DisableSshPasswordAuthentication"`
36 }
37
38 func (c *LinuxProvisioningConfiguration) Serialize() (string, error) {
39@@ -47,13 +47,13 @@
40
41 func NewLinuxProvisioningConfiguration(
42 Hostname, Username, Password string,
43- DisableSshPasswordAuthentication bool) *LinuxProvisioningConfiguration {
44+ DisableSSHPasswordAuthentication bool) *LinuxProvisioningConfiguration {
45 return &LinuxProvisioningConfiguration{
46 ConfigurationSetType: "LinuxProvisioningConfiguration",
47 Hostname: Hostname,
48 Username: Username,
49 Password: Password,
50- DisableSshPasswordAuthentication: DisableSshPasswordAuthentication,
51+ DisableSSHPasswordAuthentication: DisableSSHPasswordAuthentication,
52 }
53 }
54
55@@ -166,7 +166,7 @@
56
57 type HostedService struct {
58 XMLNS string `xml:"xmlns,attr"`
59- Url string `xml:"Url"`
60+ URL string `xml:"Url"`
61 ServiceName string `xml:"ServiceName"`
62 Description string `xml:"Description"`
63 Deployments []Deployment `xml:"Deployments>Deployment"`
64@@ -178,7 +178,7 @@
65
66 type HostedServiceDescriptor struct {
67 XMLNS string `xml:"xmlns,attr"`
68- Url string `xml:"Url"`
69+ URL string `xml:"Url"`
70 ServiceName string `xml:"ServiceName"`
71 Description string `xml:"Description"`
72 }
73@@ -303,7 +303,7 @@
74 type StorageService struct {
75 // List Storage Accounts.
76 // See http://msdn.microsoft.com/en-us/library/windowsazure/ee460787.aspx
77- Url string `xml:"Url"` // TODO: change the struct field to all-uppercase.
78+ URL string `xml:"Url"`
79 ServiceName string `xml:"ServiceName"`
80 Description string `xml:"StorageServiceProperties>Description"`
81 AffinityGroup string `xml:"StorageServiceProperties>AffinityGroup"`
82@@ -322,7 +322,7 @@
83 }
84
85 type StorageServices struct {
86- xmlns string `xml:"xmlns,attr"`
87+ XMLNS string `xml:"xmlns,attr"`
88 StorageServices []StorageService `xml:"StorageService"`
89 }
90
91@@ -376,9 +376,9 @@
92 type Blob struct {
93 Name string `xml:"Name"`
94 Snapshot string `xml:"Snapshot"`
95- Url string `xml:"Url"`
96+ URL string `xml:"Url"`
97 LastModified string `xml:"Properties>Last-Modified"`
98- Etag string `xml:"Properties>Etag"`
99+ ETag string `xml:"Properties>Etag"`
100 ContentLength string `xml:"Properties>Content-Length"`
101 ContentType string `xml:"Properties>Content-Type"`
102 BlobSequenceNumber string `xml:"Properties>x-ms-blob-sequence-number"`
103@@ -386,7 +386,7 @@
104 LeaseStatus string `xml:"Properties>LeaseStatus"`
105 LeaseState string `xml:"Properties>LeaseState"`
106 LeaseDuration string `xml:"Properties>LeaseDuration"`
107- CopyId string `xml:"Properties>CopyId"`
108+ CopyID string `xml:"Properties>CopyId"`
109 CopyStatus string `xml:"Properties>CopyStatus"`
110 CopySource string `xml:"Properties>CopySource"`
111 CopyProgress string `xml:"Properties>CopyProgress"`
112@@ -414,7 +414,7 @@
113 type StorageAccountKeys struct {
114 // See http://msdn.microsoft.com/en-us/library/windowsazure/ee460785.aspx
115 XMLName xml.Name `xml:"StorageService"`
116- Url string `xml:"Url"` // TODO: change the struct field to all-uppercase.
117+ URL string `xml:"Url"`
118 Primary string `xml:"StorageServiceKeys>Primary"`
119 Secondary string `xml:"StorageServiceKeys>Secondary"`
120 }
121@@ -447,7 +447,7 @@
122
123 type Properties struct {
124 LastModified string `xml:"Last-Modified"`
125- Etag string `xml:"Etag"`
126+ ETag string `xml:"Etag"`
127 LeaseStatus string `xml:"LeaseStatus"`
128 LeaseState string `xml:"LeaseState"`
129 LeaseDuration string `xml:"LeaseDuration"`
130@@ -533,7 +533,7 @@
131 type Operation struct {
132 ID string `xml:"ID"`
133 Status string `xml:"Status"`
134- HttpStatusCode int `xml:"HttpStatusCode"`
135+ HTTPStatusCode int `xml:"HttpStatusCode"`
136 ErrorCode string `xml:"Error>Code"`
137 ErrorMessage string `xml:"Error>Message"`
138 }
139
140=== modified file 'xmlobjects_test.go'
141--- xmlobjects_test.go 2013-03-29 01:27:37 +0000
142+++ xmlobjects_test.go 2013-04-01 07:32:21 +0000
143@@ -33,7 +33,7 @@
144 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>
145 </LinuxProvisioningConfiguration>`)
146 expected := fmt.Sprintf(template, config.Hostname, config.Username,
147- config.Password, config.DisableSshPasswordAuthentication)
148+ config.Password, config.DisableSSHPasswordAuthentication)
149 c.Check(xml, Equals, expected)
150 }
151
152@@ -131,7 +131,7 @@
153 </Role>`)
154 expected := fmt.Sprintf(template, role.RoleName,
155 config.ConfigurationSetType, config.Hostname, config.Username,
156- config.Password, config.DisableSshPasswordAuthentication, role.RoleSize)
157+ config.Password, config.DisableSSHPasswordAuthentication, role.RoleSize)
158 c.Check(xml, Equals, expected)
159 }
160
161@@ -178,7 +178,7 @@
162 deployment.DeploymentSlot, deployment.Label,
163 role.RoleName, config.ConfigurationSetType, config.Hostname,
164 config.Username, config.Password,
165- config.DisableSshPasswordAuthentication, role.RoleSize,
166+ config.DisableSSHPasswordAuthentication, role.RoleSize,
167 deployment.VirtualNetworkName, dns.Name, dns.Address)
168 c.Check(xml, Equals, expected)
169 }
170@@ -304,7 +304,7 @@
171 s := services.StorageServices[0]
172
173 // Oh jeez, here we go....
174- c.Check(s.Url, Equals, url)
175+ c.Check(s.URL, Equals, url)
176 c.Check(s.ServiceName, Equals, servicename)
177 c.Check(s.Description, Equals, desc)
178 c.Check(s.AffinityGroup, Equals, affinity)
179@@ -386,9 +386,9 @@
180 b := r.Blobs[0]
181 c.Check(b.Name, Equals, "blob-name")
182 c.Check(b.Snapshot, Equals, "snapshot-date-time")
183- c.Check(b.Url, Equals, "blob-address")
184+ c.Check(b.URL, Equals, "blob-address")
185 c.Check(b.LastModified, Equals, "last-modified")
186- c.Check(b.Etag, Equals, "etag")
187+ c.Check(b.ETag, Equals, "etag")
188 c.Check(b.ContentLength, Equals, "size-in-bytes")
189 c.Check(b.ContentType, Equals, "blob-content-type")
190 c.Check(b.BlobSequenceNumber, Equals, "sequence-number")
191@@ -396,7 +396,7 @@
192 c.Check(b.LeaseStatus, Equals, "leasestatus")
193 c.Check(b.LeaseState, Equals, "leasestate")
194 c.Check(b.LeaseDuration, Equals, "leasesduration")
195- c.Check(b.CopyId, Equals, "id")
196+ c.Check(b.CopyID, Equals, "id")
197 c.Check(b.CopyStatus, Equals, "copystatus")
198 c.Check(b.CopySource, Equals, "copysource")
199 c.Check(b.CopyProgress, Equals, "copyprogress")
200@@ -431,7 +431,7 @@
201 keys := &StorageAccountKeys{}
202 err := keys.Deserialize(data)
203 c.Assert(err, IsNil)
204- c.Check(keys.Url, Equals, url)
205+ c.Check(keys.URL, Equals, url)
206 c.Check(keys.Primary, Equals, key1)
207 c.Check(keys.Secondary, Equals, key2)
208 }
209@@ -463,7 +463,7 @@
210 c.Check(config.Hostname, Equals, hostname)
211 c.Check(config.Username, Equals, username)
212 c.Check(config.Password, Equals, password)
213- c.Check(config.DisableSshPasswordAuthentication, Equals, disablessh)
214+ c.Check(config.DisableSSHPasswordAuthentication, Equals, disablessh)
215 c.Check(config.ConfigurationSetType, Equals, "LinuxProvisioningConfiguration")
216 }
217
218@@ -500,7 +500,7 @@
219
220 expected := &Properties{
221 LastModified: "date/time-value",
222- Etag: "etag-value",
223+ ETag: "etag-value",
224 LeaseStatus: "lease-status-value",
225 LeaseState: "lease-state-value",
226 LeaseDuration: "lease-duration-value",
227@@ -560,7 +560,7 @@
228 URL: "url-value",
229 Properties: Properties{
230 LastModified: "date/time-value",
231- Etag: "etag-value",
232+ ETag: "etag-value",
233 LeaseStatus: "lease-status-value",
234 LeaseState: "lease-state-value",
235 LeaseDuration: "lease-duration-value",
236@@ -620,7 +620,7 @@
237 URL: "url-value",
238 Properties: Properties{
239 LastModified: "date/time-value",
240- Etag: "etag-value",
241+ ETag: "etag-value",
242 LeaseStatus: "lease-status-value",
243 LeaseState: "lease-state-value",
244 LeaseDuration: "lease-duration-value",

Subscribers

People subscribed via source and target branches