private void createTestEnvironment() throws Throwable {
      ZookeeperClientFactory zkFactory = mock(ZookeeperClientFactory.class);
      sourceEnvironment =
          new TestEnvironment.Builder()
              .listeningExecutorService(listeningExecutorService)
              .apiClientFactory(apiClientFactory)
              .cloudServerSet(sourceCloudStore.getServerSet())
              .hostCount(1)
              .build();

      destinationEnvironment =
          new TestEnvironment.Builder()
              .hostCount(1)
              .apiClientFactory(apiClientFactory)
              .cloudServerSet(destinationCloudStore.getServerSet())
              .httpFileServiceClientFactory(httpFileServiceClientFactory)
              .zookeeperServersetBuilderFactory(zkFactory)
              .build();

      ZookeeperClient zkBuilder = mock(ZookeeperClient.class);
      doReturn(zkBuilder).when(zkFactory).create();
      doReturn(
              Collections.singleton(
                  new InetSocketAddress(
                      "127.0.0.1", sourceEnvironment.getHosts()[0].getState().httpPort)))
          .when(zkBuilder)
          .getServers(Matchers.startsWith("127.0.0.1:2181"), eq("cloudstore"));

      ServiceHost sourceHost = sourceEnvironment.getHosts()[0];
      startState.sourceLoadBalancerAddress = sourceHost.getPublicUri().toString();

      TestHelper.createHostService(sourceCloudStore, Collections.singleton(UsageTag.MGMT.name()));
      TestHelper.createHostService(sourceCloudStore, Collections.singleton(UsageTag.CLOUD.name()));
      DeploymentService.State deploymentService =
          TestHelper.createDeploymentService(destinationCloudStore);
      startState.destinationDeploymentId =
          ServiceUtils.getIDFromDocumentSelfLink(deploymentService.documentSelfLink);
    }
  @Override
  public ServiceHost start() throws Throwable {
    super.start();
    startDefaultCoreServicesSynchronously();

    // Start all the factories
    ServiceHostUtils.startServices(this, FACTORY_SERVICES);

    // Kick start the special services
    startImageCleanerTriggerService();
    startTaskSchedulerServices();

    return this;
  }