// 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;
/*-
 * -\-\-
 * Spydra
 * --
 * Copyright (C) 2016 - 2018 Spotify AB
 * --
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * -/-/-
 */
package com.spotify.spydra.submitter.api;



public class ClusterPlacementTest {

  @Test
  public void testClustereneration() {
    // Random offset is 20 and 6 for clusterNumber 0 and 1 and age 30
    final Pooling pooling = new Pooling();
    pooling.setLimit(2);
    pooling.setMaxAge(Duration.ofSeconds(30));
// 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;

/*-
 * -\-\-
 * Spydra
 * --
 * Copyright (C) 2016 - 2018 Spotify AB
 * --
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * -/-/-
 */
package com.spotify.spydra.submitter.api;



public class ClusterPlacementTest {

  @Test
  public void testClustereneration() {
    // Random offset is 20 and 6 for clusterNumber 0 and 1 and age 30
    final Pooling pooling = new Pooling();
    pooling.setLimit(2);
    pooling.setMaxAge(Duration.ofSeconds(30));
    assertEquals(ClusterPlacement.createClusterPlacement(() -> 0L, 0, pooling)