@@ -391,9 +391,9 @@ public void testGetNicStats() {
391391
392392 @ Test
393393 public void diskUuidToSerialTest () {
394- String uuid = "38400000-8cf0-11bd-b24e-10b96e4ef00d" ;
395- String expected = "384000008cf011bdb24e" ;
396- LibvirtComputingResource lcr = new LibvirtComputingResource ();
394+ final String uuid = "38400000-8cf0-11bd-b24e-10b96e4ef00d" ;
395+ final String expected = "384000008cf011bdb24e" ;
396+ final LibvirtComputingResource lcr = new LibvirtComputingResource ();
397397 Assert .assertEquals (expected , lcr .diskUuidToSerial (uuid ));
398398 }
399399
@@ -711,7 +711,7 @@ public void testGetVmDiskStatsCommand() {
711711 @ SuppressWarnings ("unchecked" )
712712 @ Test
713713 public void testGetVmDiskStatsCommandException () {
714- final Connect conn = Mockito .mock (Connect .class );
714+ Mockito .mock (Connect .class );
715715 final LibvirtUtilitiesHelper libvirtUtilitiesHelper = Mockito .mock (LibvirtUtilitiesHelper .class );
716716
717717 final String vmName = "Test" ;
@@ -931,7 +931,7 @@ public void testRebootRouterCommandConnect() {
931931 public void testGetHostStatsCommand () {
932932 // A bit difficult to test due to the logger being passed and the parser itself relying on the connection.
933933 // Have to spend some more time afterwards in order to refactor the wrapper itself.
934- final LibvirtUtilitiesHelper libvirtUtilitiesHelper = Mockito .mock (LibvirtUtilitiesHelper .class );
934+ Mockito .mock (LibvirtUtilitiesHelper .class );
935935 final CPUStat cpuStat = Mockito .mock (CPUStat .class );
936936 final MemStat memStat = Mockito .mock (MemStat .class );
937937
@@ -1253,8 +1253,10 @@ public void testMigrateCommand() {
12531253 when (conn .domainLookupByName (vmName )).thenReturn (dm );
12541254
12551255 when (libvirtComputingResource .getPrivateIp ()).thenReturn ("127.0.0.1" );
1256- when (dm .getXMLDesc (8 )).thenReturn ("host_domain" );
1257- when (dm .getXMLDesc (1 )).thenReturn ("host_domain" );
1256+ when (dm .getXMLDesc (8 )).thenReturn ("<domain type='kvm' id='3'>" + " <devices>" + " <graphics type='vnc' port='5900' autoport='yes' listen='10.10.10.1'>"
1257+ + " <listen type='address' address='10.10.10.1'/>" + " </graphics>" + " </devices>" + "</domain>" );
1258+ when (dm .getXMLDesc (1 )).thenReturn ("<domain type='kvm' id='3'>" + " <devices>" + " <graphics type='vnc' port='5900' autoport='yes' listen='10.10.10.1'>"
1259+ + " <listen type='address' address='10.10.10.1'/>" + " </graphics>" + " </devices>" + "</domain>" );
12581260 when (dm .isPersistent ()).thenReturn (1 );
12591261 doNothing ().when (dm ).undefine ();
12601262
@@ -5010,13 +5012,13 @@ public void testUpdateHostPasswordCommandFail() {
50105012
50115013 @ Test
50125014 public void testIsInterface () {
5013- LibvirtComputingResource lvcr = new LibvirtComputingResource ();
5015+ final LibvirtComputingResource lvcr = new LibvirtComputingResource ();
50145016 assertFalse (lvcr .isInterface ("bla" ));
50155017 assertTrue (lvcr .isInterface ("p99p00" ));
5016- for (String ifNamePattern : lvcr ._ifNamePatterns ) {
5018+ for (final String ifNamePattern : lvcr ._ifNamePatterns ) {
50175019 // excluding regexps as "\\\\d+" won't replace with String.replaceAll(String,String);
50185020 if (!ifNamePattern .contains ("\\ " )) {
5019- String ifName = ifNamePattern .replaceFirst ("\\ ^" , "" ) + "0" ;
5021+ final String ifName = ifNamePattern .replaceFirst ("\\ ^" , "" ) + "0" ;
50205022 assertTrue ("The pattern '" + ifNamePattern + "' is expected to be valid for interface " + ifName ,lvcr .isInterface (ifName ));
50215023 }
50225024 }
0 commit comments