// Path: coopr-server/src/main/java/co/cask/coopr/spec/plugin/AutomatorType.java
// public class AutomatorType extends AbstractPluginSpecification {
// 
//   private AutomatorType(BaseEntity.Builder baseBuilder,
//                         Map<ParameterType, ParametersSpecification> parameters,
//                         Map<String, ResourceTypeSpecification> resourceTypes) {
//     super(baseBuilder, parameters, resourceTypes);
//   }
// 
//   /**
//    * Get a builder for creating automator types.
//    *
//    * @return builder for creating automator types
//    */
//   public static Builder builder() {
//     return new Builder();
//   }
// 
//   /**
//    * Builder for creating automator types.
//    */
//   public static class Builder extends AbstractPluginSpecification.Builder<AutomatorType> {
//     @Override
//     public AutomatorType build() {
//       return new AutomatorType(this, parameters, resourceTypes);
//     }
//   }
// }


import co.cask.common.http.exception.HttpFailureException;
import co.cask.coopr.client.ClientManager;
import co.cask.coopr.client.PluginClient;
import co.cask.coopr.client.rest.handler.PluginTestConstants;
import co.cask.coopr.client.rest.handler.PluginTestHandler;
import co.cask.coopr.provisioner.plugin.ResourceMeta;
import co.cask.coopr.provisioner.plugin.ResourceStatus;
import co.cask.coopr.spec.plugin.AutomatorType;
import co.cask.coopr.spec.plugin.ProviderType;
import co.cask.http.NettyHttpService;
import com.google.common.collect.ImmutableSet;
import org.apache.http.HttpStatus;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
    PluginTestHandler handler = new PluginTestHandler();
    NettyHttpService.Builder builder = NettyHttpService.builder();
    builder.addHttpHandlers(ImmutableSet.of(handler));

    builder.setHost("localhost");
    builder.setPort(0);

    builder.setConnectionBacklog(200);
    builder.setExecThreadPoolSize(10);
    builder.setBossThreadPoolSize(1);
    builder.setWorkerThreadPoolSize(1);
    httpService = builder.build();
    httpService.startAndWait();

    int testServerPort = httpService.getBindAddress().getPort();
    String testServerHost = httpService.getBindAddress().getHostName();
    clientManager = new RestClientManager(RestClientConnectionConfig.builder(testServerHost, testServerPort)
                    .userId(PluginTestConstants.TEST_USER_ID)
                    .tenantId(PluginTestConstants.TEST_TENANT_ID).build());
    pluginRestClient = clientManager.getPluginClient();

  }

  @AfterClass
  public static void cleanupTestClass() {
    httpService.stopAndWait();
  }

  @Test
  public void getAllAutomatorTypesSuccessTest() throws IOException {
// Path: coopr-server/src/main/java/co/cask/coopr/spec/plugin/AutomatorType.java
// public class AutomatorType extends AbstractPluginSpecification {
// 
//   private AutomatorType(BaseEntity.Builder baseBuilder,
//                         Map<ParameterType, ParametersSpecification> parameters,
//                         Map<String, ResourceTypeSpecification> resourceTypes) {
//     super(baseBuilder, parameters, resourceTypes);
//   }
// 
//   /**
//    * Get a builder for creating automator types.
//    *
//    * @return builder for creating automator types
//    */
//   public static Builder builder() {
//     return new Builder();
//   }
// 
//   /**
//    * Builder for creating automator types.
//    */
//   public static class Builder extends AbstractPluginSpecification.Builder<AutomatorType> {
//     @Override
//     public AutomatorType build() {
//       return new AutomatorType(this, parameters, resourceTypes);
//     }
//   }
// }


// Path: coopr-rest-client/src/test/java/co/cask/coopr/client/rest/PluginRestTest.java
import co.cask.common.http.exception.HttpFailureException;
import co.cask.coopr.client.ClientManager;
import co.cask.coopr.client.PluginClient;
import co.cask.coopr.client.rest.handler.PluginTestConstants;
import co.cask.coopr.client.rest.handler.PluginTestHandler;
import co.cask.coopr.provisioner.plugin.ResourceMeta;
import co.cask.coopr.provisioner.plugin.ResourceStatus;
import co.cask.coopr.spec.plugin.AutomatorType;
import co.cask.coopr.spec.plugin.ProviderType;
import co.cask.http.NettyHttpService;
import com.google.common.collect.ImmutableSet;
import org.apache.http.HttpStatus;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

    PluginTestHandler handler = new PluginTestHandler();
    NettyHttpService.Builder builder = NettyHttpService.builder();
    builder.addHttpHandlers(ImmutableSet.of(handler));

    builder.setHost("localhost");
    builder.setPort(0);

    builder.setConnectionBacklog(200);
    builder.setExecThreadPoolSize(10);
    builder.setBossThreadPoolSize(1);
    builder.setWorkerThreadPoolSize(1);
    httpService = builder.build();
    httpService.startAndWait();

    int testServerPort = httpService.getBindAddress().getPort();
    String testServerHost = httpService.getBindAddress().getHostName();
    clientManager = new RestClientManager(RestClientConnectionConfig.builder(testServerHost, testServerPort)
                    .userId(PluginTestConstants.TEST_USER_ID)
                    .tenantId(PluginTestConstants.TEST_TENANT_ID).build());
    pluginRestClient = clientManager.getPluginClient();

  }

  @AfterClass
  public static void cleanupTestClass() {
    httpService.stopAndWait();
  }

  @Test
  public void getAllAutomatorTypesSuccessTest() throws IOException {
    List<AutomatorType> allAutomatorTypes = pluginRestClient.getAllAutomatorTypes();