// Path: cloud-vmware-server/src/test/java/jetbrains/buildServer/clouds/vmware/stubs/FakeModel.java
// public static final ThreadFactory FAKE_MODEL_THREAD_FACTORY = r -> {
//   Thread th = new Thread(r);
//   th.setDaemon(true);
//   return th;
// };


import com.vmware.vim25.*;
import com.vmware.vim25.mo.*;
import java.rmi.RemoteException;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import jetbrains.buildServer.serverSide.TeamCityProperties;
import org.jetbrains.annotations.NotNull;
import static jetbrains.buildServer.clouds.vmware.stubs.FakeModel.FAKE_MODEL_THREAD_FACTORY;
  private static final Random RANDOM = new Random();

  public FakeVirtualMachine(final String name, final boolean isTemplate, final boolean isRunning) {
    super(null, createVMMor(name));
    myName = name;
    updateVersion();
    myIsStarted.set(isRunning);
    myConfigInfoRef.set(new VirtualMachineConfigInfo(){
      @Override
      public String getName() {
        return myName;
      }

      @Override
      public boolean isTemplate() {
        return isTemplate;
      }

      @Override
      public String getChangeVersion() {
        return myVersion;
      }

      @Override
      public OptionValue[] getExtraConfig() {
        final OptionValue[] retval = new OptionValue[myCustomUserData.size()];
        int i=0;
        for (final Map.Entry<String, String> entry : myCustomUserData.entrySet()) {
          retval[i] = new OptionValue();
          retval[i].setKey(entry.getKey());
// Path: cloud-vmware-server/src/test/java/jetbrains/buildServer/clouds/vmware/stubs/FakeModel.java
// public static final ThreadFactory FAKE_MODEL_THREAD_FACTORY = r -> {
//   Thread th = new Thread(r);
//   th.setDaemon(true);
//   return th;
// };


// Path: cloud-vmware-server/src/test/java/jetbrains/buildServer/clouds/vmware/stubs/FakeVirtualMachine.java
import com.vmware.vim25.*;
import com.vmware.vim25.mo.*;
import java.rmi.RemoteException;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import jetbrains.buildServer.serverSide.TeamCityProperties;
import org.jetbrains.annotations.NotNull;
import static jetbrains.buildServer.clouds.vmware.stubs.FakeModel.FAKE_MODEL_THREAD_FACTORY;

  private static final Random RANDOM = new Random();

  public FakeVirtualMachine(final String name, final boolean isTemplate, final boolean isRunning) {
    super(null, createVMMor(name));
    myName = name;
    updateVersion();
    myIsStarted.set(isRunning);
    myConfigInfoRef.set(new VirtualMachineConfigInfo(){
      @Override
      public String getName() {
        return myName;
      }

      @Override
      public boolean isTemplate() {
        return isTemplate;
      }

      @Override
      public String getChangeVersion() {
        return myVersion;
      }

      @Override
      public OptionValue[] getExtraConfig() {
        final OptionValue[] retval = new OptionValue[myCustomUserData.size()];
        int i=0;
        for (final Map.Entry<String, String> entry : myCustomUserData.entrySet()) {
          retval[i] = new OptionValue();
          retval[i].setKey(entry.getKey());
          retval[i++].setValue(entry.getValue());