Source:
public void testGetCapabilities ( ) throws java.io.IOException , java.lang.InterruptedException , java.util.concurrent.ExecutionException , java.util.concurrent.TimeoutException , org.codehaus.jackson.JsonParseException , org.codehaus.jackson.map.JsonMappingException , org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { java.lang.String capabilitiesJson = "{\"jsonrpc\": \"2.0\", \"id\": \"aed1feb4-42cf-4bf4-8ddf-852251152b68\", \"result\": {\"HBAInventory\": {\"iSCSI\": " + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "[{\"InitiatorName\": \"iqn.1994-05.com.redhat:d990cf85cdeb\"}], \"FC\": []}, \"packages2\": {\"kernel\": {\"release\": \"200.fc19.x86_64\"," + " \"buildtime\": 1384356599.0, \"version\": \"3.11.8\"}, \"spice-server\": {\"release\": \"3.fc19\", \"buildtime\": 1383130020, " ) + "\"version\": \"0.12.4\"}, \"vdsm\": {\"release\": \"163.git9adad51.fc19\", \"buildtime\": 1385064768, \"version\": \"4.13.0\"}, " ) + "\"qemu-kvm\": {\"release\": \"13.fc19\", \"buildtime\": 1383700301, \"version\": \"1.4.2\"}, \"libvirt\": {\"release\": " ) + "\"1.fc19\", \"buildtime\": 1383765188, \"version\": \"1.0.5.7\"}, \"qemu-img\": {\"release\": \"13.fc19\", \"buildtime\": " ) + "1383700301, \"version\": \"1.4.2\"}, \"mom\": {\"release\": \"3.13.giteb3985f.fc19\", \"buildtime\": 1384283536, \"version\"" ) + ": \"0.3.2\"}}, \"cpuModel\": \"Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz\", \"hooks\": {}, \"cpuSockets\": \"1\", \"vmTypes\": " ) + "[\"kvm\"], \"supportedProtocols\": [\"2.2\", \"2.3\"], \"networks\": {\"ovirtmgmt\": {\"iface\": \"ovirtmgmt\", \"addr\":" ) + " \"192.168.1.10\", \"cfg\": {\"DEFROUTE\": \"yes\", \"IPADDR\": \"192.168.1.10\", \"GATEWAY\": \"192.168.1.1\", \"DELAY\":" ) + " \"0\", \"NM_CONTROLLED\": \"no\", \"NETMASK\": \"255.255.255.0\", \"BOOTPROTO\": \"none\", \"STP\": \"no\", \"DEVICE\": " ) + "\"ovirtmgmt\", \"TYPE\": \"Bridge\", \"ONBOOT\": \"yes\"}, \"ipv6addrs\": [\"fe80::baca:3aff:fea9:77e2/64\"], \"gateway\":" ) + " \"192.168.1.1\", \"netmask\": \"255.255.255.0\", \"stp\": \"off\", \"bridged\": true, \"qosInbound\": \"\", \"qosOutbound\":" ) + " \"\", \"mtu\": \"1500\", \"ipv6gateway\": \"::\", \"ports\": [\"em1\"]}}, \"bridges\": {\"ovirtmgmt\": {\"addr\": \"192.168.1.10\"," ) + " \"cfg\": {\"DEFROUTE\": \"yes\", \"IPADDR\": \"192.168.1.10\", \"GATEWAY\": \"192.168.1.1\", \"DELAY\": \"0\", \"NM_CONTROLLED\":" ) + " \"no\", \"NETMASK\": \"255.255.255.0\", \"BOOTPROTO\": \"none\", \"STP\": \"no\", \"DEVICE\": \"ovirtmgmt\", \"TYPE\": \"Bridge\"," ) + " \"ONBOOT\": \"yes\"}, \"ipv6addrs\": [\"fe80::baca:3aff:fea9:77e2/64\"], \"mtu\": \"1500\", \"netmask\": \"255.255.255.0\", " ) + "\"stp\": \"off\", \"ipv6gateway\": \"::\", \"gateway\": \"192.168.1.1\", \"ports\": [\"em1\"]}}, \"uuid\": \"4C4C4544-0046-4E10-8032-B2C04F385A31\"," ) + " \"nics\": {\"em1\": {\"netmask\": \"\", \"addr\": \"\", \"hwaddr\": \"b8:ca:3a:a9:77:e2\", \"cfg\": {\"BRIDGE\": \"ovirtmgmt\", \"NM_CONTROLLED\":" ) + " \"no\", \"HWADDR\": \"b8:ca:3a:a9:77:e2\", \"STP\": \"no\", \"DEVICE\": \"em1\", \"ONBOOT\": \"yes\"}, \"ipv6addrs\": [\"fe80::baca:3aff:fea9:77e2/64\"]," ) + " \"speed\": 100, \"mtu\": \"1500\"}}, \"software_revision\": \"163\", \"clusterLevels\": [\"3.0\", \"3.1\", \"3.2\", \"3.3\"], \"cpuFlags\": " ) + "\"fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,rdtscp,lm,constant_" ) + "tsc,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,aperfmperf,eagerfpu,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,smx,est,tm2,ssse3,cx16,xtpr,pdcm," ) + "pcid,sse4_1,sse4_2,x2apic,popcnt,tsc_deadline_timer,aes,xsave,avx,f16c,rdrand,lahf_lm,ida,arat,epb,xsaveopt,pln,pts,dtherm,tpr_shadow,vnmi,flexpriority,ept," ) + "vpid,fsgsbase,smep,erms,model_Nehalem,model_Conroe,model_coreduo,model_core2duo,model_Penryn,model_Westmere,model_n270,model_SandyBridge\", \"ISCSIInitiatorName\"" ) + ": \"iqn.1994-05.com.redhat:d990cf85cdeb\", \"netConfigDirty\": \"False\", \"supportedENGINEs\": [\"3.0\", \"3.1\", \"3.2\", \"3.3\"], \"reservedMem\": \"321\"," ) + " \"bondings\": {\"bond0\": {\"netmask\": \"\", \"addr\": \"\", \"slaves\": [], \"hwaddr\": \"6e:31:40:a3:e3:d7\", \"cfg\": {}, \"ipv6addrs\": [], \"mtu\": \"1500\"}}," ) + " \"software_version\": \"4.13\", \"memSize\": \"15937\", \"cpuSpeed\": \"3400.000\", \"version_name\": \"Snow Man\", \"vlans\": {}, \"cpuCores\": \"4\", \"kvmEnabled\":" ) + " \"true\", \"guestOverhead\": \"65\", \"cpuThreads\": \"8\", \"emulatedMachines\": [\"pc\", \"q35\", \"isapc\", \"pc-0.10\", \"pc-0.11\", \"pc-0.12\", \"pc-0.13\", " ) + "\"pc-0.14\", \"pc-0.15\", \"pc-1.0\", \"pc-1.1\", \"pc-1.2\", \"pc-1.3\", \"none\"], \"operatingSystem\": {\"release\": \"4\", \"version\": \"19\", \"name\": \"Fedora\"}}}" ) ; org.codehaus.jackson.map.ObjectMapper mapper = new org.codehaus.jackson.map.ObjectMapper ( ) ; org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse response = org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse.fromJsonNode ( mapper.readTree ( capabilitiesJson ) ) ; java.util.concurrent.Future < org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse > future = org.mockito.Mockito.mock ( java.util.concurrent.Future.class ) ; org.mockito.Mockito.when ( future.get ( ) ) . thenReturn ( response ) ; org.ovirt.vdsm.jsonrpc.client.JsonRpcClient client = org.mockito.Mockito.mock ( org.ovirt.vdsm.jsonrpc.client.JsonRpcClient.class ) ; org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = org.mockito.Mockito.mock ( org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest.class ) ; org.mockito.Mockito.when ( client.call ( request ) ) . thenReturn ( future ) ; java.util.Map < java.lang.String , java.lang.Object > map = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( client , request ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.VDSInfoReturnForXmlRpc vdsInfo = new org.ovirt.engine.core.vdsbroker.vdsbroker.VDSInfoReturnForXmlRpc ( map ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusForXmlRpc status = vdsInfo.mStatus ; junit.framework.Assert.assertEquals ( "Done" , status.mMessage ) ; junit.framework.Assert.assertEquals ( 0 , status.mCode ) ; java.util.Map < java.lang.String , java.lang.Object > info = vdsInfo.mInfo ; junit.framework.Assert.assertTrue ( ( ! ( info.isEmpty ( ) ) ) ) ; java.util.Map < java.lang.String , java.lang.Object > bonds = ( ( java.util.Map < java.lang.String , java.lang.Object > ) ( info.get ( "bondings" ) ) ) ; for ( java.util.Map.Entry < java.lang.String , java.lang.Object > entry : bonds.entrySet ( ) ) { java.util.Map < java.lang.String , java.lang.Object > bond = ( ( java.util.Map < java.lang.String , java.lang.Object > ) ( entry.getValue ( ) ) ) ; junit.framework.Assert.assertEquals ( 0 , ( ( java.lang.Object [ ] ) ( bond.get ( "slaves" ) ) ) . length ) ; } }

Target:
public void testGetCapabilities ( ) throws java.io.IOException , java.lang.InterruptedException , java.util.concurrent.ExecutionException , java.util.concurrent.TimeoutException , org.codehaus.jackson.JsonParseException , org.codehaus.jackson.map.JsonMappingException , org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { java.lang.String capabilitiesJson = "{\"jsonrpc\": \"2.0\", \"id\": \"aed1feb4-42cf-4bf4-8ddf-852251152b68\", \"result\": {\"HBAInventory\": {\"iSCSI\": " + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "[{\"InitiatorName\": \"iqn.1994-05.com.redhat:d990cf85cdeb\"}], \"FC\": []}, \"packages2\": {\"kernel\": {\"release\": \"200.fc19.x86_64\"," + " \"buildtime\": 1384356599.0, \"version\": \"3.11.8\"}, \"spice-server\": {\"release\": \"3.fc19\", \"buildtime\": 1383130020, " ) + "\"version\": \"0.12.4\"}, \"vdsm\": {\"release\": \"163.git9adad51.fc19\", \"buildtime\": 1385064768, \"version\": \"4.13.0\"}, " ) + "\"qemu-kvm\": {\"release\": \"13.fc19\", \"buildtime\": 1383700301, \"version\": \"1.4.2\"}, \"libvirt\": {\"release\": " ) + "\"1.fc19\", \"buildtime\": 1383765188, \"version\": \"1.0.5.7\"}, \"qemu-img\": {\"release\": \"13.fc19\", \"buildtime\": " ) + "1383700301, \"version\": \"1.4.2\"}, \"mom\": {\"release\": \"3.13.giteb3985f.fc19\", \"buildtime\": 1384283536, \"version\"" ) + ": \"0.3.2\"}}, \"cpuModel\": \"Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz\", \"hooks\": {}, \"cpuSockets\": \"1\", \"vmTypes\": " ) + "[\"kvm\"], \"supportedProtocols\": [\"2.2\", \"2.3\"], \"networks\": {\"ovirtmgmt\": {\"iface\": \"ovirtmgmt\", \"addr\":" ) + " \"192.168.1.10\", \"cfg\": {\"DEFROUTE\": \"yes\", \"IPADDR\": \"192.168.1.10\", \"GATEWAY\": \"192.168.1.1\", \"DELAY\":" ) + " \"0\", \"NM_CONTROLLED\": \"no\", \"NETMASK\": \"255.255.255.0\", \"BOOTPROTO\": \"none\", \"STP\": \"no\", \"DEVICE\": " ) + "\"ovirtmgmt\", \"TYPE\": \"Bridge\", \"ONBOOT\": \"yes\"}, \"ipv6addrs\": [\"fe80::baca:3aff:fea9:77e2/64\"], \"gateway\":" ) + " \"192.168.1.1\", \"netmask\": \"255.255.255.0\", \"stp\": \"off\", \"bridged\": true, \"qosInbound\": \"\", \"qosOutbound\":" ) + " \"\", \"mtu\": \"1500\", \"ipv6gateway\": \"::\", \"ports\": [\"em1\"]}}, \"bridges\": {\"ovirtmgmt\": {\"addr\": \"192.168.1.10\"," ) + " \"cfg\": {\"DEFROUTE\": \"yes\", \"IPADDR\": \"192.168.1.10\", \"GATEWAY\": \"192.168.1.1\", \"DELAY\": \"0\", \"NM_CONTROLLED\":" ) + " \"no\", \"NETMASK\": \"255.255.255.0\", \"BOOTPROTO\": \"none\", \"STP\": \"no\", \"DEVICE\": \"ovirtmgmt\", \"TYPE\": \"Bridge\"," ) + " \"ONBOOT\": \"yes\"}, \"ipv6addrs\": [\"fe80::baca:3aff:fea9:77e2/64\"], \"mtu\": \"1500\", \"netmask\": \"255.255.255.0\", " ) + "\"stp\": \"off\", \"ipv6gateway\": \"::\", \"gateway\": \"192.168.1.1\", \"ports\": [\"em1\"]}}, \"uuid\": \"4C4C4544-0046-4E10-8032-B2C04F385A31\"," ) + " \"nics\": {\"em1\": {\"netmask\": \"\", \"addr\": \"\", \"hwaddr\": \"b8:ca:3a:a9:77:e2\", \"cfg\": {\"BRIDGE\": \"ovirtmgmt\", \"NM_CONTROLLED\":" ) + " \"no\", \"HWADDR\": \"b8:ca:3a:a9:77:e2\", \"STP\": \"no\", \"DEVICE\": \"em1\", \"ONBOOT\": \"yes\"}, \"ipv6addrs\": [\"fe80::baca:3aff:fea9:77e2/64\"]," ) + " \"speed\": 100, \"mtu\": \"1500\"}}, \"software_revision\": \"163\", \"clusterLevels\": [\"3.0\", \"3.1\", \"3.2\", \"3.3\"], \"cpuFlags\": " ) + "\"fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,rdtscp,lm,constant_" ) + "tsc,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,aperfmperf,eagerfpu,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,smx,est,tm2,ssse3,cx16,xtpr,pdcm," ) + "pcid,sse4_1,sse4_2,x2apic,popcnt,tsc_deadline_timer,aes,xsave,avx,f16c,rdrand,lahf_lm,ida,arat,epb,xsaveopt,pln,pts,dtherm,tpr_shadow,vnmi,flexpriority,ept," ) + "vpid,fsgsbase,smep,erms,model_Nehalem,model_Conroe,model_coreduo,model_core2duo,model_Penryn,model_Westmere,model_n270,model_SandyBridge\", \"ISCSIInitiatorName\"" ) + ": \"iqn.1994-05.com.redhat:d990cf85cdeb\", \"netConfigDirty\": \"False\", \"supportedENGINEs\": [\"3.0\", \"3.1\", \"3.2\", \"3.3\"], \"reservedMem\": \"321\"," ) + " \"bondings\": {\"bond0\": {\"netmask\": \"\", \"addr\": \"\", \"slaves\": [], \"hwaddr\": \"6e:31:40:a3:e3:d7\", \"cfg\": {}, \"ipv6addrs\": [], \"mtu\": \"1500\"}}," ) + " \"software_version\": \"4.13\", \"memSize\": \"15937\", \"cpuSpeed\": \"3400.000\", \"version_name\": \"Snow Man\", \"vlans\": {}, \"cpuCores\": \"4\", \"kvmEnabled\":" ) + " \"true\", \"guestOverhead\": \"65\", \"cpuThreads\": \"8\", \"emulatedMachines\": [\"pc\", \"q35\", \"isapc\", \"pc-0.10\", \"pc-0.11\", \"pc-0.12\", \"pc-0.13\", " ) + "\"pc-0.14\", \"pc-0.15\", \"pc-1.0\", \"pc-1.1\", \"pc-1.2\", \"pc-1.3\", \"none\"], \"operatingSystem\": {\"release\": \"4\", \"version\": \"19\", \"name\": \"Fedora\"}}}" ) ; org.codehaus.jackson.map.ObjectMapper mapper = new org.codehaus.jackson.map.ObjectMapper ( ) ; org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse response = org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse.fromJsonNode ( mapper.readTree ( capabilitiesJson ) ) ; java.util.concurrent.Future < org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse > future = org.mockito.Mockito.mock ( java.util.concurrent.Future.class ) ; org.mockito.Mockito.when ( future.get ( ) ) . thenReturn ( response ) ; org.ovirt.vdsm.jsonrpc.client.JsonRpcClient client = org.mockito.Mockito.mock ( org.ovirt.vdsm.jsonrpc.client.JsonRpcClient.class ) ; org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = org.mockito.Mockito.mock ( org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest.class ) ; org.mockito.Mockito.when ( client.call ( request ) ) . thenReturn ( future ) ; java.util.Map < java.lang.String , java.lang.Object > map = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( client , request ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.VDSInfoReturnForXmlRpc vdsInfo = new org.ovirt.engine.core.vdsbroker.vdsbroker.VDSInfoReturnForXmlRpc ( map ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusForXmlRpc status = vdsInfo.mStatus ; org.junit.Assert.assertEquals ( "Done" , status.mMessage ) ; org.junit.Assert.assertEquals ( 0 , status.mCode ) ; java.util.Map < java.lang.String , java.lang.Object > info = vdsInfo.mInfo ; org.junit.Assert.assertTrue ( ( ! ( info.isEmpty ( ) ) ) ) ; java.util.Map < java.lang.String , java.lang.Object > bonds = ( ( java.util.Map < java.lang.String , java.lang.Object > ) ( info.get ( "bondings" ) ) ) ; for ( java.util.Map.Entry < java.lang.String , java.lang.Object > entry : bonds.entrySet ( ) ) { java.util.Map < java.lang.String , java.lang.Object > bond = ( ( java.util.Map < java.lang.String , java.lang.Object > ) ( entry.getValue ( ) ) ) ; org.junit.Assert.assertEquals ( 0 , ( ( java.lang.Object [ ] ) ( bond.get ( "slaves" ) ) ) . length ) ; } }