// Path: src/test/java/org/jenkinsci/plugins/mesos/fixture/AgentSpecMother.java
// public class AgentSpecMother {
// 
//   public static final MesosAgentSpecTemplate simple =
//       new MesosAgentSpecTemplate(
//           "label",
//           Mode.EXCLUSIVE,
//           "0.1",
//           "32",
//           1,
//           1,
//           1,
//           "0",
//           "",
//           "",
//           Collections.emptyList(),
//           null,
//           null,
//           null);
// 
//   public static final MesosAgentSpecTemplate docker =
//       new MesosAgentSpecTemplate(
//           "label",
//           Mode.EXCLUSIVE,
//           "0.5",
//           "512",
//           3,
//           1,
//           1,
//           "1",
//           "",
//           "",
//           Collections.emptyList(),
//           new ContainerInfo(
//               "DOCKER",
//               "jeschkies/jenkins-simple-agent:testing",
//               false,
//               false,
//               true,
//               Collections.emptyList(),
//               Network.HOST),
//           null,
//           null);
// }


import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
import akka.actor.ActorSystem;
import akka.stream.ActorMaterializer;
import com.mesosphere.utils.mesos.MesosClusterExtension;
import com.mesosphere.utils.zookeeper.ZookeeperServerExtension;
import hudson.model.Slave;
import hudson.slaves.SlaveComputer;
import java.time.Duration;
import java.util.Collections;
import java.util.concurrent.*;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.mesos.*;
import org.jenkinsci.plugins.mesos.fixture.AgentSpecMother;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;
package org.jenkinsci.plugins.mesos.integration;



@ExtendWith(TestUtils.JenkinsParameterResolver.class)
@IntegrationTest
public class MesosJenkinsAgentLifecycleTest {

  @RegisterExtension static ZookeeperServerExtension zkServer = new ZookeeperServerExtension();

  static ActorSystem system = ActorSystem.create("mesos-scheduler-test");
  static ActorMaterializer materializer = ActorMaterializer.create(system);

  @RegisterExtension
  static MesosClusterExtension mesosCluster =
      MesosClusterExtension.builder()
          .withMesosMasterUrl(String.format("zk://%s/mesos", zkServer.getConnectionUrl()))
          .withLogPrefix(MesosJenkinsAgentLifecycleTest.class.getCanonicalName())
          .build(system, materializer);

  @Test
  public void testAgentLifecycle(TestUtils.JenkinsRule j) throws Exception {
    MesosCloud cloud =
        new MesosCloud(
            mesosCluster.getMesosUrl().toString(),
            "MesosTest",
            null,
            "*",
            System.getProperty("user.name"),
            j.getURL().toString(),
            Collections.emptyList());

    final String name = "jenkins-lifecycle";
// Path: src/test/java/org/jenkinsci/plugins/mesos/fixture/AgentSpecMother.java
// public class AgentSpecMother {
// 
//   public static final MesosAgentSpecTemplate simple =
//       new MesosAgentSpecTemplate(
//           "label",
//           Mode.EXCLUSIVE,
//           "0.1",
//           "32",
//           1,
//           1,
//           1,
//           "0",
//           "",
//           "",
//           Collections.emptyList(),
//           null,
//           null,
//           null);
// 
//   public static final MesosAgentSpecTemplate docker =
//       new MesosAgentSpecTemplate(
//           "label",
//           Mode.EXCLUSIVE,
//           "0.5",
//           "512",
//           3,
//           1,
//           1,
//           "1",
//           "",
//           "",
//           Collections.emptyList(),
//           new ContainerInfo(
//               "DOCKER",
//               "jeschkies/jenkins-simple-agent:testing",
//               false,
//               false,
//               true,
//               Collections.emptyList(),
//               Network.HOST),
//           null,
//           null);
// }


// Path: src/test/java/org/jenkinsci/plugins/mesos/integration/MesosJenkinsAgentLifecycleTest.java
import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
import akka.actor.ActorSystem;
import akka.stream.ActorMaterializer;
import com.mesosphere.utils.mesos.MesosClusterExtension;
import com.mesosphere.utils.zookeeper.ZookeeperServerExtension;
import hudson.model.Slave;
import hudson.slaves.SlaveComputer;
import java.time.Duration;
import java.util.Collections;
import java.util.concurrent.*;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.mesos.*;
import org.jenkinsci.plugins.mesos.fixture.AgentSpecMother;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;

package org.jenkinsci.plugins.mesos.integration;



@ExtendWith(TestUtils.JenkinsParameterResolver.class)
@IntegrationTest
public class MesosJenkinsAgentLifecycleTest {

  @RegisterExtension static ZookeeperServerExtension zkServer = new ZookeeperServerExtension();

  static ActorSystem system = ActorSystem.create("mesos-scheduler-test");
  static ActorMaterializer materializer = ActorMaterializer.create(system);

  @RegisterExtension
  static MesosClusterExtension mesosCluster =
      MesosClusterExtension.builder()
          .withMesosMasterUrl(String.format("zk://%s/mesos", zkServer.getConnectionUrl()))
          .withLogPrefix(MesosJenkinsAgentLifecycleTest.class.getCanonicalName())
          .build(system, materializer);

  @Test
  public void testAgentLifecycle(TestUtils.JenkinsRule j) throws Exception {
    MesosCloud cloud =
        new MesosCloud(
            mesosCluster.getMesosUrl().toString(),
            "MesosTest",
            null,
            "*",
            System.getProperty("user.name"),
            j.getURL().toString(),
            Collections.emptyList());

    final String name = "jenkins-lifecycle";
    final MesosAgentSpecTemplate spec = AgentSpecMother.simple;