// Path: spydra/src/main/java/com/spotify/spydra/submitter/api/PoolingSubmitter.java
// public static final String SPYDRA_PLACEMENT_TOKEN_LABEL = "spydra-placement-token";
// 
// Path: api/src/main/java/com/spotify/spydra/api/model/Cluster.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class Cluster {
// 
//   @JsonIgnoreProperties(ignoreUnknown = true)
//   public static class Status {
// 
//     public static final String ERROR = "ERROR";
//     public static final String CREATING = "CREATING";
//     public static final String RUNNING = "RUNNING";
//     public String state;
//     public ZonedDateTime stateStartTime;
//   }
// 
//   public Status status;
// 
//   @JsonIgnoreProperties(ignoreUnknown = true)
//   public static class Config {
// 
//     @JsonIgnoreProperties(ignoreUnknown = true)
//     public static class GceClusterConfig {
// 
//       @JsonIgnoreProperties(ignoreUnknown = true)
//       public static class Metadata {
// 
//         // This is the initial heartbeat of the cluster. It is not updated.
//         // Look at the MasterConfig.instanceNames[0] for updated heartbeats
//         public Optional<ZonedDateTime> heartbeat = Optional.empty();
//       }
// 
//       public Metadata metadata = new Metadata();
//       public String zoneUri; // Even though this is an Uri-string, --zone takes it just fine
//     }
// 
//     @JsonIgnoreProperties(ignoreUnknown = true)
//     public static class MasterConfig {
// 
//       public List<String> instanceNames = Collections.emptyList();
//     }
// 
//     public MasterConfig masterConfig = new MasterConfig();
//     public GceClusterConfig gceClusterConfig = new GceClusterConfig();
//   }
// 
//   public Config config = new Config();
// 
//   public String clusterName;
// 
//   public Map<String, String> labels;
// 
//   //TODO: TW Look at the `metrics` for the cluster
//   //TODO: TW look at labels to see if it is a spydra created cluster?
// }
// 
// Path: common/src/main/java/com/spotify/spydra/model/SpydraArgument.java
// public static class Pooling {
//   public Optional<Integer> limit;
//   public Optional<Duration> maxAge;
// 
//   public Integer getLimit() {
//     return limit.get();
//   }
// 
//   public void setLimit(Integer limit) {
//     this.limit = Optional.of(limit);
//   }
// 
//   public Duration getMaxAge() {
//     return maxAge.get();
//   }
// 
//   public void setMaxAge(Duration maxAge) {
//     this.maxAge = Optional.of(maxAge);
//   }
// 
// }


