### Question:
VmwareClient { public <T extends ManagedEntity> T search(Class<T> type, String name) { return search(getRootEntity(), type, name); } VmwareClient(String url, String username, String password, boolean ignoreCert);  VmwareClient(String url, String username, String password, boolean ignoreCert, String datacenterName); void logout(); ServiceInstance getServiceInstance(); ManagedEntity getRootEntity(); T search(Class<T> type, String name); T search(ManagedEntity rootEntity, Class<T> type, String name); ManagedEntity searchByName(String name); ManagedEntity searchByName(ManagedEntity rootEntity, String name); ManagedEntity[] searchByType(Class<T> type); ManagedEntity[] searchByType(ManagedEntity rootEntity, Class<T> type); ManagedEntity[] searchAll(); ManagedEntity[] searchAll(ManagedEntity rootEntity);  }### Answer:
@Test @Ignore public void testSearch() { System.out.println("===== DataCenter ====="); ManagedEntity[] datacenters = client.searchByType(Datacenter.class); for (ManagedEntity entity : datacenters) { Datacenter datacenter = Datacenter.class.cast(entity); System.out.println(datacenter.getName()); } System.out.println("===== ComputeResource ====="); ManagedEntity[] computeResources = client.searchByType(ComputeResource.class); for (ManagedEntity entity : computeResources) { ComputeResource computeResource = ComputeResource.class.cast(entity); System.out.println(computeResource.getName()); } System.out.println("===== HostSystem ====="); ManagedEntity[] hostSystems = client.searchByType(HostSystem.class); for (ManagedEntity entity : hostSystems) { HostSystem hostSystem = HostSystem.class.cast(entity); System.out.println(hostSystem.getName()); } System.out.println("===== VirtualMachine ====="); ManagedEntity[] virtualMachines = client.searchByType(VirtualMachine.class); for (ManagedEntity entity : virtualMachines) { VirtualMachine virtualMachine = VirtualMachine.class.cast(entity); System.out.println(virtualMachine.getName()); } System.out.println("===== Datastore ====="); ManagedEntity[] datastores = client.searchByType(Datastore.class); for (ManagedEntity entity : datastores) { Datastore datastore = Datastore.class.cast(entity); System.out.println(datastore.getName()); } System.out.println("===== Network ====="); ManagedEntity[] networks = client.searchByType(Network.class); for (ManagedEntity entity : networks) { Network network = Network.class.cast(entity); System.out.println(network.getName()); } System.out.println("===== Folder ====="); ManagedEntity[] folders = client.searchByType(Folder.class); for (ManagedEntity entity : folders) { Folder folder = Folder.class.cast(entity); System.out.println(folder.getName()); } }