@@ -51,10 +51,10 @@ public void testCreateAndInfo() throws QemuImgException {
5151 fail ("We didn't get any information back from qemu-img" );
5252 }
5353
54- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
54+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
5555 assertEquals (Long .valueOf (size ), Long .valueOf (infoSize ));
5656
57- String infoPath = info .get (new String ( "image" ) );
57+ String infoPath = info .get (QemuImg . IMAGE );
5858 assertEquals (filename , infoPath );
5959
6060 File f = new File (filename );
@@ -78,13 +78,13 @@ public void testCreateAndInfoWithOptions() throws QemuImgException {
7878 qemu .create (file , options );
7979 Map <String , String > info = qemu .info (file );
8080
81- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
81+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
8282 assertEquals (Long .valueOf (size ), Long .valueOf (infoSize ));
8383
84- String infoPath = info .get (new String ( "image" ) );
84+ String infoPath = info .get (QemuImg . IMAGE );
8585 assertEquals (filename , infoPath );
8686
87- String infoClusterSize = info .get (new String ( "cluster_size" ) );
87+ String infoClusterSize = info .get (QemuImg . CLUSTER_SIZE );
8888 assertEquals (clusterSize , infoClusterSize );
8989
9090 File f = new File (filename );
@@ -135,7 +135,7 @@ public void testCreateAndResize() throws QemuImgException {
135135 fail ("We didn't get any information back from qemu-img" );
136136 }
137137
138- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
138+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
139139 assertEquals (Long .valueOf (endSize ), Long .valueOf (infoSize ));
140140 } catch (QemuImgException e ) {
141141 fail (e .getMessage ());
@@ -164,7 +164,7 @@ public void testCreateAndResizeDeltaPositive() throws QemuImgException {
164164 fail ("We didn't get any information back from qemu-img" );
165165 }
166166
167- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
167+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
168168 assertEquals (Long .valueOf (startSize + increment ), Long .valueOf (infoSize ));
169169 } catch (QemuImgException e ) {
170170 fail (e .getMessage ());
@@ -192,7 +192,7 @@ public void testCreateAndResizeDeltaNegative() throws QemuImgException {
192192 fail ("We didn't get any information back from qemu-img" );
193193 }
194194
195- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
195+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
196196 assertEquals (Long .valueOf (startSize + increment ), Long .valueOf (infoSize ));
197197 } catch (QemuImgException e ) {
198198 fail (e .getMessage ());
@@ -255,7 +255,7 @@ public void testCreateWithBackingFile() throws QemuImgException {
255255 fail ("We didn't get any information back from qemu-img" );
256256 }
257257
258- String backingFile = info .get (new String ( "backing_file" ) );
258+ String backingFile = info .get (QemuImg . BACKING_FILE );
259259 if (backingFile == null ) {
260260 fail ("The second file does not have a property backing_file! Create failed?" );
261261 }
@@ -303,10 +303,10 @@ public void testConvertAdvanced() throws QemuImgException {
303303
304304 Map <String , String > info = qemu .info (destFile );
305305
306- PhysicalDiskFormat infoFormat = PhysicalDiskFormat .valueOf (info .get (new String ( "format" ) ).toUpperCase ());
306+ PhysicalDiskFormat infoFormat = PhysicalDiskFormat .valueOf (info .get (QemuImg . FILE_FORMAT ).toUpperCase ());
307307 assertEquals (destFormat , infoFormat );
308308
309- Long infoSize = Long .parseLong (info .get (new String ( "virtual_size" ) ));
309+ Long infoSize = Long .parseLong (info .get (QemuImg . VIRTUAL_SIZE ));
310310 assertEquals (Long .valueOf (srcSize ), Long .valueOf (infoSize ));
311311
312312 File sf = new File (srcFileName );
@@ -316,4 +316,4 @@ public void testConvertAdvanced() throws QemuImgException {
316316 df .delete ();
317317
318318 }
319- }
319+ }
0 commit comments