import com.spotify.spydra.model.SpydraArgument.Pooling;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import static com.spotify.spydra.submitter.api.PoolingSubmitter.SPYDRA_PLACEMENT_TOKEN_LABEL;
import static junit.framework.TestCase.assertTrue;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsCollectionContaining.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import com.spotify.spydra.api.model.Cluster;
    assertThat(all, hasSize(3));
    assertThat(all, hasItems(
        new ClusterPlacementBuilder().clusterNumber(0).clusterGeneration(2).build(),
        new ClusterPlacementBuilder().clusterNumber(1).clusterGeneration(1).build(),
        new ClusterPlacementBuilder().clusterNumber(2).clusterGeneration(1).build()));
  }

  @Test
  public void testFrom() {
    ClusterPlacement clusterPlacement = ClusterPlacement.from("10-15");
    assertThat(clusterPlacement.clusterNumber(), is(10));
    assertThat(clusterPlacement.clusterGeneration(), is(15L));
  }

  @Test
  public void testToken() {
    final ClusterPlacement clusterPlacement =
        new ClusterPlacementBuilder().clusterNumber(10).clusterGeneration(15L).build();
    assertThat(clusterPlacement.token(), is("10-15"));
  }

  @Test
  public void testFilterClusters() {

    final List<ClusterPlacement> clusterPlacements =
        Arrays.asList(new ClusterPlacementBuilder().clusterNumber(0).clusterGeneration(1).build(),
            new ClusterPlacementBuilder().clusterNumber(1).clusterGeneration(1).build(),
            new ClusterPlacementBuilder().clusterNumber(2).clusterGeneration(0).build());

    final Cluster cluster1 = new Cluster();
// Path: spydra/src/main/java/com/spotify/spydra/submitter/api/PoolingSubmitter.java
// public static final String SPYDRA_PLACEMENT_TOKEN_LABEL = "spydra-placement-token";
// 
// Path: api/src/main/java/com/spotify/spydra/api/model/Cluster.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class Cluster {
// 
//   @JsonIgnoreProperties(ignoreUnknown = true)
//   public static class Status {
// 
//     public static final String ERROR = "ERROR";
//     public static final String CREATING = "CREATING";
//     public static final String RUNNING = "RUNNING";
//     public String state;
//     public ZonedDateTime stateStartTime;
//   }
// 
//   public Status status;
// 
//   @JsonIgnoreProperties(ignoreUnknown = true)
//   public static class Config {
// 
//     @JsonIgnoreProperties(ignoreUnknown = true)
//     public static class GceClusterConfig {
// 
//       @JsonIgnoreProperties(ignoreUnknown = true)
//       public static class Metadata {
// 
//         // This is the initial heartbeat of the cluster. It is not updated.
//         // Look at the MasterConfig.instanceNames[0] for updated heartbeats
//         public Optional<ZonedDateTime> heartbeat = Optional.empty();
//       }
// 
//       public Metadata metadata = new Metadata();
//       public String zoneUri; // Even though this is an Uri-string, --zone takes it just fine
//     }
// 
//     @JsonIgnoreProperties(ignoreUnknown = true)
//     public static class MasterConfig {
// 
//       public List<String> instanceNames = Collections.emptyList();
//     }
// 
//     public MasterConfig masterConfig = new MasterConfig();
//     public GceClusterConfig gceClusterConfig = new GceClusterConfig();
//   }
// 
//   public Config config = new Config();
// 
//   public String clusterName;
// 
//   public Map<String, String> labels;
// 
//   //TODO: TW Look at the `metrics` for the cluster
//   //TODO: TW look at labels to see if it is a spydra created cluster?
// }
// 
// Path: common/src/main/java/com/spotify/spydra/model/SpydraArgument.java
// public static class Pooling {
//   public Optional<Integer> limit;
//   public Optional<Duration> maxAge;
// 
//   public Integer getLimit() {
//     return limit.get();
//   }
// 
//   public void setLimit(Integer limit) {
//     this.limit = Optional.of(limit);
//   }
// 
//   public Duration getMaxAge() {
//     return maxAge.get();
//   }
// 
//   public void setMaxAge(Duration maxAge) {
//     this.maxAge = Optional.of(maxAge);
//   }
// 
// }


// Path: spydra/src/test/java/com/spotify/spydra/submitter/api/ClusterPlacementTest.java
import com.spotify.spydra.model.SpydraArgument.Pooling;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import static com.spotify.spydra.submitter.api.PoolingSubmitter.SPYDRA_PLACEMENT_TOKEN_LABEL;
import static junit.framework.TestCase.assertTrue;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsCollectionContaining.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import com.spotify.spydra.api.model.Cluster;

    assertThat(all, hasSize(3));
    assertThat(all, hasItems(
        new ClusterPlacementBuilder().clusterNumber(0).clusterGeneration(2).build(),
        new ClusterPlacementBuilder().clusterNumber(1).clusterGeneration(1).build(),
        new ClusterPlacementBuilder().clusterNumber(2).clusterGeneration(1).build()));
  }

  @Test
  public void testFrom() {
    ClusterPlacement clusterPlacement = ClusterPlacement.from("10-15");
    assertThat(clusterPlacement.clusterNumber(), is(10));
    assertThat(clusterPlacement.clusterGeneration(), is(15L));
  }

  @Test
  public void testToken() {
    final ClusterPlacement clusterPlacement =
        new ClusterPlacementBuilder().clusterNumber(10).clusterGeneration(15L).build();
    assertThat(clusterPlacement.token(), is("10-15"));
  }

  @Test
  public void testFilterClusters() {

    final List<ClusterPlacement> clusterPlacements =
        Arrays.asList(new ClusterPlacementBuilder().clusterNumber(0).clusterGeneration(1).build(),
            new ClusterPlacementBuilder().clusterNumber(1).clusterGeneration(1).build(),
            new ClusterPlacementBuilder().clusterNumber(2).clusterGeneration(0).build());

    final Cluster cluster1 = new Cluster();
    cluster1.labels = Collections.singletonMap(SPYDRA_PLACEMENT_TOKEN_LABEL, "0-1");