@@ -52,10 +52,10 @@ public void testCreateAndInfo() throws QemuImgException, LibvirtException {
5252 fail ("We didn't get any information back from qemu-img" );
5353 }
5454
55- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
55+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
5656 assertEquals (Long .valueOf (size ), Long .valueOf (infoSize ));
5757
58- String infoPath = info .get (new String ( "image" ) );
58+ String infoPath = info .get (QemuImg . IMAGE );
5959 assertEquals (filename , infoPath );
6060
6161 File f = new File (filename );
@@ -79,13 +79,13 @@ public void testCreateAndInfoWithOptions() throws QemuImgException, LibvirtExcep
7979 qemu .create (file , options );
8080 Map <String , String > info = qemu .info (file );
8181
82- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
82+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
8383 assertEquals (Long .valueOf (size ), Long .valueOf (infoSize ));
8484
85- String infoPath = info .get (new String ( "image" ) );
85+ String infoPath = info .get (QemuImg . IMAGE );
8686 assertEquals (filename , infoPath );
8787
88- String infoClusterSize = info .get (new String ( "cluster_size" ) );
88+ String infoClusterSize = info .get (QemuImg . CLUSTER_SIZE );
8989 assertEquals (clusterSize , infoClusterSize );
9090
9191 File f = new File (filename );
@@ -136,7 +136,7 @@ public void testCreateAndResize() throws QemuImgException, LibvirtException {
136136 fail ("We didn't get any information back from qemu-img" );
137137 }
138138
139- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
139+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
140140 assertEquals (Long .valueOf (endSize ), Long .valueOf (infoSize ));
141141 } catch (QemuImgException e ) {
142142 fail (e .getMessage ());
@@ -165,7 +165,7 @@ public void testCreateAndResizeDeltaPositive() throws QemuImgException, LibvirtE
165165 fail ("We didn't get any information back from qemu-img" );
166166 }
167167
168- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
168+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
169169 assertEquals (Long .valueOf (startSize + increment ), Long .valueOf (infoSize ));
170170 } catch (QemuImgException e ) {
171171 fail (e .getMessage ());
@@ -193,7 +193,7 @@ public void testCreateAndResizeDeltaNegative() throws QemuImgException, LibvirtE
193193 fail ("We didn't get any information back from qemu-img" );
194194 }
195195
196- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
196+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
197197 assertEquals (Long .valueOf (startSize + increment ), Long .valueOf (infoSize ));
198198 } catch (QemuImgException e ) {
199199 fail (e .getMessage ());
@@ -256,7 +256,7 @@ public void testCreateWithBackingFile() throws QemuImgException, LibvirtExceptio
256256 fail ("We didn't get any information back from qemu-img" );
257257 }
258258
259- String backingFile = info .get (new String ( "backing_file" ) );
259+ String backingFile = info .get (QemuImg . BACKING_FILE );
260260 if (backingFile == null ) {
261261 fail ("The second file does not have a property backing_file! Create failed?" );
262262 }
@@ -304,10 +304,10 @@ public void testConvertAdvanced() throws QemuImgException, LibvirtException {
304304
305305 Map <String , String > info = qemu .info (destFile );
306306
307- PhysicalDiskFormat infoFormat = PhysicalDiskFormat .valueOf (info .get (new String ( "format" ) ).toUpperCase ());
307+ PhysicalDiskFormat infoFormat = PhysicalDiskFormat .valueOf (info .get (QemuImg . FILE_FORMAT ).toUpperCase ());
308308 assertEquals (destFormat , infoFormat );
309309
310- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
310+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
311311 assertEquals (Long .valueOf (srcSize ), Long .valueOf (infoSize ));
312312
313313 File sf = new File (srcFileName );
@@ -317,4 +317,4 @@ public void testConvertAdvanced() throws QemuImgException, LibvirtException {
317317 df .delete ();
318318
319319 }
320- }
320+ }
0 commit comments