// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/beans/ResourcePoolBean.java
// public class ResourcePoolBean implements VmwareManagedEntity, Comparable<ResourcePoolBean> {
//   private final String myName;
//   private final ManagedObjectReference myMOR;
//   private final String myPath;
//   private final ManagedObjectReference myParentRef;
//   private final String myDatacenterId;
// 
// 
//   @Used("Tests")
//   public ResourcePoolBean(final ResourcePool rp){
//     this(rp.getMOR(), rp.getName(), null, rp.getParent().getMOR(), "dc");
//   }
// 
//   public ResourcePoolBean(@NotNull final ManagedObjectReference mor,
//                           @NotNull final String name,
//                           @NotNull final String path,
//                           @Nullable final ManagedObjectReference parentRef,
//                           @Nullable final String datacenterId) {
//     myName = name;
//     myMOR = mor;
//     myPath = path;
//     myParentRef = parentRef;
//     myDatacenterId = datacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return myMOR.getVal();
//   }
// 
//   @NotNull
//   public String getName() {
//     return myName;
//   }
// 
//   @NotNull
//   @Override
//   public String getPath() {
//     return myPath;
//   }
// 
//   @Nullable
//   @Override
//   public String getDatacenterId() {
//     return myDatacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public ManagedObjectReference getMOR() {
//     return myMOR;
//   }
// 
//   @Nullable
//   @Override
//   public ManagedObjectReference getParentMOR() {
//     return myParentRef;
//   }
// 
//   @Override
//   public int compareTo(@NotNull final ResourcePoolBean o) {
//     if (myPath == null && o.myPath == null){
//       return StringUtil.compare(StringUtil.toLowerCase(myName), StringUtil.toLowerCase(o.myName));
//     }
//     return StringUtil.compare(StringUtil.toLowerCase(myPath), StringUtil.toLowerCase(o.myPath));
//   }
// }
// 
// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/errors/VmwareCheckedCloudException.java
// public class VmwareCheckedCloudException extends CheckedCloudException {
// 
//   public VmwareCheckedCloudException(final Throwable cause) {
//     super(cause.getMessage(), cause);
//   }
// 
//   public VmwareCheckedCloudException(final String message) {
//     super(message);
//   }
// 
//   public VmwareCheckedCloudException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// 
// }


import com.intellij.openapi.util.Pair;
import com.vmware.vim25.*;
import com.vmware.vim25.mo.Datacenter;
import com.vmware.vim25.mo.Folder;
import com.vmware.vim25.mo.ManagedEntity;
import com.vmware.vim25.mo.ResourcePool;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jetbrains.buildServer.BaseTestCase;
import jetbrains.buildServer.clouds.vmware.connector.beans.ResourcePoolBean;
import jetbrains.buildServer.clouds.vmware.errors.VmwareCheckedCloudException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jmock.Mockery;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
        }
        return null;
      }

      @Override
      protected <T extends ManagedEntity> T createExactManagedEntity(final ManagedObjectReference mor) {
        return (T)myEntitiesMap.get(mor.getVal());
      }

      @Override
      protected <T extends ManagedEntity> T searchManagedEntity(@NotNull final String idName,
                                                                @NotNull final Class<T> instanceType,
                                                                @Nullable final Datacenter dc) {
        return (T)myEntitiesMap.get(idName);
      }

      @Override
      protected ObjectContent[] getObjectContents(final Datacenter dc, final String[][] typeinfo) throws RemoteException {
        assert dc == myDc;
        final ObjectContent[] retval = new ObjectContent[2];
        //"ResourcePool", "name", "parent"
        ManagedObjectReference parentMOR = new ManagedObjectReference();
        parentMOR.setType("Folder");
        parentMOR.setVal("group-v1");
        retval[0] = createObjectContent("ResourcePool", "resgroup-2", Pair.create("name", "MyRespool"), Pair.create("parent", parentMOR));
        retval[1] = createObjectContent("ResourcePool", "resgroup-3", Pair.create("name", "MyRespool"), Pair.create("parent", parentMOR));
        return retval;
      }
    };

// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/beans/ResourcePoolBean.java
// public class ResourcePoolBean implements VmwareManagedEntity, Comparable<ResourcePoolBean> {
//   private final String myName;
//   private final ManagedObjectReference myMOR;
//   private final String myPath;
//   private final ManagedObjectReference myParentRef;
//   private final String myDatacenterId;
// 
// 
//   @Used("Tests")
//   public ResourcePoolBean(final ResourcePool rp){
//     this(rp.getMOR(), rp.getName(), null, rp.getParent().getMOR(), "dc");
//   }
// 
//   public ResourcePoolBean(@NotNull final ManagedObjectReference mor,
//                           @NotNull final String name,
//                           @NotNull final String path,
//                           @Nullable final ManagedObjectReference parentRef,
//                           @Nullable final String datacenterId) {
//     myName = name;
//     myMOR = mor;
//     myPath = path;
//     myParentRef = parentRef;
//     myDatacenterId = datacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return myMOR.getVal();
//   }
// 
//   @NotNull
//   public String getName() {
//     return myName;
//   }
// 
//   @NotNull
//   @Override
//   public String getPath() {
//     return myPath;
//   }
// 
//   @Nullable
//   @Override
//   public String getDatacenterId() {
//     return myDatacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public ManagedObjectReference getMOR() {
//     return myMOR;
//   }
// 
//   @Nullable
//   @Override
//   public ManagedObjectReference getParentMOR() {
//     return myParentRef;
//   }
// 
//   @Override
//   public int compareTo(@NotNull final ResourcePoolBean o) {
//     if (myPath == null && o.myPath == null){
//       return StringUtil.compare(StringUtil.toLowerCase(myName), StringUtil.toLowerCase(o.myName));
//     }
//     return StringUtil.compare(StringUtil.toLowerCase(myPath), StringUtil.toLowerCase(o.myPath));
//   }
// }
// 
// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/errors/VmwareCheckedCloudException.java
// public class VmwareCheckedCloudException extends CheckedCloudException {
// 
//   public VmwareCheckedCloudException(final Throwable cause) {
//     super(cause.getMessage(), cause);
//   }
// 
//   public VmwareCheckedCloudException(final String message) {
//     super(message);
//   }
// 
//   public VmwareCheckedCloudException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// 
// }


// Path: cloud-vmware-server/src/test/java/jetbrains/buildServer/clouds/vmware/connector/VmwareApiConnectorTest.java
import com.intellij.openapi.util.Pair;
import com.vmware.vim25.*;
import com.vmware.vim25.mo.Datacenter;
import com.vmware.vim25.mo.Folder;
import com.vmware.vim25.mo.ManagedEntity;
import com.vmware.vim25.mo.ResourcePool;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jetbrains.buildServer.BaseTestCase;
import jetbrains.buildServer.clouds.vmware.connector.beans.ResourcePoolBean;
import jetbrains.buildServer.clouds.vmware.errors.VmwareCheckedCloudException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jmock.Mockery;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

        }
        return null;
      }

      @Override
      protected <T extends ManagedEntity> T createExactManagedEntity(final ManagedObjectReference mor) {
        return (T)myEntitiesMap.get(mor.getVal());
      }

      @Override
      protected <T extends ManagedEntity> T searchManagedEntity(@NotNull final String idName,
                                                                @NotNull final Class<T> instanceType,
                                                                @Nullable final Datacenter dc) {
        return (T)myEntitiesMap.get(idName);
      }

      @Override
      protected ObjectContent[] getObjectContents(final Datacenter dc, final String[][] typeinfo) throws RemoteException {
        assert dc == myDc;
        final ObjectContent[] retval = new ObjectContent[2];
        //"ResourcePool", "name", "parent"
        ManagedObjectReference parentMOR = new ManagedObjectReference();
        parentMOR.setType("Folder");
        parentMOR.setVal("group-v1");
        retval[0] = createObjectContent("ResourcePool", "resgroup-2", Pair.create("name", "MyRespool"), Pair.create("parent", parentMOR));
        retval[1] = createObjectContent("ResourcePool", "resgroup-3", Pair.create("name", "MyRespool"), Pair.create("parent", parentMOR));
        return retval;
      }
    };

    final List<ResourcePoolBean> pools = connector.getResourcePools();